Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Gothic 1 melee blocking #630

Merged
merged 2 commits into from
Jun 25, 2024
Merged

Fix Gothic 1 melee blocking #630

merged 2 commits into from
Jun 25, 2024

Conversation

thokkat
Copy link
Contributor

@thokkat thokkat commented May 16, 2024

Problem was a character confusion. For G2 the number 0 is used in T_1HPARADE_0 but in G1 the letter O is used in T_1HPARADE_O.

What I'm unsure about is the FIXME: seems like name check is not needed part. Testing shows this is necessary because the DefWindow can be reached during attack animations. But DefWindow refers to a combo window and DefParWindow should be the correct one to choose. But then again this one is always empty.

For now I checked against DefParWindow and consider empty window as blocking always enabled during animation.

Fixes #557

@@ -263,7 +263,7 @@ bool Animation::Sequence::isInComboWindow(uint64_t t, uint16_t comboLen) const {

bool Animation::Sequence::isDefParWindow(uint64_t t) const {
if(data->defParFrame.size()!=2)
return false;
return true;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pose::isDefence uses isDefWindow, not isDefParWindow.

Also, after checking the source, I've find out that isDefParWindow is not in use. Was this change made by mistake or this is some kind of leftover?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isDefWindow is also used for attack anis which made no sense for me in parade if there's DEF_PAR_FRAME extra for it. Though this is never used for humans so my plan was to just check the animation and leave def window/parade out completely. Decided to check against isDefParWindow later in case this is actually used somewhere. At least form testing it felt parade was always blocking.

Did some search now for DEF_WINDOW and modding wiki gives:

Set a “window” in the animation - an interval of frames during which you need to press the “up” (G1) or the left mouse button (G2) to continue the combo strike.

https://gothic-modding-community.github.io/gmc/zengin/anims/events/#def_window

@Try
Copy link
Owner

Try commented Jun 20, 2024

After testing this PR:

It looks to me that in opengothic block is handled conceptually wrong.

  • In G2 we missing T_2HPARADE_0_A3, maybe more
  • T_2HPARADE_0_A3 show that there is no clear naming pattern
  • check for BS_PARADE is way more simple

My suggesting is to:

  1. BS_PARADE test instead of name test + isDefParWindow (old implementation) for normal block
  2. BS_PARADE + lack of defParFrame for jump-back block

case 2 will help with Gothic1 and also makes sense in G2. Not sure about animals in G1

@thokkat
Copy link
Contributor Author

thokkat commented Jun 22, 2024

  1. BS_PARADE test instead of name test + isDefParWindow (old implementation) for normal block
  2. BS_PARADE + lack of defParFrame for jump-back block

Do you mean DefWindow? Asking because defParFrame is always empty and thus Animation::Sequence::isDefParWindow returns always false.

Vanilla is using t_1hParadeJumpB instead of t_1hJumpB for jump block. Animation is the same but t_1hParadeJumpB comes with a DEF_WINDOW so suggested check for jump wouldn't work then which means vanilla must have some different jump detection. Maybe go back to name testing for jump only and check BS_PARADE for isDefence?

@Try
Copy link
Owner

Try commented Jun 23, 2024

Do you mean DefWindow?

Yes def-window, sorry. Maybe it's easier to post the code:

bool Pose::isDefence(uint64_t tickCount) const {
  for(auto& i:lay) {
    if(i.bs==BS_PARADE && i.seq->isDefWindow(tickCount-i.sAnim))
      return true;
  return false;
  }

Asking because defParFrame is always empty

This will fall-thru to jump-back case. Here My assumption that vanilla script is slightly buggy, and engine should interpret such cases as jump-back (aka unconditional block)

bool Pose::isJumpBack() const {
  for(auto& i:lay) {
    if(i.bs==BS_PARADE && i.seq->data->defParFrame.empty())
      return true;
    }
  return false;
  }

Reason, why I'm thinking that this can be correct way: no name checks + simplicity of code.
Only issue here, is propagating BS in Pose::processLayers: "T_2HJUMPB" has stand animation as next, resulting into infinite stand-block. Probably it's a bug with BS propagation here.

@thokkat
Copy link
Contributor Author

thokkat commented Jun 25, 2024

BS_PARADE is now set if npc is in jump back animation and in melee fight mode. Technically this is wrong because in G1 for humans jump back is always BS_RUN and non blocking. For G1 it looks like only monsters block in jump back but haven't tested much more. I'd leave that for later.

I let animation names as is because it already works and avoids the bug you mentioned. One more reason is waran in G1 uses both JUMPB and PARADEJUMPB which makes it unclear when to pick which.

@Try
Copy link
Owner

Try commented Jun 25, 2024

I've added

        if(lay[i].bs==BS_PARADE)
          lay[i].bs = BS_RUN;

to animation solver, to avoid issues with T_2HJUMPB, rest looks good

@Try Try merged commit e06f3ad into Try:master Jun 25, 2024
1 check was pending
@Try
Copy link
Owner

Try commented Jun 25, 2024

Merged, thanks!

@thokkat thokkat deleted the g1-block branch June 25, 2024 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gothic 1 blocking does not work
2 participants