Core: Remove ifdefs that don't influence RGSS specific behavior
This is the first step in eliminating the build time RGSS versioning.
This commit is contained in:
parent
28421a0ce5
commit
b1981055e1
|
@ -249,17 +249,10 @@ Audio::Audio(const Config &conf)
|
||||||
|
|
||||||
void Audio::bgmPlay(const char *filename,
|
void Audio::bgmPlay(const char *filename,
|
||||||
int volume,
|
int volume,
|
||||||
int pitch
|
int pitch,
|
||||||
#ifdef RGSS3
|
float pos)
|
||||||
,float pos
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
#ifdef RGSS3
|
|
||||||
p->bgm.play(filename, volume, pitch, pos);
|
p->bgm.play(filename, volume, pitch, pos);
|
||||||
#else
|
|
||||||
p->bgm.play(filename, volume, pitch);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio::bgmStop()
|
void Audio::bgmStop()
|
||||||
|
@ -275,17 +268,10 @@ void Audio::bgmFade(int time)
|
||||||
|
|
||||||
void Audio::bgsPlay(const char *filename,
|
void Audio::bgsPlay(const char *filename,
|
||||||
int volume,
|
int volume,
|
||||||
int pitch
|
int pitch,
|
||||||
#ifdef RGSS3
|
float pos)
|
||||||
,float pos
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
#ifdef RGSS3
|
|
||||||
p->bgs.play(filename, volume, pitch, pos);
|
p->bgs.play(filename, volume, pitch, pos);
|
||||||
#else
|
|
||||||
p->bgs.play(filename, volume, pitch);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio::bgsStop()
|
void Audio::bgsStop()
|
||||||
|
@ -329,8 +315,6 @@ void Audio::seStop()
|
||||||
p->se.stop();
|
p->se.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RGSS3
|
|
||||||
|
|
||||||
void Audio::setupMidi()
|
void Audio::setupMidi()
|
||||||
{
|
{
|
||||||
#ifdef MIDI
|
#ifdef MIDI
|
||||||
|
@ -348,6 +332,4 @@ float Audio::bgsPos()
|
||||||
return p->bgs.playingOffset();
|
return p->bgs.playingOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Audio::~Audio() { delete p; }
|
Audio::~Audio() { delete p; }
|
||||||
|
|
16
src/audio.h
16
src/audio.h
|
@ -40,21 +40,15 @@ class Audio
|
||||||
public:
|
public:
|
||||||
void bgmPlay(const char *filename,
|
void bgmPlay(const char *filename,
|
||||||
int volume = 100,
|
int volume = 100,
|
||||||
int pitch = 100
|
int pitch = 100,
|
||||||
#ifdef RGSS3
|
float pos = 0);
|
||||||
,float pos = 0
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
void bgmStop();
|
void bgmStop();
|
||||||
void bgmFade(int time);
|
void bgmFade(int time);
|
||||||
|
|
||||||
void bgsPlay(const char *filename,
|
void bgsPlay(const char *filename,
|
||||||
int volume = 100,
|
int volume = 100,
|
||||||
int pitch = 100
|
int pitch = 100,
|
||||||
#ifdef RGSS3
|
float pos = 0);
|
||||||
,float pos = 0
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
void bgsStop();
|
void bgsStop();
|
||||||
void bgsFade(int time);
|
void bgsFade(int time);
|
||||||
|
|
||||||
|
@ -69,11 +63,9 @@ public:
|
||||||
int pitch = 100);
|
int pitch = 100);
|
||||||
void seStop();
|
void seStop();
|
||||||
|
|
||||||
#ifdef RGSS3
|
|
||||||
void setupMidi();
|
void setupMidi();
|
||||||
float bgmPos();
|
float bgmPos();
|
||||||
float bgsPos();
|
float bgsPos();
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Audio(const Config &conf);
|
Audio(const Config &conf);
|
||||||
|
|
|
@ -488,8 +488,6 @@ void Bitmap::fillRect(const IntRect &rect, const Vec4 &color)
|
||||||
p->onModified();
|
p->onModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
|
|
||||||
void Bitmap::gradientFillRect(int x, int y,
|
void Bitmap::gradientFillRect(int x, int y,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
const Vec4 &color1, const Vec4 &color2,
|
const Vec4 &color1, const Vec4 &color2,
|
||||||
|
@ -553,6 +551,8 @@ void Bitmap::clearRect(const IntRect &rect)
|
||||||
p->onModified();
|
p->onModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef RGSS2
|
||||||
|
|
||||||
void Bitmap::blur()
|
void Bitmap::blur()
|
||||||
{
|
{
|
||||||
GUARD_MEGA;
|
GUARD_MEGA;
|
||||||
|
|
|
@ -61,7 +61,6 @@ public:
|
||||||
const Vec4 &color);
|
const Vec4 &color);
|
||||||
void fillRect(const IntRect &rect, const Vec4 &color);
|
void fillRect(const IntRect &rect, const Vec4 &color);
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
void gradientFillRect(int x, int y,
|
void gradientFillRect(int x, int y,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
const Vec4 &color1, const Vec4 &color2,
|
const Vec4 &color1, const Vec4 &color2,
|
||||||
|
@ -74,8 +73,8 @@ public:
|
||||||
int width, int height);
|
int width, int height);
|
||||||
void clearRect(const IntRect &rect);
|
void clearRect(const IntRect &rect);
|
||||||
|
|
||||||
|
#ifdef RGSS2
|
||||||
void blur();
|
void blur();
|
||||||
|
|
||||||
void radialBlur(int angle, int divisions);
|
void radialBlur(int angle, int divisions);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
12
src/font.cpp
12
src/font.cpp
|
@ -335,29 +335,17 @@ DEF_ATTR_RD_SIMPLE(Font, Size, int, p->size)
|
||||||
DEF_ATTR_SIMPLE(Font, Bold, bool, p->bold)
|
DEF_ATTR_SIMPLE(Font, Bold, bool, p->bold)
|
||||||
DEF_ATTR_SIMPLE(Font, Italic, bool, p->italic)
|
DEF_ATTR_SIMPLE(Font, Italic, bool, p->italic)
|
||||||
DEF_ATTR_SIMPLE(Font, Color, Color*, p->color)
|
DEF_ATTR_SIMPLE(Font, Color, Color*, p->color)
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
DEF_ATTR_SIMPLE(Font, Shadow, bool, p->shadow)
|
DEF_ATTR_SIMPLE(Font, Shadow, bool, p->shadow)
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RGSS3
|
|
||||||
DEF_ATTR_SIMPLE(Font, Outline, bool, p->outline)
|
DEF_ATTR_SIMPLE(Font, Outline, bool, p->outline)
|
||||||
DEF_ATTR_SIMPLE(Font, OutColor, Color*, p->outColor)
|
DEF_ATTR_SIMPLE(Font, OutColor, Color*, p->outColor)
|
||||||
#endif
|
|
||||||
|
|
||||||
DEF_ATTR_SIMPLE_STATIC(Font, DefaultSize, int, FontPrivate::defaultSize)
|
DEF_ATTR_SIMPLE_STATIC(Font, DefaultSize, int, FontPrivate::defaultSize)
|
||||||
DEF_ATTR_SIMPLE_STATIC(Font, DefaultBold, bool, FontPrivate::defaultBold)
|
DEF_ATTR_SIMPLE_STATIC(Font, DefaultBold, bool, FontPrivate::defaultBold)
|
||||||
DEF_ATTR_SIMPLE_STATIC(Font, DefaultItalic, bool, FontPrivate::defaultItalic)
|
DEF_ATTR_SIMPLE_STATIC(Font, DefaultItalic, bool, FontPrivate::defaultItalic)
|
||||||
DEF_ATTR_SIMPLE_STATIC(Font, DefaultColor, Color*, FontPrivate::defaultColor)
|
DEF_ATTR_SIMPLE_STATIC(Font, DefaultColor, Color*, FontPrivate::defaultColor)
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
DEF_ATTR_SIMPLE_STATIC(Font, DefaultShadow, bool, FontPrivate::defaultShadow)
|
DEF_ATTR_SIMPLE_STATIC(Font, DefaultShadow, bool, FontPrivate::defaultShadow)
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RGSS3
|
|
||||||
DEF_ATTR_SIMPLE_STATIC(Font, DefaultOutline, bool, FontPrivate::defaultOutline)
|
DEF_ATTR_SIMPLE_STATIC(Font, DefaultOutline, bool, FontPrivate::defaultOutline)
|
||||||
DEF_ATTR_SIMPLE_STATIC(Font, DefaultOutColor, Color*, FontPrivate::defaultOutColor)
|
DEF_ATTR_SIMPLE_STATIC(Font, DefaultOutColor, Color*, FontPrivate::defaultOutColor)
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *Font::getDefaultName()
|
const char *Font::getDefaultName()
|
||||||
{
|
{
|
||||||
|
|
12
src/font.h
12
src/font.h
|
@ -89,30 +89,18 @@ public:
|
||||||
DECL_ATTR( Bold, bool )
|
DECL_ATTR( Bold, bool )
|
||||||
DECL_ATTR( Italic, bool )
|
DECL_ATTR( Italic, bool )
|
||||||
DECL_ATTR( Color, Color* )
|
DECL_ATTR( Color, Color* )
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
DECL_ATTR( Shadow, bool )
|
DECL_ATTR( Shadow, bool )
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RGSS3
|
|
||||||
DECL_ATTR( Outline, bool )
|
DECL_ATTR( Outline, bool )
|
||||||
DECL_ATTR( OutColor, Color* )
|
DECL_ATTR( OutColor, Color* )
|
||||||
#endif
|
|
||||||
|
|
||||||
DECL_ATTR_STATIC( DefaultName, const char* )
|
DECL_ATTR_STATIC( DefaultName, const char* )
|
||||||
DECL_ATTR_STATIC( DefaultSize, int )
|
DECL_ATTR_STATIC( DefaultSize, int )
|
||||||
DECL_ATTR_STATIC( DefaultBold, bool )
|
DECL_ATTR_STATIC( DefaultBold, bool )
|
||||||
DECL_ATTR_STATIC( DefaultItalic, bool )
|
DECL_ATTR_STATIC( DefaultItalic, bool )
|
||||||
DECL_ATTR_STATIC( DefaultColor, Color* )
|
DECL_ATTR_STATIC( DefaultColor, Color* )
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
DECL_ATTR_STATIC( DefaultShadow, bool )
|
DECL_ATTR_STATIC( DefaultShadow, bool )
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RGSS3
|
|
||||||
DECL_ATTR_STATIC( DefaultOutline, bool )
|
DECL_ATTR_STATIC( DefaultOutline, bool )
|
||||||
DECL_ATTR_STATIC( DefaultOutColor, Color* )
|
DECL_ATTR_STATIC( DefaultOutColor, Color* )
|
||||||
#endif
|
|
||||||
|
|
||||||
/* internal */
|
/* internal */
|
||||||
_TTF_Font *getSdlFont();
|
_TTF_Font *getSdlFont();
|
||||||
|
|
|
@ -126,10 +126,8 @@ public:
|
||||||
{
|
{
|
||||||
updateReso(width, height);
|
updateReso(width, height);
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
brightEffect = false;
|
brightEffect = false;
|
||||||
brightnessQuad.setColor(Vec4());
|
brightnessQuad.setColor(Vec4());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void composite()
|
void composite()
|
||||||
|
@ -147,7 +145,6 @@ public:
|
||||||
|
|
||||||
Scene::composite();
|
Scene::composite();
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
if (brightEffect)
|
if (brightEffect)
|
||||||
{
|
{
|
||||||
SimpleColorShader &shader = shState->shaders().simpleColor;
|
SimpleColorShader &shader = shState->shaders().simpleColor;
|
||||||
|
@ -157,7 +154,6 @@ public:
|
||||||
|
|
||||||
brightnessQuad.draw();
|
brightnessQuad.draw();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void requestViewportRender(Vec4 &c, Vec4 &f, Vec4 &t)
|
void requestViewportRender(Vec4 &c, Vec4 &f, Vec4 &t)
|
||||||
|
@ -194,14 +190,12 @@ public:
|
||||||
glState.blend.pop();
|
glState.blend.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
void setBrightness(float norm)
|
void setBrightness(float norm)
|
||||||
{
|
{
|
||||||
brightnessQuad.setColor(Vec4(0, 0, 0, 1.0 - norm));
|
brightnessQuad.setColor(Vec4(0, 0, 0, 1.0 - norm));
|
||||||
|
|
||||||
brightEffect = norm < 1.0;
|
brightEffect = norm < 1.0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void updateReso(int width, int height)
|
void updateReso(int width, int height)
|
||||||
{
|
{
|
||||||
|
@ -209,10 +203,7 @@ public:
|
||||||
geometry.rect.h = height;
|
geometry.rect.h = height;
|
||||||
|
|
||||||
screenQuad.setTexPosRect(geometry.rect, geometry.rect);
|
screenQuad.setTexPosRect(geometry.rect, geometry.rect);
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
brightnessQuad.setTexPosRect(geometry.rect, geometry.rect);
|
brightnessQuad.setTexPosRect(geometry.rect, geometry.rect);
|
||||||
#endif
|
|
||||||
|
|
||||||
notifyGeometryChange();
|
notifyGeometryChange();
|
||||||
}
|
}
|
||||||
|
@ -232,10 +223,8 @@ private:
|
||||||
PingPong pp;
|
PingPong pp;
|
||||||
Quad screenQuad;
|
Quad screenQuad;
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
Quad brightnessQuad;
|
Quad brightnessQuad;
|
||||||
bool brightEffect;
|
bool brightEffect;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Nanoseconds per second */
|
/* Nanoseconds per second */
|
||||||
|
@ -391,10 +380,7 @@ struct GraphicsPrivate
|
||||||
|
|
||||||
int frameRate;
|
int frameRate;
|
||||||
int frameCount;
|
int frameCount;
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
int brightness;
|
int brightness;
|
||||||
#endif
|
|
||||||
|
|
||||||
FPSLimiter fpsLimiter;
|
FPSLimiter fpsLimiter;
|
||||||
|
|
||||||
|
@ -412,9 +398,7 @@ struct GraphicsPrivate
|
||||||
threadData(rtData),
|
threadData(rtData),
|
||||||
frameRate(DEF_FRAMERATE),
|
frameRate(DEF_FRAMERATE),
|
||||||
frameCount(0),
|
frameCount(0),
|
||||||
#ifdef RGSS2
|
|
||||||
brightness(255),
|
brightness(255),
|
||||||
#endif
|
|
||||||
fpsLimiter(frameRate),
|
fpsLimiter(frameRate),
|
||||||
frozen(false)
|
frozen(false)
|
||||||
{
|
{
|
||||||
|
@ -606,9 +590,7 @@ void Graphics::transition(int duration,
|
||||||
vague = clamp(vague, 0, 512);
|
vague = clamp(vague, 0, 512);
|
||||||
Bitmap *transMap = filename ? new Bitmap(filename) : 0;
|
Bitmap *transMap = filename ? new Bitmap(filename) : 0;
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
setBrightness(255);
|
setBrightness(255);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Capture new scene */
|
/* Capture new scene */
|
||||||
p->compositeToBuffer(p->currentScene);
|
p->compositeToBuffer(p->currentScene);
|
||||||
|
@ -714,8 +696,6 @@ void Graphics::setFrameRate(int value)
|
||||||
p->fpsLimiter.setDesiredFPS(p->frameRate);
|
p->fpsLimiter.setDesiredFPS(p->frameRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
|
|
||||||
void Graphics::wait(int duration)
|
void Graphics::wait(int duration)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < duration; ++i)
|
for (int i = 0; i < duration; ++i)
|
||||||
|
@ -849,8 +829,6 @@ void Graphics::setBrightness(int value)
|
||||||
p->screen.setBrightness(value / 255.0);
|
p->screen.setBrightness(value / 255.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool Graphics::getFullscreen() const
|
bool Graphics::getFullscreen() const
|
||||||
{
|
{
|
||||||
return p->threadData->ethread->getFullscreen();
|
return p->threadData->ethread->getFullscreen();
|
||||||
|
|
|
@ -41,8 +41,8 @@ public:
|
||||||
|
|
||||||
DECL_ATTR( FrameRate, int )
|
DECL_ATTR( FrameRate, int )
|
||||||
DECL_ATTR( FrameCount, int )
|
DECL_ATTR( FrameCount, int )
|
||||||
|
DECL_ATTR( Brightness, int )
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
void wait(int duration);
|
void wait(int duration);
|
||||||
void fadeout(int duration);
|
void fadeout(int duration);
|
||||||
void fadein(int duration);
|
void fadein(int duration);
|
||||||
|
@ -53,9 +53,6 @@ public:
|
||||||
int height() const;
|
int height() const;
|
||||||
void resizeScreen(int width, int height);
|
void resizeScreen(int width, int height);
|
||||||
|
|
||||||
DECL_ATTR( Brightness, int )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Non-standard extension */
|
/* Non-standard extension */
|
||||||
DECL_ATTR( Fullscreen, bool )
|
DECL_ATTR( Fullscreen, bool )
|
||||||
DECL_ATTR( ShowCursor, bool )
|
DECL_ATTR( ShowCursor, bool )
|
||||||
|
|
|
@ -67,7 +67,6 @@ struct SpritePrivate
|
||||||
Color *color;
|
Color *color;
|
||||||
Tone *tone;
|
Tone *tone;
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int amp;
|
int amp;
|
||||||
|
@ -81,7 +80,6 @@ struct SpritePrivate
|
||||||
bool dirty;
|
bool dirty;
|
||||||
SimpleQuadArray qArray;
|
SimpleQuadArray qArray;
|
||||||
} wave;
|
} wave;
|
||||||
#endif
|
|
||||||
|
|
||||||
EtcTemps tmp;
|
EtcTemps tmp;
|
||||||
|
|
||||||
|
@ -109,13 +107,11 @@ struct SpritePrivate
|
||||||
prepareCon = shState->prepareDraw.connect
|
prepareCon = shState->prepareDraw.connect
|
||||||
(sigc::mem_fun(this, &SpritePrivate::prepare));
|
(sigc::mem_fun(this, &SpritePrivate::prepare));
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
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.0;
|
||||||
wave.dirty = false;
|
wave.dirty = false;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~SpritePrivate()
|
~SpritePrivate()
|
||||||
|
@ -147,9 +143,7 @@ struct SpritePrivate
|
||||||
quad.setPosRect(IntRect(0, 0, srcRect->width, srcRect->height));
|
quad.setPosRect(IntRect(0, 0, srcRect->width, srcRect->height));
|
||||||
recomputeBushDepth();
|
recomputeBushDepth();
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
wave.dirty = true;
|
wave.dirty = true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateSrcRectCon()
|
void updateSrcRectCon()
|
||||||
|
@ -171,7 +165,6 @@ struct SpritePrivate
|
||||||
if (!opacity)
|
if (!opacity)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
if (wave.active)
|
if (wave.active)
|
||||||
{
|
{
|
||||||
/* Don't do expensive wave bounding box
|
/* Don't do expensive wave bounding box
|
||||||
|
@ -179,7 +172,6 @@ struct SpritePrivate
|
||||||
isVisible = true;
|
isVisible = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Compare sprite bounding box against the scene */
|
/* Compare sprite bounding box against the scene */
|
||||||
|
|
||||||
|
@ -201,7 +193,6 @@ struct SpritePrivate
|
||||||
isVisible = SDL_HasIntersection(&self, &sceneRect);
|
isVisible = SDL_HasIntersection(&self, &sceneRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -285,17 +276,14 @@ struct SpritePrivate
|
||||||
|
|
||||||
wave.qArray.commit();
|
wave.qArray.commit();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void prepare()
|
void prepare()
|
||||||
{
|
{
|
||||||
#ifdef RGSS2
|
|
||||||
if (wave.dirty)
|
if (wave.dirty)
|
||||||
{
|
{
|
||||||
updateWave();
|
updateWave();
|
||||||
wave.dirty = false;
|
wave.dirty = false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
updateVisibility();
|
updateVisibility();
|
||||||
}
|
}
|
||||||
|
@ -327,20 +315,17 @@ DEF_ATTR_RD_SIMPLE(Sprite, Angle, float, p->trans.getRotation())
|
||||||
DEF_ATTR_RD_SIMPLE(Sprite, Mirror, bool, p->mirrored)
|
DEF_ATTR_RD_SIMPLE(Sprite, Mirror, bool, p->mirrored)
|
||||||
DEF_ATTR_RD_SIMPLE(Sprite, BushDepth, int, p->bushDepth)
|
DEF_ATTR_RD_SIMPLE(Sprite, BushDepth, int, p->bushDepth)
|
||||||
DEF_ATTR_RD_SIMPLE(Sprite, BlendType, int, p->blendType)
|
DEF_ATTR_RD_SIMPLE(Sprite, BlendType, int, p->blendType)
|
||||||
|
|
||||||
DEF_ATTR_SIMPLE(Sprite, BushOpacity, int, p->bushOpacity)
|
|
||||||
DEF_ATTR_SIMPLE(Sprite, Opacity, int, p->opacity)
|
|
||||||
DEF_ATTR_SIMPLE(Sprite, Color, Color*, p->color)
|
|
||||||
DEF_ATTR_SIMPLE(Sprite, Tone, Tone*, p->tone)
|
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
DEF_ATTR_RD_SIMPLE(Sprite, Width, int, p->srcRect->width)
|
DEF_ATTR_RD_SIMPLE(Sprite, Width, int, p->srcRect->width)
|
||||||
DEF_ATTR_RD_SIMPLE(Sprite, Height, int, p->srcRect->height)
|
DEF_ATTR_RD_SIMPLE(Sprite, Height, int, p->srcRect->height)
|
||||||
DEF_ATTR_RD_SIMPLE(Sprite, WaveAmp, int, p->wave.amp)
|
DEF_ATTR_RD_SIMPLE(Sprite, WaveAmp, int, p->wave.amp)
|
||||||
DEF_ATTR_RD_SIMPLE(Sprite, WaveLength, int, p->wave.length)
|
DEF_ATTR_RD_SIMPLE(Sprite, WaveLength, int, p->wave.length)
|
||||||
DEF_ATTR_RD_SIMPLE(Sprite, WaveSpeed, int, p->wave.speed)
|
DEF_ATTR_RD_SIMPLE(Sprite, WaveSpeed, int, p->wave.speed)
|
||||||
DEF_ATTR_RD_SIMPLE(Sprite, WavePhase, float, p->wave.phase)
|
DEF_ATTR_RD_SIMPLE(Sprite, WavePhase, float, p->wave.phase)
|
||||||
#endif
|
|
||||||
|
DEF_ATTR_SIMPLE(Sprite, BushOpacity, int, p->bushOpacity)
|
||||||
|
DEF_ATTR_SIMPLE(Sprite, Opacity, int, p->opacity)
|
||||||
|
DEF_ATTR_SIMPLE(Sprite, Color, Color*, p->color)
|
||||||
|
DEF_ATTR_SIMPLE(Sprite, Tone, Tone*, p->tone)
|
||||||
|
|
||||||
void Sprite::setBitmap(Bitmap *bitmap)
|
void Sprite::setBitmap(Bitmap *bitmap)
|
||||||
{
|
{
|
||||||
|
@ -359,9 +344,7 @@ void Sprite::setBitmap(Bitmap *bitmap)
|
||||||
p->onSrcRectChange();
|
p->onSrcRectChange();
|
||||||
p->quad.setPosRect(p->srcRect->toFloatRect());
|
p->quad.setPosRect(p->srcRect->toFloatRect());
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
p->wave.dirty = true;
|
p->wave.dirty = true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sprite::setSrcRect(Rect *rect)
|
void Sprite::setSrcRect(Rect *rect)
|
||||||
|
@ -478,8 +461,6 @@ void Sprite::setBlendType(int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
|
|
||||||
#define DEF_WAVE_SETTER(Name, name, type) \
|
#define DEF_WAVE_SETTER(Name, name, type) \
|
||||||
void Sprite::setWave##Name(type value) \
|
void Sprite::setWave##Name(type value) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -505,8 +486,6 @@ void Sprite::update()
|
||||||
p->wave.dirty = true;
|
p->wave.dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* SceneElement */
|
/* SceneElement */
|
||||||
void Sprite::draw()
|
void Sprite::draw()
|
||||||
{
|
{
|
||||||
|
@ -560,14 +539,10 @@ void Sprite::draw()
|
||||||
|
|
||||||
p->bitmap->bindTex(*base);
|
p->bitmap->bindTex(*base);
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
if (p->wave.active)
|
if (p->wave.active)
|
||||||
p->wave.qArray.draw();
|
p->wave.qArray.draw();
|
||||||
else
|
else
|
||||||
p->quad.draw();
|
p->quad.draw();
|
||||||
#else
|
|
||||||
p->quad.draw();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
glState.blendMode.pop();
|
glState.blendMode.pop();
|
||||||
}
|
}
|
||||||
|
|
13
src/sprite.h
13
src/sprite.h
|
@ -41,6 +41,11 @@ public:
|
||||||
Sprite(Viewport *viewport = 0);
|
Sprite(Viewport *viewport = 0);
|
||||||
~Sprite();
|
~Sprite();
|
||||||
|
|
||||||
|
int getWidth() const;
|
||||||
|
int getHeight() const;
|
||||||
|
|
||||||
|
void update();
|
||||||
|
|
||||||
DECL_ATTR( Bitmap, Bitmap* )
|
DECL_ATTR( Bitmap, Bitmap* )
|
||||||
DECL_ATTR( SrcRect, Rect* )
|
DECL_ATTR( SrcRect, Rect* )
|
||||||
DECL_ATTR( X, int )
|
DECL_ATTR( X, int )
|
||||||
|
@ -57,19 +62,11 @@ public:
|
||||||
DECL_ATTR( BlendType, int )
|
DECL_ATTR( BlendType, int )
|
||||||
DECL_ATTR( Color, Color* )
|
DECL_ATTR( Color, Color* )
|
||||||
DECL_ATTR( Tone, Tone* )
|
DECL_ATTR( Tone, Tone* )
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
int getWidth() const;
|
|
||||||
int getHeight() const;
|
|
||||||
|
|
||||||
DECL_ATTR( WaveAmp, int )
|
DECL_ATTR( WaveAmp, int )
|
||||||
DECL_ATTR( WaveLength, int )
|
DECL_ATTR( WaveLength, int )
|
||||||
DECL_ATTR( WaveSpeed, int )
|
DECL_ATTR( WaveSpeed, int )
|
||||||
DECL_ATTR( WavePhase, float )
|
DECL_ATTR( WavePhase, float )
|
||||||
|
|
||||||
void update();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SpritePrivate *p;
|
SpritePrivate *p;
|
||||||
|
|
||||||
|
|
|
@ -113,8 +113,6 @@ Viewport::Viewport(Rect *rect)
|
||||||
initViewport(rect->x, rect->y, rect->width, rect->height);
|
initViewport(rect->x, rect->y, rect->width, rect->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RGSS3
|
|
||||||
|
|
||||||
Viewport::Viewport()
|
Viewport::Viewport()
|
||||||
: SceneElement(*shState->screen()),
|
: SceneElement(*shState->screen()),
|
||||||
sceneLink(this)
|
sceneLink(this)
|
||||||
|
@ -123,8 +121,6 @@ Viewport::Viewport()
|
||||||
initViewport(0, 0, graphics.width(), graphics.height());
|
initViewport(0, 0, graphics.width(), graphics.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void Viewport::initViewport(int x, int y, int width, int height)
|
void Viewport::initViewport(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
p = new ViewportPrivate(x, y, width, height, this);
|
p = new ViewportPrivate(x, y, width, height, this);
|
||||||
|
@ -232,8 +228,6 @@ Viewport *ViewportElement::getViewport() const
|
||||||
return m_viewport;
|
return m_viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
|
|
||||||
void ViewportElement::setViewport(Viewport *viewport)
|
void ViewportElement::setViewport(Viewport *viewport)
|
||||||
{
|
{
|
||||||
m_viewport = viewport;
|
m_viewport = viewport;
|
||||||
|
@ -241,5 +235,3 @@ void ViewportElement::setViewport(Viewport *viewport)
|
||||||
onViewportChange();
|
onViewportChange();
|
||||||
onGeometryChange(scene->getGeometry());
|
onGeometryChange(scene->getGeometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -34,11 +34,7 @@ class Viewport : public Scene, public SceneElement, public Flashable, public Dis
|
||||||
public:
|
public:
|
||||||
Viewport(int x, int y, int width, int height);
|
Viewport(int x, int y, int width, int height);
|
||||||
Viewport(Rect *rect);
|
Viewport(Rect *rect);
|
||||||
|
|
||||||
#ifdef RGSS3
|
|
||||||
Viewport();
|
Viewport();
|
||||||
#endif
|
|
||||||
|
|
||||||
~Viewport();
|
~Viewport();
|
||||||
|
|
||||||
DECL_ATTR( Rect, Rect* )
|
DECL_ATTR( Rect, Rect* )
|
||||||
|
@ -68,11 +64,7 @@ public:
|
||||||
ViewportElement(Viewport *viewport = 0, int z = 0, bool isSprite = false);
|
ViewportElement(Viewport *viewport = 0, int z = 0, bool isSprite = false);
|
||||||
ViewportElement(Viewport *viewport, int z, unsigned int cStamp);
|
ViewportElement(Viewport *viewport, int z, unsigned int cStamp);
|
||||||
|
|
||||||
Viewport *getViewport() const;
|
DECL_ATTR( Viewport, Viewport* )
|
||||||
|
|
||||||
#ifdef RGSS2
|
|
||||||
void setViewport(Viewport *viewport = 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void onViewportChange() {}
|
virtual void onViewportChange() {}
|
||||||
|
|
Loading…
Reference in New Issue