Mercurial > sdl-ios-xcode
comparison src/haptic/linux/SDL_syshaptic.c @ 2634:dbd63c419ba5 gsoc2008_force_feedback
Correctness patch my alam.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Wed, 06 Aug 2008 15:39:08 +0000 |
parents | 3696b9ce8a37 |
children | 318e67011ad9 |
comparison
equal
deleted
inserted
replaced
2633:6b0d1f494c10 | 2634:dbd63c419ba5 |
---|---|
504 tmp = (((18000 + tmp) % 36000) * 0xFFFF) / 36000; | 504 tmp = (((18000 + tmp) % 36000) * 0xFFFF) / 36000; |
505 return (Uint16) tmp; | 505 return (Uint16) tmp; |
506 | 506 |
507 default: | 507 default: |
508 SDL_SetError("Haptic: Unsupported direction type."); | 508 SDL_SetError("Haptic: Unsupported direction type."); |
509 return -1; | 509 return (Uint16)-1; |
510 } | 510 } |
511 | 511 |
512 return 0; | 512 return 0; |
513 } | 513 } |
514 | 514 |
535 constant = &src->constant; | 535 constant = &src->constant; |
536 | 536 |
537 /* Header */ | 537 /* Header */ |
538 dest->type = FF_CONSTANT; | 538 dest->type = FF_CONSTANT; |
539 dest->direction = SDL_SYS_ToDirection(&constant->direction); | 539 dest->direction = SDL_SYS_ToDirection(&constant->direction); |
540 if (dest->direction < 0) return -1; | 540 if (dest->direction == (Uint16)-1) return -1; |
541 | 541 |
542 /* Replay */ | 542 /* Replay */ |
543 dest->replay.length = (constant->length == SDL_HAPTIC_INFINITY) ? | 543 dest->replay.length = (constant->length == SDL_HAPTIC_INFINITY) ? |
544 0 : CLAMP(constant->length); | 544 0 : CLAMP(constant->length); |
545 dest->replay.delay = CLAMP(constant->delay); | 545 dest->replay.delay = CLAMP(constant->delay); |
567 periodic = &src->periodic; | 567 periodic = &src->periodic; |
568 | 568 |
569 /* Header */ | 569 /* Header */ |
570 dest->type = FF_PERIODIC; | 570 dest->type = FF_PERIODIC; |
571 dest->direction = SDL_SYS_ToDirection(&periodic->direction); | 571 dest->direction = SDL_SYS_ToDirection(&periodic->direction); |
572 if (dest->direction < 0) return -1; | 572 if (dest->direction == (Uint16)-1) return -1; |
573 | 573 |
574 /* Replay */ | 574 /* Replay */ |
575 dest->replay.length = (periodic->length == SDL_HAPTIC_INFINITY) ? | 575 dest->replay.length = (periodic->length == SDL_HAPTIC_INFINITY) ? |
576 0 : CLAMP(periodic->length); | 576 0 : CLAMP(periodic->length); |
577 dest->replay.delay = CLAMP(periodic->delay); | 577 dest->replay.delay = CLAMP(periodic->delay); |
654 ramp = &src->ramp; | 654 ramp = &src->ramp; |
655 | 655 |
656 /* Header */ | 656 /* Header */ |
657 dest->type = FF_RAMP; | 657 dest->type = FF_RAMP; |
658 dest->direction = SDL_SYS_ToDirection(&ramp->direction); | 658 dest->direction = SDL_SYS_ToDirection(&ramp->direction); |
659 if (dest->direction < 0) return -1; | 659 if (dest->direction == (Uint16)-1) return -1; |
660 | 660 |
661 /* Replay */ | 661 /* Replay */ |
662 dest->replay.length = (ramp->length == SDL_HAPTIC_INFINITY) ? | 662 dest->replay.length = (ramp->length == SDL_HAPTIC_INFINITY) ? |
663 0 : CLAMP(ramp->length); | 663 0 : CLAMP(ramp->length); |
664 dest->replay.delay = CLAMP(ramp->delay); | 664 dest->replay.delay = CLAMP(ramp->delay); |