1package { 2 import bigroom.input.KeyPoll; 3 import flash.display.*; 4 import flash.geom.*; 5 import flash.events.*; 6 import flash.net.*; 7 import flash.desktop.NativeApplication; 8 9 public class gameclass extends Sprite { 10 public var GAMEMODE:int = 0; 11 public var TITLEMODE:int = 1; 12 public var CLICKTOSTART:int = 2; 13 public var FOCUSMODE:int = 3; 14 public var MAPMODE:int = 4; 15 public var TELEPORTERMODE:int = 5; 16 public var GAMECOMPLETE:int = 6; 17 public var GAMECOMPLETE2:int = 7; 18 public var EDITORMODE:int = 8; 19 public var CONTROLTUTORIALMODE:int = 9; 20 21 public function gameclass(dwgfx:dwgraphicsclass, map:mapclass, obj:entityclass, help:helpclass, music:musicclass):void { 22 platform.init(); //Cross platform specific init 23 NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, onActivate); 24 NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, onDeactivate); 25 26 infocus = true; paused = false; muted = false; globalsound = 1; 27 /* 28 if(device.devicetype != device.MOBILE){ 29 addEventListener(Event.DEACTIVATE, windowNotActive); 30 addEventListener(Event.ACTIVATE, windowActive); 31 } 32 */ 33 34 //iOS only, turn off for android 35 scores.init(stage); 36 37 //gamestate = GAMEMODE; 38 hascontrol = true; jumpheld = false; advancetext = false; jumppressed = 0; 39 gravitycontrol = 0; teleport = false; companion = 0; roomchange = false; 40 41 edteleportent = 0; //Added in the port! 42 teleport_to_new_area = false; mapheld = false; teleport_to_x = 0; teleport_to_y = 0; 43 teleportscript = ""; 44 savemystats = false; 45 menukludge = false; 46 quickrestartkludge = false; 47 48 tapleft = 0; tapright = 0; 49 50 recording = 0; recordinit = false; playbackfinished = false; 51 recordstring = ""; 52 53 advancetext = false; pausescript = false; completestop = false; 54 activeactivity = -1; act_fade = 0; 55 backgroundtext = false; 56 startscript = false; newscript = ""; 57 inintermission = false; 58 59 alarmon = false; alarmdelay = 0; blackout = false; 60 creditposx = 0; creditposy = 0; creditposdelay = 0; 61 62 useteleporter = false; teleport_to_teleporter = 0; 63 64 teleblock = new Rectangle(); 65 activetele = false; readytotele = 0; 66 activity_lastprompt = ""; activity_r = 0; activity_g = 0; activity_b = 0; 67 creditposition = 0; 68 bestgamedeaths = -1; 69 70 //Accessibility Options 71 colourblindmode = false; 72 noflashingmode = false; 73 slowdown = 30; 74 75 fullscreen = false;// true; //Assumed true at first unless overwritten at some point! 76 advanced_mode = false; 77 advanced_smoothing = true; 78 advanced_scaling = 0; 79 80 nodeathmode = false; 81 nocutscenes = false; 82 83 for (i = 0; i < 50; i++){ 84 customscript.push(""); 85 } 86 customcol = 0; 87 88 for (i = 0; i < 6; i++) { 89 var cstats:Boolean; 90 cstats = false; 91 crewstats.push(cstats); 92 tele_crewstats.push(false); 93 quick_crewstats.push(false); 94 besttimes.push( -1); 95 besttrinkets.push( -1); 96 bestlives.push( -1); 97 bestrank.push( -1); 98 } 99 crewstats[0] = true; 100 lastsaved = 0; 101 102 tele_gametime = "00:00"; 103 tele_trinkets = 0; 104 tele_currentarea = "Error! Error!"; 105 quick_gametime = "00:00"; 106 quick_trinkets = 0; 107 quick_currentarea = "Error! Error!"; 108 109 //Menu stuff initiliased here: 110 for (i = 0; i < 25; i++) { 111 menuoptions.push(new String); 112 menuoptions_alt.push(new String); 113 menuoptionsactive.push(new Boolean); 114 menuoptionslayout.push(new int(0)); 115 116 var nb1:Boolean, nb2:Boolean; 117 nb1 = false; nb2 = false; 118 unlock.push(nb1); 119 unlocknotify.push(nb2); 120 } 121 122 for (i = 0; i < 25; i++) { unlock[i] = false; unlocknotify[i] = false; } 123 124 nummenuoptions = 0; currentmenuoption = 0; 125 menuselection = "null"; currentmenuname = "null"; 126 menuxoff = 0; menuyoff = 0; 127 menucountdown = 0; menudest="null"; 128 createmenu("mainmenu"); 129 130 deathcounts = 0; gameoverdelay = 0; 131 frames = 0; seconds = 0; minutes = 0; hours = 0; 132 gamesaved = false; 133 savetime = "00:00"; savearea = "nowhere"; savetrinkets = 0; 134 135 intimetrial = false; 136 timetrialcountdown = 0; timetrialshinytarget = 0; 137 timetrialparlost = false; timetrialpar = 0; timetrialresulttime = 0; 138 139 totalflips = 0; 140 hardestroom = "Welcome Aboard"; hardestroomdeaths = 0; currentroomdeaths=0; 141 142 sfpsmode = false; //by default, play at 30 fps 143 inertia = 1.1; 144 swnmode = false; swntimer = 0; swngame = 0;//Not playing sine wave ninja! 145 swnstate = 0; swnstate2 = 0; swnstate3 = 0; swnstate4 = 0; swndelay = 0; swndeaths = 0; 146 supercrewmate = false; scmhurt = false; scmprogress = 0; scmmoveme = false; 147 swncolstate = 0; swncoldelay = 0; 148 swnrecord = 0; swnbestrank = 0; swnrank = 0; swnmessage = 0; 149 150 for (i = 0; i < 200; i++) { 151 customlevelstats.push(""); 152 customlevelscore.push(int(0)); 153 } 154 155 clearcustomlevelstats(); 156 157 //Save stuff 158 for (i = 0; i < 3; i++) { 159 var supersave:saveclass = new saveclass(); 160 savestate.push(supersave); 161 } 162 163 telecookie = SharedObject.getLocal("vvvvvv_telesave"); 164 quickcookie = SharedObject.getLocal("vvvvvv_quicksave"); 165 levelstatscookie = SharedObject.getLocal("vvvvvv_levelstats"); 166 for (var i:int = 0; i < editor.playerlevel.length; i++) { 167 customcookie.push(SharedObject.getLocal("vvvvvv_custom_" + String(i))); 168 customcookieexists.push(false); 169 customcookiesummary.push(false); 170 } 171 172 levelstatscookieloaded = true; 173 if (levelstatscookie.data.num == undefined) { 174 levelstatscookie.data.num = 0; 175 } 176 177 if (telecookie.data.savex == undefined) { 178 telecookieexists = false; telesummary = ""; 179 } else { 180 telecookieexists = true; telesummary = telecookie.data.summary; 181 } 182 183 if (quickcookie.data.savex == undefined) { 184 quickcookieexists = false; quicksummary = ""; 185 } else { 186 quickcookieexists = true; quicksummary = quickcookie.data.summary; 187 } 188 189 for (i = 0; i < editor.playerlevel.length; i++) { 190 if(customcookie[i].data.savex == undefined) { 191 customcookieexists[i] = false; customcookiesummary[i] = ""; 192 } else { 193 customcookieexists[i] = true; customcookiesummary[i] = customcookie[i].data.summary; 194 } 195 } 196 197 screenshake = flashlight = 0; 198 199 stat_trinkets = 0; 200 201 test = false; teststring = "TEST = True"; 202 state = 1; statedelay = 0; 203 updatestate(dwgfx, map, obj, help, music); 204 } 205 206 public function onActivate(e:Event):void { 207 platform.callonwake(); 208 infocus = true; 209 } 210 211 public function onDeactivate(e:Event):void { 212 infocus = false; 213 } 214 215 public function clearcustomlevelstats():void{ 216 //just clearing the arrays 217 for (var i:int = 0; i < 200; i++) { 218 customlevelstats[i] = ""; 219 customlevelscore[i] = 0; 220 } 221 numcustomlevelstats = 0; 222 223 customlevelstatsloaded=false; //To ensure we don't load it where it isn't needed 224 } 225 226 public function updatecustomlevelstats(clevel:String, cscore:int):void{ 227 var tvar:int = -1; 228 for (var j:int = 0; j < numcustomlevelstats; j++) { 229 if (clevel == customlevelstats[j]) { 230 tvar=j; 231 j=numcustomlevelstats+1; 232 } 233 } 234 235 if (tvar >= 0) { 236 //update existing entry 237 customlevelscore[tvar]=cscore; 238 }else{ 239 //add a new entry 240 if (numcustomlevelstats < 200) { 241 customlevelstats[numcustomlevelstats]=clevel; 242 customlevelscore[numcustomlevelstats]=cscore; 243 numcustomlevelstats++; 244 } 245 } 246 savecustomlevelstats(); 247 } 248 249 public function loadcustomlevelstats():void{ 250 //Totally rewriten for mobile version, probably broken 251 if (!customlevelstatsloaded) { 252 numcustomlevelstats = levelstatscookie.data.num; 253 if (numcustomlevelstats > 0) { 254 if (numcustomlevelstats >= 200) numcustomlevelstats = 199; 255 256 var lvlstring:String = levelstatscookie.data.customlevelscore; 257 var values:Array; 258 values = new Array; 259 values = lvlstring.split(","); 260 for (var i:int = 0; i < values.length; i++) { 261 if (i < 200) customlevelscore[i] = int(values[i]); 262 } 263 264 lvlstring = levelstatscookie.data.customlevelstats; 265 values = new Array; 266 values = lvlstring.split("|"); 267 for(i = 0; i < values.length; i++){ 268 if (i < 200) customlevelstats[i] = values[i]; 269 } 270 } 271 } 272 } 273 274 public function savecustomlevelstats():void { 275 //Rewritten for mobile 276 levelstatscookie = SharedObject.getLocal("vvvvvv_levelstats"); 277 278 if (numcustomlevelstats >= 200) numcustomlevelstats = 199; 279 levelstatscookie.data.num = numcustomlevelstats; 280 281 var lvlstring:String = ""; 282 for (var i:int = 0; i < numcustomlevelstats; i++) { 283 lvlstring = lvlstring + customlevelscore[i] + ","; 284 } 285 levelstatscookie.data.customlevelscore = lvlstring; 286 287 lvlstring = "" 288 for (i = 0; i < numcustomlevelstats; i++) { 289 lvlstring = lvlstring + customlevelstats[i] + "|"; 290 } 291 levelstatscookie.data.customlevelstats = lvlstring; 292 293 levelstatscookie.flush(); 294 levelstatscookie.close(); 295 } 296 297 public function inittouchpoints(key:KeyPoll):void { 298 if (key.touchPoints > 0) { 299 my = key.touchy[key.touchPoints - 1]; 300 } 301 } 302 303 public function inbox(x:int, y:int, x1:int, y1:int, w:int, h:int):Boolean { 304 if (x >= x1 && x <= x1 + w) { 305 if (y >= y1 && y <= y1 + h) { 306 return true; 307 } 308 } 309 return false; 310 } 311 312 public var m_touchx:int, m_touchy:int; 313 public var m_pressed:Boolean = false; 314 public var b_gap:int = 40, b_size:int = 26; 315 316 public function gettouchpoints_mainmenu(key:KeyPoll, dwgfx:dwgraphicsclass):void { 317 //Checks for last touchpress. For main menu, check to see that you've lifted 318 //your finger before continuing. 319 if (!m_pressed) { 320 if (key.touchPoints > 0) { 321 m_pressed = true; 322 m_touchx = key.touchx[key.touchPoints - 1]; 323 m_touchy = key.touchy[key.touchPoints - 1]; 324 if (dwgfx.flipmode) m_touchy = dwgfx.devicey - m_touchy; 325 //These coordinates now need to be translated to actual screen coordinates 326 //Gamecenter 327 if(menustart && !showloadingnotice) { 328 if (inbox(m_touchx, m_touchy, 0, 0, dwgfx.buttonscreen[0].width + (dwgfx.buttonxspacing * 2), dwgfx.buttonscreen[0].height + (dwgfx.buttonyspacing * 2))) { 329 //Bring up game center achievements 330 scores.showAchievements(); 331 } 332 } 333 334 m_touchx -= dwgfx.screen.x; 335 m_touchx = m_touchx / dwgfx.screensizemultiplier; 336 m_touchy = m_touchy / dwgfx.screensizemultiplier; 337 338 //Ok! Now we see if we've pressed any buttons! 339 340 for (i = 0; i < nummenuoptions; i++) { 341 switch(menuoptionslayout[i]) { 342 case 0: 343 if (menuoptionsactive[i]) { 344 if (inbox(m_touchx, m_touchy, 160 - 70, 140 + (i * b_gap) + menuyoff - 6, 140, b_size)) { 345 press_action = true; 346 currentmenuoption = i; 347 } 348 } 349 break; 350 case 1: 351 if (menuoptionsactive[i]) { 352 if (inbox(m_touchx, m_touchy, 160 - 70, 140 + (i * b_gap) - 10 + menuyoff - 6, 140, b_size * 2)) { 353 press_action = true; 354 currentmenuoption = i; 355 } 356 } 357 break; 358 case 2: 359 if (menuoptionsactive[i]) { 360 if (inbox(m_touchx, m_touchy, 160 - 70, 140 + (i * b_gap)+20 + menuyoff - 6, 140, b_size)) { 361 press_action = true; 362 currentmenuoption = i; 363 } 364 } 365 break; 366 case 3: 367 if (menuoptionsactive[i]) { 368 if (inbox(m_touchx, m_touchy, -8, 230 - 6, 70, b_size)) { 369 press_action = true; 370 currentmenuoption = i; 371 } 372 } 373 break; 374 case 4: 375 if (menuoptionsactive[i]) { 376 if (inbox(m_touchx, m_touchy, 160 - 90, 140 + (i * b_gap) + menuyoff - 6, 180, b_size)) { 377 press_action = true; 378 currentmenuoption = i; 379 } 380 } 381 break; 382 case 5: 383 if (menuoptionsactive[i]) { 384 if (inbox(m_touchx, m_touchy, 10, 140 + (i * 68)-10 + menuyoff - 6, 140, 40)) { 385 press_action = true; 386 currentmenuoption = i; 387 } 388 } 389 break; 390 case 6: 391 if (menuoptionsactive[i]) { 392 if (inbox(m_touchx, m_touchy, 170, 140 + ((i-3) * 68)-10 + menuyoff - 6, 140, 40)) { 393 press_action = true; 394 currentmenuoption = i; 395 } 396 } 397 break; 398 case 7: 399 if (menuoptionsactive[i]) { 400 if (inbox(m_touchx, m_touchy, -8, 230 - 6-10, 70, b_size)) { 401 press_action = true; 402 currentmenuoption = i; 403 } 404 } 405 break; 406 case 8: 407 if (menuoptionsactive[i]) { 408 if (inbox(m_touchx, m_touchy, 320 - 70, 230 - 6-10, 70, b_size)) { 409 press_action = true; 410 currentmenuoption = i; 411 } 412 } 413 break; 414 case 9: 415 if (menuoptionsactive[i]) { 416 if (inbox(m_touchx, m_touchy, 160 - 90, 140 + (i * b_gap) + menuyoff - 6, 180, b_size)) { 417 press_action = true; 418 currentmenuoption = i; 419 } 420 } 421 break; 422 case 10: 423 if (menuoptionsactive[i]) { 424 if (inbox(m_touchx, m_touchy, 160 - 70, 240 - b_gap, 140, b_size)) { 425 press_action = true; 426 currentmenuoption = i; 427 } 428 } 429 break; 430 case 11: 431 if (menuoptionsactive[i]) { 432 if (inbox(m_touchx, m_touchy, 160 - 140, 140 + (i * 65)-10 + menuyoff - 6, 280, (b_size*2)+5)) { 433 press_action = true; 434 currentmenuoption = i; 435 } 436 } 437 break; 438 case 12: 439 if (menuoptionsactive[i]) { 440 if (inbox(m_touchx, m_touchy, 320 - 70, 0, 70, b_size+10)) { 441 press_action = true; 442 currentmenuoption = i; 443 } 444 } 445 break; 446 } 447 448 if (!menustart) press_action = true; 449 } 450 } 451 }else { 452 if (key.touchPoints == 0) { 453 m_pressed = false; 454 } 455 } 456 } 457 458 459 public function gettouchpoints_gamemenu(key:KeyPoll, obj:entityclass, music:musicclass, dwgfx:dwgraphicsclass):void { 460 //Buttons for in game menu! 461 if (!m_pressed) { 462 if (key.touchPoints > 0) { 463 m_pressed = true; 464 m_touchx = key.touchx[key.touchPoints - 1]; 465 m_touchy = key.touchy[key.touchPoints - 1]; 466 if (dwgfx.flipmode) m_touchy = dwgfx.devicey - m_touchy; 467 468 if (inbox(m_touchx, m_touchy, dwgfx.devicex - dwgfx.buttonscreen[0].width - dwgfx.buttonxspacing, 0, dwgfx.buttonscreen[0].width + (dwgfx.buttonxspacing*2), dwgfx.buttonscreen[0].height + (dwgfx.buttonyspacing*2) )) { 469 press_map = true; 470 } 471 if(menupage == 0){ 472 if (inbox(m_touchx, m_touchy, 0, 0, dwgfx.buttonscreen[1].width + (dwgfx.buttonxspacing*2), dwgfx.buttonscreen[1].height + (dwgfx.buttonyspacing*2) )) { 473 menupage = 30; 474 music.playef(11, 10); 475 } 476 } 477 478 //These coordinates now need to be translated to actual screen coordinates 479 m_touchx -= dwgfx.screen.x; 480 m_touchx = m_touchx / dwgfx.screensizemultiplier; 481 m_touchy = m_touchy / dwgfx.screensizemultiplier; 482 483 //Ok! Now we see if we've pressed any buttons! 484 if (inbox(m_touchx, m_touchy, 30 - 8-10, 220-20, 56+20, b_size+40)) { 485 //Press map button 486 //disablekludge_1 = !disablekludge_1; 487 menupage = 0; 488 music.playef(11, 10); 489 }else if (inbox(m_touchx, m_touchy, 103-10, 220-20, 56+20, b_size+40)) { 490 //Press crew button 491 //disablekludge_2 = !disablekludge_2; 492 menupage = 1; 493 music.playef(11, 10); 494 }else if (inbox(m_touchx, m_touchy, 185-4-10, 220-20, 56+20, b_size+40)) { 495 //Press stats button 496 //disablekludge_3 = !disablekludge_3; 497 menupage = 2; 498 music.playef(11, 10); 499 }else if (inbox(m_touchx, m_touchy, 258-10, 220-20, 56+20, b_size+40)) { 500 //Press quit button 501 //disablekludge_4 = !disablekludge_4; 502 menupage = 3; 503 music.playef(11, 10); 504 } 505 506 if (menupage == 1 && !insecretlab && obj.flags[67] == 1) { 507 if (inbox(m_touchx, m_touchy, 160 + 4 - 24-20, 110-20, (8 * 6)+40, b_size+40)) { 508 //Warp to ship! 509 press_action = true; 510 } 511 } 512 if (menupage == 3 || menupage == 10 || menupage == 20) { 513 if (inbox(m_touchx, m_touchy, 160 + 4 - 24-20, 110-20, (8 * 6)+40, b_size+40)) { 514 //Press quit button 515 press_action = true; 516 } 517 } 518 if (menupage == 30) { 519 //Change controls 520 if (inbox(m_touchx, m_touchy, 160 - (12 * 8) - 20-10, 156-20, (8 * 8)+20, b_size+40)) { 521 if(controlstyle!=0){ 522 controlstyle = 0; 523 music.playef(11, 10); 524 savemystats = true; 525 } 526 } 527 if (inbox(m_touchx, m_touchy, 160 - (4 * 8)-20, 156-10, (8 * 8)+20, b_size+40)) { 528 if(controlstyle!=1){ 529 controlstyle = 1; 530 music.playef(11, 10); 531 savemystats = true; 532 } 533 } 534 if (inbox(m_touchx, m_touchy, 160 + (4 * 8)+20-10, 156-20, (8 * 8)+20, b_size+40)) { 535 if(controlstyle!=2){ 536 controlstyle = 2; 537 music.playef(11, 10); 538 savemystats = true; 539 } 540 } 541 } 542 543 } 544 }else { 545 if (key.touchPoints == 0) { 546 m_pressed = false; 547 } 548 } 549 } 550 551 public function gettouchpoints_teleportmenu(key:KeyPoll, music:musicclass, dwgfx:dwgraphicsclass):void { 552 //Buttons for in game menu! 553 if (!m_pressed) { 554 if (key.touchPoints > 0) { 555 m_pressed = true; 556 m_touchx = key.touchx[key.touchPoints - 1]; 557 m_touchy = key.touchy[key.touchPoints - 1]; 558 if (dwgfx.flipmode) m_touchy = dwgfx.devicey - m_touchy; 559 //These coordinates now need to be translated to actual screen coordinates 560 m_touchx -= dwgfx.screen.x; 561 m_touchx = m_touchx / dwgfx.screensizemultiplier; 562 m_touchy = m_touchy / dwgfx.screensizemultiplier; 563 564 //Ok! Now we see if we've pressed any buttons! 565 if (inbox(m_touchx, m_touchy, 5+10-20, 220-10-20, 64+40, b_size+40)) { 566 //Press left 567 press_left = true; 568 music.playef(11, 10); 569 }else if (inbox(m_touchx, m_touchy,320 - 5 - 64-20, 220-10-20, 64+40, b_size+40)) { 570 //Press right 571 press_right = true; 572 music.playef(11, 10); 573 }else if (inbox(m_touchx, m_touchy, 160 - 40+4-20, 220-20, 64+16+40, b_size+40)) { 574 //Press teleport 575 press_map = true; 576 music.playef(11, 10); 577 } 578 } 579 }else { 580 if (key.touchPoints == 0) { 581 m_pressed = false; 582 } 583 } 584 } 585 586 public function gettouchpoints_gamecomplete(key:KeyPoll, music:musicclass, dwgfx:dwgraphicsclass):void { 587 //Buttons for in game menu! 588 if (!m_pressed) { 589 if (key.touchPoints > 0) { 590 /* 591 m_touchx = key.touchx[key.touchPoints - 1]; 592 m_touchy = key.touchy[key.touchPoints - 1]; 593 if (dwgfx.flipmode) m_touchy = dwgfx.devicey - m_touchy; 594 //These coordinates now need to be translated to actual screen coordinates 595 m_touchx -= dwgfx.screen.x; 596 m_touchx = m_touchx / dwgfx.screensizemultiplier; 597 m_touchy = m_touchy / dwgfx.screensizemultiplier; 598 */ 599 press_action = true; 600 601 } 602 }else { 603 if (key.touchPoints == 0) { 604 m_pressed = false; 605 } 606 } 607 } 608 609 public function gettouchpoints_controltutorial(key:KeyPoll, music:musicclass, dwgfx:dwgraphicsclass):void { 610 //Buttons for in game menu! 611 if (!m_pressed) { 612 if (key.touchPoints > 0) { 613 m_pressed = true; 614 m_touchx = key.touchx[key.touchPoints - 1]; 615 m_touchy = key.touchy[key.touchPoints - 1]; 616 if (dwgfx.flipmode) m_touchy = dwgfx.devicey - m_touchy; 617 //These coordinates now need to be translated to actual screen coordinates 618 m_touchx -= dwgfx.screen.x; 619 m_touchx = m_touchx / dwgfx.screensizemultiplier; 620 m_touchy = m_touchy / dwgfx.screensizemultiplier; 621 622 //Ok! Now we see if we've pressed any buttons! 623 if (inbox(m_touchx, m_touchy, 160 + 4 - 24-20, 200-20, (8 * 7)+40, b_size+40)) { 624 //Press continue 625 press_action = true; 626 music.playef(11, 10); 627 } 628 } 629 }else { 630 if (key.touchPoints == 0) { 631 m_pressed = false; 632 } 633 } 634 } 635 636 public function gettouchpoints(key:KeyPoll, dwgfx:dwgraphicsclass):void { 637 //Iterate through touch points, find buttons that are being pressed 638 switch(controlstyle) { 639 case 0: 640 //Swipe controls 641 for (i = 0; i < key.touchPoints; i++) { 642 /*if (inbox(key.touchx[i], key.touchy[i], 0, dwgfx.buttonpos[0].y - 100, dwgfx.buttonsize + dwgfx.buttonxspacing+ (dwgfx.buttonxspacing/2), dwgfx.buttonsize + 200)) { 643 press_left = true; 644 }else if (inbox(key.touchx[i], key.touchy[i], dwgfx.buttonpos[1].x - (dwgfx.buttonxspacing/2), dwgfx.buttonpos[1].y - 100, dwgfx.buttonsize + (dwgfx.buttonxspacing*3), dwgfx.buttonsize + 200)) { 645 press_right = true; 646 }else 647 */ 648 if (insecretlab) { 649 if (inbox(key.touchx[i], key.touchy[i], 0, 0, dwgfx.buttonscreen[0].width + (dwgfx.buttonxspacing * 2), dwgfx.buttonscreen[0].height + (dwgfx.buttonyspacing * 2) )) { 650 scores.opengamecenter(); 651 press_map = true; 652 } 653 } 654 if (inbox(key.touchx[i], key.touchy[i], dwgfx.devicex - dwgfx.buttonscreen[0].width - dwgfx.buttonxspacing, 0, dwgfx.buttonscreen[0].width + (dwgfx.buttonxspacing*2), dwgfx.buttonscreen[0].height + (dwgfx.buttonyspacing*2) )) { 655 press_map = true; 656 }else { 657 if (key.touchid[i] != key.controlstick) { 658 press_action = true; 659 } 660 } 661 } 662 663 if (key.pushleft) press_left = true; 664 if (key.pushright) press_right = true; 665 break; 666 case 1: 667 //both sides 668 for (i = 0; i < key.touchPoints; i++) { 669 //if (inbox(key.touchx[i], key.touchy[i], 0, 0, dwgfx.devicex, dwgfx.devicey / 4)) { 670 // press_action = true; 671 //}else 672 if (insecretlab) { 673 if (inbox(key.touchx[i], key.touchy[i], 0, 0, dwgfx.buttonscreen[0].width + (dwgfx.buttonxspacing * 2), dwgfx.buttonscreen[0].height + (dwgfx.buttonyspacing * 2) )) { 674 scores.opengamecenter(); 675 press_map = true; 676 } 677 } 678 if (inbox(key.touchx[i], key.touchy[i], dwgfx.devicex - dwgfx.buttonscreen[0].width - dwgfx.buttonxspacing, 0, dwgfx.buttonscreen[0].width + (dwgfx.buttonxspacing*2), dwgfx.buttonscreen[0].height + (dwgfx.buttonyspacing*2) )) { 679 press_map = true; 680 }else{ 681 if (inbox(key.touchx[i], key.touchy[i], 0, 0, dwgfx.devicex / 2, dwgfx.devicey)) { 682 press_left = true; 683 }else if (inbox(key.touchx[i], key.touchy[i], dwgfx.devicex / 2, 0, dwgfx.devicex / 2, dwgfx.devicey)) { 684 press_right = true; 685 } 686 } 687 } 688 689 /* 690 if (last_action > 0) { 691 if (!press_left || !press_right) { 692 last_action = 0; 693 }else { 694 press_left = false; 695 press_right = false; 696 } 697 } 698 */ 699 700 //if (last_action > 0) { 701 if (press_left && press_right) { 702 if (last_left > 0 && last_right > 0) { 703 press_left = false; 704 press_right = false; 705 press_action = true; 706 last_action = 1; 707 }else if (last_left > 0 && last_right == 0) { 708 press_right = false; 709 press_action = true; 710 }else if (last_left == 0 && last_right > 0) { 711 press_left = false; 712 press_action = true; 713 } 714 } 715 //} 716 717 if (press_left) { 718 last_left = 2; 719 }else { 720 if (last_left > 0) last_left--; 721 } 722 if (press_right) { 723 last_right = 2; 724 }else { 725 if (last_right > 0) last_right--; 726 } 727 break; 728 case 2: 729 //D-Pad controls 730 for (i = 0; i < key.touchPoints; i++) { 731 if (insecretlab) { 732 if (inbox(key.touchx[i], key.touchy[i], 0, 0, dwgfx.buttonscreen[0].width + (dwgfx.buttonxspacing * 2), dwgfx.buttonscreen[0].height + (dwgfx.buttonyspacing * 2) )) { 733 scores.opengamecenter(); 734 press_map = true; 735 } 736 } 737 if (inbox(key.touchx[i], key.touchy[i], dwgfx.devicex - dwgfx.buttonscreen[0].width - dwgfx.buttonxspacing, 0, dwgfx.buttonscreen[0].width + (dwgfx.buttonxspacing*2), dwgfx.buttonscreen[0].height + (dwgfx.buttonyspacing*2) )) { 738 press_map = true; 739 }else if (inbox(key.touchx[i], key.touchy[i], 0, dwgfx.buttonpos[2].y - (dwgfx.devicey*2/3), dwgfx.buttonsize + dwgfx.buttonxspacing+ (dwgfx.buttonxspacing/2), dwgfx.devicey)) { 740 press_left = true; 741 }else if (inbox(key.touchx[i], key.touchy[i], dwgfx.buttonpos[3].x - (dwgfx.buttonxspacing / 2), dwgfx.buttonpos[3].y -(dwgfx.devicey*2 / 3), dwgfx.buttonsize + (dwgfx.buttonxspacing * 5), dwgfx.devicey)) { 742 press_right = true; 743 }else if (key.touchx[i] > dwgfx.devicex / 2) { 744 press_action = true; 745 } 746 } 747 break; 748 } 749 } 750 751 public function windowNotActive(e:Event):void{ infocus = false; } 752 public function windowActive(e:Event):void{ infocus = true; } 753 754 public function customstart(obj:entityclass, music:musicclass):void{ 755 jumpheld = true; 756 757 savex = edsavex; 758 savey = edsavey; 759 saverx = edsaverx; 760 savery = edsavery; 761 762 savegc = edsavegc; 763 savedir = edsavedir; //Worldmap Start 764 //savex = 6 * 8; savey = 15 * 8; saverx = 46; savery = 54; savegc = 0; savedir = 1; //Final Level Current 765 savepoint = 0; 766 gravitycontrol = savegc; 767 768 coins = 0; 769 trinkets = 0; 770 crewmates = 0; 771 772 //state = 2; deathseq = -1; lifeseq = 10; //Not dead, in game initilisation state 773 state = 0; 774 deathseq = -1; 775 lifeseq = 0; 776 777 //let's teleport in! 778 //state = 2500; 779 //if (!nocutscenes) music.play(5); 780 } 781 782 public function start(obj:entityclass, music:musicclass):void { 783 jumpheld = true; 784 785 savex = 232; savey = 113; saverx = 104; savery = 110; savegc = 0; savedir = 1; //Worldmap Start 786 //savex = 6 * 8; savey = 15 * 8; saverx = 46; savery = 54; savegc = 0; savedir = 1; //Final Level Current 787 savepoint = 0; 788 gravitycontrol = savegc; 789 790 coins = 0; trinkets = 0; 791 792 //state = 2; deathseq = -1; lifeseq = 10; //Not dead, in game initilisation state 793 state = 0; deathseq = -1; lifeseq = 0; 794 795 //let's teleport in! 796 //state = 2500; 797 if (!nocutscenes) music.play(5); 798 } 799 800 801 public function startspecial(t:int, obj:entityclass, music:musicclass):void { 802 jumpheld = true; 803 804 switch(t) { 805 case 0: //Secret Lab 806 savex = 104; savey = 169; saverx = 118; savery = 106; savegc = 0; savedir = 1; 807 break; 808 case 1: //Intermission 1 (any) 809 savex = 80; savey = 57; saverx = 41; savery = 56; savegc = 0; savedir = 0; 810 break; 811 default: 812 savex = 232; savey = 113; saverx = 104; savery = 110; savegc = 0; savedir = 1; //Worldmap Start 813 break; 814 } 815 816 savepoint = 0; 817 gravitycontrol = savegc; 818 coins = 0; trinkets = 0; 819 state = 0; deathseq = -1; lifeseq = 0; 820 } 821 822 public function starttrial(t:int, obj:entityclass, music:musicclass):void { 823 jumpheld = true; 824 825 switch(t) { 826 case 0: //Space Station 1 827 savex = 200; savey = 161; saverx = 113; savery = 105; savegc = 0; savedir = 1; 828 break; 829 case 1: //Lab 830 savex = 191; savey = 33; saverx = 102; savery = 116; savegc = 0; savedir = 1; 831 break; 832 case 2: //Tower 833 savex = 84; savey = 193, saverx = 108; savery = 109; savegc = 0; savedir = 1; 834 break; 835 case 3: //Space Station 2 836 savex = 148; savey = 38; saverx = 112; savery = 114; savegc = 1; savedir = 0; 837 break; 838 case 4: //Warp 839 savex = 52; savey = 73; saverx = 114; savery = 101; savegc = 0; savedir = 1; 840 break; 841 case 5: //Final 842 savex = 101; savey = 113; saverx = 46; savery = 54; savegc = 0; savedir = 1; 843 break; 844 default: 845 savex = 232; savey = 113; saverx = 104; savery = 110; savegc = 0; savedir = 1; //Worldmap Start 846 break; 847 } 848 849 savepoint = 0; 850 gravitycontrol = savegc; 851 852 coins = 0; trinkets = 0; 853 854 //state = 2; deathseq = -1; lifeseq = 10; //Not dead, in game initilisation state 855 state = 0; deathseq = -1; lifeseq = 0; 856 } 857 858 public function starttest(obj:entityclass, music:musicclass):void { 859 jumpheld = true; 860 861 //savex = 19*8; savey = 17*8; saverx = 50; savery = 50; savegc = 0; savedir = 1; //Generic Start 862 863 //savex = 19*8; savey = 18*8; saverx = 114; savery = 101; savegc = 0; savedir = 1; //Warp Zone Start 864 //savex = 20*8; savey = 18*8; saverx = 113; savery = 100; savegc = 0; savedir = 1; //Warp Zone current 865 866 //savex = 6 * 8; savey = 6 * 8; saverx = 113; savery = 105; savegc = 0; savedir = 1; //Space Station Start 867 //savex = 6 * 8; savey = 6 * 8; saverx = 50; savery = 42; savegc = 0; savedir = 1; //Space Station Reversal 868 //savex = 16 * 8; savey = 10 * 8; saverx = 116; savery = 107; savegc = 0; savedir = 1; //Space Station Tele 869 870 //savex = 5 * 8; savey = 5 * 8; saverx = 112; savery = 114; savegc = 1; savedir = 1; //Space Station 2 Start 871 //savex = 22*8; savey = 10*8; saverx = 113; savery = 108; savegc = 0; savedir = 1; //Space Station 2 Tele1 872 //savex = 9*8; savey = 13*8; saverx = 118; savery = 108; savegc = 0; savedir = 1; //Space Station 2 s.driller 873 //savex = 10*8; savey = 22*8; saverx = 111; savery = 107; savegc = 0; savedir = 1; //Space Station 2 ending 874 //savex = 24*8; savey = 26*8; saverx = 53; savery = 52; savegc = 0; savedir = 1; //Actual start 875 //savex = 5 * 8; savey = 5 * 8; saverx = 117; savery = 108; savegc = 0; savedir = 1; //Space Station 2 wip 876 877 //savex = 18 * 8; savey = 24 * 8; saverx = 100; savery = 116; savegc = 0; savedir = 1; //Lab outside, start 878 //savex = 17 * 8; savey = 24 * 8; saverx = 107; savery = 115; savegc = 1; savedir = 1; //Lab tele 879 //savex = 31 * 8; savey = 12 * 8; saverx = 49; savery = 54; savegc = 1; savedir = 1; //Lab, final bit 880 //savex = 19 * 8; savey = 14 * 8; saverx = 104; savery = 102; savegc = 0; savedir = 1; //Lab, ending 881 882 //savex = 20; savey = 680*8; saverx = 109; savery = 101; savegc = 0; savedir = 1; //The tower 883 //savex = 6 * 8; savey = 6 * 8; saverx = 108; savery = 109; savegc = 0; savedir = 1; //Area just before tower 884 //savex = 6 * 8; savey = 6 * 8; saverx = 110; savery = 104; savegc = 0; savedir = 1; //Area after tower 885 //savex = 70; savey = 129; saverx = 1; savery = 1; savegc = 0; savedir = 1; //The testbed 886 887 //savex = 14 * 8; savey = 15 * 8; saverx = 102; savery = 111; savegc = 0; savedir = 1; //Worldmap Start 888 //savex = 19 * 8; savey = 13 * 8; saverx = 114; savery = 117; savegc = 0; savedir = 1; //Warp zone entrance 889 //savex = 19 * 8; savey = 13 * 8; saverx = 110; savery = 109; savegc = 0; savedir = 1; //The Elephant 890 891 //savex = 16 * 8; savey = 15 * 8; saverx = 46; savery = 54; savegc = 0; savedir = 1; //Final Level Start 892 //savex = 5 * 8; savey = 15 * 8; saverx = 41; savery = 52; savegc = 0; savedir = 1; //Final Level Midpoint 893 //savex = (5-3) * 8; savey = (5+2) * 8; saverx = 52-2; savery = 53; savegc = 0; savedir = 1; //Final Level End 894 895 //savex = 6 * 8; savey = 6 * 8; saverx = 117; savery = 107; savegc = 0; savedir = 1; //Space Station Start 896 897 savex = 13 * 8; savey = 129; saverx = 102; savery = 111; savegc = 0; savedir = 1; //Worldmap Start ********** 898 //savex = 13 * 8; savey = (19 * 8)-22; saverx = 107; savery = 108; savegc = 0; savedir = 1; //Worldmap Start 899 900 //savex = 228; savey = 129; saverx = 53; savery = 49; savegc = 0; savedir = 0; //Intermission level 2 901 //savex = 80; savey = 57; saverx = 41; savery = 56; savegc = 0; savedir = 0; //Intermission level 1 902 //savex = 215; savey = 33; saverx = 52-1; savery = 56; savegc = 0; savedir = 0; //Intermission level 1 903 904 //savex = 104; savey = 169; saverx = 118; savery = 106; savegc = 0; savedir = 1; //Secret Lab 905 //savex = 132; savey = 137; saverx = 119; savery = 107; savegc = 0; savedir = 1; //Secret Lab (beside gravitron) 906 907 savepoint = 0; 908 gravitycontrol = savegc; 909 910 coins = 0; trinkets = 0; 911 912 state = 0; deathseq = -1; lifeseq = 10; 913 914 //music.play(1); 915 } 916 917 //Menu stuff first! 918 public function createmenu(t:String):void { 919 var tcount:int, i:int, tvar:int, j:int; 920 for (i = 0; i < 25; i++) menuoptionslayout[i] = 0; 921 922 currentmenuoption = 0; menuselection = "null"; currentmenuname = t; 923 menuxoff = 0; menuyoff = 0; 924 menucountdown = 0; menudest="null"; 925 926 if (mobilemenu) { 927 if (t == "mainmenu") { 928 showloadingnotice = false; 929 menuoptions[0] = "play"; 930 menuoptionsactive[0] = true; 931 menuoptionslayout[0] = 1; 932 menuoptions[1] = "player worlds"; 933 menuoptionsactive[1] = true; 934 menuoptionslayout[1] = 2; 935 /*menuoptions[2] = "super gravitron"; 936 menuoptionsactive[2] = true; 937 menuoptionslayout[2] = 2; 938 */ 939 menuoptions[2] = "options"; 940 menuoptionsactive[2] = true; 941 menuoptionslayout[2] = 7; 942 menuoptions[3] = "credits"; 943 menuoptionsactive[3] = true; 944 menuoptionslayout[3] = 8; 945 menuoptions[4] = "more games"; 946 menuoptionsactive[4] = true; 947 menuoptionslayout[4] = 12; 948 nummenuoptions = 5; 949 menuxoff = -16; 950 menuyoff = -50+20; 951 }else if (t == "playerworlds"){ 952 menuoptions[0] = "play a level"; 953 menuoptionsactive[0] = true; 954 menuoptions[1] = "level editor"; 955 menuoptionsactive[1] = true; 956 menuoptions[2] = "< back"; menuoptionsactive[2] = true; 957 menuoptionslayout[2] = 3; 958 nummenuoptions = 3; 959 menuxoff = -30; 960 menuyoff = -40-(12*2); 961 }else if (t == "quickloadlevel") { 962 menuoptions[0] = "continue from save"; 963 menuoptionsactive[0] = true; 964 menuoptionslayout[0] = 4; 965 menuoptions[1] = "start from beginning"; 966 menuoptionsactive[1] = true; 967 menuoptionslayout[1] = 4; 968 menuoptions[2] = "< back"; menuoptionsactive[2] = true; 969 menuoptionslayout[2] = 3; 970 nummenuoptions = 3; 971 menuxoff = -40; 972 menuyoff = -30-(12*2); 973 }else if (t == "youwannaquit") { 974 menuoptions[0] = "yes, quit"; menuoptionsactive[0] = true; 975 menuoptions[1] = "no, return"; menuoptionsactive[1] = true; 976 nummenuoptions = 2; 977 menuxoff = 0; menuyoff = -20-(12*2); 978 }else if (t == "levellist"){ 979 if (editor.ListOfMetaData.length == 0) { 980 menuoptions[0] = "ok"; 981 menuoptionsactive[0] = true; 982 nummenuoptions = 1; 983 menuxoff = 0; 984 menuyoff = -20; 985 }else{ 986 tcount = 0; 987 for (i = 0; i < editor.ListOfMetaData.length; i++) { 988 if (i >= levelpage * 3 && i < (levelpage * 3) + 3) { 989 //This is, er, suboptimal. Whatever, life optimisation and all that 990 tvar = -1; 991 for (j = 0; j < numcustomlevelstats; j++) { 992 if (editor.ListOfMetaData[i].filename == customlevelstats[j]) { 993 tvar = customlevelscore[j]; 994 j=numcustomlevelstats+1; 995 } 996 } 997 /* 998 if(tvar>=0){ 999 if(customlevelscore[tvar]==0){ 1000 menuoptions[tcount] = " " + editor.ListOfMetaData[i].title; 1001 }else if(customlevelscore[tvar]==1){ 1002 menuoptions[tcount] = " * " + editor.ListOfMetaData[i].title; 1003 }else if(customlevelscore[tvar]==3){ 1004 menuoptions[tcount] = "** " + editor.ListOfMetaData[i].title; 1005 } 1006 }else{ 1007 menuoptions[tcount] = " " + editor.ListOfMetaData[i].title; 1008 } 1009 */ 1010 menuoptions[tcount] = String(i); 1011 menuoptions_alt[tcount] = String(tvar); 1012 menuoptionsactive[tcount] = true; 1013 menuoptionslayout[tcount] = 11; 1014 menuoptions[tcount] = menuoptions[tcount].toLowerCase(); 1015 tcount++; 1016 } 1017 } 1018 if((levelpage*3)+3<editor.ListOfMetaData.length){ 1019 menuoptions[tcount] = "next page"; 1020 menuoptionsactive[tcount] = true; 1021 menuoptionslayout[tcount] = 10; 1022 tcount++; 1023 }else{ 1024 menuoptions[tcount] = "first page"; 1025 menuoptionsactive[tcount] = true; 1026 menuoptionslayout[tcount] = 10; 1027 tcount++; 1028 } 1029 1030 menuoptions[tcount] = "< back"; menuoptionsactive[tcount] = true; 1031 menuoptionslayout[tcount] = 3; 1032 tcount++; 1033 1034 nummenuoptions = tcount; 1035 menuxoff = -90; 1036 menuyoff = -120; 1037 } 1038 }else if (t == "graphicoptions") { 1039 if (advanced_mode) { 1040 if(fullscreen){ 1041 menuoptions[0] = "change to windowed mode"; menuoptionsactive[0] = true; 1042 }else { 1043 menuoptions[0] = "change to fullscreen"; menuoptionsactive[0] = true; 1044 } 1045 menuoptions[1] = "enable acceleration"; menuoptionsactive[1] = true; 1046 menuoptions[2] = "change scaling mode"; menuoptionsactive[2] = true; 1047 if (advanced_smoothing) { 1048 menuoptions[3] = "disable smoothing"; menuoptionsactive[3] = true; 1049 }else{ 1050 menuoptions[3] = "enable smoothing"; menuoptionsactive[3] = true; 1051 } 1052 menuoptions[4] = "< back"; menuoptionsactive[4] = true; 1053 menuoptionslayout[4] = 3; 1054 nummenuoptions = 5; 1055 menuxoff = -50; menuyoff = 16-(12*4); 1056 }else{ 1057 if(fullscreen){ 1058 menuoptions[0] = "change to windowed mode"; menuoptionsactive[0] = true; 1059 }else { 1060 menuoptions[0] = "change to fullscreen"; menuoptionsactive[0] = true; 1061 } 1062 menuoptions[1] = "disable acceleration"; menuoptionsactive[1] = true; 1063 menuoptions[2] = "< back"; menuoptionsactive[2] = true; 1064 menuoptionslayout[2] = 3; 1065 nummenuoptions = 3; 1066 menuxoff = -50; menuyoff = 16-(12*2); 1067 } 1068 }else if (t == "options") { 1069 menuoptions[0] = "accessibility options"; menuoptionsactive[0] = true; 1070 menuoptionslayout[0] = 4; 1071 menuoptions[1] = "unlock play modes"; menuoptionsactive[1] = true; 1072 menuoptionslayout[1] = 4; 1073 menuoptions[2] = "clear data"; menuoptionsactive[2] = true; 1074 menuoptionslayout[2] = 4; 1075 menuoptions[3] = "< back"; menuoptionsactive[3] = true; 1076 menuoptionslayout[3] = 3; 1077 nummenuoptions = 4; 1078 menuxoff = -40; menuyoff = -30-(12*3); 1079 }else if (t == "accessibility") { 1080 menuoptions[0] = "animated backgrounds"; menuoptionsactive[0] = true; 1081 menuoptionslayout[0] = 4; 1082 menuoptions[1] = "screen effects"; menuoptionsactive[1] = true; 1083 menuoptionslayout[1] = 4; 1084 //menuoptions[2] = "invincibility"; menuoptionsactive[2] = true; 1085 //menuoptions[3] = "slowdown"; menuoptionsactive[3] = true; 1086 menuoptions[2] = "< back"; menuoptionsactive[2] = true; 1087 menuoptionslayout[2] = 3; 1088 nummenuoptions = 3; 1089 menuxoff = -40; menuyoff = 16-(12*2); 1090 }else if (t == "cleardatamenu") { 1091 menuoptions[0] = "no! don't delete"; menuoptionsactive[0] = true; 1092 menuoptionslayout[0] = 4; 1093 menuoptions[1] = "delete everything"; menuoptionsactive[1] = true; 1094 menuoptionslayout[1] = 4; 1095 nummenuoptions = 2; 1096 menuxoff = -30; menuyoff = 32-(12*2)-32; 1097 }else if (t == "setinvincibility") { 1098 menuoptions[0] = "no, return to options"; menuoptionsactive[0] = true; 1099 menuoptions[1] = "yes, delete saves"; menuoptionsactive[1] = true; 1100 nummenuoptions = 2; 1101 menuxoff = -30; menuyoff = 64-(12*2); 1102 }else if (t == "setslowdown1") { 1103 menuoptions[0] = "no, return to options"; menuoptionsactive[0] = true; 1104 menuoptions[1] = "yes, delete saves"; menuoptionsactive[1] = true; 1105 nummenuoptions = 2; 1106 menuxoff = -30; menuyoff = 64-(12*2); 1107 }else if (t == "setslowdown2") { 1108 menuoptions[0] = "normal speed"; menuoptionsactive[0] = true; 1109 menuoptions[1] = "80% speed"; menuoptionsactive[1] = true; 1110 menuoptions[2] = "60% speed"; menuoptionsactive[2] = true; 1111 menuoptions[3] = "40% speed"; menuoptionsactive[3] = true; 1112 nummenuoptions = 4; 1113 menuxoff = -40; menuyoff = 16-(12*3); 1114 }else if (t == "unlockmenu") { 1115 menuoptions[0] = "unlock time trials"; menuoptionsactive[0] = true; menuoptionslayout[0] = 9; 1116 menuoptions[1] = "unlock intermissions"; menuoptionsactive[1] = !unlock[16]; menuoptionslayout[1] = 9; 1117 menuoptions[2] = "unlock no death mode"; menuoptionsactive[2] = !unlock[17];menuoptionslayout[2] = 9; 1118 menuoptions[3] = "unlock flip mode"; menuoptionsactive[3] = !unlock[18];menuoptionslayout[3] = 9; 1119 menuoptions[4] = "unlock ship jukebox"; menuoptionsactive[4] = (stat_trinkets<20);menuoptionslayout[4] = 9; 1120 menuoptions[5] = "unlock secret lab"; menuoptionsactive[5] = !unlock[8];menuoptionslayout[5] = 9; 1121 1122 menuoptions_alt[0] = "time trials unlocked"; 1123 menuoptions_alt[1] = "intermissions unlocked"; 1124 menuoptions_alt[2] = "no death mode unlocked"; 1125 menuoptions_alt[3] = "flip mode unlocked"; 1126 menuoptions_alt[4] = "ship jukebox unlocked"; 1127 menuoptions_alt[5] = "secret lab unlocked"; 1128 1129 menuoptions[6] = "< back"; menuoptionsactive[6] = true; 1130 menuoptionslayout[6] = 3; 1131 1132 nummenuoptions = 7; 1133 menuxoff = -70; menuyoff = -55-(12*6); 1134 }else if (t == "credits") { 1135 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1136 menuoptions[1] = "< back"; menuoptionsactive[1] = true; 1137 menuoptionslayout[1] = 3; 1138 nummenuoptions = 2; 1139 menuxoff = 20; menuyoff = 64; 1140 }else if (t == "credits2") { 1141 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1142 menuoptions[1] = "< back"; menuoptionsactive[1] = true; 1143 menuoptionslayout[1] = 3; 1144 nummenuoptions = 2; 1145 menuxoff = 20; menuyoff = 64; 1146 }else if (t == "credits3") { 1147 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1148 menuoptions[1] = "< back"; menuoptionsactive[1] = true; 1149 menuoptionslayout[1] = 3; 1150 nummenuoptions = 2; 1151 menuxoff = 20; menuyoff = 64; 1152 }else if (t == "credits4") { 1153 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1154 menuoptions[1] = "< back"; menuoptionsactive[1] = true; 1155 menuoptionslayout[1] = 3; 1156 nummenuoptions = 2; 1157 menuxoff = 20; menuyoff = 64; 1158 }else if (t == "credits5") { 1159 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1160 menuoptions[1] = "< back"; menuoptionsactive[1] = true; 1161 menuoptionslayout[1] = 3; 1162 nummenuoptions = 2; 1163 menuxoff = 20; menuyoff = 64; 1164 }else if (t == "credits6") { 1165 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1166 menuoptions[1] = "< back"; menuoptionsactive[1] = true; 1167 menuoptionslayout[1] = 3; 1168 nummenuoptions = 2; 1169 menuxoff = 20; menuyoff = 64; 1170 }else if (t == "credits7") { 1171 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1172 menuoptions[1] = "< back"; menuoptionsactive[1] = true; 1173 menuoptionslayout[1] = 3; 1174 nummenuoptions = 2; 1175 menuxoff = 20; menuyoff = 64; 1176 }else if (t == "credits8") { 1177 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1178 menuoptions[1] = "< back"; menuoptionsactive[1] = true; 1179 menuoptionslayout[1] = 3; 1180 nummenuoptions = 2; 1181 menuxoff = 20; menuyoff = 64; 1182 }else if (t == "credits9") { 1183 menuoptions[0] = "first page"; menuoptionsactive[0] = true; 1184 menuoptions[1] = "< back"; menuoptionsactive[1] = true; 1185 menuoptionslayout[1] = 3; 1186 nummenuoptions = 2; 1187 menuxoff = 20; menuyoff = 64; 1188 }else if (t == "play") { 1189 //Ok, here's where the unlock stuff comes into it: 1190 //First up, time trials: 1191 temp = 0; 1192 if (unlock[0] && stat_trinkets >= 3 && !unlocknotify[9]) temp++; 1193 if (unlock[1] && stat_trinkets >= 6 && !unlocknotify[10]) temp++; 1194 if (unlock[2] && stat_trinkets >= 9 && !unlocknotify[11]) temp++; 1195 if (unlock[3] && stat_trinkets >= 12 && !unlocknotify[12]) temp++; 1196 if (unlock[4] && stat_trinkets >= 15 && !unlocknotify[13]) temp++; 1197 if (unlock[5] && stat_trinkets >= 18 && !unlocknotify[14]) temp++; 1198 if (temp > 0) { 1199 //you've unlocked a time trial! 1200 if (unlock[0] && stat_trinkets >= 3) { unlocknotify[9] = true; unlock[9] = true; } 1201 if (unlock[1] && stat_trinkets >= 6) { unlocknotify[10] = true; unlock[10] = true; } 1202 if (unlock[2] && stat_trinkets >= 9) { unlocknotify[11] = true; unlock[11] = true; } 1203 if (unlock[3] && stat_trinkets >= 12) { unlocknotify[12] = true; unlock[12] = true; } 1204 if (unlock[4] && stat_trinkets >= 15) { unlocknotify[13] = true; unlock[13] = true; } 1205 if (unlock[5] && stat_trinkets >= 18) { unlocknotify[14] = true; unlock[14] = true; } 1206 1207 if (temp == 1) { 1208 createmenu("unlocktimetrial"); savemystats = true; 1209 }else if (temp > 1) { 1210 createmenu("unlocktimetrials"); savemystats = true; 1211 } 1212 }else { 1213 //Alright, we haven't unlocked any time trials. How about no death mode? 1214 temp = 0; 1215 if (bestrank[0] >= 2) temp++; 1216 if (bestrank[1] >= 2) temp++; 1217 if (bestrank[2] >= 2) temp++; 1218 if (bestrank[3] >= 2) temp++; 1219 if (bestrank[4] >= 2) temp++; 1220 if (bestrank[5] >= 2) temp++; 1221 if (temp >= 4 && !unlocknotify[17]) { 1222 //Unlock No Death Mode 1223 unlocknotify[17] = true; unlock[17] = true; 1224 createmenu("unlocknodeathmode"); 1225 savemystats = true; 1226 }else{ 1227 //Alright then! Flip mode? 1228 if (unlock[5] && !unlocknotify[18]) { 1229 unlock[18] = true; unlocknotify[18] = true; 1230 createmenu("unlockflipmode"); 1231 savemystats = true; 1232 }else { 1233 //What about the intermission levels? 1234 if (unlock[7] && !unlocknotify[16]) { 1235 unlock[16] = true; unlocknotify[16] = true; 1236 createmenu("unlockintermission"); 1237 savemystats = true; 1238 }else { 1239 //ok, secret lab! no notification, but test: 1240 if (unlock[8]) { 1241 createmenu("playsecretlab"); 1242 }else{ 1243 menuoptions[0] = "continue"; menuoptionsactive[0] = true; 1244 menuoptions[1] = "play modes"; menuoptionsactive[1] = true; 1245 menuoptions[2] = "new game"; menuoptionsactive[2] = true; 1246 menuoptions[3] = "< back"; menuoptionsactive[3] = true; 1247 menuoptionslayout[3] = 3; 1248 nummenuoptions = 4; 1249 menuxoff = -20; menuyoff = -30 -(12*3); 1250 } 1251 } 1252 } 1253 } 1254 } 1255 }else if (t == "unlocktimetrial" || t == "unlocktimetrials") { 1256 menuoptions[0] = "continue"; menuoptionsactive[0] = true; 1257 nummenuoptions = 1; 1258 menuxoff = 20; menuyoff = 70; 1259 }else if (t == "unlocknodeathmode") { 1260 menuoptions[0] = "continue"; menuoptionsactive[0] = true; 1261 nummenuoptions = 1; 1262 menuxoff = 20; menuyoff = 70; 1263 }else if (t == "unlockintermission") { 1264 menuoptions[0] = "continue"; menuoptionsactive[0] = true; 1265 nummenuoptions = 1; 1266 menuxoff = 20; menuyoff = 70; 1267 }else if (t == "unlockflipmode") { 1268 menuoptions[0] = "continue"; menuoptionsactive[0] = true; 1269 nummenuoptions = 1; 1270 menuxoff = 20; menuyoff = 70; 1271 }else if (t == "playsecretlab") { 1272 menuoptions[0] = "continue"; menuoptionsactive[0] = true; 1273 menuoptions[1] = "secret lab"; menuoptionsactive[1] = true; 1274 menuoptions[2] = "play modes"; menuoptionsactive[2] = true; 1275 menuoptions[3] = "new game"; menuoptionsactive[3] = true; 1276 menuoptions[4] = "< back"; menuoptionsactive[4] = true; 1277 menuoptionslayout[4] = 3; 1278 nummenuoptions = 5; 1279 menuxoff = -40; menuyoff = -35-(12*4); 1280 }else if (t == "newgamewarning") { 1281 menuoptions[0] = "start new game"; menuoptionsactive[0] = true; 1282 menuoptions[1] = "< back"; menuoptionsactive[1] = true; 1283 menuoptionslayout[1] = 3; 1284 nummenuoptions = 2; 1285 menuxoff = -30; menuyoff = 64-(16*2)-32; 1286 }else if (t == "flipmode_mobile") { 1287 menuoptions[0] = "change flip mode"; menuoptionsactive[0] = true; 1288 menuoptions[1] = "< back"; menuoptionsactive[1] = true; 1289 menuoptionslayout[1] = 3; 1290 nummenuoptions = 2; 1291 menuxoff = -30; menuyoff = 64-(16*2); 1292 }else if (t == "playmodes") { 1293 menuoptions[0] = "time trials"; menuoptionsactive[0] = true; 1294 menuoptions[1] = "intermissions"; menuoptionsactive[1] = unlock[16]; 1295 menuoptions[2] = "no death mode"; menuoptionsactive[2] = unlock[17]; 1296 menuoptions[3] = "flip mode"; menuoptionsactive[3] = unlock[18]; 1297 menuoptions[4] = "< back"; menuoptionsactive[4] = true; 1298 menuoptionslayout[4] = 3; 1299 nummenuoptions = 5; 1300 menuxoff = -70; menuyoff = -35-(12*4); 1301 }else if (t == "intermissionmenu") { 1302 menuoptions[0] = "play intermission 1"; menuoptionsactive[0] = true; 1303 menuoptions[1] = "play intermission 2"; menuoptionsactive[1] = true; 1304 menuoptions[2] = "< back"; menuoptionsactive[2] = true; 1305 menuoptionslayout[0] = 4; menuoptionslayout[1] = 4; 1306 menuoptionslayout[2] = 3; 1307 nummenuoptions = 3; 1308 menuxoff = -50; menuyoff = -35-(12*2); 1309 }else if (t == "playint1") { 1310 menuoptions[0] = "Vitellary"; menuoptionsactive[0] = true; 1311 menuoptions[1] = "Vermilion"; menuoptionsactive[1] = true; 1312 menuoptions[2] = "Verdigris"; menuoptionsactive[2] = true; 1313 menuoptions[3] = "Victoria"; menuoptionsactive[3] = true; 1314 menuoptions[4] = "< back"; menuoptionsactive[4] = true; 1315 menuoptionslayout[4] = 3; 1316 nummenuoptions = 5; 1317 menuxoff = -60; menuyoff = -30-(12*4); 1318 }else if (t == "playint2") { 1319 menuoptions[0] = "Vitellary"; menuoptionsactive[0] = true; 1320 menuoptions[1] = "Vermilion"; menuoptionsactive[1] = true; 1321 menuoptions[2] = "Verdigris"; menuoptionsactive[2] = true; 1322 menuoptions[3] = "Victoria"; menuoptionsactive[3] = true; 1323 menuoptions[4] = "< back"; menuoptionsactive[4] = true; 1324 menuoptionslayout[4] = 3; 1325 nummenuoptions = 5; 1326 menuxoff = -60; menuyoff = -30-(12*4); 1327 }else if (t == "continue") { 1328 menuoptions[0] = "continue from teleporter"; menuoptionsactive[0] = true; 1329 menuoptions[1] = "continue from quicksave"; menuoptionsactive[1] = true; 1330 menuoptionslayout[0] = 4; menuoptionslayout[1] = 4; 1331 menuoptions[2] = "< back"; menuoptionsactive[2] = true; 1332 menuoptionslayout[2] = 3; 1333 nummenuoptions = 3; 1334 menuxoff = -60; menuyoff = 20-(12*2); 1335 }else if (t == "startnodeathmode") { 1336 menuoptions[0] = "disable cutscenes"; menuoptionsactive[0] = true; 1337 menuoptions[1] = "enable cutscenes"; menuoptionsactive[1] = true; 1338 menuoptionslayout[0] = 4; menuoptionslayout[1] = 4; 1339 menuoptions[2] = "< back"; menuoptionsactive[2] = true; 1340 menuoptionslayout[2] = 3; 1341 nummenuoptions = 3; 1342 menuxoff = -60; menuyoff = 30-(12*2); 1343 }else if (t == "gameover") { 1344 nummenuoptions = 0; 1345 menucountdown = 120; menudest="gameover2"; 1346 }else if (t == "gameover2") { 1347 menuoptions[0] = "return to play menu"; menuoptionsactive[0] = true; 1348 menuoptionslayout[0] = 4; 1349 nummenuoptions = 1; 1350 menuxoff = -25; menuyoff = 80-8; 1351 }else if (t == "unlockmenutrials") { 1352 if (unlock[9]) { menuoptions[0] = "space station 1"; menuoptionsactive[0] = false; 1353 }else{ menuoptions[0] = "space station 1"; menuoptionsactive[0] = true;} 1354 if (unlock[10]) { menuoptions[1] = "the laboratory"; menuoptionsactive[1] = false; 1355 }else{ menuoptions[1] = "the laboratory"; menuoptionsactive[1] = true;} 1356 if (unlock[11]) { menuoptions[2] = "the tower"; menuoptionsactive[2] = false; 1357 }else{ menuoptions[2] = "the tower"; menuoptionsactive[2] = true;} 1358 if (unlock[12]) { menuoptions[3] = "space station 2"; menuoptionsactive[3] = false; 1359 }else{ menuoptions[3] = "space station 2"; menuoptionsactive[3] = true;} 1360 if (unlock[13]) { menuoptions[4] = "the warp zone"; menuoptionsactive[4] = false; 1361 }else{ menuoptions[4] = "the warp zone"; menuoptionsactive[4] = true;} 1362 if (unlock[14]) { menuoptions[5] = "the final level"; menuoptionsactive[5] = false; 1363 }else{ menuoptions[5] = "the final level"; menuoptionsactive[5] = true;} 1364 1365 menuoptions_alt[0] = "space station 1 unlocked"; 1366 menuoptions_alt[1] = "the laboratory unlocked"; 1367 menuoptions_alt[2] = "the tower unlocked"; 1368 menuoptions_alt[3] = "space station 2 unlocked"; 1369 menuoptions_alt[4] = "the warp zone unlocked"; 1370 menuoptions_alt[5] = "the final level unlocked"; 1371 1372 menuoptionslayout[0] = 9; 1373 menuoptionslayout[1] = 9; 1374 menuoptionslayout[2] = 9; 1375 menuoptionslayout[3] = 9; 1376 menuoptionslayout[4] = 9; 1377 menuoptionslayout[5] = 9; 1378 1379 menuoptions[6] = "< back"; menuoptionsactive[6] = true; 1380 menuoptionslayout[6] = 3; 1381 nummenuoptions = 7; 1382 menuxoff = -80; menuyoff = -55-(12*6); 1383 }else if (t == "timetrials") { 1384 if (!unlock[9]) { menuoptions[0] = "???"; menuoptionsactive[0] = false; 1385 }else{ menuoptions[0] = "space station 1"; menuoptionsactive[0] = true;} 1386 if (!unlock[10]) { menuoptions[1] = "???"; menuoptionsactive[1] = false; 1387 }else{ menuoptions[1] = "the laboratory"; menuoptionsactive[1] = true;} 1388 if (!unlock[11]) { menuoptions[2] = "???"; menuoptionsactive[2] = false; 1389 }else{ menuoptions[2] = "the tower"; menuoptionsactive[2] = true;} 1390 if (!unlock[12]) { menuoptions[3] = "???"; menuoptionsactive[3] = false; 1391 }else{ menuoptions[3] = "space station 2"; menuoptionsactive[3] = true;} 1392 if (!unlock[13]) { menuoptions[4] = "???"; menuoptionsactive[4] = false; 1393 }else{ menuoptions[4] = "the warp zone"; menuoptionsactive[4] = true;} 1394 if (!unlock[14]) { menuoptions[5] = "???"; menuoptionsactive[5] = false; 1395 }else{ menuoptions[5] = "the final level"; menuoptionsactive[5] = true;} 1396 menuoptionslayout[0] = 5; 1397 menuoptionslayout[1] = 5; 1398 menuoptionslayout[2] = 5; 1399 menuoptionslayout[3] = 6; 1400 menuoptionslayout[4] = 6; 1401 menuoptionslayout[5] = 6; 1402 1403 menuoptions[6] = "< back"; menuoptionsactive[6] = true; 1404 menuoptionslayout[6] = 3; 1405 nummenuoptions = 7; 1406 menuxoff = -80; menuyoff = -100; 1407 }else if (t == "nodeathmodecomplete") { 1408 nummenuoptions = 0; 1409 menucountdown = 90; menudest = "nodeathmodecomplete2"; 1410 }else if (t == "nodeathmodecomplete2") { 1411 menuoptions[0] = "return to play menu"; menuoptionsactive[0] = true; 1412 menuoptionslayout[0] = 4; 1413 nummenuoptions = 1; 1414 menuxoff = -25; menuyoff = 70-8; 1415 }else if (t == "timetrialcomplete") { 1416 nummenuoptions = 0; 1417 menucountdown = 90; menudest="timetrialcomplete2"; 1418 }else if (t == "timetrialcomplete2") { 1419 nummenuoptions = 0; 1420 menucountdown = 60; menudest="timetrialcomplete3"; 1421 }else if (t == "timetrialcomplete3") { 1422 menuoptions[0] = "try again"; menuoptionsactive[0] = true; 1423 menuoptions[1] = "< back"; menuoptionsactive[1] = true; 1424 menuoptionslayout[1] = 3; 1425 nummenuoptions = 2; 1426 menuxoff = -25; menuyoff = 70; 1427 }else if (t == "gamecompletecontinue") { 1428 menuoptions[0] = "return to play menu"; menuoptionsactive[0] = true; 1429 menuoptionslayout[0] = 4; 1430 nummenuoptions = 1; 1431 menuxoff = -25; menuyoff = 70-8; 1432 } 1433 }else{ 1434 if (t == "mainmenu") { 1435 menuoptions[0] = "start game"; 1436 menuoptionsactive[0] = true; 1437 menuoptions[1] = "player levels"; 1438 menuoptionsactive[1] = true; 1439 menuoptions[2] = "graphic options"; 1440 menuoptionsactive[2] = true; 1441 menuoptions[3] = "game options"; 1442 menuoptionsactive[3] = true; 1443 menuoptions[4] = "view credits"; 1444 menuoptionsactive[4] = true; 1445 menuoptions[5] = "quit game"; 1446 menuoptionsactive[5] = true; 1447 nummenuoptions = 6; 1448 menuxoff = -16; 1449 menuyoff = -10; 1450 }else if (t == "playerworlds"){ 1451 menuoptions[0] = "play a level"; 1452 menuoptionsactive[0] = true; 1453 menuoptions[1] = "level editor"; 1454 menuoptionsactive[1] = true; 1455 menuoptions[2] = "back to menu"; 1456 menuoptionsactive[3] = true; 1457 nummenuoptions = 3; 1458 menuxoff = -30; 1459 menuyoff = -40; 1460 }else if (t == "quickloadlevel") { 1461 menuoptions[0] = "continue from save"; 1462 menuoptionsactive[0] = true; 1463 menuoptions[1] = "start from beginning"; 1464 menuoptionsactive[1] = true; 1465 menuoptions[2] = "back to levels"; 1466 menuoptionsactive[2] = true; 1467 nummenuoptions = 3; 1468 menuxoff = -40; 1469 menuyoff = -30; 1470 }else if (t == "youwannaquit") { 1471 menuoptions[0] = "yes, quit"; menuoptionsactive[0] = true; 1472 menuoptions[1] = "no, return"; menuoptionsactive[1] = true; 1473 nummenuoptions = 2; 1474 menuxoff = 0; menuyoff = -20; 1475 }else if (t == "levellist"){ 1476 if (editor.ListOfMetaData.length == 0) { 1477 menuoptions[0] = "ok"; 1478 menuoptionsactive[0] = true; 1479 nummenuoptions = 1; 1480 menuxoff = 0; 1481 menuyoff = -20; 1482 }else{ 1483 tcount = 0; 1484 for (i = 0; i < editor.ListOfMetaData.length; i++) { 1485 if (i >= levelpage * 8 && i < (levelpage * 8) + 8) { 1486 //This is, er, suboptimal. Whatever, life optimisation and all that 1487 tvar = -1; 1488 for (j = 0; j < numcustomlevelstats; j++) { 1489 if (editor.ListOfMetaData[i].filename == customlevelstats[j]) { 1490 tvar=j; 1491 j=numcustomlevelstats+1; 1492 } 1493 } 1494 if(tvar>=0){ 1495 if(customlevelscore[tvar]==0){ 1496 menuoptions[tcount] = " " + editor.ListOfMetaData[i].title; 1497 }else if(customlevelscore[tvar]==1){ 1498 menuoptions[tcount] = " * " + editor.ListOfMetaData[i].title; 1499 }else if(customlevelscore[tvar]==3){ 1500 menuoptions[tcount] = "** " + editor.ListOfMetaData[i].title; 1501 } 1502 }else{ 1503 menuoptions[tcount] = " " + editor.ListOfMetaData[i].title; 1504 } 1505 menuoptionsactive[tcount] = true; 1506 menuoptions[tcount] = menuoptions[tcount].toLowerCase(); 1507 tcount++; 1508 } 1509 } 1510 if((levelpage*8)+8<editor.ListOfMetaData.length){ 1511 menuoptions[tcount] = "next page"; 1512 menuoptionsactive[tcount] = true; 1513 tcount++; 1514 }else{ 1515 menuoptions[tcount] = "first page"; 1516 menuoptionsactive[tcount] = true; 1517 tcount++; 1518 } 1519 menuoptions[tcount] = "return to menu"; 1520 menuoptionsactive[tcount] = true; 1521 tcount++; 1522 1523 nummenuoptions = tcount; 1524 menuxoff = -90; 1525 menuyoff = 70-(tcount*10); 1526 } 1527 }else if (t == "graphicoptions") { 1528 if (advanced_mode) { 1529 if(fullscreen){ 1530 menuoptions[0] = "change to windowed mode"; menuoptionsactive[0] = true; 1531 }else { 1532 menuoptions[0] = "change to fullscreen"; menuoptionsactive[0] = true; 1533 } 1534 menuoptions[1] = "enable acceleration"; menuoptionsactive[1] = true; 1535 menuoptions[2] = "change scaling mode"; menuoptionsactive[2] = true; 1536 if (advanced_smoothing) { 1537 menuoptions[3] = "disable smoothing"; menuoptionsactive[3] = true; 1538 }else{ 1539 menuoptions[3] = "enable smoothing"; menuoptionsactive[3] = true; 1540 } 1541 menuoptions[4] = "return"; menuoptionsactive[4] = true; 1542 nummenuoptions = 5; 1543 menuxoff = -50; menuyoff = 16; 1544 }else{ 1545 if(fullscreen){ 1546 menuoptions[0] = "change to windowed mode"; menuoptionsactive[0] = true; 1547 }else { 1548 menuoptions[0] = "change to fullscreen"; menuoptionsactive[0] = true; 1549 } 1550 menuoptions[1] = "disable acceleration"; menuoptionsactive[1] = true; 1551 menuoptions[2] = "return"; menuoptionsactive[2] = true; 1552 nummenuoptions = 3; 1553 menuxoff = -50; menuyoff = 16; 1554 } 1555 }else if (t == "options") { 1556 menuoptions[0] = "accessibility options"; menuoptionsactive[0] = true; 1557 menuoptions[1] = "unlock play modes"; menuoptionsactive[1] = true; 1558 menuoptions[2] = "clear data"; menuoptionsactive[2] = true; 1559 menuoptions[3] = "return"; menuoptionsactive[3] = true; 1560 nummenuoptions = 4; 1561 menuxoff = -40; menuyoff = 0; 1562 }else if (t == "accessibility") { 1563 menuoptions[0] = "animated backgrounds"; menuoptionsactive[0] = true; 1564 menuoptions[1] = "screen effects"; menuoptionsactive[1] = true; 1565 //menuoptions[2] = "invincibility"; menuoptionsactive[2] = true; 1566 //menuoptions[3] = "slowdown"; menuoptionsactive[3] = true; 1567 menuoptions[2] = "return"; menuoptionsactive[2] = true; 1568 nummenuoptions = 3; 1569 menuxoff = -40; menuyoff = 16; 1570 }else if (t == "cleardatamenu") { 1571 menuoptions[0] = "no! don't delete"; menuoptionsactive[0] = true; 1572 menuoptions[1] = "yes, delete everything"; menuoptionsactive[1] = true; 1573 nummenuoptions = 2; 1574 menuxoff = -30; menuyoff = 64; 1575 }else if (t == "setinvincibility") { 1576 menuoptions[0] = "no, return to options"; menuoptionsactive[0] = true; 1577 menuoptions[1] = "yes, delete saves"; menuoptionsactive[1] = true; 1578 nummenuoptions = 2; 1579 menuxoff = -30; menuyoff = 64; 1580 }else if (t == "setslowdown1") { 1581 menuoptions[0] = "no, return to options"; menuoptionsactive[0] = true; 1582 menuoptions[1] = "yes, delete saves"; menuoptionsactive[1] = true; 1583 nummenuoptions = 2; 1584 menuxoff = -30; menuyoff = 64; 1585 }else if (t == "setslowdown2") { 1586 menuoptions[0] = "normal speed"; menuoptionsactive[0] = true; 1587 menuoptions[1] = "80% speed"; menuoptionsactive[1] = true; 1588 menuoptions[2] = "60% speed"; menuoptionsactive[2] = true; 1589 menuoptions[3] = "40% speed"; menuoptionsactive[3] = true; 1590 nummenuoptions = 4; 1591 menuxoff = -40; menuyoff = 16; 1592 }else if (t == "unlockmenu") { 1593 menuoptions[0] = "unlock time trials"; menuoptionsactive[0] = true; 1594 menuoptions[1] = "unlock intermissions"; menuoptionsactive[1] = !unlock[16]; 1595 menuoptions[2] = "unlock no death mode"; menuoptionsactive[2] = !unlock[17]; 1596 menuoptions[3] = "unlock flip mode"; menuoptionsactive[3] = !unlock[18]; 1597 menuoptions[4] = "unlock ship jukebox"; menuoptionsactive[4] = (stat_trinkets<20); 1598 menuoptions[5] = "unlock secret lab"; menuoptionsactive[5] = !unlock[8]; 1599 menuoptions[6] = "return"; menuoptionsactive[6] = true; 1600 nummenuoptions = 7; 1601 menuxoff = -70; menuyoff = -20; 1602 }else if (t == "credits") { 1603 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1604 menuoptions[1] = "return"; menuoptionsactive[1] = true; 1605 nummenuoptions = 2; 1606 menuxoff = 20; menuyoff = 64; 1607 }else if (t == "credits2") { 1608 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1609 menuoptions[1] = "return"; menuoptionsactive[1] = true; 1610 nummenuoptions = 2; 1611 menuxoff = 20; menuyoff = 64; 1612 }else if (t == "credits3") { 1613 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1614 menuoptions[1] = "return"; menuoptionsactive[1] = true; 1615 nummenuoptions = 2; 1616 menuxoff = 20; menuyoff = 64; 1617 }else if (t == "credits4") { 1618 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1619 menuoptions[1] = "return"; menuoptionsactive[1] = true; 1620 nummenuoptions = 2; 1621 menuxoff = 20; menuyoff = 64; 1622 }else if (t == "credits5") { 1623 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1624 menuoptions[1] = "return"; menuoptionsactive[1] = true; 1625 nummenuoptions = 2; 1626 menuxoff = 20; menuyoff = 64; 1627 }else if (t == "credits6") { 1628 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1629 menuoptions[1] = "return"; menuoptionsactive[1] = true; 1630 nummenuoptions = 2; 1631 menuxoff = 20; menuyoff = 64; 1632 }else if (t == "credits7") { 1633 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1634 menuoptions[1] = "return"; menuoptionsactive[1] = true; 1635 nummenuoptions = 2; 1636 menuxoff = 20; menuyoff = 64; 1637 }else if (t == "credits8") { 1638 menuoptions[0] = "next page"; menuoptionsactive[0] = true; 1639 menuoptions[1] = "return"; menuoptionsactive[1] = true; 1640 nummenuoptions = 2; 1641 menuxoff = 20; menuyoff = 64; 1642 }else if (t == "credits9") { 1643 menuoptions[0] = "first page"; menuoptionsactive[0] = true; 1644 menuoptions[1] = "return"; menuoptionsactive[1] = true; 1645 nummenuoptions = 2; 1646 menuxoff = 20; menuyoff = 64; 1647 }else if (t == "play") { 1648 //Ok, here's where the unlock stuff comes into it: 1649 //First up, time trials: 1650 temp = 0; 1651 if (unlock[0] && stat_trinkets >= 3 && !unlocknotify[9]) temp++; 1652 if (unlock[1] && stat_trinkets >= 6 && !unlocknotify[10]) temp++; 1653 if (unlock[2] && stat_trinkets >= 9 && !unlocknotify[11]) temp++; 1654 if (unlock[3] && stat_trinkets >= 12 && !unlocknotify[12]) temp++; 1655 if (unlock[4] && stat_trinkets >= 15 && !unlocknotify[13]) temp++; 1656 if (unlock[5] && stat_trinkets >= 18 && !unlocknotify[14]) temp++; 1657 if (temp > 0) { 1658 //you've unlocked a time trial! 1659 if (unlock[0] && stat_trinkets >= 3) { unlocknotify[9] = true; unlock[9] = true; } 1660 if (unlock[1] && stat_trinkets >= 6) { unlocknotify[10] = true; unlock[10] = true; } 1661 if (unlock[2] && stat_trinkets >= 9) { unlocknotify[11] = true; unlock[11] = true; } 1662 if (unlock[3] && stat_trinkets >= 12) { unlocknotify[12] = true; unlock[12] = true; } 1663 if (unlock[4] && stat_trinkets >= 15) { unlocknotify[13] = true; unlock[13] = true; } 1664 if (unlock[5] && stat_trinkets >= 18) { unlocknotify[14] = true; unlock[14] = true; } 1665 1666 if (temp == 1) { 1667 createmenu("unlocktimetrial"); savemystats = true; 1668 }else if (temp > 1) { 1669 createmenu("unlocktimetrials"); savemystats = true; 1670 } 1671 }else { 1672 //Alright, we haven't unlocked any time trials. How about no death mode? 1673 temp = 0; 1674 if (bestrank[0] >= 2) temp++; 1675 if (bestrank[1] >= 2) temp++; 1676 if (bestrank[2] >= 2) temp++; 1677 if (bestrank[3] >= 2) temp++; 1678 if (bestrank[4] >= 2) temp++; 1679 if (bestrank[5] >= 2) temp++; 1680 if (temp >= 4 && !unlocknotify[17]) { 1681 //Unlock No Death Mode 1682 unlocknotify[17] = true; unlock[17] = true; 1683 createmenu("unlocknodeathmode"); 1684 savemystats = true; 1685 }else{ 1686 //Alright then! Flip mode? 1687 if (unlock[5] && !unlocknotify[18]) { 1688 unlock[18] = true; unlocknotify[18] = true; 1689 createmenu("unlockflipmode"); 1690 savemystats = true; 1691 }else { 1692 //What about the intermission levels? 1693 if (unlock[7] && !unlocknotify[16]) { 1694 unlock[16] = true; unlocknotify[16] = true; 1695 createmenu("unlockintermission"); 1696 savemystats = true; 1697 }else { 1698 //ok, secret lab! no notification, but test: 1699 if (unlock[8]) { 1700 createmenu("playsecretlab"); 1701 }else{ 1702 menuoptions[0] = "continue"; menuoptionsactive[0] = true; 1703 menuoptions[1] = "play modes"; menuoptionsactive[1] = true; 1704 menuoptions[2] = "new game"; menuoptionsactive[2] = true; 1705 menuoptions[3] = "return"; menuoptionsactive[3] = true; 1706 nummenuoptions = 4; 1707 menuxoff = -20; menuyoff = -40; 1708 } 1709 } 1710 } 1711 } 1712 } 1713 }else if (t == "unlocktimetrial" || t == "unlocktimetrials") { 1714 menuoptions[0] = "continue"; menuoptionsactive[0] = true; 1715 nummenuoptions = 1; 1716 menuxoff = 20; menuyoff = 70; 1717 }else if (t == "unlocknodeathmode") { 1718 menuoptions[0] = "continue"; menuoptionsactive[0] = true; 1719 nummenuoptions = 1; 1720 menuxoff = 20; menuyoff = 70; 1721 }else if (t == "unlockintermission") { 1722 menuoptions[0] = "continue"; menuoptionsactive[0] = true; 1723 nummenuoptions = 1; 1724 menuxoff = 20; menuyoff = 70; 1725 }else if (t == "unlockflipmode") { 1726 menuoptions[0] = "continue"; menuoptionsactive[0] = true; 1727 nummenuoptions = 1; 1728 menuxoff = 20; menuyoff = 70; 1729 }else if (t == "playsecretlab") { 1730 menuoptions[0] = "continue"; menuoptionsactive[0] = true; 1731 menuoptions[1] = "secret lab"; menuoptionsactive[1] = true; 1732 menuoptions[2] = "play modes"; menuoptionsactive[2] = true; 1733 menuoptions[3] = "new game"; menuoptionsactive[3] = true; 1734 menuoptions[4] = "return"; menuoptionsactive[4] = true; 1735 nummenuoptions = 5; 1736 menuxoff = -40; menuyoff = -30; 1737 }else if (t == "newgamewarning") { 1738 menuoptions[0] = "start new game"; menuoptionsactive[0] = true; 1739 menuoptions[1] = "return to menu"; menuoptionsactive[1] = true; 1740 nummenuoptions = 2; 1741 menuxoff = -30; menuyoff = 64; 1742 }else if (t == "playmodes") { 1743 menuoptions[0] = "time trials"; menuoptionsactive[0] = true; 1744 menuoptions[1] = "intermissions"; menuoptionsactive[1] = unlock[16]; 1745 menuoptions[2] = "no death mode"; menuoptionsactive[2] = unlock[17]; 1746 menuoptions[3] = "flip mode"; menuoptionsactive[3] = unlock[18]; 1747 menuoptions[4] = "return to play menu"; menuoptionsactive[4] = true; 1748 nummenuoptions = 5; 1749 menuxoff = -70; menuyoff = 8; 1750 }else if (t == "intermissionmenu") { 1751 menuoptions[0] = "play intermission 1"; menuoptionsactive[0] = true; 1752 menuoptions[1] = "play intermission 2"; menuoptionsactive[1] = true; 1753 menuoptions[2] = "return to play menu"; menuoptionsactive[2] = true; 1754 nummenuoptions = 3; 1755 menuxoff = -50; menuyoff = -35; 1756 }else if (t == "playint1") { 1757 menuoptions[0] = "Vitellary"; menuoptionsactive[0] = true; 1758 menuoptions[1] = "Vermilion"; menuoptionsactive[1] = true; 1759 menuoptions[2] = "Verdigris"; menuoptionsactive[2] = true; 1760 menuoptions[3] = "Victoria"; menuoptionsactive[3] = true; 1761 menuoptions[4] = "return"; menuoptionsactive[4] = true; 1762 nummenuoptions = 5; 1763 menuxoff = -60; menuyoff = 10; 1764 }else if (t == "playint2") { 1765 menuoptions[0] = "Vitellary"; menuoptionsactive[0] = true; 1766 menuoptions[1] = "Vermilion"; menuoptionsactive[1] = true; 1767 menuoptions[2] = "Verdigris"; menuoptionsactive[2] = true; 1768 menuoptions[3] = "Victoria"; menuoptionsactive[3] = true; 1769 menuoptions[4] = "return"; menuoptionsactive[4] = true; 1770 nummenuoptions = 5; 1771 menuxoff = -60; menuyoff = 10; 1772 }else if (t == "continue") { 1773 menuoptions[0] = "continue from teleporter"; menuoptionsactive[0] = true; 1774 menuoptions[1] = "continue from quicksave"; menuoptionsactive[1] = true; 1775 menuoptions[2] = "return to play menu"; menuoptionsactive[2] = true; 1776 nummenuoptions = 3; 1777 menuxoff = -60; menuyoff = 20; 1778 }else if (t == "startnodeathmode") { 1779 menuoptions[0] = "disable cutscenes"; menuoptionsactive[0] = true; 1780 menuoptions[1] = "enable cutscenes"; menuoptionsactive[1] = true; 1781 menuoptions[2] = "return to play menu"; menuoptionsactive[2] = true; 1782 nummenuoptions = 3; 1783 menuxoff = -60; menuyoff = 40; 1784 }else if (t == "gameover") { 1785 nummenuoptions = 0; 1786 menucountdown = 120; menudest="gameover2"; 1787 }else if (t == "gameover2") { 1788 menuoptions[0] = "return to play menu"; menuoptionsactive[0] = true; 1789 nummenuoptions = 1; 1790 menuxoff = -25; menuyoff = 80; 1791 }else if (t == "unlockmenutrials") { 1792 if (unlock[9]) { menuoptions[0] = "space station 1"; menuoptionsactive[0] = true; 1793 }else{ menuoptions[0] = "space station 1"; menuoptionsactive[0] = true;} 1794 if (unlock[10]) { menuoptions[1] = "the laboratory"; menuoptionsactive[1] = true; 1795 }else{ menuoptions[1] = "the laboratory"; menuoptionsactive[1] = true;} 1796 if (unlock[11]) { menuoptions[2] = "the tower"; menuoptionsactive[2] = true; 1797 }else{ menuoptions[2] = "the tower"; menuoptionsactive[2] = true;} 1798 if (unlock[12]) { menuoptions[3] = "space station 2"; menuoptionsactive[3] = true; 1799 }else{ menuoptions[3] = "space station 2"; menuoptionsactive[3] = true;} 1800 if (unlock[13]) { menuoptions[4] = "the warp zone"; menuoptionsactive[4] = true; 1801 }else{ menuoptions[4] = "the warp zone"; menuoptionsactive[4] = true;} 1802 if (unlock[14]) { menuoptions[5] = "the final level"; menuoptionsactive[5] = true; 1803 }else{ menuoptions[5] = "the final level"; menuoptionsactive[5] = true;} 1804 1805 menuoptions[6] = "return to unlock menu"; menuoptionsactive[6] = true; 1806 nummenuoptions = 7; 1807 menuxoff = -80; menuyoff = 0 - (12*6); 1808 }else if (t == "timetrials") { 1809 if (!unlock[9]) { menuoptions[0] = "???"; menuoptionsactive[0] = true; 1810 }else{ menuoptions[0] = "space station 1"; menuoptionsactive[0] = true;} 1811 if (!unlock[10]) { menuoptions[1] = "???"; menuoptionsactive[1] = true; 1812 }else{ menuoptions[1] = "the laboratory"; menuoptionsactive[1] = true;} 1813 if (!unlock[11]) { menuoptions[2] = "???"; menuoptionsactive[2] = true; 1814 }else{ menuoptions[2] = "the tower"; menuoptionsactive[2] = true;} 1815 if (!unlock[12]) { menuoptions[3] = "???"; menuoptionsactive[3] = true; 1816 }else{ menuoptions[3] = "space station 2"; menuoptionsactive[3] = true;} 1817 if (!unlock[13]) { menuoptions[4] = "???"; menuoptionsactive[4] = true; 1818 }else{ menuoptions[4] = "the warp zone"; menuoptionsactive[4] = true;} 1819 if (!unlock[14]) { menuoptions[5] = "???"; menuoptionsactive[5] = true; 1820 }else{ menuoptions[5] = "the final level"; menuoptionsactive[5] = true;} 1821 1822 menuoptions[6] = "return to play menu"; menuoptionsactive[6] = true; 1823 nummenuoptions = 7; 1824 menuxoff = -80; menuyoff = 0 - (12*6); 1825 }else if (t == "nodeathmodecomplete") { 1826 nummenuoptions = 0; 1827 menucountdown = 90; menudest = "nodeathmodecomplete2"; 1828 }else if (t == "nodeathmodecomplete2") { 1829 menuoptions[0] = "return to play menu"; menuoptionsactive[0] = true; 1830 nummenuoptions = 1; 1831 menuxoff = -25; menuyoff = 70; 1832 }else if (t == "timetrialcomplete") { 1833 nummenuoptions = 0; 1834 menucountdown = 90; menudest="timetrialcomplete2"; 1835 }else if (t == "timetrialcomplete2") { 1836 nummenuoptions = 0; 1837 menucountdown = 60; menudest="timetrialcomplete3"; 1838 }else if (t == "timetrialcomplete3") { 1839 menuoptions[0] = "return to play menu"; menuoptionsactive[0] = true; 1840 menuoptions[1] = "try again"; menuoptionsactive[1] = true; 1841 nummenuoptions = 2; 1842 menuxoff = -25; menuyoff = 70; 1843 }else if (t == "gamecompletecontinue") { 1844 menuoptions[0] = "return to play menu"; menuoptionsactive[0] = true; 1845 nummenuoptions = 1; 1846 menuxoff = -25; menuyoff = 70; 1847 } 1848 } 1849 } 1850 1851 public function loadstats(map:mapclass, dwgfx:dwgraphicsclass):void { 1852 statcookie = SharedObject.getLocal("vvvvvv_unlock"); 1853 1854 if (statcookie.data.stattrinkets == undefined) { 1855 savestats(map, dwgfx); //save with default values 1856 }else{ 1857 temp_unlock = statcookie.data.unlock.slice(); 1858 unlock = temp_unlock.slice(); 1859 1860 temp_unlocknotify = statcookie.data.unlocknotify.slice(); 1861 unlocknotify = temp_unlocknotify.slice(); 1862 1863 temp_besttimes = statcookie.data.besttimes.slice(); 1864 besttimes = temp_besttimes.slice(); 1865 temp_besttrinkets = statcookie.data.besttrinkets.slice(); 1866 besttrinkets = temp_besttrinkets.slice(); 1867 temp_bestlives = statcookie.data.bestlives.slice(); 1868 bestlives = temp_bestlives.slice(); 1869 temp_bestrank = statcookie.data.bestrank.slice(); 1870 bestrank = temp_bestrank.slice(); 1871 1872 bestgamedeaths = statcookie.data.bestgamedeaths; 1873 1874 stat_trinkets = statcookie.data.stattrinkets; 1875 fullscreen = statcookie.data.fullscreen; 1876 1877 noflashingmode = statcookie.data.screenshakes; 1878 colourblindmode = statcookie.data.backgrounds; 1879 dwgfx.setflipmode = statcookie.data.flipmode; 1880 map.invincibility = statcookie.data.invincibility; 1881 slowdown = statcookie.data.slowdown; 1882 1883 swnbestrank = statcookie.data.swnbestrank; 1884 swnrecord = statcookie.data.swnrecord; 1885 1886 advanced_mode = statcookie.data.advanced_mode; 1887 advanced_smoothing = statcookie.data.advanced_smoothing; 1888 advanced_scaling = statcookie.data.advanced_scaling; 1889 1890 controlstyle = statcookie.data.controlstyle; 1891 controlsensitivity = statcookie.data.controlsensitivity; 1892 showcontroltutorial = statcookie.data.showcontroltutorial; 1893 } 1894 statcookie.close(); 1895 } 1896 1897 public function savestats(map:mapclass, dwgfx:dwgraphicsclass):void { 1898 statcookie = SharedObject.getLocal("vvvvvv_unlock"); 1899 1900 temp_unlock = unlock.slice(); 1901 temp_unlocknotify = unlocknotify.slice(); 1902 1903 statcookie.data.unlock = temp_unlock.slice(); 1904 statcookie.data.unlocknotify = temp_unlocknotify.slice(); 1905 1906 temp_besttimes = besttimes.slice(); 1907 temp_besttrinkets = besttrinkets.slice(); 1908 temp_bestlives = bestlives.slice(); 1909 temp_bestrank = bestrank.slice(); 1910 statcookie.data.besttimes = temp_besttimes.slice(); 1911 statcookie.data.besttrinkets = temp_besttrinkets.slice(); 1912 statcookie.data.bestlives = temp_bestlives.slice(); 1913 statcookie.data.bestrank = temp_bestrank.slice(); 1914 1915 statcookie.data.bestgamedeaths = bestgamedeaths; 1916 1917 statcookie.data.stattrinkets = stat_trinkets; 1918 statcookie.data.fullscreen = fullscreen; 1919 1920 statcookie.data.screenshakes = noflashingmode; 1921 statcookie.data.backgrounds = colourblindmode; 1922 statcookie.data.flipmode = dwgfx.setflipmode; 1923 statcookie.data.invincibility = map.invincibility; 1924 statcookie.data.slowdown = slowdown; 1925 1926 statcookie.data.swnbestrank = swnbestrank; 1927 statcookie.data.swnrecord = swnrecord; 1928 1929 statcookie.data.advanced_mode = advanced_mode; 1930 statcookie.data.advanced_smoothing = advanced_smoothing; 1931 statcookie.data.advanced_scaling = advanced_scaling; 1932 1933 statcookie.data.controlstyle = controlstyle; 1934 statcookie.data.controlsensitivity = controlsensitivity; 1935 statcookie.data.showcontroltutorial = showcontroltutorial; 1936 1937 statcookie.flush() 1938 statcookie.close(); 1939 } 1940 1941 public function deletestats(map:mapclass, dwgfx:dwgraphicsclass):void { 1942 for (i = 0; i < 25; i++) { 1943 unlock[i] = false; 1944 unlocknotify[i] = false; 1945 } 1946 for (i = 0; i < 6; i++) { 1947 besttimes[i] = -1; 1948 besttrinkets[i] = -1; 1949 bestlives[i] = -1; 1950 bestrank[i] = -1; 1951 } 1952 dwgfx.setflipmode = false; 1953 stat_trinkets = 0; 1954 controlstyle = 0; 1955 controlsensitivity = 50; 1956 savestats(map, dwgfx); 1957 } 1958 1959 public function unlocknum(t:int, map:mapclass, dwgfx:dwgraphicsclass):void { 1960 unlock[t] = true; 1961 savestats(map, dwgfx); 1962 } 1963 1964 public function CopyLevelData():void { 1965 //Not used in mobile version 1966 } 1967 1968 public function loadsummary(map:mapclass, help:helpclass):void { 1969 quickcookie = SharedObject.getLocal("vvvvvv_quicksave"); 1970 telecookie = SharedObject.getLocal("vvvvvv_telesave"); 1971 1972 if (telecookie.data.savex == undefined) { 1973 telecookieexists = false; telesummary = ""; 1974 } else { 1975 telecookieexists = true; telesummary = telecookie.data.summary; 1976 tele_gametime = giventimestring(telecookie.data.hours, telecookie.data.minutes, telecookie.data.seconds, help); 1977 tele_trinkets = telecookie.data.trinkets; 1978 tele_currentarea = map.currentarea(map.area(telecookie.data.savex, telecookie.data.savey)); 1979 1980 summary_crewstats = telecookie.data.crewstats.slice(); 1981 tele_crewstats = summary_crewstats.slice(); 1982 } 1983 1984 if (quickcookie.data.savex == undefined) { 1985 quickcookieexists = false; quicksummary = ""; 1986 } else { 1987 quickcookieexists = true; quicksummary = quickcookie.data.summary; 1988 quick_gametime = giventimestring(quickcookie.data.hours, quickcookie.data.minutes, quickcookie.data.seconds, help); 1989 quick_trinkets = quickcookie.data.trinkets; 1990 quick_currentarea = map.currentarea(map.area(quickcookie.data.savex, quickcookie.data.savey)); 1991 1992 summary_crewstats = quickcookie.data.crewstats.slice(); 1993 quick_crewstats = summary_crewstats.slice(); 1994 } 1995 } 1996 1997 public function savequick(map:mapclass, obj:entityclass, music:musicclass, help:helpclass):void { 1998 quickcookie = SharedObject.getLocal("vvvvvv_quicksave"); 1999 //Save to the quicksave cookie 2000 quickcookieexists = true; 2001 //Flags, map and stats 2002 savestate[0].explored = map.explored.slice(); 2003 savestate[0].flags = obj.flags.slice(); 2004 savestate[0].crewstats = crewstats.slice(); 2005 savestate[0].collect = obj.collect.slice(); 2006 2007 quickcookie.data.worldmap = savestate[0].explored.slice(); 2008 quickcookie.data.flags = savestate[0].flags.slice(); 2009 quickcookie.data.crewstats = savestate[0].crewstats.slice(); 2010 quickcookie.data.collect = savestate[0].collect.slice(); 2011 2012 //trace(obj.flags); 2013 2014 quickcookie.data.finalmode = map.finalmode; 2015 quickcookie.data.finalstretch = map.finalstretch; 2016 2017 quickcookie.data.finalx = map.finalx; 2018 quickcookie.data.finaly = map.finaly; 2019 //Position 2020 quickcookie.data.savex = savex; 2021 quickcookie.data.savey = savey; 2022 quickcookie.data.saverx = saverx; 2023 quickcookie.data.savery = savery; 2024 quickcookie.data.savegc = savegc; 2025 quickcookie.data.savedir = savedir; 2026 quickcookie.data.savepoint = savepoint; 2027 quickcookie.data.trinkets = trinkets; 2028 2029 quickcookie.data.currentsong = music.currentsong; 2030 quickcookie.data.teleportscript = teleportscript; 2031 2032 //Special stats 2033 quickcookie.data.companion = companion; 2034 quickcookie.data.lastsaved = lastsaved; 2035 quickcookie.data.supercrewmate = supercrewmate; 2036 quickcookie.data.scmprogress = scmprogress; 2037 quickcookie.data.scmmoveme = scmmoveme; 2038 2039 quickcookie.data.frames = frames; quickcookie.data.seconds = seconds; 2040 quickcookie.data.minutes = minutes; quickcookie.data.hours = hours; 2041 2042 quickcookie.data.deathcounts = deathcounts; 2043 quickcookie.data.totalflips = totalflips; 2044 quickcookie.data.hardestroom = hardestroom; quickcookie.data.hardestroomdeaths = hardestroomdeaths; 2045 2046 savearea = map.currentarea(map.area(roomx, roomy)); 2047 quickcookie.data.summary = savearea + ", " + timestring(help); 2048 quicksummary = quickcookie.data.summary; 2049 2050 quickcookie.flush() 2051 quickcookie.close(); 2052 } 2053 2054 public function customsavequick(t:int, map:mapclass, obj:entityclass, music:musicclass, help:helpclass):void { 2055 customcookie[t] = SharedObject.getLocal("vvvvvv_custom_" + String(t)); 2056 2057 //Flags, map and stats 2058 savestate[2].explored = map.explored.slice(); 2059 savestate[2].flags = obj.flags.slice(); 2060 savestate[2].crewstats = crewstats.slice(); 2061 savestate[2].collect = obj.collect.slice(); 2062 savestate[2].customcollect = obj.customcollect.slice(); 2063 savestate[2].moods = obj.customcrewmoods.slice(); 2064 2065 customcookie[t].data.worldmap = savestate[2].explored.slice(); 2066 customcookie[t].data.flags = savestate[2].flags.slice(); 2067 customcookie[t].data.crewstats = savestate[2].crewstats.slice(); 2068 customcookie[t].data.collect = savestate[2].collect.slice(); 2069 customcookie[t].data.customcollect = savestate[2].customcollect.slice(); 2070 customcookie[t].data.moods = savestate[2].moods.slice(); 2071 2072 //trace(obj.flags); 2073 2074 customcookie[t].data.finalmode = map.finalmode; 2075 customcookie[t].data.finalstretch = map.finalstretch; 2076 2077 customcookie[t].data.finalx = map.finalx; 2078 customcookie[t].data.finaly = map.finaly; 2079 //Position 2080 customcookie[t].data.savex = savex; 2081 customcookie[t].data.savey = savey; 2082 customcookie[t].data.saverx = saverx; 2083 customcookie[t].data.savery = savery; 2084 customcookie[t].data.savegc = savegc; 2085 customcookie[t].data.savedir = savedir; 2086 customcookie[t].data.savepoint = savepoint; 2087 customcookie[t].data.trinkets = trinkets; 2088 customcookie[t].data.crewmates = crewmates; 2089 2090 customcookie[t].data.currentsong = music.currentsong; 2091 customcookie[t].data.teleportscript = teleportscript; 2092 2093 //Special stats 2094 customcookie[t].data.companion = companion; 2095 customcookie[t].data.lastsaved = lastsaved; 2096 customcookie[t].data.supercrewmate = supercrewmate; 2097 customcookie[t].data.scmprogress = scmprogress; 2098 customcookie[t].data.scmmoveme = scmmoveme; 2099 2100 customcookie[t].data.frames = frames; customcookie[t].data.seconds = seconds; 2101 customcookie[t].data.minutes = minutes; customcookie[t].data.hours = hours; 2102 2103 customcookie[t].data.deathcounts = deathcounts; 2104 customcookie[t].data.totalflips = totalflips; 2105 customcookie[t].data.hardestroom = hardestroom; customcookie[t].data.hardestroomdeaths = hardestroomdeaths; 2106 2107 customcookie[t].data.showminimap = map.customshowmm; 2108 2109 savearea = map.currentarea(map.area(roomx, roomy)) 2110 customcookie[t].data.summary = savearea + ", " + timestring(help); 2111 customcookiesummary[t] = customcookie[t].data.summary; 2112 2113 customcookie[t].flush() 2114 customcookie[t].close(); 2115 2116 customcookieexists[t] = true; 2117 customcookiesummary[t] = savearea + ", " + timestring(help); 2118 } 2119 2120 public function loadquick(map:mapclass, obj:entityclass, music:musicclass):void { 2121 quickcookie = SharedObject.getLocal("vvvvvv_quicksave"); 2122 //Save to the quicksave cookie 2123 savestate[0].explored = quickcookie.data.worldmap.slice(); 2124 savestate[0].flags = quickcookie.data.flags.slice(); 2125 savestate[0].crewstats = quickcookie.data.crewstats.slice(); 2126 savestate[0].collect = quickcookie.data.collect.slice(); 2127 2128 map.explored = savestate[0].explored.slice(); 2129 obj.flags = savestate[0].flags.slice(); 2130 crewstats = savestate[0].crewstats.slice(); 2131 obj.collect = savestate[0].collect.slice(); 2132 //trace(obj.flags); 2133 2134 map.finalmode = quickcookie.data.finalmode; 2135 map.finalstretch = quickcookie.data.finalstretch; 2136 if (map.finalmode) { 2137 map.final_colormode = false; map.final_mapcol = 0; map.final_colorframe = 0; 2138 } 2139 if (map.finalstretch) { 2140 map.finalstretch = true; 2141 map.final_colormode = true; 2142 map.final_mapcol = 0; 2143 map.final_colorframe = 1; 2144 } 2145 2146 map.finalx = quickcookie.data.finalx; 2147 map.finaly = quickcookie.data.finaly; 2148 //position 2149 savex = quickcookie.data.savex; 2150 savey = quickcookie.data.savey; 2151 saverx = quickcookie.data.saverx; 2152 savery = quickcookie.data.savery; 2153 savegc = quickcookie.data.savegc; 2154 savedir = quickcookie.data.savedir; 2155 savepoint = quickcookie.data.savepoint; 2156 trinkets = quickcookie.data.trinkets; 2157 2158 //Special stats 2159 companion = quickcookie.data.companion; 2160 lastsaved = quickcookie.data.lastsaved; 2161 teleportscript = quickcookie.data.teleportscript; 2162 supercrewmate = quickcookie.data.supercrewmate; 2163 scmprogress = quickcookie.data.scmprogress; 2164 scmmoveme = quickcookie.data.scmmoveme; 2165 2166 frames = quickcookie.data.frames; seconds = quickcookie.data.seconds; 2167 minutes = quickcookie.data.minutes; hours = quickcookie.data.hours; 2168 2169 deathcounts = quickcookie.data.deathcounts; 2170 totalflips = quickcookie.data.totalflips; 2171 hardestroom = quickcookie.data.hardestroom; hardestroomdeaths = quickcookie.data.hardestroomdeaths; 2172 2173 music.play(quickcookie.data.currentsong); 2174 2175 //Ok, now we determine some game stuff based on the above: 2176 map.showteleporters = true; 2177 if(obj.flags[12]==1) map.showtargets = true; 2178 if (obj.flags[42] == 1) map.showtrinkets = true; 2179 2180 quickcookie.close(); 2181 } 2182 2183 public function customloadquick(t:int, map:mapclass, obj:entityclass, music:musicclass):void{ 2184 customcookie[t] = SharedObject.getLocal("vvvvvv_custom_" + String(t)); 2185 2186 savestate[2].explored = customcookie[t].data.worldmap.slice(); 2187 savestate[2].flags = customcookie[t].data.flags.slice(); 2188 savestate[2].crewstats = customcookie[t].data.crewstats.slice(); 2189 savestate[2].collect = customcookie[t].data.collect.slice(); 2190 savestate[2].customcollect = customcookie[t].data.customcollect.slice(); 2191 savestate[2].moods = customcookie[t].data.moods.slice(); 2192 2193 map.explored = savestate[2].explored.slice(); 2194 obj.flags = savestate[2].flags.slice(); 2195 crewstats = savestate[2].crewstats.slice(); 2196 obj.collect = savestate[2].collect.slice(); 2197 obj.customcollect = savestate[2].customcollect.slice(); 2198 obj.customcrewmoods = savestate[2].moods.slice(); 2199 //trace(obj.flags); 2200 2201 map.finalmode = customcookie[t].data.finalmode; 2202 map.finalstretch = customcookie[t].data.finalstretch; 2203 if (map.finalmode) { 2204 map.final_colormode = false; map.final_mapcol = 0; map.final_colorframe = 0; 2205 } 2206 if (map.finalstretch) { 2207 map.finalstretch = true; 2208 map.final_colormode = true; 2209 map.final_mapcol = 0; 2210 map.final_colorframe = 1; 2211 } 2212 2213 map.finalx = customcookie[t].data.finalx; 2214 map.finaly = customcookie[t].data.finaly; 2215 //position 2216 savex = customcookie[t].data.savex; 2217 savey = customcookie[t].data.savey; 2218 saverx = customcookie[t].data.saverx; 2219 savery = customcookie[t].data.savery; 2220 savegc = customcookie[t].data.savegc; 2221 savedir = customcookie[t].data.savedir; 2222 savepoint = customcookie[t].data.savepoint; 2223 trinkets = customcookie[t].data.trinkets; 2224 crewmates = customcookie[t].data.crewmates; 2225 2226 //Special stats 2227 companion = customcookie[t].data.companion; 2228 lastsaved = customcookie[t].data.lastsaved; 2229 teleportscript = customcookie[t].data.teleportscript; 2230 supercrewmate = customcookie[t].data.supercrewmate; 2231 scmprogress = customcookie[t].data.scmprogress; 2232 scmmoveme = customcookie[t].data.scmmoveme; 2233 2234 frames = customcookie[t].data.frames; seconds = customcookie[t].data.seconds; 2235 minutes = customcookie[t].data.minutes; hours = customcookie[t].data.hours; 2236 2237 deathcounts = customcookie[t].data.deathcounts; 2238 totalflips = customcookie[t].data.totalflips; 2239 hardestroom = customcookie[t].data.hardestroom; hardestroomdeaths = customcookie[t].data.hardestroomdeaths; 2240 2241 map.customshowmm = customcookie[t].data.showminimap; 2242 2243 music.play(customcookie[t].data.currentsong); 2244 2245 //Ok, now we determine some game stuff based on the above: 2246 map.showteleporters = true; 2247 if (obj.flags[12] == 1) map.showtargets = true; 2248 if (obj.flags[42] == 1) map.showtrinkets = true; 2249 2250 customcookie[t].close(); 2251 } 2252 2253 public function deletequick():void { 2254 quicksummary = ""; 2255 quickcookieexists = false; 2256 quickcookie.clear(); 2257 } 2258 2259 public function telegotoship():void { 2260 //Special function to move the telesave to the ship teleporter. 2261 telecookie.data.savex = 13*8; 2262 telecookie.data.savey = 129; 2263 telecookie.data.saverx = 102; 2264 telecookie.data.savery = 111; 2265 telecookie.data.savegc = 0; 2266 telecookie.data.savedir = 1; 2267 telecookie.data.savepoint = 0; 2268 2269 telecookie.data.currentsong = 4; 2270 telecookie.data.companion = 0; 2271 2272 telecookie.data.finalmode = false;; 2273 telecookie.data.finalstretch = false; 2274 } 2275 2276 public function savetele(map:mapclass, obj:entityclass, music:musicclass, help:helpclass):void { 2277 //do a quicksave instead 2278 savequick(map, obj, music, help); 2279 /* 2280 telecookie = SharedObject.getLocal("vvvvvv_telesave"); 2281 //Save to the telesave cookie 2282 telecookieexists = true; 2283 //Flags, map and stats 2284 savestate[1].explored = map.explored.slice(); 2285 savestate[1].flags = obj.flags.slice(); 2286 savestate[1].crewstats = crewstats.slice(); 2287 savestate[1].collect = obj.collect.slice(); 2288 2289 telecookie.data.worldmap = savestate[1].explored.slice(); 2290 telecookie.data.flags = savestate[1].flags.slice(); 2291 telecookie.data.crewstats = savestate[1].crewstats.slice(); 2292 telecookie.data.collect = savestate[1].collect.slice(); 2293 2294 telecookie.data.finalmode = map.finalmode; 2295 telecookie.data.finalstretch = map.finalstretch; 2296 2297 telecookie.data.finalx = map.finalx; 2298 telecookie.data.finaly = map.finaly; 2299 //Position 2300 telecookie.data.savex = savex; 2301 telecookie.data.savey = savey; 2302 telecookie.data.saverx = saverx; 2303 telecookie.data.savery = savery; 2304 telecookie.data.savegc = savegc; 2305 telecookie.data.savedir = savedir; 2306 telecookie.data.savepoint = savepoint; 2307 telecookie.data.trinkets = trinkets; 2308 2309 if (music.nicechange != -1) { 2310 telecookie.data.currentsong = music.nicechange; 2311 }else{ 2312 telecookie.data.currentsong = music.currentsong; 2313 } 2314 telecookie.data.teleportscript = teleportscript; 2315 2316 //Special stats 2317 telecookie.data.companion = companion; 2318 telecookie.data.lastsaved = lastsaved; 2319 telecookie.data.supercrewmate = supercrewmate; 2320 telecookie.data.scmprogress = scmprogress; 2321 telecookie.data.scmmoveme = scmmoveme; 2322 2323 telecookie.data.frames = frames; telecookie.data.seconds = seconds; 2324 telecookie.data.minutes = minutes; telecookie.data.hours = hours; 2325 2326 telecookie.data.deathcounts = deathcounts; 2327 telecookie.data.totalflips = totalflips; 2328 telecookie.data.hardestroom = hardestroom; telecookie.data.hardestroomdeaths = hardestroomdeaths; 2329 2330 savearea = map.currentarea(map.area(roomx, roomy)) 2331 telecookie.data.summary = savearea + ", " + timestring(help); 2332 telesummary = telecookie.data.summary; 2333 2334 telecookie.flush(); 2335 telecookie.close(); 2336 */ 2337 } 2338 2339 public function loadtele(map:mapclass, obj:entityclass, music:musicclass):void { 2340 telecookie = SharedObject.getLocal("vvvvvv_telesave"); 2341 //Save to the telesave cookie 2342 savestate[1].explored = telecookie.data.worldmap.slice(); 2343 savestate[1].flags = telecookie.data.flags.slice(); 2344 savestate[1].crewstats = telecookie.data.crewstats.slice(); 2345 savestate[1].collect = telecookie.data.collect.slice(); 2346 2347 map.explored = savestate[1].explored.slice(); 2348 obj.flags = savestate[1].flags.slice(); 2349 crewstats = savestate[1].crewstats.slice(); 2350 obj.collect = savestate[1].collect.slice(); 2351 2352 map.finalmode = telecookie.data.finalmode; 2353 map.finalstretch = telecookie.data.finalstretch; 2354 if (map.finalmode) { 2355 map.final_colormode = false; map.final_mapcol = 0; map.final_colorframe = 0; 2356 } 2357 if (map.finalstretch) { 2358 map.finalstretch = true; 2359 map.final_colormode = true; 2360 map.final_mapcol = 0; 2361 map.final_colorframe = 1; 2362 } 2363 2364 map.finalx = telecookie.data.finalx; 2365 map.finaly = telecookie.data.finaly; 2366 //position 2367 savex = telecookie.data.savex; 2368 savey = telecookie.data.savey; 2369 saverx = telecookie.data.saverx; 2370 savery = telecookie.data.savery; 2371 savegc = telecookie.data.savegc; 2372 savedir = telecookie.data.savedir; 2373 savepoint = telecookie.data.savepoint; 2374 trinkets = telecookie.data.trinkets; 2375 2376 //trinkets = 19; obj.flags[41] = 0; obj.flags[42] = 0; obj.collect[18] = 0; //Testing Victoria epilogue criteria# 2377 2378 //Special stats 2379 companion = telecookie.data.companion; 2380 lastsaved = telecookie.data.lastsaved; 2381 teleportscript = telecookie.data.teleportscript; 2382 supercrewmate = telecookie.data.supercrewmate; 2383 scmprogress = telecookie.data.scmprogress; 2384 scmmoveme = telecookie.data.scmmoveme; 2385 2386 frames = telecookie.data.frames; seconds = telecookie.data.seconds; 2387 minutes = telecookie.data.minutes; hours = telecookie.data.hours; 2388 2389 deathcounts = telecookie.data.deathcounts; 2390 totalflips = telecookie.data.totalflips; 2391 hardestroom = telecookie.data.hardestroom; hardestroomdeaths = telecookie.data.hardestroomdeaths; 2392 2393 music.play(telecookie.data.currentsong); 2394 2395 //Ok, now we determine some game stuff based on the above: 2396 map.showteleporters = true; 2397 if(obj.flags[12]==1) map.showtargets = true; 2398 if (obj.flags[42] == 1) map.showtrinkets = true; 2399 2400 telecookie.close(); 2401 2402 } 2403 2404 public function deletetele():void { 2405 telesummary = ""; 2406 telecookieexists = false; 2407 telecookie.clear(); 2408 } 2409 2410 public function crewrescued():int { 2411 temp = 0; 2412 if (crewstats[0]) temp++; 2413 if (crewstats[1]) temp++; 2414 if (crewstats[2]) temp++; 2415 if (crewstats[3]) temp++; 2416 if (crewstats[4]) temp++; 2417 if (crewstats[5]) temp++; 2418 return temp; 2419 } 2420 2421 public function unrescued():String { 2422 //Randomly return the name of an unrescued crewmate 2423 if (Math.random() * 100 > 50) { 2424 if (!crewstats[5]) return "Victoria"; 2425 if (!crewstats[2]) return "Vitellary"; 2426 if (!crewstats[4]) return "Verdigris"; 2427 if (!crewstats[3]) return "Vermilion"; 2428 }else { 2429 if (Math.random() * 100 > 50) { 2430 if (!crewstats[2]) return "Vitellary"; 2431 if (!crewstats[4]) return "Verdigris"; 2432 if (!crewstats[3]) return "Vermilion"; 2433 if (!crewstats[5]) return "Victoria"; 2434 }else { 2435 if (!crewstats[4]) return "Verdigris"; 2436 if (!crewstats[3]) return "Vermilion"; 2437 if (!crewstats[5]) return "Victoria"; 2438 if (!crewstats[2]) return "Vitellary"; 2439 } 2440 } 2441 return "you"; 2442 } 2443 2444 public function gethardestroom(map:mapclass):void { 2445 if (currentroomdeaths > hardestroomdeaths) { 2446 hardestroomdeaths = currentroomdeaths; 2447 hardestroom = map.roomname; 2448 if (map.roomname == "glitch") { 2449 if (roomx == 42 && roomy == 51) { 2450 hardestroom = "Rear Vindow"; 2451 }else if (roomx == 48 && roomy == 51) { 2452 hardestroom = "On the Vaterfront"; 2453 }else if (roomx == 49 && roomy == 51) { 2454 hardestroom = "The Untouchavles"; 2455 } 2456 }else if (map.roomname == "change") { 2457 if (roomx == 45 && roomy == 51) hardestroom =map.specialnames[3]; 2458 if (roomx == 46 && roomy == 51) hardestroom =map.specialnames[4]; 2459 if (roomx == 47 && roomy == 51) hardestroom =map.specialnames[5]; 2460 if (roomx == 50 && roomy == 53) hardestroom =map.specialnames[6]; 2461 if (roomx == 50 && roomy == 54) hardestroom = map.specialnames[7]; 2462 } 2463 } 2464 } 2465 2466 public function updatestate(dwgfx:dwgraphicsclass, map:mapclass, obj:entityclass, help:helpclass, music:musicclass):void { 2467 statedelay--; if(statedelay<=0) statedelay=0; 2468 if (statedelay <= 0) { 2469 switch(state){ 2470 case 0: 2471 //Do nothing here! Standard game state 2472 break; 2473 case 1: 2474 //Game initilisation 2475 state = 0; 2476 break; 2477 case 2: 2478 //Opening cutscene 2479 advancetext = true; 2480 hascontrol = false; 2481 state = 3; 2482 dwgfx.createtextbox("To do: write quick", 50, 80, 164, 164, 255); 2483 dwgfx.addline("intro to story!"); 2484 //Oh no! what happen to rest of crew etc crash into dimension 2485 break; 2486 case 4: 2487 //End of opening cutscene for now 2488 switch(controlstyle) { 2489 case 0: 2490 dwgfx.createtextbox(" Swipe on the left side to move ", -1, 195, 174, 174, 174); 2491 break; 2492 case 1: 2493 dwgfx.createtextbox(" Touch the screen sides to move ", -1, 195, 174, 174, 174); 2494 break; 2495 case 2: 2496 dwgfx.createtextbox(" Tap the buttons to move ", -1, 195, 174, 174, 174); 2497 break; 2498 } 2499 dwgfx.textboxtimer(60); 2500 state = 0; 2501 break; 2502 case 5: 2503 //Demo over 2504 advancetext = true; 2505 hascontrol = false; 2506 /*dwgfx.createtextbox(" Prototype Complete ", 50, 80, 164, 164, 255); 2507 dwgfx.addline("Congrats! More Info Soon!"); 2508 dwgfx.textboxcenter(); 2509 */ 2510 2511 startscript = true; newscript="returntohub"; 2512 obj.removetrigger(5); 2513 state = 6; 2514 break; 2515 case 7: 2516 //End of opening cutscene for now 2517 dwgfx.textboxremove(); 2518 hascontrol = true; 2519 advancetext = false; 2520 state = 0; 2521 break; 2522 case 8: 2523 //Enter dialogue 2524 obj.removetrigger(8); 2525 if (obj.flags[13] == 0) { 2526 obj.changeflag(13, 1); 2527 if (mobilemenu) { 2528 dwgfx.createtextbox(" Tap the top right corner ", -1, 155, 174, 174, 174); 2529 dwgfx.addline(" to view map and crew"); 2530 }else{ 2531 dwgfx.createtextbox(" Press ENTER to view map ", -1, 155, 174, 174, 174); 2532 dwgfx.addline(" and quicksave"); 2533 } 2534 2535 dwgfx.textboxtimer(60); 2536 } 2537 state = 0; 2538 break; 2539 2540 case 9: 2541 //Start SWN Minigame Mode B 2542 obj.removetrigger(9); 2543 2544 swnmode = true; 2545 swngame = 6; 2546 swndelay = 150; 2547 swntimer = 60 * 30; 2548 2549 //set the checkpoint in the middle of the screen 2550 savepoint = 0; 2551 savex = 148; 2552 savey = 100; 2553 savegc = 0; 2554 saverx = roomx; savery = roomy; 2555 savedir = 0; 2556 2557 state = 0; 2558 break; 2559 2560 case 10: 2561 //Start SWN Minigame Mode A 2562 obj.removetrigger(10); 2563 2564 swnmode = true; 2565 swngame = 4; 2566 swndelay = 150; 2567 swntimer = 60 * 30; 2568 2569 //set the checkpoint in the middle of the screen 2570 savepoint = 0; 2571 savex = 148; 2572 savey = 100; 2573 savegc = 0; 2574 saverx = roomx; savery = roomy; 2575 savedir = 0; 2576 2577 state = 0; 2578 break; 2579 2580 case 11: 2581 //Intermission 1 instructional textbox, depends on last saved 2582 dwgfx.textboxremovefast(); 2583 dwgfx.createtextbox(" When you're NOT standing on ", -1, 3, 174, 174, 174); 2584 if (dwgfx.flipmode) { 2585 if (lastsaved == 2) { dwgfx.addline(" the ceiling, Vitellary will"); 2586 }else if (lastsaved == 3) { dwgfx.addline(" the ceiling, Vermilion will"); 2587 }else if (lastsaved == 4) { dwgfx.addline(" the ceiling, Verdigris will"); 2588 }else if (lastsaved == 5) { dwgfx.addline(" the ceiling, Victoria will"); } 2589 }else{ 2590 if (lastsaved == 2) { dwgfx.addline(" the floor, Vitellary will"); 2591 }else if (lastsaved == 3) { dwgfx.addline(" the floor, Vermilion will"); 2592 }else if (lastsaved == 4) { dwgfx.addline(" the floor, Verdigris will"); 2593 }else if (lastsaved == 5) { dwgfx.addline(" the floor, Victoria will"); } 2594 } 2595 2596 dwgfx.addline(" stop and wait for you."); 2597 dwgfx.textboxtimer(180); 2598 state = 0; 2599 break; 2600 case 12: 2601 //Intermission 1 instructional textbox, depends on last saved 2602 obj.removetrigger(12); 2603 if (obj.flags[61] == 0) { 2604 obj.changeflag(61, 1); 2605 dwgfx.textboxremovefast(); 2606 dwgfx.createtextbox(" You can't continue to the next ", -1, 8, 174, 174, 174); 2607 if (lastsaved == 5) { 2608 dwgfx.addline(" room until she is safely across. "); 2609 }else { 2610 dwgfx.addline(" room until he is safely across. "); 2611 } 2612 dwgfx.textboxtimer(120); 2613 } 2614 state = 0; 2615 break; 2616 case 13: 2617 //textbox removal 2618 obj.removetrigger(13); 2619 dwgfx.textboxremovefast(); 2620 state = 0; 2621 break; 2622 case 14: 2623 //Intermission 1 instructional textbox, depends on last saved 2624 if (dwgfx.flipmode) { 2625 dwgfx.createtextbox(" When you're standing on the ceiling, ", -1, 3, 174, 174, 174); 2626 }else{ 2627 dwgfx.createtextbox(" When you're standing on the floor, ", -1, 3, 174, 174, 174); 2628 } 2629 if (lastsaved == 2) { dwgfx.addline(" Vitellary will try to walk to you. "); 2630 }else if (lastsaved == 3) { dwgfx.addline(" Vermilion will try to walk to you. "); 2631 }else if (lastsaved == 4) { dwgfx.addline(" Verdigris will try to walk to you. "); 2632 }else if (lastsaved == 5) { dwgfx.addline(" Victoria will try to walk to you. ");} 2633 dwgfx.textboxtimer(280); 2634 2635 state = 0; 2636 break; 2637 2638 case 15: 2639 //leaving the naughty corner 2640 obj.entities[obj.getplayer()].tile = 0; 2641 state = 0; 2642 break; 2643 case 16: 2644 //entering the naughty corner 2645 if(obj.entities[obj.getplayer()].tile == 0){ 2646 obj.entities[obj.getplayer()].tile = 144; 2647 music.playef(2, 10); 2648 } 2649 state = 0; 2650 break; 2651 2652 case 17: 2653 //Arrow key tutorial 2654 /* 2655 obj.removetrigger(17); 2656 dwgfx.createtextbox(" If you prefer, you can press UP or ", -1, 195, 174, 174, 174); 2657 dwgfx.addline(" DOWN instead of ACTION to flip."); 2658 dwgfx.textboxtimer(100); 2659 */ 2660 state = 0; 2661 break; 2662 2663 case 20: 2664 if (obj.flags[1] == 0) { 2665 obj.changeflag(1, 1); 2666 state = 0; 2667 dwgfx.textboxremove(); 2668 } 2669 obj.removetrigger(20); 2670 break; 2671 case 21: 2672 if (obj.flags[2] == 0) { 2673 obj.changeflag(2, 1); 2674 state = 0; 2675 dwgfx.textboxremove(); 2676 } 2677 obj.removetrigger(21); 2678 break; 2679 case 22: 2680 if (obj.flags[3] == 0) { 2681 dwgfx.textboxremovefast(); 2682 obj.changeflag(3, 1); 2683 state = 0; 2684 2685 switch(controlstyle) { 2686 case 0: case 2: 2687 dwgfx.createtextbox(" Tap on the right to flip ", -1, 25, 174, 174, 174); 2688 break; 2689 case 1: 2690 dwgfx.createtextbox(" Tap both sides together to flip ", -1, 25, 174, 174, 174); 2691 break; 2692 } 2693 2694 dwgfx.textboxtimer(60); 2695 } 2696 obj.removetrigger(22); 2697 break; 2698 2699 case 30: 2700 //Generic "run script" 2701 if (obj.flags[4] == 0) { 2702 obj.changeflag(4, 1); 2703 startscript = true; newscript="firststeps"; 2704 state = 0; 2705 } 2706 obj.removetrigger(30); 2707 state = 0; 2708 break; 2709 case 31: 2710 //state = 55; statedelay = 50; 2711 state = 0; statedelay = 0; 2712 if (obj.flags[6] == 0) { 2713 obj.changeflag(6, 1); 2714 2715 obj.changeflag(5, 1); 2716 startscript = true; newscript="communicationstation"; 2717 state = 0; statedelay = 0; 2718 } 2719 obj.removetrigger(31); 2720 break; 2721 case 32: 2722 //Generic "run script" 2723 if (obj.flags[7] == 0) { 2724 obj.changeflag(7, 1); 2725 startscript = true; newscript="teleporterback"; 2726 state = 0; 2727 } 2728 obj.removetrigger(32); 2729 state = 0; 2730 break; 2731 case 33: 2732 //Generic "run script" 2733 if (obj.flags[9] == 0) { 2734 obj.changeflag(9, 1); 2735 startscript = true; newscript="rescueblue"; 2736 state = 0; 2737 } 2738 obj.removetrigger(33); 2739 state = 0; 2740 break; 2741 case 34: 2742 //Generic "run script" 2743 if (obj.flags[10] == 0) { 2744 obj.changeflag(10, 1); 2745 startscript = true; newscript="rescueyellow"; 2746 state = 0; 2747 } 2748 obj.removetrigger(34); 2749 state = 0; 2750 break; 2751 case 35: 2752 //Generic "run script" 2753 if (obj.flags[11] == 0) { 2754 obj.changeflag(11, 1); 2755 startscript = true; newscript="rescuegreen"; 2756 state = 0; 2757 } 2758 obj.removetrigger(35); 2759 state = 0; 2760 break; 2761 case 36: 2762 //Generic "run script" 2763 if (obj.flags[8] == 0) { 2764 obj.changeflag(8, 1); 2765 startscript = true; newscript="rescuered"; 2766 state = 0; 2767 } 2768 obj.removetrigger(36); 2769 state = 0; 2770 break; 2771 2772 case 37: 2773 //Generic "run script" 2774 if (companion == 0) { 2775 startscript = true; newscript="int2_yellow"; 2776 state = 0; 2777 } 2778 obj.removetrigger(37); 2779 state = 0; 2780 break; 2781 case 38: 2782 //Generic "run script" 2783 if (companion == 0) { 2784 startscript = true; newscript="int2_red"; 2785 state = 0; 2786 } 2787 obj.removetrigger(38); 2788 state = 0; 2789 break; 2790 case 39: 2791 //Generic "run script" 2792 if (companion == 0) { 2793 startscript = true; newscript="int2_green"; 2794 state = 0; 2795 } 2796 obj.removetrigger(39); 2797 state = 0; 2798 break; 2799 case 40: 2800 //Generic "run script" 2801 if (companion == 0) { 2802 startscript = true; newscript="int2_blue"; 2803 state = 0; 2804 } 2805 obj.removetrigger(40); 2806 state = 0; 2807 break; 2808 2809 case 41: 2810 //Generic "run script" 2811 if (obj.flags[60] == 0) { 2812 obj.changeflag(60, 1); 2813 startscript = true; 2814 if (lastsaved == 2) { newscript = "int1yellow_2"; 2815 }else if (lastsaved == 3) { newscript = "int1red_2"; 2816 }else if (lastsaved == 4) { newscript = "int1green_2"; 2817 }else if (lastsaved == 5) { newscript = "int1blue_2";} 2818 state = 0; 2819 } 2820 obj.removetrigger(41); 2821 state = 0; 2822 break; 2823 case 42: 2824 //Generic "run script" 2825 if (obj.flags[62] == 0) { 2826 obj.changeflag(62, 1); 2827 startscript = true; 2828 if (lastsaved == 2) { newscript = "int1yellow_3"; 2829 }else if (lastsaved == 3) { newscript = "int1red_3"; 2830 }else if (lastsaved == 4) { newscript = "int1green_3"; 2831 }else if (lastsaved == 5) { newscript = "int1blue_3";} 2832 state = 0; 2833 } 2834 obj.removetrigger(42); 2835 state = 0; 2836 break; 2837 case 43: 2838 //Generic "run script" 2839 if (obj.flags[63] == 0) { 2840 obj.changeflag(63, 1); 2841 startscript = true; 2842 if (lastsaved == 2) { newscript = "int1yellow_4"; 2843 }else if (lastsaved == 3) { newscript = "int1red_4"; 2844 }else if (lastsaved == 4) { newscript = "int1green_4"; 2845 }else if (lastsaved == 5) { newscript = "int1blue_4";} 2846 state = 0; 2847 } 2848 obj.removetrigger(43); 2849 state = 0; 2850 break; 2851 case 44: 2852 //Generic "run script" 2853 if (obj.flags[64] == 0) { 2854 obj.changeflag(64, 1); 2855 startscript = true; 2856 if (lastsaved == 2) { newscript = "int1yellow_5"; 2857 }else if (lastsaved == 3) { newscript = "int1red_5"; 2858 }else if (lastsaved == 4) { newscript = "int1green_5"; 2859 }else if (lastsaved == 5) { newscript = "int1blue_5";} 2860 state = 0; 2861 } 2862 obj.removetrigger(44); 2863 state = 0; 2864 break; 2865 case 45: 2866 //Generic "run script" 2867 if (obj.flags[65] == 0) { 2868 obj.changeflag(65, 1); 2869 startscript = true; 2870 if (lastsaved == 2) { newscript = "int1yellow_6"; 2871 }else if (lastsaved == 3) { newscript = "int1red_6"; 2872 }else if (lastsaved == 4) { newscript = "int1green_6"; 2873 }else if (lastsaved == 5) { newscript = "int1blue_6";} 2874 state = 0; 2875 } 2876 obj.removetrigger(45); 2877 state = 0; 2878 break; 2879 case 46: 2880 //Generic "run script" 2881 if (obj.flags[66] == 0) { 2882 obj.changeflag(66, 1); 2883 startscript = true; 2884 if (lastsaved == 2) { newscript = "int1yellow_7"; 2885 }else if (lastsaved == 3) { newscript = "int1red_7"; 2886 }else if (lastsaved == 4) { newscript = "int1green_7"; 2887 }else if (lastsaved == 5) { newscript = "int1blue_7";} 2888 state = 0; 2889 } 2890 obj.removetrigger(46); 2891 state = 0; 2892 break; 2893 2894 case 47: 2895 //Generic "run script" 2896 if (obj.flags[69] == 0) { 2897 obj.changeflag(69, 1); 2898 startscript = true; newscript="trenchwarfare"; 2899 state = 0; 2900 } 2901 obj.removetrigger(47); 2902 state = 0; 2903 break; 2904 case 48: 2905 //Generic "run script" 2906 if (obj.flags[70] == 0) { 2907 obj.changeflag(70, 1); 2908 startscript = true; newscript="trinketcollector"; 2909 state = 0; 2910 } 2911 obj.removetrigger(48); 2912 state = 0; 2913 break; 2914 case 49: 2915 //Start final level music 2916 if (obj.flags[71] == 0) { 2917 obj.changeflag(71, 1); 2918 music.niceplay(15); //Final level remix 2919 state = 0; 2920 } 2921 obj.removetrigger(49); 2922 state = 0; 2923 break; 2924 2925 case 50: 2926 music.playef(15, 10); 2927 dwgfx.createtextbox("Help! Can anyone hear", 35, 15, 255, 134, 255); 2928 dwgfx.addline("this message?"); 2929 dwgfx.textboxtimer(60); 2930 state++; statedelay = 100; 2931 break; 2932 case 51: 2933 music.playef(15, 10); 2934 dwgfx.createtextbox("Verdigris? Are you out", 30, 12, 255, 134, 255); 2935 dwgfx.addline("there? Are you ok?"); 2936 dwgfx.textboxtimer(60); 2937 state++; statedelay = 100; 2938 break; 2939 case 52: 2940 music.playef(15, 10); 2941 dwgfx.createtextbox("Please help us! We've crashed", 5, 22, 255, 134, 255); 2942 dwgfx.addline("and need assistance!"); 2943 dwgfx.textboxtimer(60); 2944 state++; statedelay = 100; 2945 break; 2946 case 53: 2947 music.playef(15, 10); 2948 dwgfx.createtextbox("Hello? Anyone out there?", 40, 15, 255, 134, 255); 2949 dwgfx.textboxtimer(60); 2950 state++; statedelay = 100; 2951 break; 2952 case 54: 2953 music.playef(15, 10); 2954 dwgfx.createtextbox("This is Doctor Violet from the", 5, 8, 255, 134, 255); 2955 dwgfx.addline("D.S.S. Souleye! Please respond!"); 2956 dwgfx.textboxtimer(60); 2957 state++; statedelay = 100; 2958 break; 2959 case 55: 2960 music.playef(15, 10); 2961 dwgfx.createtextbox("Please... Anyone...", 45, 14, 255, 134, 255); 2962 dwgfx.textboxtimer(60); 2963 state++; statedelay = 100; 2964 break; 2965 case 56: 2966 music.playef(15, 10); 2967 dwgfx.createtextbox("Please be alright, everyone...", 25, 18, 255, 134, 255); 2968 dwgfx.textboxtimer(60); 2969 state=50; statedelay = 100; 2970 break; 2971 2972 2973 case 80: 2974 //Used to return to menu from the game 2975 if(dwgfx.fademode == 1) state++; 2976 break; 2977 case 81: 2978 gamestate = 1; dwgfx.fademode = 4; 2979 music.play(6); dwgfx.backgrounddrawn = false; map.tdrawback = true; 2980 dwgfx.flipmode = false; 2981 createmenu("mainmenu"); 2982 state = 0; 2983 break; 2984 2985 case 82: 2986 //Time Trial Complete! 2987 obj.removetrigger(82); 2988 hascontrol = false; 2989 timetrialresulttime = seconds + (minutes * 60); 2990 timetrialrank = 0; 2991 if (timetrialresulttime <= timetrialpar) timetrialrank++; 2992 if (trinkets >= timetrialshinytarget) timetrialrank++; 2993 if (deathcounts == 0) timetrialrank++; 2994 2995 if (timetrialresulttime < besttimes[timetriallevel] || besttimes[timetriallevel]==-1) { 2996 besttimes[timetriallevel] = timetrialresulttime; 2997 } 2998 if (trinkets > besttrinkets[timetriallevel] || besttrinkets[timetriallevel]==-1) { 2999 besttrinkets[timetriallevel] = trinkets; 3000 } 3001 if (deathcounts < bestlives[timetriallevel] || bestlives[timetriallevel]==-1) { 3002 bestlives[timetriallevel] = deathcounts; 3003 } 3004 if (timetrialrank > bestrank[timetriallevel] || bestrank[timetriallevel]==-1) { 3005 bestrank[timetriallevel] = timetrialrank; 3006 scores.reportAchievement(6 + timetriallevel); 3007 } 3008 3009 savestats(map, dwgfx); 3010 3011 dwgfx.fademode = 2; music.fadeout(); 3012 state++; 3013 break; 3014 case 83: 3015 frames--; 3016 if(dwgfx.fademode == 1) state++; 3017 break; 3018 case 84: 3019 dwgfx.flipmode = false; 3020 gamestate = 1; dwgfx.fademode = 4; 3021 dwgfx.backgrounddrawn = true; map.tdrawback = true; 3022 createmenu("timetrialcomplete"); 3023 state = 0; 3024 break; 3025 3026 3027 case 85: 3028 //Cutscene skip version of final level change 3029 obj.removetrigger(85); 3030 //Init final stretch 3031 state++; music.playef(9, 10); 3032 music.play(2); 3033 obj.flags[72] = 1; 3034 3035 screenshake = 10; 3036 flashlight = 5; 3037 map.finalstretch = true; 3038 map.warpx = false; map.warpy = false; 3039 map.background = 6; 3040 3041 map.final_colormode = true; map.final_colorframe = 1; 3042 3043 state = 0; 3044 break; 3045 3046 //From 90-100 are run scripts for the eurogamer expo only, remove later 3047 case 90: 3048 //Generic "run script" 3049 startscript = true; newscript="startexpolevel_station1"; 3050 obj.removetrigger(90); 3051 state = 0; 3052 break; 3053 case 91: 3054 //Generic "run script" 3055 startscript = true; newscript="startexpolevel_lab"; 3056 obj.removetrigger(91); 3057 state = 0; 3058 break; 3059 case 92: 3060 //Generic "run script" 3061 startscript = true; newscript="startexpolevel_warp"; 3062 obj.removetrigger(92); 3063 state = 0; 3064 break; 3065 case 93: 3066 //Generic "run script" 3067 startscript = true; newscript="startexpolevel_tower"; 3068 obj.removetrigger(93); 3069 state = 0; 3070 break; 3071 case 94: 3072 //Generic "run script" 3073 startscript = true; newscript="startexpolevel_station2"; 3074 obj.removetrigger(94); 3075 state = 0; 3076 break; 3077 case 95: 3078 //Generic "run script" 3079 startscript = true; newscript="startexpolevel_final"; 3080 obj.removetrigger(95); 3081 state = 0; 3082 break; 3083 3084 case 96: 3085 //Used to return to gravitron to game 3086 if(dwgfx.fademode == 1) state++; 3087 break; 3088 case 97: 3089 gamestate = 0; dwgfx.fademode = 4; 3090 startscript = true; newscript="returntolab"; 3091 state = 0; 3092 break; 3093 3094 case 100: 3095 // 3096 // Meeting crewmate in the warpzone 3097 // 3098 obj.removetrigger(100); 3099 if (obj.flags[4] == 0) { 3100 obj.changeflag(4, 1); 3101 state++; 3102 } 3103 break; 3104 case 101: 3105 i = obj.getplayer(); 3106 hascontrol = false; 3107 if (obj.entities[i].onroof > 0 && gravitycontrol == 1) { 3108 gravitycontrol = 0; music.playef(1, 10); 3109 } 3110 if (obj.entities[i].onground > 0) { 3111 state++; 3112 } 3113 break; 3114 case 102: 3115 companion = 6; 3116 i = obj.getcompanion(6); obj.entities[i].tile = 0; obj.entities[i].state = 1; 3117 3118 advancetext = true; hascontrol = false; 3119 3120 dwgfx.createtextbox("Captain! I've been so worried!", 60, 90, 164, 255, 164); 3121 state++; music.playef(12, 10); 3122 break; 3123 case 104: 3124 dwgfx.createtextbox("I'm glad you're ok!", 135, 152, 164, 164, 255); 3125 state++; music.playef(11, 10); 3126 dwgfx.textboxactive(); 3127 break; 3128 case 106: 3129 dwgfx.createtextbox("I've been trying to find a", 74, 70, 164, 255, 164); 3130 dwgfx.addline("way out, but I keep going"); 3131 dwgfx.addline("around in circles..."); 3132 state++; music.playef(2, 10); 3133 dwgfx.textboxactive(); 3134 i = obj.getcompanion(6); 3135 obj.entities[i].tile = 54; obj.entities[i].state = 0; 3136 break; 3137 case 108: 3138 dwgfx.createtextbox("Don't worry! I have a", 125, 152, 164, 164, 255); 3139 dwgfx.addline("teleporter key!"); 3140 state++; music.playef(11, 10); 3141 dwgfx.textboxactive(); 3142 break; 3143 case 110: 3144 i = obj.getcompanion(6); obj.entities[i].tile = 0; obj.entities[i].state = 1; 3145 dwgfx.createtextbox("Follow me!", 185, 154, 164, 164, 255); 3146 state++; music.playef(11, 10); 3147 dwgfx.textboxactive(); 3148 break; 3149 case 112: 3150 dwgfx.textboxremove(); 3151 hascontrol = true; 3152 advancetext = false; 3153 3154 state = 0; 3155 break; 3156 3157 case 115: 3158 // 3159 // Test script for space station, totally delete me! 3160 // 3161 i = obj.getplayer(); 3162 hascontrol = false; 3163 state++; 3164 break; 3165 case 116: 3166 advancetext = true; hascontrol = false; 3167 3168 dwgfx.createtextbox("Sorry Eurogamers! Teleporting around", 60 - 20, 200, 255, 64, 64); 3169 dwgfx.addline("the map doesn't work in this version!"); 3170 dwgfx.textboxcenterx(); 3171 state++; 3172 break; 3173 case 118: 3174 dwgfx.textboxremove(); 3175 hascontrol = true; 3176 advancetext = false; 3177 3178 state = 0; 3179 break; 3180 3181 case 120: 3182 // 3183 // Meeting crewmate in the space station 3184 // 3185 obj.removetrigger(120); 3186 if (obj.flags[5] == 0) { 3187 obj.changeflag(5, 1); 3188 state++; 3189 } 3190 break; 3191 case 121: 3192 i = obj.getplayer(); 3193 hascontrol = false; 3194 if (obj.entities[i].onground > 0 && gravitycontrol == 0) { 3195 gravitycontrol = 1; music.playef(1, 10); 3196 } 3197 if (obj.entities[i].onroof > 0) { 3198 state++; 3199 } 3200 break; 3201 case 122: 3202 companion = 7; 3203 i = obj.getcompanion(7); obj.entities[i].tile = 6; obj.entities[i].state = 1; 3204 3205 advancetext = true; hascontrol = false; 3206 3207 dwgfx.createtextbox("Captain! You're ok!", 60-10, 90-40, 255, 255, 134); 3208 state++; music.playef(14, 10); 3209 break; 3210 case 124: 3211 dwgfx.createtextbox("I've found a teleporter, but", 60-20, 90 - 40, 255, 255, 134); 3212 dwgfx.addline("I can't get it to go anywhere..."); 3213 state++; music.playef(2, 10); 3214 dwgfx.textboxactive(); 3215 i = obj.getcompanion(7); //obj.entities[i].tile = 66; obj.entities[i].state = 0; 3216 break; 3217 case 126: 3218 dwgfx.createtextbox("I can help with that!", 125, 152-40, 164, 164, 255); 3219 state++; music.playef(11, 10); 3220 dwgfx.textboxactive(); 3221 break; 3222 case 128: 3223 dwgfx.createtextbox("I have the teleporter", 130, 152-35, 164, 164, 255); 3224 dwgfx.addline("codex for our ship!"); 3225 state++; music.playef(11, 10); 3226 dwgfx.textboxactive(); 3227 break; 3228 3229 case 130: 3230 dwgfx.createtextbox("Yey! Let's go home!", 60-30, 90-35, 255, 255, 134); 3231 state++; music.playef(14, 10); 3232 dwgfx.textboxactive(); 3233 i = obj.getcompanion(7); obj.entities[i].tile = 6; obj.entities[i].state = 1; 3234 break; 3235 case 132: 3236 dwgfx.textboxremove(); 3237 hascontrol = true; 3238 advancetext = false; 3239 3240 state = 0; 3241 break; 3242 3243 case 200: 3244 //Init final stretch 3245 state++; music.playef(9, 10); 3246 //music.play(2); 3247 obj.flags[72] = 1; 3248 3249 screenshake = 10; 3250 flashlight = 5; 3251 map.finalstretch = true; 3252 map.warpx = false; map.warpy = false; 3253 map.background = 6; 3254 3255 map.final_colormode = true; map.final_colorframe = 1; 3256 3257 startscript = true; newscript="finalterminal_finish"; 3258 state = 0; 3259 break; 3260 3261 case 300: 3262 startscript = true; 3263 newscript="custom_"+customscript[0]; 3264 obj.removetrigger(300); 3265 state = 0; 3266 break; 3267 case 301: 3268 startscript = true; 3269 newscript="custom_"+customscript[1]; 3270 obj.removetrigger(301); 3271 state = 0; 3272 break; 3273 case 302: 3274 startscript = true; 3275 newscript="custom_"+customscript[2]; 3276 obj.removetrigger(302); 3277 state = 0; 3278 break; 3279 case 303: 3280 startscript = true; 3281 newscript="custom_"+customscript[3]; 3282 obj.removetrigger(303); 3283 state = 0; 3284 break; 3285 case 304: 3286 startscript = true; 3287 newscript="custom_"+customscript[4]; 3288 obj.removetrigger(304); 3289 state = 0; 3290 break; 3291 case 305: 3292 startscript = true; 3293 newscript="custom_"+customscript[5]; 3294 obj.removetrigger(305); 3295 state = 0; 3296 break; 3297 case 306: 3298 startscript = true; 3299 newscript="custom_"+customscript[6]; 3300 obj.removetrigger(306); 3301 state = 0; 3302 break; 3303 case 307: 3304 startscript = true; 3305 newscript="custom_"+customscript[7]; 3306 obj.removetrigger(307); 3307 state = 0; 3308 break; 3309 case 308: 3310 startscript = true; 3311 newscript="custom_"+customscript[8]; 3312 obj.removetrigger(308); 3313 state = 0; 3314 break; 3315 case 309: 3316 startscript = true; 3317 newscript="custom_"+customscript[9]; 3318 obj.removetrigger(309); 3319 state = 0; 3320 break; 3321 case 310: 3322 startscript = true; 3323 newscript="custom_"+customscript[10]; 3324 obj.removetrigger(310); 3325 state = 0; 3326 break; 3327 case 311: 3328 startscript = true; 3329 newscript="custom_"+customscript[11]; 3330 obj.removetrigger(311); 3331 state = 0; 3332 break; 3333 case 312: 3334 startscript = true; 3335 newscript="custom_"+customscript[12]; 3336 obj.removetrigger(312); 3337 state = 0; 3338 break; 3339 case 313: 3340 startscript = true; 3341 newscript="custom_"+customscript[13]; 3342 obj.removetrigger(313); 3343 state = 0; 3344 break; 3345 case 314: 3346 startscript = true; 3347 newscript="custom_"+customscript[14]; 3348 obj.removetrigger(314); 3349 state = 0; 3350 break; 3351 case 315: 3352 startscript = true; 3353 newscript="custom_"+customscript[15]; 3354 obj.removetrigger(315); 3355 state = 0; 3356 break; 3357 case 316: 3358 startscript = true; 3359 newscript="custom_"+customscript[16]; 3360 obj.removetrigger(316); 3361 state = 0; 3362 break; 3363 case 317: 3364 startscript = true; 3365 newscript="custom_"+customscript[17]; 3366 obj.removetrigger(317); 3367 state = 0; 3368 break; 3369 case 318: 3370 startscript = true; 3371 newscript="custom_"+customscript[18]; 3372 obj.removetrigger(318); 3373 state = 0; 3374 break; 3375 case 319: 3376 startscript = true; 3377 newscript="custom_"+customscript[19]; 3378 obj.removetrigger(319); 3379 state = 0; 3380 break; 3381 case 320: 3382 startscript = true; 3383 newscript="custom_"+customscript[20]; 3384 obj.removetrigger(320); 3385 state = 0; 3386 break; 3387 case 321: 3388 startscript = true; 3389 newscript="custom_"+customscript[21]; 3390 obj.removetrigger(321); 3391 state = 0; 3392 break; 3393 case 322: 3394 startscript = true; 3395 newscript="custom_"+customscript[22]; 3396 obj.removetrigger(322); 3397 state = 0; 3398 break; 3399 case 323: 3400 startscript = true; 3401 newscript="custom_"+customscript[23]; 3402 obj.removetrigger(323); 3403 state = 0; 3404 break; 3405 case 324: 3406 startscript = true; 3407 newscript="custom_"+customscript[24]; 3408 obj.removetrigger(324); 3409 state = 0; 3410 break; 3411 case 325: 3412 startscript = true; 3413 newscript="custom_"+customscript[25]; 3414 obj.removetrigger(325); 3415 state = 0; 3416 break; 3417 case 326: 3418 startscript = true; 3419 newscript="custom_"+customscript[26]; 3420 obj.removetrigger(326); 3421 state = 0; 3422 break; 3423 case 327: 3424 startscript = true; 3425 newscript="custom_"+customscript[27]; 3426 obj.removetrigger(327); 3427 state = 0; 3428 break; 3429 case 328: 3430 startscript = true; 3431 newscript="custom_"+customscript[28]; 3432 obj.removetrigger(328); 3433 state = 0; 3434 break; 3435 case 329: 3436 startscript = true; 3437 newscript="custom_"+customscript[29]; 3438 obj.removetrigger(329); 3439 state = 0; 3440 break; 3441 case 330: 3442 startscript = true; 3443 newscript="custom_"+customscript[30]; 3444 obj.removetrigger(330); 3445 state = 0; 3446 break; 3447 case 331: 3448 startscript = true; 3449 newscript="custom_"+customscript[31]; 3450 obj.removetrigger(331); 3451 state = 0; 3452 break; 3453 case 332: 3454 startscript = true; 3455 newscript="custom_"+customscript[32]; 3456 obj.removetrigger(332); 3457 state = 0; 3458 break; 3459 case 333: 3460 startscript = true; 3461 newscript="custom_"+customscript[33]; 3462 obj.removetrigger(333); 3463 state = 0; 3464 break; 3465 case 334: 3466 startscript = true; 3467 newscript="custom_"+customscript[34]; 3468 obj.removetrigger(334); 3469 state = 0; 3470 break; 3471 case 335: 3472 startscript = true; 3473 newscript="custom_"+customscript[35]; 3474 obj.removetrigger(335); 3475 state = 0; 3476 break; 3477 case 336: 3478 startscript = true; 3479 newscript="custom_"+customscript[36]; 3480 obj.removetrigger(336); 3481 state = 0; 3482 break; 3483 3484 case 1000: 3485 dwgfx.showcutscenebars = true; 3486 hascontrol = false; 3487 completestop = true; 3488 state++; statedelay = 15; 3489 break; 3490 case 1001: 3491 //Found a trinket! 3492 advancetext = true; 3493 state++; 3494 if (dwgfx.flipmode) { 3495 dwgfx.createtextbox(" Congratulations! ", 50, 105, 174, 174, 174); 3496 dwgfx.addline(""); 3497 dwgfx.addline("You have found a shiny trinket!"); 3498 dwgfx.textboxcenterx(); 3499 3500 if (map.custommode) { 3501 dwgfx.createtextbox(" " + help.number(trinkets) + " out of " + help.number(map.customtrinkets), 50, 65, 174, 174, 174); 3502 }else{ 3503 dwgfx.createtextbox(" " + help.number(trinkets) + " out of Twenty ", 50, 65, 174, 174, 174); 3504 } 3505 dwgfx.textboxcenterx(); 3506 }else{ 3507 dwgfx.createtextbox(" Congratulations! ", 50, 85, 174, 174, 174); 3508 dwgfx.addline(""); 3509 dwgfx.addline("You have found a shiny trinket!"); 3510 dwgfx.textboxcenterx(); 3511 3512 if (map.custommode) { 3513 dwgfx.createtextbox(" " + help.number(trinkets) + " out of " + help.number(map.customtrinkets), 50, 135, 174, 174, 174); 3514 }else{ 3515 dwgfx.createtextbox(" " + help.number(trinkets) + " out of Twenty ", 50, 135, 174, 174, 174); 3516 } 3517 dwgfx.textboxcenterx(); 3518 } 3519 break; 3520 case 1003: 3521 dwgfx.textboxremove(); 3522 hascontrol = true; 3523 advancetext = false; completestop = false; 3524 state = 0; 3525 //music.play(music.resumesong); 3526 music.musicfadein = 90; 3527 dwgfx.showcutscenebars = false; 3528 break; 3529 3530 case 1010: 3531 dwgfx.showcutscenebars = true; 3532 hascontrol = false; 3533 completestop = true; 3534 state++; 3535 statedelay = 15; 3536 break; 3537 case 1011: 3538 //Found a trinket! 3539 advancetext = true; 3540 state++; 3541 if (dwgfx.flipmode) 3542 { 3543 dwgfx.createtextbox(" Congratulations! ", 50, 105, 174, 174, 174); 3544 dwgfx.addline(""); 3545 dwgfx.addline("You have found a lost crewmate!"); 3546 dwgfx.textboxcenterx(); 3547 3548 if(int(map.customcrewmates-crewmates)==0) 3549 { 3550 dwgfx.createtextbox(" All crewmates rescued! ", 50, 135, 174, 174, 174); 3551 } 3552 else if(map.customcrewmates-crewmates==1) 3553 { 3554 dwgfx.createtextbox(" " + help.number(int(map.customcrewmates-crewmates))+ " remains ", 50, 135, 174, 174, 174); 3555 } 3556 else 3557 { 3558 dwgfx.createtextbox(" " + help.number(int(map.customcrewmates-crewmates))+ " remain ", 50, 135, 174, 174, 174); 3559 } 3560 dwgfx.textboxcenterx(); 3561 3562 } 3563 else 3564 { 3565 dwgfx.createtextbox(" Congratulations! ", 50, 85, 174, 174, 174); 3566 dwgfx.addline(""); 3567 dwgfx.addline("You have found a lost crewmate!"); 3568 dwgfx.textboxcenterx(); 3569 3570 if(int(map.customcrewmates-crewmates)==0) 3571 { 3572 dwgfx.createtextbox(" All crewmates rescued! ", 50, 135, 174, 174, 174); 3573 } 3574 else if(map.customcrewmates-crewmates==1) 3575 { 3576 dwgfx.createtextbox(" " + help.number(int(map.customcrewmates-crewmates))+ " remains ", 50, 135, 174, 174, 174); 3577 } 3578 else 3579 { 3580 dwgfx.createtextbox(" " + help.number(int(map.customcrewmates-crewmates))+ " remain ", 50, 135, 174, 174, 174); 3581 } 3582 dwgfx.textboxcenterx(); 3583 } 3584 break; 3585 case 1013: 3586 dwgfx.textboxremove(); 3587 hascontrol = true; 3588 advancetext = false; 3589 completestop = false; 3590 state = 0; 3591 3592 if(map.customcrewmates-crewmates==0) 3593 { 3594 if(map.custommodeforreal) 3595 { 3596 dwgfx.fademode = 2; 3597 if(!muted && editor.levmusic>0) music.musicfadein = 90; 3598 if(editor.levmusic>0) music.fadeout(); 3599 state=1014; 3600 } 3601 else 3602 { 3603 gamestate = EDITORMODE; 3604 dwgfx.backgrounddrawn=false; 3605 if(!muted && editor.levmusic>0) music.musicfadein = 90; 3606 if(editor.levmusic>0) music.fadeout(); 3607 } 3608 } 3609 else 3610 { 3611 if(!muted && editor.levmusic>0) music.musicfadein = 90; 3612 } 3613 dwgfx.showcutscenebars = false; 3614 break; 3615 case 1014: 3616 frames--; 3617 if(dwgfx.fademode == 1) state++; 3618 break; 3619 case 1015: 3620 dwgfx.flipmode = false; 3621 gamestate = TITLEMODE; 3622 dwgfx.fademode = 4; 3623 music.play(6); 3624 dwgfx.backgrounddrawn = true; 3625 map.tdrawback = true; 3626 //Update level stats 3627 if(map.customcrewmates-crewmates==0) 3628 { 3629 //Finished level 3630 if(map.customtrinkets-trinkets==0) 3631 { 3632 //and got all the trinkets! 3633 updatecustomlevelstats(customlevelfilename, 3); 3634 } 3635 else 3636 { 3637 updatecustomlevelstats(customlevelfilename, 1); 3638 } 3639 } 3640 createmenu("levellist"); 3641 state = 0; 3642 break; 3643 3644 case 2000: 3645 //Game Saved! 3646 if (intimetrial || nodeathmode || inintermission) { 3647 state = 0; 3648 }else{ 3649 savetele(map, obj, music, help); 3650 if (dwgfx.flipmode) { 3651 dwgfx.createtextbox(" Game Saved ", -1, 202, 174, 174, 174); 3652 dwgfx.textboxtimer(25); 3653 }else{ 3654 dwgfx.createtextbox(" Game Saved ", -1, 12, 174, 174, 174); 3655 dwgfx.textboxtimer(25); 3656 } 3657 state = 0; 3658 } 3659 break; 3660 3661 case 2500: 3662 3663 music.play(5); 3664 //Activating a teleporter (appear) 3665 state++; statedelay = 15; 3666 flashlight = 5; 3667 screenshake = 90; 3668 music.playef(9, 10); 3669 break; 3670 case 2501: 3671 //Activating a teleporter 2 3672 state++; statedelay = 0; 3673 flashlight = 5; screenshake = 0; 3674 //we're done here! 3675 music.playef(10, 10); 3676 break; 3677 case 2502: 3678 //Activating a teleporter 2 3679 state++; statedelay = 5; 3680 3681 i = obj.getplayer(); 3682 obj.entities[i].colour = 0; 3683 obj.entities[i].invis = false; 3684 3685 obj.entities[i].xp = obj.entities[obj.getteleporter()].xp+44; 3686 obj.entities[i].yp = obj.entities[obj.getteleporter()].yp+44; 3687 obj.entities[i].ay = -6; 3688 obj.entities[i].ax = 6; 3689 obj.entities[i].vy = -6; 3690 obj.entities[i].vx = 6; 3691 3692 i = obj.getteleporter(); 3693 obj.entities[i].tile = 1; 3694 obj.entities[i].colour = 101; 3695 break; 3696 case 2503: 3697 state++; 3698 i = obj.getplayer(); 3699 obj.entities[i].xp += 10; 3700 break; 3701 case 2504: 3702 state++; 3703 i = obj.getplayer(); 3704 //obj.entities[i].xp += 10; 3705 break; 3706 case 2505: 3707 state++; 3708 i = obj.getplayer(); 3709 obj.entities[i].xp += 8; 3710 break; 3711 case 2506: 3712 state++; 3713 i = obj.getplayer(); 3714 obj.entities[i].xp += 6; 3715 break; 3716 case 2507: 3717 state++; 3718 i = obj.getplayer(); 3719 //obj.entities[i].xp += 4; 3720 break; 3721 case 2508: 3722 state++; 3723 i = obj.getplayer(); 3724 obj.entities[i].xp += 2; 3725 break; 3726 case 2509: 3727 state++; statedelay = 15; 3728 i = obj.getplayer(); 3729 obj.entities[i].xp += 1; 3730 break; 3731 case 2510: 3732 advancetext = true; hascontrol = false; 3733 dwgfx.createtextbox("Hello?", 125+24, 152-20, 164, 164, 255); 3734 state++; music.playef(11, 10); 3735 dwgfx.textboxactive(); 3736 break; 3737 case 2512: 3738 advancetext = true; hascontrol = false; 3739 dwgfx.createtextbox("Is anyone there?", 125+8, 152-24, 164, 164, 255); 3740 state++; music.playef(11, 10); 3741 dwgfx.textboxactive(); 3742 break; 3743 case 2514: 3744 dwgfx.textboxremove(); 3745 hascontrol = true; 3746 advancetext = false; 3747 3748 state = 0; 3749 music.play(3); 3750 break; 3751 3752 3753 case 3000: 3754 //Activating a teleporter (long version for level complete) 3755 state++; statedelay = 30; 3756 flashlight = 5; 3757 screenshake = 90; 3758 music.playef(9, 10); 3759 break; 3760 case 3001: 3761 //Activating a teleporter 2 3762 state++; statedelay = 15; 3763 flashlight = 5; 3764 music.playef(9, 10); 3765 break; 3766 case 3002: 3767 //Activating a teleporter 2 3768 state++; statedelay = 15; 3769 flashlight = 5; 3770 music.playef(9, 10); 3771 break; 3772 case 3003: 3773 //Activating a teleporter 2 3774 state++; statedelay = 15; 3775 flashlight = 5; 3776 music.playef(9, 10); 3777 break; 3778 case 3004: 3779 //Activating a teleporter 2 3780 state++; statedelay = 0; 3781 flashlight = 5; screenshake = 0; 3782 //we're done here! 3783 music.playef(10, 10); 3784 break; 3785 case 3005: 3786 //Activating a teleporter 2 3787 state++; statedelay = 50; 3788 //testing! 3789 //state = 3006; //Warp Zone 3790 //state = 3020; //Space Station 3791 switch(companion) { 3792 case 6: state = 3006; break; //Warp Zone 3793 case 7: state = 3020; break; //Space Station 3794 case 8: state = 3040; break; //Lab 3795 case 9: state = 3060; break; //Tower 3796 case 10: state = 3080; break; //Intermission 2 3797 case 11: state = 3085; break; //Intermission 1 3798 } 3799 3800 i = obj.getplayer(); 3801 obj.entities[i].colour = 0; 3802 obj.entities[i].invis = true; 3803 3804 i = obj.getcompanion(companion); 3805 if(i>-1){ 3806 obj.entities[i].active = false; 3807 } 3808 3809 i = obj.getteleporter(); 3810 obj.entities[i].tile = 1; 3811 obj.entities[i].colour = 100; 3812 break; 3813 3814 case 3006: 3815 //Level complete! (warp zone) 3816 unlocknum(4, map, dwgfx); 3817 lastsaved = 4; 3818 music.play(0); 3819 state++; statedelay = 75; 3820 3821 if (dwgfx.flipmode) { dwgfx.createtextbox("", -1, 180, 165, 165, 255); 3822 }else{ dwgfx.createtextbox("", -1, 12, 165, 165, 255); } 3823 //dwgfx.addline(" Level Complete! "); 3824 dwgfx.addline(" "); 3825 dwgfx.addline(""); 3826 dwgfx.addline(""); 3827 dwgfx.textboxcenterx(); 3828 3829/* advancetext = true; 3830 hascontrol = false; 3831 state = 3; 3832 dwgfx.createtextbox("To do: write quick", 50, 80, 164, 164, 255); 3833 dwgfx.addline("intro to story!");*/ 3834 break; 3835 case 3007: 3836 state++; statedelay = 45; 3837 3838 if (dwgfx.flipmode) { dwgfx.createtextbox("", -1, 104, 175,174,174); 3839 }else { dwgfx.createtextbox("", -1, 64+8+16, 175,174,174); } 3840 dwgfx.addline(" You have rescued "); 3841 dwgfx.addline(" a crew member! "); 3842 dwgfx.addline(""); 3843 dwgfx.textboxcenterx(); 3844 break; 3845 case 3008: 3846 state++; statedelay = 45; 3847 3848 temp = 6 - crewrescued(); 3849 if (temp == 1) { 3850 tempstring = " One remains "; 3851 if (dwgfx.flipmode) { dwgfx.createtextbox(tempstring, -1, 72, 174, 174, 174); 3852 }else { dwgfx.createtextbox(tempstring, -1, 128+16, 174, 174, 174); } 3853 }else if (temp > 0) { 3854 tempstring = " " + help.number(temp) + " remain "; 3855 if (dwgfx.flipmode) { dwgfx.createtextbox(tempstring, -1, 72, 174, 174, 174); 3856 }else { dwgfx.createtextbox(tempstring, -1, 128+16, 174, 174, 174); } 3857 }else { 3858 if (dwgfx.flipmode) { dwgfx.createtextbox(" All Crew Members Rescued! ", -1, 72, 174, 174, 174); 3859 }else { dwgfx.createtextbox(" All Crew Members Rescued! ", -1, 128+16, 174, 174, 174); } 3860 } 3861 dwgfx.textboxcenterx(); 3862 break; 3863 case 3009: 3864 state++; statedelay = 0; 3865 3866 if (dwgfx.flipmode) { dwgfx.createtextbox(" Tap screen to continue ", -1, 20, 164, 164, 255); 3867 }else { dwgfx.createtextbox(" Tap screen to continue ", -1, 196, 164, 164, 255); } 3868 dwgfx.textboxcenterx(); 3869 break; 3870 case 3010: 3871 if (jumppressed) { 3872 state++; statedelay = 30; 3873 dwgfx.textboxremove(); 3874 } 3875 break; 3876 case 3011: 3877 state = 3070; statedelay = 0; 3878 break; 3879 3880 case 3020: 3881 //Level complete! (Space Station 2) 3882 unlocknum(3, map, dwgfx); 3883 lastsaved = 2; 3884 music.play(0); 3885 state++; statedelay = 75; 3886 3887 3888 if (dwgfx.flipmode) { dwgfx.createtextbox("", -1, 180, 165, 165, 255); 3889 }else{ dwgfx.createtextbox("", -1, 12, 165, 165, 255); } 3890 //dwgfx.addline(" Level Complete! "); 3891 dwgfx.addline(" "); 3892 dwgfx.addline(""); 3893 dwgfx.addline(""); 3894 dwgfx.textboxcenterx(); 3895 3896/* advancetext = true; 3897 hascontrol = false; 3898 state = 3; 3899 dwgfx.createtextbox("To do: write quick", 50, 80, 164, 164, 255); 3900 dwgfx.addline("intro to story!");*/ 3901 break; 3902 case 3021: 3903 state++; statedelay = 45; 3904 3905 if (dwgfx.flipmode) { dwgfx.createtextbox("", -1, 104, 174,175,174); 3906 }else { dwgfx.createtextbox("", -1, 64+8+16, 174,175,174); } 3907 dwgfx.addline(" You have rescued "); 3908 dwgfx.addline(" a crew member! "); 3909 dwgfx.addline(""); 3910 dwgfx.textboxcenterx(); 3911 break; 3912 case 3022: 3913 state++; statedelay = 45; 3914 3915 temp = 6 - crewrescued(); 3916 if (temp == 1) { 3917 tempstring = " One remains "; 3918 if (dwgfx.flipmode) { dwgfx.createtextbox(tempstring, -1, 72, 174, 174, 174); 3919 }else { dwgfx.createtextbox(tempstring, -1, 128+16, 174, 174, 174); } 3920 }else if (temp > 0) { 3921 tempstring = " " + help.number(temp) + " remain "; 3922 if (dwgfx.flipmode) { dwgfx.createtextbox(tempstring, -1, 72, 174, 174, 174); 3923 }else { dwgfx.createtextbox(tempstring, -1, 128+16, 174, 174, 174); } 3924 }else { 3925 if (dwgfx.flipmode) { dwgfx.createtextbox(" All Crew Members Rescued! ", -1, 72, 174, 174, 174); 3926 }else { dwgfx.createtextbox(" All Crew Members Rescued! ", -1, 128+16, 174, 174, 174); } 3927 } 3928 dwgfx.textboxcenterx(); 3929 break; 3930 case 3023: 3931 state++; statedelay = 0; 3932 3933 if (dwgfx.flipmode) { dwgfx.createtextbox(" Tap screen to continue ", -1, 20, 164, 164, 255); 3934 }else { dwgfx.createtextbox(" Tap screen to continue ", -1, 196, 164, 164, 255); } 3935 dwgfx.textboxcenterx(); 3936 break; 3937 case 3024: 3938 if (jumppressed) { 3939 state++; statedelay = 30; 3940 dwgfx.textboxremove(); 3941 } 3942 break; 3943 case 3025: 3944 state = 3070; statedelay = 0; 3945 break; 3946 3947 case 3040: 3948 //Level complete! (Lab) 3949 unlocknum(1, map, dwgfx); 3950 lastsaved = 5; 3951 music.play(0); 3952 state++; statedelay = 75; 3953 3954 if (dwgfx.flipmode) { dwgfx.createtextbox("", -1, 180, 165, 165, 255); 3955 }else{ dwgfx.createtextbox("", -1, 12, 165, 165, 255); } 3956 //dwgfx.addline(" Level Complete! "); 3957 dwgfx.addline(" "); 3958 dwgfx.addline(""); 3959 dwgfx.addline(""); 3960 dwgfx.textboxcenterx(); 3961 3962/* advancetext = true; 3963 hascontrol = false; 3964 state = 3; 3965 dwgfx.createtextbox("To do: write quick", 50, 80, 164, 164, 255); 3966 dwgfx.addline("intro to story!");*/ 3967 break; 3968 case 3041: 3969 state++; statedelay = 45; 3970 3971 if (dwgfx.flipmode) { dwgfx.createtextbox("", -1, 104, 174,174,175); 3972 }else { dwgfx.createtextbox("", -1, 64+8+16, 174,174,175); } 3973 dwgfx.addline(" You have rescued "); 3974 dwgfx.addline(" a crew member! "); 3975 dwgfx.addline(""); 3976 dwgfx.textboxcenterx(); 3977 break; 3978 case 3042: 3979 state++; statedelay = 45; 3980 3981 temp = 6 - crewrescued(); 3982 if (temp == 1) { 3983 tempstring = " One remains "; 3984 if (dwgfx.flipmode) { dwgfx.createtextbox(tempstring, -1, 72, 174, 174, 174); 3985 }else { dwgfx.createtextbox(tempstring, -1, 128+16, 174, 174, 174); } 3986 }else if (temp > 0) { 3987 tempstring = " " + help.number(temp) + " remain "; 3988 if (dwgfx.flipmode) { dwgfx.createtextbox(tempstring, -1, 72, 174, 174, 174); 3989 }else { dwgfx.createtextbox(tempstring, -1, 128+16, 174, 174, 174); } 3990 }else { 3991 if (dwgfx.flipmode) { dwgfx.createtextbox(" All Crew Members Rescued! ", -1, 72, 174, 174, 174); 3992 }else { dwgfx.createtextbox(" All Crew Members Rescued! ", -1, 128+16, 174, 174, 174); } 3993 } 3994 dwgfx.textboxcenterx(); 3995 break; 3996 case 3043: 3997 state++; statedelay = 0; 3998 3999 if (dwgfx.flipmode) { dwgfx.createtextbox(" Tap screen to continue ", -1, 20, 164, 164, 255); 4000 }else { dwgfx.createtextbox(" Tap screen to continue ", -1, 196, 164, 164, 255); } 4001 dwgfx.textboxcenterx(); 4002 break; 4003 case 3044: 4004 if (jumppressed) { 4005 state++; statedelay = 30; 4006 dwgfx.textboxremove(); 4007 } 4008 break; 4009 case 3045: 4010 state = 3070; statedelay = 0; 4011 break; 4012 4013 case 3050: 4014 //Level complete! (Space Station 1) 4015 unlocknum(0, map, dwgfx); 4016 lastsaved = 1; 4017 music.play(0); 4018 state++; statedelay = 75; 4019 4020 4021 if (dwgfx.flipmode) { dwgfx.createtextbox("", -1, 180, 165, 165, 255); 4022 }else{ dwgfx.createtextbox("", -1, 12, 165, 165, 255); } 4023 //dwgfx.addline(" Level Complete! "); 4024 dwgfx.addline(" "); 4025 dwgfx.addline(""); 4026 dwgfx.addline(""); 4027 dwgfx.textboxcenterx(); 4028 4029/* advancetext = true; 4030 hascontrol = false; 4031 state = 3; 4032 dwgfx.createtextbox("To do: write quick", 50, 80, 164, 164, 255); 4033 dwgfx.addline("intro to story!");*/ 4034 break; 4035 case 3051: 4036 state++; statedelay = 45; 4037 4038 if (dwgfx.flipmode) { dwgfx.createtextbox("", -1, 104, 175,175,174); 4039 }else { dwgfx.createtextbox("", -1, 64+8+16, 175,175,174); } 4040 dwgfx.addline(" You have rescued "); 4041 dwgfx.addline(" a crew member! "); 4042 dwgfx.addline(""); 4043 dwgfx.textboxcenterx(); 4044 break; 4045 case 3052: 4046 state++; statedelay = 45; 4047 4048 temp = 6 - crewrescued(); 4049 if (temp == 1) { 4050 tempstring = " One remains "; 4051 if (dwgfx.flipmode) { dwgfx.createtextbox(tempstring, -1, 72, 174, 174, 174); 4052 }else { dwgfx.createtextbox(tempstring, -1, 128+16, 174, 174, 174); } 4053 }else if (temp > 0) { 4054 tempstring = " " + help.number(temp) + " remain "; 4055 if (dwgfx.flipmode) { dwgfx.createtextbox(tempstring, -1, 72, 174, 174, 174); 4056 }else { dwgfx.createtextbox(tempstring, -1, 128+16, 174, 174, 174); } 4057 }else { 4058 if (dwgfx.flipmode) { dwgfx.createtextbox(" All Crew Members Rescued! ", -1, 72, 174, 174, 174); 4059 }else { dwgfx.createtextbox(" All Crew Members Rescued! ", -1, 128+16, 174, 174, 174); } 4060 } 4061 dwgfx.textboxcenterx(); 4062 break; 4063 case 3053: 4064 state++; statedelay = 0; 4065 4066 if (dwgfx.flipmode) { dwgfx.createtextbox(" Tap screen to continue ", -1, 20, 164, 164, 255); 4067 }else { dwgfx.createtextbox(" Tap screen to continue ", -1, 196, 164, 164, 255); } 4068 dwgfx.textboxcenterx(); 4069 break; 4070 case 3054: 4071 if (jumppressed) { 4072 state++; statedelay = 30; 4073 dwgfx.textboxremove(); 4074 crewstats[1] = 0; //Set violet's rescue script to 0 to make the next bit easier 4075 teleportscript = ""; 4076 } 4077 break; 4078 case 3055: 4079 dwgfx.fademode = 2; 4080 state++; statedelay = 10; 4081 break; 4082 case 3056: 4083 if(dwgfx.fademode==1){ 4084 startscript = true; 4085 if (nocutscenes) { 4086 newscript="bigopenworldskip"; 4087 }else{ 4088 newscript = "bigopenworld"; 4089 } 4090 state = 0; 4091 } 4092 break; 4093 4094 4095 case 3060: 4096 //Level complete! (Tower) 4097 unlocknum(2, map, dwgfx); 4098 lastsaved = 3; 4099 music.play(0); 4100 state++; statedelay = 75; 4101 4102 if (dwgfx.flipmode) { dwgfx.createtextbox("", -1, 180, 165, 165, 255); 4103 }else{ dwgfx.createtextbox("", -1, 12, 165, 165, 255); } 4104 //dwgfx.addline(" Level Complete! "); 4105 dwgfx.addline(" "); 4106 dwgfx.addline(""); 4107 dwgfx.addline(""); 4108 dwgfx.textboxcenterx(); 4109 4110/* advancetext = true; 4111 hascontrol = false; 4112 state = 3; 4113 dwgfx.createtextbox("To do: write quick", 50, 80, 164, 164, 255); 4114 dwgfx.addline("intro to story!");*/ 4115 break; 4116 case 3061: 4117 state++; statedelay = 45; 4118 4119 if (dwgfx.flipmode) { dwgfx.createtextbox("", -1, 104, 175,174,175); 4120 }else { dwgfx.createtextbox("", -1, 64+8+16, 175,174,175); } 4121 dwgfx.addline(" You have rescued "); 4122 dwgfx.addline(" a crew member! "); 4123 dwgfx.addline(""); 4124 dwgfx.textboxcenterx(); 4125 break; 4126 case 3062: 4127 state++; statedelay = 45; 4128 4129 temp = 6 - crewrescued(); 4130 if (temp == 1) { 4131 tempstring = " One remains "; 4132 if (dwgfx.flipmode) { dwgfx.createtextbox(tempstring, -1, 72, 174, 174, 174); 4133 }else { dwgfx.createtextbox(tempstring, -1, 128+16, 174, 174, 174); } 4134 }else if (temp > 0) { 4135 tempstring = " " + help.number(temp) + " remain "; 4136 if (dwgfx.flipmode) { dwgfx.createtextbox(tempstring, -1, 72, 174, 174, 174); 4137 }else { dwgfx.createtextbox(tempstring, -1, 128+16, 174, 174, 174); } 4138 }else { 4139 if (dwgfx.flipmode) { dwgfx.createtextbox(" All Crew Members Rescued! ", -1, 72, 174, 174, 174); 4140 }else { dwgfx.createtextbox(" All Crew Members Rescued! ", -1, 128+16, 174, 174, 174); } 4141 } 4142 dwgfx.textboxcenterx(); 4143 break; 4144 case 3063: 4145 state++; statedelay = 0; 4146 4147 if (dwgfx.flipmode) { dwgfx.createtextbox(" Tap screen to continue ", -1, 20, 164, 164, 255); 4148 }else { dwgfx.createtextbox(" Tap screen to continue ", -1, 196, 164, 164, 255); } 4149 dwgfx.textboxcenterx(); 4150 break; 4151 case 3064: 4152 if (jumppressed) { 4153 state++; statedelay = 30; 4154 dwgfx.textboxremove(); 4155 } 4156 break; 4157 case 3065: 4158 state = 3070; statedelay = 0; 4159 break; 4160 4161 4162 case 3070: 4163 dwgfx.fademode = 2; 4164 state++; 4165 break; 4166 case 3071: 4167 if (dwgfx.fademode == 1) state++; 4168 break; 4169 case 3072: 4170 //Ok, we need to adjust some flags based on who've we've rescued. Some of there conversation options 4171 //change depending on when they get back to the ship. 4172 if (lastsaved == 2) { 4173 if (crewstats[3]) obj.flags[25] = 1; 4174 if (crewstats[4]) obj.flags[26] = 1; 4175 if (crewstats[5]) obj.flags[24] = 1; 4176 }else if (lastsaved == 3) { 4177 if (crewstats[2]) obj.flags[50] = 1; 4178 if (crewstats[4]) obj.flags[49] = 1; 4179 if (crewstats[5]) obj.flags[48] = 1; 4180 }else if (lastsaved == 4) { 4181 if (crewstats[2]) obj.flags[54] = 1; 4182 if (crewstats[3]) obj.flags[55] = 1; 4183 if (crewstats[5]) obj.flags[56] = 1; 4184 }else if (lastsaved == 5) { 4185 if (crewstats[2]) obj.flags[37] = 1; 4186 if (crewstats[3]) obj.flags[38] = 1; 4187 if (crewstats[4]) obj.flags[39] = 1; 4188 } 4189 //We're pitch black now, make a decision 4190 companion = 0; 4191 if (crewrescued() == 6) { 4192 startscript = true; newscript="startlevel_final"; 4193 state = 0; 4194 }else if (crewrescued() == 4) { 4195 companion = 11; 4196 supercrewmate = true; 4197 scmprogress = 0; 4198 4199 startscript = true; newscript = "intermission_1"; 4200 obj.flags[19] = 1; 4201 if (lastsaved == 2) obj.flags[32] = 1; 4202 if (lastsaved == 3) obj.flags[35] = 1; 4203 if (lastsaved == 4) obj.flags[34] = 1; 4204 if (lastsaved == 5) obj.flags[33] = 1; 4205 state = 0; 4206 }else if (crewrescued() == 5) { 4207 startscript = true; newscript = "intermission_2"; 4208 obj.flags[20] = 1; 4209 if (lastsaved == 2) obj.flags[32] = 1; 4210 if (lastsaved == 3) obj.flags[35] = 1; 4211 if (lastsaved == 4) obj.flags[34] = 1; 4212 if (lastsaved == 5) obj.flags[33] = 1; 4213 state = 0; 4214 }else { 4215 startscript = true; newscript="regularreturn"; 4216 state = 0; 4217 } 4218 break; 4219 4220 case 3080: 4221 //returning from an intermission, very like 3070 4222 if (inintermission) { 4223 dwgfx.fademode = 2; 4224 companion = 0; 4225 state=3100; 4226 }else{ 4227 unlocknum(7, map, dwgfx); 4228 dwgfx.fademode = 2; 4229 companion = 0; 4230 state++; 4231 } 4232 break; 4233 case 3081: 4234 if (dwgfx.fademode == 1) state++; 4235 break; 4236 case 3082: 4237 map.finalmode = false; 4238 startscript = true; newscript="regularreturn"; 4239 state = 0; 4240 break; 4241 4242 case 3085: 4243 //returning from an intermission, very like 3070 4244 //return to menu from here 4245 if (inintermission) { 4246 companion = 0; 4247 supercrewmate = false; 4248 state++; 4249 dwgfx.fademode = 2; music.fadeout(); 4250 state=3100; 4251 }else{ 4252 unlocknum(6, map, dwgfx); 4253 dwgfx.fademode = 2; 4254 companion = 0; 4255 supercrewmate = false; 4256 state++; 4257 } 4258 break; 4259 case 3086: 4260 if (dwgfx.fademode == 1) state++; 4261 break; 4262 case 3087: 4263 map.finalmode = false; 4264 startscript = true; newscript="regularreturn"; 4265 state = 0; 4266 break; 4267 4268 case 3100: 4269 if(dwgfx.fademode == 1) state++; 4270 break; 4271 case 3101: 4272 dwgfx.flipmode = false; 4273 gamestate = 1; dwgfx.fademode = 4; 4274 dwgfx.backgrounddrawn = true; map.tdrawback = true; 4275 createmenu("play"); 4276 music.play(6); 4277 state = 0; 4278 break; 4279 4280 //startscript = true; newscript="returntohub"; 4281 //state = 0; 4282 4283 /*case 3025: 4284 if (recording == 1) { 4285 //if recording the input, output it to debug here 4286 trace(recordstring); 4287 help.toclipboard(recordstring); 4288 } 4289 test = true; teststring = recordstring; 4290 dwgfx.createtextbox(" Congratulations! ", 50, 80, 164, 164, 255); 4291 dwgfx.addline(""); 4292 dwgfx.addline("Your play of this level has"); 4293 dwgfx.addline("been copied to the clipboard."); 4294 dwgfx.addline(""); 4295 dwgfx.addline("Please consider pasting and"); 4296 dwgfx.addline("sending it to me! Even if you"); 4297 dwgfx.addline("made a lot of mistakes - knowing"); 4298 dwgfx.addline("exactly where people are having"); 4299 dwgfx.addline("trouble is extremely useful!"); 4300 dwgfx.textboxcenter(); 4301 state = 0; 4302 break;*/ 4303 4304 case 3500: 4305 music.fadeout(); 4306 state++; statedelay = 120; 4307 //state = 3511; //testing 4308 break; 4309 case 3501: 4310 //Game complete! 4311 scores.reportAchievement(scores.vvvvvvgamecomplete); 4312 unlocknum(5, map, dwgfx); 4313 crewstats[0] = true; 4314 state++; statedelay = 75; 4315 music.play(7); 4316 4317 if (dwgfx.flipmode) { dwgfx.createtextbox("", -1, 180, 164, 165, 255); 4318 }else{ dwgfx.createtextbox("", -1, 12, 164, 165, 255); } 4319 dwgfx.addline(" "); 4320 dwgfx.addline(""); 4321 dwgfx.addline(""); 4322 dwgfx.textboxcenterx(); 4323 break; 4324 case 3502: 4325 state++; statedelay = 45+15; 4326 4327 if (dwgfx.flipmode) { dwgfx.createtextbox(" All Crew Members Rescued! ", -1, 175-24, 0, 0, 0); 4328 }else{ dwgfx.createtextbox(" All Crew Members Rescued! ", -1, 64, 0, 0, 0);} 4329 savetime = timestring(help); 4330 break; 4331 case 3503: 4332 state++; statedelay = 45; 4333 4334 tempstring = help.number(trinkets); 4335 if (dwgfx.flipmode) { 4336 dwgfx.createtextbox("Trinkets Found:", 48, 155-24, 0,0,0); 4337 dwgfx.createtextbox(tempstring, 180, 155-24, 0, 0, 0); 4338 }else{ 4339 dwgfx.createtextbox("Trinkets Found:", 48, 84, 0,0,0); 4340 dwgfx.createtextbox(tempstring, 180, 84, 0, 0, 0); 4341 } 4342 break; 4343 case 3504: 4344 state++; statedelay = 45+15; 4345 4346 tempstring = String(savetime); 4347 if (dwgfx.flipmode) { 4348 dwgfx.createtextbox(" Game Time:", 64, 143-24, 0,0,0); 4349 dwgfx.createtextbox(tempstring, 180, 143-24, 0, 0, 0); 4350 }else{ 4351 dwgfx.createtextbox(" Game Time:", 64, 96, 0,0,0); 4352 dwgfx.createtextbox(tempstring, 180, 96, 0, 0, 0); 4353 } 4354 break; 4355 case 3505: 4356 state++; statedelay = 45; 4357 4358 if (dwgfx.flipmode) { 4359 dwgfx.createtextbox(" Total Flips:", 64, 116-24, 0,0,0); 4360 dwgfx.createtextbox(String(totalflips), 180, 116-24, 0, 0, 0); 4361 }else{ 4362 dwgfx.createtextbox(" Total Flips:", 64, 123, 0,0,0); 4363 dwgfx.createtextbox(String(totalflips), 180, 123, 0, 0, 0); 4364 } 4365 break; 4366 case 3506: 4367 state++; statedelay = 45+15; 4368 4369 if (dwgfx.flipmode) { 4370 dwgfx.createtextbox("Total Deaths:", 64, 104-24, 0,0,0); 4371 dwgfx.createtextbox(String(deathcounts), 180, 104-24, 0, 0, 0); 4372 }else{ 4373 dwgfx.createtextbox("Total Deaths:", 64, 135, 0,0,0); 4374 dwgfx.createtextbox(String(deathcounts), 180, 135, 0, 0, 0); 4375 } 4376 break; 4377 case 3507: 4378 state++; statedelay = 45+15; 4379 4380 if (dwgfx.flipmode) { 4381 tempstring = "Hardest Room (with " + String(hardestroomdeaths) + " deaths)"; 4382 dwgfx.createtextbox(tempstring, -1, 81-24, 0,0,0); 4383 dwgfx.createtextbox(hardestroom, -1, 69-24, 0, 0, 0); 4384 }else{ 4385 tempstring = "Hardest Room (with " + String(hardestroomdeaths) + " deaths)"; 4386 dwgfx.createtextbox(tempstring, -1, 158, 0,0,0); 4387 dwgfx.createtextbox(hardestroom, -1, 170, 0, 0, 0); 4388 } 4389 break; 4390 case 3508: 4391 state++; statedelay = 0; 4392 4393 if (dwgfx.flipmode) { 4394 dwgfx.createtextbox(" Tap screen to continue ", -1, 20, 164, 164, 255); 4395 }else{ 4396 dwgfx.createtextbox(" Tap screen to continue ", -1, 196, 164, 164, 255); 4397 } 4398 dwgfx.textboxcenterx(); 4399 break; 4400 case 3509: 4401 if (jumppressed) { 4402 state++; statedelay = 30; 4403 dwgfx.textboxremove(); 4404 } 4405 break; 4406 case 3510: 4407 //Save stats and stuff here 4408 if (obj.flags[73] == 0) { 4409 //flip mode complete 4410 scores.reportAchievement(scores.vvvvvvgamecompleteflip); 4411 unlock[19] = true; 4412 } 4413 4414 if (bestgamedeaths == -1) { 4415 bestgamedeaths = deathcounts; 4416 }else { 4417 if (deathcounts < bestgamedeaths) { 4418 bestgamedeaths = deathcounts; 4419 } 4420 } 4421 4422 if (bestgamedeaths > -1) { 4423 if (bestgamedeaths <= 500) { 4424 scores.reportAchievement(scores.vvvvvvcomplete500); 4425 } 4426 if (bestgamedeaths <= 250) { 4427 scores.reportAchievement(scores.vvvvvvcomplete250); 4428 } 4429 if (bestgamedeaths <= 100) { 4430 scores.reportAchievement(scores.vvvvvvcomplete100); 4431 } 4432 if (bestgamedeaths <= 50) { 4433 scores.reportAchievement(scores.vvvvvvcomplete50); 4434 } 4435 } 4436 4437 savestats(map, dwgfx); 4438 if (nodeathmode) { 4439 scores.reportAchievement(scores.vvvvvvmaster); //bloody hell 4440 unlock[20] = true; 4441 state = 3520; statedelay = 0; 4442 }else{ 4443 statedelay = 120; 4444 state++; 4445 } 4446 break; 4447 case 3511: 4448 //Activating a teleporter (long version for level complete) 4449 i = obj.getplayer(); obj.entities[i].colour = 102; 4450 4451 obj.flags[67] = 1; 4452 4453 state++; statedelay = 30; 4454 flashlight = 5; 4455 screenshake = 90; 4456 music.playef(9, 10); 4457 break; 4458 case 3512: 4459 //Activating a teleporter 2 4460 state++; statedelay = 15; 4461 flashlight = 5; 4462 music.playef(9, 10); 4463 break; 4464 case 3513: 4465 //Activating a teleporter 2 4466 state++; statedelay = 15; 4467 flashlight = 5; 4468 music.playef(9, 10); 4469 break; 4470 case 3514: 4471 //Activating a teleporter 2 4472 state++; statedelay = 15; 4473 flashlight = 5; 4474 music.playef(9, 10); 4475 break; 4476 case 3515: 4477 //Activating a teleporter 2 4478 state++; statedelay = 0; 4479 flashlight = 5; screenshake = 0; 4480 4481 i = obj.getplayer(); obj.entities[i].colour = 0; 4482 obj.entities[i].invis = true; 4483 4484 //we're done here! 4485 music.playef(10, 10); 4486 statedelay = 60; 4487 break; 4488 case 3516: 4489 dwgfx.fademode = 2; 4490 state++; 4491 break; 4492 case 3517: 4493 if (dwgfx.fademode == 1) { 4494 state++; statedelay = 30; 4495 } 4496 break; 4497 case 3518: 4498 dwgfx.fademode = 4; 4499 state = 0; statedelay = 30; 4500 //music.play(5); 4501 //music.play(10); 4502 4503 map.finalmode = false; 4504 map.final_colormode = false; map.final_mapcol = 0; map.final_colorframe = 0; 4505 map.finalstretch = false; 4506 map.finalx = 100; map.finaly = 100; 4507 4508 dwgfx.cutscenebarspos = 320; 4509 4510 teleport_to_new_area = true; 4511 teleportscript = "gamecomplete"; 4512 break; 4513 4514 case 3520: 4515 //NO DEATH MODE COMPLETE JESUS 4516 hascontrol = false; 4517 crewstats[0] = true; 4518 4519 dwgfx.fademode = 2; 4520 state++; 4521 break; 4522 case 3521: 4523 if(dwgfx.fademode == 1) state++; 4524 break; 4525 case 3522: 4526 dwgfx.flipmode = false; 4527 gamestate = 1; dwgfx.fademode = 4; 4528 dwgfx.backgrounddrawn = true; map.tdrawback = true; 4529 createmenu("nodeathmodecomplete"); 4530 state = 0; 4531 break; 4532 4533 case 4000: 4534 //Activating a teleporter (short version) 4535 state++; statedelay = 10; 4536 flashlight = 5; 4537 screenshake = 10; 4538 music.playef(9, 10); 4539 break; 4540 case 4001: 4541 //Activating a teleporter 2 4542 state++; statedelay = 0; 4543 flashlight = 5; screenshake = 0; 4544 //we're done here! 4545 music.playef(10, 10); 4546 break; 4547 case 4002: 4548 //Activating a teleporter 2 4549 state++; statedelay = 10; 4550 //testing! 4551 //state = 3006; //Warp Zone 4552 //state = 3020; //Space Station 4553 //state = 3040; //Lab 4554 4555 i = obj.getplayer(); 4556 obj.entities[i].colour = 0; 4557 obj.entities[i].invis = true; 4558 4559 i = obj.getteleporter(); 4560 if(i>-1){ 4561 obj.entities[i].tile = 1; 4562 obj.entities[i].colour = 100; 4563 } 4564 break; 4565 case 4003: 4566 state = 0; statedelay = 0; 4567 teleport_to_new_area = true; 4568 break; 4569 4570 case 4010: 4571 //Activating a teleporter (default appear) 4572 state++; statedelay = 15; 4573 flashlight = 5; screenshake = 90; 4574 music.playef(9, 10); 4575 break; 4576 case 4011: 4577 //Activating a teleporter 2 4578 state++; statedelay = 0; flashlight = 5; screenshake = 0; music.playef(10, 10); 4579 break; 4580 case 4012: 4581 //Activating a teleporter 2 4582 state++; statedelay = 5; 4583 4584 i = obj.getplayer(); j = obj.getteleporter(); 4585 if (j != -1) { 4586 obj.entities[i].xp = obj.entities[j].xp+44; 4587 obj.entities[i].yp = obj.entities[j].yp+44; 4588 obj.entities[j].tile = 2; obj.entities[j].colour = 101; 4589 } 4590 obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 1; 4591 4592 obj.entities[i].ay = -6; obj.entities[i].ax = 6; 4593 obj.entities[i].vy = -6; obj.entities[i].vx = 6; 4594 break; 4595 case 4013: state++; i = obj.getplayer(); obj.entities[i].xp += 10; break; 4596 case 4014: state++; i = obj.getplayer(); obj.entities[i].xp += 10; break; 4597 case 4015: state++; i = obj.getplayer(); obj.entities[i].xp += 8; break; 4598 case 4016: state++; i = obj.getplayer(); obj.entities[i].xp += 6; break; 4599 case 4017: state++; i = obj.getplayer(); obj.entities[i].xp += 3; break; 4600 case 4018: state++; statedelay = 15; i = obj.getplayer(); obj.entities[i].xp += 1; break; 4601 case 4019: 4602 if (intimetrial || nodeathmode || inintermission) { 4603 }else{ 4604 savetele(map, obj, music, help); 4605 } 4606 i = obj.getteleporter(); 4607 activetele = true; 4608 teleblock.x = obj.entities[i].xp - 32; teleblock.y = obj.entities[i].yp - 32; 4609 teleblock.width = 160; teleblock.height = 160; 4610 hascontrol = true; advancetext = false; state = 0; 4611 break; 4612 4613 case 4020: 4614 //Activating a teleporter (default appear) 4615 state++; statedelay = 15; 4616 flashlight = 5; screenshake = 90; 4617 music.playef(9, 10); 4618 break; 4619 case 4021: 4620 //Activating a teleporter 2 4621 state++; statedelay = 0; flashlight = 5; screenshake = 0; music.playef(10, 10); 4622 break; 4623 case 4022: 4624 //Activating a teleporter 2 4625 state++; statedelay = 5; 4626 4627 i = obj.getplayer(); j = obj.getteleporter(); 4628 if (j != -1) { 4629 obj.entities[i].xp = obj.entities[j].xp+44; 4630 obj.entities[i].yp = obj.entities[j].yp+44; 4631 obj.entities[j].tile = 2; obj.entities[j].colour = 101; 4632 } 4633 obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 1; 4634 4635 obj.entities[i].ay = -6; obj.entities[i].ax = 6; 4636 obj.entities[i].vy = -6; obj.entities[i].vx = 6; 4637 break; 4638 case 4023: state++; i = obj.getplayer(); obj.entities[i].xp += 12; break; 4639 case 4024: state++; i = obj.getplayer(); obj.entities[i].xp += 12; break; 4640 case 4025: state++; i = obj.getplayer(); obj.entities[i].xp += 10; break; 4641 case 4026: state++; i = obj.getplayer(); obj.entities[i].xp += 8; break; 4642 case 4027: state++; i = obj.getplayer(); obj.entities[i].xp += 5; break; 4643 case 4028: state++; statedelay = 15; i = obj.getplayer(); obj.entities[i].xp += 2; break; 4644 case 4029: hascontrol = true; advancetext = false; state = 0; break; 4645 4646 case 4030: 4647 //Activating a teleporter (default appear) 4648 state++; statedelay = 15; 4649 flashlight = 5; screenshake = 90; 4650 music.playef(9, 10); 4651 break; 4652 case 4031: 4653 //Activating a teleporter 2 4654 state++; statedelay = 0; flashlight = 5; screenshake = 0; music.playef(10, 10); 4655 break; 4656 case 4032: 4657 //Activating a teleporter 2 4658 state++; statedelay = 5; 4659 4660 i = obj.getplayer(); j = obj.getteleporter(); 4661 if (j != -1) { 4662 obj.entities[i].xp = obj.entities[j].xp+44; 4663 obj.entities[i].yp = obj.entities[j].yp+44; 4664 obj.entities[j].tile = 2; obj.entities[j].colour = 101; 4665 } 4666 obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 0; 4667 4668 obj.entities[i].ay = -6; obj.entities[i].ax = -6; 4669 obj.entities[i].vy = -6; obj.entities[i].vx = -6; 4670 break; 4671 case 4033: state++; i = obj.getplayer(); obj.entities[i].xp -= 12; break; 4672 case 4034: state++; i = obj.getplayer(); obj.entities[i].xp -= 12; break; 4673 case 4035: state++; i = obj.getplayer(); obj.entities[i].xp -= 10; break; 4674 case 4036: state++; i = obj.getplayer(); obj.entities[i].xp -= 8; break; 4675 case 4037: state++; i = obj.getplayer(); obj.entities[i].xp -= 5; break; 4676 case 4038: state++; statedelay = 15; i = obj.getplayer(); obj.entities[i].xp -= 2; break; 4677 case 4039: hascontrol = true; advancetext = false; state = 0; break; 4678 4679 case 4040: 4680 //Activating a teleporter (default appear) 4681 state++; statedelay = 15; 4682 flashlight = 5; screenshake = 90; 4683 music.playef(9, 10); 4684 break; 4685 case 4041: 4686 //Activating a teleporter 2 4687 state++; statedelay = 0; flashlight = 5; screenshake = 0; music.playef(10, 10); 4688 break; 4689 case 4042: 4690 //Activating a teleporter 2 4691 state++; statedelay = 5; 4692 4693 i = obj.getplayer(); j = obj.getteleporter(); 4694 if (j != -1) { 4695 obj.entities[i].xp = obj.entities[j].xp+44; 4696 obj.entities[i].yp = obj.entities[j].yp+44; 4697 obj.entities[j].tile = 2; obj.entities[j].colour = 101; 4698 } 4699 obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 1; 4700 4701 obj.entities[i].ay = -6; obj.entities[i].ax = 6; 4702 obj.entities[i].vy = -6; obj.entities[i].vx = 6; 4703 break; 4704 case 4043: state++; i = obj.getplayer(); obj.entities[i].xp += 12; obj.entities[i].yp -= 15; break; 4705 case 4044: state++; i = obj.getplayer(); obj.entities[i].xp += 12; obj.entities[i].yp -= 10; break; 4706 case 4045: state++; i = obj.getplayer(); obj.entities[i].xp += 12; obj.entities[i].yp -= 10; break; 4707 case 4046: state++; i = obj.getplayer(); obj.entities[i].xp += 8; obj.entities[i].yp -= 8; break; 4708 case 4047: state++; i = obj.getplayer(); obj.entities[i].xp += 6; obj.entities[i].yp -= 8; break; 4709 case 4048: state++; statedelay = 15; i = obj.getplayer(); obj.entities[i].xp += 3; break; 4710 case 4049: hascontrol = true; advancetext = false; state = 0; break; 4711 4712 case 4050: 4713 //Activating a teleporter (default appear) 4714 state++; statedelay = 15; 4715 flashlight = 5; screenshake = 90; 4716 music.playef(9, 10); 4717 break; 4718 case 4051: 4719 //Activating a teleporter 2 4720 state++; statedelay = 0; flashlight = 5; screenshake = 0; music.playef(10, 10); 4721 break; 4722 case 4052: 4723 //Activating a teleporter 2 4724 state++; statedelay = 5; 4725 4726 i = obj.getplayer(); j = obj.getteleporter(); 4727 if (j != -1) { 4728 obj.entities[i].xp = obj.entities[j].xp+44; 4729 obj.entities[i].yp = obj.entities[j].yp+44; 4730 obj.entities[j].tile = 2; obj.entities[j].colour = 101; 4731 } 4732 obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 1; 4733 4734 obj.entities[i].ay = -6; obj.entities[i].ax = 6; 4735 obj.entities[i].vy = -6; obj.entities[i].vx = 6; 4736 break; 4737 case 4053: state++; i = obj.getplayer(); obj.entities[i].xp += 4; obj.entities[i].yp -= 15; break; 4738 case 4054: state++; i = obj.getplayer(); obj.entities[i].xp += 4; obj.entities[i].yp -= 10; break; 4739 case 4055: state++; i = obj.getplayer(); obj.entities[i].xp += 4; obj.entities[i].yp -= 10; break; 4740 case 4056: state++; i = obj.getplayer(); obj.entities[i].xp += 4; obj.entities[i].yp -= 8; break; 4741 case 4057: state++; i = obj.getplayer(); obj.entities[i].xp += 2; obj.entities[i].yp -= 8; break; 4742 case 4058: state++; statedelay = 15; i = obj.getplayer(); obj.entities[i].xp += 1; break; 4743 case 4059: hascontrol = true; advancetext = false; state = 0; break; 4744 4745 case 4060: 4746 //Activating a teleporter (default appear) 4747 state++; statedelay = 15; 4748 flashlight = 5; screenshake = 90; 4749 music.playef(9, 10); 4750 break; 4751 case 4061: 4752 //Activating a teleporter 2 4753 state++; statedelay = 0; flashlight = 5; screenshake = 0; music.playef(10, 10); 4754 break; 4755 case 4062: 4756 //Activating a teleporter 2 4757 state++; statedelay = 5; 4758 4759 i = obj.getplayer(); j = obj.getteleporter(); 4760 if (j != -1) { 4761 obj.entities[i].xp = obj.entities[j].xp+44; 4762 obj.entities[i].yp = obj.entities[j].yp+44; 4763 obj.entities[j].tile = 2; obj.entities[j].colour = 101; 4764 } 4765 obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 0; 4766 4767 obj.entities[i].ay = -6; obj.entities[i].ax = -6; 4768 obj.entities[i].vy = -6; obj.entities[i].vx = -6; 4769 break; 4770 case 4063: state++; i = obj.getplayer(); obj.entities[i].xp -= 28; obj.entities[i].yp -= 8; break; 4771 case 4064: state++; i = obj.getplayer(); obj.entities[i].xp -= 28; obj.entities[i].yp -= 8; break; 4772 case 4065: state++; i = obj.getplayer(); obj.entities[i].xp -= 25; break; 4773 case 4066: state++; i = obj.getplayer(); obj.entities[i].xp -= 25; break; 4774 case 4067: state++; i = obj.getplayer(); obj.entities[i].xp -= 20; break; 4775 case 4068: state++; statedelay = 15; i = obj.getplayer(); obj.entities[i].xp -= 16; break; 4776 case 4069: hascontrol = true; advancetext = false; state = 0; break; 4777 4778 4779 case 4070: 4780 //Activating a teleporter (special for final script, player has colour changed to match rescued crewmate) 4781 state++; statedelay = 15; 4782 flashlight = 5; screenshake = 90; 4783 music.playef(9, 10); 4784 break; 4785 case 4071: 4786 //Activating a teleporter 2 4787 state++; statedelay = 0; flashlight = 5; screenshake = 0; music.playef(10, 10); 4788 break; 4789 case 4072: 4790 //Activating a teleporter 2 4791 state++; statedelay = 5; 4792 4793 i = obj.getplayer(); j = obj.getteleporter(); 4794 if (j != -1) { 4795 obj.entities[i].xp = obj.entities[j].xp+44; 4796 obj.entities[i].yp = obj.entities[j].yp+44; 4797 obj.entities[j].tile = 2; obj.entities[j].colour = 101; 4798 } 4799 obj.entities[i].invis = false; obj.entities[i].dir = 1; 4800 obj.entities[i].colour = obj.crewcolour(lastsaved); 4801 4802 obj.entities[i].ay = -6; obj.entities[i].ax = 6; 4803 obj.entities[i].vy = -6; obj.entities[i].vx = 6; 4804 break; 4805 case 4073: state++; i = obj.getplayer(); obj.entities[i].xp += 10; break; 4806 case 4074: state++; i = obj.getplayer(); obj.entities[i].xp += 10; break; 4807 case 4075: state++; i = obj.getplayer(); obj.entities[i].xp += 8; break; 4808 case 4076: state++; i = obj.getplayer(); obj.entities[i].xp += 6; break; 4809 case 4077: state++; i = obj.getplayer(); obj.entities[i].xp += 3; break; 4810 case 4078: state++; statedelay = 15; i = obj.getplayer(); obj.entities[i].xp += 1; break; 4811 case 4079: 4812 state = 0; 4813 startscript = true; newscript = "finallevel_teleporter"; 4814 break; 4815 4816 case 4080: 4817 //Activating a teleporter (default appear) 4818 state++; statedelay = 15; 4819 flashlight = 5; screenshake = 90; 4820 music.playef(9, 10); 4821 break; 4822 case 4081: 4823 //Activating a teleporter 2 4824 state++; statedelay = 0; flashlight = 5; screenshake = 0; music.playef(10, 10); 4825 break; 4826 case 4082: 4827 //Activating a teleporter 2 4828 state++; statedelay = 5; 4829 4830 i = obj.getplayer(); j = obj.getteleporter(); 4831 if (j != -1) { 4832 obj.entities[i].xp = obj.entities[j].xp+44; 4833 obj.entities[i].yp = obj.entities[j].yp+44; 4834 obj.entities[j].tile = 2; obj.entities[j].colour = 101; 4835 } 4836 obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 1; 4837 4838 obj.entities[i].ay = -6; obj.entities[i].ax = 6; 4839 obj.entities[i].vy = -6; obj.entities[i].vx = 6; 4840 break; 4841 case 4083: state++; i = obj.getplayer(); obj.entities[i].xp += 10; break; 4842 case 4084: state++; i = obj.getplayer(); obj.entities[i].xp += 10; break; 4843 case 4085: state++; i = obj.getplayer(); obj.entities[i].xp += 8; break; 4844 case 4086: state++; i = obj.getplayer(); obj.entities[i].xp += 6; break; 4845 case 4087: state++; i = obj.getplayer(); obj.entities[i].xp += 3; break; 4846 case 4088: state++; statedelay = 15; i = obj.getplayer(); obj.entities[i].xp += 1; break; 4847 case 4089: 4848 startscript = true; newscript = "gamecomplete_ending"; 4849 state = 0; 4850 break; 4851 4852 case 4090: 4853 //Activating a teleporter (default appear) 4854 state++; statedelay = 15; 4855 flashlight = 5; screenshake = 90; 4856 music.playef(9, 10); 4857 break; 4858 case 4091: 4859 //Activating a teleporter 2 4860 state++; statedelay = 0; flashlight = 5; screenshake = 0; music.playef(10, 10); 4861 break; 4862 case 4092: 4863 //Activating a teleporter 2 4864 state++; statedelay = 5; 4865 4866 i = obj.getplayer(); j = obj.getteleporter(); 4867 if (j != -1) { 4868 obj.entities[i].xp = obj.entities[j].xp+44; 4869 obj.entities[i].yp = obj.entities[j].yp+44; 4870 obj.entities[j].tile = 2; obj.entities[j].colour = 101; 4871 } 4872 obj.entities[i].colour = 0; obj.entities[i].invis = false; obj.entities[i].dir = 1; 4873 4874 obj.entities[i].ay = -6; obj.entities[i].ax = 6; 4875 obj.entities[i].vy = -6; obj.entities[i].vx = 6; 4876 break; 4877 case 4093: state++; i = obj.getplayer(); obj.entities[i].xp += 10; break; 4878 case 4094: state++; i = obj.getplayer(); obj.entities[i].xp += 10; break; 4879 case 4095: state++; i = obj.getplayer(); obj.entities[i].xp += 8; break; 4880 case 4096: state++; i = obj.getplayer(); obj.entities[i].xp += 6; break; 4881 case 4097: state++; i = obj.getplayer(); obj.entities[i].xp += 3; break; 4882 case 4098: state++; statedelay = 15; i = obj.getplayer(); obj.entities[i].xp += 1; break; 4883 case 4099: 4884 if (nocutscenes) { 4885 startscript = true; newscript = "levelonecompleteskip"; 4886 }else{ 4887 startscript = true; newscript = "levelonecomplete_ending"; 4888 } 4889 state = 0; 4890 break; 4891 } 4892 } 4893 } 4894 4895 public function lifesequence(obj:entityclass):void{ 4896 if (lifeseq > 0) { 4897 i = obj.getplayer(); 4898 obj.entities[i].invis = false; 4899 if (lifeseq == 2) obj.entities[i].invis = true; 4900 if (lifeseq == 6) obj.entities[i].invis = true; 4901 if (lifeseq >= 8) obj.entities[i].invis = true; 4902 if (lifeseq > 5) gravitycontrol = savegc; 4903 4904 lifeseq--; 4905 if (lifeseq <= 0) { obj.entities[i].invis = false; } 4906 } 4907 } 4908 4909 public function resetgameclock():void { 4910 frames = 0; 4911 seconds = 0; 4912 minutes = 0; 4913 hours = 0; 4914 } 4915 4916 public function gameclock():void { 4917 frames++; 4918 if (frames >= 30) { 4919 frames -= 30; 4920 seconds++; 4921 if (seconds >= 60) { 4922 seconds -= 60; 4923 minutes++; 4924 if (minutes >= 60) { 4925 minutes -= 60; 4926 hours++; 4927 } 4928 } 4929 } 4930 } 4931 4932 public function giventimestring(hrs:int, min:int, sec:int, help:helpclass):String { 4933 tempstring = ""; 4934 if (hrs > 0) { 4935 tempstring += String(hrs) + ":"; 4936 } 4937 tempstring += help.twodigits(min) + ":" + help.twodigits(sec); 4938 return tempstring; 4939 } 4940 4941 public function timestring(help:helpclass):String { 4942 tempstring = ""; 4943 if (hours > 0) { 4944 tempstring += String(hours) + ":"; 4945 } 4946 tempstring += help.twodigits(minutes) + ":" + help.twodigits(seconds); 4947 return tempstring; 4948 } 4949 4950 public function partimestring(help:helpclass):String { 4951 //given par time in seconds: 4952 tempstring = ""; 4953 if (timetrialpar >= 60) { 4954 tempstring = help.twodigits(int((timetrialpar - (timetrialpar % 60)) / 60)) + ":" + help.twodigits(timetrialpar % 60); 4955 }else { 4956 tempstring = "00:" + help.twodigits(timetrialpar); 4957 } 4958 return tempstring; 4959 } 4960 4961 public function resulttimestring(help:helpclass):String { 4962 //given result time in seconds: 4963 tempstring = ""; 4964 if (timetrialresulttime > 60) { 4965 tempstring = help.twodigits(int((timetrialresulttime - (timetrialresulttime % 60)) / 60)) + ":" 4966 + help.twodigits(timetrialresulttime % 60); 4967 }else { 4968 tempstring = "00:" + help.twodigits(timetrialresulttime); 4969 } 4970 return tempstring; 4971 } 4972 4973 public function timetstring(t:int, help:helpclass):String { 4974 //given par time in seconds: 4975 tempstring = ""; 4976 if (t >= 60) { 4977 tempstring = help.twodigits(int((t - (t % 60)) / 60)) + ":" + help.twodigits(t % 60); 4978 }else { 4979 tempstring = "00:" + help.twodigits(t); 4980 } 4981 return tempstring; 4982 } 4983 4984 4985 public function deathsequence(map:mapclass, obj:entityclass, music:musicclass):void { 4986 if (supercrewmate && scmhurt) { 4987 i = obj.getscm(); 4988 }else{ 4989 i = obj.getplayer(); 4990 } 4991 obj.entities[i].colour = 1; 4992 4993 obj.entities[i].invis = false; 4994 if (deathseq == 30) { 4995 if (nodeathmode) { 4996 music.fadeout(); 4997 gameoverdelay = 60; 4998 } 4999 deathcounts++; 5000 music.playef(2,10); 5001 obj.entities[i].invis = true; 5002 if (map.finalmode) { 5003 map.roomdeathsfinal[roomx - 41 + (20 * (roomy - 48))]++; 5004 currentroomdeaths = map.roomdeathsfinal[roomx - 41 + (20 * (roomy - 48))]; 5005 }else{ 5006 map.roomdeaths[roomx - 100 + (20*(roomy - 100))]++; 5007 currentroomdeaths = map.roomdeaths[roomx - 100 + (20 * (roomy - 100))]; 5008 } 5009 } 5010 if (deathseq == 25) obj.entities[i].invis = true; 5011 if (deathseq == 20) obj.entities[i].invis = true; 5012 if (deathseq == 16) obj.entities[i].invis = true; 5013 if (deathseq == 14) obj.entities[i].invis = true; 5014 if (deathseq == 12) obj.entities[i].invis = true; 5015 if (deathseq < 10) obj.entities[i].invis = true; 5016 if (!nodeathmode) { 5017 if (deathseq <= 1) obj.entities[i].invis = false; 5018 }else { 5019 gameoverdelay--; 5020 } 5021 } 5022 5023 public function initteleportermode(map:mapclass):void { 5024 //Set the teleporter variable to the right position! 5025 teleport_to_teleporter = 0; 5026 5027 for (i = 0; i < map.numteleporters; i++) { 5028 if (roomx == map.teleporters[i].x + 100 && roomy == map.teleporters[i].y + 100) { 5029 teleport_to_teleporter = i; 5030 } 5031 } 5032 } 5033 5034 public function swnpenalty():void { 5035 //set the SWN clock back to the closest 5 second interval 5036 if (swntimer <= 150) { swntimer += 8; if (swntimer > 150) swntimer = 150; 5037 }else if (swntimer <= 300) { swntimer += 8; if (swntimer > 300) swntimer = 300; 5038 }else if (swntimer <= 450) { swntimer += 8; if (swntimer > 450) swntimer = 450; 5039 }else if (swntimer <= 600) { swntimer += 8; if (swntimer > 600) swntimer = 600; 5040 }else if (swntimer <= 750) { swntimer += 8; if (swntimer > 750) swntimer = 750; 5041 }else if (swntimer <= 900) { swntimer += 8; if (swntimer > 900) swntimer = 900; 5042 }else if (swntimer <= 1050) { swntimer += 8; if (swntimer > 1050) swntimer = 1050; 5043 }else if (swntimer <= 1200) { swntimer += 8; if (swntimer > 1200) swntimer = 1200; 5044 }else if (swntimer <= 1350) { swntimer += 8; if (swntimer > 1350) swntimer = 1350; 5045 }else if (swntimer <= 1500) { swntimer += 8; if (swntimer > 1500) swntimer = 1500; 5046 }else if (swntimer <= 1650) { swntimer += 8; if (swntimer > 1650) swntimer = 1650; 5047 }else if (swntimer <= 1800) { swntimer += 8; if (swntimer > 1800) swntimer = 1800; 5048 }else if (swntimer <= 2100) { swntimer += 8; if (swntimer > 2100) swntimer = 2100; 5049 }else if (swntimer <= 2400) { swntimer += 8; if (swntimer > 2400) swntimer = 2400; 5050 } 5051 } 5052 5053 //Game room control 5054 public var door_left:int, door_right:int, door_up:int, door_down:int; 5055 public var roomx:int, roomy:int, roomchangedir:int; 5056 public var temp:int, i:int, j:int, k:int; 5057 5058 //Save points 5059 public var savex:int, savey:int, saverx:int, savery:int; 5060 public var savegc:int, savedir:int; 5061 5062 //Game save variables: two cookies, one for quicksaves and one for teleporters 5063 public var telecookie:SharedObject, quickcookie:SharedObject, statcookie:SharedObject; 5064 public var customcookie:Vector.<SharedObject> = new Vector.<SharedObject>; 5065 public var customcookieexists:Vector.<Boolean> = new Vector.<Boolean>; 5066 public var customcookiesummary:Vector.<String> = new Vector.<String>; 5067 public var telecookieexists:Boolean, quickcookieexists:Boolean; 5068 public var telesummary:String, quicksummary:String; 5069 public var tele_crewstats:Array = new Array(); 5070 public var tele_gametime:String; 5071 public var tele_trinkets:int; 5072 public var tele_currentarea:String; 5073 public var quick_crewstats:Array = new Array(); 5074 public var quick_gametime:String; 5075 public var quick_trinkets:int; 5076 public var quick_currentarea:String; 5077 public var summary_crewstats:Array;// = new Array(); 5078 5079 public var savestate:Array = new Array(); 5080 5081 //Added for port 5082 public var edsavex:int, edsavey:int, edsaverx:int, edsavery:int; 5083 public var edsavegc:int, edsavedir:int; 5084 5085 //State Logic stuff 5086 public var state:int, statedelay:int; 5087 5088 public var gamestate:int; 5089 public var hascontrol:Boolean, jumpheld:Boolean, jumppressed:int; 5090 public var gravitycontrol:int; 5091 5092 public var infocus:Boolean, paused:Boolean; 5093 public var muted:Boolean; 5094 public var mutebutton:int; 5095 public var globalsound:int; 5096 5097 public var mx:int, my:int; 5098 public var screenshake:int, flashlight:int; 5099 public var test:Boolean, teststring:String, tempstring:String; 5100 public var advancetext:Boolean, pausescript:Boolean; 5101 5102 public var deathseq:int, lifeseq:int; 5103 5104 public var coins:int, trinkets:int, crewmates:int, trinketcollect:int; 5105 public var savepoint:int, teleport:Boolean, teleportxpos:int; 5106 public var edteleportent:int; 5107 public var completestop:Boolean; 5108 5109 public var inertia:Number; 5110 5111 public var companion:int, roomchange:Boolean; 5112 public var teleblock:Rectangle, activetele:Boolean, readytotele:int; 5113 public var activeactivity:int, act_fade:int; 5114 public var activity_lastprompt:String, activity_r:int, activity_g:int, activity_b:int; 5115 public var backgroundtext:Boolean; 5116 5117 public var press_left:Boolean, press_right:Boolean, press_action:Boolean, press_map:Boolean; 5118 5119 //Some stats: 5120 public var totalflips:int; 5121 public var hardestroom:String, hardestroomdeaths:int, currentroomdeaths:int; 5122 5123 //Menu interaction stuff 5124 public var mapheld:Boolean; //Is the map key being held down? 5125 public var menupage:int; 5126 public var crewstats:Array = new Array(); 5127 public var lastsaved:int; 5128 public var deathcounts:int; 5129 public var frames:int, seconds:int, minutes:int, hours:int; 5130 public var gamesaved:Boolean; 5131 public var savetime:String, savearea:String, savetrinkets:int; 5132 public var startscript:Boolean, newscript:String; 5133 5134 public var mainmenu:int, menustart:Boolean; 5135 5136 //teleporting 5137 public var teleport_to_new_area:Boolean; 5138 public var teleport_to_x:int, teleport_to_y:int; 5139 public var teleportscript:String; 5140 public var useteleporter:Boolean; 5141 public var teleport_to_teleporter:int; 5142 5143 //Screenrecording stuff, for beta/trailer 5144 public var recording:int; 5145 public var recordstring:String; 5146 public var combomode:Boolean, combolen:int, comboaction:String; 5147 public var currentaction:String, recordinit:Boolean; 5148 5149 public var alarmon:Boolean, alarmdelay:int; 5150 public var blackout:Boolean; 5151 5152 public var playback:Array = new Array(); 5153 public var playbackpos:int, playbacksize:int; 5154 public var playmove:int, playcombo:int; 5155 public var playbackfinished:Boolean; 5156 5157 //functions for recording: 5158 public function initplayback():void { 5159 playback = new Array(); 5160 5161 playback = recordstring.split(","); 5162 playbacksize = playback.length; 5163 playbackpos = 0; 5164 } 5165 5166 //Main Menu Variables 5167 public var menuoptions:Vector.<String> = new Vector.<String>; 5168 public var menuoptions_alt:Vector.<String> = new Vector.<String>; 5169 public var menuoptionsactive:Vector.<Boolean> = new Vector.<Boolean>; 5170 public var menuoptionslayout:Vector.<int> = new Vector.<int>; 5171 public var nummenuoptions:int, currentmenuoption:int; 5172 public var menuselection:String, currentmenuname:String, previousmenuname:String; 5173 public var menuxoff:int, menuyoff:int; 5174 5175 public var menucountdown:int, menudest:String; 5176 5177 public var creditposx:int, creditposy:int, creditposdelay:int; 5178 5179 //60 fps mode! 5180 public var sfpsmode:Boolean; 5181 5182 //Sine Wave Ninja Minigame 5183 public var swnmode:Boolean; 5184 public var swngame:int, swnstate:int, swnstate2:int, swnstate3:int, swnstate4:int, swndelay:int, swndeaths:int; 5185 public var swntimer:int, swncolstate:int, swncoldelay:int; 5186 public var swnrecord:int, swnbestrank:int, swnrank:int, swnmessage:int; 5187 5188 //SuperCrewMate Stuff 5189 public var supercrewmate:Boolean, scmhurt:Boolean, scmprogress:int, scmmoveme:Boolean; 5190 5191 //Accessibility Options 5192 public var colourblindmode:Boolean; 5193 public var noflashingmode:Boolean; 5194 public var slowdown:int; 5195 5196 public var nodeathmode:Boolean; 5197 public var gameoverdelay:int; 5198 public var nocutscenes:Boolean; 5199 5200 //Time Trials 5201 public var intimetrial:Boolean, timetrialparlost:Boolean; 5202 public var timetrialcountdown:int, timetrialshinytarget:int, timetriallevel:int; 5203 public var timetrialpar:int, timetrialresulttime:int, timetrialrank:int; 5204 5205 public var creditposition:int; 5206 public var insecretlab:Boolean; 5207 5208 public var inintermission:Boolean; 5209 5210 //Tap sensors 5211 public var tapleft:int, tapright:int; 5212 5213 //Stats 5214 public var unlock:Array = new Array(); 5215 public var unlocknotify:Array = new Array(); 5216 public var temp_unlock:Array; 5217 public var temp_unlocknotify:Array; 5218 public var stat_trinkets:int; 5219 public var fullscreen:Boolean; 5220 public var bestgamedeaths:int; 5221 5222 public var stat_screenshakes:Boolean; 5223 public var stat_backgrounds:Boolean; 5224 public var stat_flipmode:Boolean; 5225 public var stat_invincibility:Boolean; 5226 public var stat_slowdown:int; 5227 5228 public var besttimes:Array = new Array(); 5229 public var besttrinkets:Array = new Array(); 5230 public var bestlives:Array = new Array(); 5231 public var bestrank:Array = new Array(); 5232 public var temp_besttimes:Array; 5233 public var temp_besttrinkets:Array; 5234 public var temp_bestlives:Array; 5235 public var temp_bestrank:Array; 5236 5237 public var savemystats:Boolean; 5238 5239 public var menukludge:Boolean; 5240 public var quickrestartkludge:Boolean; 5241 5242 public var advanced_mode:Boolean; 5243 public var advanced_smoothing:Boolean; 5244 public var advanced_scaling:int; 5245 5246 public var fullscreentoggleheld:Boolean = false; 5247 5248 //Custom stuff 5249 public var levelstatscookie:SharedObject; 5250 public var levelstatscookieloaded:Boolean; 5251 public var customscript:Vector.<String> = new Vector.<String>; 5252 public var customcol:int, levelpage:int, playcustomlevel:int; 5253 public var customleveltitle:String; 5254 public var customlevelfilename:String; 5255 5256 public var customlevelstats:Vector.<String> = new Vector.<String>; //string array containing level filenames 5257 public var customlevelscore:Vector.<int> = new Vector.<int>; 5258 public var numcustomlevelstats:int; 5259 public var customlevelstatsloaded:Boolean; 5260 5261 //Control types! 5262 //0 is swipe, 1 is both sides, 2 is d-pad 5263 public var controlstyle:int = 0; 5264 public var last_left:int = 0, last_right:int = 0; 5265 public var last_action:int = 0; 5266 public var controlsensitivity:int = 50; 5267 5268 //Mobile menu options 5269 public var mobilemenu:Boolean = true; 5270 public var autoquicksave:Boolean = false; 5271 public var mobilequicksave_thisroom:Boolean = false; 5272 public var controltutorialstate:int = 0; 5273 public var controltutorialstatedelay:int = 0; 5274 public var controllerp1:int = 0; 5275 public var controllerp2:int = 0; 5276 public var controllerp3:int = 0; 5277 5278 public var showloadingnotice:Boolean = false; 5279 5280 public var disablekludge_1:Boolean = false; 5281 public var disablekludge_2:Boolean = false; 5282 public var disablekludge_3:Boolean = false; 5283 public var disablekludge_4:Boolean = false; 5284 5285 public var showcontroltutorial:int = 0; 5286 5287 public var platform:platformclass = new platformclass; 5288 public var scores:scoreclass = new scoreclass; 5289 } 5290}