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

[1] aiGoalFollowWayPts::Update() #137

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

KcRobin9
Copy link
Collaborator

Notes

  1. Code compiles in Debug mode and runs fine in-game at first glance (e.g. change "Car->Sim.ICS.AngularMomentum *= 0.1f;") 2) Doesn't compile in Final mode:
    ...\mmai\aiGoalFollowWayPts.cpp(138,59): error C2220: the following warning is treated as an error
    ...\mmai\aiGoalFollowWayPts.cpp(138,59): warning C4244: '=': conversion from 'i32' to 'i16', possible loss of data
  2. IDA suggest "f32 arg10" instead of the current "i16 arg10" for the function "DetermineOppMapComponent"

Notes
1) Code compiles in Debug mode and runs fine in-game at first glance (e.g. change "Car->Sim.ICS.AngularMomentum *= 0.1f;")
2) Doesn't compile in Final mode:
	...\mmai\aiGoalFollowWayPts.cpp(138,59): error C2220: the following warning is treated as an error
	...\mmai\aiGoalFollowWayPts.cpp(138,59): warning C4244: '=': conversion from 'i32' to 'i16', possible loss of data
3) IDA suggest "f32 arg10" instead of the current "i16 arg10" for the function "DetermineOppMapComponent"
code/midtown/mmai/aiGoalFollowWayPts.cpp Show resolved Hide resolved
code/midtown/mmai/aiGoalFollowWayPts.cpp Outdated Show resolved Hide resolved
code/midtown/mmai/aiGoalFollowWayPts.cpp Outdated Show resolved Hide resolved
code/midtown/mmai/aiGoalFollowWayPts.cpp Outdated Show resolved Hide resolved
code/midtown/mmai/aiGoalFollowWayPts.cpp Outdated Show resolved Hide resolved
code/midtown/mmai/aiGoalFollowWayPts.cpp Outdated Show resolved Hide resolved
code/midtown/mmai/aiGoalFollowWayPts.cpp Outdated Show resolved Hide resolved
code/midtown/mmai/aiGoalFollowWayPts.h Outdated Show resolved Hide resolved
@@ -55,3 +57,124 @@ b32 aiGoalFollowWayPts::Context()
return false;
}
}

i32 aiGoalFollowWayPts::GetWayPtId(i16 index, i32 num_waypts)
Copy link
Owner

Choose a reason for hiding this comment

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

Was there a reason for passing in num_waypts instead of using NumWayPts directly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, it was an oversight. I changed it now

Car->Sim.Steering = 0.0f;
Car->Sim.Brakes = 0.0f;
Car->Sim.Engine.Throttle = 1.0f;
return;
Copy link
Owner

Choose a reason for hiding this comment

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

I think this return should be outside the inner if

Comment on lines 61 to 63
#define CAR_NOT_STUCK 0
#define CAR_MAYBE_STUCK 1
#define CAR_STUCK 2
Copy link
Owner

Choose a reason for hiding this comment

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

Move these to the mmStuck header

- I'm still unsure how to interpret `unk_var1` (v28)
- For `unk_var2` (v27) it might be similar to the CAR_STUCK constants in the context of collision (looking at the related functions)
@KcRobin9
Copy link
Collaborator Author

KcRobin9 commented Jun 1, 2024

The code builds in Final mode and works in the game.

Before merging, maybe a stylistic check on your side to see if everything is OK?

@KcRobin9 KcRobin9 requested a review from 0x1F9F1 June 1, 2024 12:57
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.

2 participants