forked from EasyRPG/Player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscene_debug.h
209 lines (172 loc) · 4.81 KB
/
scene_debug.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*
* This file is part of EasyRPG Player.
*
* EasyRPG Player is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EasyRPG Player is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EP_SCENE_DEBUG_H
#define EP_SCENE_DEBUG_H
// Headers
#include <vector>
#include "scene.h"
#include "window_command.h"
#include "window_numberinput.h"
#include "window_varlist.h"
#include "window_stringview.h"
#include "window_interpreter.h"
/**
* Scene Equip class.
* Displays the equipment of a hero.
*/
class Scene_Debug : public Scene {
public:
/**
* Constructor.
*/
Scene_Debug();
void Start() override;
void vUpdate() override;
void TransitionIn(SceneType prev_scene) override;
void TransitionOut(SceneType next_scene) override;
/**
* Updates the range list window.
*/
void UpdateRangeListWindow();
/**
* Resets the remembered indices
*/
static void ResetPrevIndices();
enum Mode {
eMain,
eSave,
eLoad,
eSwitch,
eVariable,
eGold,
eItem,
eBattle,
eMap,
eFullHeal,
eLevel,
eMoveSpeed,
eCallCommonEvent,
eCallMapEvent,
eCallBattleEvent,
eString,
eInterpreter,
eOpenMenu,
eLastMainMenuOption,
};
enum UiMode {
eUiMain,
eUiRangeList,
eUiVarList,
eUiNumberInput,
eUiStringView,
eUiChoices,
eUiInterpreterView
};
private:
Mode mode = eMain;
/** Current Page being displayed */
int range_page = 0;
/** Current range being displayed. */
int range_index = 0;
/** Creates Range window. */
void CreateRangeWindow();
/** Creates variable list View window. */
void CreateVarListWindow();
/** Creates number input window. */
void CreateNumberInputWindow();
/** Creates choices window. */
void CreateChoicesWindow();
/** Creates string view window. */
void CreateStringViewWindow();
/** Creates interpreter window. */
void CreateInterpreterWindow();
/** Get the last page for the current mode */
int GetLastPage();
/** Get the first item number for the selected range */
int GetSelectedIndexFromRange() const;
void RestoreRangeSelectionFromSelectedValue(int value);
int GetNumMainMenuItems() const;
void DoSwitch();
void DoVariable();
void DoGold();
void DoItem();
void DoBattle();
void DoMap();
void DoFullHeal();
void DoLevel();
void DoMoveSpeed();
void DoCallCommonEvent();
void DoCallMapEvent();
void DoCallBattleEvent();
void DoOpenMenu();
const int choice_window_width = 120;
/** Displays a range selection for mode. */
std::unique_ptr<Window_Command> range_window;
/** Displays the vars inside the current range. */
std::unique_ptr<Window_VarList> var_window;
/** Number Editor. */
std::unique_ptr<Window_NumberInput> numberinput_window;
/** Choices window. */
std::unique_ptr<Window_Command> choices_window;
/** Windows for displaying multiline strings. */
std::unique_ptr<Window_StringView> stringview_window;
/** Displays the currently running inteprreters. */
std::unique_ptr<Window_Interpreter> interpreter_window;
struct StackFrame {
UiMode uimode = eUiMain;
int value = 0;
};
std::array<StackFrame,8> stack;
int stack_index = 0;
StackFrame& GetFrame(int n = 0);
const StackFrame& GetFrame(int n = 0) const;
int GetStackSize() const;
void Push(UiMode ui);
void Pop();
void SetupUiRangeList();
void PushUiRangeList();
void PushUiVarList();
void PushUiNumberInput(int init_value, int digits, bool show_operator);
void PushUiChoices(std::vector<std::string> choices, std::vector<bool> choices_enabled);
void PushUiStringView();
void PushUiInterpreterView();
Window_VarList::Mode GetWindowMode() const;
void UpdateFrameValueFromUi();
void UpdateDetailWindow();
void RefreshDetailWindow();
bool IsValidMapId(int map_id) const;
void UpdateArrows();
int arrow_frame = 0;
bool strings_cached = false;
std::vector<lcf::DBString> strings;
bool interpreter_states_cached = false;
void UpdateInterpreterWindow(int index);
lcf::rpg::SaveEventExecFrame& GetSelectedInterpreterFrameFromUiState() const;
void CacheBackgroundInterpreterStates();
struct {
std::vector<int> ev;
std::vector<int> ce;
std::vector<lcf::rpg::SaveEventExecState> state_ev;
std::vector<lcf::rpg::SaveEventExecState> state_ce;
// Frame-scoped data types introduced in 'ScopedVars' branch
// bool show_frame_switches = false;
// bool show_frame_vars = false;
int selected_state = -1;
int selected_frame = -1;
} state_interpreter;
};
#endif