SpelunkyFan wiki

objects/oTransition/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.

oTransition's draw event, 126 lines of GML.

draw_set_font(global.myFontSmall);draw_set_color(c_white);if (instance_exists(oTunnelMan)){    person = instance_nearest(176, 176, oTunnelMan);    if (person.talk == 1)    {        strLen = string_length("HEY THERE! I'M THE TUNNEL MAN!")*8;        n = 320 - strLen;        n = ceil(n / 2);        draw_text(n, 208, "HEY THERE! I'M THE TUNNEL MAN!");        strLen = string_length("I DIG SHORTCUTS.")*8;        n = 320 - strLen;        n = ceil(n / 2);        draw_text(n, 216, "I DIG SHORTCUTS.");    }    else if (person.talk == 2)    {        strLen = string_length("CAN YOU LEND ME A LITTLE MONEY?")*8;        n = 320 - strLen;        n = ceil(n / 2);        draw_text(n, 208, "CAN YOU LEND ME A LITTLE MONEY?");        if (isRoom("rTransition1x") or isRoom("rTransition3x")) strLen = string_length("I NEED $" + string(global.tunnel1) + " FOR A NEW SHORTCUT.")*8;        else strLen = string_length("I NEED $" + string(global.tunnel2) + " FOR A NEW SHORTCUT.")*8;        n = 320 - strLen;        n = ceil(n / 2);        if (isRoom("rTransition1x") or isRoom("rTransition3x")) draw_text(n, 216, "I NEED $" + string(global.tunnel1) + " FOR A NEW SHORTCUT.");        else draw_text(n, 216, "I NEED $" + string(global.tunnel2) + " FOR A NEW SHORTCUT.");        draw_set_color(c_yellow);        draw_text(n, 224, "DONATE: " + string(oTunnelMan.donate));        draw_set_color(c_white);    }    else if (person.talk == 3)    {        strLen = string_length("THANKS! YOU WON'T REGRET IT!")*8;        n = 320 - strLen;        n = ceil(n / 2);        draw_text(n, 216, "THANKS! YOU WON'T REGRET IT!");    }    else if (person.talk == 4)    {        strLen = string_length("I'LL NEVER GET THIS SHORTCUT BUILT!")*8;        n = 320 - strLen;        n = ceil(n / 2);        draw_text(n, 216, "I'LL NEVER GET THIS SHORTCUT BUILT!");    }    else if (person.talk == 5)    {        strLen = string_length("ONE SHORTCUT, COMING UP!")*8;        n = 320 - strLen;        n = ceil(n / 2);        draw_text(n, 216, "ONE SHORTCUT, COMING UP!");    }}else if (instance_exists(oDamselKiss)){    person = instance_nearest(176, 176, oDamselKiss);    if (person.kissed)    {        strLen = string_length("MY HERO!")*8;        n = 320 - strLen;        n = ceil(n / 2);        draw_text(n, 216, "MY HERO!");    }}/* debugelse{        draw_text(8, 208, string(debugCounter));        if (global.genBlackMarket) draw_text(8, 216, "MARKET : " + string(drawLoot) + " :$ " + string(moneyCount) + " :$ " + string(global.xmoney) + " :A " + string(alarm[0]) + " :A " + string(alarm[1]));}*/draw_set_color(c_yellow);if (global.customLevel) draw_text(32, 48, global.customLevelName + " COMPLETED!");else if (global.currLevel-1 < 1) draw_text(32, 48, "TUTORIAL CAVE COMPLETED!");else draw_text(32, 48, "LEVEL " + string(global.currLevel-1) + " COMPLETED!");draw_set_color(c_white);draw_text(32, 64, "TIME  = ");draw_text(32, 80, "LOOT  = ");draw_text(32, 96, "KILLS = ");draw_text(32, 112, "MONEY = ");if (drawLoot >= 1 and not isLoot){    draw_text(96, 80, "NONE");}if (drawLoot > -2){    s = global.xtime;    s = floor(s / 1000);    m = 0;    while (s > 59)    {        s -= 60;        m += 1;    }        // don't create a dark level if player is attempting a speed run    if (s <= 20) global.noDarkLevel = true;    else global.noDarkLevel = false;        s2 = global.time;    s2 = floor(s2 / 1000);    m2 = 0;    while (s2 > 59)    {        s2 -= 60;        m2 += 1;    }        if (s < 10 and s2 < 10) draw_text(96, 64, string(m) + ":0" + string(s) + " / " + string(m2) + ":0" + string(s2));    else if (s < 10) draw_text(96, 64, string(m) + ":0" + string(s) + " / " + string(m2) + ":" + string(s2));    else if (s2 < 10) draw_text(96, 64, string(m) + ":" + string(s) + " / " + string(m2) + ":0" + string(s2));    else draw_text(96, 64, string(m) + ":" + string(s) + " / " + string(m2) + ":" + string(s2));}if (drawLoot == 2){    if (not isKills)    {        draw_text(96, 96, "NONE");    }    draw_text(96, 112, "$" + string(moneyCount) + " / $" + string(global.money));}