411 grenadeTime.frame = CGRectMake(screen.size.height / 2 - 125, screen.size.width - 100, 250, 50); |
411 grenadeTime.frame = CGRectMake(screen.size.height / 2 - 125, screen.size.width - 100, 250, 50); |
412 [UIView commitAnimations]; |
412 [UIView commitAnimations]; |
413 |
413 |
414 [self activateOverlay]; |
414 [self activateOverlay]; |
415 doNotDim(); |
415 doNotDim(); |
416 } |
416 } |
417 isSegmentVisible = !isSegmentVisible; |
417 isSegmentVisible = !isSegmentVisible; |
418 } |
418 } else |
419 |
419 if (HW_isWeaponSwitch()) |
|
420 HW_tab(); |
420 break; |
421 break; |
421 case 2: |
422 case 2: |
422 HW_allKeysUp(); |
423 HW_allKeysUp(); |
423 break; |
424 break; |
424 default: |
425 default: |
445 } |
446 } |
446 |
447 |
447 -(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { |
448 -(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { |
448 CGRect screen = [[UIScreen mainScreen] bounds]; |
449 CGRect screen = [[UIScreen mainScreen] bounds]; |
449 NSSet *allTouches = [event allTouches]; |
450 NSSet *allTouches = [event allTouches]; |
|
451 int x, y; |
450 |
452 |
451 UITouch *touch, *first, *second; |
453 UITouch *touch, *first, *second; |
452 |
454 |
453 switch ([allTouches count]) { |
455 switch ([allTouches count]) { |
454 case 1: |
456 case 1: |
455 touch = [[allTouches allObjects] objectAtIndex:0]; |
457 touch = [[allTouches allObjects] objectAtIndex:0]; |
456 CGPoint currentPosition = [touch locationInView:self.view]; |
458 CGPoint currentPosition = [touch locationInView:self.view]; |
457 |
459 |
458 if (HW_isAmmoOpen()) { |
460 if (HW_isAmmoOpen() || HW_isWeaponRequiringClick()) { |
459 // moves the cursor around |
461 // moves the cursor around |
460 HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y)); |
462 HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y)); |
461 } else { |
463 } else { |
462 DLog(@"x: %f y: %f -> X:%d Y:%d", currentPosition.x, currentPosition.y, HWX(currentPosition.x), HWY(currentPosition.y)); |
464 // panning \o/ |
463 HW_setCursor(HWX(currentPosition.x), HWY(currentPosition.y)); |
465 HW_getCursor(&x, &y); |
464 if (HW_isWeaponSwitch()) |
466 x = x + currentPosition.x - startingPoint.x; |
465 HW_tab(); |
467 y = y + currentPosition.y - startingPoint.y; |
|
468 HW_setCursor(x, y); |
|
469 |
|
470 startingPoint = currentPosition; |
466 } |
471 } |
467 break; |
472 break; |
468 case 2: |
473 case 2: |
469 first = [[allTouches allObjects] objectAtIndex:0]; |
474 first = [[allTouches allObjects] objectAtIndex:0]; |
470 second = [[allTouches allObjects] objectAtIndex:1]; |
475 second = [[allTouches allObjects] objectAtIndex:1]; |