Skip to content

Commit

Permalink
Interpreter debug window: Extended view to display the initial event …
Browse files Browse the repository at this point in the history
…execution type of an interpreter stack (Action, Touch, Parallel, etc...)
  • Loading branch information
florianessl committed Feb 6, 2025
1 parent eb37dbc commit 513dd4a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/game_interpreter_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ namespace Game_Interpreter_Shared {
CommonEvent,
BattleEvent
};
static constexpr auto kEventType = lcf::makeEnumTags<EventType>(
"None",
"MapEvent",
"CommonEvent",
"BattleEvent"
);

enum class ExecutionType {
/*
Expand All @@ -59,6 +65,21 @@ namespace Game_Interpreter_Shared {
Eval,
DebugCall
};
static constexpr auto kExecutionType = lcf::makeEnumTags<ExecutionType>(
"Action",
"Touch",
"Collision",
"AutoStart",
"Parallel",
"Call",
"BattleStart",
"BattleParallel",
"---",
"---",
"DeathHandler",
"Eval",
"DebugCall"
);

/*
* Indicates how the target of an interpreter operation (lvalue) should be evaluated.
Expand Down
6 changes: 5 additions & 1 deletion src/window_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ void Window_Interpreter::DrawDescriptionLines() {
rect = GetItemRect(i++);
contents->ClearRect(rect);

contents->TextDraw(rect.x, rect.y, Font::ColorDefault, "Stack Size: ");
auto str_ex_type = std::string(Game_Interpreter_Shared::kExecutionType.tag(static_cast<int>(stack_display_items[0].type_ex)));
contents->TextDraw(rect.x, rect.y, Font::ColorDefault, "(");
contents->TextDraw(rect.x + 6, rect.y, Font::ColorHeal, str_ex_type);
contents->TextDraw(rect.x + 6 * (str_ex_type.length() + 1), rect.y, Font::ColorDefault, ")");
contents->TextDraw(rect.x + rect.width / 2, rect.y, Font::ColorDefault, "Stack Size: ");
contents->TextDraw(GetWidth() - 16, rect.y, Font::ColorCritical, std::to_string(state.stack.size()), Text::AlignRight);
}

Expand Down

0 comments on commit 513dd4a

Please sign in to comment.