- "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 */ /* variable sizes */
#define SMALLBUFLEN 64 /* small text buffer */ #define SMALLBUFLEN 64 /* small text buffer */

View File

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

View File

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