Unify float literals to use f suffix and avoid double promotions
I might have missed some.
This commit is contained in:
parent
d1ee507ec4
commit
384249c31a
|
@ -238,6 +238,6 @@ inline ALenum chooseALFormat(int sampleSize, int channelCount)
|
||||||
|
|
||||||
#define AUDIO_SLEEP 10
|
#define AUDIO_SLEEP 10
|
||||||
#define STREAM_BUF_SIZE 32768
|
#define STREAM_BUF_SIZE 32768
|
||||||
#define GLOBAL_VOLUME 0.8
|
#define GLOBAL_VOLUME 0.8f
|
||||||
|
|
||||||
#endif // ALUTIL_H
|
#endif // ALUTIL_H
|
||||||
|
|
|
@ -42,12 +42,12 @@ ALStream::ALStream(LoopMode loopMode,
|
||||||
source(0),
|
source(0),
|
||||||
thread(0),
|
thread(0),
|
||||||
preemptPause(false),
|
preemptPause(false),
|
||||||
pitch(1.0)
|
pitch(1.0f)
|
||||||
{
|
{
|
||||||
alSrc = AL::Source::gen();
|
alSrc = AL::Source::gen();
|
||||||
|
|
||||||
AL::Source::setVolume(alSrc, 1.0);
|
AL::Source::setVolume(alSrc, 1.0f);
|
||||||
AL::Source::setPitch(alSrc, 1.0);
|
AL::Source::setPitch(alSrc, 1.0f);
|
||||||
AL::Source::detachBuffer(alSrc);
|
AL::Source::detachBuffer(alSrc);
|
||||||
|
|
||||||
for (int i = 0; i < STREAM_BUFS; ++i)
|
for (int i = 0; i < STREAM_BUFS; ++i)
|
||||||
|
@ -172,7 +172,7 @@ void ALStream::setPitch(float value)
|
||||||
/* If the source supports setting pitch natively,
|
/* If the source supports setting pitch natively,
|
||||||
* we don't have to do it via OpenAL */
|
* we don't have to do it via OpenAL */
|
||||||
if (source && source->setPitch(value))
|
if (source && source->setPitch(value))
|
||||||
AL::Source::setPitch(alSrc, 1.0);
|
AL::Source::setPitch(alSrc, 1.0f);
|
||||||
else
|
else
|
||||||
AL::Source::setPitch(alSrc, value);
|
AL::Source::setPitch(alSrc, value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ struct AudioPrivate
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* BGM is stopped. -> MeNotPlaying */
|
/* BGM is stopped. -> MeNotPlaying */
|
||||||
bgm.setVolume(AudioStream::External, 1.0);
|
bgm.setVolume(AudioStream::External, 1.0f);
|
||||||
|
|
||||||
if (!bgm.noResumeStop)
|
if (!bgm.noResumeStop)
|
||||||
bgm.stream.play();
|
bgm.stream.play();
|
||||||
|
@ -193,7 +193,7 @@ struct AudioPrivate
|
||||||
if (bgm.stream.queryState() == ALStream::Stopped)
|
if (bgm.stream.queryState() == ALStream::Stopped)
|
||||||
{
|
{
|
||||||
/* BGM stopped midway fade in. -> MeNotPlaying */
|
/* BGM stopped midway fade in. -> MeNotPlaying */
|
||||||
bgm.setVolume(AudioStream::External, 1.0);
|
bgm.setVolume(AudioStream::External, 1.0f);
|
||||||
meWatch.state = MeNotPlaying;
|
meWatch.state = MeNotPlaying;
|
||||||
bgm.unlockStream();
|
bgm.unlockStream();
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ struct AudioPrivate
|
||||||
if (vol >= 1)
|
if (vol >= 1)
|
||||||
{
|
{
|
||||||
/* BGM fully faded in. -> MeNotPlaying */
|
/* BGM fully faded in. -> MeNotPlaying */
|
||||||
vol = 1.0;
|
vol = 1.0f;
|
||||||
meWatch.state = MeNotPlaying;
|
meWatch.state = MeNotPlaying;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,11 @@ AudioStream::AudioStream(ALStream::LoopMode loopMode,
|
||||||
noResumeStop(false),
|
noResumeStop(false),
|
||||||
stream(loopMode, threadId)
|
stream(loopMode, threadId)
|
||||||
{
|
{
|
||||||
current.volume = 1.0;
|
current.volume = 1.0f;
|
||||||
current.pitch = 1.0;
|
current.pitch = 1.0f;
|
||||||
|
|
||||||
for (size_t i = 0; i < VolumeTypeCount; ++i)
|
for (size_t i = 0; i < VolumeTypeCount; ++i)
|
||||||
volumes[i] = 1.0;
|
volumes[i] = 1.0f;
|
||||||
|
|
||||||
fade.thread = 0;
|
fade.thread = 0;
|
||||||
fade.threadName = std::string("audio_fadeout (") + threadId + ")";
|
fade.threadName = std::string("audio_fadeout (") + threadId + ")";
|
||||||
|
@ -82,8 +82,8 @@ void AudioStream::play(const std::string &filename,
|
||||||
|
|
||||||
lockStream();
|
lockStream();
|
||||||
|
|
||||||
float _volume = clamp<int>(volume, 0, 100) / 100.f;
|
float _volume = clamp<int>(volume, 0, 100) / 100.0f;
|
||||||
float _pitch = clamp<int>(pitch, 50, 150) / 100.f;
|
float _pitch = clamp<int>(pitch, 50, 150) / 100.0f;
|
||||||
|
|
||||||
ALStream::State sState = stream.queryState();
|
ALStream::State sState = stream.queryState();
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ void AudioStream::fadeOut(int duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
fade.active.set();
|
fade.active.set();
|
||||||
fade.msStep = (1.0) / duration;
|
fade.msStep = 1.0f / duration;
|
||||||
fade.reqFini.clear();
|
fade.reqFini.clear();
|
||||||
fade.reqTerm.clear();
|
fade.reqTerm.clear();
|
||||||
fade.startTicks = SDL_GetTicks();
|
fade.startTicks = SDL_GetTicks();
|
||||||
|
@ -302,7 +302,7 @@ void AudioStream::fadeOutThread()
|
||||||
lockStream();
|
lockStream();
|
||||||
|
|
||||||
uint32_t curDur = SDL_GetTicks() - fade.startTicks;
|
uint32_t curDur = SDL_GetTicks() - fade.startTicks;
|
||||||
float resVol = 1.0 - (curDur*fade.msStep);
|
float resVol = 1.0f - (curDur*fade.msStep);
|
||||||
|
|
||||||
ALStream::State state = stream.queryState();
|
ALStream::State state = stream.queryState();
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ void AudioStream::fadeOutThread()
|
||||||
if (state != ALStream::Paused)
|
if (state != ALStream::Paused)
|
||||||
stream.stop();
|
stream.stop();
|
||||||
|
|
||||||
setVolume(FadeOut, 1.0);
|
setVolume(FadeOut, 1.0f);
|
||||||
unlockStream();
|
unlockStream();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -340,15 +340,15 @@ void AudioStream::fadeInThread()
|
||||||
|
|
||||||
/* Fade in duration is always 1 second */
|
/* Fade in duration is always 1 second */
|
||||||
uint32_t cur = SDL_GetTicks() - fadeIn.startTicks;
|
uint32_t cur = SDL_GetTicks() - fadeIn.startTicks;
|
||||||
float prog = cur / 1000.0;
|
float prog = cur / 1000.0f;
|
||||||
|
|
||||||
ALStream::State state = stream.queryState();
|
ALStream::State state = stream.queryState();
|
||||||
|
|
||||||
if (state != ALStream::Playing
|
if (state != ALStream::Playing
|
||||||
|| prog >= 1.0
|
|| prog >= 1.0f
|
||||||
|| fadeIn.rqFini)
|
|| fadeIn.rqFini)
|
||||||
{
|
{
|
||||||
setVolume(FadeIn, 1.0);
|
setVolume(FadeIn, 1.0f);
|
||||||
unlockStream();
|
unlockStream();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -890,9 +890,9 @@ static void applyShadow(SDL_Surface *&in, const SDL_PixelFormat &fm, const SDL_C
|
||||||
SDL_Surface *out = SDL_CreateRGBSurface
|
SDL_Surface *out = SDL_CreateRGBSurface
|
||||||
(0, in->w+1, in->h+1, fm.BitsPerPixel, fm.Rmask, fm.Gmask, fm.Bmask, fm.Amask);
|
(0, in->w+1, in->h+1, fm.BitsPerPixel, fm.Rmask, fm.Gmask, fm.Bmask, fm.Amask);
|
||||||
|
|
||||||
float fr = c.r / 255.0;
|
float fr = c.r / 255.0f;
|
||||||
float fg = c.g / 255.0;
|
float fg = c.g / 255.0f;
|
||||||
float fb = c.b / 255.0;
|
float fb = c.b / 255.0f;
|
||||||
|
|
||||||
/* We allocate an output surface one pixel wider and higher than the input,
|
/* We allocate an output surface one pixel wider and higher than the input,
|
||||||
* (implicitly) blit a copy of the input with RGB values set to black into
|
* (implicitly) blit a copy of the input with RGB values set to black into
|
||||||
|
@ -946,11 +946,11 @@ static void applyShadow(SDL_Surface *&in, const SDL_PixelFormat &fm, const SDL_C
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
float fSrcA = srcA / 255.0;
|
float fSrcA = srcA / 255.0f;
|
||||||
float fShdA = shdA / 255.0;
|
float fShdA = shdA / 255.0f;
|
||||||
|
|
||||||
/* Because opacity == 1, co1 == fSrcA */
|
/* Because opacity == 1, co1 == fSrcA */
|
||||||
float co2 = fShdA * (1.0 - fSrcA);
|
float co2 = fShdA * (1.0f - fSrcA);
|
||||||
/* Result alpha */
|
/* Result alpha */
|
||||||
float fa = fSrcA + co2;
|
float fa = fSrcA + co2;
|
||||||
/* Temp value to simplify arithmetic below */
|
/* Temp value to simplify arithmetic below */
|
||||||
|
@ -959,10 +959,10 @@ static void applyShadow(SDL_Surface *&in, const SDL_PixelFormat &fm, const SDL_C
|
||||||
/* Result colors */
|
/* Result colors */
|
||||||
uint8_t r, g, b, a;
|
uint8_t r, g, b, a;
|
||||||
|
|
||||||
r = clamp<float>(fr * co3, 0, 1) * 255;
|
r = clamp<float>(fr * co3, 0, 1) * 255.0f;
|
||||||
g = clamp<float>(fg * co3, 0, 1) * 255;
|
g = clamp<float>(fg * co3, 0, 1) * 255.0f;
|
||||||
b = clamp<float>(fb * co3, 0, 1) * 255;
|
b = clamp<float>(fb * co3, 0, 1) * 255.0f;
|
||||||
a = clamp<float>(fa, 0, 1) * 255;
|
a = clamp<float>(fa, 0, 1) * 255.0f;
|
||||||
|
|
||||||
*outP = SDL_MapRGBA(&fm, r, g, b, a);
|
*outP = SDL_MapRGBA(&fm, r, g, b, a);
|
||||||
}
|
}
|
||||||
|
@ -1067,11 +1067,11 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
||||||
Vec2i gpTexSize;
|
Vec2i gpTexSize;
|
||||||
shState->ensureTexSize(txtSurf->w, txtSurf->h, gpTexSize);
|
shState->ensureTexSize(txtSurf->w, txtSurf->h, gpTexSize);
|
||||||
|
|
||||||
bool fastBlit = !p->touchesTaintedArea(posRect) && txtAlpha == 1.0;
|
bool fastBlit = !p->touchesTaintedArea(posRect) && txtAlpha == 1.0f;
|
||||||
|
|
||||||
if (fastBlit)
|
if (fastBlit)
|
||||||
{
|
{
|
||||||
if (squeeze == 1.0 && !shState->config().subImageFix)
|
if (squeeze == 1.0f && !shState->config().subImageFix)
|
||||||
{
|
{
|
||||||
/* Even faster: upload directly to bitmap texture.
|
/* Even faster: upload directly to bitmap texture.
|
||||||
* We have to make sure the posRect lies within the texture
|
* We have to make sure the posRect lies within the texture
|
||||||
|
|
|
@ -63,7 +63,7 @@ struct Vec4
|
||||||
|
|
||||||
bool xyzNotNull() const
|
bool xyzNotNull() const
|
||||||
{
|
{
|
||||||
return (x != 0.0 || y != 0.0 || z != 0.0);
|
return (x != 0.0f || y != 0.0f || z != 0.0f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -269,13 +269,13 @@ struct NormValue
|
||||||
|
|
||||||
NormValue(int unNorm)
|
NormValue(int unNorm)
|
||||||
: unNorm(unNorm),
|
: unNorm(unNorm),
|
||||||
norm(unNorm / 255.0)
|
norm(unNorm / 255.0f)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void operator =(int value)
|
void operator =(int value)
|
||||||
{
|
{
|
||||||
unNorm = clamp(value, 0, 255);
|
unNorm = clamp(value, 0, 255);
|
||||||
norm = unNorm / 255.0;
|
norm = unNorm / 255.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator ==(int value) const
|
bool operator ==(int value) const
|
||||||
|
|
|
@ -174,7 +174,7 @@ _TTF_Font *SharedFontState::getFont(std::string family,
|
||||||
// FIXME 0.9 is guesswork at this point
|
// FIXME 0.9 is guesswork at this point
|
||||||
// float gamma = (96.0/45.0)*(5.0/14.0)*(size-5);
|
// float gamma = (96.0/45.0)*(5.0/14.0)*(size-5);
|
||||||
// font = TTF_OpenFontRW(ops, 1, gamma /** .90*/);
|
// font = TTF_OpenFontRW(ops, 1, gamma /** .90*/);
|
||||||
font = TTF_OpenFontRW(ops, 1, size* .90);
|
font = TTF_OpenFontRW(ops, 1, size* 0.90f);
|
||||||
|
|
||||||
if (!font)
|
if (!font)
|
||||||
throw Exception(Exception::SDLError, "%s", SDL_GetError());
|
throw Exception(Exception::SDLError, "%s", SDL_GetError());
|
||||||
|
|
|
@ -281,9 +281,9 @@ public:
|
||||||
|
|
||||||
void setBrightness(float norm)
|
void setBrightness(float norm)
|
||||||
{
|
{
|
||||||
brightnessQuad.setColor(Vec4(0, 0, 0, 1.0 - norm));
|
brightnessQuad.setColor(Vec4(0, 0, 0, 1.0f - norm));
|
||||||
|
|
||||||
brightEffect = norm < 1.0;
|
brightEffect = norm < 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateReso(int width, int height)
|
void updateReso(int width, int height)
|
||||||
|
@ -736,7 +736,7 @@ void Graphics::transition(int duration,
|
||||||
shader.setFrozenScene(p->frozenScene.tex);
|
shader.setFrozenScene(p->frozenScene.tex);
|
||||||
shader.setCurrentScene(p->currentScene.tex);
|
shader.setCurrentScene(p->currentScene.tex);
|
||||||
shader.setTransMap(transMap->getGLTypes().tex);
|
shader.setTransMap(transMap->getGLTypes().tex);
|
||||||
shader.setVague(vague / 256.0);
|
shader.setVague(vague / 256.0f);
|
||||||
shader.setTexSize(p->scRes);
|
shader.setTexSize(p->scRes);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -774,7 +774,7 @@ void Graphics::transition(int duration,
|
||||||
|
|
||||||
p->checkSyncLock();
|
p->checkSyncLock();
|
||||||
|
|
||||||
const float prog = i * (1.0 / duration);
|
const float prog = i * (1.0f / duration);
|
||||||
|
|
||||||
if (transMap)
|
if (transMap)
|
||||||
{
|
{
|
||||||
|
@ -852,7 +852,7 @@ void Graphics::fadeout(int duration)
|
||||||
FBO::unbind();
|
FBO::unbind();
|
||||||
|
|
||||||
float curr = p->brightness;
|
float curr = p->brightness;
|
||||||
float diff = 255.0 - curr;
|
float diff = 255.0f - curr;
|
||||||
|
|
||||||
for (int i = duration-1; i > -1; --i)
|
for (int i = duration-1; i > -1; --i)
|
||||||
{
|
{
|
||||||
|
@ -882,7 +882,7 @@ void Graphics::fadein(int duration)
|
||||||
FBO::unbind();
|
FBO::unbind();
|
||||||
|
|
||||||
float curr = p->brightness;
|
float curr = p->brightness;
|
||||||
float diff = 255.0 - curr;
|
float diff = 255.0f - curr;
|
||||||
|
|
||||||
for (int i = 1; i <= duration; ++i)
|
for (int i = 1; i <= duration; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -320,7 +320,7 @@ readEvent(MidiReadHandler *handler, MemChunk &chunk,
|
||||||
| (data[2] << 0x00);
|
| (data[2] << 0x00);
|
||||||
|
|
||||||
e.type = Tempo;
|
e.type = Tempo;
|
||||||
e.e.tempo.bpm = 60000000.0 / mpqn;
|
e.e.tempo.bpm = 60000000 / mpqn;
|
||||||
}
|
}
|
||||||
else if (metaType == 0x2F)
|
else if (metaType == 0x2F)
|
||||||
{
|
{
|
||||||
|
@ -699,7 +699,7 @@ struct MidiSource : ALDataSource, MidiReadHandler
|
||||||
|
|
||||||
void updatePlaybackSpeed(uint32_t bpm)
|
void updatePlaybackSpeed(uint32_t bpm)
|
||||||
{
|
{
|
||||||
float deltaLength = 60.0 / (dpb * bpm);
|
float deltaLength = 60.0f / (dpb * bpm);
|
||||||
playbackSpeed = TICK_FRAMES / (deltaLength * freq);
|
playbackSpeed = TICK_FRAMES / (deltaLength * freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -910,7 +910,7 @@ struct MidiSource : ALDataSource, MidiReadHandler
|
||||||
bool setPitch(float value)
|
bool setPitch(float value)
|
||||||
{
|
{
|
||||||
// not completely correct, but close
|
// not completely correct, but close
|
||||||
pitchShift = round((value > 1.0 ? 14 : 24) * (value - 1.0));
|
pitchShift = round((value > 1.0f ? 14 : 24) * (value - 1.0f));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,8 +105,8 @@ struct PlanePrivate
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Scaled (zoomed) bitmap dimensions */
|
/* Scaled (zoomed) bitmap dimensions */
|
||||||
double sw = bitmap->width() * zoomX;
|
float sw = bitmap->width() * zoomX;
|
||||||
double sh = bitmap->height() * zoomY;
|
float sh = bitmap->height() * zoomY;
|
||||||
|
|
||||||
/* Plane offset wrapped by scaled bitmap dims */
|
/* Plane offset wrapped by scaled bitmap dims */
|
||||||
float wox = fwrap(ox, sw);
|
float wox = fwrap(ox, sw);
|
||||||
|
|
|
@ -764,13 +764,13 @@ void Widget::click(int x, int y, uint8_t button)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ratio of cell area to total widget width */
|
/* Ratio of cell area to total widget width */
|
||||||
#define BW_CELL_R 0.75
|
#define BW_CELL_R 0.75f
|
||||||
|
|
||||||
void BindingWidget::drawHandler(SDL_Surface *surf)
|
void BindingWidget::drawHandler(SDL_Surface *surf)
|
||||||
{
|
{
|
||||||
const int cellW = (rect.w*BW_CELL_R) / 2;
|
const int cellW = (rect.w*BW_CELL_R) / 2;
|
||||||
const int cellH = rect.h / 2;
|
const int cellH = rect.h / 2;
|
||||||
const int cellOffX = (1.0-BW_CELL_R) * rect.w;
|
const int cellOffX = (1.0f-BW_CELL_R) * rect.w;
|
||||||
|
|
||||||
const int cellOff[] =
|
const int cellOff[] =
|
||||||
{
|
{
|
||||||
|
@ -860,7 +860,7 @@ int BindingWidget::cellIndex(int x, int y) const
|
||||||
{
|
{
|
||||||
const int cellW = (rect.w*BW_CELL_R) / 2;
|
const int cellW = (rect.w*BW_CELL_R) / 2;
|
||||||
const int cellH = rect.h / 2;
|
const int cellH = rect.h / 2;
|
||||||
const int cellOff = (1.0-BW_CELL_R) * rect.w;
|
const int cellOff = (1.0f-BW_CELL_R) * rect.w;
|
||||||
|
|
||||||
if (x < cellOff)
|
if (x < cellOff)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -80,7 +80,7 @@ struct SharedMidiState
|
||||||
return;
|
return;
|
||||||
|
|
||||||
flSettings = fluid.new_settings();
|
flSettings = fluid.new_settings();
|
||||||
fluid.settings_setnum(flSettings, "synth.gain", 1.0);
|
fluid.settings_setnum(flSettings, "synth.gain", 1.0f);
|
||||||
fluid.settings_setnum(flSettings, "synth.sample-rate", SYNTH_SAMPLERATE);
|
fluid.settings_setnum(flSettings, "synth.sample-rate", SYNTH_SAMPLERATE);
|
||||||
fluid.settings_setstr(flSettings, "synth.chorus.active", conf.midi.chorus ? "yes" : "no");
|
fluid.settings_setstr(flSettings, "synth.chorus.active", conf.midi.chorus ? "yes" : "no");
|
||||||
fluid.settings_setstr(flSettings, "synth.reverb.active", conf.midi.reverb ? "yes" : "no");
|
fluid.settings_setstr(flSettings, "synth.reverb.active", conf.midi.reverb ? "yes" : "no");
|
||||||
|
|
|
@ -123,8 +123,8 @@ void SoundEmitter::play(const std::string &filename,
|
||||||
int volume,
|
int volume,
|
||||||
int pitch)
|
int pitch)
|
||||||
{
|
{
|
||||||
float _volume = clamp<int>(volume, 0, 100) / 100.f;
|
float _volume = clamp<int>(volume, 0, 100) / 100.0f;
|
||||||
float _pitch = clamp<int>(pitch, 50, 150) / 100.f;
|
float _pitch = clamp<int>(pitch, 50, 150) / 100.0f;
|
||||||
|
|
||||||
SoundBuffer *buffer = allocateBuffer(filename);
|
SoundBuffer *buffer = allocateBuffer(filename);
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ struct SpritePrivate
|
||||||
wave.amp = 0;
|
wave.amp = 0;
|
||||||
wave.length = 180;
|
wave.length = 180;
|
||||||
wave.speed = 360;
|
wave.speed = 360;
|
||||||
wave.phase = 0.0;
|
wave.phase = 0.0f;
|
||||||
wave.dirty = false;
|
wave.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ struct SpritePrivate
|
||||||
(srcRect->y + srcRect->height) +
|
(srcRect->y + srcRect->height) +
|
||||||
bitmap->height();
|
bitmap->height();
|
||||||
|
|
||||||
efBushDepth = 1.0 - texBushDepth / bitmap->height();
|
efBushDepth = 1.0f - texBushDepth / bitmap->height();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSrcRectChange()
|
void onSrcRectChange()
|
||||||
|
@ -194,7 +194,7 @@ struct SpritePrivate
|
||||||
void emitWaveChunk(SVertex *&vert, float phase, int width,
|
void emitWaveChunk(SVertex *&vert, float phase, int width,
|
||||||
float zoomY, int chunkY, int chunkLength)
|
float zoomY, int chunkY, int chunkLength)
|
||||||
{
|
{
|
||||||
float wavePos = phase + (chunkY / (float) wave.length) * M_PI * 2;
|
float wavePos = phase + (chunkY / (float) wave.length) * (float) (M_PI * 2);
|
||||||
float chunkX = sin(wavePos) * wave.amp;
|
float chunkX = sin(wavePos) * wave.amp;
|
||||||
|
|
||||||
FloatRect tex(0, chunkY / zoomY, width, chunkLength / zoomY);
|
FloatRect tex(0, chunkY / zoomY, width, chunkLength / zoomY);
|
||||||
|
@ -261,7 +261,7 @@ struct SpritePrivate
|
||||||
wave.qArray.resize(!!firstLength + chunks + !!lastLength);
|
wave.qArray.resize(!!firstLength + chunks + !!lastLength);
|
||||||
SVertex *vert = &wave.qArray.vertices[0];
|
SVertex *vert = &wave.qArray.vertices[0];
|
||||||
|
|
||||||
float phase = (wave.phase * M_PI) / 180.f;
|
float phase = (wave.phase * (float) M_PI) / 180.0f;
|
||||||
|
|
||||||
if (firstLength > 0)
|
if (firstLength > 0)
|
||||||
emitWaveChunk(vert, phase, width, zoomY, 0, firstLength);
|
emitWaveChunk(vert, phase, width, zoomY, 0, firstLength);
|
||||||
|
|
|
@ -51,14 +51,14 @@ extern const int autotileVXRectsBN;
|
||||||
/* Waterfall (C) autotile patterns */
|
/* Waterfall (C) autotile patterns */
|
||||||
static const StaticRect autotileVXRectsC[] =
|
static const StaticRect autotileVXRectsC[] =
|
||||||
{
|
{
|
||||||
{ 32.5, 0.5, 15, 31 },
|
{ 32.5f, 0.5f, 15.0f, 31.0f },
|
||||||
{ 16.5, 0.5, 15, 31 },
|
{ 16.5f, 0.5f, 15.0f, 31.0f },
|
||||||
{ 0.0, 0.5, 15, 31 },
|
{ 0.0f, 0.5f, 15.0f, 31.0f },
|
||||||
{ 16.5, 0.5, 15, 31 },
|
{ 16.5f, 0.5f, 15.0f, 31.0f },
|
||||||
{ 32.5, 0.5, 15, 31 },
|
{ 32.5f, 0.5f, 15.0f, 31.0f },
|
||||||
{ 48.5, 0.5, 15, 31 },
|
{ 48.5f, 0.5f, 15.0f, 31.0f },
|
||||||
{ 0.0, 0.5, 15, 31 },
|
{ 0.0f, 0.5f, 15.0f, 31.0f },
|
||||||
{ 48.5, 0.5, 15, 31 }
|
{ 48.5f, 0.5f, 15.0f, 31.0f }
|
||||||
};
|
};
|
||||||
|
|
||||||
static elementsN(autotileVXRectsC);
|
static elementsN(autotileVXRectsC);
|
||||||
|
|
|
@ -698,7 +698,7 @@ struct TilemapPrivate
|
||||||
int tileY = tsInd / 8;
|
int tileY = tsInd / 8;
|
||||||
|
|
||||||
Vec2i texPos = TileAtlas::tileToAtlasCoor(tileX, tileY, atlas.efTilesetH, atlas.size.y);
|
Vec2i texPos = TileAtlas::tileToAtlasCoor(tileX, tileY, atlas.efTilesetH, atlas.size.y);
|
||||||
FloatRect texRect((float) texPos.x+.5, (float) texPos.y+.5, 31, 31);
|
FloatRect texRect((float) texPos.x+0.5f, (float) texPos.y+0.5f, 31, 31);
|
||||||
FloatRect posRect(x*32, y*32, 32, 32);
|
FloatRect posRect(x*32, y*32, 32, 32);
|
||||||
|
|
||||||
SVertex v[4];
|
SVertex v[4];
|
||||||
|
|
|
@ -130,7 +130,7 @@ private:
|
||||||
if (rotation < 0)
|
if (rotation < 0)
|
||||||
rotation += 360;
|
rotation += 360;
|
||||||
|
|
||||||
float angle = rotation * 3.141592654f / 180.f;
|
float angle = rotation * 3.141592654f / 180.0f;
|
||||||
float cosine = (float) cos(angle);
|
float cosine = (float) cos(angle);
|
||||||
float sine = (float) sin(angle);
|
float sine = (float) sin(angle);
|
||||||
float sxc = scale.x * cosine;
|
float sxc = scale.x * cosine;
|
||||||
|
|
|
@ -642,7 +642,7 @@ struct WindowPrivate
|
||||||
|
|
||||||
if (active && cursorVert.vert)
|
if (active && cursorVert.vert)
|
||||||
{
|
{
|
||||||
float alpha = cursorAniAlpha[cursorAniAlphaIdx] / 255.0;
|
float alpha = cursorAniAlpha[cursorAniAlphaIdx] / 255.0f;
|
||||||
|
|
||||||
cursorVert.setAlpha(alpha);
|
cursorVert.setAlpha(alpha);
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ struct WindowPrivate
|
||||||
|
|
||||||
if (pause && pauseAniVert.vert)
|
if (pause && pauseAniVert.vert)
|
||||||
{
|
{
|
||||||
float alpha = pauseAniAlpha[pauseAniAlphaIdx] / 255.0;
|
float alpha = pauseAniAlpha[pauseAniAlphaIdx] / 255.0f;
|
||||||
FloatRect frameRect = pauseAniSrc[pauseAniQuad[pauseAniQuadIdx]];
|
FloatRect frameRect = pauseAniSrc[pauseAniQuad[pauseAniQuadIdx]];
|
||||||
|
|
||||||
pauseAniVert.setAlpha(alpha);
|
pauseAniVert.setAlpha(alpha);
|
||||||
|
|
|
@ -482,7 +482,7 @@ struct WindowVXPrivate
|
||||||
void updateBaseQuad()
|
void updateBaseQuad()
|
||||||
{
|
{
|
||||||
const FloatRect tex(0, 0, geo.w, geo.h);
|
const FloatRect tex(0, 0, geo.w, geo.h);
|
||||||
const FloatRect pos(0, (geo.h / 2.0) * (1 - openness.norm),
|
const FloatRect pos(0, (geo.h / 2.0f) * (1.0f - openness.norm),
|
||||||
geo.w, geo.h * openness.norm);
|
geo.w, geo.h * openness.norm);
|
||||||
|
|
||||||
base.quad.setTexPosRect(tex, pos);
|
base.quad.setTexPosRect(tex, pos);
|
||||||
|
@ -633,7 +633,7 @@ struct WindowVXPrivate
|
||||||
Quad::setTexRect(pauseVert, pauseSrc[pauseQuad[pauseQuadIdx]]);
|
Quad::setTexRect(pauseVert, pauseSrc[pauseQuad[pauseQuadIdx]]);
|
||||||
|
|
||||||
/* Set opacity */
|
/* Set opacity */
|
||||||
Quad::setColor(pauseVert, Vec4(1, 1, 1, pauseAlpha[pauseAlphaIdx] / 255.0));
|
Quad::setColor(pauseVert, Vec4(1, 1, 1, pauseAlpha[pauseAlphaIdx] / 255.0f));
|
||||||
|
|
||||||
ctrlVertArrayDirty = true;
|
ctrlVertArrayDirty = true;
|
||||||
}
|
}
|
||||||
|
@ -643,7 +643,7 @@ struct WindowVXPrivate
|
||||||
if (cursorVert.count() == 0)
|
if (cursorVert.count() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Vec4 color(1, 1, 1, cursorAlpha[cursorAlphaIdx] / 255.0);
|
Vec4 color(1, 1, 1, cursorAlpha[cursorAlphaIdx] / 255.0f);
|
||||||
|
|
||||||
for (size_t i = 0; i < cursorVert.count(); ++i)
|
for (size_t i = 0; i < cursorVert.count(); ++i)
|
||||||
Quad::setColor(&cursorVert.vertices[i*4], color);
|
Quad::setColor(&cursorVert.vertices[i*4], color);
|
||||||
|
|
Loading…
Reference in New Issue