Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.cache/
.agent/
.vs/
.vscode/
build/

engine.log
reone.cfg
29 changes: 29 additions & 0 deletions include/reone/game/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@

#pragma once

#include <vector>

#include "reone/audio/source.h"
#include "reone/graphics/cursor.h"
#include "reone/graphics/types.h"
#include "reone/input/event.h"
#include "reone/movie/movie.h"
#include "reone/script/routines.h"
Expand Down Expand Up @@ -71,6 +74,12 @@ class GUI;

}

namespace graphics {

class Font;

}

namespace game {

class Game : boost::noncopyable {
Expand Down Expand Up @@ -320,6 +329,16 @@ class Game : boost::noncopyable {

Screen _screen {Screen::None};

struct DeveloperOverlay {
bool visible {false};
bool triggers {true};
bool actorLabels {true};
bool watchedValues {true};
};

DeveloperOverlay _developerOverlay;
std::shared_ptr<graphics::Font> _developerFont;

std::shared_ptr<movie::IMovie> _movie;
resource::CursorType _cursorType {resource::CursorType::None};
std::shared_ptr<graphics::Cursor> _cursor;
Expand Down Expand Up @@ -399,6 +418,7 @@ class Game : boost::noncopyable {
bool handleMouseMotion(const input::MouseMotionEvent &event);
bool handleMouseButtonDown(const input::MouseButtonEvent &event);
bool handleMouseButtonUp(const input::MouseButtonEvent &event);
bool handleDeveloperKeyDown(const input::KeyEvent &event);

void onModuleSelected(const std::string &name);
void renderHUD();
Expand All @@ -419,6 +439,15 @@ class Game : boost::noncopyable {

void renderScene();
void renderGUI();
void renderDeveloperOverlay();
void renderDeveloperBanner();
void renderDeveloperTriggerOverlay(const glm::mat4 &projection, const glm::mat4 &view);
void renderDeveloperActorLabels(const glm::mat4 &projection, const glm::mat4 &view);
void renderDeveloperWatchedValues();
void renderDeveloperText(const std::string &text, const glm::vec3 &position, const glm::vec3 &color, graphics::TextGravity gravity = graphics::TextGravity::LeftTop);
void renderDeveloperPanel(const std::vector<std::string> &lines, glm::vec2 position, glm::vec3 color);
void renderDeveloperLine(glm::vec2 a, glm::vec2 b, glm::vec4 color, float width);
void renderDeveloperRect(glm::vec2 position, glm::vec2 size, glm::vec4 color);

// END Rendering

Expand Down
1 change: 1 addition & 0 deletions include/reone/game/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ class Object : public scene::IUser, boost::noncopyable {

std::deque<std::shared_ptr<Action>> _actions;
std::vector<DelayedAction> _delayed;
std::weak_ptr<Action> _executingAction;

// END Actions

Expand Down
1 change: 1 addition & 0 deletions include/reone/game/object/door.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Door : public Object {
const std::string &getOnFailToOpen() const { return _onFailToOpen; }

int genericType() const { return _genericType; }
Faction faction() const { return _faction; }
const std::string &linkedToModule() const { return _linkedToModule; }
const std::string &linkedTo() const { return _linkedTo; }
const std::string &transitionDestin() const { return _transitionDestin; }
Expand Down
1 change: 1 addition & 0 deletions include/reone/game/object/placeable.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Placeable : public Object {
bool isUsable() const { return _usable; }

int appearance() const { return _appearance; }
Faction faction() const { return _faction; }
std::shared_ptr<scene::WalkmeshSceneNode> walkmesh() const { return _walkmesh; }

// Scripts
Expand Down
16 changes: 16 additions & 0 deletions include/reone/game/object/trigger.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ namespace game {

class Trigger : public Object {
public:
enum class DebugState {
Default,
Tested,
Inside,
Entered
};

Trigger(
uint32_t id,
std::string sceneName,
Expand Down Expand Up @@ -56,6 +63,12 @@ class Trigger : public Object {
bool isIn(const glm::vec2 &point) const;
bool isTenant(const std::shared_ptr<Object> &object) const;

const std::vector<glm::vec3> &geometry() const { return _geometry; }
DebugState debugState() const;

void markDebugTested(bool inside);
void markDebugEntered();

const std::string &getOnEnter() const { return _onEnter; }
const std::string &getOnExit() const { return _onExit; }

Expand All @@ -79,6 +92,9 @@ class Trigger : public Object {
std::vector<glm::vec3> _geometry;
std::set<std::shared_ptr<Object>> _tenants;
std::string _keyName;
float _debugTestAge {0.0f};
float _debugInsideAge {0.0f};
float _debugEnterAge {0.0f};

// Scripts

Expand Down
2 changes: 2 additions & 0 deletions include/reone/system/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class Logger {
LogChannel channel,
LogSeverity severity);

void flush();

bool isChannelEnabled(LogChannel channel) const {
return _enabledChannels.count(channel) > 0;
}
Expand Down
4 changes: 4 additions & 0 deletions src/apps/engine/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#endif

#include "reone/system/logger.h"
#include "reone/system/logutil.h"
#include "reone/system/threadutil.h"

#include "engine.h"
Expand All @@ -31,6 +32,7 @@ using namespace reone;
using namespace reone::graphics;

static constexpr char kLogFilename[] = "engine.log";
static constexpr char kEngineStartupMessage[] = "reone smoke signal: engine startup";

int main(int argc, char **argv) {
#ifdef _WIN32
Expand All @@ -48,6 +50,8 @@ int main(int argc, char **argv) {
}
try {
Logger::instance.init(options->logging.severity, options->logging.channels, kLogFilename);
info(kEngineStartupMessage);
Logger::instance.flush();
} catch (const std::exception &ex) {
std::cerr << "Error initializing logging: " << ex.what() << std::endl;
return 2;
Expand Down
3 changes: 3 additions & 0 deletions src/apps/launcher/frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ LauncherFrame::LauncherFrame() :

_checkBoxDev = new wxCheckBox(this, wxID_ANY, "Developer Mode", wxDefaultPosition, wxDefaultSize);
_checkBoxDev->SetValue(_config.devMode);
auto devToolsHelp = new wxStaticText(this, wxID_ANY, "Developer tools: Ctrl+Shift+D overlay, Ctrl+Shift+T triggers, Ctrl+Shift+A labels, Ctrl+Shift+W watch", wxDefaultPosition, wxDefaultSize);
devToolsHelp->Wrap(600);

// END Setup controls

Expand Down Expand Up @@ -341,6 +343,7 @@ LauncherFrame::LauncherFrame() :
topSizer2->SetMinSize(640, 100);
topSizer2->Add(gameSizer, wxSizerFlags(0).Expand().Border(wxALL, 3));
topSizer2->Add(_checkBoxDev, wxSizerFlags(0).Expand().Border(wxALL, 3));
topSizer2->Add(devToolsHelp, wxSizerFlags(0).Expand().Border(wxLEFT | wxRIGHT | wxBOTTOM, 3));
topSizer2->Add(topSizer, wxSizerFlags(0).Expand().Border(wxALL, 3));
topSizer2->Add(new wxButton(this, WindowID::launch, "Launch"), wxSizerFlags(0).Expand().Border(wxALL, 3));
topSizer2->Add(new wxButton(this, WindowID::saveConfig, "Save Configuration"), wxSizerFlags(0).Expand().Border(wxALL, 3));
Expand Down
Loading