Skip to content

Commit

Permalink
Merge branch 'master' into scripting
Browse files Browse the repository at this point in the history
  • Loading branch information
vieiraa committed Mar 12, 2020
2 parents c5309f4 + a1a60c1 commit 23d3730
Show file tree
Hide file tree
Showing 58 changed files with 755 additions and 804 deletions.
1 change: 1 addition & 0 deletions apps/freeablo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ add_library(freeablo_lib # split into a library so I can link to it from tests
faworld/missile/missile.cpp
faworld/missile/missile.h
faworld/missile/missileactorengagement.cpp
faworld/missile/missileattributes.cpp
faworld/missile/missilecreation.cpp
faworld/missile/missileenums.h
faworld/missile/missilegraphic.cpp
Expand Down
2 changes: 1 addition & 1 deletion apps/freeablo/engine/localinputhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace Engine
{
auto type = EngineMain::get()->mGuiManager->isInventoryShown() ? FAWorld::Target::ItemTarget::ActionType::toCursor
: FAWorld::Target::ItemTarget::ActionType::autoEquip;
mInputs.emplace_back(FAWorld::PlayerInput::TargetItemOnFloorData{item->getTile().position, type}, player->getId());
mInputs.emplace_back(FAWorld::PlayerInput::TargetItemOnFloorData{item->getTile(), type}, player->getId());
}
else if (player->getLevel()->isDoor(clickedTile.pos) || !cursorItem.isEmpty())
{
Expand Down
2 changes: 1 addition & 1 deletion apps/freeablo/farender/animationplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace FARender
mFrameSequence.push_back(loader.load<int32_t>());
}

void AnimationPlayer::save(FASaveGame::GameSaver& saver)
void AnimationPlayer::save(FASaveGame::GameSaver& saver) const
{
Serial::ScopedCategorySaver cat("AnimationPlayer", saver);

Expand Down
2 changes: 1 addition & 1 deletion apps/freeablo/farender/animationplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace FARender

AnimationPlayer() {}
AnimationPlayer(FASaveGame::GameLoader& loader);
void save(FASaveGame::GameSaver& saver);
void save(FASaveGame::GameSaver& saver) const;

std::pair<FARender::FASpriteGroup*, int32_t> getCurrentFrame();
AnimationType getCurrentAnimationType() { return mPlayingAnimType; }
Expand Down
1 change: 1 addition & 0 deletions apps/freeablo/farender/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ namespace FARender
// struct nk_font *tiny = nk_font_atlas_add_from_file(atlas, "../../../extra_font/ProggyTiny.ttf", 10, 0);
// struct nk_font *cousine = nk_font_atlas_add_from_file(atlas, "../../../extra_font/Cousine-Regular.ttf", 13, 0);
mConsoleFont = nk_font_atlas_add_from_file(&mNuklearGraphicsData.atlas, "resources/fonts/FreeMono/FreeMonoBold.ttf", 14, 0);

mNuklearGraphicsData.dev.font_tex =
nk_fa_font_stash_end(mSpriteManager, &mNuklearContext, mNuklearGraphicsData.atlas, mNuklearGraphicsData.dev.null);
// nk_style_load_all_cursors(ctx, atlas->cursors);
Expand Down
13 changes: 8 additions & 5 deletions apps/freeablo/faworld/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ namespace FAWorld
mType = ActorType(loader.load<uint8_t>());
}

void Actor::save(FASaveGame::GameSaver& saver)
void Actor::save(FASaveGame::GameSaver& saver) const
{
Serial::ScopedCategorySaver cat("Actor", saver);

Expand Down Expand Up @@ -240,10 +240,13 @@ namespace FAWorld

void Actor::pickupItem(Target::ItemTarget target)
{
auto& itemMap = getLevel()->getItemMap();
auto tile = target.item->getTile();
auto item = itemMap.takeItemAt(tile);
auto dropBack = [&]() { itemMap.dropItem(std::move(item), *this, tile); };
ItemMap& itemMap = getLevel()->getItemMap();
std::unique_ptr<Item> item = itemMap.takeItemAt(target.itemLocation);

if (!item)
return;

auto dropBack = [&]() { itemMap.dropItem(std::move(item), *this, target.itemLocation); };
switch (target.action)
{
case Target::ItemTarget::ActionType::autoEquip:
Expand Down
2 changes: 1 addition & 1 deletion apps/freeablo/faworld/actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace FAWorld
Actor(World& world, const DiabloExe::Npc& npc, const DiabloExe::DiabloExe& exe);
Actor(World& world, FASaveGame::GameLoader& loader);
virtual ~Actor();
virtual void save(FASaveGame::GameSaver& saver);
virtual void save(FASaveGame::GameSaver& saver) const;

virtual int32_t getOnKilledExperience() const { return 0; }
void pickupItem(Target::ItemTarget target);
Expand Down
5 changes: 2 additions & 3 deletions apps/freeablo/faworld/actor/basestate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,14 @@ namespace FAWorld
{
Target::ItemTarget target = actor.mTarget.get<Target::ItemTarget>();

auto tile = target.item->getTile();
if (actor.getPos().isNear(Position(tile.position)))
if (actor.getPos().isNear(Position(target.itemLocation)))
{
actor.pickupItem(target);
actor.mTarget.clear();
}
else
{
actor.mMoveHandler.setDestination(tile.position, true);
actor.mMoveHandler.setDestination(target.itemLocation, true);
}

break;
Expand Down
Loading

0 comments on commit 23d3730

Please sign in to comment.