- "Create map link" screen is now scrollable with ,/./q/w keys

- Changed version to 1.7g
This commit is contained in:
Rob Pearce 2006-05-11 06:49:44 +00:00
parent 83b63fe1c7
commit 1325f8c3f7
3 changed files with 42 additions and 9 deletions

View File

@ -1,4 +1,4 @@
#define VERSION "1.7f"
#define VERSION "1.7g"
/* variable sizes */
#define SMALLBUFLEN 64 /* small text buffer */

View File

@ -79,6 +79,8 @@ Uint8 defarrow = 0;
int modified = FALSE;
int readonly = FALSE;
int maplistpos = 0; /* scroll position in map list */
int copyfrom = -1;
int copymap = -1;
int copytype = T_MAP;
@ -754,10 +756,10 @@ int main (int argc, char **argv) {
setmod(TRUE);
changestate(S_NONE);
drawmap();
} else if (pos <= (nummaps-1)) {
} else if ((pos+maplistpos) <= (nummaps-1)) {
if ((map[curmap].selecteditem != -1) && (map[curmap].selecteditemtype == T_OBJECT)) {
if (pos != curmap) {
map[curmap].obj[map[curmap].selecteditem].child = pos;
if ((pos+maplistpos) != curmap) {
map[curmap].obj[map[curmap].selecteditem].child = pos + maplistpos;
sprintf(statustext, "Map link created.");
strcpy(oldstatustext, statustext);
setmod(TRUE);
@ -1687,16 +1689,32 @@ int main (int argc, char **argv) {
drawmap();
}
if ((c == ',') || (c == 'q')) { /* scroll object box up */
scrollobox(-1);
if (state == S_CREATETELE) {
scrollmaplist(-1);
} else {
scrollobox(-1);
}
}
if ((c == '.') || (c == 'w')) { /* scroll object box down */
scrollobox(1);
if (state == S_CREATETELE) {
scrollmaplist(1);
} else {
scrollobox(1);
}
}
if ((c == '<') || (c == 'Q')) { /* scroll object box up */
scrollobox(-OBOXPAGESIZE);
if (state == S_CREATETELE) {
scrollmaplist(-20);
} else {
scrollobox(-OBOXPAGESIZE);
}
}
if ((c == '>') || (c == 'W')) { /* scroll object box down */
scrollobox(OBOXPAGESIZE);
if (state == S_CREATETELE) {
scrollmaplist(20);
} else {
scrollobox(OBOXPAGESIZE);
}
}
if (c == 'x') {
if (map[curmap].selecteditem != -1) {
@ -4296,7 +4314,7 @@ void drawmaplist(SDL_Surface *dest) {
y += (DEFTEXTH*2);
for (i = 0; i < nummaps; i++) {
for (i = maplistpos; i < nummaps; i++) {
drawbox(dest, x, y, map[curmap].width-1,y+(DEFTEXTH*2),blue, NULL);
drawtextat(dest, x+1, y+1, map[i].name, (DEFTEXTH*2)-2, blue);
@ -7343,6 +7361,20 @@ int savemap(void) {
return 0;
}
void scrollmaplist(int amt) {
maplistpos += amt;
if (amt < 0) {
if (maplistpos < 0) maplistpos = 0;
} else if (amt > 0) {
if (maplistpos >= nummaps) {
maplistpos = nummaps - 1;
}
}
drawmaplist(screen);
}
void scrollobox(int amt) {
int fitx,fity,fit;

View File

@ -273,6 +273,7 @@ void seterror(int errnum);
void setinfo(int infonum);
void setmod(int tf);
int savemap(void);
void scrollmaplist(int amt);
void scrollobox(int amt);
int showfiledialog(void);
void startedittext (int o);