X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=a300c84f9ba46c546ba0c694c023655221c06965;hb=7ff43d7ba40390c41b10888aad0a35dfe3cad82a;hp=98292409bee141f5eabf20d92c62136178e9970b;hpb=8c6f354ceb0f49857489ef2df0303e155e7f6846;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 98292409..a300c84f 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1966,7 +1966,7 @@ boolean Request(char *text, unsigned int req_state) break; case EVENT_KEYRELEASE: - key_joystick_mapping = 0; + ClearPlayerAction(); break; default: @@ -2054,7 +2054,12 @@ unsigned int CloseDoor(unsigned int door_state) unsigned int GetDoorState() { - return(MoveDoor(DOOR_GET_STATE)); + return MoveDoor(DOOR_GET_STATE); +} + +unsigned int SetDoorState(unsigned int door_state) +{ + return MoveDoor(door_state | DOOR_SET_STATE); } unsigned int MoveDoor(unsigned int door_state) @@ -2068,6 +2073,16 @@ unsigned int MoveDoor(unsigned int door_state) if (door_state == DOOR_GET_STATE) return(door1 | door2); + if (door_state & DOOR_SET_STATE) + { + if (door_state & DOOR_ACTION_1) + door1 = door_state & DOOR_ACTION_1; + if (door_state & DOOR_ACTION_2) + door2 = door_state & DOOR_ACTION_2; + + return(door1 | door2); + } + if (door1 == DOOR_OPEN_1 && door_state & DOOR_OPEN_1) door_state &= ~DOOR_OPEN_1; else if (door1 == DOOR_CLOSE_1 && door_state & DOOR_CLOSE_1) @@ -2081,13 +2096,19 @@ unsigned int MoveDoor(unsigned int door_state) { stepsize = 20; door_delay_value = 0; - StopSound(SND_OEFFNEN); + StopSound(SND_MENU_DOOR_OPENING); + StopSound(SND_MENU_DOOR_CLOSING); } if (door_state & DOOR_ACTION) { if (!(door_state & DOOR_NO_DELAY)) - PlaySoundStereo(SND_OEFFNEN, PSND_MAX_RIGHT); + { + if (door_state & (DOOR_OPEN_1 | DOOR_OPEN_2)) + PlaySoundStereo(SND_MENU_DOOR_OPENING, PSND_MAX_RIGHT); + if (door_state & (DOOR_CLOSE_1 | DOOR_CLOSE_2)) + PlaySoundStereo(SND_MENU_DOOR_CLOSING, PSND_MAX_RIGHT); + } start = ((door_state & DOOR_NO_DELAY) ? DXSIZE : 0); @@ -2182,7 +2203,10 @@ unsigned int MoveDoor(unsigned int door_state) } if (setup.quick_doors) - StopSound(SND_OEFFNEN); + { + StopSound(SND_MENU_DOOR_OPENING); + StopSound(SND_MENU_DOOR_CLOSING); + } if (door_state & DOOR_ACTION_1) door1 = door_state & DOOR_ACTION_1;