Skip to content

Commit e6b231c

Browse files
committed
Changed a number of 32-bit float literal constants to doubles by removing the 'f' suffix.
1 parent 554fcde commit e6b231c

File tree

2 files changed

+41
-41
lines changed

2 files changed

+41
-41
lines changed

cocos2d/CCActionEase.m

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#import "CCActionEase.h"
3737

3838
#ifndef M_PI_X_2
39-
#define M_PI_X_2 (float)M_PI * 2.0f
39+
#define M_PI_X_2 (float)M_PI * 2.0
4040
#endif
4141

4242
#pragma mark EaseAction
@@ -128,7 +128,7 @@ - (CCActionInterval*) reverse
128128
@implementation CCActionEaseSineInOut
129129
-(void) update: (CCTime) t
130130
{
131-
[_inner update:-0.5f*(cosf( (float)M_PI*t) - 1)];
131+
[_inner update:-0.5*(cosf( (float)M_PI*t) - 1)];
132132
}
133133
@end
134134

@@ -176,7 +176,7 @@ -(void) update: (CCTime) t
176176
@implementation CCActionEaseOut
177177
-(void) update: (CCTime) t
178178
{
179-
[_inner update: 1.0f - powf(1.0f - t, _rate)];
179+
[_inner update: 1.0 - powf(1.0 - t, _rate)];
180180
}
181181
@end
182182

@@ -186,10 +186,10 @@ -(void) update: (CCTime) t
186186
{
187187
t *= 2;
188188
if (t < 1) {
189-
[_inner update: 0.5f * powf (t, _rate)];
189+
[_inner update: 0.5 * powf (t, _rate)];
190190
}
191191
else {
192-
[_inner update: 1.0f - 0.5f * powf(2-t, _rate)];
192+
[_inner update: 1.0 - 0.5 * powf(2-t, _rate)];
193193
}
194194
}
195195

@@ -211,7 +211,7 @@ @implementation CCActionEaseElastic
211211

212212
+(instancetype) actionWithAction: (CCActionInterval*) action
213213
{
214-
return [[self alloc] initWithAction:action period:0.3f];
214+
return [[self alloc] initWithAction:action period:0.3];
215215
}
216216

217217
+(instancetype) actionWithAction: (CCActionInterval*) action period:(float)period
@@ -221,7 +221,7 @@ +(instancetype) actionWithAction: (CCActionInterval*) action period:(float)perio
221221

222222
-(id) initWithAction: (CCActionInterval*) action
223223
{
224-
return [self initWithAction:action period:0.3f];
224+
return [self initWithAction:action period:0.3];
225225
}
226226

227227
-(id) initWithAction: (CCActionInterval*) action period:(float)period
@@ -303,14 +303,14 @@ -(void) update: (CCTime) t
303303
else {
304304
t = t * 2;
305305
if(! _period )
306-
_period = 0.3f * 1.5f;
306+
_period = 0.3 * 1.5;
307307
CCTime s = _period / 4;
308308

309309
t = t -1;
310310
if( t < 0 )
311-
newT = -0.5f * powf(2, 10 * t) * sinf((t - s) * M_PI_X_2 / _period);
311+
newT = -0.5 * powf(2, 10 * t) * sinf((t - s) * M_PI_X_2 / _period);
312312
else
313-
newT = powf(2, -10 * t) * sinf((t - s) * M_PI_X_2 / _period) * 0.5f + 1;
313+
newT = powf(2, -10 * t) * sinf((t - s) * M_PI_X_2 / _period) * 0.5 + 1;
314314
}
315315
[_inner update:newT];
316316
}
@@ -330,19 +330,19 @@ @implementation CCActionEaseBounce
330330
-(CCTime) bounceTime:(CCTime) t
331331
{
332332
if (t < 1 / 2.75) {
333-
return 7.5625f * t * t;
333+
return 7.5625 * t * t;
334334
}
335335
else if (t < 2 / 2.75) {
336-
t -= 1.5f / 2.75f;
337-
return 7.5625f * t * t + 0.75f;
336+
t -= 1.5 / 2.75;
337+
return 7.5625 * t * t + 0.75;
338338
}
339339
else if (t < 2.5 / 2.75) {
340-
t -= 2.25f / 2.75f;
341-
return 7.5625f * t * t + 0.9375f;
340+
t -= 2.25 / 2.75;
341+
return 7.5625 * t * t + 0.9375;
342342
}
343343

344-
t -= 2.625f / 2.75f;
345-
return 7.5625f * t * t + 0.984375f;
344+
t -= 2.625 / 2.75;
345+
return 7.5625 * t * t + 0.984375;
346346
}
347347
@end
348348

@@ -397,9 +397,9 @@ -(void) update: (CCTime) t
397397
newT = t;
398398
else if (t < 0.5) {
399399
t = t * 2;
400-
newT = (1 - [self bounceTime:1-t] ) * 0.5f;
400+
newT = (1 - [self bounceTime:1-t] ) * 0.5;
401401
} else
402-
newT = [self bounceTime:t * 2 - 1] * 0.5f + 0.5f;
402+
newT = [self bounceTime:t * 2 - 1] * 0.5 + 0.5;
403403

404404
[_inner update:newT];
405405
}
@@ -413,7 +413,7 @@ @implementation CCActionEaseBackIn
413413

414414
-(void) update: (CCTime) t
415415
{
416-
CCTime overshoot = 1.70158f;
416+
CCTime overshoot = 1.70158;
417417
[_inner update: t * t * ((overshoot + 1) * t - overshoot)];
418418
}
419419

@@ -427,7 +427,7 @@ - (CCActionInterval*) reverse
427427
@implementation CCActionEaseBackOut
428428
-(void) update: (CCTime) t
429429
{
430-
CCTime overshoot = 1.70158f;
430+
CCTime overshoot = 1.70158;
431431

432432
t = t - 1;
433433
[_inner update: t * t * ((overshoot + 1) * t + overshoot) + 1];
@@ -444,7 +444,7 @@ @implementation CCActionEaseBackInOut
444444

445445
-(void) update: (CCTime) t
446446
{
447-
CCTime overshoot = 1.70158f * 1.525f;
447+
CCTime overshoot = 1.70158 * 1.525;
448448

449449
t = t * 2;
450450
if (t < 1)

cocos2d/CCActionInterval.m

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ -(void) step: (CCTime) dt
101101
-(void) startWithTarget:(id)aTarget
102102
{
103103
[super startWithTarget:aTarget];
104-
_elapsed = 0.0f;
104+
_elapsed = 0.0;
105105
_firstTick = YES;
106106
}
107107

@@ -215,7 +215,7 @@ -(void) update: (CCTime) t
215215
{
216216

217217
int found = 0;
218-
CCTime new_t = 0.0f;
218+
CCTime new_t = 0.0;
219219

220220
if( t < _split ) {
221221
// action[0]
@@ -239,13 +239,13 @@ -(void) update: (CCTime) t
239239
if( _last == -1 ) {
240240
// action[0] was skipped, execute it.
241241
[_actions[0] startWithTarget:_target];
242-
[_actions[0] update:1.0f];
242+
[_actions[0] update:1.0];
243243
[_actions[0] stop];
244244
}
245245
else if( _last == 0 )
246246
{
247247
// switching to action 1. stop action 0.
248-
[_actions[0] update: 1.0f];
248+
[_actions[0] update: 1.0];
249249
[_actions[0] stop];
250250
}
251251
}
@@ -337,7 +337,7 @@ -(void) update:(CCTime) dt
337337
while (dt > _nextDt && _total < _times)
338338
{
339339

340-
[_innerAction update:1.0f];
340+
[_innerAction update:1.0];
341341
_total++;
342342

343343
[_innerAction stop];
@@ -346,7 +346,7 @@ -(void) update:(CCTime) dt
346346
}
347347

348348
// fix for issue #1288, incorrect end value of repeat
349-
if(dt >= 1.0f && _total < _times)
349+
if(dt >= 1.0 && _total < _times)
350350
{
351351
_total++;
352352
}
@@ -368,7 +368,7 @@ -(void) update:(CCTime) dt
368368
}
369369
else
370370
{
371-
[_innerAction update:fmodf(dt * _times,1.0f)];
371+
[_innerAction update:fmodf(dt * _times,1.0)];
372372
}
373373
}
374374

@@ -606,9 +606,9 @@ -(void) startWithTarget:(CCNode *)aTarget
606606
//Calculate X
607607
_startAngleX = [_target rotationalSkewX];
608608
if (_startAngleX > 0)
609-
_startAngleX = fmodf(_startAngleX, 360.0f);
609+
_startAngleX = fmodf(_startAngleX, 360.0);
610610
else
611-
_startAngleX = fmodf(_startAngleX, -360.0f);
611+
_startAngleX = fmodf(_startAngleX, -360.0);
612612

613613
_diffAngleX = _dstAngleX - _startAngleX;
614614
if (_diffAngleX > 180)
@@ -620,9 +620,9 @@ -(void) startWithTarget:(CCNode *)aTarget
620620
//Calculate Y: It's duplicated from calculating X since the rotation wrap should be the same
621621
_startAngleY = [_target rotationalSkewY];
622622
if (_startAngleY > 0)
623-
_startAngleY = fmodf(_startAngleY, 360.0f);
623+
_startAngleY = fmodf(_startAngleY, 360.0);
624624
else
625-
_startAngleY = fmodf(_startAngleY, -360.0f);
625+
_startAngleY = fmodf(_startAngleY, -360.0);
626626

627627
_diffAngleY = _dstAngleY - _startAngleY;
628628
if (_diffAngleY > 180)
@@ -836,9 +836,9 @@ -(void) startWithTarget:(CCNode *)aTarget
836836
_startSkewX = [_target skewX];
837837

838838
if (_startSkewX > 0)
839-
_startSkewX = fmodf(_startSkewX, 180.0f);
839+
_startSkewX = fmodf(_startSkewX, 180.0);
840840
else
841-
_startSkewX = fmodf(_startSkewX, -180.0f);
841+
_startSkewX = fmodf(_startSkewX, -180.0);
842842

843843
_deltaX = _endSkewX - _startSkewX;
844844

@@ -852,9 +852,9 @@ -(void) startWithTarget:(CCNode *)aTarget
852852
_startSkewY = [_target skewY];
853853

854854
if (_startSkewY > 0)
855-
_startSkewY = fmodf(_startSkewY, 360.0f);
855+
_startSkewY = fmodf(_startSkewY, 360.0);
856856
else
857-
_startSkewY = fmodf(_startSkewY, -360.0f);
857+
_startSkewY = fmodf(_startSkewY, -360.0);
858858

859859
_deltaY = _endSkewY - _startSkewY;
860860

@@ -946,7 +946,7 @@ -(void) update: (CCTime) t
946946
// y += _delta.y * dt;
947947

948948
// // parabolic jump (since v0.8.2)
949-
CGFloat frac = fmodf( t * _jumps, 1.0f );
949+
CGFloat frac = fmodf( t * _jumps, 1.0 );
950950
CGFloat y = _height * 4 * frac * (1 - frac);
951951
y += _delta.y * t;
952952

@@ -1218,7 +1218,7 @@ -(void) startWithTarget:(id)target
12181218
-(void) update: (CCTime) t
12191219
{
12201220
if( ! [self isDone] ) {
1221-
CCTime slice = 1.0f / _times;
1221+
CCTime slice = 1.0 / _times;
12221222
CCTime m = fmodf(t, slice);
12231223
[_target setVisible: (m > slice/2) ? YES : NO];
12241224
}
@@ -1545,7 +1545,7 @@ -(void) update: (CCTime) t
15451545
{
15461546

15471547
// if t==1, ignore. Animation should finish with t==1
1548-
if( t < 1.0f ) {
1548+
if( t < 1.0 ) {
15491549
t *= _animation.loops;
15501550

15511551
// new loop? If so, reset frame counter
@@ -1556,7 +1556,7 @@ -(void) update: (CCTime) t
15561556
}
15571557

15581558
// new t for animations
1559-
t = fmodf(t, 1.0f);
1559+
t = fmodf(t, 1.0);
15601560
}
15611561

15621562
NSArray *frames = [_animation frames];

0 commit comments

Comments
 (0)