Skip to content

Commit

Permalink
add dynamite as an achievement
Browse files Browse the repository at this point in the history
  • Loading branch information
evanbowman committed Feb 23, 2022
1 parent c240dba commit 0962de5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
10 changes: 10 additions & 0 deletions source/skyland/achievement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ static const AchievementInfo info[Achievement::count] = {
set_enabled(metaclass_index(info[stronghold].reward_), awarded);
}},

{"dynamite",
"Complete any challenge level!",
"dynamite",
[](Platform&, App& app) {
return app.gp_.challenge_flags_ not_eq 0;
},
[](Platform&, App&, bool awarded) {
set_enabled(metaclass_index(info[maestro_1].reward_), awarded);
}},

{"Virtuoso (1)",
"Complete three challenge levels!",
"speaker",
Expand Down
1 change: 1 addition & 0 deletions source/skyland/achievement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ enum Achievement : u8 {
explorer,
strategist,
stronghold,
dynamite,
maestro_1,
maestro_2,
triage,
Expand Down
20 changes: 19 additions & 1 deletion source/skyland/rooms/switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ void Switch::display_on_hover(Platform::Screen& screen,
App& app,
const Vec2<u8>& cursor)
{
if (not setup_) {
return;
}

const auto origin = parent()->visual_origin();

Sprite icon;
Expand Down Expand Up @@ -115,7 +119,21 @@ void Switch::deserialize(lisp::Value* list)
__set_health(lisp::get_list(list, 5)->integer().value_);
}

// TODO: read branch_1_ and branch_2_ from list!
if (lisp::length(list) >= 5) {
auto p1 = lisp::get_list(list, 3);
auto p2 = lisp::get_list(list, 4);

if (p1->type() == lisp::Value::Type::cons and
p2->type() == lisp::Value::Type::cons) {

setup_ = true;
branch_1_.x = p1->cons().car()->integer().value_;
branch_1_.y = p1->cons().cdr()->integer().value_;

branch_2_.x = p2->cons().car()->integer().value_;
branch_2_.y = p2->cons().cdr()->integer().value_;
}
}
}


Expand Down
1 change: 1 addition & 0 deletions source/skyland/rooms/tnt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Explosive : public Room {
static u32 properties()
{
return RoomProperties::roof_hidden | RoomProperties::flag_mount |
RoomProperties::locked_by_default |
RoomProperties::disabled_in_tutorials;
}

Expand Down

0 comments on commit 0962de5

Please sign in to comment.