Should remove warnings on compilation. gsoc2008_force_feedback
authorEdgar Simo <bobbens@gmail.com>
Wed, 06 Aug 2008 10:33:16 +0000
branchgsoc2008_force_feedback
changeset 2628bfbda6c656e5
parent 2627 265ced2079bd
child 2629 43a0416b3707
Should remove warnings on compilation.
src/haptic/darwin/SDL_syshaptic.c
     1.1 --- a/src/haptic/darwin/SDL_syshaptic.c	Wed Aug 06 10:26:47 2008 +0000
     1.2 +++ b/src/haptic/darwin/SDL_syshaptic.c	Wed Aug 06 10:33:16 2008 +0000
     1.3 @@ -582,7 +582,11 @@
     1.4     }
     1.5  }
     1.6  
     1.7 -#define CONVERT(x)   (((x) > 0x7FFF) ? 10000 : ((x)*10000) / 0x7FFF)
     1.8 +
     1.9 +/* Clamps and converts. */
    1.10 +#define CCONVERT(x)   (((x) > 0x7FFF) ? 10000 : ((x)*10000) / 0x7FFF)
    1.11 +/* Just converts. */
    1.12 +#define CONVERT(x)    (((x)*10000) / 0x7FFF)
    1.13  /*
    1.14   * Creates the FFEFFECT from a SDL_HapticEffect.
    1.15   */
    1.16 @@ -672,9 +676,9 @@
    1.17              dest->lpEnvelope = NULL;
    1.18           }
    1.19           else {
    1.20 -            envelope->dwAttackLevel = CONVERT(hap_constant->attack_level);
    1.21 +            envelope->dwAttackLevel = CCONVERT(hap_constant->attack_level);
    1.22              envelope->dwAttackTime = hap_constant->attack_length * 1000;
    1.23 -            envelope->dwFadeLevel = CONVERT(hap_constant->fade_level);
    1.24 +            envelope->dwFadeLevel = CCONVERT(hap_constant->fade_level);
    1.25              envelope->dwFadeTime = hap_constant->fade_length * 1000;
    1.26           }
    1.27  
    1.28 @@ -718,9 +722,9 @@
    1.29              dest->lpEnvelope = NULL;
    1.30           }
    1.31           else {
    1.32 -            envelope->dwAttackLevel = CONVERT(hap_periodic->attack_level);
    1.33 +            envelope->dwAttackLevel = CCONVERT(hap_periodic->attack_level);
    1.34              envelope->dwAttackTime = hap_periodic->attack_length * 1000;
    1.35 -            envelope->dwFadeLevel = CONVERT(hap_periodic->fade_level);
    1.36 +            envelope->dwFadeLevel = CCONVERT(hap_periodic->fade_level);
    1.37              envelope->dwFadeTime = hap_periodic->fade_length * 1000;
    1.38           }
    1.39  
    1.40 @@ -743,9 +747,9 @@
    1.41              condition[i].lOffset = CONVERT(hap_condition->center[i]);
    1.42              condition[i].lPositiveCoefficient = CONVERT(hap_condition->right_coeff[i]);
    1.43              condition[i].lNegativeCoefficient = CONVERT(hap_condition->left_coeff[i]);
    1.44 -            condition[i].dwPositiveSaturation = CONVERT(hap_condition->right_sat[i]);
    1.45 -            condition[i].dwNegativeSaturation = CONVERT(hap_condition->left_sat[i]);
    1.46 -            condition[i].lDeadBand = CONVERT(hap_condition->deadband[i]);
    1.47 +            condition[i].dwPositiveSaturation = CCONVERT(hap_condition->right_sat[i]);
    1.48 +            condition[i].dwNegativeSaturation = CCONVERT(hap_condition->left_sat[i]);
    1.49 +            condition[i].lDeadBand = CCONVERT(hap_condition->deadband[i]);
    1.50           }
    1.51           dest->cbTypeSpecificParams = sizeof(FFCONDITION) * dest->cAxes;
    1.52           dest->lpvTypeSpecificParams = condition;
    1.53 @@ -765,9 +769,9 @@
    1.54           SDL_free(dest->lpEnvelope);
    1.55           dest->lpEnvelope = NULL;
    1.56  /* TODO Check is envelope actually used.
    1.57 -         envelope->dwAttackLevel = CONVERT(hap_condition->attack_level);
    1.58 +         envelope->dwAttackLevel = CCONVERT(hap_condition->attack_level);
    1.59           envelope->dwAttackTime = hap_condition->attack_length * 1000;
    1.60 -         envelope->dwFadeLevel = CONVERT(hap_condition->fade_level);
    1.61 +         envelope->dwFadeLevel = CCONVERT(hap_condition->fade_level);
    1.62           envelope->dwFadeTime = hap_condition->fade_length * 1000;
    1.63  */
    1.64  
    1.65 @@ -805,9 +809,9 @@
    1.66              dest->lpEnvelope = NULL;
    1.67           }
    1.68           else {
    1.69 -            envelope->dwAttackLevel = CONVERT(hap_ramp->attack_level);
    1.70 +            envelope->dwAttackLevel = CCONVERT(hap_ramp->attack_level);
    1.71              envelope->dwAttackTime = hap_ramp->attack_length * 1000;
    1.72 -            envelope->dwFadeLevel = CONVERT(hap_ramp->fade_level);
    1.73 +            envelope->dwFadeLevel = CCONVERT(hap_ramp->fade_level);
    1.74              envelope->dwFadeTime = hap_ramp->fade_length * 1000;
    1.75           }
    1.76  
    1.77 @@ -828,7 +832,7 @@
    1.78           custom->cSamples = hap_custom->samples;
    1.79           custom->rglForceData = SDL_malloc(sizeof(LONG)*custom->cSamples*custom->cChannels);
    1.80           for (i=0; i<hap_custom->samples*hap_custom->channels; i++) { /* Copy data. */
    1.81 -            custom->rglForceData[i] = CONVERT(hap_custom->data[i]);
    1.82 +            custom->rglForceData[i] = CCONVERT(hap_custom->data[i]);
    1.83           }
    1.84           dest->cbTypeSpecificParams = sizeof(FFCUSTOMFORCE);
    1.85           dest->lpvTypeSpecificParams = custom;
    1.86 @@ -850,9 +854,9 @@
    1.87              dest->lpEnvelope = NULL;
    1.88           }
    1.89           else {
    1.90 -            envelope->dwAttackLevel = CONVERT(hap_custom->attack_level);
    1.91 +            envelope->dwAttackLevel = CCONVERT(hap_custom->attack_level);
    1.92              envelope->dwAttackTime = hap_custom->attack_length * 1000;
    1.93 -            envelope->dwFadeLevel = CONVERT(hap_custom->fade_level);
    1.94 +            envelope->dwFadeLevel = CCONVERT(hap_custom->fade_level);
    1.95              envelope->dwFadeTime = hap_custom->fade_length * 1000;
    1.96           }
    1.97