This repository has been archived by the owner. It is now read-only.
CPedPath complete #416
Merged
CPedPath complete #416
Conversation
src/control/PathFind.cpp
Outdated
| CVector vecPos = (position + destination) * 0.5f; | ||
| CVector vecSectorStartPos (vecPos.x - 14.0f, vecPos.y - 14.0f, vecPos.z); | ||
| CVector2D vecSectorEndPos (vecPos.x + 28.0f, vecPos.x + 28.0f); | ||
| const int16 nodeStartX = (position.x - vecSectorStartPos.x) * 1.4286f; |
aap
Apr 14, 2020
Member
/ 0.7f probably
/ 0.7f probably
src/control/PathFind.cpp
Outdated
| for (*pointsFound = 0; pPathNode != pEndPathNode && *pointsFound < maxPoints; ++ *pointsFound) { | ||
| const uint8 nodeIdX = pPathNode->nodeIdX; | ||
| const uint8 nodeIdY = pPathNode->nodeIdY; | ||
| if (nodeIdX <= 0 || pathNodes[nodeIdX - 1][nodeIdY].id + 5 != pPathNode->id) { |
aap
Apr 14, 2020
Member
flip all those ifs. it's just an else if ladder
flip all those ifs. it's just an else if ladder
|
You can actually remove the |
src/control/PathFind.cpp
Outdated
| for (int32 x = 0; x < 40; x++) { | ||
| for (int32 y = 0; y < 40; y++) { | ||
| pathNodes[x][y].bBlockade = false; | ||
| pathNodes[x][y].id = 0x7FFF; |
erorcun
Apr 14, 2020
Collaborator
INT16_MAX
INT16_MAX
src/control/PathFind.cpp
Outdated
| { | ||
| *pointsFound = 0; | ||
| CVector vecDistance = destination - position; | ||
| if (Abs(vecDistance.x) > 23.8f || Abs(vecDistance.y) > 23.8f || Abs(vecDistance.z) > 23.8f) |
erorcun
Apr 14, 2020
•
Collaborator
adding define for that number would be cool
adding define for that number would be cool
src/control/PathFind.cpp
Outdated
| CPedPath::AddNodeToPathList(CPedPathNode *pNodeToAdd, int16 id, CPedPathNode *pNodeList) | ||
| { | ||
| if (!pNodeToAdd->bBlockade && id < pNodeToAdd->id) { | ||
| if (pNodeToAdd->id != 0x7FFF) |
erorcun
Apr 14, 2020
Collaborator
INT16_MAX
INT16_MAX
|
lgtm except comments |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
This is an unused function. There is an opcode for it, but I confirmed that it's not being used. I tested the code. It works, or at least it behaves the same way as the original function. I also tried calling the original function from memory and saw how this function affects the ped. If the point is closer to the ped, then the ped starts moving towards the point and after a while the ped starts moving in a different direction. floating-point comparisons were completely messed up in
CPedPath::AddBlockade, I used the android IDB and ghidra to fix it.