mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 09:23:51 +00:00
ShowMap & FillMap commands, merged next
This commit is contained in:
parent
8214966d44
commit
98c1dc1151
5 changed files with 66 additions and 1 deletions
|
@ -189,6 +189,8 @@ namespace MWBase
|
||||||
virtual void allowMouse() = 0;
|
virtual void allowMouse() = 0;
|
||||||
virtual void notifyInputActionBound() = 0;
|
virtual void notifyInputActionBound() = 0;
|
||||||
|
|
||||||
|
virtual void addVisitedLocation(const std::string& name, int x, int y) = 0;
|
||||||
|
|
||||||
virtual void removeDialog(OEngine::GUI::Layout* dialog) = 0;
|
virtual void removeDialog(OEngine::GUI::Layout* dialog) = 0;
|
||||||
///< Hides dialog and schedules dialog to be deleted.
|
///< Hides dialog and schedules dialog to be deleted.
|
||||||
|
|
||||||
|
|
|
@ -954,3 +954,8 @@ bool WindowManager::getPlayerSleeping ()
|
||||||
{
|
{
|
||||||
return mWaitDialog->getSleeping();
|
return mWaitDialog->getSleeping();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::addVisitedLocation(const std::string& name, int x, int y)
|
||||||
|
{
|
||||||
|
mMap->addVisitedLocation (name, x, y);
|
||||||
|
}
|
||||||
|
|
|
@ -172,6 +172,8 @@ namespace MWGui
|
||||||
virtual void allowMouse();
|
virtual void allowMouse();
|
||||||
virtual void notifyInputActionBound();
|
virtual void notifyInputActionBound();
|
||||||
|
|
||||||
|
virtual void addVisitedLocation(const std::string& name, int x, int y);
|
||||||
|
|
||||||
virtual void removeDialog(OEngine::GUI::Layout* dialog); ///< Hides dialog and schedules dialog to be deleted.
|
virtual void removeDialog(OEngine::GUI::Layout* dialog); ///< Hides dialog and schedules dialog to be deleted.
|
||||||
|
|
||||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||||
|
|
|
@ -203,5 +203,7 @@ op 0x200019c: PlaceAtPc
|
||||||
op 0x200019d: PlaceAtMe
|
op 0x200019d: PlaceAtMe
|
||||||
op 0x200019e: PlaceAtMe Explicit
|
op 0x200019e: PlaceAtMe Explicit
|
||||||
op 0x200019f: GetPcSleep
|
op 0x200019f: GetPcSleep
|
||||||
opcodes 0x20001a0-0x3ffffff unused
|
op 0x20001a0: ShowMap
|
||||||
|
op 0x20001a1: FillMap
|
||||||
|
opcodes 0x20001a2-0x3ffffff unused
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
|
|
||||||
#include "guiextensions.hpp"
|
#include "guiextensions.hpp"
|
||||||
|
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
#include <components/compiler/extensions.hpp>
|
#include <components/compiler/extensions.hpp>
|
||||||
|
|
||||||
#include <components/interpreter/interpreter.hpp>
|
#include <components/interpreter/interpreter.hpp>
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
|
#include <components/esm_store/store.hpp>
|
||||||
|
#include <components/esm_store/reclists.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
|
@ -91,6 +96,47 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class OpShowMap : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
std::string cell = (runtime.getStringLiteral (runtime[0].mInteger));
|
||||||
|
boost::algorithm::to_lower(cell);
|
||||||
|
runtime.pop();
|
||||||
|
|
||||||
|
// "Will match complete or partial cells, so ShowMap, "Vivec" will show cells Vivec and Vivec, Fred's House as well."
|
||||||
|
// http://www.uesp.net/wiki/Tes3Mod:ShowMap
|
||||||
|
|
||||||
|
const ESMS::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells;
|
||||||
|
for (ESMS::CellList::ExtCells::const_iterator it = extCells.begin(); it != extCells.end(); ++it)
|
||||||
|
{
|
||||||
|
std::string name = it->second->name;
|
||||||
|
boost::algorithm::to_lower(name);
|
||||||
|
if (name.find(cell) != std::string::npos)
|
||||||
|
MWBase::Environment::get().getWindowManager()->addVisitedLocation (it->second->name, it->first.first, it->first.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class OpFillMap : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
const ESMS::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells;
|
||||||
|
for (ESMS::CellList::ExtCells::const_iterator it = extCells.begin(); it != extCells.end(); ++it)
|
||||||
|
{
|
||||||
|
std::string name = it->second->name;
|
||||||
|
if (name != "")
|
||||||
|
MWBase::Environment::get().getWindowManager()->addVisitedLocation (name, it->first.first, it->first.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
const int opcodeEnableBirthMenu = 0x200000e;
|
const int opcodeEnableBirthMenu = 0x200000e;
|
||||||
const int opcodeEnableClassMenu = 0x200000f;
|
const int opcodeEnableClassMenu = 0x200000f;
|
||||||
const int opcodeEnableNameMenu = 0x2000010;
|
const int opcodeEnableNameMenu = 0x2000010;
|
||||||
|
@ -105,6 +151,8 @@ namespace MWScript
|
||||||
const int opcodeGetButtonPressed = 0x2000137;
|
const int opcodeGetButtonPressed = 0x2000137;
|
||||||
const int opcodeToggleFogOfWar = 0x2000145;
|
const int opcodeToggleFogOfWar = 0x2000145;
|
||||||
const int opcodeToggleFullHelp = 0x2000151;
|
const int opcodeToggleFullHelp = 0x2000151;
|
||||||
|
const int opcodeShowMap = 0x20001a0;
|
||||||
|
const int opcodeFillMap = 0x20001a1;
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
|
@ -132,6 +180,9 @@ opcodeEnableStatsReviewMenu);
|
||||||
|
|
||||||
extensions.registerInstruction ("togglefullhelp", "", opcodeToggleFullHelp);
|
extensions.registerInstruction ("togglefullhelp", "", opcodeToggleFullHelp);
|
||||||
extensions.registerInstruction ("tfh", "", opcodeToggleFullHelp);
|
extensions.registerInstruction ("tfh", "", opcodeToggleFullHelp);
|
||||||
|
|
||||||
|
extensions.registerInstruction ("showmap", "S", opcodeShowMap);
|
||||||
|
extensions.registerInstruction ("fillmap", "", opcodeFillMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
|
@ -167,6 +218,9 @@ opcodeEnableStatsReviewMenu);
|
||||||
interpreter.installSegment5 (opcodeToggleFogOfWar, new OpToggleFogOfWar);
|
interpreter.installSegment5 (opcodeToggleFogOfWar, new OpToggleFogOfWar);
|
||||||
|
|
||||||
interpreter.installSegment5 (opcodeToggleFullHelp, new OpToggleFullHelp);
|
interpreter.installSegment5 (opcodeToggleFullHelp, new OpToggleFullHelp);
|
||||||
|
|
||||||
|
interpreter.installSegment5 (opcodeShowMap, new OpShowMap);
|
||||||
|
interpreter.installSegment5 (opcodeFillMap, new OpFillMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue