SpelunkyFan wiki

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

oJoyConfig's draw event, 124 lines of GML.

draw_set_font(global.myFontSmall);draw_set_color(c_yellow);strLen = string_length("PRESS BUTTON FOR")*8;n = 160 - strLen;n = ceil(n / 2);draw_text(n, 32, "PRESS BUTTON FOR");draw_text(8, 96, "ESC TO KEEP SAME.");draw_text(8, 104, "CURRENT: ");if (not joystick_exists(1)){    draw_set_color(c_red);    draw_text(8, 88, "NO GAMEPAD FOUND!");}if (status == 0){    draw_set_font(global.myFont);    draw_set_color(c_white);    strLen = string_length("JUMP")*16;    n = 160 - strLen;    n = ceil(n / 2);    draw_text(n, 40, "JUMP");    currVal = global.joyJumpVal;}else if (status == 1){    draw_set_font(global.myFont);    draw_set_color(c_white);    strLen = string_length("ACTION")*16;    n = 160 - strLen;    n = ceil(n / 2);    draw_text(n, 40, "ACTION");    currVal = global.joyAttackVal;}else if (status == 2){    draw_set_font(global.myFont);    draw_set_color(c_white);    strLen = string_length("SWITCH")*16;    n = 160 - strLen;    n = ceil(n / 2);    draw_text(n, 40, "SWITCH");    currVal = global.joyItemVal;}else if (status == 3){    draw_set_font(global.myFont);    draw_set_color(c_white);    strLen = string_length("RUN")*16;    n = 160 - strLen;    n = ceil(n / 2);    draw_text(n, 40, "RUN");    currVal = global.joyRunVal;}else if (status == 4){    draw_set_font(global.myFont);    draw_set_color(c_white);    strLen = string_length("BOMB")*16;    n = 160 - strLen;    n = ceil(n / 2);    draw_text(n, 40, "BOMB");    currVal = global.joyBombVal;}else if (status == 5){    draw_set_font(global.myFont);    draw_set_color(c_white);    strLen = string_length("ROPE")*16;    n = 160 - strLen;    n = ceil(n / 2);    draw_text(n, 40, "ROPE");    currVal = global.joyRopeVal;}else if (status == 6){    draw_set_font(global.myFont);    draw_set_color(c_white);    strLen = string_length("FLARE")*16;    n = 160 - strLen;    n = ceil(n / 2);    draw_text(n, 40, "FLARE");    currVal = global.joyFlareVal;}else if (status == 7){    draw_set_font(global.myFont);    draw_set_color(c_white);    strLen = string_length("PURCHASE")*16;    n = 160 - strLen;    n = ceil(n / 2);    draw_text(n, 40, "PURCHASE");    currVal = global.joyPayVal;}else if (status == 8){    draw_set_font(global.myFont);    draw_set_color(c_white);    strLen = string_length("START")*16;    n = 160 - strLen;    n = ceil(n / 2);    draw_text(n, 40, "START");    currVal = global.joyStartVal;}draw_set_font(global.myFontSmall);switch (currVal){    case 1: { draw_text(80, 104, "B1"); break; }    case 2: { draw_text(80, 104, "B2"); break; }    case 3: { draw_text(80, 104, "B3"); break; }    case 4: { draw_text(80, 104, "B4"); break; }    case 5: { draw_text(80, 104, "B5"); break; }    case 6: { draw_text(80, 104, "B6"); break; }    case 7: { draw_text(80, 104, "B7"); break; }    case 8: { draw_text(80, 104, "B8"); break; }    case 9: { draw_text(80, 104, "B9"); break; }    case 10: { draw_text(80, 104, "B10"); break; }    case -1: { draw_text(80, 104, "LT (XB)"); break; }    case -2: { draw_text(80, 104, "RT (XB)"); break; }    default: { draw_text(80, 104, "B" + string(currVal)); break; }}