Skip to content

Commit de2968e

Browse files
committed
New Feature - Picture Inspector
Introduces a new debug scene and windows for viewing and inspecting active pictures and string windows. Updates scene and debug menu logic to support the new 'DebugPicture' scene, adds menu option, and implements detailed property display for both image and string pictures.
1 parent 59d37f2 commit de2968e

File tree

10 files changed

+516
-3
lines changed

10 files changed

+516
-3
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ add_library(${PROJECT_NAME} OBJECT
305305
src/scene.cpp
306306
src/scene_debug.cpp
307307
src/scene_debug.h
308+
src/scene_debug_picture.cpp
309+
src/scene_debug_picture.h
308310
src/scene_end.cpp
309311
src/scene_end.h
310312
src/scene_equip.cpp
@@ -420,6 +422,8 @@ add_library(${PROJECT_NAME} OBJECT
420422
src/window_command.h
421423
src/window_command_horizontal.cpp
422424
src/window_command_horizontal.h
425+
src/window_debug_picture.cpp
426+
src/window_debug_picture.h
423427
src/window.cpp
424428
src/window_equip.cpp
425429
src/window_equip.h

Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ libeasyrpg_player_a_SOURCES = \
280280
src/scene_battle_rpg2k3.h \
281281
src/scene_debug.cpp \
282282
src/scene_debug.h \
283+
src/scene_debug_picture.cpp \
284+
src/scene_debug_picture.h \
283285
src/scene_end.cpp \
284286
src/scene_end.h \
285287
src/scene_equip.cpp \
@@ -426,6 +428,8 @@ libeasyrpg_player_a_SOURCES = \
426428
src/window_numberinput.h \
427429
src/window_paramstatus.cpp \
428430
src/window_paramstatus.h \
431+
src/window_debug_picture.cpp \
432+
src/window_debug_picture.h \
429433
src/window_savefile.cpp \
430434
src/window_savefile.h \
431435
src/window_selectable.cpp \

src/scene.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
std::shared_ptr<Scene> Scene::instance;
4545
std::vector<std::shared_ptr<Scene> > Scene::old_instances;
4646
std::vector<std::shared_ptr<Scene> > Scene::instances;
47-
const char Scene::scene_names[SceneMax][12] =
47+
const char Scene::scene_names[SceneMax][13] =
4848
{
4949
"Null",
5050
"Title",
@@ -69,7 +69,8 @@ const char Scene::scene_names[SceneMax][12] =
6969
"GameBrowser",
7070
"Teleport",
7171
"Settings",
72-
"Language"
72+
"Language",
73+
"DebugPicture"
7374
};
7475

7576
enum PushPopOperation {
@@ -116,6 +117,8 @@ lcf::rpg::SaveSystem::Scene Scene::rpgRtSceneFromSceneType(SceneType t) {
116117
return lcf::rpg::SaveSystem::Scene_game_over;
117118
case Debug:
118119
return lcf::rpg::SaveSystem::Scene_debug;
120+
case DebugPicture:
121+
return lcf::rpg::SaveSystem::Scene_debug;
119122
}
120123
return lcf::rpg::SaveSystem::Scene(-1);
121124
}

src/scene.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class Scene {
6060
Teleport,
6161
Settings,
6262
LanguageMenu,
63+
DebugPicture,
6364
SceneMax
6465
};
6566

@@ -203,7 +204,7 @@ class Scene {
203204
static std::vector<std::shared_ptr<Scene> > old_instances;
204205

205206
/** Contains name of the Scenes. For debug purposes. */
206-
static const char scene_names[SceneMax][12];
207+
static const char scene_names[SceneMax][13];
207208

208209
/**
209210
* Called by the graphic system to request drawing of a background, usually a system color background

src/scene_debug.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "scene_menu.h"
3535
#include "scene_save.h"
3636
#include "scene_map.h"
37+
#include "scene_debug_picture.h"
3738
#include "scene_battle.h"
3839
#include "player.h"
3940
#include "window_command.h"
@@ -621,6 +622,10 @@ void Scene_Debug::vUpdate() {
621622
PushUiRangeList();
622623
}
623624
break;
625+
case ePictureTool:
626+
Scene::Push(std::make_shared<Scene_DebugPicture>());
627+
mode = eMain;
628+
return;
624629
case eInterpreter:
625630
if (sz == 3) {
626631
auto action = interpreter_window->GetSelectedAction();
@@ -776,6 +781,7 @@ void Scene_Debug::UpdateRangeListWindow() {
776781
addItem("Call MapEvent", Scene::Find(Scene::Map) != nullptr);
777782
addItem("Call BtlEvent", is_battle);
778783
addItem("Strings", Player::IsPatchManiac());
784+
addItem("Pictures");
779785
addItem("Interpreter");
780786
addItem("Open Menu", !is_battle);
781787
}

src/scene_debug.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class Scene_Debug : public Scene {
7272
eCallMapEvent,
7373
eCallBattleEvent,
7474
eString,
75+
ePictureTool,
7576
eInterpreter,
7677
eOpenMenu,
7778
eLastMainMenuOption,

src/scene_debug_picture.cpp

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* This file is part of EasyRPG Player.
3+
*
4+
* EasyRPG Player is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* EasyRPG Player is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#include "scene_debug_picture.h"
19+
#include "input.h"
20+
#include "player.h"
21+
#include "game_system.h"
22+
#include "main_data.h"
23+
24+
Scene_DebugPicture::Scene_DebugPicture() {
25+
type = Scene::DebugPicture;
26+
}
27+
28+
void Scene_DebugPicture::Start() {
29+
// Make list window narrow (just IDs) to maximize info space
30+
int list_w = 64;
31+
32+
list_window = std::make_unique<Window_DebugPictureList>(
33+
Player::menu_offset_x,
34+
Player::menu_offset_y,
35+
list_w,
36+
MENU_HEIGHT
37+
);
38+
39+
info_window = std::make_unique<Window_DebugPictureInfo>(
40+
Player::menu_offset_x + list_w,
41+
Player::menu_offset_y,
42+
MENU_WIDTH - list_w,
43+
MENU_HEIGHT
44+
);
45+
46+
list_window->SetActive(true);
47+
list_window->SetIndex(0);
48+
49+
// Initialize info window with first item
50+
info_window->SetPictureId(list_window->GetPictureId());
51+
}
52+
53+
void Scene_DebugPicture::vUpdate() {
54+
list_window->Update();
55+
info_window->Update();
56+
57+
// Update info window based on selection
58+
if (list_window->GetActive()) {
59+
// Always refresh info window to see real-time coordinate updates
60+
info_window->SetPictureId(list_window->GetPictureId());
61+
info_window->Refresh();
62+
}
63+
64+
if (Input::IsTriggered(Input::CANCEL)) {
65+
Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Cancel));
66+
Scene::Pop();
67+
}
68+
}

src/scene_debug_picture.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* This file is part of EasyRPG Player.
3+
*
4+
* EasyRPG Player is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* EasyRPG Player is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#ifndef EP_SCENE_DEBUG_PICTURE_H
19+
#define EP_SCENE_DEBUG_PICTURE_H
20+
21+
#include "scene.h"
22+
#include "window_debug_picture.h"
23+
#include <memory>
24+
25+
class Scene_DebugPicture : public Scene {
26+
public:
27+
Scene_DebugPicture();
28+
void Start() override;
29+
void vUpdate() override;
30+
31+
private:
32+
std::unique_ptr<Window_DebugPictureList> list_window;
33+
std::unique_ptr<Window_DebugPictureInfo> info_window;
34+
};
35+
36+
#endif

0 commit comments

Comments
 (0)