improved the "open door from the side" code to make the merc turn into the proper direction

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8633 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2018-10-31 17:00:44 +00:00
parent 2196a73b1a
commit 7f5d83d220
2 changed files with 43 additions and 17 deletions
+2 -2
View File
@@ -55,8 +55,8 @@
#endif
CHAR8 czVersionNumber[16] = { "Build 18.30.10" }; //YY.MM.DD
CHAR8 czVersionNumber[16] = { "Build 18.31.10" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" };
CHAR16 zRevisionNumber[16] = { L"Revision 8632" };
CHAR16 zRevisionNumber[16] = { L"Revision 8633" };
// SAVE_GAME_VERSION is defined in header, change it there
+41 -15
View File
@@ -2198,27 +2198,53 @@ UINT32 UIHandleCMoveMerc( UI_EVENT *pUIEvent )
{
// orientation NW - SE
case INSIDE_TOP_LEFT:
if ( (sDestGridNo - pSoldier->sGridNo == 1) || (pSoldier->sGridNo - sDestGridNo == 1) ||
( pStructure->fFlags & STRUCTURE_SLIDINGDOOR && sDestGridNo - pSoldier->sGridNo == 2) )
case OUTSIDE_TOP_LEFT:
// standing south, left of door
if ( ( (sDestGridNo - pSoldier->sGridNo) == 1 || (pStructure->fFlags & STRUCTURE_SLIDINGDOOR && (sDestGridNo - pSoldier->sGridNo) == 2) )&& ubDirection == NORTH )
{
ubDirection = NORTHEAST;
bSideOpenDoor = true;
} // standing south, right of door
else if ( (pSoldier->sGridNo - sDestGridNo) == 1 && ubDirection == NORTH )
{
ubDirection = NORTHWEST;
bSideOpenDoor = true;
} // standing north, left of door
else if ( (pSoldier->sGridNo - sDestGridNo) == 1 && ubDirection == SOUTH )
{
ubDirection = SOUTHWEST;
bSideOpenDoor = true;
} // standing north, right of door
else if ( ( (sDestGridNo - pSoldier->sGridNo) == 1 || (pStructure->fFlags & STRUCTURE_SLIDINGDOOR && (sDestGridNo - pSoldier->sGridNo) == 2) ) && ubDirection == SOUTH )
{
ubDirection = SOUTHEAST;
bSideOpenDoor = true;
}
break;
// orientation SW - NE
case INSIDE_TOP_RIGHT:
if ( (sDestGridNo - pSoldier->sGridNo == WORLD_COLS) || (pSoldier->sGridNo - sDestGridNo == WORLD_COLS) ||
( pStructure->fFlags & STRUCTURE_SLIDINGDOOR && sDestGridNo - pSoldier->sGridNo == WORLD_COLS *2) )
bSideOpenDoor = true;
break;
// orientation NW - SE
case OUTSIDE_TOP_LEFT:
if ( (sDestGridNo - pSoldier->sGridNo == 1) || (pSoldier->sGridNo - sDestGridNo == 1) ||
( pStructure->fFlags & STRUCTURE_SLIDINGDOOR && sDestGridNo - pSoldier->sGridNo == 2) )
bSideOpenDoor = true;
break;
// orientation SW - NE
case OUTSIDE_TOP_RIGHT:
if ( (sDestGridNo - pSoldier->sGridNo == WORLD_COLS) || (pSoldier->sGridNo - sDestGridNo == WORLD_COLS) ||
( pStructure->fFlags & STRUCTURE_SLIDINGDOOR && sDestGridNo - pSoldier->sGridNo == WORLD_COLS *2) )
// standing east, left of door
if ( (pSoldier->sGridNo - sDestGridNo) == WORLD_COLS && ubDirection == WEST )
{
ubDirection = NORTHWEST;
bSideOpenDoor = true;
} // standing east, right of door
else if ( ( (sDestGridNo - pSoldier->sGridNo) == WORLD_COLS || (pStructure->fFlags & STRUCTURE_SLIDINGDOOR && (sDestGridNo - pSoldier->sGridNo) == (WORLD_COLS *2)) ) && ubDirection == WEST )
{
ubDirection = SOUTHWEST;
bSideOpenDoor = true;
} // standing west, left of door
else if ( ( (sDestGridNo - pSoldier->sGridNo) == WORLD_COLS || (pStructure->fFlags & STRUCTURE_SLIDINGDOOR && (sDestGridNo - pSoldier->sGridNo) == (WORLD_COLS *2)) ) && ubDirection == EAST )
{
ubDirection = SOUTHEAST;
bSideOpenDoor = true;
} // standing west, right of door
else if ( (pSoldier->sGridNo - sDestGridNo) == WORLD_COLS && ubDirection == EAST )
{
ubDirection = NORTHEAST;
bSideOpenDoor = true;
}
break;
}
}