Commit graph

74 commits

Author SHA1 Message Date
Humberto Gontijo
c136a75263
fix: make macOS build with modern sol2 and wxGL (#201)
Bug Fixes:
- Improved Lua scripting: Lua-visible nil is now consistent for missing/empty values across storage, JSON parsing, item/map/tile APIs, dialogs, app properties, and overlay hover.
- Improved macOS graphics reliability (OpenGL context/linking) and safer background/thread handling for streaming and SQLite bootstrap.
- Fixed client asset loading paths and improved SQLite migration input paths.

UI Improvements:
- Replaced “Missing …” modal dialogs with inline text boxes.
- Made “Client directory” editable; added macOS app-picker browse flow.

CI:
- Added compile-scoped macOS builds via reusable workflow and a new build-macos job.
2026-07-29 19:44:25 -03:00
Eduardo Dantas
d78a2546c7
feat: add Cyclopedia protobuf export pipeline (#160)
Add editor support for exporting Cyclopedia and CipSoft protobuf assets from the currently loaded map.

Main changes:
- Add File > Client Assets actions for Static House Data export, Cyclopedia minimap and satellite export, and restoring timestamped client asset backups.
- Keep generic minimap and tileset exports under File > Export.
- Export staticdata, staticmapdata, and mapdata protobuf files with content-hashed filenames.
- Update catalog-content.json so generated assets are picked up by the client.
- Merge compatible CipSoft templates when they match the loaded map.
- Fall back to generated data for custom maps instead of failing the export.
- Support filtered house exports.
- Report warnings for missing or failed static map entries.
- Emit aligned MINIMAP and sprite-based SATELLITE assets for the documented scales, including the 1/16 layer.
- Keep Cyclopedia export progress in the status bar instead of using a blocking modal progress dialog.

Performance:
- Precompute floor and chunk plans for global map exports.
- Write BMP output directly.
- Reuse minimap renders for matching satellite assets.
- Parallelize asset hash and LZMA encoding through a bounded worker queue.
- Remove modal progress overhead from the export path.
- Revert the tile-grid satellite optimization after profiling showed it shifted cost without improving total export time.

Documentation:
- Document the export contract in docs/static-data.md.
- Add docs/cyclopedia-export-roadmap.md with deferred optimization candidates and follow-up notes.

Scope:
- Focus this change on the Cyclopedia/staticdata protobuf export path and the export-specific performance work needed for practical global map exports.
- Move unrelated runtime, performance, and UI experiments out of this branch.

Validation:
- Ran static inspection and git diff checks during the export changes.
- Reviewed Visual Studio CPU profiles after each global map export performance pass.
- Verified hash and LZMA work moved into bounded async workers.
- Verified the restore action is labeled as restore and grouped under File > Client Assets, not File > Export.

This adds the editor-side pipeline needed to generate client Cyclopedia assets from a loaded map while keeping the export flow recoverable, documented, and practical for large maps.
2026-05-28 08:35:21 -03:00
Victor
ce8d5093ee
feat: add SQLite materials backend with XML import pipeline, schema migrations, and inspection tools (#183)
New Features:
- Added "SQLite Materials Inspector" to the Window menu — a read-only multi-tab viewer for summary stats, brushes by type, and tilesets with reload and detail panes.
- Background initialization and async bootstrap/import of the materials database to avoid blocking the UI; startup/shutdown now synchronize to prevent concurrent access.

Chores:
- New runtime option to enable the SQLite materials backend and control migration/bootstrap behavior (default enabled).
2026-05-22 19:41:30 -03:00
Eduardo Dantas
1fbc5b9113
perf: otbm load save and preview/map renderization (#188)
Improve OTBM load/save and map view performance

This change improves Remere's Map Editor performance in OTBM load/save paths,
object allocation, binary serialization, tile lookup, and idle map rendering.

Measured impact:

Object pool allocation:
- Slab refill events reduced from 17,830 to 2,230, about 87.5% fewer refills.
- 48-byte class refills reduced from 4,276 to 535, about 87.5% fewer refills.
- 64-byte class refills reduced from 5 to 1, about 80.0% fewer refills.
- 128-byte class refills reduced from 8,776 to 1,097, about 87.5% fewer refills.
- 1024-byte class refills reduced from 4,773 to 597, about 87.5% fewer refills.
- rme::allocatePooledObject sampled CPU share reduced from 20.01% to 14.62%,
  about 26.9% lower sampled share.
- Total pooled allocation calls stayed at 42,559,971 for the measured workload.
- Heap fallback allocations stayed at 0, confirming the hot load path remains pooled.

Latest mixed load/save profile:
- GUI::LoadMap remained the dominant sampled cost at 67.02%.
- IOMapOTBM::loadMap accounted for 60.23% total sampled CPU, with 56.34% in
  the inner load body.
- GUI::SaveMap and Editor::saveMap accounted for 28.16%.
- IOMapOTBM::saveMap accounted for 27.63%.
- BaseMap::forEachTileLocation during save accounted for 23.01%.
- Tile::Tile accounted for 11.53%.
- Tile::addLoadedItem accounted for 8.15%.
- Item::Create accounted for 6.99%.
- QTreeNode::createFloor accounted for 6.71%.
- BinaryNode::advance and BinaryNode::load accounted for 5.37% and 3.81%.

Map view idle and preview rendering:
- Static map-view sampled CPU dropped from 139,767 sampled units to 126 sampled
  units after overlay-only refresh reuse.
- MapCanvas::OnPaint dropped from 46,229 sampled units and 32.20% to 19 sampled
  units and 15.08%.
- GLRenderer::flushCommands dropped from 24,321 sampled units and 16.94% to
  4 sampled units and 3.17%.
- Performance stats refresh changed from a 16 ms scene-dirty timer to a 500 ms
  overlay-only timer.
- Show Preview changed from a 16 ms scene-dirty timer to a 250 ms scene-dirty
  timer.
- Position indicator keeps the 16 ms scene-dirty timer because it is expected
  to animate smoothly while active.

Main changes:
- Added cached floor and tile lookup while loading OTBM map data and spawn files.
- Added direct TileLocation assignment for parser paths that already resolved
  the destination location.
- Added BaseMap::forEachTileLocation for direct save traversal of existing tile
  locations.
- Added a small-object slab allocator for hot Item, Tile, and Floor allocations.
- Added pool owner-thread binding and diagnostics for allocation validation.
- Increased slab sizing to reduce refill pressure in large-map loads.
- Improved binary node writing by batching raw bytes and avoiding redundant cache
  renewal checks.
- Avoided rewriting XML sidecar files when serialized content only differs by
  line endings.
- Fixed invalid ground serialization so placeholder ground id 0 no longer drops
  the rest of the tile contents during save.
- Split map canvas refresh into scene-dirty and overlay-only paths.
- Adjusted animation timer behavior for position indicator, Show Preview, and
  performance stats.
- Scaled tooltip rendering with map zoom, clamped to 55% minimum.
- Kept review and Sonar cleanups away from hot path regressions with targeted
  NOSONAR annotations or FORCEINLINE where needed.
- Added AGENTS.md guidance for future Git, build, and PCH discipline.

Notes:
- The Visual Studio captures are sampling profiles, so percentages represent CPU
  sample share, not direct wall-clock speedup.
- The latest profile is a mixed interaction profile, not a strict load-only or
  save-only benchmark.
- The allocator counters are the strongest before/after measurement in this
  change.
- No OTBM format or map semantics are intended to change.
2026-05-22 15:14:34 -03:00
Victor
21b234e2ab
feat: deferred rendering pipeline, memory optimization, and async map cleanup (#173)
New Features:
- Scene caching with render-to-texture and blitting for faster map redraws.
- Explicit blend-mode controls and FBO-backed render-to-texture workflow.

Bug Fixes:
- More robust sprite-sheet reload and texture release behavior.
- Safer editor/tab shutdown with ensured live-server closure and deferred deletion.

Performance:
- Reworked GPU batching/streaming and command-based flushing for fewer draw calls and efficient uploads.
- Smarter scene invalidation to avoid unnecessary re-renders.

UX:
- Undo/redo now refreshes editor views more reliably.
2026-04-25 10:35:24 -03:00
Victor
cbf183cbb1
fix: NPC spawn use-after-free on map import, progress bar freeze, and improved diagnostics (#167)
Bug Fixes:
- Fixed tile merge behavior to properly handle both monster and NPC spawns when importing maps.
- Improved spawn size validation to check input bounds before assignment.
- Removed duplicate NPC transfer logic in tile operations.

Improvements:
- Enhanced diagnostic messages during map loading with contextual information about tile areas and file positions.
- Updated error messaging for tile position parsing failures in map formats.
2026-04-21 11:56:46 -03:00
Victor
557d91123e
feat: add support for loading monsters and NPCs from Canary Lua files (#162)
New Features:
- Load monsters and NPCs from configurable Lua folders; shows warnings/errors for empty or problematic files and prompts to set folders when missing. Missing-creature dialogs and progress labels updated (“Loading monsters ...”, “Loading NPCs ...”, “Missing Monsters”, “Missing NPCs”).
- Preferences page adds directory pickers for Monsters/NPCs Lua folders; values are saved and applied.
- Brush list and palettes display creature sprites for loaded monsters/NPCs.

Chores:
- Added lightweight Lua parsing helpers to support importing outfits and surface warnings for malformed files.
2026-03-28 21:20:43 -03:00
Victor
d05ba30ff8
feat: add Lua API modules and Script Manager UI (#161)
This commit adds the full Lua scripting API and integrates the Script Manager into the application.
It builds on top of the scripting engine introduced in #158, exposing all the API modules that Lua scripts can use and making everything accessible from the UI.  
  
Changes:
- Added all Lua API modules: map, tile, item, brush, image, position, selection, creature, color, app, dialog, noise, algo, geo, json, http.
- Added map overlay system for scripts to draw on the map view.
- Added event system, context menu registration, persistent storage, and transaction support with undo/redo.
- Added support for package scripts (directory with manifest.lua) and script metadata tags.
- Added Scripts menu to the menubar with per-script execution and reload.
- Connected the Script Manager window to the UI.
- Added missing build dependencies and fixed MSVC compilation errors.

Notes:
- Build dependencies were added for HTTP and noise generation support.  
- Some code was adjusted to compile correctly on MSVC.
2026-03-28 19:15:57 -03:00
Eduardo Dantas
d0887ca047
fix: enable opening multiple map files in dialog (#153) 2026-01-12 14:35:47 -03:00
André Morais
3c5b6bf322
fix: 'open with' option (#143) 2026-01-12 14:33:32 -03:00
Eduardo Dantas
6d501a5ad2
feat: support reading assets from client 11 or higher (#70)
feat: migrate Remeres to 12.x assets system and modernized item handling

• Migrated old Remeres .dat/.spr system to new 12.x client /assets/ appearance & sprite format
• Removed OTB dependency and outdated client version structures
• Integrated Protobuf-based sprite reader (credit: @nekiro)
• Major refactor on graphics.cpp structure and brush icon handling
• Updated brushes and tags system
• Fixed top order drawing bugs and missing brushes icons
• Fixed outfit color paint and correct offset handling for non-32x32 sprites
• Re-enabled map saving and loading
• Improved creature sprite rendering and brush previews
• Added new item properties window with toggle for legacy/new layout

Co-authored-by: Marcos <66353315+marcosvf132@users.noreply.github.com>
Co-authored-by: Pedro Henrique Alves Cruz <phac@cin.ufpe.br>
2025-05-10 16:38:45 -03:00
Pedro Cruz
1409cddd31
fix: clipboard paste position pattern and special brushes palette (#102) 2024-08-14 16:42:33 -03:00
Luan Santos
2ee365e836
ci: add clang-format linter (#54) 2023-10-09 19:12:16 -07:00
Beats
6b55201a64
feat: synchronizing commits with the official rme repository (#36)
* Show indicators for pickupable and moveable items

* Fix: drawing always refreshing ui

* Fix crash on invalid friend for wallbrush

* Option to remove empty spawns

* Draws position indicator, some code cleanup

* Teleport copy/paste improvements

* Fix flood fill

* Add function to get minimap/8bit color

* Small code cleanup

* Cleanup Position

* Code cleanup and small optimizations

* Code cleanup

* Code cleanup and small optimizations (#406)

* Cleanup and cast functions.

* Avoid adding a new Unique ID if it already exists

* Code cleanup and small optimizations

* More changes and cleanup

* Changes and cleanup

* Some changes

* Fix copy position.

* Only show uid/aid alert if it really changed

* Add actions history panel

* Does not draw tooltips on minimap mode

* Use constexpr

* Replace items fix (#408)

* Draw grid small optimization

* Small change in selection box and Fix #409

* Fix some xpm

* Ingame box improvements, add lights support.

* Fix go to previous position (#410)

* Fix depot crash (#411)

* Fix XPMs

* Export minimap as .otmm (otclient format) or .png (#413)

* Fix glitch after drawing secondary map

* fix

* Update about_window.cpp

* sonar

* fix Minimap and progress bar

* fix erro load items.xml

* fix

* fix doodad brush

* fix: slightly more accurate house size estimation

* feat: update items.otb and items.xml

* fix: bad merge

* Revert "feat: update items.otb and items.xml"

This reverts commit 40f1edc70f.

---------

Co-authored-by: Nailson <Mignari@users.noreply.github.com>
Co-authored-by: wtver <51377408+maattch@users.noreply.github.com>
Co-authored-by: Majesty <32709570+majestyotbr@users.noreply.github.com>
Co-authored-by: Luan Santos <github@luan.sh>
2023-10-09 19:02:37 -07:00
Beats
17e42a5056
feat: improve cmake build and add pugixml integration (#40) 2023-09-08 03:04:02 -03:00
Eduardo Dantas
047113ade3 Merge branch 'master' 2022-08-19 02:43:27 -03:00
Nailson
05b791ee07 Use standard min,mas,abs functions, fix compile warning. 2022-06-16 22:39:12 -03:00
diath
8bf57e35a6
Fix build errors (#380)
- Updated the minimum required CMake version.
- Updated the minimum required C++ standard version to match the
  functions used in the code base.
- Added missing `public` visibility specifier for classes deriving from
  wxEvtHandler (DatDebugView and MainMenuBar) that is required to
  access the event table from the derived classes.
- Fixed a typo in the MainMenuBar code (`REPLACE_ITEM` =>
  `REPLACE_ITEMS`).
- Added missing ZLIB search to the CMake project (previously it was
  implicitly linked by older wxWidgets versions?).
- Fixed GLUT compatibility with newer CMake version.
- Added a new `FROM_DIP` macro that fixes wxSize scaling compatibility
  with wxWidgets <3.1.0.
- Fixed catching std::bad_cast exceptions by value instead of const
  ref.

Closes #329.
Closes #345.
Closes #371.
Closes #373.
Closes #375.
2022-02-02 18:55:27 -03:00
Eduardo Dantas
adef6c47c1
Change ids to clientid and organize data folder and tilesets (#6)
This only works with the canary server: https://github.com/opentibiabr/canary

Added support only for client .dat and .spr 11.00 outdated (10x), signature: data format="11" dat="0x4A10" spr="0x59E48E02"

Otb cllient 11, version 3, id 62

In addition to the ids being converted to client id (for compatibility with canary), the data folder has been completely reorganized for ease of understanding.
The organization of tilesets was also started, which will be further improved in other pulls.
2021-06-23 21:30:37 -03:00
Eduardo Dantas
e09f3e94c8
Decouple npcs from the creature class (it's create npc.xml file in the map folder) (#3)
Created the complete organization of npcs, that way, it is possible to create own files for npcs, no longer depending on being together with the monsters
this pull request was made to be worked together with the canary project: https://github.com/opentibiabr/canary

The spawns npcs is "yellow" and spawns monsters is "red" (the old)

With this change, the map will automatically create an "npc.xml" the first time it is saved.
It is possible to edit only the xml, it is not necessary to add or modify the npc by opening the editor map

Thus, there is a script for npcs, similar to how it works with old spawns
2021-05-25 00:29:12 -03:00
Evil Puncker
cfe36ce5b3
license headers (#315) 2020-07-30 11:42:28 -03:00
Elime1
bb38067971 Menu should not be usable before main frame is shown 2020-07-11 11:18:18 +02:00
Elime1
91336937c1 Add dpi awareness 2020-06-26 14:25:49 +02:00
Elime1
ae62b0c954 Introduce snapshot version for versions not yet released (ie built from source at any point). The official release should not be a snapshot version. 2020-06-26 14:17:32 +02:00
Elime1
d96bb5902b Reintroduce old behaviour when welcome dialog is toggled off 2020-06-26 08:44:56 +02:00
Elime1
39023fcc30 Make welcome dialog optional 2020-06-18 19:08:13 +02:00
Elime1
1198f9c34c Update vs configuration for 32 bit 2020-01-19 19:30:54 +01:00
Nailson
4bfd7347a7
Load assets name from otfi file. (#276) 2019-07-23 10:21:07 -03:00
Elime1
6b11485da0 Move welcome dialog to gui 2019-06-28 15:24:25 +02:00
Elime1
e3856e8dbc Use non modal welcome dialog 2019-06-27 22:23:28 +02:00
Elime1
c4551731fd Add welcome window 2019-06-25 18:07:36 +02:00
Mignari
12754fd889 Add Sizes toolbar. 2019-06-05 01:43:52 -03:00
Nailson
860febd663
Add tool bar (#144) (#23) (#264)
* Add default tool bar.

* Add Toobars menu.

* Add brushes toolbar.
2019-06-03 14:14:18 -03:00
Mignari
272c0a987f Define const for assets files. 2018-10-14 19:54:08 -03:00
Mignari
8227054ef2 Make spawns visible when placing a new spawn. 2018-08-24 21:30:19 -03:00
Elime1
e0e3400bb6 Find data directory when building using generated Xcode project 2016-12-21 17:05:36 +01:00
Elime1
d2aba9289a Fix a problem where the map could be loaded too early. Also make the code more coherent. 2016-12-02 16:40:51 +01:00
Nailson
1afdd10d49 Code improvements. 2016-11-12 10:30:06 -03:00
Elime1
610aeeaeaa Remove use of wxT macro. Closes #141 2016-11-05 15:28:14 +01:00
Nailson
ba5cd683a8 Restore last position when opening a map. Closes #139 2016-11-02 08:05:10 -03:00
Nailson
d7e863cb86 Rename global variable 'creature_db' to 'g_creatures'. 2016-10-25 10:22:46 -03:00
Nailson
b458163331 Rename global variable 'brushes' to 'g_brushes'. 2016-10-25 10:19:42 -03:00
Nailson
f6c84ed67b Rename global variable 'item_db' to 'g_items'. 2016-10-25 09:47:00 -03:00
Nailson
5d265c1976 Rename global variable 'materials' to 'g_materials'. 2016-10-25 09:46:12 -03:00
Nailson
970539dc73 Add CanUndo, CanRedo, DoUndo and DoRedo methods. 2016-09-29 21:21:33 -03:00
Nailson
d6d7643176 Rename global variable 'settings' to 'g_settings'. 2016-09-29 20:37:43 -03:00
Nailson
6ab0f851a4 Rename global variable 'gui' to 'g_gui'. 2016-09-29 20:30:54 -03:00
Nailson
f3b82b8734 Add 'Go To Previous Position' menu item. Hotkey 'P'.
Sometimes when using 'Go To Position', 'Go To Town Position' or 'Go To
Teleport Destination', we want to return to the previous position.

- Renamed 'CenterOnPosition' to 'SetScreenCenterPosition'.

- Added 'GetScreenCenterPosition' and 'GoToPreviousCenterPosition'
methods.

- Remove trailing spaces.
2016-09-29 18:36:27 -03:00
Nailson
bf9cda1eb4 Clarify variable names. 2016-02-28 10:26:33 -03:00
Nailson
f93e43f679 Add zoom menu.
Shortcuts:

Ctrl++ Zoom in
Ctrl+- Zoom out
Ctrl+0 Normal zoom (100%)
2016-02-25 21:32:05 -03:00