View Single Post
  #4  
Old 01-10-2008, 09:53 AM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

I PM'ed FNW details of the reworked patch for this along the lines he asked for, but I don't think he's been around for the last week, so I will post it here as well in case anyone
else wants to test the updated version.

----------------------------------------

I reworked the Water Detection patch. Diffs against the 1070 source are at:

http://www.rama.demon.co.uk/Reworked-water.patch

It affects these files

Code:
entwisd@rama ~/EQEmu-0.7.0-1070 $ patch -p0 < /tmp/Reworked-water.patch
patching file ./common/ruletypes.h
patching file ./utils/azone/Makefile
patching file ./utils/azone/awater.cpp
patching file ./utils/azone/awater.h
patching file ./utils/azone/wld.c
patching file ./utils/azone/wld.h
patching file ./zone/command.cpp
patching file ./zone/forage.cpp
patching file ./zone/makefile.common
patching file ./zone/mob.cpp
patching file ./zone/mob.h
patching file ./zone/watermap.cpp
patching file ./zone/watermap.h
patching file ./zone/waypoints.cpp
patching file ./zone/zone.cpp
patching file ./zone/zone.h
And adds these rules:

Code:
+RULE_BOOL ( Watermap, CheckWaypointsInWaterWhenLoading, false ) // Does not apply BestZ as waypoints are loaded if they are in water
+RULE_BOOL ( Watermap, CheckForWaterAtWaypoints, false) 		// Check if a mob has moved into/out of water when at waypoints and sets flymode
+RULE_BOOL ( Watermap, CheckForWaterWhenMoving, false)		// Checks if a mob has moved into/out of water each time it's loc is recalculated
+RULE_BOOL ( Watermap, CheckForWaterOnSendTo, false)		// Checks if a mob has moved into/out of water on SendTo
+RULE_BOOL ( Watermap, CheckForWaterWhenFishing, false)		// Only lets a player fish near water (if a water map exists for the zone)
+RULE_REAL ( Watermap, FishingRodLength, 30)			// How far in front of player water must be for fishing to work
+RULE_REAL ( Watermap, FishingLineLength, 40)			// If water is more than this far below the player, it is considered too far to fish
I thought about adding a test in zone.cpp so that if none of the rules where true, it wouldn't
try and load the water map, but I didn't do that.

Originally I only had the water detection in waypoints.cpp in CalcPosition2 and UpdateWaypoint, however
while I was reworking it, I also put it in the other places BestZ is calculated.

This caused an issue in the SendTo routine. What my code does is turn flymode 1 on when a mob is in water to
stop it sinking to the floor.

It appears the SendTo routine can be (always is) called before the spawn packet has been removed from the
queue and sent to the clients. In this case, the client ignores the flymode packet because the mob doesn't
exist for it yet.

This causes problems because all the water checks assume that if the mob has remained in water since the
last check, that the flymode 1 has already been put on the mob. This is so that unnecessary appearance packets aren't sent to the clients.

I therefore don't attempt to set flymode or set the mob's inWater flag in SendTo.

The other bug I noticed while reworking this is that the DeltaZ
in the spawn update packet is being ignored. I.e. if you watch the mobs pathing in water, they always
move horizontally and then jump up or down when they get to their waypoint (or when another position update packet is sent).

I don't know whether this is a side effect of flymode 1, or whether it's something else, e.g. maybe the offset
for DeltaZ in the spawn struct is not correct and it's something that is only noticeable in water. I
only have the 6.2 client so don't know if it works differently with Titanium. Whatever the problem is,
I couldn't find a way around it.
Reply With Quote