Mercurial > mm7
diff Indoor.cpp @ 2101:ee2724b9ca05
RasterLine2D fix and etc.
author | Ritor1 |
---|---|
date | Mon, 16 Dec 2013 18:43:42 +0600 |
parents | 577c081b8019 |
children | 4c0c475917dd |
line wrap: on
line diff
--- a/Indoor.cpp Fri Dec 13 22:19:56 2013 +0600 +++ b/Indoor.cpp Mon Dec 16 18:43:42 2013 +0600 @@ -7150,4 +7150,98 @@ pParty->uFlags |= 0x200; if (uFaceEvent) EventProcessor(uFaceEvent, 0, 1); +} + +//----- (00449A49) -------------------------------------------------------- +void Door_switch_animation(unsigned int uDoorID, int a2) +{ + int old_state; // eax@1 + signed int door_id; // esi@2 + + if ( !pIndoor->pDoors ) + return; + for ( door_id = 0; door_id < 200; ++door_id ) + { + if ( pIndoor->pDoors[door_id].uDoorID == uDoorID ) + break; + } + if ( door_id >= 200 ) + { + Error("Unable to find Door ID: %i!", uDoorID); + } + old_state = pIndoor->pDoors[door_id].uState; + //old_state: 0 - в нижнем положении/закрыто + // 2 - в верхнем положении/открыто, + //a2: 1 - открыть + // 2 - опустить/поднять + if ( a2 == 2 ) + { + if ( pIndoor->pDoors[door_id].uState == BLVDoor::Closing || pIndoor->pDoors[door_id].uState == BLVDoor::Opening ) + return; + if ( pIndoor->pDoors[door_id].uState ) + { + if ( pIndoor->pDoors[door_id].uState != BLVDoor::Closed && pIndoor->pDoors[door_id].uState != BLVDoor::Closing ) + { + pIndoor->pDoors[door_id].uState = BLVDoor::Closing; + if ( old_state == BLVDoor::Open ) + { + pIndoor->pDoors[door_id].uTimeSinceTriggered = 0; + return; + } + if ( pIndoor->pDoors[door_id].uTimeSinceTriggered != 15360 ) + { + pIndoor->pDoors[door_id].uTimeSinceTriggered = (pIndoor->pDoors[door_id].uMoveLength << 7) / pIndoor->pDoors[door_id].uOpenSpeed + - ((signed int)(pIndoor->pDoors[door_id].uTimeSinceTriggered * pIndoor->pDoors[door_id].uCloseSpeed) + / 128 << 7) / pIndoor->pDoors[door_id].uOpenSpeed; + return; + } + pIndoor->pDoors[door_id].uTimeSinceTriggered = 15360; + } + return; + } + } + else + { + if ( a2 == 0 ) + { + if ( pIndoor->pDoors[door_id].uState != BLVDoor::Closed && pIndoor->pDoors[door_id].uState != BLVDoor::Closing ) + { + pIndoor->pDoors[door_id].uState = BLVDoor::Closing; + if ( old_state == BLVDoor::Open ) + { + pIndoor->pDoors[door_id].uTimeSinceTriggered = 0; + return; + } + if ( pIndoor->pDoors[door_id].uTimeSinceTriggered != 15360 ) + { + pIndoor->pDoors[door_id].uTimeSinceTriggered = (pIndoor->pDoors[door_id].uMoveLength << 7) / pIndoor->pDoors[door_id].uOpenSpeed + - ((signed int)(pIndoor->pDoors[door_id].uTimeSinceTriggered * pIndoor->pDoors[door_id].uCloseSpeed) + / 128 << 7) / pIndoor->pDoors[door_id].uOpenSpeed; + return; + } + pIndoor->pDoors[door_id].uTimeSinceTriggered = 15360; + } + return; + } + if ( a2 != 1 ) + return; + } + if ( old_state != BLVDoor::Open && old_state != BLVDoor::Opening ) + { + pIndoor->pDoors[door_id].uState = BLVDoor::Opening; + if ( old_state == BLVDoor::Closed ) + { + pIndoor->pDoors[door_id].uTimeSinceTriggered = 0; + return; + } + if ( pIndoor->pDoors[door_id].uTimeSinceTriggered != 15360 ) + { + pIndoor->pDoors[door_id].uTimeSinceTriggered = (pIndoor->pDoors[door_id].uMoveLength << 7) / pIndoor->pDoors[door_id].uCloseSpeed + - ((signed int)(pIndoor->pDoors[door_id].uTimeSinceTriggered * pIndoor->pDoors[door_id].uOpenSpeed) + / 128 << 7) / pIndoor->pDoors[door_id].uCloseSpeed; + return; + } + pIndoor->pDoors[door_id].uTimeSinceTriggered = 15360; + } + return; } \ No newline at end of file