125 lines
2.8 KiB
C++
125 lines
2.8 KiB
C++
#include <filesystem>
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <unordered_set>
|
|
|
|
#include <Game/Core.hpp>
|
|
|
|
#include <windows.h>
|
|
|
|
void Setup() {
|
|
ScriptInfo Info;
|
|
Info.Name = "Object Debugger";
|
|
Info.Description = "Debug objects";
|
|
Info.Version = "1.00";
|
|
Info.Category = "Magic";
|
|
Info.Author = "Warren";
|
|
Info.UID = "UID";
|
|
Info.ForumPage = "forum.alpacabot.org";
|
|
SetScriptInfo(Info);
|
|
}
|
|
|
|
bool OnStart() {
|
|
SetLoopDelay(5);
|
|
return true;
|
|
}
|
|
|
|
std::vector<Interactable::GameObject> get_game_objects() {
|
|
return GameObjects::GetAllWithin(10);
|
|
}
|
|
|
|
std::vector<Interactable::WallObject> get_wall_objects() {
|
|
return WallObjects::GetAllWithin(10);
|
|
}
|
|
|
|
std::vector<Interactable::GroundObject> get_ground_objects() {
|
|
return GroundObjects::GetAllWithin(10);
|
|
}
|
|
|
|
std::vector<Interactable::DecorativeObject> get_decorative_objects() {
|
|
return DecorativeObjects::GetAllWithin(10);
|
|
}
|
|
|
|
std::vector<Interactable::NPC> get_npcs() { return NPCs::GetAllWithin(10); }
|
|
|
|
std::vector<Interactable::Player> get_players() {
|
|
return Players::GetAllWithin(10);
|
|
}
|
|
|
|
enum class paint_mode {
|
|
game_objects,
|
|
wall_objects,
|
|
ground_objects,
|
|
decorative_objects,
|
|
npcs,
|
|
players
|
|
};
|
|
|
|
void paint_object(const auto &obj, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
|
|
const auto model = obj.GetModel();
|
|
Paint::DrawModel(model, r, g, b, a);
|
|
}
|
|
|
|
paint_mode pmode = paint_mode::players;
|
|
|
|
bool Loop() {
|
|
Paint::Clear();
|
|
|
|
if (GetAsyncKeyState(VK_MENU)) {
|
|
pmode = static_cast<paint_mode>((static_cast<int>(pmode) + 1) % 6);
|
|
Wait(200);
|
|
}
|
|
|
|
auto paint_objects = [&](const auto &objects, uint8_t r, uint8_t g,
|
|
uint8_t b) {
|
|
for (const auto &obj : objects) {
|
|
const auto name = obj.GetName();
|
|
if (name == "")
|
|
continue;
|
|
|
|
const auto tile = obj.GetTile();
|
|
if (!tile)
|
|
continue;
|
|
|
|
const auto w2s = Internal::TileToMainscreen(tile, 0, 0, 0);
|
|
if (!w2s)
|
|
continue;
|
|
|
|
paint_object(obj, r, g, b, 255);
|
|
|
|
std::stringstream ss;
|
|
ss << name;
|
|
ss << ": (" << tile.X << ", " << tile.Y << ", " << tile.Plane << ")";
|
|
|
|
Paint::DrawString(ss.str(), w2s, 255, 255, 255, 255);
|
|
}
|
|
};
|
|
|
|
switch (pmode) {
|
|
case paint_mode::game_objects:
|
|
paint_objects(get_game_objects(), 255, 0, 0);
|
|
break;
|
|
case paint_mode::wall_objects:
|
|
paint_objects(get_wall_objects(), 0, 255, 0);
|
|
break;
|
|
case paint_mode::ground_objects:
|
|
paint_objects(get_ground_objects(), 0, 0, 255);
|
|
break;
|
|
case paint_mode::decorative_objects:
|
|
paint_objects(get_decorative_objects(), 255, 255, 0);
|
|
break;
|
|
case paint_mode::npcs:
|
|
paint_objects(get_npcs(), 128, 0, 128);
|
|
break;
|
|
case paint_mode::players:
|
|
paint_objects(get_players(), 0, 255, 255);
|
|
break;
|
|
}
|
|
|
|
Paint::SwapBuffer();
|
|
return true;
|
|
}
|
|
|
|
bool OnBreak() { return true; }
|
|
|
|
void OnEnd() {} |