diff --git a/data/doors.gif b/data/doors.gif index d98b14b..ee29cf2 100644 Binary files a/data/doors.gif and b/data/doors.gif differ diff --git a/data/end1.gif b/data/end1.gif new file mode 100644 index 0000000..24652f0 Binary files /dev/null and b/data/end1.gif differ diff --git a/data/end2.gif b/data/end2.gif new file mode 100644 index 0000000..4a3f741 Binary files /dev/null and b/data/end2.gif differ diff --git a/data/gifs.txt b/data/gifs.txt index 8c77567..a3fff03 100644 --- a/data/gifs.txt +++ b/data/gifs.txt @@ -4,6 +4,8 @@ altres.gif batman.gif caixes.gif doors.gif +end1.gif +end2.gif floor.gif font.gif font2.gif diff --git a/data/rooms/12.txt b/data/rooms/12.txt index be4b14e..baeba49 100644 --- a/data/rooms/12.txt +++ b/data/rooms/12.txt @@ -28,13 +28,13 @@ actor{ } actor{ - name: ANBERNIC + name: ANBERNIC0 bmp: altres.gif bmp-rect: 157 80 24 14 bmp-offset: -4 16 pos: 56 16 0 size: 6 4 2 - flags: PUSHABLE GRAVITY + flags: SPECIAL movement: CW } diff --git a/data/rooms/25.txt b/data/rooms/25.txt index 44076af..ea8a434 100644 --- a/data/rooms/25.txt +++ b/data/rooms/25.txt @@ -11,13 +11,13 @@ exit-zp: 21 editor-done: 1 actor{ - name: ANBERNIC + name: ANBERNIC1 bmp: altres.gif bmp-rect: 157 80 24 14 bmp-offset: -4 16 pos: 24 40 8 size: 6 4 2 - flags: PUSHABLE GRAVITY + flags: SPECIAL movement: CW } diff --git a/data/rooms/26.txt b/data/rooms/26.txt index f3f42ed..b35fcc5 100644 --- a/data/rooms/26.txt +++ b/data/rooms/26.txt @@ -26,13 +26,13 @@ actor{ } actor{ - name: ANBERNIC + name: ANBERNIC2 bmp: altres.gif bmp-rect: 157 80 24 14 bmp-offset: -6 10 pos: 40 8 6 size: 6 4 2 - flags: PUSHABLE GRAVITY + flags: SPECIAL movement: CW } diff --git a/data/rooms/28.txt b/data/rooms/28.txt index f3fa9e1..e7bf85b 100644 --- a/data/rooms/28.txt +++ b/data/rooms/28.txt @@ -13,6 +13,17 @@ exit-yp: 35 exit-yn: 29 editor-done: 1 +actor{ + name: ANBERNIC3 + bmp: altres.gif + bmp-rect: 157 80 24 14 + bmp-offset: -4 16 + pos: 0 8 0 + size: 6 4 2 + flags: SPECIAL + movement: CW +} + actor{ name: BLOCMATA-00 bmp: altres.gif diff --git a/data/rooms/33.txt b/data/rooms/33.txt index 559749c..a4a2295 100644 --- a/data/rooms/33.txt +++ b/data/rooms/33.txt @@ -14,13 +14,13 @@ exit-yn: 32 editor-done: 1 actor{ - name: ANBERNIC + name: ANBERNIC4 bmp: altres.gif bmp-rect: 157 80 24 14 bmp-offset: -4 16 pos: 24 32 0 size: 6 4 2 - flags: PUSHABLE GRAVITY + flags: SPECIAL movement: CW } diff --git a/data/rooms/34.txt b/data/rooms/34.txt index cb73f57..40d8e02 100644 --- a/data/rooms/34.txt +++ b/data/rooms/34.txt @@ -12,13 +12,13 @@ exit-yn: 33 editor-done: 1 actor{ - name: ANBERNIC + name: ANBERNIC5 bmp: altres.gif bmp-rect: 157 80 24 14 bmp-offset: -4 16 pos: 40 16 0 size: 6 4 2 - flags: PUSHABLE GRAVITY + flags: SPECIAL movement: CW } diff --git a/data/rooms/39.txt b/data/rooms/39.txt index 1d2b0fc..c8c3d81 100644 --- a/data/rooms/39.txt +++ b/data/rooms/39.txt @@ -12,13 +12,13 @@ exit-yp: 37 editor-done: 1 actor{ - name: ANBERNIC + name: ANBERNIC6 bmp: altres.gif bmp-rect: 157 80 24 14 bmp-offset: -4 16 pos: 0 8 0 size: 6 4 2 - flags: PUSHABLE GRAVITY + flags: SPECIAL movement: CW } @@ -47,7 +47,7 @@ actor{ bmp: doors.gif bmp-rect: 160 7 16 40 bmp-offset: -8 47 - pos: 8 16 0 + pos: 10 18 0 size: 6 6 14 movement: CW } diff --git a/data/rooms/43.txt b/data/rooms/43.txt index 18e037b..4e342f5 100644 --- a/data/rooms/43.txt +++ b/data/rooms/43.txt @@ -10,21 +10,6 @@ exit-yn: 42 exit-zn: 47 editor-done: 1 -actor{ - name: ABAD - bmp: lordabad.gif - bmp-rect: 0 0 20 33 - bmp-offset: -6 38 - pos: 2 28 20 - size: 8 8 8 - orient: XP - anim-cycle: MIN - anim-wait: 1 - flags: ANIMATED ORIENTABLE - react-mask: XP XN YP YN ZP ZN - movement: CCW -} - actor{ name: LIFT-00 bmp: caixes.gif @@ -47,6 +32,21 @@ actor{ movement: Z } +actor{ + name: LORD-ABAD + bmp: lordabad.gif + bmp-rect: 0 0 20 33 + bmp-offset: -6 38 + pos: 2 28 20 + size: 8 8 8 + orient: XP + anim-cycle: MIN + anim-wait: 1 + flags: ANIMATED ORIENTABLE + react-mask: XP XN YP YN ZP ZN + movement: CCW +} + actor{ name: PLATH-00 bmp: caixes.gif diff --git a/data/rooms/48.txt b/data/rooms/48.txt index 8ccb45c..8c2bf02 100644 --- a/data/rooms/48.txt +++ b/data/rooms/48.txt @@ -14,7 +14,7 @@ actor{ name: BOX-A bmp: sam.gif bmp-rect: 0 0 19 33 - bmp-offset: -7 37 + bmp-offset: -10 38 pos: 27 0 19 size: 8 8 8 anim-cycle: DUO @@ -37,8 +37,8 @@ actor{ actor{ name: PLATH-00 bmp: caixes.gif - bmp-rect: 128 128 32 32 - bmp-offset: 0 32 + bmp-rect: 32 32 32 32 + bmp-offset: 0 24 pos: 24 0 15 size: 8 8 4 orient: ZP @@ -59,8 +59,8 @@ actor{ actor{ name: PLATH-01 bmp: caixes.gif - bmp-rect: 128 128 32 32 - bmp-offset: 0 32 + bmp-rect: 32 32 32 32 + bmp-offset: 0 24 pos: 32 0 15 size: 8 8 4 orient: ZP diff --git a/data/rooms/51.txt b/data/rooms/51.txt index 43d63fe..d1c6622 100644 --- a/data/rooms/51.txt +++ b/data/rooms/51.txt @@ -10,6 +10,17 @@ exit-yp: 52 exit-zp: 47 editor-done: 1 +actor{ + name: ANBERNIC7 + bmp: altres.gif + bmp-rect: 157 80 24 14 + bmp-offset: -4 16 + pos: 8 40 0 + size: 6 4 2 + flags: SPECIAL + movement: CW +} + actor{ name: CADIRA bmp: caixes.gif diff --git a/data/rooms/60.txt b/data/rooms/60.txt index 7b6b014..583ca47 100644 --- a/data/rooms/60.txt +++ b/data/rooms/60.txt @@ -10,13 +10,13 @@ exit-yn: 59 editor-done: 1 actor{ - name: ANBERNIC + name: ANBERNIC8 bmp: altres.gif bmp-rect: 157 80 24 14 bmp-offset: -4 16 pos: 48 40 0 size: 6 4 2 - flags: PUSHABLE GRAVITY + flags: SPECIAL movement: CW } diff --git a/data/rooms/61.txt b/data/rooms/61.txt index 613af18..8381bbc 100644 --- a/data/rooms/61.txt +++ b/data/rooms/61.txt @@ -10,13 +10,13 @@ exit-xp: 59 editor-done: 1 actor{ - name: ANBERNIC + name: ANBERNIC9 bmp: altres.gif bmp-rect: 157 80 24 14 bmp-offset: -4 16 pos: 0 40 0 size: 6 4 2 - flags: PUSHABLE GRAVITY + flags: SPECIAL movement: CW } diff --git a/data/templates.txt b/data/templates.txt index b982a95..7a2f62f 100644 --- a/data/templates.txt +++ b/data/templates.txt @@ -204,6 +204,75 @@ category{ movement: CW } + actor{ + name: SAM + bmp: sam.gif + bmp-rect: 0 0 19 33 + bmp-offset: -8 38 + pos: 24 40 0 + size: 8 8 8 + orient: XP + anim-cycle: DUO + anim-wait: 20 + flags: ANIMATED + react-mask: XP XN YP YN ZP ZN + movement: CCW + } + + actor{ + name: YONKI + bmp: caixes.gif + bmp-rect: 168 65 19 31 + bmp-offset: -6 36 + pos: 24 40 0 + size: 8 8 8 + orient: XP + anim-wait: 20 + react-mask: XP XN YP YN ZP ZN + movement: CCW + } + + actor{ + name: LORD-ABAD + bmp: lordabad.gif + bmp-rect: 0 0 20 33 + bmp-offset: -6 38 + pos: 56 48 0 + size: 8 8 8 + orient: XP + anim-cycle: MIN + anim-wait: 1 + flags: ANIMATED ORIENTABLE + react-mask: XP XN YP YN ZP ZN + movement: CCW + } + + actor{ + name: JAILDES + bmp: test.gif + bmp-rect: 0 32 20 32 + bmp-offset: -6 38 + pos: 48 40 0 + size: 8 8 8 + orient: XP + anim-wait: 1 + flags: ANIMATED + react-mask: XP XN YP YN ZP ZN + movement: CCW + } + + actor{ + name: ROOMBA2 + bmp: caixes.gif + bmp-rect: 164 0 24 32 + bmp-offset: 0 34 + pos: 24 40 0 + size: 8 8 2 + orient: XN + react-mask: XP XN YP YN ZP ZN + movement: CCW + } + } category{ diff --git a/source/actor.cpp b/source/actor.cpp index 489f946..c12980e 100644 --- a/source/actor.cpp +++ b/source/actor.cpp @@ -650,6 +650,7 @@ namespace actor if (act->name[0] == 'B') { // Es un booster hero::collectBooster(&act->name[5], (act->name[2] - 48) * 10 + (act->name[3] - 48)); + audio::playSound("snd_boost.wav", SOUND_BASIC); } else if (act->name[0] == 'S') { // Es un skill @@ -669,6 +670,11 @@ namespace actor return result; } } + else if (act->name[0] == 'A') + { + hero::pickAnbernic(act->name); + audio::playSound("snd_pick.wav", SOUND_BASIC); + } else { SDL_assert(false); @@ -727,7 +733,7 @@ namespace actor act->push |= PUSH_XP; } } - else if (controller::down(KEY_UP)) //input::keyDown(SDL_SCANCODE_UP) || input::keyDown(config::getKey(KEY_UP))) + else if (controller::down(KEY_UP)) // input::keyDown(SDL_SCANCODE_UP) || input::keyDown(config::getKey(KEY_UP))) { hero::useBoostRun(); act->orient = PUSH_YN; @@ -747,7 +753,7 @@ namespace actor act->push |= PUSH_YN; } } - else if (controller::down(KEY_DOWN)) //input::keyDown(SDL_SCANCODE_DOWN) || input::keyDown(config::getKey(KEY_DOWN))) + else if (controller::down(KEY_DOWN)) // input::keyDown(SDL_SCANCODE_DOWN) || input::keyDown(config::getKey(KEY_DOWN))) { hero::useBoostRun(); act->orient = PUSH_YP; @@ -767,7 +773,7 @@ namespace actor act->push |= PUSH_YP; } } - //if ((input::keyPressed(SDL_SCANCODE_RETURN) || input::keyPressed(config::getKey(KEY_PICK))) && (hero::getSkills() & SKILL_PANTS)) + // if ((input::keyPressed(SDL_SCANCODE_RETURN) || input::keyPressed(config::getKey(KEY_PICK))) && (hero::getSkills() & SKILL_PANTS)) if ((controller::pressed(KEY_PICK)) && (hero::getSkills() & SKILL_PANTS)) { if (picked) @@ -815,7 +821,7 @@ namespace actor } } actor::actor_t *future_below = any_below_me(act); - //if ((input::keyDown(SDL_SCANCODE_SPACE) || input::keyDown(config::getKey(KEY_JUMP))) && + // 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))) { @@ -869,7 +875,8 @@ namespace actor if (moving) { act->flags |= FLAG_ANIMATED; - if ((config::getSoundMode()==SOUND_ALL) && act->react_mask==0 && ( (act->below) || (act->pos.z==0) )) audio::resumeChannel(walk_channel); + if ((config::getSoundMode() == SOUND_ALL) && act->react_mask == 0 && ((act->below) || (act->pos.z == 0))) + audio::resumeChannel(walk_channel); } else { @@ -885,7 +892,7 @@ namespace actor act->push |= act->mov_push; } - void changeMoving(actor_t *act, const bool silent=false) + void changeMoving(actor_t *act, const bool silent = false) { if (!silent && !push_sound_already_playing) { @@ -1035,7 +1042,11 @@ namespace actor act2->anim_frame = 2; act->anim_wait = act2->anim_wait = 1; actor_t *other = first; - while (other) { other->flags &= ~FLAG_MOVING; other = other->next; } + while (other) + { + other->flags &= ~FLAG_MOVING; + other = other->next; + } actor::setDirty(act2); room::cycleColor(4); return; @@ -1488,7 +1499,7 @@ namespace actor draw::stencil::set(act->tag); draw::draw(x, y, act->bmp_rect.w, act->bmp_rect.h, act->bmp_rect.x + ao, act->bmp_rect.y + oo, flip); draw::swapcol(1, room::getColor(0)); // Tornem al color per defecte - if (act->flags & FLAG_SPECIAL) + if ((act->flags & FLAG_SPECIAL) && (act->name[0] != 'A')) { draw::setSource(brilli); const int dx = (act->bmp_rect.w - 22) >> 1; @@ -1898,6 +1909,7 @@ namespace actor int skills = SKILL_NONE; int parts = PART_NONE; bool boosters_collected[100]; + bool anbernics[10] = {false, false, false, false, false, false, false, false, false, false}; vec3_t first_pos = {0, 0, 0}; int first_orient = 0; bool dead = false; @@ -1917,10 +1929,13 @@ namespace actor lives = 8; skills = SKILL_NONE; parts = PART_NONE; + for (int i = 0; i < 10; ++i) + anbernics[i] = false; for (int i = 0; i < 100; ++i) boosters_collected[i] = false; brilli = draw::getSurface("objectes.gif"); - if ( (config::getSoundMode()==SOUND_ALL) ) { + if ((config::getSoundMode() == SOUND_ALL)) + { walk_channel = audio::playSound("snd_walk.wav", SOUND_ALL, -1); audio::pauseChannel(walk_channel); } @@ -2181,6 +2196,25 @@ namespace actor return parts; } + void pickAnbernic(char *name) + { + anbernics[name[8] - 48] = true; + } + + bool wasAnbernicCollected(char *name) + { + return anbernics[name[8] - 48]; + } + + int getNumAmbernicsCollected() + { + int count = 0; + for (auto anbernic : anbernics) + if (anbernic) + count++; + return count; + } + void move(int *x, int *y, int *z) { actor_t *hero = actor::find("HERO"); diff --git a/source/actor.h b/source/actor.h index 6fece4f..fea7087 100644 --- a/source/actor.h +++ b/source/actor.h @@ -233,6 +233,10 @@ namespace actor bool wasPartCollected(char *part); int getParts(); + void pickAnbernic(char *name); + bool wasAnbernicCollected(char *name); + int getNumAmbernicsCollected(); + void move(int *x, int *y, int *z); void setFirstPos(); } diff --git a/source/config.cpp b/source/config.cpp index 1e1325d..85f9b01 100644 --- a/source/config.cpp +++ b/source/config.cpp @@ -8,6 +8,7 @@ namespace config int soundMode = SOUND_ALL; uint8_t keys[7] = {SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_SPACE, SDL_SCANCODE_RETURN, SDL_SCANCODE_ESCAPE}; int8_t pad_btns[7] = {SDL_CONTROLLER_BUTTON_DPAD_UP, SDL_CONTROLLER_BUTTON_DPAD_DOWN, SDL_CONTROLLER_BUTTON_DPAD_LEFT, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, SDL_CONTROLLER_BUTTON_A, SDL_CONTROLLER_BUTTON_B, SDL_CONTROLLER_BUTTON_START}; + bool prologo_desbloquejat = false; void setMusic(const bool value) { @@ -69,4 +70,16 @@ namespace config { return pad_btns[which]; } + + void setProgoloDesbloquejat() + { + prologo_desbloquejat = true; + file::setConfigValue("prologo", "unlocked"); + } + + const bool isProgoloDesbloquejat() + { + return prologo_desbloquejat; + } + } diff --git a/source/config.h b/source/config.h index d204977..32b4f4d 100644 --- a/source/config.h +++ b/source/config.h @@ -28,4 +28,6 @@ namespace config void definePadBtn(const int which, const int btn); const int getPadBtn(const int which); + void setProgoloDesbloquejat(); + const bool isProgoloDesbloquejat(); } \ No newline at end of file diff --git a/source/m_end_sequence.cpp b/source/m_end_sequence.cpp new file mode 100644 index 0000000..c6c4b71 --- /dev/null +++ b/source/m_end_sequence.cpp @@ -0,0 +1,138 @@ +#include "m_intro.h" +#include "jgame.h" +#include "jdraw.h" +#include "jinput.h" +#include "jaudio.h" +#include "controller.h" +#include "config.h" +#include +#include "actor.h" + +namespace modules +{ + namespace end_sequence + { + int stage = 0; + uint32_t time = 0; + actor::actor_t *act = nullptr; + const char *actor_names[] = {"JAILDESIGNER", "BATMAN", "ROBIN", "EL ALTRE BATMAN", "EL ABAD", "LA ROOMBA", "EL OBRER", "BAMBOLLA DE CAFE", "EL YONKI", "LA PILOTA", "SAM", "LORD ABAD"}; + const char *actor_ids[] = {"JAILDES", "GAT-BATMAN", "GAT-ROBIN", "BATMAN", "ABAD", "ROOMBA2", "OBRER", "COFFEE", "YONKI", "PILOTA", "SAM", "LORD-ABAD"}; + + void init() + { + time = SDL_GetTicks(); + draw::restorecol(2); + draw::cls(2); + + draw::swapcol(1, 7); + draw::setSource(draw::getSurface("end1.gif")); + draw::draw(96, 28, 128, 96, 0, 0); + draw::print2("PER FI! JA PUC", 13, 17, WHITE, FONT_ZOOM_NONE); + draw::print2("TASTAR LA PISCINA!", 11, 19, WHITE, FONT_ZOOM_NONE); + draw::render(); + + if (audio::getCurrentMusic() != "mus_menu.ogg") audio::playMusic("mus_menu.ogg"); + actor::templates::load(); + } + + const bool shouldGoToNext() + { + return (SDL_GetTicks()-time > (stage==15||stage==16?10000:5000)) || + (controller::pressed(KEY_JUMP)) || (controller::pressed(KEY_PICK)) || + (input::keyPressed(SDL_SCANCODE_SPACE)) || (input::keyPressed(SDL_SCANCODE_RETURN)); + } + + void drawActorAt(const char* name, const int x, const int y) + { + draw::swapcol(1,YELLOW); + actor::actor_t *act = actor::createFromTemplate(name); + //act->flags &= ~FLAG_SPECIAL; + actor::drawAt(act, x, y); actor::remove(act); + } + + bool loop() + { + if (controller::pressed(KEY_MENU)) return false; + + if (shouldGoToNext()) + { + time = SDL_GetTicks(); + stage++; + if ( (stage==2) && (config::isProgoloDesbloquejat()) ) stage++; + if (stage == 17) return false; + + switch (stage) + { + case 1: + draw::cls(2); + draw::swapcol(1, 8); + draw::setSource(draw::getSurface("end2.gif")); + draw::draw(96, 28, 128, 96, 0, 0); + draw::print2("PUTA, QUE GUST...", 12, 17, WHITE, FONT_ZOOM_NONE); + //draw::render(); + break; + case 2: + draw::cls(2); + draw::swapcol(1, 8); + draw::setSource(draw::getSurface("end2.gif")); + draw::draw(96, 28, 128, 96, 0, 0); + draw::print2("LLASTIMA QUE ENCARA", 11, 17, WHITE, FONT_ZOOM_NONE); + draw::print2("NO HE TROBAT TOTES", 11, 19, WHITE, FONT_ZOOM_NONE); + draw::print2("LES ANBERNICS...", 13, 21, WHITE, FONT_ZOOM_NONE); + //draw::render(); + break; + case 3: case 4: case 5: case 6: case 7: case 8: + case 9: case 10: case 11: case 12: case 13: case 14: + ::game::setUpdateTicks(64); + if (act) actor::remove(act); + act = actor::createFromTemplate(actor_ids[stage-3]); + act->flags &= ~FLAG_MOVING; + break; + case 15: + if (act) actor::remove(act); + act = actor::createFromTemplate("GAT-BATMAN"); + act->flags &= ~FLAG_MOVING; + break; + case 16: + if (act) actor::remove(act); + break; + } + } + + switch (stage) + { + case 3: case 4: case 5: case 6: case 7: case 8: + case 9: case 10: case 11: case 12: case 13: case 14: + { + draw::cls(2); + draw::print2("THE POOL", 16, 3, TEAL, FONT_ZOOM_VERTICAL); + draw::swapcol(1,YELLOW); + actor::update(act, false); + actor::drawAt(act, 148, 100); + const int x = 160-strlen(actor_names[stage-3])*2; + draw::print(actor_names[stage-3], x, 145, WHITE, PAPER); + draw::print2("(C) JAILDOCTOR 2024", 11, 28, TEAL, FONT_ZOOM_NONE); + break; + } + case 15: + { + draw::cls(2); + draw::swapcol(1,GREEN); + actor::update(act, false); + actor::drawAt(act, 148, 100); + const int x = 160-strlen("DEDICAT A BATMAN")*2; + draw::print("DEDICAT A BATMAN", x, 145, WHITE, PAPER); + break; + } + case 16: + draw::cls(2); + draw::print2("GRACIES PER JUGAR!", 11, 15, PURPLE, FONT_ZOOM_NONE); + break; + + } + + draw::render(); + return true; + } + } +} \ No newline at end of file diff --git a/source/m_end_sequence.h b/source/m_end_sequence.h new file mode 100644 index 0000000..693894e --- /dev/null +++ b/source/m_end_sequence.h @@ -0,0 +1,10 @@ +#pragma once + +namespace modules +{ + namespace end_sequence + { + void init(); + bool loop(); + } +} diff --git a/source/m_game.cpp b/source/m_game.cpp index ccef90f..49cef14 100644 --- a/source/m_game.cpp +++ b/source/m_game.cpp @@ -323,6 +323,7 @@ namespace modules { actor::update(actor::getFirst()); actor::hero::useBoostGod(); + if ( (actor::hero::getParts()==0x3f) && (room::getCurrent()==45) ) return GAME_END; } } diff --git a/source/m_game.h b/source/m_game.h index f0c1239..9b8f913 100644 --- a/source/m_game.h +++ b/source/m_game.h @@ -15,6 +15,7 @@ namespace modules #define GAME_EDITOR_BITMAP_FILE 5 #define GAME_EDITOR_BITMAP_POS 6 #define GAME_EDITOR_BITMAP_SIZE 7 + #define GAME_END 8 enum sections { SECTION_GENERAL, SECTION_ROOM, SECTION_ACTOR }; diff --git a/source/m_ingame.cpp b/source/m_ingame.cpp index 6fded57..a1fc0d4 100644 --- a/source/m_ingame.cpp +++ b/source/m_ingame.cpp @@ -13,16 +13,18 @@ namespace modules { namespace ingame { - draw::surface *surf; + //draw::surface *surf; int selected_option = INGAME_CONTINUAR; actor::actor_t *parts[6] = {nullptr,nullptr,nullptr,nullptr,nullptr,nullptr}; + actor::actor_t *anbernic = nullptr; + int num_anbernics = 0; void init() { - + num_anbernics = actor::hero::getNumAmbernicsCollected(); selected_option = INGAME_CONTINUAR; - surf = draw::getSurface("objectes.gif"); + //surf = draw::getSurface("objectes.gif"); if (parts[0]==nullptr) { parts[0] = actor::createFromTemplate("P-ELBOW"); @@ -65,6 +67,13 @@ namespace modules parts[5]->inner_x=96+16; parts[5]->inner_y=69+8; } + if (anbernic==nullptr) + { + anbernic = actor::createFromTemplate("ANBERNIC"); + anbernic->flags=0; + anbernic->inner_x=252; + anbernic->inner_y=76; + } } int loop() @@ -85,20 +94,33 @@ namespace modules if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK) || input::keyPressed(SDL_SCANCODE_RETURN)) { audio::playSound("snd_push.wav", SOUND_BASIC); + if (selected_option==INGAME_EIXIR) + { + for (int i=0; i<6; ++i) { actor::remove(parts[i]); parts[i]=nullptr;} + actor::remove(anbernic); anbernic=nullptr; + } return selected_option; } draw::cls(2); draw::color(1); - draw::setSource(surf); + //draw::setSource(surf); static int part[6] = { PART_ELBOW, PART_PIPE, PART_SALT, PART_FILTER, PART_PUMP, PART_TIMER}; for (int i=0;i<6;++i) { draw::swapcol(1, room::getColor((actor::hero::getParts() & part[i])?1:3)); actor::drawAt(parts[i], parts[i]->inner_x, parts[i]->inner_y); } - + if (num_anbernics>0) + { + draw::restorecol(1); + actor::drawAt(anbernic, anbernic->inner_x, anbernic->inner_y); + char count[] = " 0/10"; + count[1] = (num_anbernics%10)+48; + if (num_anbernics==10) count[0]='1'; + draw::print2(count, 30, 12, WHITE, FONT_ZOOM_NONE); + } draw::print2("PAUSA", 17, 3, TEAL, FONT_ZOOM_VERTICAL); diff --git a/source/m_menu.cpp b/source/m_menu.cpp index bffadd4..190544f 100644 --- a/source/m_menu.cpp +++ b/source/m_menu.cpp @@ -6,6 +6,7 @@ #include "config.h" #include #include "jaudio.h" +#include "actor.h" namespace modules { namespace menu @@ -15,6 +16,8 @@ namespace modules int retras=4; int selected_option = OPTION_JUGAR; + bool prologo_desbloquejat = false; + int min_option = 1; void init() { @@ -24,6 +27,7 @@ namespace modules draw::loadPalette("test.gif"); surf = draw::getSurface("test.gif"); draw::restorecol(2); + if (config::isProgoloDesbloquejat()) min_option=0; } int loop() @@ -34,13 +38,13 @@ namespace modules if (controller::pressed(KEY_DOWN) || input::keyPressed(SDL_SCANCODE_DOWN)) { audio::playSound("snd_push.wav", SOUND_BASIC); - selected_option++; if (selected_option==5) selected_option=0; + selected_option++; if (selected_option==6) selected_option=min_option; } if (controller::pressed(KEY_UP) || input::keyPressed(SDL_SCANCODE_UP)) { audio::playSound("snd_push.wav", SOUND_BASIC); - selected_option--; if (selected_option<0) selected_option=4; + selected_option--; if (selected_optionflags &= ~FLAG_ANIMATED; act->bmp_rect.x += act->bmp_rect.w; } + } else if (act->name[0]=='A') { // Es una anbernic + if (!::editor::isDevMode() && actor::hero::wasAnbernicCollected(act->name)) + { + actor::remove(act); + act = nullptr; + } } } if (act) actor::setDirty(act, true);