OpenGothic
Open source reimplementation of Gothic I and II
Loading...
Searching...
No Matches
marvin.h
Go to the documentation of this file.
1#pragma once
2
3#include <Tempest/Vec>
4#include <Tempest/Signal>
5#include <string>
6#include <vector>
7#include "world/world.h"
8
9class Marvin {
10 public:
11 Marvin();
12
13 Tempest::Signal<void(std::string_view)> print;
14
15 bool autoComplete(std::string& v);
16 bool exec(std::string_view v);
17
18 private:
19 enum CmdType {
20 C_None,
21 C_Incomplete,
22 C_Extra,
23 C_Invalid,
24
25 // gdb-like
26 C_PrintVar,
27 C_SetVar,
28
29 // rendering
30 C_ToggleFrame,
31 // game
32 C_ToggleDesktop,
33 C_ToggleTime,
34 C_TimeMultiplyer,
35 C_TimeRealtime,
36 // npc
37 C_CheatFull,
38 C_CheatGod,
39 C_Kill,
40 // camera
41 C_CamAutoswitch,
42 C_CamMode,
43 C_ToggleCamDebug,
44 C_ToggleCamera,
45 C_ToggleInertia,
46 C_ZToggleTimeDemo,
47
48 C_ZTrigger,
49 C_ZUntrigger,
50
51 C_AiGoTo,
52 C_GoToPos,
53 C_GoToVob,
54 C_GoToWayPoint,
55 C_GoToCamera,
56
57 C_SetTime,
58
59 C_Insert,
60 C_PlayAni,
61
62 // opengothic specific
63 C_ToggleGI,
64 C_ToggleVsm,
65 C_ToggleRtsm,
66 };
67
68 struct Cmd {
69 std::string_view cmd = "";
70 CmdType type = C_None;
71 };
72
73 struct CmdVal {
74 CmdVal() = default;
75 CmdVal(CmdType t){ cmd.type = t; };
76 CmdVal(Cmd cmd):cmd(cmd) {};
77
78 Cmd cmd;
79 std::string_view complete = "";
80 bool fullword = false;
81
82 std::string_view argv[4] = {};
83 };
84
85 CmdVal recognize(std::string_view v);
86 CmdVal isMatch(std::string_view inp, const Cmd& cmd) const;
87 auto completeInstanceName(std::string_view inp, bool& fullword) const -> std::string_view;
88
89 bool addItemOrNpcBySymbolName(World* world, std::string_view name, const Tempest::Vec3& at);
90 bool printVariable (World* world, std::string_view name);
91 bool setVariable (World* world, std::string_view name, std::string_view value);
92 bool setTime (World& world, std::string_view hh, std::string_view mm);
93 bool goToVob (World& world, Npc& player, Camera& c, std::string_view name, size_t n);
94
95 std::vector<Cmd> cmd;
96 };
97
Definition marvin.h:9
Marvin()
Definition marvin.cpp:51
bool exec(std::string_view v)
Definition marvin.cpp:255
Tempest::Signal< void(std::string_view)> print
Definition marvin.h:13
bool autoComplete(std::string &v)
Definition marvin.cpp:243
Definition npc.h:25
Definition world.h:31