I continued digging thru the source code to find the missing ingredients for the initial approach.
Modifications in other game modules
Player character combat mode
If TBC is activated, the Avatar character should always behave as in combat mode Manual.
This should be done using avatar->set_attack_mode(Actor::manual)
Blocking player actions
If tbc.isActive && tbc.playerBlocked (i.e. the player just acted, waiting for a new turn), player cannot do any of the following actions:
- Attack a monster
- Cast a spell
- Use an Item
This should be doable by:
- Preventing the inventory windows from showing: In Actor::show_inventory in actors.cc
- Ignoring double click events: in Game_window::double_clicked in gamewin.cc
Limit walking while in combat
Every step the avatar takes should invoke tbc.updateWalkCounter
Probably on Game_window::start_actor_alt, still not sure… code inspection won’t be enough.
Next step, let’s hit the code
I set up a git repo based on the svn one, to track my changes and prevent getting lost. Exult’s official repo is SVN under sourceforge.net, like the old times. So in the end if this works I would have to make a patch for the current maintainers to apply, or maybe even submit the diff for them to replay my changes. I don’t know yet.
All the previous assumptions where based on inspecting the code, so I went ahead to try and add messages to the code and see if they matched on runtime (of course, some of them didn’t and most required tweaking)
I also discovered what people meant when they said “the project is compiling”, there’s effectively enough time to stand up and grab a cup of coffee. Amazing!
As expected, detecting the event when the avatar is walking proved to be a bit complex to find. In the ended I managed to intercept most of the code I think I’ll need for an initial approach.

Next up was the creation of the Turn Based Combat module. So I created a .h and a .cc files based on other files, included the header file in gamewin.cc and prayed for success. After some small tweaks (and learning quite a bit of C++) it worked 😛

So it’s now calling the functions on the new module. I started adding some of the real effects (like pausing the game) and found out there will be an issue since the pausing function doesn’t let the player move, so I must look for another way of pausing the game (or somehow overriding the way the time queue works for the Avatar to break the boundaries of time)
If you are curious, you can checkout the current status here. (or more importantly, the changes over here)