- Treballant en el prólogo

This commit is contained in:
2024-10-07 20:07:03 +02:00
parent 304f636a95
commit 77cdf90c99
30 changed files with 3942 additions and 7 deletions

View File

@@ -820,10 +820,13 @@ namespace actor
// act->pos.z -= height;
}
}
actor::actor_t *future_below = any_below_me(act);
// if ((input::keyDown(SDL_SCANCODE_SPACE) || input::keyDown(config::getKey(KEY_JUMP))) &&
if ((controller::down(KEY_JUMP)) &&
(hero::getSkills() & SKILL_SHOES) && (act->pos.y + act->size.y) <= max.y && act->pos.y >= min.y && (act->pos.x + act->size.x) <= max.x && act->pos.x >= min.x && act->react_mask == 0 && ((act->pos.z == 0 && room::getFloor() != 11) || (act->below || future_below)))
if ((controller::down(KEY_JUMP)) && ((hero::getSkills() & SKILL_SHOES) || actor::hero::isPrologo())
&& (act->pos.y + act->size.y) <= max.y && act->pos.y >= min.y && (act->pos.x + act->size.x) <= max.x && act->pos.x >= min.x && act->react_mask == 0 && ((act->pos.z == 0 && room::getFloor() != 11) || (act->below || future_below)))
{
audio::pauseChannel(walk_channel);
audio::playSound("snd_jump.wav", SOUND_BASIC);
@@ -1913,10 +1916,29 @@ namespace actor
vec3_t first_pos = {0, 0, 0};
int first_orient = 0;
bool dead = false;
bool prologo = false;
void setPrologo()
{
prologo = true;
}
const bool isPrologo()
{
return prologo;
}
void init(const bool complete)
{
actor::actor_t *hero = actor::create("HERO", {16, 32, 0}, {6, 6, 12}, "test.gif", {0, 32, 20, 32}, {-6, 38});
actor::actor_t *hero = nullptr;
if (prologo)
{
hero = actor::create("HERO", {16, 32, 0}, {6, 6, 8}, "gat.gif", {0, 0, 24, 28}, {-4, 32});
}
else
{
hero = actor::create("HERO", {16, 32, 0}, {6, 6, 12}, "test.gif", {0, 32, 20, 32}, {-6, 38});
}
hero->flags = FLAG_HERO | FLAG_PUSHABLE | FLAG_GRAVITY | FLAG_ORIENTABLE | FLAG_ANIMATED;
actor::setDirty(hero, true);
@@ -1928,6 +1950,7 @@ namespace actor
stats::reset();
lives = 8;
skills = SKILL_NONE;
if (prologo) skills &= SKILL_SHOES;
parts = PART_NONE;
for (int i = 0; i < 10; ++i)
anbernics[i] = false;

View File

@@ -198,6 +198,8 @@ namespace actor
namespace hero
{
void setPrologo();
const bool isPrologo();
void init(const bool complete = true);
int getLives();
void setLives(int value);

View File

@@ -22,8 +22,9 @@ namespace modules
vec2_t floating_position = {3,3};
void init()
void init(const bool prologo)
{
if (prologo) actor::hero::setPrologo();
actor::clear(true);
::game::setUpdateTicks(64);
actor::templates::load();
@@ -48,7 +49,7 @@ namespace modules
}
actor::hero::init();
room::load(0);
room::load(actor::hero::isPrologo()?64:0);
}
void print(int x, int y, int num)

View File

@@ -19,7 +19,7 @@ namespace modules
enum sections { SECTION_GENERAL, SECTION_ROOM, SECTION_ACTOR };
void init();
void init(const bool prologo=false);
int loop();
void setSection(int value);

View File

@@ -145,7 +145,7 @@ bool game::loop()
switch(current_module)
{
case M_LOGO:
if (!modules::logo::loop()) { modules::intro::init(); current_module = M_END; }
if (!modules::logo::loop()) { modules::intro::init(); current_module = M_INTRO; }
break;
case M_INTRO:
if (!modules::intro::loop()) { modules::menu::init(); current_module = M_MENU; }
@@ -157,6 +157,7 @@ bool game::loop()
option = modules::menu::loop();
if (option != OPTION_NONE) {
if (option == OPTION_EIXIR) return false;
if (option == OPTION_PROLOGO) { modules::game::init(true); current_module = M_GAME; }
if (option == OPTION_JUGAR) { modules::game::init(); current_module = M_GAME; }
if (option == OPTION_TECLES) { modules::menu_tecles::init(); current_module = M_MENU_TECLES; }
if (option == OPTION_GAMEPAD) { modules::menu_gamepad::init(); current_module = M_MENU_GAMEPAD; }