@ -2274,75 +2274,106 @@ void ObjL2Special(int x1, int y1, int x2, int y2)
}
}
void DoorSet ( int oi , int dx , int dy )
void DoorSet ( Point position , _object_id doorType )
{
int pn = dPiece [ dx ] [ d y] ;
int pn = dPiece [ position . x ] [ position . y ] ;
if ( currlevel < 17 ) {
if ( pn = = 43 )
ObjSetMicro ( { dx , dy } , 392 ) ;
if ( pn = = 45 )
ObjSetMicro ( { dx , dy } , 394 ) ;
if ( pn = = 50 & & Objects [ oi ] . _otype = = OBJ_L1LDOOR )
ObjSetMicro ( { dx , dy } , 411 ) ;
if ( pn = = 50 & & Objects [ oi ] . _otype = = OBJ_L1RDOOR )
ObjSetMicro ( { dx , dy } , 412 ) ;
if ( pn = = 54 )
ObjSetMicro ( { dx , dy } , 397 ) ;
if ( pn = = 55 )
ObjSetMicro ( { dx , dy } , 398 ) ;
if ( pn = = 61 )
ObjSetMicro ( { dx , dy } , 399 ) ;
if ( pn = = 67 )
ObjSetMicro ( { dx , dy } , 400 ) ;
if ( pn = = 68 )
ObjSetMicro ( { dx , dy } , 401 ) ;
if ( pn = = 69 )
ObjSetMicro ( { dx , dy } , 403 ) ;
if ( pn = = 70 )
ObjSetMicro ( { dx , dy } , 404 ) ;
if ( pn = = 72 )
ObjSetMicro ( { dx , dy } , 406 ) ;
if ( pn = = 212 )
ObjSetMicro ( { dx , dy } , 407 ) ;
if ( pn = = 354 )
ObjSetMicro ( { dx , dy } , 409 ) ;
if ( pn = = 355 )
ObjSetMicro ( { dx , dy } , 410 ) ;
if ( pn = = 411 )
ObjSetMicro ( { dx , dy } , 396 ) ;
if ( pn = = 412 )
ObjSetMicro ( { dx , dy } , 396 ) ;
} else {
if ( pn = = 75 )
ObjSetMicro ( { dx , dy } , 204 ) ;
if ( pn = = 79 )
ObjSetMicro ( { dx , dy } , 208 ) ;
if ( pn = = 86 & & Objects [ oi ] . _otype = = OBJ_L1LDOOR ) {
ObjSetMicro ( { dx , dy } , 232 ) ;
switch ( pn ) {
case 43 :
ObjSetMicro ( position , 392 ) ;
break ;
case 45 :
ObjSetMicro ( position , 394 ) ;
break ;
case 50 :
if ( doorType = = _object_id : : OBJ_L1LDOOR )
ObjSetMicro ( position , 411 ) ;
else if ( doorType = = _object_id : : OBJ_L1RDOOR )
ObjSetMicro ( position , 412 ) ;
break ;
case 54 :
ObjSetMicro ( position , 397 ) ;
break ;
case 55 :
ObjSetMicro ( position , 398 ) ;
break ;
case 61 :
ObjSetMicro ( position , 399 ) ;
break ;
case 67 :
ObjSetMicro ( position , 400 ) ;
break ;
case 68 :
ObjSetMicro ( position , 401 ) ;
break ;
case 69 :
ObjSetMicro ( position , 403 ) ;
break ;
case 70 :
ObjSetMicro ( position , 404 ) ;
break ;
case 72 :
ObjSetMicro ( position , 406 ) ;
break ;
case 212 :
ObjSetMicro ( position , 407 ) ;
break ;
case 354 :
ObjSetMicro ( position , 409 ) ;
break ;
case 355 :
ObjSetMicro ( position , 410 ) ;
break ;
case 411 :
case 412 :
ObjSetMicro ( position , 396 ) ;
break ;
}
if ( pn = = 86 & & Objects [ oi ] . _otype = = OBJ_L1RDOOR ) {
ObjSetMicro ( { dx , dy } , 234 ) ;
} else {
switch ( pn ) {
case 75 :
ObjSetMicro ( position , 204 ) ;
break ;
case 79 :
ObjSetMicro ( position , 208 ) ;
break ;
case 86 :
if ( doorType = = _object_id : : OBJ_L1LDOOR ) {
ObjSetMicro ( position , 232 ) ;
}
if ( doorType = = _object_id : : OBJ_L1RDOOR ) {
ObjSetMicro ( position , 234 ) ;
}
break ;
case 91 :
ObjSetMicro ( position , 215 ) ;
break ;
case 93 :
ObjSetMicro ( position , 218 ) ;
break ;
case 99 :
ObjSetMicro ( position , 220 ) ;
break ;
case 111 :
ObjSetMicro ( position , 222 ) ;
break ;
case 113 :
ObjSetMicro ( position , 224 ) ;
break ;
case 115 :
ObjSetMicro ( position , 226 ) ;
break ;
case 117 :
ObjSetMicro ( position , 228 ) ;
break ;
case 119 :
ObjSetMicro ( position , 230 ) ;
break ;
case 232 :
case 234 :
ObjSetMicro ( position , 212 ) ;
break ;
}
if ( pn = = 91 )
ObjSetMicro ( { dx , dy } , 215 ) ;
if ( pn = = 93 )
ObjSetMicro ( { dx , dy } , 218 ) ;
if ( pn = = 99 )
ObjSetMicro ( { dx , dy } , 220 ) ;
if ( pn = = 111 )
ObjSetMicro ( { dx , dy } , 222 ) ;
if ( pn = = 113 )
ObjSetMicro ( { dx , dy } , 224 ) ;
if ( pn = = 115 )
ObjSetMicro ( { dx , dy } , 226 ) ;
if ( pn = = 117 )
ObjSetMicro ( { dx , dy } , 228 ) ;
if ( pn = = 119 )
ObjSetMicro ( { dx , dy } , 230 ) ;
if ( pn = = 232 )
ObjSetMicro ( { dx , dy } , 212 ) ;
if ( pn = = 234 )
ObjSetMicro ( { dx , dy } , 212 ) ;
}
}
@ -2400,7 +2431,7 @@ void OperateL1RDoor(int pnum, int oi, bool sendflag)
objects_set_door_piece ( door . position + Direction : : DIR_NE ) ;
door . _oAnimFrame + = 2 ;
door . _oPreFlag = true ;
DoorSet ( oi , door . position . x - 1 , door . position . y ) ;
DoorSet ( door . position + Direction : : DIR_NW , door . _otype ) ;
door . _oVar4 = 1 ;
door . _oSelFlag = 2 ;
RedoPlayerVision ( ) ;
@ -2481,7 +2512,7 @@ void OperateL1LDoor(int pnum, int oi, bool sendflag)
objects_set_door_piece ( door . position + Direction : : DIR_NW ) ;
door . _oAnimFrame + = 2 ;
door . _oPreFlag = true ;
DoorSet ( oi , door . position . x , door . position . y - 1 ) ;
DoorSet ( door . position + Direction : : DIR_NE , door . _otype ) ;
door . _oVar4 = 1 ;
door . _oSelFlag = 2 ;
RedoPlayerVision ( ) ;
@ -5119,46 +5150,43 @@ void SyncBreakObj(int pnum, int oi)
BreakBarrel ( pnum , oi , 0 , true , false ) ;
}
void SyncL1Doors ( int i )
void SyncL1Doors ( ObjectStruct & door )
{
if ( Objects [ i ] . _oVar4 = = 0 ) {
Objects [ i ] . _oMissFlag = false ;
if ( door . _oVar4 = = 0 ) {
door . _oMissFlag = false ;
return ;
}
Objects [ i ] . _oMissFlag = true ;
door . _oMissFlag = true ;
door . _oSelFlag = 2 ;
auto doorPosition = Objects [ i ] . position ;
Objects [ i ] . _oSelFlag = 2 ;
Direction doorSetDirection { Direction : : DIR_OMNI } ;
if ( currlevel < 17 ) {
if ( Objects [ i ] . _otype = = OBJ_L1LDOOR ) {
if ( Objects [ i ] . _oVar1 = = 214 )
ObjSetMicro ( doorPosition , 408 ) ;
else
ObjSetMicro ( doorPosition , 393 ) ;
dSpecial [ doorPosition . x ] [ doorPosition . y ] = 7 ;
objects_set_door_piece ( doorPosition + Direction : : DIR_NW ) ;
doorPosition . y - - ;
if ( door . _otype = = _object_id : : OBJ_L1LDOOR ) {
ObjSetMicro ( door . position , door . _oVar1 = = 214 ? 408 : 393 ) ;
dSpecial [ door . position . x ] [ door . position . y ] = 7 ;
objects_set_door_piece ( door . position + Direction : : DIR_NW ) ;
doorSetDirection = Direction : : DIR_NE ;
} else {
ObjSetMicro ( doorP osition , 395 ) ;
dSpecial [ doorP osition . x ] [ doorP osition . y ] = 8 ;
objects_set_door_piece ( doorP osition + Direction : : DIR_NE ) ;
doorPosition . x - - ;
ObjSetMicro ( door . position , 395 ) ;
dSpecial [ door . position . x ] [ door . position . y ] = 8 ;
objects_set_door_piece ( door . p osition + Direction : : DIR_NE ) ;
doorSetDirection = Direction : : DIR_NW ;
}
} else {
if ( Objects [ i ] . _otype = = OBJ_L1LDOOR ) {
ObjSetMicro ( doorP osition , 206 ) ;
dSpecial [ doorP osition . x ] [ doorP osition . y ] = 1 ;
objects_set_door_piece ( doorP osition + Direction : : DIR_NW ) ;
doorPosition . y - - ;
if ( door . _otype = = _object_id : : OBJ_L1LDOOR ) {
ObjSetMicro ( door . p osition, 206 ) ;
dSpecial [ door . p osition. x ] [ door . p osition. y ] = 1 ;
objects_set_door_piece ( door . p osition + Direction : : DIR_NW ) ;
doorSetDirection = Direction : : DIR_NE ;
} else {
ObjSetMicro ( doorP osition , 209 ) ;
dSpecial [ doorP osition . x ] [ doorP osition . y ] = 2 ;
objects_set_door_piece ( doorP osition + Direction : : DIR_NE ) ;
doorPosition . x - - ;
ObjSetMicro ( door . p osition, 209 ) ;
dSpecial [ door . p osition. x ] [ door . p osition. y ] = 2 ;
objects_set_door_piece ( door . p osition + Direction : : DIR_NE ) ;
doorSetDirection = Direction : : DIR_NW ;
}
}
DoorSet ( i , doorPosition . x , doorPosition . y ) ;
DoorSet ( door . position + doorSetDirection , door . _ot ype ) ;
}
void SyncCrux ( int i )
@ -5212,41 +5240,41 @@ void SyncPedistal(int i)
}
}
void SyncL2Doors ( int i )
void SyncL2Doors ( ObjectStruct & door )
{
Objects [ i ] . _oMissFlag = Objects [ i ] . _oVar4 ! = 0 ;
int x = Objects [ i ] . position . x ;
int y = Objects [ i ] . position . y ;
Objects [ i ] . _oSelFlag = 2 ;
if ( Objects [ i ] . _otype = = OBJ_L2LDOOR & & Objects [ i ] . _oVar4 = = 0 ) {
ObjSetMicro ( { x , y } , 538 ) ;
dSpecial [ x ] [ y ] = 0 ;
} else if ( Objects [ i ] . _otype = = OBJ_L2LDOOR & & ( Objects [ i ] . _oVar4 = = 1 | | Objects [ i ] . _oVar4 = = 2 ) ) {
ObjSetMicro ( { x , y } , 13 ) ;
dSpecial [ x ] [ y ] = 5 ;
} else if ( Objects [ i ] . _otype = = OBJ_L2RDOOR & & Objects [ i ] . _oVar4 = = 0 ) {
ObjSetMicro ( { x , y } , 540 ) ;
dSpecial [ x ] [ y ] = 0 ;
} else if ( Objects [ i ] . _otype = = OBJ_L2RDOOR & & ( Objects [ i ] . _oVar4 = = 1 | | Objects [ i ] . _oVar4 = = 2 ) ) {
ObjSetMicro ( { x , y } , 17 ) ;
dSpecial [ x ] [ y ] = 6 ;
door . _oMissFlag = door . _oVar4 ! = 0 ;
door . _oSelFlag = 2 ;
bool isLeftDoor = door . _otype = = _object_id : : OBJ_L2LDOOR ; // otherwise the door is type OBJ_L2RDOOR
switch ( door . _oVar4 ) {
case 0 :
ObjSetMicro ( door . position , isLeftDoor ? 538 : 540 ) ;
dSpecial [ door . position . x ] [ door . position . y ] = 0 ;
break ;
case 1 :
case 2 :
ObjSetMicro ( door . position , isLeftDoor ? 13 : 17 ) ;
dSpecial [ door . position . x ] [ door . position . y ] = isLeftDoor ? 5 : 6 ;
break ;
}
}
void SyncL3Doors ( int i )
void SyncL3Doors ( ObjectStruct & door )
{
Objects [ i ] . _oMissFlag = true ;
int x = Objects [ i ] . position . x ;
int y = Objects [ i ] . position . y ;
Objects [ i ] . _oSelFlag = 2 ;
if ( Objects [ i ] . _otype = = OBJ_L3LDOOR & & Objects [ i ] . _oVar4 = = 0 ) {
ObjSetMicro ( { x , y } , 531 ) ;
} else if ( Objects [ i ] . _otype = = OBJ_L3LDOOR & & ( Objects [ i ] . _oVar4 = = 1 | | Objects [ i ] . _oVar4 = = 2 ) ) {
ObjSetMicro ( { x , y } , 538 ) ;
} else if ( Objects [ i ] . _otype = = OBJ_L3RDOOR & & Objects [ i ] . _oVar4 = = 0 ) {
ObjSetMicro ( { x , y } , 534 ) ;
} else if ( Objects [ i ] . _otype = = OBJ_L3RDOOR & & ( Objects [ i ] . _oVar4 = = 1 | | Objects [ i ] . _oVar4 = = 2 ) ) {
ObjSetMicro ( { x , y } , 541 ) ;
door . _oMissFlag = true ;
door . _oSelFlag = 2 ;
bool isLeftDoor = door . _otype = = _object_id : : OBJ_L3LDOOR ; // otherwise the door is type OBJ_L3RDOOR
switch ( door . _oVar4 ) {
case 0 :
ObjSetMicro ( door . position , isLeftDoor ? 531 : 534 ) ;
break ;
case 1 :
case 2 :
ObjSetMicro ( door . position , isLeftDoor ? 538 : 541 ) ;
break ;
}
}
@ -5266,15 +5294,15 @@ void SyncObjectAnim(int o)
switch ( Objects [ o ] . _otype ) {
case OBJ_L1LDOOR :
case OBJ_L1RDOOR :
SyncL1Doors ( o ) ;
SyncL1Doors ( Objects [ o ] ) ;
break ;
case OBJ_L2LDOOR :
case OBJ_L2RDOOR :
SyncL2Doors ( o ) ;
SyncL2Doors ( Objects [ o ] ) ;
break ;
case OBJ_L3LDOOR :
case OBJ_L3RDOOR :
SyncL3Doors ( o ) ;
SyncL3Doors ( Objects [ o ] ) ;
break ;
case OBJ_CRUX1 :
case OBJ_CRUX2 :