Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 06-09-2012, 10:12 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default Fix for Inverted Doors

(All changes are located in 'doors.cpp')

Step 1: Add the following to definitions:
Code:
#define INVOPEN_DOOR 0x03
#define INVCLOSE_DOOR 0x02
(All of the following changes made to 'HandleClick')

Step 2: Change all 'md->action = OPEN_DOOR' to this:
Code:
md->action = invert_state == 0 ? OPEN_DOOR : INVOPEN_DOOR;
Step 3: Change all 'md->action = CLOSE_DOOR' to this:
Code:
md->action = invert_state == 0 ? CLOSE_DOOR : INVCLOSE_DOOR;
Step 4: Change the 'return' on 'md->action == CLOSE_DOOR' conditional criteria to this:
Code:
if((md->action == CLOSE_DOOR && invert_state == 0) || (md->action == INVCLOSE_DOOR && invert_state == 1))
{
	safe_delete(outapp);
	return;
}
This should fix the proper operation of inverted doors. My limited testing in-game has not found any door that will not function
properly, unless there are issues not related to 'doors.cpp'

(There is an apparent bug in the actual GFay client door model. Sometimes you will 'miss' the elevator and you'll be left floating in
the air. I remember this behavior from early 'live'.)

I'm still running into other issues with incorrect or missing database values.

I'll post updates for 'NPCOpen', 'ForceOpen' and 'ForceClose' after I make the proper changes in them. This should add my fix as well
as the fix to 'ForceClose' suggested by someone else.


U
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #2  
Old 06-09-2012, 10:15 PM
Vexyl
Hill Giant
 
Join Date: Oct 2009
Location: U.S.A.
Posts: 197
Default

Could you please post a diff of the changes? It's easier to patch a diff than to search through the source replacing lines.
Reply With Quote
  #3  
Old 06-09-2012, 10:30 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

I'll have to get a 'clean' copy of doors.cpp for posting because mine is heavily modified with debug code, but I can post the modified
'HandleClick' if the dev's don't mind a ~380 line posting

It may take until tomorrow afternoon until I can get back online to post it. I don't have access to the internet at my house.

U
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #4  
Old 06-09-2012, 10:38 PM
Vexyl
Hill Giant
 
Join Date: Oct 2009
Location: U.S.A.
Posts: 197
Default

Here is the current doors.cpp in the SVN repo:
http://projecteqemu.googlecode.com/s...zone/doors.cpp
Reply With Quote
  #5  
Old 06-09-2012, 10:52 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

The best thing to do is finish your changes, diff against the repository and remove any debug code you wouldn't want to check in, then test with that file. If all tests were successful and you'd be happy checking that in then make a diff and post it.
Reply With Quote
  #6  
Old 06-10-2012, 05:26 AM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Never done this before, but the diff file, patch action and build appear valid, and the game works as intended.


doors.cpp.patch
Code:
Index: doors.cpp
===================================================================
--- doors.cpp	(revision 2145)
+++ doors.cpp	(working copy)
@@ -31,6 +31,8 @@
 
 #define OPEN_DOOR 0x02
 #define CLOSE_DOOR 0x03
+#define INVOPEN_DOOR 0x03  // U: Added inverted action definitions
+#define INVCLOSE_DOOR 0x02 //    for ease of discernment
 
 extern EntityList entity_list;
 extern WorldServer worldserver;
@@ -143,6 +145,12 @@
 	//TODO: add check for other lockpick items
 	//////////////////////////////////////////////////////////////////
 
+	// U: I left this test code in case someone wants to work on trigger doors in the database
+	//sender->Message(4, "door:%i->doorst (ds:%s | ti:%s)", door_id,  IsDoorOpen() ? "O" : "C", close_timer.Enabled() ? "E" : "D");
+	//sender->Message(4, "door:%i->trigdr (tdid:%i)", door_id, GetTriggerDoorID());
+	//sender->Message(4, "door:%i->trigger (trid:%i | trs:%s | trt:%i)", door_id, trigger, triggered ? "T" : "F", GetTriggerType());
+	//sender->Message(4, "door:%i->client (xp:%f | yp:%f | zp:%f)", door_id, sender->GetX(), sender->GetY(), sender->GetZ());
+
 	//TODO: ADVENTURE DOOR
 	if(IsLDoNDoor())
 	{
@@ -200,11 +208,11 @@
 		{ // this door is only triggered by an object
 			if(!IsDoorOpen() || (opentype == 58))
 			{
-				md->action = OPEN_DOOR;
+				md->action = invert_state == 0 ? OPEN_DOOR : INVOPEN_DOOR;
 			}
 			else
 			{
-				md->action = CLOSE_DOOR;
+				md->action = invert_state == 0 ? CLOSE_DOOR : INVCLOSE_DOOR;
 			}
 		}
 		else
@@ -221,11 +229,11 @@
 	{	//door not locked
 		if(!IsDoorOpen() || (opentype == 58))
 		{
-			md->action = OPEN_DOOR;
+			md->action = invert_state == 0 ? OPEN_DOOR : INVOPEN_DOOR;
 		}
 		else
 		{
-			md->action = CLOSE_DOOR;
+			md->action = invert_state == 0 ? CLOSE_DOOR : INVCLOSE_DOOR;
 		}
 	}
 	else
@@ -243,20 +251,23 @@
 				strcpy(tmpmsg, "Door is locked by an unknown guild");
 			}
 			sender->Message(4, tmpmsg);
+			// safe_delete(outapp); // U: does this need to be added here?
 			return;
 		}
 		// a key is required or the door is locked but can be picked or both
 		sender->Message(4, "This is locked...");		// debug spam - should probably go
+
+		// U: If anyone is considering keys for GM, make sure they can't be passed out or created on client cursor
 	    if(sender->GetGM())		// GM can always open locks - should probably be changed to require a key
 		{
 			sender->Message_StringID(4,DOORS_GM);
 			if(!IsDoorOpen() || (opentype == 58))
 			{
-				md->action = OPEN_DOOR;
+				md->action = invert_state == 0 ? OPEN_DOOR : INVOPEN_DOOR;
 			}
 			else
 			{
-				md->action = CLOSE_DOOR;
+				md->action = invert_state == 0 ? CLOSE_DOOR : INVCLOSE_DOOR;
 			}
 		}
 		else if(playerkey)
@@ -270,11 +281,11 @@
 				sender->Message(4, "You got it open!");
 				if(!IsDoorOpen() || (opentype == 58))
 				{
-					md->action = OPEN_DOOR;
+					md->action = invert_state == 0 ? OPEN_DOOR : INVOPEN_DOOR;
 				}
 				else
 				{
-					md->action = CLOSE_DOOR;
+					md->action = invert_state == 0 ? CLOSE_DOOR : INVCLOSE_DOOR;
 				}
 			}
 		}
@@ -295,11 +306,11 @@
 					{
 						if(!IsDoorOpen())
 						{
-							md->action = OPEN_DOOR;
+							md->action = invert_state == 0 ? OPEN_DOOR : INVOPEN_DOOR;
 						}
 						else
 						{
-							md->action = CLOSE_DOOR;
+							md->action = invert_state == 0 ? CLOSE_DOOR : INVCLOSE_DOOR;
 						}
 						sender->Message_StringID(4, DOORS_SUCCESSFUL_PICK);
 					}
@@ -333,11 +344,11 @@
 				sender->Message(4, "You got it open!"); // more debug spam
 				if(!IsDoorOpen() || (opentype == 58))
 				{ 
-					md->action = OPEN_DOOR; 
+					md->action = invert_state == 0 ? OPEN_DOOR : INVOPEN_DOOR;
 				} 
 				else
 				{ 
-					md->action = CLOSE_DOOR; 
+					md->action = invert_state == 0 ? CLOSE_DOOR : INVCLOSE_DOOR;
 				} 
 			}
 			else 
@@ -349,6 +360,9 @@
 		}
 	}
 	
+	// U: This was also left in to mark the end of door processing
+	//sender->Message(4, "---end of call---");
+
 	entity_list.QueueClients(sender, outapp, false);
 	if(!IsDoorOpen() || (opentype == 58))
 	{
@@ -365,7 +379,7 @@
 	//and met all the reqs for opening
 	//everything to do with closed doors has already been taken care of
 	//we return because we don't want people using teleports on an unlocked door (exploit!)
-	if(md->action == CLOSE_DOOR)
+	if((md->action == CLOSE_DOOR && invert_state == 0) || (md->action == INVCLOSE_DOOR && invert_state == 1))
 	{
 		safe_delete(outapp);
 		return;
If you're looking to run over to Greater Faydark and test the lifts out, just remember that the lifts themselves are still buggy.

If you are waiting to go up the lift, you need to be about 3/5ths or more onto the lift or it will leave without you. The reverse
is true for coming down - no more than 2/5ths way coming from Kelethin. Cycling the actuator seems to bypass this particular bug.

The lift in 'Vergalid' and the 4-part Doors in 'Gyrospire' are not fixed by this, nor is 'Stonehive.' The 'Stonehive' lift actuators
are not assigned trigger doors in my db (and are also exhibiting some really erractic behavior), and the other two will
probably require a scripted action to work correctly. (They can be assigned as triggerdoors in sequential order, but if someone
clicks a door somewhere down the chain than the 'starting' one, all preceding doors will not be triggered.)


Since I have no experience with the scripted door actions for quests and npc's, I will need to parse out the logic states
before I submit fixed versions of 'NPCOpen', 'ForceOpen' and 'ForceClose.'


U
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 09:32 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3