From dd87f2ee1d088e78a5545d09534f48c52390c8fa Mon Sep 17 00:00:00 2001 From: Tom Mason Date: Thu, 17 May 2018 08:23:25 +0200 Subject: [PATCH] shops mostly working in mp --- apps/fontgenerator/main.cpp | 6 +- apps/freeablo/fa_main.cpp | 6 +- apps/freeablo/fagui/dialogmanager.cpp | 62 +++++++--- apps/freeablo/fagui/dialogmanager.h | 11 +- apps/freeablo/fagui/guimanager.cpp | 2 +- apps/freeablo/fagui/guimanager.h | 17 +-- apps/freeablo/faworld/inventory.cpp | 10 +- apps/freeablo/faworld/item.cpp | 2 +- apps/freeablo/faworld/item.h | 2 +- apps/freeablo/faworld/player.cpp | 5 +- apps/freeablo/faworld/playerbehaviour.cpp | 22 ++++ apps/freeablo/faworld/playerinput.cpp | 12 ++ apps/freeablo/faworld/playerinput.h | 11 +- apps/freeablo/faworld/storedata.cpp | 41 ++++++- apps/freeablo/faworld/storedata.h | 20 ++- apps/freeablo/faworld/world.cpp | 2 + components/faio/faio.cpp | 5 +- .../render/rocketglue/RenderInterfaceSDL2.h | 116 ------------------ .../render/rocketglue/SystemInterfaceSDL2.h | 41 ------- components/render/rocketglue/drawcommand.h | 36 ------ decisions.md | 14 ++- 21 files changed, 199 insertions(+), 244 deletions(-) delete mode 100644 components/render/rocketglue/RenderInterfaceSDL2.h delete mode 100644 components/render/rocketglue/SystemInterfaceSDL2.h delete mode 100644 components/render/rocketglue/drawcommand.h diff --git a/apps/fontgenerator/main.cpp b/apps/fontgenerator/main.cpp index 0e3b459ca..0131355e2 100644 --- a/apps/fontgenerator/main.cpp +++ b/apps/fontgenerator/main.cpp @@ -1,9 +1,11 @@ +// clang-format off +#include #include +#include +// clang-format on #include #include #include -#include -#include #include void help(char** argv) diff --git a/apps/freeablo/fa_main.cpp b/apps/freeablo/fa_main.cpp index cdec159c0..0f525cff7 100644 --- a/apps/freeablo/fa_main.cpp +++ b/apps/freeablo/fa_main.cpp @@ -1,10 +1,10 @@ -#include - +// clang-format off #include #include #include #include - +// clang-format on +#include #include #include diff --git a/apps/freeablo/fagui/dialogmanager.cpp b/apps/freeablo/fagui/dialogmanager.cpp index 7ceb95ca1..f4589ff33 100644 --- a/apps/freeablo/fagui/dialogmanager.cpp +++ b/apps/freeablo/fagui/dialogmanager.cpp @@ -1,4 +1,6 @@ #include "dialogmanager.h" +#include "../engine/enginemain.h" +#include "../engine/localinputhandler.h" #include "../faworld/actor.h" #include "../faworld/equiptarget.h" #include "../faworld/player.h" @@ -393,34 +395,56 @@ namespace FAGui // While there are some similiraties between buying and selling I do not consider them to be that similar to implement // using single function. Identification dialog could probably be implemented like a sell dialog though. - void DialogManager::buyDialog(std::vector& items) + void DialogManager::buyDialog(const FAWorld::Actor* shopkeeper, std::vector& items) { + // TODO: this function is a mess, but ot sort of works right now, I'm planning on redoing dialog "soon", so it will do for now. + // Also note that after buying an item it will continue to show up as for sale after until you exit and re-enter dialog, is not fixed for the same + // reason as above. + DialogData d; d.widen(); int32_t cnt = 0; - auto& inventory = mWorld.getCurrentPlayer()->mInventory; - d.header({(boost::format("%2% Your gold : %1%") % inventory.getTotalGold() % "I have these items for sale :").str()}); + d.shopData.items = &items; + d.shopData.shopkeeper = shopkeeper; + + d.header( + {(boost::format("%2% Your gold : %1%") % mWorld.getCurrentPlayer()->mInventory.getTotalGold() % "I have these items for sale :").str()}); for (auto it = items.begin(); it != items.end(); ++it) { auto& item = *it; - auto price = item.getPrice(); + auto price = item.item.getPrice(); auto header = d.getHeader(); - d.textLines(item.descriptionForMerchants(), TextColor::white, false, {20, 40, 40}) - .setAction([this, price, header, it, &items, &inventory]() mutable { - if (inventory.getTotalGold() < price) - return fillMessageDialog(header, "You do not have enough gold"); - - if (!inventory.getInv(FAWorld::EquipTargetType::inventory).canFitItem(*it)) - return fillMessageDialog(header, "You do not have enough room in inventory"); - - confirmDialog(header, *it, price, "Are you sure you want to buy this item?", [this, price, it, &inventory, &items]() { - inventory.takeOutGold(price); - inventory.autoPlaceItem(*it); - items.erase(it); - auto recreate = [this, &items] { buyDialog(items); }; - mGuiManager.popDialogData(); + d.textLines(item.item.descriptionForMerchants(), TextColor::white, false, {20, 40, 40}) + .setAction([it, price]() { + auto& self = Engine::EngineMain::get()->mGuiManager->mDialogManager; + FAWorld::CharacterInventory& inventory = self.mWorld.getCurrentPlayer()->mInventory; + + // if (inventory.getTotalGold() < price) + // return fillMessageDialog(header, "You do not have enough gold"); + + // if (!inventory.getInv(FAWorld::EquipTargetType::inventory).canFitItem(it->item)) + // return fillMessageDialog(header, "You do not have enough room in inventory"); + + auto& data = Engine::EngineMain::get()->mGuiManager->mDialogs[Engine::EngineMain::get()->mGuiManager->mDialogs.size() - 1]; + + data.shopData.itemId = it->storeId; + + auto header = data.getHeader(); + + self.confirmDialog(header, it->item, price, "Are you sure you want to buy this item?", []() { + // inventory.takeOutGold(price); + // inventory.autoPlaceItem(it->item); + // items.erase(it); + + auto& shopData = Engine::EngineMain::get()->mGuiManager->mDialogs[Engine::EngineMain::get()->mGuiManager->mDialogs.size() - 1].shopData; + + auto input = FAWorld::PlayerInput::BuyItemData{shopData.itemId, shopData.shopkeeper->getId()}; + Engine::EngineMain::get()->getLocalInputHandler()->addInput( + FAWorld::PlayerInput(input, Engine::EngineMain::get()->mWorld->getCurrentPlayer()->getId())); + auto recreate = [=] { Engine::EngineMain::get()->mGuiManager->mDialogManager.buyDialog(shopData.shopkeeper, *shopData.items); }; + Engine::EngineMain::get()->mGuiManager->popDialogData(); recreate(); }); }) @@ -446,7 +470,7 @@ namespace FAGui d.textLines({td.at("introduction")}, TextColor::golden); d.skip_line(); d.textLines({td.at("talk")}, TextColor::blue).setAction([]() {}); - d.textLines({td.at("buyBasic")}).setAction([&]() { buyDialog(mWorld.getStoreData().griswoldBasicItems); }); + d.textLines({td.at("buyBasic")}).setAction([&]() { buyDialog(npc, mWorld.getStoreData().griswoldBasicItems); }); d.textLines({td.at("buyPremium")}).setAction([]() {}); d.textLines({td.at("sell")}).setAction([&] { sellDialog(griswoldSellFilter); }); d.textLines({td.at("repair")}).setAction([]() {}); diff --git a/apps/freeablo/fagui/dialogmanager.h b/apps/freeablo/fagui/dialogmanager.h index aa5d7393a..f5887dafa 100644 --- a/apps/freeablo/fagui/dialogmanager.h +++ b/apps/freeablo/fagui/dialogmanager.h @@ -16,6 +16,7 @@ namespace FAWorld class World; class Actor; class Item; + class StoreItem; } namespace FAGui @@ -80,6 +81,14 @@ namespace FAGui void clearLines(); std::vector getHeader() const { return mHeader; } + // HACK + struct + { + const FAWorld::Actor* shopkeeper = nullptr; + std::vector* items = nullptr; + uint32_t itemId = 0; + } shopData; + private: std::vector mHeader; std::vector mLines; @@ -100,7 +109,7 @@ namespace FAGui private: template void sellDialog(FilterType filter); - void buyDialog(std::vector& items); + void buyDialog(const FAWorld::Actor* shopkeeper, std::vector& items); void talkOgden(const FAWorld::Actor* npc); void talkFarnham(const FAWorld::Actor* npc); diff --git a/apps/freeablo/fagui/guimanager.cpp b/apps/freeablo/fagui/guimanager.cpp index 72de4e775..fa6cda3a5 100644 --- a/apps/freeablo/fagui/guimanager.cpp +++ b/apps/freeablo/fagui/guimanager.cpp @@ -90,7 +90,7 @@ namespace FAGui return ""; } - GuiManager::GuiManager(Engine::EngineMain& engine) : mEngine(engine) + GuiManager::GuiManager(Engine::EngineMain& engine) : mDialogManager(*this, *engine.mWorld.get()), mEngine(engine) { mMenuHandler.reset(new MenuHandler(engine)); diff --git a/apps/freeablo/fagui/guimanager.h b/apps/freeablo/fagui/guimanager.h index 3890b8fab..467ceefd9 100644 --- a/apps/freeablo/fagui/guimanager.h +++ b/apps/freeablo/fagui/guimanager.h @@ -1,17 +1,15 @@ - #pragma once - +#include "../engine/inputobserverinterface.h" +#include "dialogmanager.h" #include "textcolor.h" +#include #include +#include #include +#include #include #include -#include "../engine/inputobserverinterface.h" -#include -#include -#include - struct nk_context; typedef uint32_t nk_flags; struct nk_rect; @@ -135,7 +133,10 @@ namespace FAGui void notify(Engine::KeyboardInputAction action) override; void keyPress(const Input::Hotkey&) override; - private: + public: + DialogManager mDialogManager; + + // private: Engine::EngineMain& mEngine; FAWorld::Player* mPlayer = nullptr; std::string mHoveredInventoryItemText; diff --git a/apps/freeablo/faworld/inventory.cpp b/apps/freeablo/faworld/inventory.cpp index 3eee3ea1f..a41ac6247 100644 --- a/apps/freeablo/faworld/inventory.cpp +++ b/apps/freeablo/faworld/inventory.cpp @@ -588,9 +588,15 @@ namespace FAWorld copy.mCount -= toTake; quantity -= toTake; - mMainInventory.remove(item.mInvX, item.mInvY); + int32_t x = item.mInvX; + int32_t y = item.mInvY; + + mMainInventory.remove(x, y); if (copy.mCount > 0) - mMainInventory.placeItem(copy, item.mInvX, item.mInvY); + { + PlaceItemResult result = mMainInventory.placeItem(copy, x, y); + release_assert(result.succeeded()); + } if (quantity == 0) return; diff --git a/apps/freeablo/faworld/item.cpp b/apps/freeablo/faworld/item.cpp index af37a6060..b002cae3c 100644 --- a/apps/freeablo/faworld/item.cpp +++ b/apps/freeablo/faworld/item.cpp @@ -11,7 +11,7 @@ namespace FAWorld { - void Item::save(FASaveGame::GameSaver& saver) + void Item::save(FASaveGame::GameSaver& saver) const { saver.save(mIsReal); saver.save(mUniqueId); diff --git a/apps/freeablo/faworld/item.h b/apps/freeablo/faworld/item.h index 62ea8f362..a949c5a62 100644 --- a/apps/freeablo/faworld/item.h +++ b/apps/freeablo/faworld/item.h @@ -53,7 +53,7 @@ namespace FAWorld public: Item() = default; - void save(FASaveGame::GameSaver& saver); + void save(FASaveGame::GameSaver& saver) const; void load(FASaveGame::GameLoader& loader); ~Item(); // retrieve description which is shown when hovering over the items in your inventory diff --git a/apps/freeablo/faworld/player.cpp b/apps/freeablo/faworld/player.cpp index e7534eb10..55ec9f5dc 100644 --- a/apps/freeablo/faworld/player.cpp +++ b/apps/freeablo/faworld/player.cpp @@ -1,6 +1,8 @@ #include "player.h" +#include "../engine/enginemain.h" #include "../engine/threadmanager.h" #include "../fagui/dialogmanager.h" +#include "../fagui/guimanager.h" #include "../fasavegame/gameloader.h" #include "actorstats.h" #include "boost/algorithm/clamp.hpp" @@ -340,7 +342,8 @@ namespace FAWorld if (target && target->getPos().isNear(this->getPos()) && canTalkTo(target)) { - // mWorld.mDlgManager->talk(target); + if (mWorld.getCurrentPlayer() == this) + Engine::EngineMain::get()->mGuiManager->mDialogManager.talk(target); mTarget.clear(); } } diff --git a/apps/freeablo/faworld/playerbehaviour.cpp b/apps/freeablo/faworld/playerbehaviour.cpp index 871fea498..1bc9f3c89 100644 --- a/apps/freeablo/faworld/playerbehaviour.cpp +++ b/apps/freeablo/faworld/playerbehaviour.cpp @@ -4,6 +4,7 @@ #include "equiptarget.h" #include "input/inputmanager.h" #include "player.h" +#include "storedata.h" #include namespace FAWorld @@ -120,6 +121,27 @@ namespace FAWorld mPlayer->getWorld()->getItemFactory()); return; } + case PlayerInput::Type::BuyItem: + { + auto items = mPlayer->getWorld()->getStoreData().griswoldBasicItems; + auto item = std::find_if(items.begin(), items.end(), [&](StoreItem& item) { return item.storeId == input.mData.dataBuyItem.itemId; }); + + if (item == items.end()) + return; + + int32_t price = item->item.getPrice(); + if (mPlayer->mInventory.getTotalGold() < price) + return; + + if (!mPlayer->mInventory.getInv(FAWorld::EquipTargetType::inventory).canFitItem(item->item)) + return; + + mPlayer->mInventory.takeOutGold(price); + mPlayer->mInventory.autoPlaceItem(item->item); + items.erase(item); + + return; + } case PlayerInput::Type::PlayerJoined: case PlayerInput::Type::PlayerLeft: { diff --git a/apps/freeablo/faworld/playerinput.cpp b/apps/freeablo/faworld/playerinput.cpp index f58b6bf03..f1d0a7097 100644 --- a/apps/freeablo/faworld/playerinput.cpp +++ b/apps/freeablo/faworld/playerinput.cpp @@ -121,4 +121,16 @@ namespace FAWorld void PlayerInput::PlayerJoinedData::save(Serial::Saver& saver) { saver.save(peerId); } void PlayerInput::PlayerJoinedData::load(Serial::Loader& loader) { peerId = loader.load(); } + + void PlayerInput::BuyItemData::save(Serial::Saver& saver) + { + saver.save(itemId); + saver.save(shopkeeperId); + } + + void PlayerInput::BuyItemData::load(Serial::Loader& loader) + { + itemId = loader.load(); + shopkeeperId = loader.load(); + } } diff --git a/apps/freeablo/faworld/playerinput.h b/apps/freeablo/faworld/playerinput.h index ed358f606..81d93dce0 100644 --- a/apps/freeablo/faworld/playerinput.h +++ b/apps/freeablo/faworld/playerinput.h @@ -14,7 +14,8 @@ MACRO(InventorySlotClicked) \ MACRO(SplitGoldStackIntoCursor) \ MACRO(PlayerJoined) \ - MACRO(PlayerLeft) + MACRO(PlayerLeft) \ + MACRO(BuyItem) namespace Serial { @@ -103,6 +104,14 @@ namespace FAWorld void save(Serial::Saver&) {} void load(Serial::Loader&) {} }; + struct BuyItemData + { + uint32_t itemId; + int32_t shopkeeperId; + + void save(Serial::Saver& saver); + void load(Serial::Loader& loader); + }; // All this macro mess takes care of generating boilerplate code to wrap up the above structs into a union with a type enum, and // save/load functions. So, eg, if mType == TargetTile, then you can access mData.dataTargetType. You can also call .save() and .load() diff --git a/apps/freeablo/faworld/storedata.cpp b/apps/freeablo/faworld/storedata.cpp index 8467dc102..e555a47ba 100644 --- a/apps/freeablo/faworld/storedata.cpp +++ b/apps/freeablo/faworld/storedata.cpp @@ -1,5 +1,5 @@ #include "storedata.h" -#include "item.h" +#include "../fasavegame/gameloader.h" #include "itemfactory.h" #include @@ -12,7 +12,42 @@ namespace FAWorld int32_t count = rng.randomInRange(10, 20); griswoldBasicItems.resize(count); for (auto& item : griswoldBasicItems) - item = mItemFactory.generateBaseItem(mItemFactory.randomItemId(ItemFilter::maxQLvl(ilvl), ItemFilter::sellableGriswoldBasic())); - std::sort(griswoldBasicItems.begin(), griswoldBasicItems.end(), [](const Item& lhs, const Item& rhs) { return lhs.baseId() < rhs.baseId(); }); + { + item.item = mItemFactory.generateBaseItem(mItemFactory.randomItemId(ItemFilter::maxQLvl(ilvl), ItemFilter::sellableGriswoldBasic())); + item.storeId = mNextItemId; + mNextItemId++; + } + + std::sort(griswoldBasicItems.begin(), griswoldBasicItems.end(), [](const StoreItem& lhs, const StoreItem& rhs) { + return lhs.item.baseId() < rhs.item.baseId(); + }); + } + + void StoreData::save(FASaveGame::GameSaver& saver) const + { + saver.save(uint32_t(griswoldBasicItems.size())); + for (auto& item : griswoldBasicItems) + { + saver.save(item.storeId); + item.item.save(saver); + } + + saver.save(mNextItemId); + } + + void StoreData::load(FASaveGame::GameLoader& loader) + { + griswoldBasicItems.clear(); + + uint32_t size = loader.load(); + griswoldBasicItems.resize(size); + + for (uint32_t i = 0; i < size; i++) + { + griswoldBasicItems[i].storeId = loader.load(); + griswoldBasicItems[i].item.load(loader); + } + + mNextItemId = loader.load(); } } diff --git a/apps/freeablo/faworld/storedata.h b/apps/freeablo/faworld/storedata.h index 96d5aa93b..7710c544c 100644 --- a/apps/freeablo/faworld/storedata.h +++ b/apps/freeablo/faworld/storedata.h @@ -1,4 +1,5 @@ #pragma once +#include "item.h" #include #include @@ -7,23 +8,38 @@ namespace Random class Rng; } +namespace FASaveGame +{ + class GameLoader; + class GameSaver; +} + namespace FAWorld { - class Item; class ItemFactory; + struct StoreItem + { + Item item; + uint32_t storeId = 0; + }; + /// class for storing and regenerating items sold in various stores class StoreData { public: explicit StoreData(const ItemFactory& itemFactory); + void save(FASaveGame::GameSaver& saver) const; + void load(FASaveGame::GameLoader& loader); + void regenerateGriswoldBasicItems(int32_t ilvl, Random::Rng& rng); public: - std::vector griswoldBasicItems; + std::vector griswoldBasicItems; private: + uint32_t mNextItemId = 0; const ItemFactory& mItemFactory; }; } diff --git a/apps/freeablo/faworld/world.cpp b/apps/freeablo/faworld/world.cpp index 90d232c01..46a36a350 100644 --- a/apps/freeablo/faworld/world.cpp +++ b/apps/freeablo/faworld/world.cpp @@ -71,6 +71,7 @@ namespace FAWorld } mNextId = loader.load(); + mStoreData->load(loader); loader.runFunctionsToRunAtEnd(); @@ -97,6 +98,7 @@ namespace FAWorld } saver.save(mNextId); + mStoreData->save(saver); } void World::setupObjectIdMappers() diff --git a/components/faio/faio.cpp b/components/faio/faio.cpp index a22a49dfc..0af8f449d 100644 --- a/components/faio/faio.cpp +++ b/components/faio/faio.cpp @@ -7,10 +7,11 @@ namespace bfs = boost::filesystem; -// We don't want warnings from StormLibs headers -#include +// clang-format off #include +#include #include +// clang-format on namespace FAIO { diff --git a/components/render/rocketglue/RenderInterfaceSDL2.h b/components/render/rocketglue/RenderInterfaceSDL2.h deleted file mode 100644 index e6d5be292..000000000 --- a/components/render/rocketglue/RenderInterfaceSDL2.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * This source file is part of libRocket, the HTML/CSS Interface Middleware - * - * For the latest information, see http://www.librocket.com - * - * Copyright (c) 2008-2010 Nuno Silva - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ -#ifndef RENDERINTERFACESDL2_H -#define RENDERINTERFACESDL2_H - -#include -#include -#include - -#include -//#include - -#include "../sdl_gl_funcs.h" - -#include - -#include - -#include "drawcommand.h" - -#if !(SDL_VIDEO_RENDER_OGL) -#error "Only the opengl sdl backend is supported. To add support for others, see http://mdqinc.com/blog/2013/01/integrating-librocket-with-sdl-2/" -#endif - -class RocketSDL2Renderer : public Rocket::Core::RenderInterface -{ - -public: - RocketSDL2Renderer(SDL_Renderer* renderer, - SDL_Window* screen, - std::function loadTextureFunc, - std::function generateTextureFunc, - std::function releaseTextureFunc); - - void drawBuffer(std::vector& buffer, Render::SpriteCacheBase* cache); - - /// Called by Rocket when it wants to render geometry that it does not wish to optimise. - virtual void RenderGeometry(Rocket::Core::Vertex* vertices, - int num_vertices, - int* indices, - int num_indices, - Rocket::Core::TextureHandle texture, - const Rocket::Core::Vector2f& translation); - - /// Called by Rocket when it wants to enable or disable scissoring to clip content. - virtual void EnableScissorRegion(bool enable); - /// Called by Rocket when it wants to change the scissor region. - virtual void SetScissorRegion(int x, int y, int width, int height); - - /// Called by Rocket when a texture is required by the library. - virtual bool LoadTexture(Rocket::Core::TextureHandle& texture_handle, Rocket::Core::Vector2i& texture_dimensions, const Rocket::Core::String& source); - - /// Called by Rocket when a texture is required to be built from an internally-generated sequence of pixels. - virtual bool - GenerateTexture(Rocket::Core::TextureHandle& texture_handle, const Rocket::Core::byte* source, const Rocket::Core::Vector2i& source_dimensions); - - /// Called by Rocket when a loaded texture is no longer required. - virtual void ReleaseTexture(Rocket::Core::TextureHandle texture_handle); - - std::vector* mDrawBuffer; - -private: - void RenderGeometryImp(Rocket::Core::Vertex* vertices, - int num_vertices, - int* indices, - int num_indices, - Rocket::Core::TextureHandle texture, - const Rocket::Core::Vector2f& translation, - Render::SpriteCacheBase* cache); - void EnableScissorRegionImp(bool enable); - void SetScissorRegionImp(int x, int y, int width, int height); - - std::function mLoadTextureFunc; - std::function mGenerateTextureFunc; - std::function mReleaseTextureFunc; - - SDL_Renderer* mRenderer; - SDL_Window* mScreen; - PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; - - void getGLFunc() - { -#ifdef WIN32 - glUseProgramObjectARB = static_cast(SDL_GL_GetProcAddress("glUseProgramObjectARB")); -#else -#pragma GCC system_header // this was the only way I could silence the warning :( - glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)(SDL_GL_GetProcAddress("glUseProgramObjectARB")); -#endif - } -}; - -#endif diff --git a/components/render/rocketglue/SystemInterfaceSDL2.h b/components/render/rocketglue/SystemInterfaceSDL2.h deleted file mode 100644 index c4c4da0ee..000000000 --- a/components/render/rocketglue/SystemInterfaceSDL2.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This source file is part of libRocket, the HTML/CSS Interface Middleware - * - * For the latest information, see http://www.librocket.com - * - * Copyright (c) 2008-2010 Nuno Silva - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ -#ifndef SYSTEMINTEFACESDL2_H -#define SYSTEMINTEFACESDL2_H - -#include -#include - -#include - -class RocketSDL2SystemInterface : public Rocket::Core::SystemInterface -{ -public: - float GetElapsedTime(); - bool LogMessage(Rocket::Core::Log::Type type, const Rocket::Core::String& message); -}; -#endif diff --git a/components/render/rocketglue/drawcommand.h b/components/render/rocketglue/drawcommand.h deleted file mode 100644 index 780f53512..000000000 --- a/components/render/rocketglue/drawcommand.h +++ /dev/null @@ -1,36 +0,0 @@ - -#pragma once - -#include -#include -#include - -#include - -struct DrawCommand -{ - enum class DraCom - { - Draw, - EnableScissor, - SetScissor - } mode; - - struct - { - std::vector vertices; - std::vector indices; - Rocket::Core::TextureHandle texture; - Rocket::Core::Vector2f translation; - } draw; - - struct - { - int x; - int y; - int width; - int height; - } setScissor; - - bool enableScissor; -}; diff --git a/decisions.md b/decisions.md index 7ba5cf280..d603cf6fd 100644 --- a/decisions.md +++ b/decisions.md @@ -8,6 +8,16 @@ decisions you make over the course of the project's lifetime. When adding entries here, please place them at the top of the list, preferably with the title of the entry being the output from `date`. +## Mon Apr 30 08:41:55 CEST 2018^M +- Decided not to use floating point calculation in the game simulation in order to + preserve determinism. It is possible achieve this while still using floats, but + in my opinion it is easier and safer to just avoid it and use integer and fixed + point maths instead. + +## 19 Feb 2017 12:44:21 +- No more unsigned ints. They just cause problems (just finished spending several + hours debugging a problem with a negative value being passed as a size_t). + ## Tue Jan 2 17:39:15 CET 2018 - These were actually decided a while ago, but I never wrote them down. - The existing multiplayer implementation was not working, decided to pursue @@ -55,7 +65,3 @@ of that have already been made. - using qt for the launcher because it has good cross platform support (better than gtk), and besides, gtk is yucky. Also, gtk and qt are the only real options for cross platform gui libs in c/c++. - -## 19 Feb 2017 12:44:21 -No more unsigned ints. They just cause problems (just finished spending several -hours debugging a problem with a negative value being passed as a size_t).