- Made map box scrollable.
This commit is contained in:
parent
82e6c3cfb3
commit
d15155a03c
9
INSTALL
9
INSTALL
|
@ -1,9 +0,0 @@
|
||||||
UNIX:
|
|
||||||
|
|
||||||
1. cp Makefile.whatever Makefile
|
|
||||||
2. make
|
|
||||||
3. make install
|
|
||||||
4. Add the following to your profile:
|
|
||||||
NETMAPRDIR=/usr/local/share/netmapr
|
|
||||||
export NETMAPRDIR
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
UNIX:
|
||||||
|
|
||||||
|
1. cp Makefile.whatever Makefile
|
||||||
|
2. make
|
||||||
|
3. make install
|
||||||
|
4. Add the following to your profile:
|
||||||
|
NETMAPRDIR=/usr/local/share/netmapr
|
||||||
|
export NETMAPRDIR
|
||||||
|
|
||||||
|
WINDOWS:
|
||||||
|
1. Unzip to C:\program files (or anywhere else)
|
||||||
|
2. Add the following environment variable
|
||||||
|
(my computer->properties->advanced->environment settings)
|
||||||
|
|
||||||
|
Name: NETMAPRDIR
|
||||||
|
Value: C:\program files\netmapr-1.0 (or wherever you unzipped it)
|
|
@ -4,7 +4,7 @@ netmapr: netmapr.c constants.h netmapr.h Makefile
|
||||||
install: netmapr
|
install: netmapr
|
||||||
install -C -D -o root -m 755 netmapr /usr/local/bin/netmapr
|
install -C -D -o root -m 755 netmapr /usr/local/bin/netmapr
|
||||||
ln -f /usr/local/bin/netmapr /usr/local/bin/netmapr-viewer
|
ln -f /usr/local/bin/netmapr /usr/local/bin/netmapr-viewer
|
||||||
install -C -D -o root -m 644 buttons.dat /usr/local/share/buttons.dat
|
install -C -D -o root -m 644 buttons.dat /usr/local/share/netmapr/buttons.dat
|
||||||
install -C -D -o root -m 644 objects.dat /usr/local/share/objects.dat
|
install -C -D -o root -m 644 objects.dat /usr/local/share/netmapr/objects.dat
|
||||||
install -C -D -o root -m 644 verdana.ttf /usr/local/share/verdana.ttf
|
install -C -D -o root -m 644 verdana.ttf /usr/local/share/netmapr/verdana.ttf
|
||||||
install -C -D -o root -m 644 icon.bmp /usr/local/share/icon.bmp
|
install -C -D -o root -m 644 icon.bmp /usr/local/share/netmapr/icon.bmp
|
||||||
|
|
|
@ -5,7 +5,7 @@ netmapr: netmapr.c constants.h netmapr.h Makefile
|
||||||
install: netmapr
|
install: netmapr
|
||||||
install -C -D -o root -m 755 netmapr /usr/local/bin/netmapr
|
install -C -D -o root -m 755 netmapr /usr/local/bin/netmapr
|
||||||
ln -f /usr/local/bin/netmapr /usr/local/bin/netmapr-viewer
|
ln -f /usr/local/bin/netmapr /usr/local/bin/netmapr-viewer
|
||||||
install -C -D -o root -m 644 buttons.dat /usr/local/share/buttons.dat
|
install -C -D -o root -m 644 buttons.dat /usr/local/share/netmapr/buttons.dat
|
||||||
install -C -D -o root -m 644 objects.dat /usr/local/share/objects.dat
|
install -C -D -o root -m 644 objects.dat /usr/local/share/netmapr/objects.dat
|
||||||
install -C -D -o root -m 644 verdana.ttf /usr/local/share/verdana.ttf
|
install -C -D -o root -m 644 verdana.ttf /usr/local/share/netmapr/verdana.ttf
|
||||||
install -C -D -o root -m 644 icon.bmp /usr/local/share/icon.bmp
|
install -C -D -o root -m 644 icon.bmp /usr/local/share/netmapr/icon.bmp
|
||||||
|
|
12
constants.h
12
constants.h
|
@ -1,4 +1,4 @@
|
||||||
#define VERSION "0.99e"
|
#define VERSION "1.0"
|
||||||
|
|
||||||
#define BUFLEN 512
|
#define BUFLEN 512
|
||||||
|
|
||||||
|
@ -10,10 +10,10 @@
|
||||||
#define MAXPOINTS 20
|
#define MAXPOINTS 20
|
||||||
#define MAXBUTTONS 40
|
#define MAXBUTTONS 40
|
||||||
|
|
||||||
#define MAXMAPS 20
|
#define MAXMAPS 60
|
||||||
|
|
||||||
#define MAXHISTORY 50
|
#define MAXHISTORY 50
|
||||||
#define MAXCHILDREN 10
|
#define MAXCHILDREN 30
|
||||||
|
|
||||||
#define MAXOBJTYPES 30
|
#define MAXOBJTYPES 30
|
||||||
#define MAXOBJECTS 512
|
#define MAXOBJECTS 512
|
||||||
|
@ -146,5 +146,7 @@
|
||||||
#define LA_DEST (2)
|
#define LA_DEST (2)
|
||||||
#define LA_BOTH (3)
|
#define LA_BOTH (3)
|
||||||
|
|
||||||
#define LM_ARROW ()
|
#define C_NONE (-1)
|
||||||
#define THICKNESS
|
#define C_SCROLLUP (-2)
|
||||||
|
#define C_SCROLLDOWN (-3)
|
||||||
|
|
||||||
|
|
94
netmapr.c
94
netmapr.c
|
@ -550,6 +550,8 @@ int main (int argc, char **argv) {
|
||||||
th = TTF_FontHeight(font[MAPBOXTEXTHEIGHT]);
|
th = TTF_FontHeight(font[MAPBOXTEXTHEIGHT]);
|
||||||
/* change to child */
|
/* change to child */
|
||||||
pos = (event.button.y - (mapbox.y+(th*2)+1)) / th;
|
pos = (event.button.y - (mapbox.y+(th*2)+1)) / th;
|
||||||
|
/* adjust for offset if not a special value */
|
||||||
|
pos += mapbox.offset;
|
||||||
if (pos >= numchildren) {
|
if (pos >= numchildren) {
|
||||||
sprintf(statustext, "ERROR: Invalid child map %d (max is %d).",pos,numchildren);
|
sprintf(statustext, "ERROR: Invalid child map %d (max is %d).",pos,numchildren);
|
||||||
drawstatusbar();
|
drawstatusbar();
|
||||||
|
@ -2551,7 +2553,7 @@ void drawmapbox(void) {
|
||||||
|
|
||||||
/* show .. */
|
/* show .. */
|
||||||
if (numhistory >= 1) {
|
if (numhistory >= 1) {
|
||||||
/* draw arrow */
|
/* draw back arrow */
|
||||||
drawline(screen, x+5,y+(lh/2),x+mapbox.width-15,y+(lh/2),white,1);
|
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+1,white,1);
|
||||||
drawline(screen, x+5,y+(lh/2),x+15,y+(lh-1),white,1);
|
drawline(screen, x+5,y+(lh/2),x+15,y+(lh-1),white,1);
|
||||||
|
@ -2561,7 +2563,10 @@ void drawmapbox(void) {
|
||||||
|
|
||||||
/* children ... */
|
/* children ... */
|
||||||
|
|
||||||
|
/* first generate list of children */
|
||||||
|
|
||||||
numchildren = 0;
|
numchildren = 0;
|
||||||
|
|
||||||
for (i = 0; i < map[curmap].numobjects; i++) {
|
for (i = 0; i < map[curmap].numobjects; i++) {
|
||||||
if (map[curmap].obj[i].child != -1) {
|
if (map[curmap].obj[i].child != -1) {
|
||||||
/* make sure we haven't already drawn this name */
|
/* make sure we haven't already drawn this name */
|
||||||
|
@ -2573,26 +2578,75 @@ void drawmapbox(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
sprintf(temp.text, map[map[curmap].obj[i].child].name);
|
|
||||||
//temp.x = x+DEFTEXTW;
|
|
||||||
temp.x = x;
|
|
||||||
temp.y = y;
|
|
||||||
temp.h = lh;
|
|
||||||
TTF_SizeText(font[lh], temp.text, &tw,&th);
|
|
||||||
temp.w = tw;
|
|
||||||
temp.anchor = -1;
|
|
||||||
temp.c = white;
|
|
||||||
|
|
||||||
drawtext(screen, &temp);
|
|
||||||
|
|
||||||
children[numchildren] = map[curmap].obj[i].child;
|
children[numchildren] = map[curmap].obj[i].child;
|
||||||
numchildren++;
|
numchildren++;
|
||||||
|
|
||||||
y += th;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* now draw all children, starting at mapbox.offset */
|
||||||
|
for (i = mapbox.offset; i < numchildren; i++) {
|
||||||
|
if ((i == mapbox.offset) && (mapbox.offset > 0)) {
|
||||||
|
/* replace this entry with an arrow */
|
||||||
|
children[i] = C_SCROLLUP;
|
||||||
|
/* draw an up arrow */
|
||||||
|
TTF_SizeText(font[lh], "unused", &tw,&th);
|
||||||
|
drawline(screen, x + (mapbox.width / 2)-3, y+th-4,
|
||||||
|
x + (mapbox.width / 2), y+th-7,
|
||||||
|
white, 1);
|
||||||
|
drawline(screen, x + (mapbox.width / 2)+3, y+th-4,
|
||||||
|
x + (mapbox.width / 2), y+th-7,
|
||||||
|
white, 1);
|
||||||
|
} else {
|
||||||
|
/* get its name */
|
||||||
|
sprintf(temp.text, "*Unknown*"); /* default, shouldn't actually ever be used */
|
||||||
|
for (n = 0; n < map[curmap].numobjects; n++) {
|
||||||
|
if (map[curmap].obj[n].child == children[i]) {
|
||||||
|
sprintf(temp.text, map[map[curmap].obj[n].child].name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
temp.x = x;
|
||||||
|
temp.y = y;
|
||||||
|
temp.h = lh;
|
||||||
|
TTF_SizeText(font[lh], temp.text, &tw,&th);
|
||||||
|
temp.w = tw;
|
||||||
|
temp.anchor = -1;
|
||||||
|
temp.c = white;
|
||||||
|
|
||||||
|
if (temp.y + temp.h >= (mapbox.y + mapbox.height)) {
|
||||||
|
SDL_Rect ar;
|
||||||
|
/* off the bottom of the page - replace previous item with an arrow */
|
||||||
|
|
||||||
|
printf("showing arrow\n"); fflush(stdout);
|
||||||
|
|
||||||
|
y = y - th - 1; /* go back one line */
|
||||||
|
/* clear previous text */
|
||||||
|
ar.x = x;
|
||||||
|
ar.y = y;
|
||||||
|
ar.w = mapbox.width - 3;
|
||||||
|
ar.h = th;
|
||||||
|
SDL_FillRect(screen, &ar, fillcol);
|
||||||
|
|
||||||
|
/* draw arrow */
|
||||||
|
drawline(screen, x + (mapbox.width / 2)-3, y+th-7,
|
||||||
|
x + (mapbox.width / 2), y+th-4,
|
||||||
|
white, 1);
|
||||||
|
drawline(screen, x + (mapbox.width / 2)+3, y+th-7,
|
||||||
|
x + (mapbox.width / 2), y+th-4,
|
||||||
|
white, 1);
|
||||||
|
|
||||||
|
children[i-1] = C_SCROLLDOWN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
drawtext(screen, &temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
y += th;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_UpdateRect(screen, mapbox.x, mapbox.y, screen->w - mapbox.x,mapbox.height+2);
|
SDL_UpdateRect(screen, mapbox.x, mapbox.y, screen->w - mapbox.x,mapbox.height+2);
|
||||||
//SDL_Flip(screen);
|
//SDL_Flip(screen);
|
||||||
}
|
}
|
||||||
|
@ -4589,6 +4643,7 @@ void initvars(void) {
|
||||||
mapbox.y = toolbox.y+toolbox.height+1;
|
mapbox.y = toolbox.y+toolbox.height+1;
|
||||||
mapbox.width = SIDEBARW;
|
mapbox.width = SIDEBARW;
|
||||||
mapbox.height = obox.y - mapbox.y - 20;
|
mapbox.height = obox.y - mapbox.y - 20;
|
||||||
|
mapbox.offset = 0;
|
||||||
|
|
||||||
|
|
||||||
fgcol = black;
|
fgcol = black;
|
||||||
|
@ -5768,7 +5823,8 @@ int endlinkmove(int x, int y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void drillto(int mapnum) {
|
void drillto(int mapnum) {
|
||||||
if (mapnum == -1) {
|
printf("drilling to: %d\n",mapnum);
|
||||||
|
if (mapnum == C_NONE) {
|
||||||
if (nummaps < (MAXMAPS-1)) {
|
if (nummaps < (MAXMAPS-1)) {
|
||||||
/* push current map */
|
/* push current map */
|
||||||
history[numhistory] = curmap;
|
history[numhistory] = curmap;
|
||||||
|
@ -5797,6 +5853,12 @@ void drillto(int mapnum) {
|
||||||
sprintf(statustext, "ERROR: Maximum number of maps reached.");
|
sprintf(statustext, "ERROR: Maximum number of maps reached.");
|
||||||
drawstatusbar();
|
drawstatusbar();
|
||||||
}
|
}
|
||||||
|
} else if (mapnum == C_SCROLLUP) {
|
||||||
|
mapbox.offset--;
|
||||||
|
drawmapbox();
|
||||||
|
} else if (mapnum == C_SCROLLDOWN) {
|
||||||
|
mapbox.offset++;
|
||||||
|
drawmapbox();
|
||||||
} else {
|
} else {
|
||||||
/* push current map */
|
/* push current map */
|
||||||
history[numhistory] = curmap;
|
history[numhistory] = curmap;
|
||||||
|
|
Loading…
Reference in New Issue