Merge branch 'master' of https://gitea.sustancia.synology.me/JailDesigner/jaildoctors_dilemma
This commit is contained in:
@@ -57,9 +57,6 @@ Director::Director(int argc, char *argv[])
|
||||
screen->setBorderColor(borderColor);
|
||||
debug = new Debug(renderer, screen, asset);
|
||||
music = JA_LoadMusic(asset->get("title.ogg").c_str());
|
||||
|
||||
// Inicializa los servicios online
|
||||
// initOnline();
|
||||
}
|
||||
|
||||
Director::~Director()
|
||||
@@ -112,10 +109,13 @@ void Director::initOptions()
|
||||
// Crea el puntero a la estructura de opciones
|
||||
options = new options_t;
|
||||
|
||||
// Version
|
||||
// Version del archivo de configuración
|
||||
options->configVersion = "v1.06.1";
|
||||
|
||||
// Opciones dee video
|
||||
// Opciones de control
|
||||
options->keys = ctrl_cursor;
|
||||
|
||||
// Opciones de video
|
||||
options->gameWidth = GAMECANVAS_WIDTH;
|
||||
options->gameHeight = GAMECANVAS_HEIGHT;
|
||||
options->videoMode = 0;
|
||||
@@ -125,7 +125,8 @@ void Director::initOptions()
|
||||
options->integerScale = true;
|
||||
options->keepAspect = true;
|
||||
options->borderEnabled = true;
|
||||
options->borderSize = 0.2f;
|
||||
options->borderWidth = 32;
|
||||
options->borderHeight = 24;
|
||||
options->palette = p_zxspectrum;
|
||||
|
||||
// Estos valores no se guardan en el fichero de configuraci´ón
|
||||
@@ -312,6 +313,21 @@ bool Director::saveConfig()
|
||||
file << "## VERSION\n";
|
||||
file << "configVersion=" + options->configVersion + "\n";
|
||||
|
||||
file << "\n## CONTROL OPTIONS\n";
|
||||
file << "## keys = CURSOR | OPQA | WASD\n";
|
||||
if (options->keys == ctrl_cursor)
|
||||
{
|
||||
file << "keys=CURSOR\n";
|
||||
}
|
||||
else if (options->keys == ctrl_opqa)
|
||||
{
|
||||
file << "keys=OPQA\n";
|
||||
}
|
||||
else if (options->keys == ctrl_wasd)
|
||||
{
|
||||
file << "keys=WASD\n";
|
||||
}
|
||||
|
||||
file << "\n## VISUAL OPTIONS\n";
|
||||
if (options->videoMode == 0)
|
||||
{
|
||||
@@ -343,7 +359,8 @@ bool Director::saveConfig()
|
||||
file << "integerScale=" + boolToString(options->integerScale) + "\n";
|
||||
file << "keepAspect=" + boolToString(options->keepAspect) + "\n";
|
||||
file << "borderEnabled=" + boolToString(options->borderEnabled) + "\n";
|
||||
file << "borderSize=" + std::to_string(options->borderSize) + "\n";
|
||||
file << "borderWidth=" + std::to_string(options->borderWidth) + "\n";
|
||||
file << "borderHeight=" + std::to_string(options->borderHeight) + "\n";
|
||||
file << "palette=" + std::to_string(options->palette) + "\n";
|
||||
|
||||
file << "\n## ONLINE OPTIONS\n";
|
||||
@@ -362,7 +379,7 @@ bool Director::saveConfig()
|
||||
{
|
||||
file << "notifications.posV=pos_bottom\n";
|
||||
}
|
||||
|
||||
|
||||
file << "## notifications.posH = pos_left | pos_middle | pos_right\n";
|
||||
if (options->notifications.posH == pos_left)
|
||||
{
|
||||
@@ -543,9 +560,9 @@ void Director::loadResources(section_t section)
|
||||
textureList.push_back("abad.png");
|
||||
textureList.push_back("abad_bell.png");
|
||||
textureList.push_back("amstrad_cs.png");
|
||||
textureList.push_back("arounder_fly.png");
|
||||
textureList.push_back("arounder_stop.png");
|
||||
textureList.push_back("arounder_walk.png");
|
||||
textureList.push_back("flying_arounder.png");
|
||||
textureList.push_back("stopped_arounder.png");
|
||||
textureList.push_back("walking_arounder.png");
|
||||
textureList.push_back("arounders_door.png");
|
||||
textureList.push_back("arounders_machine.png");
|
||||
textureList.push_back("bat.png");
|
||||
@@ -567,11 +584,11 @@ void Director::loadResources(section_t section)
|
||||
textureList.push_back("diskette.png");
|
||||
textureList.push_back("dong.png");
|
||||
textureList.push_back("guitar.png");
|
||||
textureList.push_back("jb_alien.png");
|
||||
textureList.push_back("jb_human.png");
|
||||
textureList.push_back("jailer.png");
|
||||
textureList.push_back("jailer2.png");
|
||||
textureList.push_back("jailer3.png");
|
||||
textureList.push_back("jailbattle_alien.png");
|
||||
textureList.push_back("jailbattle_human.png");
|
||||
textureList.push_back("jailer_#1.png");
|
||||
textureList.push_back("jailer_#2.png");
|
||||
textureList.push_back("jailer_#3.png");
|
||||
textureList.push_back("jeannine.png");
|
||||
textureList.push_back("lamp.png");
|
||||
textureList.push_back("lord_abad.png");
|
||||
@@ -579,7 +596,7 @@ void Director::loadResources(section_t section)
|
||||
textureList.push_back("matatunos.png");
|
||||
textureList.push_back("mummy.png");
|
||||
textureList.push_back("paco.png");
|
||||
textureList.push_back("printer.png");
|
||||
textureList.push_back("elsa.png");
|
||||
textureList.push_back("qvoid.png");
|
||||
textureList.push_back("sam.png");
|
||||
textureList.push_back("sigmasua.png");
|
||||
@@ -606,9 +623,9 @@ void Director::loadResources(section_t section)
|
||||
animationList.push_back("abad.ani");
|
||||
animationList.push_back("abad_bell.ani");
|
||||
animationList.push_back("amstrad_cs.ani");
|
||||
animationList.push_back("arounder_fly.ani");
|
||||
animationList.push_back("arounder_stop.ani");
|
||||
animationList.push_back("arounder_walk.ani");
|
||||
animationList.push_back("flying_arounder.ani");
|
||||
animationList.push_back("stopped_arounder.ani");
|
||||
animationList.push_back("walking_arounder.ani");
|
||||
animationList.push_back("arounders_door.ani");
|
||||
animationList.push_back("arounders_machine.ani");
|
||||
animationList.push_back("bat.ani");
|
||||
@@ -630,11 +647,11 @@ void Director::loadResources(section_t section)
|
||||
animationList.push_back("diskette.ani");
|
||||
animationList.push_back("dong.ani");
|
||||
animationList.push_back("guitar.ani");
|
||||
animationList.push_back("jb_alien.ani");
|
||||
animationList.push_back("jb_human.ani");
|
||||
animationList.push_back("jailer.ani");
|
||||
animationList.push_back("jailer2.ani");
|
||||
animationList.push_back("jailer3.ani");
|
||||
animationList.push_back("jailbattle_alien.ani");
|
||||
animationList.push_back("jailbattle_human.ani");
|
||||
animationList.push_back("jailer_#1.ani");
|
||||
animationList.push_back("jailer_#2.ani");
|
||||
animationList.push_back("jailer_#3.ani");
|
||||
animationList.push_back("jeannine.ani");
|
||||
animationList.push_back("lamp.ani");
|
||||
animationList.push_back("lord_abad.ani");
|
||||
@@ -642,7 +659,7 @@ void Director::loadResources(section_t section)
|
||||
animationList.push_back("matatunos.ani");
|
||||
animationList.push_back("mummy.ani");
|
||||
animationList.push_back("paco.ani");
|
||||
animationList.push_back("printer.ani");
|
||||
animationList.push_back("elsa.ani");
|
||||
animationList.push_back("qvoid.ani");
|
||||
animationList.push_back("sam.ani");
|
||||
animationList.push_back("sigmasua.ani");
|
||||
@@ -717,9 +734,9 @@ void Director::loadResources(section_t section)
|
||||
textureList.push_back("abad.png");
|
||||
textureList.push_back("aerojailer.png");
|
||||
textureList.push_back("amstrad_cs.png");
|
||||
textureList.push_back("arounder_fly.png");
|
||||
textureList.push_back("arounder_stop.png");
|
||||
textureList.push_back("arounder_walk.png");
|
||||
textureList.push_back("flying_arounder.png");
|
||||
textureList.push_back("stopped_arounder.png");
|
||||
textureList.push_back("walking_arounder.png");
|
||||
textureList.push_back("arounder.png");
|
||||
textureList.push_back("arounders_door.png");
|
||||
textureList.push_back("arounders_machine.png");
|
||||
@@ -742,11 +759,11 @@ void Director::loadResources(section_t section)
|
||||
textureList.push_back("dong.png");
|
||||
textureList.push_back("guitar.png");
|
||||
textureList.push_back("heavy.png");
|
||||
textureList.push_back("jailer.png");
|
||||
textureList.push_back("jailer2.png");
|
||||
textureList.push_back("jailer3.png");
|
||||
textureList.push_back("jb_alien.png");
|
||||
textureList.push_back("jb_human.png");
|
||||
textureList.push_back("jailer_#1.png");
|
||||
textureList.push_back("jailer_#2.png");
|
||||
textureList.push_back("jailer_#3.png");
|
||||
textureList.push_back("jailbattle_alien.png");
|
||||
textureList.push_back("jailbattle_human.png");
|
||||
textureList.push_back("jeannine.png");
|
||||
textureList.push_back("lamp.png");
|
||||
textureList.push_back("lord_abad.png");
|
||||
@@ -754,7 +771,7 @@ void Director::loadResources(section_t section)
|
||||
textureList.push_back("mummy.png");
|
||||
textureList.push_back("paco.png");
|
||||
textureList.push_back("pepe_rosita_job.png");
|
||||
textureList.push_back("printer.png");
|
||||
textureList.push_back("elsa.png");
|
||||
textureList.push_back("qvoid.png");
|
||||
textureList.push_back("robot.png");
|
||||
textureList.push_back("sam.png");
|
||||
@@ -798,9 +815,9 @@ void Director::loadResources(section_t section)
|
||||
animationList.push_back("abad.ani");
|
||||
animationList.push_back("aerojailer.ani");
|
||||
animationList.push_back("amstrad_cs.ani");
|
||||
animationList.push_back("arounder_fly.ani");
|
||||
animationList.push_back("arounder_stop.ani");
|
||||
animationList.push_back("arounder_walk.ani");
|
||||
animationList.push_back("flying_arounder.ani");
|
||||
animationList.push_back("stopped_arounder.ani");
|
||||
animationList.push_back("walking_arounder.ani");
|
||||
animationList.push_back("arounder.ani");
|
||||
animationList.push_back("arounders_door.ani");
|
||||
animationList.push_back("arounders_machine.ani");
|
||||
@@ -823,11 +840,11 @@ void Director::loadResources(section_t section)
|
||||
animationList.push_back("dong.ani");
|
||||
animationList.push_back("guitar.ani");
|
||||
animationList.push_back("heavy.ani");
|
||||
animationList.push_back("jailer.ani");
|
||||
animationList.push_back("jailer2.ani");
|
||||
animationList.push_back("jailer3.ani");
|
||||
animationList.push_back("jb_alien.ani");
|
||||
animationList.push_back("jb_human.ani");
|
||||
animationList.push_back("jailer_#1.ani");
|
||||
animationList.push_back("jailer_#2.ani");
|
||||
animationList.push_back("jailer_#3.ani");
|
||||
animationList.push_back("jailbattle_alien.ani");
|
||||
animationList.push_back("jailbattle_human.ani");
|
||||
animationList.push_back("jeannine.ani");
|
||||
animationList.push_back("lamp.ani");
|
||||
animationList.push_back("lord_abad.ani");
|
||||
@@ -835,7 +852,7 @@ void Director::loadResources(section_t section)
|
||||
animationList.push_back("mummy.ani");
|
||||
animationList.push_back("paco.ani");
|
||||
animationList.push_back("pepe_rosita_job.ani");
|
||||
animationList.push_back("printer.ani");
|
||||
animationList.push_back("elsa.ani");
|
||||
animationList.push_back("qvoid.ani");
|
||||
animationList.push_back("robot.ani");
|
||||
animationList.push_back("sam.ani");
|
||||
@@ -1009,6 +1026,22 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
options->configVersion = value;
|
||||
}
|
||||
|
||||
else if (var == "keys")
|
||||
{
|
||||
if (value == "OPQA")
|
||||
{
|
||||
options->keys = ctrl_opqa;
|
||||
}
|
||||
else if (value == "WASD")
|
||||
{
|
||||
options->keys = ctrl_wasd;
|
||||
}
|
||||
else
|
||||
{
|
||||
options->keys = ctrl_cursor;
|
||||
}
|
||||
}
|
||||
|
||||
else if (var == "videoMode")
|
||||
{
|
||||
if (value == "SDL_WINDOW_FULLSCREEN_DESKTOP")
|
||||
@@ -1066,13 +1099,14 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
|
||||
options->borderEnabled = stringToBool(value);
|
||||
}
|
||||
|
||||
else if (var == "borderSize")
|
||||
else if (var == "borderWidth")
|
||||
{
|
||||
options->borderSize = std::stof(value);
|
||||
if (options->borderSize < 0.0f || options->borderSize > 0.5f)
|
||||
{
|
||||
options->borderSize = 0.1f;
|
||||
}
|
||||
options->borderWidth = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "borderHeight")
|
||||
{
|
||||
options->borderHeight = std::stoi(value);
|
||||
}
|
||||
|
||||
else if (var == "palette")
|
||||
@@ -1169,10 +1203,26 @@ void Director::initInput()
|
||||
input->discoverGameController();
|
||||
|
||||
// Asigna inputs a teclas
|
||||
input->bindKey(INPUT_UP, SDL_SCANCODE_UP);
|
||||
if (options->keys == ctrl_cursor)
|
||||
{
|
||||
input->bindKey(INPUT_UP, SDL_SCANCODE_UP);
|
||||
input->bindKey(INPUT_LEFT, SDL_SCANCODE_LEFT);
|
||||
input->bindKey(INPUT_RIGHT, SDL_SCANCODE_RIGHT);
|
||||
}
|
||||
else if (options->keys == ctrl_opqa)
|
||||
{
|
||||
input->bindKey(INPUT_UP, SDL_SCANCODE_Q);
|
||||
input->bindKey(INPUT_LEFT, SDL_SCANCODE_O);
|
||||
input->bindKey(INPUT_RIGHT, SDL_SCANCODE_P);
|
||||
}
|
||||
else if (options->keys == ctrl_wasd)
|
||||
{
|
||||
input->bindKey(INPUT_UP, SDL_SCANCODE_W);
|
||||
input->bindKey(INPUT_LEFT, SDL_SCANCODE_A);
|
||||
input->bindKey(INPUT_RIGHT, SDL_SCANCODE_D);
|
||||
}
|
||||
|
||||
input->bindKey(INPUT_DOWN, SDL_SCANCODE_DOWN);
|
||||
input->bindKey(INPUT_LEFT, SDL_SCANCODE_LEFT);
|
||||
input->bindKey(INPUT_RIGHT, SDL_SCANCODE_RIGHT);
|
||||
input->bindKey(INPUT_ACCEPT, SDL_SCANCODE_RETURN);
|
||||
input->bindKey(INPUT_CANCEL, SDL_SCANCODE_ESCAPE);
|
||||
input->bindKey(INPUT_BUTTON_1, SDL_SCANCODE_SPACE);
|
||||
@@ -1231,8 +1281,8 @@ bool Director::initSDL()
|
||||
int incH = 0;
|
||||
if (options->borderEnabled)
|
||||
{
|
||||
incW = options->gameWidth * options->borderSize;
|
||||
incH = options->gameHeight * options->borderSize;
|
||||
incW = options->borderWidth * 2;
|
||||
incH = options->borderHeight * 2;
|
||||
}
|
||||
|
||||
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, (options->gameWidth + incW) * options->windowSize, (options->gameHeight + incH) * options->windowSize, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||
@@ -1443,12 +1493,12 @@ bool Director::setFileList()
|
||||
asset->add(prefix + "/data/enemies/abad.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/amstrad_cs.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/amstrad_cs.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/arounder_fly.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/arounder_fly.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/arounder_stop.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/arounder_stop.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/arounder_walk.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/arounder_walk.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/flying_arounder.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/flying_arounder.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/stopped_arounder.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/stopped_arounder.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/walking_arounder.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/walking_arounder.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/arounders_door.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/arounders_door.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/arounders_machine.ani", t_data);
|
||||
@@ -1491,16 +1541,16 @@ bool Director::setFileList()
|
||||
asset->add(prefix + "/data/enemies/guitar.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/heavy.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/heavy.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/jailer.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/jailer.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/jailer2.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/jailer2.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/jailer3.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/jailer3.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/jb_alien.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/jb_alien.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/jb_human.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/jb_human.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/jailer_#1.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/jailer_#1.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/jailer_#2.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/jailer_#2.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/jailer_#3.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/jailer_#3.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/jailbattle_alien.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/jailbattle_alien.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/jailbattle_human.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/jailbattle_human.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/jeannine.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/jeannine.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/lamp.ani", t_data);
|
||||
@@ -1513,8 +1563,8 @@ bool Director::setFileList()
|
||||
asset->add(prefix + "/data/enemies/mummy.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/paco.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/paco.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/printer.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/printer.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/elsa.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/elsa.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/qvoid.ani", t_data);
|
||||
asset->add(prefix + "/data/enemies/qvoid.png", t_bitmap);
|
||||
asset->add(prefix + "/data/enemies/robot.ani", t_data);
|
||||
|
||||
Reference in New Issue
Block a user