filename = getPath3((leveldir_current->user_defined ?
getUserLevelDir("") :
options.level_directory),
- leveldir_current->filename,
+ leveldir_current->fullpath,
basename);
return filename;
#define LEVELINFO_TOKEN_LEVELS 34
#define LEVELINFO_TOKEN_FIRST_LEVEL 35
#define LEVELINFO_TOKEN_SORT_PRIORITY 36
-#define LEVELINFO_TOKEN_READONLY 37
+#define LEVELINFO_TOKEN_LEVEL_GROUP 37
+#define LEVELINFO_TOKEN_READONLY 38
#define FIRST_GLOBAL_SETUP_TOKEN SETUP_TOKEN_PLAYER_NAME
#define LAST_GLOBAL_SETUP_TOKEN SETUP_TOKEN_TIME_LIMIT
{ TYPE_INTEGER, &ldi.levels, "levels" },
{ TYPE_INTEGER, &ldi.first_level, "first_level" },
{ TYPE_INTEGER, &ldi.sort_priority, "sort_priority" },
+ { TYPE_BOOLEAN, &ldi.level_group, "level_group" },
{ TYPE_BOOLEAN, &ldi.readonly, "readonly" }
};
static void setLevelDirInfoToDefaults(struct LevelDirInfo *ldi)
{
ldi->filename = NULL;
+ ldi->fullpath = NULL;
+ ldi->basepath = NULL;
ldi->name = getStringCopy(ANONYMOUS_NAME);
ldi->name_short = NULL;
ldi->name_sorting = NULL;
ldi->first_level = 0;
ldi->last_level = 0;
ldi->sort_priority = LEVELCLASS_UNDEFINED; /* default: least priority */
- ldi->readonly = TRUE;
+ ldi->level_group = FALSE;
+ ldi->parent_link = FALSE;
ldi->user_defined = FALSE;
+ ldi->readonly = TRUE;
ldi->color = 0;
ldi->class_desc = NULL;
ldi->handicap_level = 0;
+ ldi->cl_first = -1;
+ ldi->cl_cursor = -1;
+
+ ldi->node_parent = NULL;
+ ldi->node_group = NULL;
+ ldi->next = NULL;
}
static void setSetupInfoToDefaults(struct SetupInfo *si)
}
}
-struct LevelDirInfo *getLevelDirInfoFromLevelDirName(char *level_dir_name)
-{
- struct LevelDirInfo *leveldir_node = leveldir_first;
-
- if (level_dir_name == NULL)
- return NULL;
-
- while (leveldir_node)
- {
- if (strcmp(level_dir_name, leveldir_node->name) == 0)
- return leveldir_node; /* return success value */
-
- leveldir_node = leveldir_node->next;
- }
-
- return NULL;
-}
-
static int compareLevelDirInfoEntries(const void *object1, const void *object2)
{
const struct LevelDirInfo *entry1 = *((struct LevelDirInfo **)object1);
const struct LevelDirInfo *entry2 = *((struct LevelDirInfo **)object2);
int compare_result;
- if (entry1->sort_priority == entry2->sort_priority)
+ if (entry1->parent_link || entry2->parent_link)
+ compare_result = (entry1->parent_link ? -1 : +1);
+ else if (entry1->sort_priority == entry2->sort_priority)
{
char *name1 = getStringToLower(entry1->name_sorting);
char *name2 = getStringToLower(entry2->name_sorting);
return compare_result;
}
-static void LoadLevelInfoFromLevelDir(char *level_directory)
+static void createParentLevelDirNode(struct LevelDirInfo *node_parent)
+{
+ struct LevelDirInfo *leveldir_new = newLevelDirInfo();
+
+ setLevelDirInfoToDefaults(leveldir_new);
+
+ leveldir_new->node_parent = node_parent;
+ leveldir_new->parent_link = TRUE;
+
+ leveldir_new->name = ".. (parent directory)";
+ leveldir_new->name_short = getStringCopy(leveldir_new->name);
+ leveldir_new->name_sorting = getStringCopy(leveldir_new->name);
+
+ leveldir_new->filename = "..";
+ leveldir_new->fullpath = getStringCopy(node_parent->fullpath);
+
+ leveldir_new->sort_priority = node_parent->sort_priority;
+ leveldir_new->class_desc = getLevelClassDescription(leveldir_new);
+
+ pushLevelDirInfo(&node_parent->node_group, leveldir_new);
+}
+
+static void LoadLevelInfoFromLevelDir(struct LevelDirInfo **node_first,
+ struct LevelDirInfo *node_parent,
+ char *level_directory)
{
DIR *dir;
struct dirent *dir_entry;
while ((dir_entry = readdir(dir)) != NULL) /* loop until last dir entry */
{
+ struct SetupFileList *setup_file_list = NULL;
struct stat file_status;
- char *directory = NULL;
+ char *directory_name = dir_entry->d_name;
+ char *directory_path = getPath2(level_directory, directory_name);
char *filename = NULL;
- struct SetupFileList *setup_file_list = NULL;
/* skip entries for current and parent directory */
- if (strcmp(dir_entry->d_name, ".") == 0 ||
- strcmp(dir_entry->d_name, "..") == 0)
+ if (strcmp(directory_name, ".") == 0 ||
+ strcmp(directory_name, "..") == 0)
+ {
+ free(directory_path);
continue;
+ }
/* find out if directory entry is itself a directory */
- directory = getPath2(level_directory, dir_entry->d_name);
- if (stat(directory, &file_status) != 0 || /* cannot stat file */
+ if (stat(directory_path, &file_status) != 0 || /* cannot stat file */
(file_status.st_mode & S_IFMT) != S_IFDIR) /* not a directory */
{
- free(directory);
+ free(directory_path);
continue;
}
- filename = getPath2(directory, LEVELINFO_FILENAME);
+ filename = getPath2(directory_path, LEVELINFO_FILENAME);
setup_file_list = loadSetupFileList(filename);
if (setup_file_list)
checkSetupFileListIdentifier(setup_file_list, LEVELINFO_COOKIE);
setLevelDirInfoToDefaults(leveldir_new);
+ leveldir_new->node_parent = node_parent;
+
+ /* set all structure fields according to the token/value pairs */
ldi = *leveldir_new;
for (i=FIRST_LEVELINFO_TOKEN; i<=LAST_LEVELINFO_TOKEN; i++)
setSetupInfo(i, getTokenValue(setup_file_list, token_info[i].text));
if (leveldir_new->name_sorting == NULL)
leveldir_new->name_sorting = getStringCopy(leveldir_new->name);
- leveldir_new->filename = getStringCopy(dir_entry->d_name);
+ leveldir_new->filename = getStringCopy(directory_name);
+
+ if (node_parent == NULL) /* top level group */
+ {
+ leveldir_new->basepath = level_directory;
+ leveldir_new->fullpath = leveldir_new->filename;
+ }
+ else /* sub level group */
+ {
+ leveldir_new->basepath = node_parent->basepath;
+ leveldir_new->fullpath = getPath2(node_parent->fullpath,
+ directory_name);
+ }
if (leveldir_new->levels < 1)
leveldir_new->levels = 1;
leveldir_new->first_level + leveldir_new->levels - 1;
leveldir_new->user_defined =
- (level_directory == options.level_directory ? FALSE : TRUE);
+ (leveldir_new->basepath == options.level_directory ? FALSE : TRUE);
+
leveldir_new->color = LEVELCOLOR(leveldir_new);
leveldir_new->class_desc = getLevelClassDescription(leveldir_new);
leveldir_new->last_level :
leveldir_new->first_level);
- pushLevelDirInfo(leveldir_new); /* add new LevelDirInfo to list */
+ pushLevelDirInfo(node_first, leveldir_new);
freeSetupFileList(setup_file_list);
valid_entry_found = TRUE;
+
+ if (leveldir_new->level_group)
+ {
+ /* create node to link back to current level directory */
+ createParentLevelDirNode(leveldir_new);
+
+ /* step into sub-directory and look for more level series */
+ LoadLevelInfoFromLevelDir(&leveldir_new->node_group,
+ leveldir_new, directory_path);
+ }
}
else
- Error(ERR_WARN, "ignoring level directory '%s'", directory);
+ Error(ERR_WARN, "ignoring level directory '%s'", directory_path);
- free(directory);
+ free(directory_path);
free(filename);
}
DrawInitText("Loading level series:", 120, FC_GREEN);
- LoadLevelInfoFromLevelDir(options.level_directory);
- LoadLevelInfoFromLevelDir(getUserLevelDir(""));
+ LoadLevelInfoFromLevelDir(&leveldir_first, NULL, options.level_directory);
+ LoadLevelInfoFromLevelDir(&leveldir_first, NULL, getUserLevelDir(""));
- num_leveldirs = numLevelDirInfo(leveldir_first);
- leveldir_current = leveldir_first;
+ leveldir_current = getFirstValidLevelSeries(leveldir_first);
- if (num_leveldirs == 0)
+ if (leveldir_first == NULL)
Error(ERR_EXIT, "cannot find any valid level series in any directory");
+ sortLevelDirInfo(&leveldir_first, compareLevelDirInfoEntries);
+
#if 0
- if (num_leveldirs > 1)
- qsort(leveldir, num_leveldirs, sizeof(struct LevelDirInfo),
- compareLevelDirInfoEntries);
-#else
- if (num_leveldirs > 1)
- sortLevelDirInfo(&leveldir_first, compareLevelDirInfoEntries);
+ dumpLevelDirInfo(leveldir_first, 0);
#endif
}
char *last_level_series =
getTokenValue(level_setup_list, TOKEN_STR_LAST_LEVEL_SERIES);
- leveldir_current = getLevelDirInfoFromLevelDirName(last_level_series);
+ leveldir_current = getLevelDirInfoFromFilename(last_level_series);
if (leveldir_current == NULL)
leveldir_current = leveldir_first;
void DrawMainMenu()
{
+ static struct LevelDirInfo *leveldir_last_valid = NULL;
int i;
char *name_text = (!options.network && setup.team_mode ? "Team:" : "Name:");
/* map gadgets for main menu screen */
MapTapeButtons();
- /* level_nr may have set to value over handicap with level editor */
+ /* leveldir_current may be invalid (level group, parent link) */
+ if (!validLevelSeries(leveldir_current))
+ leveldir_current = getFirstValidLevelSeries(leveldir_last_valid);
+
+ /* store valid level series information */
+ leveldir_last_valid = leveldir_current;
+
+ /* level_nr may have been set to value over handicap with level editor */
if (setup.handicap && level_nr > leveldir_current->handicap_level)
level_nr = leveldir_current->handicap_level;
}
+static void gotoTopLevelDir()
+{
+ /* move upwards to top level directory */
+ while (leveldir_current->node_parent)
+ {
+ /* write a "path" into level tree for easy navigation to last level */
+ if (leveldir_current->node_parent->node_group->cl_first == -1)
+ {
+ int num_leveldirs = numLevelDirInfoInGroup(leveldir_current);
+ int leveldir_pos = posLevelDirInfo(leveldir_current);
+ int num_page_entries;
+ int cl_first, cl_cursor;
+
+ if (num_leveldirs <= MAX_LEVEL_SERIES_ON_SCREEN)
+ num_page_entries = num_leveldirs;
+ else
+ num_page_entries = MAX_LEVEL_SERIES_ON_SCREEN - 1;
+
+ cl_first = MAX(0, leveldir_pos - num_page_entries + 1);
+ cl_cursor = leveldir_pos - cl_first + 3;
+
+ leveldir_current->node_parent->node_group->cl_first = cl_first;
+ leveldir_current->node_parent->node_group->cl_cursor = cl_cursor;
+ }
+
+ leveldir_current = leveldir_current->node_parent;
+ }
+}
+
void HandleMainMenu(int mx, int my, int dx, int dy, int button)
{
static int choice = 3;
}
else if (y == 4)
{
- if (num_leveldirs)
+ if (leveldir_first)
{
game_status = CHOOSELEVEL;
SaveLevelSetup_LastSeries();
SaveLevelSetup_SeriesInfo();
+
+ gotoTopLevelDir();
+
DrawChooseLevel();
}
}
BackToFront();
}
+static void drawCursorExt(int ypos, int color, int graphic)
+{
+ static int cursor_array[SCR_FIELDY];
+
+ if (graphic)
+ cursor_array[ypos] = graphic;
+
+ graphic = cursor_array[ypos];
+
+ if (color == FC_RED)
+ graphic = (graphic == GFX_ARROW_BLUE_LEFT ? GFX_ARROW_RED_LEFT :
+ graphic == GFX_ARROW_BLUE_RIGHT ? GFX_ARROW_RED_RIGHT :
+ GFX_KUGEL_ROT);
+
+ DrawGraphic(0, ypos, graphic);
+}
+
+static void initCursor(int ypos, int graphic)
+{
+ drawCursorExt(ypos, FC_BLUE, graphic);
+}
+
+static void drawCursor(int ypos, int color)
+{
+ drawCursorExt(ypos, color, 0);
+}
+
void DrawChooseLevel()
{
UnmapAllGadgets();
struct GadgetInfo *gi = screen_gadget[id];
int items_max, items_visible, item_position;
- items_max = num_leveldirs;
+ items_max = numLevelDirInfoInGroup(leveldir_current);
items_visible = MAX_LEVEL_SERIES_ON_SCREEN - 1;
item_position = first_entry;
int i;
char buffer[SCR_FIELDX * 2];
int max_buffer_len = (SCR_FIELDX - 2) * 2;
+ int num_leveldirs = numLevelDirInfoInGroup(leveldir_current);
XFillRectangle(display, backbuffer, gc, SX, SY, SXSIZE - 32, SYSIZE);
redraw_mask |= REDRAW_FIELD;
for(i=0; i<num_page_entries; i++)
{
- struct LevelDirInfo *leveldir_node;
+ struct LevelDirInfo *node, *node_first;
int leveldir_pos = first_entry + i;
+ int ypos = i + 2;
- leveldir_node = getLevelDirInfoFromPos(leveldir_first, leveldir_pos);
- strncpy(buffer, leveldir_node->name , max_buffer_len);
+ node_first = getLevelDirInfoFirstGroupEntry(leveldir_current);
+ node = getLevelDirInfoFromPos(node_first, leveldir_pos);
+
+ strncpy(buffer, node->name , max_buffer_len);
buffer[max_buffer_len] = '\0';
- DrawText(SX + 32, SY + (i + 2) * 32, buffer, FS_MEDIUM,
- leveldir_node->color);
- DrawGraphic(0, i + 2, GFX_KUGEL_BLAU);
+ DrawText(SX + 32, SY + ypos * 32, buffer, FS_MEDIUM, node->color);
+
+ if (node->parent_link)
+ initCursor(ypos, GFX_ARROW_BLUE_LEFT);
+ else if (node->level_group)
+ initCursor(ypos, GFX_ARROW_BLUE_RIGHT);
+ else
+ initCursor(ypos, GFX_KUGEL_BLAU);
}
if (first_entry > 0)
static void drawChooseLevelInfo(int leveldir_pos)
{
- struct LevelDirInfo *leveldir_node;
+ struct LevelDirInfo *node, *node_first;
int x, last_redraw_mask = redraw_mask;
- leveldir_node = getLevelDirInfoFromPos(leveldir_first, leveldir_pos);
+ node_first = getLevelDirInfoFirstGroupEntry(leveldir_current);
+ node = getLevelDirInfoFromPos(node_first, leveldir_pos);
XFillRectangle(display, drawto, gc, SX + 32, SY + 32, SXSIZE - 64, 32);
- DrawTextFCentered(40, FC_RED, "%3d levels (%s)",
- leveldir_node->levels,
- leveldir_node->class_desc);
+ if (node->parent_link)
+ DrawTextFCentered(40, FC_RED, "leave group \"%s\"", node->class_desc);
+ else if (node->level_group)
+ DrawTextFCentered(40, FC_RED, "enter group \"%s\"", node->class_desc);
+ else
+ DrawTextFCentered(40, FC_RED, "%3d levels (%s)",
+ node->levels, node->class_desc);
/* let BackToFront() redraw only what is needed */
redraw_mask = last_redraw_mask | REDRAW_TILES;
void HandleChooseLevel(int mx, int my, int dx, int dy, int button)
{
- static int choice = 3;
- static int first_entry = -1;
static unsigned long choose_delay = 0;
static int redraw = TRUE;
int x = (mx + 32 - SX) / 32, y = (my + 32 - SY) / 32;
int step = (button == 1 ? 1 : button == 2 ? 5 : 10);
+ int num_leveldirs = numLevelDirInfoInGroup(leveldir_current);
int num_page_entries;
if (num_leveldirs <= MAX_LEVEL_SERIES_ON_SCREEN)
{
int leveldir_pos = posLevelDirInfo(leveldir_current);
- if (first_entry == -1)
+ if (leveldir_current->cl_first == -1)
{
- first_entry = MAX(0, leveldir_pos - num_page_entries + 1);
- choice = leveldir_pos - first_entry + 3;
- AdjustChooseLevelScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL, first_entry);
+ leveldir_current->cl_first = MAX(0, leveldir_pos - num_page_entries + 1);
+ leveldir_current->cl_cursor =
+ leveldir_pos - leveldir_current->cl_first + 3;
}
- if (dx == 1) /* 'first_entry' is set by scrollbar position */
- first_entry = dy;
+ if (dx == 999) /* first entry is set by scrollbar position */
+ leveldir_current->cl_first = dy;
+ else
+ AdjustChooseLevelScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL,
+ leveldir_current->cl_first);
- drawChooseLevelList(first_entry, num_page_entries);
+ drawChooseLevelList(leveldir_current->cl_first, num_page_entries);
drawChooseLevelInfo(leveldir_pos);
redraw = TRUE;
}
if (redraw)
{
- DrawGraphic(0, choice - 1, GFX_KUGEL_ROT);
+ drawCursor(leveldir_current->cl_cursor - 1, FC_RED);
redraw = FALSE;
}
if (dy)
{
x = 1;
- y = choice + dy;
+ y = leveldir_current->cl_cursor + dy;
}
else
x = y = 0; /* no action */
if (x == 1 && y == 2)
{
- if (first_entry > 0 &&
+ if (leveldir_current->cl_first > 0 &&
(dy || DelayReached(&choose_delay, GADGET_FRAME_DELAY)))
{
- first_entry -= step;
- if (first_entry < 0)
- first_entry = 0;
-
- drawChooseLevelList(first_entry, num_page_entries);
- drawChooseLevelInfo(first_entry + choice - 3);
- AdjustChooseLevelScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL, first_entry);
- DrawGraphic(0, choice - 1, GFX_KUGEL_ROT);
+ leveldir_current->cl_first -= step;
+ if (leveldir_current->cl_first < 0)
+ leveldir_current->cl_first = 0;
+
+ drawChooseLevelList(leveldir_current->cl_first, num_page_entries);
+ drawChooseLevelInfo(leveldir_current->cl_first +
+ leveldir_current->cl_cursor - 3);
+ drawCursor(leveldir_current->cl_cursor - 1, FC_RED);
+ AdjustChooseLevelScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL,
+ leveldir_current->cl_first);
return;
}
}
else if (x == 1 && y > num_page_entries + 2)
{
- if (first_entry + num_page_entries < num_leveldirs &&
+ if (leveldir_current->cl_first + num_page_entries < num_leveldirs &&
(dy || DelayReached(&choose_delay, GADGET_FRAME_DELAY)))
{
- first_entry += step;
- if (first_entry + num_page_entries > num_leveldirs)
- first_entry = MAX(0, num_leveldirs - num_page_entries);
-
- drawChooseLevelList(first_entry, num_page_entries);
- drawChooseLevelInfo(first_entry + choice - 3);
- AdjustChooseLevelScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL, first_entry);
- DrawGraphic(0, choice - 1, GFX_KUGEL_ROT);
+ leveldir_current->cl_first += step;
+ if (leveldir_current->cl_first + num_page_entries > num_leveldirs)
+ leveldir_current->cl_first = MAX(0, num_leveldirs - num_page_entries);
+
+ drawChooseLevelList(leveldir_current->cl_first, num_page_entries);
+ drawChooseLevelInfo(leveldir_current->cl_first +
+ leveldir_current->cl_cursor - 3);
+ drawCursor(leveldir_current->cl_cursor - 1, FC_RED);
+ AdjustChooseLevelScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL,
+ leveldir_current->cl_first);
return;
}
}
if (!mx && !my && !dx && !dy)
{
x = 1;
- y = choice;
+ y = leveldir_current->cl_cursor;
+ }
+
+ if (dx == 1)
+ {
+ struct LevelDirInfo *node_first, *node_cursor;
+ int leveldir_pos =
+ leveldir_current->cl_first + leveldir_current->cl_cursor - 3;
+
+ node_first = getLevelDirInfoFirstGroupEntry(leveldir_current);
+ node_cursor = getLevelDirInfoFromPos(node_first, leveldir_pos);
+
+ if (node_cursor->node_group)
+ {
+ node_cursor->cl_first = leveldir_current->cl_first;
+ node_cursor->cl_cursor = leveldir_current->cl_cursor;
+ leveldir_current = node_cursor->node_group;
+ DrawChooseLevel();
+ }
+ }
+ else if (dx == -1 && leveldir_current->node_parent)
+ {
+ leveldir_current = leveldir_current->node_parent;
+ DrawChooseLevel();
}
if (x == 1 && y >= 3 && y <= num_page_entries + 2)
{
if (button)
{
- if (y != choice)
+ if (y != leveldir_current->cl_cursor)
{
- DrawGraphic(0, y - 1, GFX_KUGEL_ROT);
- DrawGraphic(0, choice - 1, GFX_KUGEL_BLAU);
- drawChooseLevelInfo(first_entry + y - 3);
- choice = y;
+ drawCursor(y - 1, FC_RED);
+ drawCursor(leveldir_current->cl_cursor - 1, FC_BLUE);
+ drawChooseLevelInfo(leveldir_current->cl_first + y - 3);
+ leveldir_current->cl_cursor = y;
}
}
else
{
- int leveldir_pos = first_entry + y - 3;
-
- leveldir_current = getLevelDirInfoFromPos(leveldir_first, leveldir_pos);
+ struct LevelDirInfo *node_first, *node_cursor;
+ int leveldir_pos = leveldir_current->cl_first + y - 3;
- LoadLevelSetup_SeriesInfo();
-
- SaveLevelSetup_LastSeries();
- SaveLevelSetup_SeriesInfo();
- TapeErase();
+ node_first = getLevelDirInfoFirstGroupEntry(leveldir_current);
+ node_cursor = getLevelDirInfoFromPos(node_first, leveldir_pos);
+ if (node_cursor->node_group)
+ {
+ node_cursor->cl_first = leveldir_current->cl_first;
+ node_cursor->cl_cursor = leveldir_current->cl_cursor;
+ leveldir_current = node_cursor->node_group;
+ DrawChooseLevel();
+ }
+ else if (node_cursor->parent_link)
+ {
+ leveldir_current = node_cursor->node_parent;
+ DrawChooseLevel();
+ }
+ else
+ {
+ leveldir_current = node_cursor;
- printf("first_level == %d, last_level == %d, levels == %d\n",
- leveldir_current->first_level,
- leveldir_current->last_level,
- leveldir_current->levels);
+ LoadLevelSetup_SeriesInfo();
+ SaveLevelSetup_LastSeries();
+ SaveLevelSetup_SeriesInfo();
+ TapeErase();
- game_status = MAINMENU;
- DrawMainMenu();
- redraw = TRUE;
+ game_status = MAINMENU;
+ DrawMainMenu();
+ }
}
}
if (!(i >= SETUP_SCREEN_POS_EMPTY1 && i <= SETUP_SCREEN_POS_EMPTY2))
{
- DrawGraphic(0,i,GFX_KUGEL_BLAU);
DrawText(SX+32,SY+i*32, setup_info[base].text, FS_BIG,FC_GREEN);
+
+ if (strcmp(setup_info[base].text, "Input Devices") == 0)
+ initCursor(i, GFX_ARROW_BLUE_RIGHT);
+ else
+ initCursor(i, GFX_KUGEL_BLAU);
}
if (setup_info[base].value)
if (redraw)
{
- DrawGraphic(0,choice-1,GFX_KUGEL_ROT);
+ drawCursor(choice - 1, FC_RED);
redraw = FALSE;
}
y = choice;
}
+ if (dx == 1 && choice == 14)
+ {
+ game_status = SETUPINPUT;
+ DrawSetupInputScreen();
+ redraw = TRUE;
+ }
+
if (x==1 && y >= pos_start && y <= pos_end &&
!(y >= pos_empty1 && y <= pos_empty2))
{
{
if (y!=choice)
{
- DrawGraphic(0,y-1,GFX_KUGEL_ROT);
- DrawGraphic(0,choice-1,GFX_KUGEL_BLAU);
+ drawCursor(y - 1, FC_RED);
+ drawCursor(choice - 1, FC_BLUE);
}
choice = y;
}
ClearWindow();
DrawText(SX+16, SY+16, "SETUP INPUT", FS_BIG, FC_YELLOW);
- DrawGraphic(0, 2, GFX_KUGEL_BLAU);
- DrawGraphic(0, 3, GFX_KUGEL_BLAU);
- DrawGraphic(0, 4, GFX_KUGEL_BLAU);
- DrawGraphic(0, 15, GFX_KUGEL_BLAU);
+ initCursor(2, GFX_KUGEL_BLAU);
+ initCursor(3, GFX_KUGEL_BLAU);
+ initCursor(4, GFX_ARROW_BLUE_RIGHT);
+ initCursor(15, GFX_KUGEL_BLAU);
+
DrawGraphic(10, 2, GFX_ARROW_BLUE_LEFT);
DrawGraphic(12, 2, GFX_ARROW_BLUE_RIGHT);
if (redraw)
{
- DrawGraphic(0,choice-1,GFX_KUGEL_ROT);
+ drawCursor(choice - 1, FC_RED);
redraw = FALSE;
}
{
if (y != choice)
{
- DrawGraphic(0, y-1, GFX_KUGEL_ROT);
- DrawGraphic(0, choice-1, GFX_KUGEL_BLAU);
+ drawCursor(y - 1, FC_RED);
+ drawCursor(choice - 1, FC_BLUE);
}
choice = y;
}
struct GadgetInfo *gi;
int items_max, items_visible, item_position;
unsigned long event_mask;
- int num_page_entries;
+ int num_page_entries = MAX_LEVEL_SERIES_ON_SCREEN - 1;
+#if 0
if (num_leveldirs <= MAX_LEVEL_SERIES_ON_SCREEN)
num_page_entries = num_leveldirs;
else
items_max = MAX(num_leveldirs, num_page_entries);
items_visible = num_page_entries;
item_position = 0;
+#else
+ items_max = num_page_entries;
+ items_visible = num_page_entries;
+ item_position = 0;
+#endif
event_mask = GD_EVENT_MOVING | GD_EVENT_OFF_BORDERS;
void MapChooseLevelGadgets()
{
+ int num_leveldirs = numLevelDirInfoInGroup(leveldir_current);
int i;
if (num_leveldirs <= MAX_LEVEL_SERIES_ON_SCREEN)
break;
case SCREEN_CTRL_ID_SCROLL_VERTICAL:
- HandleChooseLevel(0,0, 1,gi->event.item_position, MB_MENU_INITIALIZE);
+ HandleChooseLevel(0,0, 999,gi->event.item_position, MB_MENU_INITIALIZE);
break;
default: