increased initial memory for Emscripten platform
[rocksndiamonds.git] / src / screens.c
index 7e87e50dc7117cd912e91db620e12e2a2f26eb36..81a54b064ca2fbe7f52a214172f2b9d643409ca3 100644 (file)
 // other screen text constants
 #define STR_CHOOSE_TREE_EDIT           "Edit"
 #define MENU_CHOOSE_TREE_FONT(x)       (FONT_TEXT_1 + (x))
+#define MENU_CHOOSE_TREE_COLOR(ti, a)  TREE_COLOR(ti, a)
 
 // for input setup functions
 #define SETUPINPUT_SCREEN_POS_START    0
@@ -4408,9 +4409,8 @@ static void drawChooseTreeText(int y, boolean active, TreeInfo *ti)
   int entry_pos = first_entry + y;
   TreeInfo *node_first = getTreeInfoFirstGroupEntry(ti);
   TreeInfo *node = getTreeInfoFromPos(node_first, entry_pos);
-  int node_color = (node->color == FC_YELLOW ? FC_GREEN : node->color);
-  int color = (active ? FC_YELLOW : node_color);
-  int font_nr = MENU_CHOOSE_TREE_FONT(color);
+  int font_color = MENU_CHOOSE_TREE_COLOR(node, active);
+  int font_nr = MENU_CHOOSE_TREE_FONT(font_color);
   int font_xoffset = getFontBitmapInfo(font_nr)->draw_xoffset;
   int xpos = MENU_SCREEN_START_XPOS;
   int ypos = MENU_SCREEN_START_YPOS + y;
@@ -4503,6 +4503,12 @@ static void drawChooseTreeInfo(int entry_pos, TreeInfo *ti)
     MarkTileDirty(x, 1);
 }
 
+static void drawChooseTreeCursorAndText(int y, boolean active, TreeInfo *ti)
+{
+  drawChooseTreeCursor(y, active);
+  drawChooseTreeText(y, active, ti);
+}
+
 static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
                             TreeInfo **ti_ptr)
 {
@@ -4550,7 +4556,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
 
     drawChooseTreeList(ti->cl_first, num_page_entries, ti);
     drawChooseTreeInfo(ti->cl_first + ti->cl_cursor, ti);
-    drawChooseTreeCursor(ti->cl_cursor, TRUE);
+    drawChooseTreeCursorAndText(ti->cl_cursor, TRUE, ti);
 
     return;
   }
@@ -4660,7 +4666,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
       {
        drawChooseTreeList(ti->cl_first, num_page_entries, ti);
        drawChooseTreeInfo(ti->cl_first + ti->cl_cursor, ti);
-       drawChooseTreeCursor(ti->cl_cursor, TRUE);
+       drawChooseTreeCursorAndText(ti->cl_cursor, TRUE, ti);
 
        AdjustChooseTreeScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL,
                                  ti->cl_first, ti);
@@ -4724,8 +4730,8 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
       {
        PlaySound(SND_MENU_ITEM_ACTIVATING);
 
-       drawChooseTreeCursor(ti->cl_cursor, FALSE);
-       drawChooseTreeCursor(y, TRUE);
+       drawChooseTreeCursorAndText(ti->cl_cursor, FALSE, ti);
+       drawChooseTreeCursorAndText(y, TRUE, ti);
        drawChooseTreeInfo(ti->cl_first + y, ti);
 
        ti->cl_cursor = y;