Try / OpenGothic

Reimplementation of Gothic 2 Notr
MIT License
1.17k stars 85 forks source link

More perc issues #639

Open thokkat opened 6 months ago

thokkat commented 6 months ago

Have to bring this up again. In G2 old world Mitten is automatically talking to the player at first meeting if in close distance. But this is happening through a wall when Milten is in the right room and player in the left room in old mage building. Can be tested with -w oldworld.zen and goto pos 0 0 0.

Cause is this line in Npc::canSenseNpc

  if(isNoisy) {
    // no need to be in same room: https://github.com/Try/OpenGothic/issues/420
    ret = ret | SensesBit::SENSE_HEAR;
    }

Commenting out works.


Two open points from https://github.com/Try/OpenGothic/issues/604

Npcs wake up if player is picking a lock in sneak mode.

My suggestion was

- if(ev.groundSounds>0 && isPlayer() && (bodyStateMasked()!=BodyState::BS_SNEAK))
+ if(ev.groundSounds>0 && isPlayer() && (wlkMode&WalkBit::WM_Sneak)!=WalkBit::WM_Sneak)
  world().sendPassivePerc(*this,*this,*this,PERC_ASSESSQUIETSOUND);

I'm asking because this was part of rejected https://github.com/Try/OpenGothic/pull/589 and hasn't been moved to https://github.com/Try/OpenGothic/commit/fccda5bec4afede9d31d90889eec4c99e80fc2d6.

Secon question was

AssessEnterRoom not sent while sneaking is incorrect. Test case can be house behind Zuris. Guard reacts on enter if sneaking.

This is blocked by the sneak check

void WorldObjects::sendImmediatePerc(Npc& self, Npc& other, Npc& victum, Item* itm, int32_t perc) {
  const auto pl = owner.player();
  if(pl==nullptr || pl->bodyStateMasked()==BS_SNEAK)
    return;

Thesneak check could be removed because ASSESSQUIETSOUND isn't sent in that case. Is this special treatment for QUIETSOUND/ENTERROOM as immediate perc needed at all? Is there a difference in executing immediately or later in the same tick together with other passive percs?