Exult Ultima 7 Turn Based Combat, Day 3

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.

Screen Shot 2016-02-13 at 3.59.50 PM
what. I don’t have a savegame outside Trinsic, and I have to test combat!

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 😛

noidea
Ah! so this is what they call “the linker”

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)

Advertisements

4 thoughts on “Exult Ultima 7 Turn Based Combat, Day 3

    1. Sure, any help is welcome! if you want you can clone the repo at github, let me know if you need any help with the setup! my repo has a build.sh which is not in the official SVN repo, that can help 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s