SpelunkyFan wiki

objects/oHighscores/draw.gml

From spelunky.gmk, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC, shown whole under the Spelunky User License v1.1b. Extracted by spelunky.ai's tools, an unofficial fan project, one file per script or event; the // ==== lines are the extractor's, naming each action of the event. Some scripts are others' work that Derek Yu credits in the source's readme.txt: Martin Piecyk's platform engine, ChevyRay's view scaling scripts and tsg1zzn's Super Sound System.

oHighscores's draw event, 159 lines of GML.

if (oPlayer1.y < 156){draw_set_font(global.myFontSmall);draw_set_color(c_yellow);draw_text(128+16, 32, "SECRET CHALLENGES");draw_set_color(c_white);tMini1 = floor(highscore_value(10) / 10000);tMini2 = floor((highscore_value(10)-(tMini1*10000)) / 100);tMini3 = floor(highscore_value(10)-(tMini1*10000)-(tMini2*100));draw_text(128, 48, "SUN:   " + string(tMini1));draw_text(128, 64, "MOON:  " + string(tMini2));draw_text(128, 80, "STARS: " + string(tMini3));if (oPlayer1.y < 48+16){    draw_set_color(c_yellow);    draw_text(168, 96, "SUN ROOM");    draw_set_color(c_white);    if (tMoney >= sunGold)    {        if (false) // (global.isTunnelMan)        {            draw_text(128, 112, "NO MATTOCKS ALLOWED!");            draw_text(128, 128, "THIS MEANS YOU!");            draw_text(128, 144, "");            draw_text(128, 160, "");        }        else        {            draw_text(128, 112, "KEEP YOURSELF AND");            draw_text(128, 128, "THE DAMSEL ALIVE");            draw_text(128, 144, "FOR AS LONG AS");            draw_text(128, 160, "POSSIBLE!");        }    }    else    {        draw_text(128, 112, "LOCKED.");    }}else if (oPlayer1.y < 80+16){    draw_set_color(c_yellow);    draw_text(168, 96, "MOON ROOM");    draw_set_color(c_white);    if (tTime > 0 and tTime <= moonGold)    {        if (false) // (global.isTunnelMan)        {            draw_text(128, 112, "NO MATTOCKS ALLOWED!");            draw_text(128, 128, "THIS MEANS YOU!");            draw_text(128, 144, "");            draw_text(128, 160, "");        }        else        {            draw_text(128, 112, "SHOOT THE MOVING");            draw_text(128, 128, "TARGETS WITH YOUR");            draw_text(128, 144, "BOW AND ARROWS!");        }    }    else    {        draw_text(128, 112, "LOCKED.");    }}else if (oPlayer1.y < 112+16){    draw_set_color(c_yellow);    draw_text(168, 96, "STARS ROOM");    draw_set_color(c_white);    if (tKills >= starsGold)    {        if (false) // (global.isTunnelMan)        {            draw_text(128, 112, "NO MATTOCKS ALLOWED!");            draw_text(128, 128, "THIS MEANS YOU!");            draw_text(128, 144, "");            draw_text(128, 160, "");        }        else        {            draw_text(128, 112, "KILL AS MANY ANGRY");            draw_text(128, 128, "SHOPKEEPS AS YOU CAN");            draw_text(128, 144, "BEFORE THEY GET YOU!");        }    }    else    {        draw_text(128, 112, "LOCKED.");    }}else if (oPlayer1.y < 160){    draw_set_color(c_yellow);    draw_text(160, 96, "CHANGING ROOM");    draw_set_color(c_white);    if (tSaves >= 8)    {        draw_text(128, 112, "LADY IN RED...");    }    else    {        draw_text(128, 112, "LOCKED.");    }    with oNew    {        visible = false;    }}}else{with oNew{    visible = true;}draw_set_font(global.myFontSmall);draw_set_color(c_yellow);draw_text(160, 32, "TOP DEFILERS");draw_set_color(c_white);draw_text(128, 48, "MONEY:  " + string(highscore_value(1)-9000000));draw_text(128, 64, "KILLS:  " + string(highscore_value(3)-7000000));draw_text(128, 80, "SAVES:  " + string(highscore_value(4)-6000000));// only display time if wonif (highscore_value(6)-4000000 > 0){    s = highscore_value(2)-8000000;    // s = floor(s / 1000);    m = 0;    while (s > 59)    {        s -= 60;        m += 1;    }        draw_set_color(c_white);    draw_text(128, 96, "TIME: ");    if (s < 10) draw_text(128+64, 96, string(m) + ":0" + string(s));    else draw_text(128+64, 96, string(m) + ":" + string(s));}draw_set_color(c_yellow);draw_text(168, 112, "STATISTICS");draw_set_color(c_white);draw_text(128, 128, "PLAYS:  " + string(highscore_value(5)-5000000));draw_text(128, 144, "DEATHS: " + string(highscore_value(7)-3000000));draw_text(128, 160, "WINS:   " + string(highscore_value(6)-4000000));block = instance_nearest(160, 240, oPushBlock);if (not oButtonHighscore.pushed and block.x > 160){    draw_set_font(global.myFontSmall);    draw_set_color(c_yellow);    strLen = string_length("THIS WILL CLEAR EVERYTHING!")*8;    n = 320 - strLen;    n = ceil(n / 2);    draw_text(n, 216, string("THIS WILL CLEAR EVERYTHING!"));}}