objects/oTitle/create.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.
oTitle's create event, 105 lines of GML.
global.lake = false;global.cemetary = false;global.keepScore = true;darkness = 0;needDark = true;state = 0;global.scoresStart = 0;fadeOut = false;global.customLevel = false;global.testLevel = "";global.prevCustomLevel = "";view_xview[0] = 320;global.newMoney = false;global.newKills = false;global.newSaves = false;global.newTime = false;tMoney = highscore_value(1) - 9000000;tTime = highscore_value(2) - 8000000;tKills = highscore_value(3) - 7000000;tSaves = highscore_value(4) - 6000000;// Tunnel Manif (global.tunnel1 == 0 or (global.tunnel1 > 0 and global.tunnel2 == 0)){ instance_create(352, 96, oLadderOrange); instance_create(352, 96+16, oLadderTop); instance_create(352, 96+32, oLadderOrange); instance_create(352, 96+48, oLadderOrange); instance_create(352, 96+64, oLadderOrange); instance_create(352, 96+80, oLadderOrange); if (global.tunnel2 == 0) { instance_create(128, 112, oLevel9Sign); instance_create(144, 128, oXShortcut9); if (global.tunnel1 == 0) { instance_create(192, 112, oLevel13Sign); instance_create(208, 128, oXShortcut13); } } }else{ instance_create(320, 96, oBrick); instance_create(336, 96, oBrick);}if (tMoney >= 200000 && tTime > 0 && tTime <= 600 && tKills >= 120 && tSaves >= 8){ instance_create(32, 112, oMultiTrophy); instance_create(32, 128, oXChange2);}else{ instance_create(32+8, 128+8, oTunnelMan);}if (global.titleStart == 0){ darkness = 1; alarm[0] = 50; with oScreen { canPause = false; } //instance_create(280, -32, oPDummy4); //instance_create(280, 32, oFlare);}else if (global.titleStart == 1) // start at highscore door{ player = instance_create(432+8, 184, oPlayer1); player.facing = 19; instance_create(320+280, 188, oFlare); with oScreen { canPause = true; } playMusic(global.musTitle, true); if (global.firstTime) instance_create(384, 144, oHintHand);}else if (global.titleStart == 2) // start at rope{ player = instance_create(320+280, 184, oPlayer1); player.facing = 18; instance_create(320+280, 188, oFlare); with oScreen { canPause = true; } playMusic(global.musTitle, true); if (global.firstTime) instance_create(384, 144, oHintHand);}else if (global.titleStart == 3) // start at tutorial door{ player = instance_create(336+8, 184, oPlayer1); player.facing = 19; instance_create(320+280, 188, oFlare); with oScreen { canPause = true; } playMusic(global.musTitle, true); if (global.firstTime) instance_create(384, 144, oHintHand);}if (global.firstTime){ instance_create(320, 160, oBrick); instance_create(336, 160, oBrick); instance_create(336, 176, oBrick);}