| 141 | } |
| 142 | |
| 143 | private static void KeyUp(kbutton_t b, List<String> args) { |
| 144 | int k; |
| 145 | |
| 146 | if (args.size() >= 2) |
| 147 | k = Lib.atoi(args.get(1)); |
| 148 | else { |
| 149 | // typed manually at the console, assume for unsticking, so clear |
| 150 | // all |
| 151 | b.down[0] = b.down[1] = 0; |
| 152 | b.state = 4; // impulse up |
| 153 | return; |
| 154 | } |
| 155 | |
| 156 | if (b.down[0] == k) |
| 157 | b.down[0] = 0; |
| 158 | else if (b.down[1] == k) |
| 159 | b.down[1] = 0; |
| 160 | else |
| 161 | return; // key up without coresponding down (menu pass through) |
| 162 | if (b.down[0] != 0 || b.down[1] != 0) |
| 163 | return; // some other key is still holding it down |
| 164 | |
| 165 | if ((b.state & 1) == 0) |
| 166 | return; // still up (this should not happen) |
| 167 | |
| 168 | // save timestamp |
| 169 | if (args.size() >= 3) |
| 170 | b.msec += Lib.atoi(args.get(2)) - b.downtime; |
| 171 | else |
| 172 | b.msec += 10; |
| 173 | |
| 174 | b.state &= ~1; // now up |
| 175 | b.state |= 4; // impulse up |
| 176 | } |
| 177 | |
| 178 | /* |
| 179 | * =============== CL_KeyState |