SpelunkyFan wiki

objects/oJoyConfig/step.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 step event, 68 lines of GML.

joyReleased = false;joyPressed = false;joyKey = checkJoyButton();if (joy){    if (joyKey != 0) joy = true;    else    {        joyReleased = true;        joy = false;    }}else{    if (joyKey != 0)    {        joyPressed = true;        joy = true;    }    else joy = false;}if (joyPressed){if (status == 0){    global.joyJumpVal = joyKey;}else if (status == 1){    global.joyAttackVal = joyKey;}else if (status == 2){    global.joyItemVal = joyKey;}else if (status == 3){    global.joyRunVal = joyKey;}else if (status == 4){    global.joyBombVal = joyKey;}else if (status == 5){    global.joyRopeVal = joyKey;}else if (status == 6){    global.joyFlareVal = joyKey;}else if (status == 7){    global.joyPayVal = joyKey;}else if (status == 8){    global.joyStartVal = joyKey;}}if (joyPressed or keyboard_check_pressed(vk_escape)){    status += 1;    if (gamepad.attackPressed) gamepad.attackPressed = false;    if (gamepad.startPressed) gamepad.startPressed = false;    if (status > 8) room_goto(rInit);}