2020-01-01 21:29:24 +01:00
|
|
|
#include "Input.h"
|
2020-02-10 01:53:01 +01:00
|
|
|
#include "Script.h"
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
#include "MakeAndPlay.h"
|
|
|
|
|
|
|
|
#include "tinyxml.h"
|
|
|
|
|
Replace TiXmlDocument load and save functions by PHYSFS
The TinyXml functions to load and save files don't properly support
unicode file paths on Windows, so in order to support that properly, I
saw no other option than to do the actual loading and saving via PHYSFS
(or to use the Windows API on Windows and retain doc.LoadFile and
doc.SaveFile on other OSes, but that'd be more complicated and
unnecessary, we already have PHYSFS, right?).
There are two new functions in FileSystemUtils:
bool FILESYSTEM_saveTiXmlDocument(const char *name, TiXmlDocument *doc)
bool FILESYSTEM_loadTiXmlDocument(const char *name, TiXmlDocument *doc)
Any instances of doc.SaveFile(<FULL_PATH>) have been replaced by
FILESYSTEM_saveTiXmlDocument(<VVVVVV_FOLDER_PATH>, &doc), where
<FULL_PATH> included the full path to the saves or levels directory,
and <VVVVVV_FOLDER_PATH> only includes the path relative to the VVVVVV
directory.
When loading a document, a TiXmlDocument used to be created with a full
path in its constructor and doc.LoadFile() would then be called, now a
TiXmlDocument is constructed with no path name and
FILESYSTEM_loadTiXmlDocument(<VVVVVV_FOLDER_PATH>, &doc) is called.
2020-01-12 15:17:39 +01:00
|
|
|
#include "FileSystemUtils.h"
|
|
|
|
|
2020-02-10 01:53:01 +01:00
|
|
|
extern scriptclass script;
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
void updatebuttonmappings(int bind)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
2020-04-02 23:06:56 +02:00
|
|
|
for (
|
|
|
|
SDL_GameControllerButton i = SDL_CONTROLLER_BUTTON_A;
|
|
|
|
i < SDL_CONTROLLER_BUTTON_DPAD_UP;
|
|
|
|
i = (SDL_GameControllerButton) (i + 1)
|
|
|
|
) {
|
|
|
|
if (key.isDown(i))
|
|
|
|
{
|
|
|
|
bool dupe = false;
|
|
|
|
if (bind == 1)
|
|
|
|
{
|
|
|
|
for (size_t j = 0; j < game.controllerButton_flip.size(); j += 1)
|
|
|
|
{
|
|
|
|
if (i == game.controllerButton_flip[j])
|
|
|
|
{
|
|
|
|
dupe = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!dupe)
|
|
|
|
{
|
|
|
|
game.controllerButton_flip.push_back(i);
|
|
|
|
music.playef(11);
|
|
|
|
}
|
|
|
|
for (size_t j = 0; j < game.controllerButton_map.size(); j += 1)
|
|
|
|
{
|
|
|
|
if (i == game.controllerButton_map[j])
|
|
|
|
{
|
|
|
|
game.controllerButton_map.erase(game.controllerButton_map.begin() + j);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (size_t j = 0; j < game.controllerButton_esc.size(); j += 1)
|
|
|
|
{
|
|
|
|
if (i == game.controllerButton_esc[j])
|
|
|
|
{
|
|
|
|
game.controllerButton_esc.erase(game.controllerButton_esc.begin() + j);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bind == 2)
|
|
|
|
{
|
|
|
|
for (size_t j = 0; j < game.controllerButton_map.size(); j += 1)
|
|
|
|
{
|
|
|
|
if (i == game.controllerButton_map[j])
|
|
|
|
{
|
|
|
|
dupe = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!dupe)
|
|
|
|
{
|
|
|
|
game.controllerButton_map.push_back(i);
|
|
|
|
music.playef(11);
|
|
|
|
}
|
|
|
|
for (size_t j = 0; j < game.controllerButton_flip.size(); j += 1)
|
|
|
|
{
|
|
|
|
if (i == game.controllerButton_flip[j])
|
|
|
|
{
|
|
|
|
game.controllerButton_flip.erase(game.controllerButton_flip.begin() + j);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (size_t j = 0; j < game.controllerButton_esc.size(); j += 1)
|
|
|
|
{
|
|
|
|
if (i == game.controllerButton_esc[j])
|
|
|
|
{
|
|
|
|
game.controllerButton_esc.erase(game.controllerButton_esc.begin() + j);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bind == 3)
|
|
|
|
{
|
|
|
|
for (size_t j = 0; j < game.controllerButton_esc.size(); j += 1)
|
|
|
|
{
|
|
|
|
if (i == game.controllerButton_esc[j])
|
|
|
|
{
|
|
|
|
dupe = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!dupe)
|
|
|
|
{
|
|
|
|
game.controllerButton_esc.push_back(i);
|
|
|
|
music.playef(11);
|
|
|
|
}
|
|
|
|
for (size_t j = 0; j < game.controllerButton_flip.size(); j += 1)
|
|
|
|
{
|
|
|
|
if (i == game.controllerButton_flip[j])
|
|
|
|
{
|
|
|
|
game.controllerButton_flip.erase(game.controllerButton_flip.begin() + j);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (size_t j = 0; j < game.controllerButton_map.size(); j += 1)
|
|
|
|
{
|
|
|
|
if (i == game.controllerButton_map[j])
|
|
|
|
{
|
|
|
|
game.controllerButton_map.erase(game.controllerButton_map.begin() + j);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
void titleinput()
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
//game.mx = (mouseX / 4);
|
|
|
|
//game.my = (mouseY / 4);
|
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
//TODO bit wasteful doing this every poll
|
|
|
|
key.setSensitivity(game.controllerSensitivity);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
game.press_left = false;
|
|
|
|
game.press_right = false;
|
|
|
|
game.press_action = false;
|
|
|
|
game.press_map = false;
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
if (graphics.flipmode)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
if (key.isDown(KEYBOARD_LEFT) || key.isDown(KEYBOARD_DOWN) || key.isDown(KEYBOARD_a) || key.isDown(KEYBOARD_s) || key.controllerWantsRight(true)) game.press_left = true;
|
|
|
|
if (key.isDown(KEYBOARD_RIGHT) || key.isDown(KEYBOARD_UP) || key.isDown(KEYBOARD_d) || key.isDown(KEYBOARD_w) || key.controllerWantsLeft(true)) game.press_right = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (key.isDown(KEYBOARD_LEFT) || key.isDown(KEYBOARD_UP) || key.isDown(KEYBOARD_a) || key.isDown(KEYBOARD_w) || key.controllerWantsLeft(true))
|
|
|
|
{
|
|
|
|
game.press_left = true;
|
|
|
|
}
|
|
|
|
if (key.isDown(KEYBOARD_RIGHT) || key.isDown(KEYBOARD_DOWN) || key.isDown(KEYBOARD_d) || key.isDown(KEYBOARD_s) || key.controllerWantsRight(true))
|
|
|
|
{
|
|
|
|
game.press_right = true;
|
2020-04-02 23:06:56 +02:00
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
if (key.isDown(KEYBOARD_z) || key.isDown(KEYBOARD_SPACE) || key.isDown(KEYBOARD_v) || key.isDown(game.controllerButton_flip)) game.press_action = true;
|
|
|
|
//|| key.isDown(KEYBOARD_UP) || key.isDown(KEYBOARD_DOWN)) game.press_action = true; //on menus, up and down don't work as action
|
|
|
|
if (key.isDown(KEYBOARD_ENTER)) game.press_map = true;
|
|
|
|
|
|
|
|
//In the menu system, all keypresses are single taps rather than holds. Therefore this test has to be done for all presses
|
|
|
|
if (!game.press_action && !game.press_left && !game.press_right) game.jumpheld = false;
|
|
|
|
if (!game.press_map) game.mapheld = false;
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
if (!game.jumpheld && graphics.fademode==0)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
if (game.press_action || game.press_left || game.press_right || game.press_map)
|
|
|
|
{
|
|
|
|
game.jumpheld = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (key.isDown(27) && game.currentmenuname != "youwannaquit" && game.menustart)
|
|
|
|
{
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.previousmenuname = game.currentmenuname;
|
|
|
|
game.createmenu("youwannaquit");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(game.menustart)
|
|
|
|
{
|
|
|
|
if (game.press_left)
|
|
|
|
{
|
|
|
|
game.currentmenuoption--;
|
|
|
|
}
|
|
|
|
else if (game.press_right)
|
|
|
|
{
|
|
|
|
game.currentmenuoption++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (game.currentmenuoption < 0) game.currentmenuoption = game.nummenuoptions-1;
|
|
|
|
if (game.currentmenuoption >= game.nummenuoptions ) game.currentmenuoption = 0;
|
|
|
|
|
|
|
|
if (game.press_action)
|
|
|
|
{
|
|
|
|
if (!game.menustart)
|
|
|
|
{
|
|
|
|
game.menustart = true;
|
|
|
|
music.play(6);
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(18);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.screenshake = 10;
|
|
|
|
game.flashlight = 5;
|
|
|
|
map.colstate = 10;
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (game.currentmenuname == "mainmenu")
|
|
|
|
{
|
2020-04-02 21:41:33 +02:00
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
#if defined(MAKEANDPLAY)
|
|
|
|
if (game.currentmenuoption == 0)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
//Bring you to the normal playmenu
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("playerworlds");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
|
|
|
//Options
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("graphicoptions");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2)
|
|
|
|
{
|
|
|
|
//Options
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("options");
|
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
//Add extra menu for mmmmmm mod
|
|
|
|
if(music.mmmmmm){
|
|
|
|
game.menuoptions[3] = "soundtrack";
|
|
|
|
game.menuoptionsactive[3] = true;
|
|
|
|
game.menuoptions[4] = "return";
|
|
|
|
game.menuoptionsactive[4] = true;
|
|
|
|
game.nummenuoptions = 5;
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 3)
|
|
|
|
{
|
|
|
|
//bye!
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(2);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.mainmenu = 100;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
2020-04-02 23:06:56 +02:00
|
|
|
#elif !defined(MAKEANDPLAY)
|
|
|
|
#if defined(NO_CUSTOM_LEVELS)
|
2020-01-01 21:29:24 +01:00
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//Play
|
|
|
|
if (game.telesummary == "" && game.quicksummary == "")
|
|
|
|
{
|
|
|
|
//No saves exist, just start a new game
|
|
|
|
game.mainmenu = 0;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Bring you to the normal playmenu
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("play");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
|
|
|
//Options
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("graphicoptions");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
2020-02-10 01:53:01 +01:00
|
|
|
else if (game.currentmenuoption == 2)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
//Options
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("options");
|
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
//Add extra menu for mmmmmm mod
|
|
|
|
if(music.mmmmmm){
|
|
|
|
game.menuoptions[4] = "soundtrack";
|
|
|
|
game.menuoptionsactive[4] = true;
|
|
|
|
game.menuoptions[5] = "return";
|
|
|
|
game.menuoptionsactive[5] = true;
|
|
|
|
game.nummenuoptions = 6;
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
2020-02-10 01:53:01 +01:00
|
|
|
else if (game.currentmenuoption == 3)
|
|
|
|
{
|
|
|
|
//Credits
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-02-10 01:53:01 +01:00
|
|
|
game.createmenu("credits");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 4)
|
|
|
|
{
|
|
|
|
//bye!
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(2);
|
2020-02-10 01:53:01 +01:00
|
|
|
game.mainmenu = 100;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-02-10 01:53:01 +01:00
|
|
|
}
|
2020-04-02 23:06:56 +02:00
|
|
|
#else
|
2020-02-10 01:53:01 +01:00
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//Play
|
|
|
|
if (game.telesummary == "" && game.quicksummary == "")
|
|
|
|
{
|
|
|
|
//No saves exist, just start a new game
|
|
|
|
game.mainmenu = 0;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-02-10 01:53:01 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Bring you to the normal playmenu
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-02-10 01:53:01 +01:00
|
|
|
game.createmenu("play");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
|
|
|
//Bring you to the normal playmenu
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-02-10 01:53:01 +01:00
|
|
|
game.createmenu("playerworlds");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2)
|
|
|
|
{
|
|
|
|
//Options
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-02-10 01:53:01 +01:00
|
|
|
game.createmenu("graphicoptions");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 3)
|
|
|
|
{
|
|
|
|
//Options
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-02-10 01:53:01 +01:00
|
|
|
game.createmenu("options");
|
|
|
|
|
|
|
|
//Add extra menu for mmmmmm mod
|
|
|
|
if(music.mmmmmm){
|
|
|
|
game.menuoptions[4] = "soundtrack";
|
|
|
|
game.menuoptionsactive[4] = true;
|
|
|
|
game.menuoptions[5] = "return";
|
|
|
|
game.menuoptionsactive[5] = true;
|
|
|
|
game.nummenuoptions = 6;
|
|
|
|
}
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
else if (game.currentmenuoption == 4)
|
|
|
|
{
|
|
|
|
//Credits
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("credits");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 5)
|
|
|
|
{
|
|
|
|
//bye!
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(2);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.mainmenu = 100;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
2020-04-02 23:06:56 +02:00
|
|
|
#endif
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
2020-04-02 23:06:56 +02:00
|
|
|
#endif
|
|
|
|
#if !defined(NO_CUSTOM_LEVELS)
|
2020-01-01 21:29:24 +01:00
|
|
|
else if(game.currentmenuname=="levellist")
|
|
|
|
{
|
2020-04-02 23:06:56 +02:00
|
|
|
if(game.currentmenuoption==game.nummenuoptions-1){
|
|
|
|
//go back to menu
|
|
|
|
music.playef(11);
|
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}else if(game.currentmenuoption==game.nummenuoptions-2){
|
|
|
|
//next page
|
|
|
|
music.playef(11);
|
|
|
|
if((size_t) ((game.levelpage*8)+8) >= ed.ListOfMetaData.size()){
|
|
|
|
game.levelpage=0;
|
|
|
|
}else{
|
|
|
|
game.levelpage++;
|
|
|
|
}
|
|
|
|
game.createmenu("levellist");
|
|
|
|
game.currentmenuoption=game.nummenuoptions-2;
|
|
|
|
map.nexttowercolour();
|
2020-01-01 21:29:24 +01:00
|
|
|
}else{
|
2020-04-02 23:06:56 +02:00
|
|
|
//Ok, launch the level!
|
|
|
|
//PLAY CUSTOM LEVEL HOOK
|
|
|
|
music.playef(11);
|
|
|
|
game.playcustomlevel=(game.levelpage*8)+game.currentmenuoption;
|
|
|
|
game.customleveltitle=ed.ListOfMetaData[game.playcustomlevel].title;
|
|
|
|
game.customlevelfilename=ed.ListOfMetaData[game.playcustomlevel].filename;
|
|
|
|
|
|
|
|
std::string name = "saves/" + ed.ListOfMetaData[game.playcustomlevel].filename.substr(7) + ".vvv";
|
|
|
|
TiXmlDocument doc;
|
|
|
|
if (!FILESYSTEM_loadTiXmlDocument(name.c_str(), &doc)){
|
|
|
|
game.mainmenu = 22;
|
|
|
|
graphics.fademode = 2;
|
|
|
|
}else{
|
|
|
|
game.createmenu("quickloadlevel");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
2020-04-02 23:06:56 +02:00
|
|
|
}
|
|
|
|
#endif
|
2020-01-01 21:29:24 +01:00
|
|
|
else if(game.currentmenuname=="quickloadlevel")
|
|
|
|
{
|
2020-04-02 23:06:56 +02:00
|
|
|
if(game.currentmenuoption==0){//continue save
|
|
|
|
game.mainmenu = 23;
|
|
|
|
graphics.fademode = 2;
|
|
|
|
}else if(game.currentmenuoption==1){
|
|
|
|
game.mainmenu = 22;
|
|
|
|
graphics.fademode = 2;
|
|
|
|
}else if(game.currentmenuoption==2){
|
|
|
|
music.playef(11);
|
|
|
|
game.levelpage=0;
|
|
|
|
game.createmenu("levellist");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
2020-04-02 23:06:56 +02:00
|
|
|
#if !defined(NO_CUSTOM_LEVELS)
|
2020-01-01 21:29:24 +01:00
|
|
|
else if(game.currentmenuname=="playerworlds")
|
|
|
|
{
|
2020-04-02 23:06:56 +02:00
|
|
|
#if !defined(NO_EDITOR)
|
|
|
|
if(game.currentmenuoption==0){
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
music.playef(11);
|
|
|
|
game.levelpage=0;
|
|
|
|
ed.getDirectoryData();
|
|
|
|
game.loadcustomlevelstats(); //Should only load a file if it's needed
|
|
|
|
game.createmenu("levellist");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}else if(game.currentmenuoption==1){
|
|
|
|
//LEVEL EDITOR HOOK
|
|
|
|
music.playef(11);
|
|
|
|
game.mainmenu = 20;
|
|
|
|
graphics.fademode = 2;
|
|
|
|
ed.filename="";
|
|
|
|
}/*else if(game.currentmenuoption==2){
|
|
|
|
music.playef(11);
|
|
|
|
//"OPENFOLDERHOOK"
|
|
|
|
//When the player selects the "open level folder" menu option,
|
|
|
|
//this is where it should run the appropriate code.
|
|
|
|
//This code should:
|
|
|
|
// - Minimise the game
|
|
|
|
// - Open the levels folder for whatever operating system we're on
|
|
|
|
SDL_assert(0 && "Remove open level dir");
|
|
|
|
|
|
|
|
}*/else if(game.currentmenuoption==2){
|
|
|
|
//back
|
|
|
|
music.playef(11);
|
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
if(game.currentmenuoption==0){
|
|
|
|
music.playef(11);
|
|
|
|
game.levelpage=0;
|
|
|
|
ed.getDirectoryData();
|
|
|
|
game.loadcustomlevelstats(); //Should only load a file if it's needed
|
|
|
|
game.createmenu("levellist");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}else if(game.currentmenuoption==1){
|
|
|
|
//back
|
|
|
|
music.playef(11);
|
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else if(game.currentmenuname=="errornostart"){
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-02-10 03:21:19 +01:00
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "graphicoptions")
|
|
|
|
{
|
2020-04-02 23:06:56 +02:00
|
|
|
if (game.currentmenuoption == 0){
|
|
|
|
music.playef(11);
|
|
|
|
graphics.screenbuffer->toggleFullScreen();
|
|
|
|
game.fullscreen = !game.fullscreen;
|
|
|
|
game.savestats();
|
|
|
|
game.createmenu("graphicoptions");
|
|
|
|
game.currentmenuoption = 0;
|
|
|
|
}else if (game.currentmenuoption == 1){
|
|
|
|
music.playef(11);
|
|
|
|
graphics.screenbuffer->toggleStretchMode();
|
|
|
|
game.stretchMode = (game.stretchMode + 1) % 3;
|
|
|
|
game.savestats();
|
|
|
|
game.createmenu("graphicoptions");
|
|
|
|
game.currentmenuoption = 1;
|
|
|
|
}else if (game.currentmenuoption == 2){
|
|
|
|
music.playef(11);
|
|
|
|
graphics.screenbuffer->toggleLinearFilter();
|
|
|
|
game.useLinearFilter = !game.useLinearFilter;
|
|
|
|
game.savestats();
|
|
|
|
game.createmenu("graphicoptions");
|
|
|
|
game.currentmenuoption = 2;
|
|
|
|
}else if (game.currentmenuoption == 3){
|
|
|
|
//change smoothing
|
|
|
|
music.playef(11);
|
|
|
|
game.fullScreenEffect_badSignal = !game.fullScreenEffect_badSignal;
|
|
|
|
//Hook the analogue thing in here: ABCDEFG
|
|
|
|
graphics.screenbuffer->badSignalEffect= !graphics.screenbuffer->badSignalEffect;
|
|
|
|
game.savestats();
|
|
|
|
game.createmenu("graphicoptions");
|
|
|
|
game.currentmenuoption = 3;
|
|
|
|
}else if (game.currentmenuoption == 4) {
|
|
|
|
//toggle mouse cursor
|
|
|
|
music.playef(11);
|
|
|
|
if (graphics.showmousecursor == true) {
|
|
|
|
SDL_ShowCursor(SDL_DISABLE);
|
|
|
|
graphics.showmousecursor = false;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
SDL_ShowCursor(SDL_ENABLE);
|
|
|
|
graphics.showmousecursor = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//back
|
|
|
|
music.playef(11);
|
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "youwannaquit")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//bye!
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(2);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.mainmenu = 100;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu(game.previousmenuname);
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "setinvincibility")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("accessibility");
|
2020-01-18 04:14:29 +01:00
|
|
|
game.currentmenuoption = 3;
|
2020-01-01 21:29:24 +01:00
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
map.invincibility = !map.invincibility;
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("accessibility");
|
2020-01-18 04:14:29 +01:00
|
|
|
game.currentmenuoption = 3;
|
2020-01-01 21:29:24 +01:00
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "setslowdown1")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("accessibility");
|
2020-01-18 04:14:29 +01:00
|
|
|
game.currentmenuoption = 4;
|
2020-01-01 21:29:24 +01:00
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//change game speed
|
|
|
|
game.deletequick();
|
|
|
|
game.deletetele();
|
|
|
|
game.createmenu("setslowdown2");
|
|
|
|
map.nexttowercolour();
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "setslowdown2")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//back
|
|
|
|
game.gameframerate=34;
|
|
|
|
game.slowdown = 30;
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("accessibility");
|
2020-01-18 04:14:29 +01:00
|
|
|
game.currentmenuoption = 4;
|
2020-01-01 21:29:24 +01:00
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
|
|
|
game.gameframerate=41;
|
|
|
|
game.slowdown = 24;
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("accessibility");
|
2020-01-18 04:14:29 +01:00
|
|
|
game.currentmenuoption = 4;
|
2020-01-01 21:29:24 +01:00
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2)
|
|
|
|
{
|
|
|
|
game.gameframerate=55;
|
|
|
|
game.slowdown = 18;
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("accessibility");
|
2020-01-18 04:14:29 +01:00
|
|
|
game.currentmenuoption = 4;
|
2020-01-01 21:29:24 +01:00
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 3)
|
|
|
|
{
|
|
|
|
game.gameframerate=83;
|
|
|
|
game.slowdown = 12;
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("accessibility");
|
2020-01-18 04:14:29 +01:00
|
|
|
game.currentmenuoption = 4;
|
2020-01-01 21:29:24 +01:00
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "accessibility")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//disable animated backgrounds
|
|
|
|
game.colourblindmode = !game.colourblindmode;
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
map.tdrawback = true;
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
|
|
|
//disable screeneffects
|
|
|
|
game.noflashingmode = !game.noflashingmode;
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
if (!game.noflashingmode)
|
|
|
|
{
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(18);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.screenshake = 10;
|
|
|
|
game.flashlight = 5;
|
2020-01-11 03:57:32 +01:00
|
|
|
}else{
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2)
|
2020-01-17 18:37:53 +01:00
|
|
|
{
|
|
|
|
//disable text outline
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.notextoutline = !graphics.notextoutline;
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-17 18:37:53 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 3)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
//invincibility
|
|
|
|
if (!map.invincibility)
|
|
|
|
{
|
|
|
|
game.createmenu("setinvincibility");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
map.invincibility = !map.invincibility;
|
|
|
|
}
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
2020-01-17 18:37:53 +01:00
|
|
|
else if (game.currentmenuoption == 4)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
//change game speed
|
|
|
|
game.createmenu("setslowdown2");
|
|
|
|
map.nexttowercolour();
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
2020-01-17 18:37:53 +01:00
|
|
|
else if (game.currentmenuoption == 5)
|
2020-01-13 02:45:44 +01:00
|
|
|
{
|
|
|
|
// toggle fake load screen
|
|
|
|
game.skipfakeload = !game.skipfakeload;
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-13 02:45:44 +01:00
|
|
|
}
|
2020-01-17 18:37:53 +01:00
|
|
|
else if (game.currentmenuoption == 6)
|
2020-01-25 05:43:04 +01:00
|
|
|
{
|
|
|
|
// toggle translucent roomname BG
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.translucentroomname = !graphics.translucentroomname;
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-25 05:43:04 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 7)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("options");
|
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
//Add extra menu for mmmmmm mod
|
|
|
|
if(music.mmmmmm){
|
|
|
|
#if defined(MAKEANDPLAY)
|
|
|
|
game.menuoptions[3] = "soundtrack";
|
|
|
|
game.menuoptionsactive[3] = true;
|
|
|
|
game.menuoptions[4] = "return";
|
|
|
|
game.menuoptionsactive[4] = true;
|
|
|
|
game.nummenuoptions = 5;
|
|
|
|
#elif !defined(MAKEANDPLAY)
|
|
|
|
game.menuoptions[4] = "soundtrack";
|
|
|
|
game.menuoptionsactive[4] = true;
|
|
|
|
game.menuoptions[5] = "return";
|
|
|
|
game.menuoptionsactive[5] = true;
|
|
|
|
game.nummenuoptions = 6;
|
|
|
|
#endif
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Can't do yet! play sad sound
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(2);
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "options")
|
|
|
|
{
|
2020-04-02 21:41:33 +02:00
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
#if defined(MAKEANDPLAY)
|
|
|
|
if (game.currentmenuoption == 0)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
//accessibility options
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("accessibility");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
2020-04-02 21:41:33 +02:00
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
|
|
|
//clear data menu
|
|
|
|
music.playef(11);
|
|
|
|
game.createmenu("controller");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
else if (game.currentmenuoption == 2)
|
|
|
|
{
|
|
|
|
//clear data menu
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("cleardatamenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
if(music.mmmmmm){
|
|
|
|
if (game.currentmenuoption == 3)
|
|
|
|
{
|
|
|
|
//**** TOGGLE MMMMMM
|
|
|
|
if(game.usingmmmmmm > 0){
|
|
|
|
game.usingmmmmmm=0;
|
|
|
|
}else{
|
|
|
|
game.usingmmmmmm=1;
|
|
|
|
}
|
|
|
|
music.usingmmmmmm = !music.usingmmmmmm;
|
|
|
|
music.playef(11);
|
|
|
|
music.play(6);
|
|
|
|
game.savestats();
|
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
if (game.currentmenuoption == 4)
|
|
|
|
{
|
|
|
|
//back
|
|
|
|
music.playef(11);
|
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if (game.currentmenuoption == 3)
|
|
|
|
{
|
|
|
|
//back
|
|
|
|
music.playef(11);
|
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#elif !defined(MAKEANDPLAY)
|
2020-01-01 21:29:24 +01:00
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//accessibility options
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("accessibility");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
|
|
|
//unlock play options
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("unlockmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
2020-04-02 23:06:56 +02:00
|
|
|
else if (game.currentmenuoption == 2)
|
|
|
|
{
|
|
|
|
//clear data menu
|
|
|
|
music.playef(11);
|
|
|
|
game.createmenu("controller");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
else if (game.currentmenuoption == 3)
|
|
|
|
{
|
|
|
|
//clear data menu
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("cleardatamenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
2020-04-02 21:41:33 +02:00
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
if(music.mmmmmm){
|
|
|
|
if (game.currentmenuoption == 4)
|
|
|
|
{
|
|
|
|
//**** TOGGLE MMMMMM
|
|
|
|
if(game.usingmmmmmm > 0){
|
|
|
|
game.usingmmmmmm=0;
|
|
|
|
}else{
|
|
|
|
game.usingmmmmmm=1;
|
|
|
|
}
|
|
|
|
music.usingmmmmmm = !music.usingmmmmmm;
|
|
|
|
music.playef(11);
|
|
|
|
music.play(6);
|
|
|
|
game.savestats();
|
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
if (game.currentmenuoption == 5)
|
|
|
|
{
|
|
|
|
//back
|
|
|
|
music.playef(11);
|
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if (game.currentmenuoption == 4)
|
|
|
|
{
|
|
|
|
//back
|
|
|
|
music.playef(11);
|
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "unlockmenutrials")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0) //unlock 1
|
|
|
|
{
|
|
|
|
game.unlock[9] = true;
|
|
|
|
game.unlocknotify[9] = true;
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("unlockmenutrials");
|
|
|
|
game.currentmenuoption = 0;
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1) //unlock 2
|
|
|
|
{
|
|
|
|
game.unlock[10] = true;
|
|
|
|
game.unlocknotify[10] = true;
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("unlockmenutrials");
|
|
|
|
game.currentmenuoption = 1;
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2) //unlock 3
|
|
|
|
{
|
|
|
|
game.unlock[11] = true;
|
|
|
|
game.unlocknotify[11] = true;
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("unlockmenutrials");
|
|
|
|
game.currentmenuoption = 2;
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 3) //unlock 4
|
|
|
|
{
|
|
|
|
game.unlock[12] = true;
|
|
|
|
game.unlocknotify[12] = true;
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("unlockmenutrials");
|
|
|
|
game.currentmenuoption = 3;
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 4) //unlock 5
|
|
|
|
{
|
|
|
|
game.unlock[13] = true;
|
|
|
|
game.unlocknotify[13] = true;
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("unlockmenutrials");
|
|
|
|
game.currentmenuoption = 4;
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 5) //unlock 6
|
|
|
|
{
|
|
|
|
game.unlock[14] = true;
|
|
|
|
game.unlocknotify[14] = true;
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("unlockmenutrials");
|
|
|
|
game.currentmenuoption = 5;
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 6) //back
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("unlockmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "unlockmenu")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
2020-01-11 02:34:03 +01:00
|
|
|
//unlock time trials separately...
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("unlockmenutrials");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
|
|
|
//unlock intermissions
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.unlock[16] = true;
|
|
|
|
game.unlocknotify[16] = true;
|
|
|
|
game.unlock[6] = true;
|
|
|
|
game.unlock[7] = true;
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("unlockmenu");
|
|
|
|
game.currentmenuoption = 1;
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2)
|
|
|
|
{
|
|
|
|
//unlock no death mode
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.unlock[17] = true;
|
|
|
|
game.unlocknotify[17] = true;
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("unlockmenu");
|
|
|
|
game.currentmenuoption = 2;
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 3)
|
|
|
|
{
|
|
|
|
//unlock flip mode
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.unlock[18] = true;
|
|
|
|
game.unlocknotify[18] = true;
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("unlockmenu");
|
|
|
|
game.currentmenuoption = 3;
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 4)
|
|
|
|
{
|
|
|
|
//unlock jukebox
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.stat_trinkets = 20;
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("unlockmenu");
|
|
|
|
game.currentmenuoption = 4;
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 5)
|
|
|
|
{
|
|
|
|
//unlock secret lab
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.unlock[8] = true;
|
|
|
|
game.unlocknotify[8] = true;
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("unlockmenu");
|
|
|
|
game.currentmenuoption = 5;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-11 03:57:32 +01:00
|
|
|
game.createmenu("options");
|
2020-01-01 21:29:24 +01:00
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "credits")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//next page
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("credits2");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "credits2")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//next page
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("credits25");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "credits25")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//next page
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("credits3");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "credits3")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//next page
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-02-12 05:45:58 +01:00
|
|
|
game.current_credits_list_index += 9;
|
|
|
|
|
|
|
|
if (game.current_credits_list_index >= (int)game.superpatrons.size())
|
|
|
|
{
|
|
|
|
// No more super patrons. Move to the next credits section
|
|
|
|
game.current_credits_list_index = 0;
|
|
|
|
game.createmenu("credits4");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// There are more super patrons. Refresh the menu with the next ones
|
|
|
|
game.createmenu("credits3");
|
|
|
|
}
|
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-02-12 05:45:58 +01:00
|
|
|
game.current_credits_list_index = 0;
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "credits4")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//next page
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-02-12 05:45:58 +01:00
|
|
|
game.current_credits_list_index += 14;
|
|
|
|
|
|
|
|
if (game.current_credits_list_index >= (int)game.patrons.size())
|
|
|
|
{
|
|
|
|
// No more patrons. Move to the next credits section
|
|
|
|
game.current_credits_list_index = 0;
|
|
|
|
game.createmenu("credits5");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// There are more patrons. Refresh the menu with the next ones
|
|
|
|
game.createmenu("credits4");
|
|
|
|
}
|
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-02-12 05:45:58 +01:00
|
|
|
game.current_credits_list_index = 0;
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "credits5")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//next page
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-02-12 05:45:58 +01:00
|
|
|
game.current_credits_list_index += 9;
|
|
|
|
|
|
|
|
if (game.current_credits_list_index >= (int)game.githubfriends.size())
|
|
|
|
{
|
|
|
|
// No more GitHub contributors. Move to the next credits section
|
|
|
|
game.current_credits_list_index = 0;
|
|
|
|
game.createmenu("credits6");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// There are more GitHub contributors. Refresh the menu with the next ones
|
|
|
|
game.createmenu("credits5");
|
|
|
|
}
|
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-02-12 05:45:58 +01:00
|
|
|
game.current_credits_list_index = 0;
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "credits6")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//first page
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("credits");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
music.niceplay(6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "play")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//continue
|
|
|
|
//right, this depends on what saves you've got
|
|
|
|
if (game.telesummary == "")
|
|
|
|
{
|
|
|
|
//You at least have a quicksave, or you couldn't have gotten here
|
|
|
|
game.mainmenu = 2;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.quicksummary == "")
|
|
|
|
{
|
|
|
|
//You at least have a telesave, or you couldn't have gotten here
|
|
|
|
game.mainmenu = 1;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//go to a menu!
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-03-31 02:16:02 +02:00
|
|
|
game.loadsummary(); //Prepare save slots to display
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("continue");
|
|
|
|
map.settowercolour(3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
|
|
|
//play modes
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("playmodes");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2)
|
|
|
|
{
|
|
|
|
//newgame
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("newgamewarning");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 3)
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "playsecretlab")
|
|
|
|
{
|
|
|
|
//as above, except with an extra option...
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//continue
|
|
|
|
//right, this depends on what saves you've got
|
|
|
|
if (game.telesummary == "")
|
|
|
|
{
|
|
|
|
//You at least have a quicksave, or you couldn't have gotten here
|
|
|
|
game.mainmenu = 2;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.quicksummary == "")
|
|
|
|
{
|
|
|
|
//You at least have a telesave, or you couldn't have gotten here
|
|
|
|
game.mainmenu = 1;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//go to a menu!
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-03-31 02:16:02 +02:00
|
|
|
game.loadsummary(); //Prepare save slots to display
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("continue");
|
|
|
|
map.settowercolour(3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
2020-04-02 23:06:56 +02:00
|
|
|
if(!map.invincibility){
|
|
|
|
game.mainmenu = 11;
|
|
|
|
graphics.fademode = 2;
|
|
|
|
}else{
|
|
|
|
//Can't do yet! play sad sound
|
|
|
|
music.playef(2);
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2)
|
|
|
|
{
|
|
|
|
//play modes
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("playmodes");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 3)
|
|
|
|
{
|
|
|
|
//newgame
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("newgamewarning");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 4)
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "newgamewarning")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//yep
|
|
|
|
game.mainmenu = 0;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
game.deletequick();
|
|
|
|
game.deletetele();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("play");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
else if (game.currentmenuname == "controller")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
game.controllerSensitivity++;
|
|
|
|
music.playef(11);
|
|
|
|
if(game.controllerSensitivity > 4)
|
|
|
|
{
|
|
|
|
game.controllerSensitivity = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (game.currentmenuoption == 4)
|
|
|
|
{
|
|
|
|
music.playef(11);
|
|
|
|
game.createmenu("options");
|
|
|
|
|
|
|
|
//Add extra menu for mmmmmm mod
|
|
|
|
if(music.mmmmmm){
|
|
|
|
#if defined(MAKEANDPLAY)
|
|
|
|
game.menuoptions[3] = "soundtrack";
|
|
|
|
game.menuoptionsactive[3] = true;
|
|
|
|
game.menuoptions[4] = "return";
|
|
|
|
game.menuoptionsactive[4] = true;
|
|
|
|
game.nummenuoptions = 5;
|
|
|
|
#elif !defined(MAKEANDPLAY)
|
|
|
|
game.menuoptions[4] = "soundtrack";
|
|
|
|
game.menuoptionsactive[4] = true;
|
|
|
|
game.menuoptions[5] = "return";
|
|
|
|
game.menuoptionsactive[5] = true;
|
|
|
|
game.nummenuoptions = 6;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
else if (game.currentmenuname == "cleardatamenu")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("options");
|
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
//Add extra menu for mmmmmm mod
|
|
|
|
if(music.mmmmmm){
|
|
|
|
#if defined(MAKEANDPLAY)
|
|
|
|
game.menuoptions[3] = "soundtrack";
|
|
|
|
game.menuoptionsactive[3] = true;
|
|
|
|
game.menuoptions[4] = "return";
|
|
|
|
game.menuoptionsactive[4] = true;
|
|
|
|
game.nummenuoptions = 5;
|
|
|
|
#elif !defined(MAKEANDPLAY)
|
|
|
|
game.menuoptions[4] = "soundtrack";
|
|
|
|
game.menuoptionsactive[4] = true;
|
|
|
|
game.menuoptions[5] = "return";
|
|
|
|
game.menuoptionsactive[5] = true;
|
|
|
|
game.nummenuoptions = 6;
|
|
|
|
#endif
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//yep
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(23);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.deletequick();
|
|
|
|
game.deletetele();
|
2020-03-31 02:16:02 +02:00
|
|
|
game.deletestats();
|
2020-01-01 21:29:24 +01:00
|
|
|
game.flashlight = 5;
|
|
|
|
game.screenshake = 15;
|
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "playmodes")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0 && game.slowdown == 30 && !map.invincibility) //go to the time trial menu
|
|
|
|
{
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("timetrials");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1 && game.unlock[16])
|
|
|
|
{
|
|
|
|
//intermission mode menu
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("intermissionmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2 && game.unlock[17] && game.slowdown == 30 && !map.invincibility) //start a game in no death mode
|
|
|
|
{
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("startnodeathmode");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 3 && game.unlock[18]) //enable/disable flip mode
|
|
|
|
{
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(18);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.screenshake = 10;
|
|
|
|
game.flashlight = 5;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.setflipmode = !graphics.setflipmode;
|
2020-01-01 21:29:24 +01:00
|
|
|
game.savemystats = true;
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 4)
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("play");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Can't do yet! play sad sound
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(2);
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "startnodeathmode")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0) //start no death mode, disabling cutscenes
|
|
|
|
{
|
|
|
|
game.mainmenu = 10;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
|
|
|
game.mainmenu = 9;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2)
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("play");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "continue")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
game.mainmenu = 1;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
|
|
|
game.mainmenu = 2;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2)
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("play");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "intermissionmenu")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
music.play(6);
|
|
|
|
game.createmenu("playint1");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
music.play(6);
|
|
|
|
game.createmenu("playint2");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2)
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("play");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "playint1")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
game.mainmenu = 12;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
|
|
|
game.mainmenu = 13;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2)
|
|
|
|
{
|
|
|
|
game.mainmenu = 14;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 3)
|
|
|
|
{
|
|
|
|
game.mainmenu = 15;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 4)
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("play");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "playint2")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
game.mainmenu = 16;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
|
|
|
game.mainmenu = 17;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2)
|
|
|
|
{
|
|
|
|
game.mainmenu = 18;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 3)
|
|
|
|
{
|
|
|
|
game.mainmenu = 19;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 4)
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("play");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "gameover2")
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
music.play(6);
|
|
|
|
game.createmenu("mainmenu");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "unlocktimetrials" || game.currentmenuname == "unlocktimetrial")
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("play");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "unlocknodeathmode" || game.currentmenuname == "unlockintermission"
|
|
|
|
|| game.currentmenuname == "unlockflipmode")
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("play");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "timetrials")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0 && game.unlock[9]) //space station 1
|
|
|
|
{
|
|
|
|
game.mainmenu = 3;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1 && game.unlock[10]) //lab
|
|
|
|
{
|
|
|
|
game.mainmenu = 4;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 2 && game.unlock[11]) //tower
|
|
|
|
{
|
|
|
|
game.mainmenu = 5;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 3 && game.unlock[12]) //station 2
|
|
|
|
{
|
|
|
|
game.mainmenu = 6;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 4 && game.unlock[13]) //warp
|
|
|
|
{
|
|
|
|
game.mainmenu = 7;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 5 && game.unlock[14]) //final
|
|
|
|
{
|
|
|
|
game.mainmenu = 8;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 6) //go to the time trial menu
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("play");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Can't do yet! play sad sound
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(2);
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "timetrialcomplete3")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
//back
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
music.play(6);
|
|
|
|
game.createmenu("play");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
else if (game.currentmenuoption == 1)
|
|
|
|
{
|
|
|
|
//duplicate the above based on given time trial level!
|
|
|
|
if (game.timetriallevel == 0) //space station 1
|
|
|
|
{
|
|
|
|
game.mainmenu = 3;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.timetriallevel == 1) //lab
|
|
|
|
{
|
|
|
|
game.mainmenu = 4;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.timetriallevel == 2) //tower
|
|
|
|
{
|
|
|
|
game.mainmenu = 5;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.timetriallevel == 3) //station 2
|
|
|
|
{
|
|
|
|
game.mainmenu = 6;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.timetriallevel == 4) //warp
|
|
|
|
{
|
|
|
|
game.mainmenu = 7;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else if (game.timetriallevel == 5) //final
|
|
|
|
{
|
|
|
|
game.mainmenu = 8;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.currentmenuname == "gamecompletecontinue" || game.currentmenuname == "nodeathmodecomplete2")
|
|
|
|
{
|
|
|
|
if (game.currentmenuoption == 0)
|
|
|
|
{
|
|
|
|
music.play(6);
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(11);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.createmenu("play");
|
|
|
|
map.nexttowercolour();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( game.currentmenuname == "controller" &&
|
|
|
|
game.currentmenuoption > 0 &&
|
|
|
|
game.currentmenuoption < 4 &&
|
|
|
|
key.controllerButtonDown() )
|
|
|
|
{
|
2020-04-01 23:52:45 +02:00
|
|
|
updatebuttonmappings(game.currentmenuoption);
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
if (graphics.fademode == 1)
|
2020-03-31 21:38:52 +02:00
|
|
|
script.startgamemode(game.mainmenu);
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
void gameinput()
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
//TODO mouse input
|
|
|
|
//game.mx = (mouseX / 2);
|
|
|
|
//game.my = (mouseY / 2);
|
|
|
|
|
|
|
|
if(!script.running)
|
|
|
|
{
|
|
|
|
game.press_left = false;
|
|
|
|
game.press_right = false;
|
|
|
|
game.press_action = false;
|
|
|
|
game.press_map = false;
|
|
|
|
|
2020-04-03 02:59:08 +02:00
|
|
|
if (key.isDown(KEYBOARD_LEFT) || key.isDown(KEYBOARD_a) || key.controllerWantsLeft(false))
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
2020-04-03 02:59:08 +02:00
|
|
|
game.press_left = true;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
2020-04-03 02:59:08 +02:00
|
|
|
if (key.isDown(KEYBOARD_RIGHT) || key.isDown(KEYBOARD_d) || key.controllerWantsRight(false))
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
2020-04-03 02:59:08 +02:00
|
|
|
game.press_right = true;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
2020-04-03 02:59:08 +02:00
|
|
|
if (key.isDown(KEYBOARD_z) || key.isDown(KEYBOARD_SPACE) || key.isDown(KEYBOARD_v)
|
|
|
|
|| key.isDown(KEYBOARD_UP) || key.isDown(KEYBOARD_DOWN) || key.isDown(KEYBOARD_w) || key.isDown(KEYBOARD_s)|| key.isDown(game.controllerButton_flip))
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
2020-04-03 02:59:08 +02:00
|
|
|
game.press_action = true;
|
|
|
|
};
|
|
|
|
if (key.isDown(KEYBOARD_ENTER) || key.isDown(SDLK_KP_ENTER) || key.isDown(game.controllerButton_map) )
|
|
|
|
{
|
|
|
|
game.press_map = true;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
2020-04-03 02:59:08 +02:00
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
if (game.advancetext)
|
|
|
|
{
|
|
|
|
if (game.pausescript)
|
|
|
|
{
|
|
|
|
game.press_action = false;
|
|
|
|
if (key.isDown(KEYBOARD_z) || key.isDown(KEYBOARD_SPACE) || key.isDown(KEYBOARD_v)
|
|
|
|
|| key.isDown(KEYBOARD_UP) || key.isDown(KEYBOARD_DOWN) || key.isDown(KEYBOARD_w) || key.isDown(KEYBOARD_s) || key.isDown(game.controllerButton_flip)) game.press_action = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (game.press_action && !game.jumpheld)
|
|
|
|
{
|
|
|
|
if (game.pausescript)
|
|
|
|
{
|
|
|
|
game.pausescript = false;
|
|
|
|
game.hascontrol = true;
|
|
|
|
game.jumpheld = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-04-02 23:06:56 +02:00
|
|
|
if(!game.glitchrunkludge) game.state++;
|
|
|
|
game.jumpheld = true;
|
|
|
|
game.glitchrunkludge=true;
|
|
|
|
//Bug fix! You should only be able to do this ONCE.
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!game.press_map) game.mapheld = false;
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
if (game.intimetrial && graphics.fademode == 1 && game.quickrestartkludge)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
//restart the time trial
|
|
|
|
game.quickrestartkludge = false;
|
2020-03-31 21:38:52 +02:00
|
|
|
script.startgamemode(game.timetriallevel + 3);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.deathseq = -1;
|
|
|
|
game.completestop = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Returning to editor mode must always be possible
|
2020-02-10 03:21:19 +01:00
|
|
|
#if !defined(NO_CUSTOM_LEVELS)
|
2020-01-01 21:29:24 +01:00
|
|
|
if(map.custommode && !map.custommodeforreal){
|
|
|
|
if ((game.press_map || key.isDown(27)) && !game.mapheld){
|
|
|
|
game.mapheld = true;
|
|
|
|
//Return to level editor
|
|
|
|
if (game.activeactivity > -1 && game.press_map){
|
|
|
|
if((int(std::abs(obj.entities[obj.getplayer()].vx))<=1) && (int(obj.entities[obj.getplayer()].vy) == 0) )
|
|
|
|
{
|
|
|
|
script.load(obj.blocks[game.activeactivity].script);
|
|
|
|
obj.removeblock(game.activeactivity);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
game.gamestate = EDITORMODE;
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.textboxremove();
|
2020-01-01 21:29:24 +01:00
|
|
|
game.hascontrol = true;
|
|
|
|
game.advancetext = false;
|
|
|
|
game.completestop = false;
|
|
|
|
game.state = 0;
|
2020-04-02 23:06:56 +02:00
|
|
|
graphics.showcutscenebars = false;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.backgrounddrawn=false;
|
2020-01-01 21:29:24 +01:00
|
|
|
music.fadeout();
|
2020-01-31 04:06:16 +01:00
|
|
|
//If warpdir() is used during playtesting, we need to set it back after!
|
|
|
|
for (int j = 0; j < ed.maxheight; j++)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < ed.maxwidth; i++)
|
|
|
|
{
|
|
|
|
ed.level[i+(j*ed.maxwidth)].warpdir=ed.kludgewarpdir[i+(j*ed.maxwidth)];
|
|
|
|
}
|
|
|
|
}
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-02-10 01:53:01 +01:00
|
|
|
#endif
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
//Entity type 0 is player controled
|
|
|
|
for (int ie = 0; ie < obj.nentity; ++ie)
|
|
|
|
{
|
|
|
|
if (obj.entities[ie].rule == 0)
|
|
|
|
{
|
|
|
|
if (game.hascontrol && game.deathseq == -1 && game.lifeseq <= 5)
|
|
|
|
{
|
|
|
|
if (game.press_map && !game.mapheld)
|
|
|
|
{
|
|
|
|
game.mapheld = true;
|
|
|
|
|
|
|
|
if (game.activetele && game.readytotele > 20 && !game.intimetrial)
|
|
|
|
{
|
2020-04-01 23:52:45 +02:00
|
|
|
if(!graphics.flipmode)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
obj.flags[73] = 1; //Flip mode test
|
|
|
|
}
|
|
|
|
if(int(std::abs(obj.entities[ie].vx))<=1 && int(obj.entities[ie].vy)==0)
|
|
|
|
{
|
|
|
|
//wait! space station 2 debug thingy
|
|
|
|
if (game.teleportscript != "")
|
|
|
|
{
|
|
|
|
|
|
|
|
//trace(game.recordstring);
|
|
|
|
//We're teleporting! Yey!
|
|
|
|
game.activetele = false;
|
|
|
|
game.hascontrol = false;
|
2020-04-03 02:59:08 +02:00
|
|
|
music.fadeout();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
int player = obj.getplayer();
|
|
|
|
obj.entities[player].colour = 102;
|
|
|
|
|
|
|
|
int teleporter = obj.getteleporter();
|
|
|
|
obj.entities[teleporter].tile = 6;
|
|
|
|
obj.entities[teleporter].colour = 102;
|
|
|
|
//which teleporter script do we use? it depends on the companion!
|
|
|
|
game.state = 4000;
|
|
|
|
game.statedelay = 0;
|
|
|
|
}
|
|
|
|
else if (game.companion == 0)
|
|
|
|
{
|
|
|
|
//Alright, normal teleporting
|
|
|
|
game.gamestate = 5;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.menuoffset = 240; //actually this should count the roomname
|
|
|
|
if (map.extrarow) graphics.menuoffset -= 10;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.resumegamemode = false;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
game.useteleporter = true;
|
2020-03-31 02:16:02 +02:00
|
|
|
game.initteleportermode();
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//We're teleporting! Yey!
|
|
|
|
game.activetele = false;
|
|
|
|
game.hascontrol = false;
|
2020-04-03 02:59:08 +02:00
|
|
|
music.fadeout();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
int player = obj.getplayer();
|
|
|
|
obj.entities[player].colour = 102;
|
2020-04-02 00:32:21 +02:00
|
|
|
int companion = obj.getcompanion();
|
2020-01-01 21:29:24 +01:00
|
|
|
if(companion>-1) obj.entities[companion].colour = 102;
|
|
|
|
|
|
|
|
int teleporter = obj.getteleporter();
|
|
|
|
obj.entities[teleporter].tile = 6;
|
|
|
|
obj.entities[teleporter].colour = 102;
|
|
|
|
//which teleporter script do we use? it depends on the companion!
|
|
|
|
game.state = 3000;
|
|
|
|
game.statedelay = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.activeactivity > -1)
|
|
|
|
{
|
|
|
|
if((int(std::abs(obj.entities[ie].vx))<=1) && (int(obj.entities[ie].vy) == 0) )
|
|
|
|
{
|
|
|
|
script.load(obj.blocks[game.activeactivity].script);
|
|
|
|
obj.removeblock(game.activeactivity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.swnmode == 1 && game.swngame == 1)
|
|
|
|
{
|
|
|
|
//quitting the super gravitron
|
|
|
|
game.mapheld = true;
|
|
|
|
//Quit menu, same conditions as in game menu
|
|
|
|
game.gamestate = MAPMODE;
|
|
|
|
game.gamesaved = false;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.resumegamemode = false;
|
2020-01-01 21:29:24 +01:00
|
|
|
game.menupage = 20; // The Map Page
|
2020-04-02 23:06:56 +02:00
|
|
|
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.menuoffset = 240; //actually this should count the roomname
|
|
|
|
if (map.extrarow) graphics.menuoffset -= 10;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
2020-04-01 23:52:45 +02:00
|
|
|
else if (game.intimetrial && graphics.fademode==0)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
//Quick restart of time trial
|
2020-03-31 21:38:52 +02:00
|
|
|
script.hardreset();
|
2020-04-01 23:52:45 +02:00
|
|
|
if (graphics.setflipmode) graphics.flipmode = true;
|
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
game.completestop = true;
|
|
|
|
music.fadeout();
|
|
|
|
game.intimetrial = true;
|
|
|
|
game.quickrestartkludge = true;
|
|
|
|
}
|
2020-04-01 23:52:45 +02:00
|
|
|
else if (graphics.fademode==0)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
//Normal map screen, do transition later
|
|
|
|
game.gamestate = MAPMODE;
|
|
|
|
map.cursordelay = 0;
|
|
|
|
map.cursorstate = 0;
|
|
|
|
game.gamesaved = false;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.resumegamemode = false;
|
2020-01-01 21:29:24 +01:00
|
|
|
game.menupage = 0; // The Map Page
|
2020-04-02 23:06:56 +02:00
|
|
|
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.menuoffset = 240; //actually this should count the roomname
|
|
|
|
if (map.extrarow) graphics.menuoffset -= 10;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((key.isDown(27) || key.isDown(game.controllerButton_esc)) && (!map.custommode || map.custommodeforreal))
|
|
|
|
{
|
|
|
|
game.mapheld = true;
|
|
|
|
//Quit menu, same conditions as in game menu
|
|
|
|
game.gamestate = MAPMODE;
|
|
|
|
game.gamesaved = false;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.resumegamemode = false;
|
2020-01-01 21:29:24 +01:00
|
|
|
game.menupage = 10; // The Map Page
|
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.menuoffset = 240; //actually this should count the roomname
|
|
|
|
if (map.extrarow) graphics.menuoffset -= 10;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (key.keymap[SDLK_r] && game.deathseq<=0)// && map.custommode) //Have fun glitchrunners!
|
|
|
|
{
|
2020-04-02 23:06:56 +02:00
|
|
|
game.deathseq = 30;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (game.press_left)
|
|
|
|
{
|
|
|
|
game.tapleft++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (game.tapleft <= 4 && game.tapleft > 0)
|
|
|
|
{
|
|
|
|
if (obj.entities[ie].vx < 0.0f)
|
|
|
|
{
|
|
|
|
obj.entities[ie].vx = 0.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
game.tapleft = 0;
|
|
|
|
}
|
|
|
|
if (game.press_right)
|
|
|
|
{
|
|
|
|
game.tapright++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (game.tapright <= 4 && game.tapright > 0)
|
|
|
|
{
|
|
|
|
if (obj.entities[ie].vx > 0.0f)
|
|
|
|
{
|
|
|
|
obj.entities[ie].vx = 0.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
game.tapright = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(game.press_left)
|
|
|
|
{
|
|
|
|
obj.entities[ie].ax = -3;
|
|
|
|
obj.entities[ie].dir = 0;
|
|
|
|
}
|
|
|
|
else if (game.press_right)
|
|
|
|
{
|
|
|
|
obj.entities[ie].ax = 3;
|
|
|
|
obj.entities[ie].dir = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!game.press_action)
|
|
|
|
{
|
|
|
|
game.jumppressed = 0;
|
|
|
|
game.jumpheld = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (game.press_action && !game.jumpheld)
|
|
|
|
{
|
|
|
|
game.jumppressed = 5;
|
|
|
|
game.jumpheld = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (game.jumppressed > 0)
|
|
|
|
{
|
|
|
|
game.jumppressed--;
|
|
|
|
if (obj.entities[ie].onground>0 && game.gravitycontrol == 0)
|
|
|
|
{
|
|
|
|
game.gravitycontrol = 1;
|
|
|
|
obj.entities[ie].vy = -4;
|
|
|
|
obj.entities[ie].ay = -3;
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(0);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.jumppressed = 0;
|
|
|
|
game.totalflips++;
|
|
|
|
}
|
|
|
|
if (obj.entities[ie].onroof>0 && game.gravitycontrol == 1)
|
|
|
|
{
|
|
|
|
game.gravitycontrol = 0;
|
|
|
|
obj.entities[ie].vy = 4;
|
|
|
|
obj.entities[ie].ay = 3;
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(1);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.jumppressed = 0;
|
|
|
|
game.totalflips++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//Simple detection of keypresses outside player control, will probably scrap this (expand on
|
|
|
|
//advance text function)
|
|
|
|
if (!game.press_action)
|
|
|
|
{
|
|
|
|
game.jumppressed = 0;
|
|
|
|
game.jumpheld = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (game.press_action && !game.jumpheld)
|
|
|
|
{
|
|
|
|
game.jumppressed = 5;
|
|
|
|
game.jumpheld = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
void mapinput()
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
//TODO Mouse Input!
|
|
|
|
//game.mx = (mouseX / 2);
|
|
|
|
//game.my = (mouseY / 2);
|
|
|
|
|
|
|
|
game.press_left = false;
|
|
|
|
game.press_right = false;
|
|
|
|
game.press_action = false;
|
|
|
|
game.press_map = false;
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
if(graphics.menuoffset==0)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
2020-04-01 23:52:45 +02:00
|
|
|
if (graphics.flipmode)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
if (key.isDown(KEYBOARD_LEFT) || key.isDown(KEYBOARD_DOWN) || key.isDown(KEYBOARD_a) || key.isDown(KEYBOARD_s) || key.controllerWantsLeft(false) ) game.press_left = true;
|
|
|
|
if (key.isDown(KEYBOARD_RIGHT) || key.isDown(KEYBOARD_UP) || key.isDown(KEYBOARD_d) || key.isDown(KEYBOARD_w) || key.controllerWantsRight(false)) game.press_right = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (key.isDown(KEYBOARD_LEFT) || key.isDown(KEYBOARD_UP) || key.isDown(KEYBOARD_a) || key.isDown(KEYBOARD_w)|| key.controllerWantsLeft(false))
|
|
|
|
{
|
|
|
|
game.press_left = true;
|
|
|
|
}
|
|
|
|
if (key.isDown(KEYBOARD_RIGHT) || key.isDown(KEYBOARD_DOWN) || key.isDown(KEYBOARD_d) || key.isDown(KEYBOARD_s)|| key.controllerWantsRight(false))
|
|
|
|
{
|
|
|
|
game.press_right = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (key.isDown(KEYBOARD_z) || key.isDown(KEYBOARD_SPACE) || key.isDown(KEYBOARD_v) || key.isDown(game.controllerButton_flip))
|
|
|
|
{
|
|
|
|
game.press_action = true;
|
|
|
|
}
|
|
|
|
if (game.menupage < 9)
|
|
|
|
{
|
|
|
|
if (key.isDown(KEYBOARD_ENTER) || key.isDown(game.controllerButton_map) ) game.press_map = true;
|
|
|
|
if (key.isDown(27))
|
|
|
|
{
|
|
|
|
game.mapheld = true;
|
|
|
|
game.menupage = 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (key.isDown(KEYBOARD_ENTER) || key.isDown(27)|| key.isDown(game.controllerButton_map) ) game.press_map = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//In the menu system, all keypresses are single taps rather than holds. Therefore this test has to be done for all presses
|
|
|
|
if (!game.press_action && !game.press_left && !game.press_right)
|
|
|
|
{
|
|
|
|
game.jumpheld = false;
|
|
|
|
}
|
|
|
|
if (!game.press_map && !key.isDown(27))
|
|
|
|
{
|
|
|
|
game.mapheld = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
game.mapheld = true;
|
|
|
|
game.jumpheld = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!game.mapheld)
|
|
|
|
{
|
|
|
|
if(game.press_map && game.menupage < 10)
|
|
|
|
{
|
|
|
|
//Normal map screen, do transition later
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.resumegamemode = true;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
if (graphics.fademode == 1)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
2020-04-01 23:52:45 +02:00
|
|
|
FillRect(graphics.menubuffer, 0x000000);
|
|
|
|
graphics.resumegamemode = true;
|
2020-01-01 21:29:24 +01:00
|
|
|
obj.removeallblocks();
|
|
|
|
game.menukludge = false;
|
|
|
|
if (game.menupage >= 20)
|
|
|
|
{
|
|
|
|
game.state = 96;
|
|
|
|
game.statedelay = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
game.state = 80;
|
|
|
|
game.statedelay = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!game.jumpheld)
|
|
|
|
{
|
|
|
|
if (game.press_action || game.press_left || game.press_right || game.press_map)
|
|
|
|
{
|
|
|
|
game.jumpheld = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (game.press_left)
|
|
|
|
{
|
|
|
|
game.menupage--;
|
|
|
|
}
|
|
|
|
else if (game.press_right)
|
|
|
|
{
|
|
|
|
game.menupage++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (game.menupage == 1 && obj.flags[67] == 1 && game.press_action && !game.insecretlab && !map.custommode)
|
|
|
|
{
|
|
|
|
//Warp back to the ship
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.resumegamemode = true;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
game.teleport_to_x = 2;
|
|
|
|
game.teleport_to_y = 11;
|
|
|
|
|
|
|
|
//trace(game.recordstring);
|
|
|
|
//We're teleporting! Yey!
|
|
|
|
game.activetele = false;
|
|
|
|
game.hascontrol = false;
|
|
|
|
|
|
|
|
int i = obj.getplayer();
|
|
|
|
obj.entities[i].colour = 102;
|
|
|
|
|
|
|
|
//which teleporter script do we use? it depends on the companion!
|
|
|
|
game.state = 4000;
|
|
|
|
game.statedelay = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (game.menupage == 3 && !game.gamesaved && game.press_action && !game.intimetrial
|
|
|
|
&& !game.nodeathmode && !game.insecretlab && !game.inintermission)
|
|
|
|
{
|
|
|
|
game.flashlight = 5;
|
|
|
|
game.screenshake = 10;
|
2020-04-02 01:36:35 +02:00
|
|
|
music.playef(18);
|
2020-01-01 21:29:24 +01:00
|
|
|
game.gamesaved = true;
|
|
|
|
|
2020-03-31 02:16:02 +02:00
|
|
|
game.savetime = game.timestring();
|
2020-01-01 21:29:24 +01:00
|
|
|
game.savearea = map.currentarea(map.area(game.roomx, game.roomy));
|
|
|
|
game.savetrinkets = game.trinkets;
|
|
|
|
|
|
|
|
if (game.roomx >= 102 && game.roomx <= 104 && game.roomy >= 110 && game.roomy <= 111) game.savearea = "The Ship";
|
|
|
|
|
2020-04-02 23:06:56 +02:00
|
|
|
#if !defined(NO_CUSTOM_LEVELS)
|
2020-02-10 01:53:01 +01:00
|
|
|
if(map.custommodeforreal)
|
|
|
|
{
|
2020-04-02 23:06:56 +02:00
|
|
|
game.customsavequick(ed.ListOfMetaData[game.playcustomlevel].filename);
|
2020-02-10 01:53:01 +01:00
|
|
|
}
|
|
|
|
else
|
2020-04-02 23:06:56 +02:00
|
|
|
#endif
|
2020-02-10 01:53:01 +01:00
|
|
|
{
|
2020-04-02 23:06:56 +02:00
|
|
|
game.savequick();
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (game.menupage == 10 && game.press_action)
|
|
|
|
{
|
|
|
|
//return to game
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.resumegamemode = true;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
if (game.menupage == 11 && game.press_action)
|
|
|
|
{
|
|
|
|
//quit to menu
|
2020-04-01 23:52:45 +02:00
|
|
|
if (graphics.fademode == 0)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
2020-04-02 23:06:56 +02:00
|
|
|
//Kill contents of offset render buffer, since we do that for some reason.
|
|
|
|
//This fixes an apparent frame flicker.
|
|
|
|
FillRect(graphics.tempBuffer, 0x000000);
|
2020-01-01 21:29:24 +01:00
|
|
|
if (game.intimetrial || game.insecretlab || game.nodeathmode) game.menukludge = true;
|
2020-03-31 21:38:52 +02:00
|
|
|
script.hardreset();
|
2020-04-01 23:52:45 +02:00
|
|
|
if(graphics.setflipmode) graphics.flipmode = true;
|
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
music.fadeout();
|
2020-01-23 02:20:32 +01:00
|
|
|
map.nexttowercolour();
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (game.menupage == 20 && game.press_action)
|
|
|
|
{
|
|
|
|
//return to game
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.resumegamemode = true;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
if (game.menupage == 21 && game.press_action)
|
|
|
|
{
|
|
|
|
//quit to menu
|
2020-04-01 23:52:45 +02:00
|
|
|
if (graphics.fademode == 0)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
game.swnmode = false;
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
music.fadeout();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (game.menupage < 0) game.menupage = 3;
|
|
|
|
if (game.menupage > 3 && game.menupage < 9) game.menupage = 0;
|
|
|
|
|
|
|
|
if (game.menupage == 9) game.menupage = 11;
|
|
|
|
if (game.menupage == 12) game.menupage = 10;
|
|
|
|
|
|
|
|
if (game.menupage == 19) game.menupage = 21;
|
|
|
|
if (game.menupage == 22) game.menupage = 20;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
void teleporterinput()
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
//Todo Mouseinput!
|
|
|
|
//game.mx = (mouseX / 2);
|
|
|
|
//game.my = (mouseY / 2);
|
|
|
|
|
|
|
|
int tempx, tempy;
|
|
|
|
|
|
|
|
game.press_left = false;
|
|
|
|
game.press_right = false;
|
|
|
|
game.press_action = false;
|
|
|
|
game.press_map = false;
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
if(graphics.menuoffset==0)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
if (key.isDown(KEYBOARD_LEFT)|| key.isDown(KEYBOARD_a) || key.controllerWantsLeft(false) ) game.press_left = true;
|
|
|
|
if (key.isDown(KEYBOARD_RIGHT) || key.isDown(KEYBOARD_d)|| key.controllerWantsRight(false) ) game.press_right = true;
|
|
|
|
if (key.isDown(KEYBOARD_z) || key.isDown(KEYBOARD_SPACE) || key.isDown(KEYBOARD_v)
|
|
|
|
|| key.isDown(KEYBOARD_UP) || key.isDown(KEYBOARD_DOWN)|| key.isDown(KEYBOARD_w)|| key.isDown(KEYBOARD_s) || key.isDown(game.controllerButton_flip)) game.press_action = true;
|
|
|
|
if (key.isDown(KEYBOARD_ENTER) || key.isDown(game.controllerButton_map)) game.press_map = true;
|
|
|
|
|
|
|
|
//In the menu system, all keypresses are single taps rather than holds. Therefore this test has to be done for all presses
|
|
|
|
if (!game.press_action && !game.press_left && !game.press_right) game.jumpheld = false;
|
|
|
|
if (!game.press_map) game.mapheld = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
game.mapheld = true;
|
|
|
|
game.jumpheld = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!game.jumpheld)
|
|
|
|
{
|
|
|
|
if (game.press_action || game.press_left || game.press_right || game.press_map)
|
|
|
|
{
|
|
|
|
game.jumpheld = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (game.press_left)
|
|
|
|
{
|
|
|
|
game.teleport_to_teleporter--;
|
|
|
|
if (game.teleport_to_teleporter < 0) game.teleport_to_teleporter = map.numteleporters - 1;
|
|
|
|
tempx = map.teleporters[game.teleport_to_teleporter].x;
|
|
|
|
tempy = map.teleporters[game.teleport_to_teleporter].y;
|
|
|
|
while (map.explored[tempx + (20 * tempy)] == 0)
|
|
|
|
{
|
|
|
|
game.teleport_to_teleporter--;
|
|
|
|
if (game.teleport_to_teleporter < 0) game.teleport_to_teleporter = map.numteleporters - 1;
|
|
|
|
tempx = map.teleporters[game.teleport_to_teleporter].x;
|
|
|
|
tempy = map.teleporters[game.teleport_to_teleporter].y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (game.press_right)
|
|
|
|
{
|
|
|
|
game.teleport_to_teleporter++;
|
|
|
|
if (game.teleport_to_teleporter >= map.numteleporters) game.teleport_to_teleporter = 0;
|
|
|
|
tempx = map.teleporters[game.teleport_to_teleporter].x;
|
|
|
|
tempy = map.teleporters[game.teleport_to_teleporter].y;
|
|
|
|
while (map.explored[tempx + (20 * tempy)] == 0)
|
|
|
|
{
|
|
|
|
game.teleport_to_teleporter++;
|
|
|
|
if (game.teleport_to_teleporter >= map.numteleporters) game.teleport_to_teleporter = 0;
|
|
|
|
tempx = map.teleporters[game.teleport_to_teleporter].x;
|
|
|
|
tempy = map.teleporters[game.teleport_to_teleporter].y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (game.press_map)
|
|
|
|
{
|
|
|
|
tempx = map.teleporters[game.teleport_to_teleporter].x;
|
|
|
|
tempy = map.teleporters[game.teleport_to_teleporter].y;
|
|
|
|
if (game.roomx == tempx + 100 && game.roomy == tempy + 100)
|
|
|
|
{
|
|
|
|
//cancel!
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.resumegamemode = true;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//teleport
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.resumegamemode = true;
|
2020-01-01 21:29:24 +01:00
|
|
|
game.teleport_to_x = tempx;
|
|
|
|
game.teleport_to_y = tempy;
|
|
|
|
|
|
|
|
//trace(game.recordstring);
|
|
|
|
//We're teleporting! Yey!
|
|
|
|
game.activetele = false;
|
|
|
|
game.hascontrol = false;
|
|
|
|
|
|
|
|
int i = obj.getplayer();
|
|
|
|
obj.entities[i].colour = 102;
|
|
|
|
|
|
|
|
i = obj.getteleporter();
|
|
|
|
obj.entities[i].tile = 6;
|
|
|
|
obj.entities[i].colour = 102;
|
|
|
|
//which teleporter script do we use? it depends on the companion!
|
|
|
|
game.state = 4000;
|
|
|
|
game.statedelay = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
void gamecompleteinput()
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
game.press_left = false;
|
|
|
|
game.press_right = false;
|
|
|
|
game.press_action = false;
|
|
|
|
game.press_map = false;
|
|
|
|
|
|
|
|
if (key.isDown(KEYBOARD_z) || key.isDown(KEYBOARD_SPACE) || key.isDown(KEYBOARD_v) || key.isDown(game.controllerButton_flip))
|
|
|
|
{
|
|
|
|
game.creditposition -= 6;
|
2020-01-17 02:14:56 +01:00
|
|
|
if (game.creditposition <= -game.creditmaxposition)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
2020-04-01 23:52:45 +02:00
|
|
|
if(graphics.fademode==0)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
2020-01-17 02:14:56 +01:00
|
|
|
game.creditposition = -game.creditmaxposition;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
map.bypos += 6;
|
|
|
|
map.bscroll = +6;
|
|
|
|
}
|
|
|
|
game.press_action = true;
|
|
|
|
}
|
|
|
|
if (key.isDown(KEYBOARD_ENTER)|| key.isDown(game.controllerButton_map)) game.press_map = true;
|
|
|
|
|
|
|
|
if (!game.mapheld)
|
|
|
|
{
|
|
|
|
if(game.press_map)
|
|
|
|
{
|
|
|
|
//Return to game
|
2020-04-01 23:52:45 +02:00
|
|
|
if(graphics.fademode==0)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-01 23:52:45 +02:00
|
|
|
void gamecompleteinput2()
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
|
|
|
game.press_left = false;
|
|
|
|
game.press_right = false;
|
|
|
|
game.press_action = false;
|
|
|
|
game.press_map = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (key.isDown(KEYBOARD_z) || key.isDown(KEYBOARD_SPACE) || key.isDown(KEYBOARD_v) || key.isDown(game.controllerButton_flip))
|
|
|
|
{
|
|
|
|
game.creditposx++;
|
|
|
|
if (game.creditposy >= 30)
|
|
|
|
{
|
2020-04-01 23:52:45 +02:00
|
|
|
if(graphics.fademode==0)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
music.fadeout();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
game.press_action = true;
|
|
|
|
}
|
|
|
|
if (key.isDown(KEYBOARD_ENTER) || key.isDown(game.controllerButton_map)) game.press_map = true;
|
|
|
|
|
|
|
|
if (!game.mapheld)
|
|
|
|
{
|
|
|
|
if(game.press_map)
|
|
|
|
{
|
|
|
|
//Return to game
|
2020-04-01 23:52:45 +02:00
|
|
|
if(graphics.fademode==0)
|
2020-01-01 21:29:24 +01:00
|
|
|
{
|
2020-04-01 23:52:45 +02:00
|
|
|
graphics.fademode = 2;
|
2020-01-01 21:29:24 +01:00
|
|
|
music.fadeout();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|