-
Notifications
You must be signed in to change notification settings - Fork 86
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
Implemented AI_LOOKAT #397
Conversation
AI_LookAt is actually for waypoints and not NPCs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @CReimer !
Thanks for PR. Looks good, but need to fix serialization (see comments)
@@ -257,7 +257,7 @@ void Npc::load(Serialize &fin, size_t id) { | |||
loadAiState(fin); | |||
|
|||
fin.read(currentInteract,currentOther,currentVictum); | |||
fin.read(currentLookAt,currentTarget,nearestEnemy); | |||
fin.read(currentLookAtNpc,currentTarget,nearestEnemy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write
code wasn't updated to mirror read- Waypoint
currentLookAt
is not serialized
For proper serialization, you need to bump save file version in Serialize::Version
and add check for fin.version()
before reading new data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not exactly sure how the serialization works. But I think it's fixed now
game/world/objects/npc.cpp
Outdated
@@ -1988,7 +1995,8 @@ void Npc::tick(uint64_t dt) { | |||
} | |||
|
|||
if(!isDown()) { | |||
implLookAt(dt); | |||
implLookAtNpc(dt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: tabs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope this is now right, too.
To be fair. I just spend about an hour trying to set your code styling in CLion.
It's just impossible. To many edge-cases and inconsistencies.
If everything is okay now. I'd like to squash the first new commit in my original fist commit and the same for the second. |
Hi, @CReimer ! There were few issues with serialization, so I've changed them inline, in merge view. |
This is my first try at actually contributing here. So please be gentle.
Some NPCs in Gothic 1 don't look in the direction they're supposed to. I figured AI_LOOKAT could be the problem.
So I implemented it as best as I could, and the NPCs still don't look in the right direction.
It turns out AI_LOOKAT is only used in the new camp (Neues Lager in German) to make an NPC look at the big pile of ore there. (Waypoint FP_OREPILE_CENTER). I haven't figured out which NPCs but if that information is needed, I might now know how to get it.
I made AI_LOOKAT mutually exclusive with AI_LOOKATNPC as I figured an NPC can't really look at two points at the same time. So whichever function is called last wins.
Your code style is a bit unusual. I hope I got it right.