Here's an addition for the realistic sailing mod. Give it a try and let me know how y'all like it.
When a ship tried to sail too close to the wind, the sails would "luff," that is, flap because the wind was going around the front of the sail instead of blowing behind it. It's easy enough to add this to the game.
In AIShip.c in the function Ship_UpdateParameters right after the line that says,
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->float fOffWind = RS_CalcOffwind(fWindAngle, fShipAngle);<!--c2--></div><!--ec2-->
... add the lines...
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->
if(iCharacterIndex == GetMainCharacterIndex()) {
if(fOffWind < fClosestPoint + RS_CP_OFFSET) { // Begin as soon as speed decreases
if (fSailState > 0.1) { // don't play sound if sails are furled
PlaySound("AMBIENT\SEA\sails1.wav");
PlaySound("AMBIENT\SEA\sails2.wav");
PlaySound("AMBIENT\SEA\sails3.wav");
}
}
}<!--c2--></div><!--ec2-->
The effect is pretty good. And it's more than just ear candy; it lets you know when you're too close to the wind when your attention is fixed on some enemy ship and you're not watching the ship speed. It also reminds you to lower your sails completely when coming about through the wind so that you don't get pushed backwards. If you don't want to hear the sound, simply furl your sails and it will stop. Note that it only plays the sound in realistic sailing mode.
Enjoy!
Hook
When a ship tried to sail too close to the wind, the sails would "luff," that is, flap because the wind was going around the front of the sail instead of blowing behind it. It's easy enough to add this to the game.
In AIShip.c in the function Ship_UpdateParameters right after the line that says,
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->float fOffWind = RS_CalcOffwind(fWindAngle, fShipAngle);<!--c2--></div><!--ec2-->
... add the lines...
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->
if(iCharacterIndex == GetMainCharacterIndex()) {
if(fOffWind < fClosestPoint + RS_CP_OFFSET) { // Begin as soon as speed decreases
if (fSailState > 0.1) { // don't play sound if sails are furled
PlaySound("AMBIENT\SEA\sails1.wav");
PlaySound("AMBIENT\SEA\sails2.wav");
PlaySound("AMBIENT\SEA\sails3.wav");
}
}
}<!--c2--></div><!--ec2-->
The effect is pretty good. And it's more than just ear candy; it lets you know when you're too close to the wind when your attention is fixed on some enemy ship and you're not watching the ship speed. It also reminds you to lower your sails completely when coming about through the wind so that you don't get pushed backwards. If you don't want to hear the sound, simply furl your sails and it will stop. Note that it only plays the sound in realistic sailing mode.
Enjoy!
Hook