cntrl/src/editor/main.cpp
dandovlatov 849b34922d FBC: NIGHT SHIFT - two-handed agent weapon grip, standalone level editor and validation
- Pin both wrists to the rifle's real grip surfaces via a shared IK pass in
  every animation clip; hand bones follow the barrel and Fire recoil pivots
  the weapon/arms as one assembly.
- Nudge the weapon forward so the stock clears the vest; make the generator
  reproducible (clears stale actions) and regenerate .blend, GLB and renders.
- Add standalone level editor with JSON level data, validation and baking,
  plus editor docs and regression fixtures.
2026-11-24 21:34:30 +04:00

64 lines
2.1 KiB
C++

#include <cstdio>
#include <cstring>
#include <filesystem>
#include <string>
#include "editor/editor_app.hpp"
#include "raylib.h"
int main(int argc, char** argv) {
std::string path = "assets/levels/floor01.json";
std::string game_path;
std::string screenshot;
std::string place_asset;
float place_x = 0.0f;
float place_y = 0.0f;
for (int i = 1; i < argc; ++i) {
if (std::strcmp(argv[i], "--level") == 0 && i + 1 < argc) {
path = argv[++i];
} else if (std::strcmp(argv[i], "--game") == 0 && i + 1 < argc) {
game_path = argv[++i];
} else if (std::strcmp(argv[i], "--screenshot") == 0 && i + 1 < argc) {
screenshot = argv[++i];
} else if (std::strcmp(argv[i], "--place") == 0 && i + 3 < argc) {
place_asset = argv[++i];
place_x = std::stof(argv[++i]);
place_y = std::stof(argv[++i]);
} else if (std::strcmp(argv[i], "--help") == 0) {
std::printf("usage: editor [--level <path>] [--game <path>]\n"
" [--screenshot <path>]\n"
" [--place <asset-name> <map-x> <map-y>]\n");
return 0;
}
}
if (game_path.empty()) {
for (const char* candidate : {"./cntrl", "./build/cntrl", "../cntrl"}) {
if (std::filesystem::exists(candidate)) {
game_path = candidate;
break;
}
}
if (game_path.empty()) game_path = "./build/cntrl";
}
SetTraceLogLevel(LOG_WARNING);
InitWindow(1400, 900, "FBC: NIGHT SHIFT - Level Editor");
SetTargetFPS(60);
editor::App app(path);
app.set_game_path(game_path);
app.init();
if (!place_asset.empty()) app.debug_place(place_asset, {place_x, place_y});
int frames = 0;
while (!WindowShouldClose() && !app.should_close()) {
app.update();
app.draw();
if (!screenshot.empty() && ++frames == 30) {
TakeScreenshot(screenshot.c_str());
break;
}
}
app.shutdown();
CloseWindow();
return 0;
}