космитические изменения и обновление oneshot.conf
This commit is contained in:
parent
8fce0cdc18
commit
acbac0b959
|
|
@ -15,6 +15,9 @@
|
||||||
#
|
#
|
||||||
# fullscreen=false
|
# fullscreen=false
|
||||||
|
|
||||||
|
# Display current FPS in Window title
|
||||||
|
# (default: disabled)
|
||||||
|
# printFPS=false
|
||||||
|
|
||||||
# Preserve game screen aspect ratio,
|
# Preserve game screen aspect ratio,
|
||||||
# as opposed to stretch-to-fill
|
# as opposed to stretch-to-fill
|
||||||
|
|
@ -24,7 +27,7 @@
|
||||||
|
|
||||||
# 16:9 support
|
# 16:9 support
|
||||||
# EXPEREMENTAL!
|
# EXPEREMENTAL!
|
||||||
#
|
# (default: disabled)
|
||||||
# EnableSixteenByNine=false
|
# EnableSixteenByNine=false
|
||||||
|
|
||||||
# Apply linear interpolation when game screen
|
# Apply linear interpolation when game screen
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ struct Config{
|
||||||
bool debugMode;
|
bool debugMode;
|
||||||
bool screenMode;
|
bool screenMode;
|
||||||
bool printFPS;
|
bool printFPS;
|
||||||
|
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
bool fixedAspectRatio;
|
bool fixedAspectRatio;
|
||||||
bool smoothScaling;
|
bool smoothScaling;
|
||||||
|
|
|
||||||
|
|
@ -33,17 +33,14 @@
|
||||||
|
|
||||||
/* A cheap replacement for qDebug() */
|
/* A cheap replacement for qDebug() */
|
||||||
|
|
||||||
class Debug
|
class Debug{
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
Debug()
|
Debug(){
|
||||||
{
|
|
||||||
buf << std::boolalpha;
|
buf << std::boolalpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Debug &operator<<(const T &t)
|
Debug &operator<<(const T &t){
|
||||||
{
|
|
||||||
buf << t;
|
buf << t;
|
||||||
buf << " ";
|
buf << " ";
|
||||||
|
|
||||||
|
|
@ -51,16 +48,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Debug &operator<<(const std::vector<T> &v)
|
Debug &operator<<(const std::vector<T> &v){
|
||||||
{
|
|
||||||
for (size_t i = 0; i < v.size(); ++i)
|
for (size_t i = 0; i < v.size(); ++i)
|
||||||
buf << v[i] << " ";
|
buf << v[i] << " ";
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
~Debug()
|
~Debug(){
|
||||||
{
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
__android_log_write(ANDROID_LOG_DEBUG, "mkxp", buf.str().c_str());
|
__android_log_write(ANDROID_LOG_DEBUG, "mkxp", buf.str().c_str());
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,7 @@
|
||||||
#include <sigc++/connection.h>
|
#include <sigc++/connection.h>
|
||||||
// #include <sigc++2.0/sigc++/connection.h>
|
// #include <sigc++2.0/sigc++/connection.h>
|
||||||
|
|
||||||
class Disposable
|
class Disposable{
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
Disposable()
|
Disposable()
|
||||||
: disposed(false),
|
: disposed(false),
|
||||||
|
|
@ -44,13 +43,11 @@ public:
|
||||||
shState->graphics().addDisposable(this);
|
shState->graphics().addDisposable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~Disposable()
|
virtual ~Disposable(){
|
||||||
{
|
|
||||||
shState->graphics().remDisposable(this);
|
shState->graphics().remDisposable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispose()
|
void dispose(){
|
||||||
{
|
|
||||||
if (disposed)
|
if (disposed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -59,16 +56,14 @@ public:
|
||||||
wasDisposed();
|
wasDisposed();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isDisposed() const
|
bool isDisposed() const{
|
||||||
{
|
|
||||||
return disposed;
|
return disposed;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigc::signal<void> wasDisposed;
|
sigc::signal<void> wasDisposed;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void guardDisposed() const
|
void guardDisposed() const{
|
||||||
{
|
|
||||||
if (isDisposed())
|
if (isDisposed())
|
||||||
throw Exception(Exception::RGSSError,
|
throw Exception(Exception::RGSSError,
|
||||||
"disposed %s", klassName());
|
"disposed %s", klassName());
|
||||||
|
|
@ -85,9 +80,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
inline bool
|
inline bool nullOrDisposed(const C *d){
|
||||||
nullOrDisposed(const C *d)
|
|
||||||
{
|
|
||||||
if (!d)
|
if (!d)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,7 @@
|
||||||
|
|
||||||
#include <SDL3/SDL_rect.h>
|
#include <SDL3/SDL_rect.h>
|
||||||
|
|
||||||
struct Vec2
|
struct Vec2{
|
||||||
{
|
|
||||||
float x, y;
|
float x, y;
|
||||||
|
|
||||||
Vec2()
|
Vec2()
|
||||||
|
|
@ -38,14 +37,12 @@ struct Vec2
|
||||||
: x(x), y(y)
|
: x(x), y(y)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool operator==(const Vec2 &other) const
|
bool operator==(const Vec2 &other) const{
|
||||||
{
|
|
||||||
return (x == other.x && y == other.y);
|
return (x == other.x && y == other.y);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Vec4
|
struct Vec4{
|
||||||
{
|
|
||||||
float x, y, z, w;
|
float x, y, z, w;
|
||||||
|
|
||||||
Vec4()
|
Vec4()
|
||||||
|
|
@ -56,19 +53,16 @@ struct Vec4
|
||||||
: x(x), y(y), z(z), w(w)
|
: x(x), y(y), z(z), w(w)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool operator==(const Vec4 &other) const
|
bool operator==(const Vec4 &other) const{
|
||||||
{
|
|
||||||
return (x == other.x && y == other.y && z == other.z && w == other.w);
|
return (x == other.x && y == other.y && z == other.z && w == other.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool xyzNotNull() const
|
bool xyzNotNull() const{
|
||||||
{
|
|
||||||
return (x != 0.0f || y != 0.0f || z != 0.0f);
|
return (x != 0.0f || y != 0.0f || z != 0.0f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Vec2i
|
struct Vec2i{
|
||||||
{
|
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
Vec2i()
|
Vec2i()
|
||||||
|
|
@ -83,138 +77,114 @@ struct Vec2i
|
||||||
: x(xy), y(xy)
|
: x(xy), y(xy)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool operator==(const Vec2i &other) const
|
bool operator==(const Vec2i &other) const{
|
||||||
{
|
|
||||||
return x == other.x && y == other.y;
|
return x == other.x && y == other.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const Vec2i &other) const
|
bool operator!=(const Vec2i &other) const{
|
||||||
{
|
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2i &operator+=(const Vec2i &value)
|
Vec2i &operator+=(const Vec2i &value){
|
||||||
{
|
|
||||||
x += value.x;
|
x += value.x;
|
||||||
y += value.y;
|
y += value.y;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2i &operator-=(const Vec2i &value)
|
Vec2i &operator-=(const Vec2i &value){
|
||||||
{
|
|
||||||
x -= value.x;
|
x -= value.x;
|
||||||
y -= value.y;
|
y -= value.y;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2i operator+(const Vec2i &value) const
|
Vec2i operator+(const Vec2i &value) const{
|
||||||
{
|
|
||||||
return Vec2i(x + value.x, y + value.y);
|
return Vec2i(x + value.x, y + value.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2i operator-(const Vec2i &value) const
|
Vec2i operator-(const Vec2i &value) const{
|
||||||
{
|
|
||||||
return Vec2i(x - value.x, y - value.y);
|
return Vec2i(x - value.x, y - value.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Vec2i operator*(T value) const
|
Vec2i operator*(T value) const{
|
||||||
{
|
|
||||||
return Vec2i(x * value, y * value);
|
return Vec2i(x * value, y * value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Vec2i operator/(T value) const
|
Vec2i operator/(T value) const{
|
||||||
{
|
|
||||||
return Vec2i(x / value, y / value);
|
return Vec2i(x / value, y / value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2i operator%(int value) const
|
Vec2i operator%(int value) const{
|
||||||
{
|
|
||||||
return Vec2i(x % value, y % value);
|
return Vec2i(x % value, y % value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2i operator&(unsigned value) const
|
Vec2i operator&(unsigned value) const{
|
||||||
{
|
|
||||||
return Vec2i(x & value, y & value);
|
return Vec2i(x & value, y & value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2i operator-() const
|
Vec2i operator-() const{
|
||||||
{
|
|
||||||
return Vec2i(-x, -y);
|
return Vec2i(-x, -y);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2i operator!() const
|
Vec2i operator!() const{
|
||||||
{
|
|
||||||
return Vec2i(!x, !y);
|
return Vec2i(!x, !y);
|
||||||
}
|
}
|
||||||
|
|
||||||
operator Vec2() const
|
operator Vec2() const{
|
||||||
{
|
|
||||||
return Vec2(x, y);
|
return Vec2(x, y);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IntRect : SDL_Rect
|
struct IntRect : SDL_Rect{
|
||||||
{
|
IntRect(){
|
||||||
IntRect()
|
|
||||||
{
|
|
||||||
x = y = w = h = 0;
|
x = y = w = h = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntRect(int x, int y, int w, int h)
|
IntRect(int x, int y, int w, int h){
|
||||||
{
|
|
||||||
this->x = x;
|
this->x = x;
|
||||||
this->y = y;
|
this->y = y;
|
||||||
this->w = w;
|
this->w = w;
|
||||||
this->h = h;
|
this->h = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntRect(const Vec2i &pos, const Vec2i &size)
|
IntRect(const Vec2i &pos, const Vec2i &size){
|
||||||
{
|
|
||||||
x = pos.x;
|
x = pos.x;
|
||||||
y = pos.y;
|
y = pos.y;
|
||||||
w = size.x;
|
w = size.x;
|
||||||
h = size.y;
|
h = size.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const IntRect &other) const
|
bool operator==(const IntRect &other) const{
|
||||||
{
|
|
||||||
return (x == other.x && y == other.y &&
|
return (x == other.x && y == other.y &&
|
||||||
w == other.w && h == other.h);
|
w == other.w && h == other.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const IntRect &other) const
|
bool operator!=(const IntRect &other) const{
|
||||||
{
|
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2i pos() const
|
Vec2i pos() const{
|
||||||
{
|
|
||||||
return Vec2i(x, y);
|
return Vec2i(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec2i size() const
|
Vec2i size() const{
|
||||||
{
|
|
||||||
return Vec2i(w, h);
|
return Vec2i(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPos(const Vec2i &value)
|
void setPos(const Vec2i &value){
|
||||||
{
|
|
||||||
x = value.x;
|
x = value.x;
|
||||||
y = value.y;
|
y = value.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSize(const Vec2i &value)
|
void setSize(const Vec2i &value){
|
||||||
{
|
|
||||||
w = value.x;
|
w = value.x;
|
||||||
h = value.y;
|
h = value.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool encloses(const IntRect &o) const
|
bool encloses(const IntRect &o) const{
|
||||||
{
|
|
||||||
return (x <= o.x &&
|
return (x <= o.x &&
|
||||||
y <= o.y &&
|
y <= o.y &&
|
||||||
x+w >= o.x+o.w &&
|
x+w >= o.x+o.w &&
|
||||||
|
|
@ -224,8 +194,7 @@ struct IntRect : SDL_Rect
|
||||||
|
|
||||||
struct StaticRect { float x, y, w, h; };
|
struct StaticRect { float x, y, w, h; };
|
||||||
|
|
||||||
struct FloatRect
|
struct FloatRect{
|
||||||
{
|
|
||||||
float x, y, w, h;
|
float x, y, w, h;
|
||||||
|
|
||||||
FloatRect()
|
FloatRect()
|
||||||
|
|
@ -244,8 +213,7 @@ struct FloatRect
|
||||||
: x(r.x), y(r.y), w(r.w), h(r.h)
|
: x(r.x), y(r.y), w(r.w), h(r.h)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
operator IntRect() const
|
operator IntRect() const{
|
||||||
{
|
|
||||||
return IntRect(x, y, w, h);
|
return IntRect(x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -254,16 +222,14 @@ struct FloatRect
|
||||||
Vec2 topRight() const { return Vec2(x+w, y); }
|
Vec2 topRight() const { return Vec2(x+w, y); }
|
||||||
Vec2 bottomRight() const { return Vec2(x+w, y+h); }
|
Vec2 bottomRight() const { return Vec2(x+w, y+h); }
|
||||||
|
|
||||||
FloatRect hFlipped() const
|
FloatRect hFlipped() const{
|
||||||
{
|
|
||||||
return FloatRect(x+w, y, -w, h);
|
return FloatRect(x+w, y, -w, h);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Value between 0 and 255 with internal
|
/* Value between 0 and 255 with internal
|
||||||
* normalized representation */
|
* normalized representation */
|
||||||
struct NormValue
|
struct NormValue{
|
||||||
{
|
|
||||||
int unNorm;
|
int unNorm;
|
||||||
float norm;
|
float norm;
|
||||||
|
|
||||||
|
|
@ -277,19 +243,16 @@ struct NormValue
|
||||||
norm(unNorm / 255.0f)
|
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.0f;
|
norm = unNorm / 255.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator ==(int value) const
|
bool operator ==(int value) const{
|
||||||
{
|
|
||||||
return unNorm == clamp(value, 0, 255);
|
return unNorm == clamp(value, 0, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
operator int() const
|
operator int() const{
|
||||||
{
|
|
||||||
return unNorm;
|
return unNorm;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
27
src/etc.h
27
src/etc.h
|
|
@ -29,8 +29,7 @@
|
||||||
|
|
||||||
struct SDL_Color;
|
struct SDL_Color;
|
||||||
|
|
||||||
enum BlendType
|
enum BlendType{
|
||||||
{
|
|
||||||
BlendKeepDestAlpha = -1,
|
BlendKeepDestAlpha = -1,
|
||||||
|
|
||||||
BlendNormal = 0,
|
BlendNormal = 0,
|
||||||
|
|
@ -38,8 +37,7 @@ enum BlendType
|
||||||
BlendSubstraction = 2
|
BlendSubstraction = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Color : public Serializable
|
struct Color : public Serializable{
|
||||||
{
|
|
||||||
Color()
|
Color()
|
||||||
: red(0), green(0), blue(0), alpha(0)
|
: red(0), green(0), blue(0), alpha(0)
|
||||||
{}
|
{}
|
||||||
|
|
@ -74,8 +72,7 @@ struct Color : public Serializable
|
||||||
void updateInternal();
|
void updateInternal();
|
||||||
void updateExternal();
|
void updateExternal();
|
||||||
|
|
||||||
bool hasEffect() const
|
bool hasEffect() const{
|
||||||
{
|
|
||||||
return (alpha != 0);
|
return (alpha != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,8 +88,7 @@ struct Color : public Serializable
|
||||||
Vec4 norm;
|
Vec4 norm;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Tone : public Serializable
|
struct Tone : public Serializable{
|
||||||
{
|
|
||||||
Tone()
|
Tone()
|
||||||
: red(0), green(0), blue(0), gray(0)
|
: red(0), green(0), blue(0), gray(0)
|
||||||
{}
|
{}
|
||||||
|
|
@ -125,8 +121,7 @@ struct Tone : public Serializable
|
||||||
/* Internal */
|
/* Internal */
|
||||||
void updateInternal();
|
void updateInternal();
|
||||||
|
|
||||||
bool hasEffect() const
|
bool hasEffect() const{
|
||||||
{
|
|
||||||
return ((int)red != 0 ||
|
return ((int)red != 0 ||
|
||||||
(int)green != 0 ||
|
(int)green != 0 ||
|
||||||
(int)blue != 0 ||
|
(int)blue != 0 ||
|
||||||
|
|
@ -146,8 +141,7 @@ struct Tone : public Serializable
|
||||||
sigc::signal<void> valueChanged;
|
sigc::signal<void> valueChanged;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Rect : public Serializable
|
struct Rect : public Serializable{
|
||||||
{
|
|
||||||
Rect()
|
Rect()
|
||||||
: x(0), y(0), width(0), height(0)
|
: x(0), y(0), width(0), height(0)
|
||||||
{}
|
{}
|
||||||
|
|
@ -182,13 +176,11 @@ struct Rect : public Serializable
|
||||||
static Rect *deserialize(const char *data, int len);
|
static Rect *deserialize(const char *data, int len);
|
||||||
|
|
||||||
/* Internal */
|
/* Internal */
|
||||||
FloatRect toFloatRect() const
|
FloatRect toFloatRect() const{
|
||||||
{
|
|
||||||
return FloatRect(x, y, width, height);
|
return FloatRect(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntRect toIntRect()
|
IntRect toIntRect(){
|
||||||
{
|
|
||||||
return IntRect(x, y, width, height);
|
return IntRect(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -215,8 +207,7 @@ struct Rect : public Serializable
|
||||||
* without memory leakage.
|
* without memory leakage.
|
||||||
* This can be removed at a later point when no testing directly
|
* This can be removed at a later point when no testing directly
|
||||||
* from C++ is needed anymore. */
|
* from C++ is needed anymore. */
|
||||||
struct EtcTemps
|
struct EtcTemps{
|
||||||
{
|
|
||||||
Color color;
|
Color color;
|
||||||
Tone tone;
|
Tone tone;
|
||||||
Rect rect;
|
Rect rect;
|
||||||
|
|
|
||||||
|
|
@ -472,14 +472,10 @@ void EventThread::process(RGSSThreadData &rtData){
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPDATE_FPS :
|
case UPDATE_FPS :
|
||||||
if (rtData.config.printFPS)
|
|
||||||
Debug() << "FPS:" << event.user.code;
|
|
||||||
|
|
||||||
if (!fps.sendUpdates)
|
if (!fps.sendUpdates)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer), "%s - %d FPS",
|
snprintf(buffer, sizeof(buffer), "%s - %d FPS", rtData.config.windowTitle.c_str(), event.user.code);
|
||||||
rtData.config.windowTitle.c_str(), event.user.code);
|
|
||||||
|
|
||||||
/* Updating the window title in fullscreen
|
/* Updating the window title in fullscreen
|
||||||
* mode seems to cause flickering */
|
* mode seems to cause flickering */
|
||||||
|
|
|
||||||
|
|
@ -46,37 +46,31 @@ union SDL_Event;
|
||||||
|
|
||||||
#define MAX_FINGERS 4
|
#define MAX_FINGERS 4
|
||||||
|
|
||||||
class EventThread
|
class EventThread{
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
struct ControllerState
|
struct ControllerState{
|
||||||
{
|
|
||||||
int axes[SDL_GAMEPAD_AXIS_COUNT];
|
int axes[SDL_GAMEPAD_AXIS_COUNT];
|
||||||
bool buttons[SDL_GAMEPAD_BUTTON_COUNT];
|
bool buttons[SDL_GAMEPAD_BUTTON_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JoyState
|
struct JoyState{
|
||||||
{
|
|
||||||
int axes[256];
|
int axes[256];
|
||||||
uint8_t hats[256];
|
uint8_t hats[256];
|
||||||
bool buttons[256];
|
bool buttons[256];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MouseState
|
struct MouseState{
|
||||||
{
|
|
||||||
int x, y;
|
int x, y;
|
||||||
bool inWindow;
|
bool inWindow;
|
||||||
bool buttons[32];
|
bool buttons[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FingerState
|
struct FingerState{
|
||||||
{
|
|
||||||
bool down;
|
bool down;
|
||||||
int x, y;
|
int x, y;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TouchState
|
struct TouchState{
|
||||||
{
|
|
||||||
FingerState fingers[MAX_FINGERS];
|
FingerState fingers[MAX_FINGERS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -123,8 +117,7 @@ private:
|
||||||
bool showCursor;
|
bool showCursor;
|
||||||
AtomicFlag msgBoxDone;
|
AtomicFlag msgBoxDone;
|
||||||
|
|
||||||
struct
|
struct{
|
||||||
{
|
|
||||||
uint64_t lastFrame;
|
uint64_t lastFrame;
|
||||||
uint64_t displayCounter;
|
uint64_t displayCounter;
|
||||||
AtomicFlag sendUpdates;
|
AtomicFlag sendUpdates;
|
||||||
|
|
@ -138,21 +131,18 @@ private:
|
||||||
/* Used to asynchronously inform the RGSS thread
|
/* Used to asynchronously inform the RGSS thread
|
||||||
* about certain value changes */
|
* about certain value changes */
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct UnidirMessage
|
struct UnidirMessage{
|
||||||
{
|
|
||||||
UnidirMessage()
|
UnidirMessage()
|
||||||
: mutex(SDL_CreateMutex()),
|
: mutex(SDL_CreateMutex()),
|
||||||
current(T())
|
current(T())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~UnidirMessage()
|
~UnidirMessage(){
|
||||||
{
|
|
||||||
SDL_DestroyMutex(mutex);
|
SDL_DestroyMutex(mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Done from the sending side */
|
/* Done from the sending side */
|
||||||
void post(const T &value)
|
void post(const T &value){
|
||||||
{
|
|
||||||
SDL_LockMutex(mutex);
|
SDL_LockMutex(mutex);
|
||||||
|
|
||||||
changed.set();
|
changed.set();
|
||||||
|
|
@ -162,8 +152,7 @@ struct UnidirMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Done from the receiving side */
|
/* Done from the receiving side */
|
||||||
bool poll(T &out) const
|
bool poll(T &out) const{
|
||||||
{
|
|
||||||
if (!changed)
|
if (!changed)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -178,8 +167,7 @@ struct UnidirMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Done from either */
|
/* Done from either */
|
||||||
void get(T &out) const
|
void get(T &out) const{
|
||||||
{
|
|
||||||
SDL_LockMutex(mutex);
|
SDL_LockMutex(mutex);
|
||||||
out = current;
|
out = current;
|
||||||
SDL_UnlockMutex(mutex);
|
SDL_UnlockMutex(mutex);
|
||||||
|
|
@ -191,8 +179,7 @@ private:
|
||||||
T current;
|
T current;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SyncPoint
|
struct SyncPoint{
|
||||||
{
|
|
||||||
/* Used by eventFilter to control sleep/wakeup */
|
/* Used by eventFilter to control sleep/wakeup */
|
||||||
void haltThreads();
|
void haltThreads();
|
||||||
void resumeThreads();
|
void resumeThreads();
|
||||||
|
|
@ -205,8 +192,7 @@ struct SyncPoint
|
||||||
void passSecondarySync();
|
void passSecondarySync();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Util
|
struct Util{
|
||||||
{
|
|
||||||
Util();
|
Util();
|
||||||
~Util();
|
~Util();
|
||||||
|
|
||||||
|
|
@ -224,8 +210,7 @@ private:
|
||||||
Util secondSync;
|
Util secondSync;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RGSSThreadData
|
struct RGSSThreadData{
|
||||||
{
|
|
||||||
/* Main thread sets this to request RGSS thread to terminate */
|
/* Main thread sets this to request RGSS thread to terminate */
|
||||||
AtomicFlag rqTerm;
|
AtomicFlag rqTerm;
|
||||||
/* In response, RGSS thread sets this to confirm
|
/* In response, RGSS thread sets this to confirm
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
struct Exception
|
struct Exception{
|
||||||
{
|
enum Type{
|
||||||
enum Type
|
|
||||||
{
|
|
||||||
RGSSError,
|
RGSSError,
|
||||||
NoFileError,
|
NoFileError,
|
||||||
IOError,
|
IOError,
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,7 @@
|
||||||
#include "etc.h"
|
#include "etc.h"
|
||||||
#include "etc-internal.h"
|
#include "etc-internal.h"
|
||||||
|
|
||||||
class Flashable
|
class Flashable{
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
Flashable()
|
Flashable()
|
||||||
: flashColor(0, 0, 0, 0),
|
: flashColor(0, 0, 0, 0),
|
||||||
|
|
@ -36,8 +35,7 @@ public:
|
||||||
|
|
||||||
virtual ~Flashable() {}
|
virtual ~Flashable() {}
|
||||||
|
|
||||||
void flash(const Vec4 *color, int duration)
|
void flash(const Vec4 *color, int duration){
|
||||||
{
|
|
||||||
if (duration < 1)
|
if (duration < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -45,8 +43,7 @@ public:
|
||||||
this->duration = duration;
|
this->duration = duration;
|
||||||
counter = 0;
|
counter = 0;
|
||||||
|
|
||||||
if (!color)
|
if (!color){
|
||||||
{
|
|
||||||
emptyFlashFlag = true;
|
emptyFlashFlag = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -55,13 +52,11 @@ public:
|
||||||
flashAlpha = flashColor.w;
|
flashAlpha = flashColor.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void update()
|
virtual void update(){
|
||||||
{
|
|
||||||
if (!flashing)
|
if (!flashing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (++counter > duration)
|
if (++counter > duration){
|
||||||
{
|
|
||||||
/* Flash finished. Cleanup */
|
/* Flash finished. Cleanup */
|
||||||
flashColor = Vec4(0, 0, 0, 0);
|
flashColor = Vec4(0, 0, 0, 0);
|
||||||
flashing = false;
|
flashing = false;
|
||||||
|
|
|
||||||
|
|
@ -48,16 +48,8 @@ struct GLDebugLoggerPrivate{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void APIENTRY arbDebugFunc(GLenum source,
|
static void APIENTRY arbDebugFunc(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam) {
|
||||||
GLenum type,
|
GLDebugLoggerPrivate *p = static_cast<GLDebugLoggerPrivate*>(const_cast<void*>(userParam));
|
||||||
GLuint id,
|
|
||||||
GLenum severity,
|
|
||||||
GLsizei length,
|
|
||||||
const GLchar* message,
|
|
||||||
const void* userParam)
|
|
||||||
{
|
|
||||||
GLDebugLoggerPrivate *p =
|
|
||||||
static_cast<GLDebugLoggerPrivate*>(const_cast<void*>(userParam));
|
|
||||||
|
|
||||||
(void) source;
|
(void) source;
|
||||||
(void) type;
|
(void) type;
|
||||||
|
|
|
||||||
|
|
@ -33,23 +33,19 @@ typedef uint16_t index_t;
|
||||||
#define INDEX_T_MAX std::numeric_limits<index_t>::max()
|
#define INDEX_T_MAX std::numeric_limits<index_t>::max()
|
||||||
#define _GL_INDEX_TYPE GL_UNSIGNED_SHORT
|
#define _GL_INDEX_TYPE GL_UNSIGNED_SHORT
|
||||||
|
|
||||||
struct GlobalIBO
|
struct GlobalIBO{
|
||||||
{
|
|
||||||
IBO::ID ibo;
|
IBO::ID ibo;
|
||||||
std::vector<index_t> buffer;
|
std::vector<index_t> buffer;
|
||||||
|
|
||||||
GlobalIBO()
|
GlobalIBO(){
|
||||||
{
|
|
||||||
ibo = IBO::gen();
|
ibo = IBO::gen();
|
||||||
}
|
}
|
||||||
|
|
||||||
~GlobalIBO()
|
~GlobalIBO(){
|
||||||
{
|
|
||||||
IBO::del(ibo);
|
IBO::del(ibo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ensureSize(size_t quadCount)
|
void ensureSize(size_t quadCount){
|
||||||
{
|
|
||||||
assert(quadCount*6 < INDEX_T_MAX);
|
assert(quadCount*6 < INDEX_T_MAX);
|
||||||
|
|
||||||
if (buffer.size() >= quadCount*6)
|
if (buffer.size() >= quadCount*6)
|
||||||
|
|
@ -58,8 +54,7 @@ struct GlobalIBO
|
||||||
size_t startInd = buffer.size() / 6;
|
size_t startInd = buffer.size() / 6;
|
||||||
buffer.reserve(quadCount*6);
|
buffer.reserve(quadCount*6);
|
||||||
|
|
||||||
for (size_t i = startInd; i < quadCount; ++i)
|
for (size_t i = startInd; i < quadCount; ++i){
|
||||||
{
|
|
||||||
static const index_t indTemp[] = { 0, 1, 2, 2, 3, 0 };
|
static const index_t indTemp[] = { 0, 1, 2, 2, 3, 0 };
|
||||||
|
|
||||||
for (size_t j = 0; j < 6; ++j)
|
for (size_t j = 0; j < 6; ++j)
|
||||||
|
|
|
||||||
|
|
@ -256,8 +256,7 @@ static const int mapToIndex[] = {
|
||||||
|
|
||||||
static elementsN(mapToIndex);
|
static elementsN(mapToIndex);
|
||||||
|
|
||||||
static const Input::ButtonCode dirs[] =
|
static const Input::ButtonCode dirs[] = { Input::Down, Input::Left, Input::Right, Input::Up };
|
||||||
{ Input::Down, Input::Left, Input::Right, Input::Up };
|
|
||||||
|
|
||||||
static const int dirFlags[] = {
|
static const int dirFlags[] = {
|
||||||
1 << Input::Down,
|
1 << Input::Down,
|
||||||
|
|
|
||||||
12
src/pipe.h
12
src/pipe.h
|
|
@ -17,8 +17,7 @@ public:
|
||||||
Read,
|
Read,
|
||||||
} Mode;
|
} Mode;
|
||||||
|
|
||||||
Pipe()
|
Pipe(){
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
handle = NULL;
|
handle = NULL;
|
||||||
#else
|
#else
|
||||||
|
|
@ -46,8 +45,7 @@ public:
|
||||||
filename = std::string(P_tmpdir) + "/" + name;
|
filename = std::string(P_tmpdir) + "/" + name;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mode == Read)
|
if (mode == Read){
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
handle = CreateFileA(
|
handle = CreateFileA(
|
||||||
filename.c_str(),
|
filename.c_str(),
|
||||||
|
|
@ -98,8 +96,7 @@ public:
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
OVERLAPPED overlapped;
|
OVERLAPPED overlapped;
|
||||||
memset(&overlapped, 0, sizeof(overlapped));
|
memset(&overlapped, 0, sizeof(overlapped));
|
||||||
if (!ReadFile(handle, buf, 1, NULL, &overlapped))
|
if (!ReadFile(handle, buf, 1, NULL, &overlapped)){
|
||||||
{
|
|
||||||
if (GetLastError() == ERROR_IO_PENDING)
|
if (GetLastError() == ERROR_IO_PENDING)
|
||||||
CancelIo(handle);
|
CancelIo(handle);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -118,8 +115,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isOpen()
|
bool isOpen(){
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return handle != NULL;
|
return handle != NULL;
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,7 @@ static bool readUint32(PHYSFS_Io *io, uint32_t &result){
|
||||||
|
|
||||||
#define IO_READ(io, dest, size) (io->read(io, dest, size) == size)
|
#define IO_READ(io, dest, size) (io->read(io, dest, size) == size)
|
||||||
|
|
||||||
static inline uint32_t
|
static inline uint32_t advanceMagic(uint32_t &magic) {
|
||||||
advanceMagic(uint32_t &magic) {
|
|
||||||
uint32_t old = magic;
|
uint32_t old = magic;
|
||||||
|
|
||||||
magic = magic * 7 + 3;
|
magic = magic * 7 + 3;
|
||||||
|
|
@ -91,8 +90,7 @@ advanceMagic(uint32_t &magic) {
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PHYSFS_sint64
|
static PHYSFS_sint64 RGSS_ioRead(PHYSFS_Io *self, void *buffer, PHYSFS_uint64 len) {
|
||||||
RGSS_ioRead(PHYSFS_Io *self, void *buffer, PHYSFS_uint64 len) {
|
|
||||||
RGSS_entryHandle *entry = static_cast<RGSS_entryHandle*>(self->opaque);
|
RGSS_entryHandle *entry = static_cast<RGSS_entryHandle*>(self->opaque);
|
||||||
|
|
||||||
PHYSFS_Io *io = entry->io;
|
PHYSFS_Io *io = entry->io;
|
||||||
|
|
@ -183,8 +181,7 @@ RGSS_ioRead(PHYSFS_Io *self, void *buffer, PHYSFS_uint64 len) {
|
||||||
return toRead;
|
return toRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int RGSS_ioSeek(PHYSFS_Io *self, PHYSFS_uint64 offset){
|
||||||
RGSS_ioSeek(PHYSFS_Io *self, PHYSFS_uint64 offset){
|
|
||||||
RGSS_entryHandle *entry = static_cast<RGSS_entryHandle*>(self->opaque);
|
RGSS_entryHandle *entry = static_cast<RGSS_entryHandle*>(self->opaque);
|
||||||
|
|
||||||
if (offset == entry->currentOffset)
|
if (offset == entry->currentOffset)
|
||||||
|
|
@ -213,23 +210,19 @@ RGSS_ioSeek(PHYSFS_Io *self, PHYSFS_uint64 offset){
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PHYSFS_sint64
|
static PHYSFS_sint64 RGSS_ioTell(PHYSFS_Io *self){
|
||||||
RGSS_ioTell(PHYSFS_Io *self){
|
|
||||||
const RGSS_entryHandle *entry = static_cast<RGSS_entryHandle*>(self->opaque);
|
const RGSS_entryHandle *entry = static_cast<RGSS_entryHandle*>(self->opaque);
|
||||||
|
|
||||||
return entry->currentOffset;
|
return entry->currentOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PHYSFS_sint64
|
static PHYSFS_sint64 RGSS_ioLength(PHYSFS_Io *self){
|
||||||
RGSS_ioLength(PHYSFS_Io *self)
|
|
||||||
{
|
|
||||||
const RGSS_entryHandle *entry = static_cast<RGSS_entryHandle*>(self->opaque);
|
const RGSS_entryHandle *entry = static_cast<RGSS_entryHandle*>(self->opaque);
|
||||||
|
|
||||||
return entry->data.size;
|
return entry->data.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PHYSFS_Io*
|
static PHYSFS_Io* RGSS_ioDuplicate(PHYSFS_Io *self){
|
||||||
RGSS_ioDuplicate(PHYSFS_Io *self){
|
|
||||||
const RGSS_entryHandle *entry = static_cast<RGSS_entryHandle*>(self->opaque);
|
const RGSS_entryHandle *entry = static_cast<RGSS_entryHandle*>(self->opaque);
|
||||||
RGSS_entryHandle *entryDup = new RGSS_entryHandle(*entry);
|
RGSS_entryHandle *entryDup = new RGSS_entryHandle(*entry);
|
||||||
|
|
||||||
|
|
@ -240,8 +233,7 @@ RGSS_ioDuplicate(PHYSFS_Io *self){
|
||||||
return dup;
|
return dup;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void RGSS_ioDestroy(PHYSFS_Io *self){
|
||||||
RGSS_ioDestroy(PHYSFS_Io *self){
|
|
||||||
RGSS_entryHandle *entry = static_cast<RGSS_entryHandle*>(self->opaque);
|
RGSS_entryHandle *entry = static_cast<RGSS_entryHandle*>(self->opaque);
|
||||||
|
|
||||||
delete entry;
|
delete entry;
|
||||||
|
|
@ -262,13 +254,9 @@ static const PHYSFS_Io RGSS_IoTemplate ={
|
||||||
RGSS_ioDestroy
|
RGSS_ioDestroy
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void processDirectories(RGSS_archiveData *data, BoostSet<std::string> &topLevel, char *nameBuf, uint32_t nameLen){
|
||||||
processDirectories(RGSS_archiveData *data, BoostSet<std::string> &topLevel,
|
|
||||||
char *nameBuf, uint32_t nameLen)
|
|
||||||
{
|
|
||||||
/* Check for top level entries */
|
/* Check for top level entries */
|
||||||
for (uint32_t i = 0; i < nameLen; ++i)
|
for (uint32_t i = 0; i < nameLen; ++i){
|
||||||
{
|
|
||||||
bool slash = nameBuf[i] == '/';
|
bool slash = nameBuf[i] == '/';
|
||||||
if (!slash && i+1 < nameLen)
|
if (!slash && i+1 < nameLen)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -297,8 +285,7 @@ processDirectories(RGSS_archiveData *data, BoostSet<std::string> &topLevel,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool verifyHeader(PHYSFS_Io *io, char version){
|
||||||
verifyHeader(PHYSFS_Io *io, char version){
|
|
||||||
char header[8];
|
char header[8];
|
||||||
|
|
||||||
if (!IO_READ(io, header, sizeof(header)))
|
if (!IO_READ(io, header, sizeof(header)))
|
||||||
|
|
@ -313,8 +300,7 @@ verifyHeader(PHYSFS_Io *io, char version){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void*
|
static void* RGSS_openArchive(PHYSFS_Io *io, const char *, int forWrite, int *claimed){
|
||||||
RGSS_openArchive(PHYSFS_Io *io, const char *, int forWrite, int *claimed){
|
|
||||||
if (forWrite)
|
if (forWrite)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -371,11 +357,7 @@ RGSS_openArchive(PHYSFS_Io *io, const char *, int forWrite, int *claimed){
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PHYSFS_EnumerateCallbackResult
|
static PHYSFS_EnumerateCallbackResult RGSS_enumerateFiles(void *opaque, const char *dirname, PHYSFS_EnumerateCallback cb, const char *origdir, void *callbackdata) {
|
||||||
RGSS_enumerateFiles(void *opaque, const char *dirname,
|
|
||||||
PHYSFS_EnumerateCallback cb,
|
|
||||||
const char *origdir, void *callbackdata)
|
|
||||||
{
|
|
||||||
RGSS_archiveData *data = static_cast<RGSS_archiveData*>(opaque);
|
RGSS_archiveData *data = static_cast<RGSS_archiveData*>(opaque);
|
||||||
|
|
||||||
std::string _dirname(dirname);
|
std::string _dirname(dirname);
|
||||||
|
|
@ -392,8 +374,7 @@ RGSS_enumerateFiles(void *opaque, const char *dirname,
|
||||||
return PHYSFS_ENUM_OK;
|
return PHYSFS_ENUM_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PHYSFS_Io*
|
static PHYSFS_Io* RGSS_openRead(void *opaque, const char *filename){
|
||||||
RGSS_openRead(void *opaque, const char *filename){
|
|
||||||
RGSS_archiveData *data = static_cast<RGSS_archiveData*>(opaque);
|
RGSS_archiveData *data = static_cast<RGSS_archiveData*>(opaque);
|
||||||
|
|
||||||
if (!data->entryHash.contains(filename))
|
if (!data->entryHash.contains(filename))
|
||||||
|
|
@ -410,8 +391,7 @@ RGSS_openRead(void *opaque, const char *filename){
|
||||||
return io;
|
return io;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int RGSS_stat(void *opaque, const char *filename, PHYSFS_Stat *stat){
|
||||||
RGSS_stat(void *opaque, const char *filename, PHYSFS_Stat *stat){
|
|
||||||
RGSS_archiveData *data = static_cast<RGSS_archiveData*>(opaque);
|
RGSS_archiveData *data = static_cast<RGSS_archiveData*>(opaque);
|
||||||
|
|
||||||
bool hasFile = data->entryHash.contains(filename);
|
bool hasFile = data->entryHash.contains(filename);
|
||||||
|
|
@ -440,20 +420,17 @@ RGSS_stat(void *opaque, const char *filename, PHYSFS_Stat *stat){
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void RGSS_closeArchive(void *opaque){
|
||||||
RGSS_closeArchive(void *opaque){
|
|
||||||
RGSS_archiveData *data = static_cast<RGSS_archiveData*>(opaque);
|
RGSS_archiveData *data = static_cast<RGSS_archiveData*>(opaque);
|
||||||
|
|
||||||
delete data;
|
delete data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PHYSFS_Io*
|
static PHYSFS_Io* RGSS_noop1(void*, const char*){
|
||||||
RGSS_noop1(void*, const char*){
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int RGSS_noop2(void*, const char*){
|
||||||
RGSS_noop2(void*, const char*){
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -497,8 +474,7 @@ const PHYSFS_Archiver RGSS2_Archiver = {
|
||||||
RGSS_closeArchive
|
RGSS_closeArchive
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool
|
static bool readUint32AndXor(PHYSFS_Io *io, uint32_t &result, uint32_t key){
|
||||||
readUint32AndXor(PHYSFS_Io *io, uint32_t &result, uint32_t key){
|
|
||||||
if (!readUint32(io, result))
|
if (!readUint32(io, result))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -507,8 +483,7 @@ readUint32AndXor(PHYSFS_Io *io, uint32_t &result, uint32_t key){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void*
|
static void* RGSS3_openArchive(PHYSFS_Io *io, const char *, int forWrite, int *claimed){
|
||||||
RGSS3_openArchive(PHYSFS_Io *io, const char *, int forWrite, int *claimed){
|
|
||||||
if (forWrite)
|
if (forWrite)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
static void showInitError(const std::string &msg){
|
static void showInitError(const std::string &msg){
|
||||||
Debug() << msg;
|
Debug() << msg;
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "OneShot: sunshine", msg.c_str(), 0);
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Sunshine Error", msg.c_str(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool readMessage(Pipe &ipc, char *buf, size_t size){
|
static bool readMessage(Pipe &ipc, char *buf, size_t size){
|
||||||
|
|
|
||||||
|
|
@ -108,10 +108,6 @@ struct SDLSoundSource : ALDataSource{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ALDataSource *createSDLSource(SDL_IOStream &ops,
|
ALDataSource *createSDLSource(SDL_IOStream &ops, const char *extension, uint32_t maxBufSize, bool looped) {
|
||||||
const char *extension,
|
|
||||||
uint32_t maxBufSize,
|
|
||||||
bool looped)
|
|
||||||
{
|
|
||||||
return new SDLSoundSource(ops, extension, maxBufSize, looped);
|
return new SDLSoundSource(ops, extension, maxBufSize, looped);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,7 @@
|
||||||
#error "Non little endian systems not supported"
|
#error "Non little endian systems not supported"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline int32_t
|
static inline int32_t readInt32(const char **dataP){
|
||||||
readInt32(const char **dataP){
|
|
||||||
int32_t result;
|
int32_t result;
|
||||||
|
|
||||||
memcpy(&result, *dataP, 4);
|
memcpy(&result, *dataP, 4);
|
||||||
|
|
@ -41,8 +40,7 @@ readInt32(const char **dataP){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline double
|
static inline double readDouble(const char **dataP){
|
||||||
readDouble(const char **dataP){
|
|
||||||
double result;
|
double result;
|
||||||
|
|
||||||
memcpy(&result, *dataP, 8);
|
memcpy(&result, *dataP, 8);
|
||||||
|
|
@ -51,14 +49,12 @@ readDouble(const char **dataP){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void writeInt32(char **dataP, int32_t value){
|
||||||
writeInt32(char **dataP, int32_t value){
|
|
||||||
memcpy(*dataP, &value, 4);
|
memcpy(*dataP, &value, 4);
|
||||||
*dataP += 4;
|
*dataP += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void writeDouble(char **dataP, double value){
|
||||||
writeDouble(char **dataP, double value){
|
|
||||||
memcpy(*dataP, &value, 8);
|
memcpy(*dataP, &value, 8);
|
||||||
*dataP += 8;
|
*dataP += 8;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -388,9 +388,7 @@ struct SettingsMenuPrivate{
|
||||||
SDL_FillSurfaceRect(surf, 0, SDL_MapSurfaceRGBA(surf, grey, grey, grey, 255));
|
SDL_FillSurfaceRect(surf, 0, SDL_MapSurfaceRGBA(surf, grey, grey, grey, 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
void fillRect(SDL_Surface *surf,
|
void fillRect(SDL_Surface *surf, int x, int y, int w, int h, uint8_t r, uint8_t g, uint8_t b){
|
||||||
int x, int y, int w, int h,
|
|
||||||
uint8_t r, uint8_t g, uint8_t b){
|
|
||||||
SDL_Rect rect = { drawOff.x+x, drawOff.y+y, w, h };
|
SDL_Rect rect = { drawOff.x+x, drawOff.y+y, w, h };
|
||||||
SDL_FillSurfaceRect(surf, &rect, SDL_MapSurfaceRGB(surf, r, g, b));
|
SDL_FillSurfaceRect(surf, &rect, SDL_MapSurfaceRGB(surf, r, g, b));
|
||||||
}
|
}
|
||||||
|
|
@ -415,9 +413,7 @@ struct SettingsMenuPrivate{
|
||||||
fillRect(surf, r, g, b, x-width/2, y, width, length);
|
fillRect(surf, r, g, b, x-width/2, y, width, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void strokeRect(SDL_Surface *surf, uint8_t grey,
|
void strokeRect(SDL_Surface *surf, uint8_t grey, int x, int y, int w, int h, int lineW){
|
||||||
int x, int y, int w, int h,
|
|
||||||
int lineW){
|
|
||||||
strokeLineH(surf, grey, x, y, w, lineW);
|
strokeLineH(surf, grey, x, y, w, lineW);
|
||||||
strokeLineH(surf, grey, x, y+h, w, lineW);
|
strokeLineH(surf, grey, x, y+h, w, lineW);
|
||||||
|
|
||||||
|
|
@ -425,18 +421,14 @@ struct SettingsMenuPrivate{
|
||||||
strokeLineV(surf, grey, x+w, y, h, lineW);
|
strokeLineV(surf, grey, x+w, y, h, lineW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void strokeRectInner(SDL_Surface *surf,
|
void strokeRectInner(SDL_Surface *surf, int x, int y, int w, int h, int lineW, uint8_t r, uint8_t g, uint8_t b){
|
||||||
int x, int y, int w, int h, int lineW,
|
|
||||||
uint8_t r, uint8_t g, uint8_t b){
|
|
||||||
fillRect(surf, x, y, w, lineW, r, g, b);
|
fillRect(surf, x, y, w, lineW, r, g, b);
|
||||||
fillRect(surf, x, y+h-lineW, w, lineW, r, g, b);
|
fillRect(surf, x, y+h-lineW, w, lineW, r, g, b);
|
||||||
fillRect(surf, x, y, lineW, h, r, g, b);
|
fillRect(surf, x, y, lineW, h, r, g, b);
|
||||||
fillRect(surf, x+w-lineW, y, lineW, h, r, g ,b);
|
fillRect(surf, x+w-lineW, y, lineW, h, r, g ,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
void strokeRectInner(SDL_Surface *surf, uint8_t grey,
|
void strokeRectInner(SDL_Surface *surf, uint8_t grey, int x, int y, int w, int h, int lineW){
|
||||||
int x, int y, int w, int h,
|
|
||||||
int lineW){
|
|
||||||
strokeRectInner(surf, x, y, w, h, lineW, grey, grey, grey);
|
strokeRectInner(surf, x, y, w, h, lineW, grey, grey, grey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -460,10 +452,7 @@ struct SettingsMenuPrivate{
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Horizontally centered */
|
/* Horizontally centered */
|
||||||
void blitTextSurf(SDL_Surface *surf, int x, int y,
|
void blitTextSurf(SDL_Surface *surf, int x, int y, int alignW, SDL_Surface *txtSurf, Justification just){
|
||||||
int alignW, SDL_Surface *txtSurf,
|
|
||||||
Justification just)
|
|
||||||
{
|
|
||||||
SDL_Rect dstRect;
|
SDL_Rect dstRect;
|
||||||
dstRect.x = drawOff.x;
|
dstRect.x = drawOff.x;
|
||||||
dstRect.y = drawOff.y + y - txtSurf->h / 2;
|
dstRect.y = drawOff.y + y - txtSurf->h / 2;
|
||||||
|
|
@ -581,9 +570,7 @@ struct SettingsMenuPrivate{
|
||||||
|
|
||||||
if (state == AwaitingInput){
|
if (state == AwaitingInput){
|
||||||
char buf[64];
|
char buf[64];
|
||||||
snprintf(buf, sizeof(buf), findtext(TRSTR_KEYBIND_KEYPROMPT,
|
snprintf(buf, sizeof(buf), findtext(TRSTR_KEYBIND_KEYPROMPT, "Press key or joystick button for \"%s\""), captureName);
|
||||||
"Press key or joystick button for \"%s\""),
|
|
||||||
captureName);
|
|
||||||
|
|
||||||
drawOff = Vec2i();
|
drawOff = Vec2i();
|
||||||
|
|
||||||
|
|
@ -622,8 +609,7 @@ struct SettingsMenuPrivate{
|
||||||
Widget *w = 0;
|
Widget *w = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < widgets.size(); ++i)
|
for (size_t i = 0; i < widgets.size(); ++i)
|
||||||
if (widgets[i]->hit(x, y))
|
if (widgets[i]->hit(x, y)){
|
||||||
{
|
|
||||||
w = widgets[i];
|
w = widgets[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -653,8 +639,7 @@ struct SettingsMenuPrivate{
|
||||||
|
|
||||||
Widget *w = findWidget(e.x, e.y);
|
Widget *w = findWidget(e.x, e.y);
|
||||||
|
|
||||||
if (w != hovered)
|
if (w != hovered){
|
||||||
{
|
|
||||||
if (hovered)
|
if (hovered)
|
||||||
hovered->leave();
|
hovered->leave();
|
||||||
hovered = w;
|
hovered = w;
|
||||||
|
|
@ -1002,8 +987,7 @@ SettingsMenu::SettingsMenu(RGSSThreadData &rtData){
|
||||||
const int bWidgetY = winSize.y - layoutH*bWidgetH - 48;
|
const int bWidgetY = winSize.y - layoutH*bWidgetH - 48;
|
||||||
|
|
||||||
for (int y = 0; y < (int)(layoutH); ++y)
|
for (int y = 0; y < (int)(layoutH); ++y)
|
||||||
for (int x = 0; x < (int)(layoutW); ++x)
|
for (int x = 0; x < (int)(layoutW); ++x){
|
||||||
{
|
|
||||||
int i = x*layoutH+y;
|
int i = x*layoutH+y;
|
||||||
BindingWidget w(i, p, IntRect(x*bWidgetW, bWidgetY+y*bWidgetH,
|
BindingWidget w(i, p, IntRect(x*bWidgetW, bWidgetY+y*bWidgetH,
|
||||||
bWidgetW, bWidgetH));
|
bWidgetW, bWidgetH));
|
||||||
|
|
|
||||||
|
|
@ -137,11 +137,7 @@ static void setupShaderSource(GLuint shader, GLenum type,
|
||||||
gl.ShaderSource(shader, i, shaderSrc, shaderSrcSize);
|
gl.ShaderSource(shader, i, shaderSrc, shaderSrcSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shader::init(const unsigned char *vert, int vertSize,
|
void Shader::init(const unsigned char *vert, int vertSize, const unsigned char *frag, int fragSize, const char *vertName, const char *fragName, const char *programName) {
|
||||||
const unsigned char *frag, int fragSize,
|
|
||||||
const char *vertName, const char *fragName,
|
|
||||||
const char *programName)
|
|
||||||
{
|
|
||||||
GLint success;
|
GLint success;
|
||||||
|
|
||||||
/* Compile vertex shader */
|
/* Compile vertex shader */
|
||||||
|
|
@ -152,9 +148,7 @@ void Shader::init(const unsigned char *vert, int vertSize,
|
||||||
|
|
||||||
if (!success){
|
if (!success){
|
||||||
printShaderLog(vertShader);
|
printShaderLog(vertShader);
|
||||||
throw Exception(Exception::MKXPError,
|
throw Exception(Exception::MKXPError, "GLSL: An error occured while compiling vertex shader '%s' in program '%s'", vertName, programName);
|
||||||
"GLSL: An error occured while compiling vertex shader '%s' in program '%s'",
|
|
||||||
vertName, programName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compile fragment shader */
|
/* Compile fragment shader */
|
||||||
|
|
@ -165,9 +159,7 @@ void Shader::init(const unsigned char *vert, int vertSize,
|
||||||
|
|
||||||
if (!success){
|
if (!success){
|
||||||
printShaderLog(fragShader);
|
printShaderLog(fragShader);
|
||||||
throw Exception(Exception::MKXPError,
|
throw Exception(Exception::MKXPError, "GLSL: An error occured while compiling fragment shader '%s' in program '%s'", fragName, programName);
|
||||||
"GLSL: An error occured while compiling fragment shader '%s' in program '%s'",
|
|
||||||
fragName, programName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Link shader program */
|
/* Link shader program */
|
||||||
|
|
@ -184,9 +176,7 @@ void Shader::init(const unsigned char *vert, int vertSize,
|
||||||
|
|
||||||
if (!success){
|
if (!success){
|
||||||
printProgramLog(program);
|
printProgramLog(program);
|
||||||
throw Exception(Exception::MKXPError,
|
throw Exception(Exception::MKXPError, "GLSL: An error occured while linking program '%s' (vertex '%s', fragment '%s')", programName, vertName, fragName);
|
||||||
"GLSL: An error occured while linking program '%s' (vertex '%s', fragment '%s')",
|
|
||||||
programName, vertName, fragName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -219,8 +209,7 @@ void ShaderBase::GLProjMat::apply(const Vec2i &value) {
|
||||||
const float b = 2.f / value.y;
|
const float b = 2.f / value.y;
|
||||||
const float c = -2.f;
|
const float c = -2.f;
|
||||||
|
|
||||||
GLfloat mat[16] =
|
GLfloat mat[16] = {
|
||||||
{
|
|
||||||
a, 0, 0, 0,
|
a, 0, 0, 0,
|
||||||
0, b, 0, 0,
|
0, b, 0, 0,
|
||||||
0, 0, c, 0,
|
0, 0, c, 0,
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,7 @@ struct SoundBuffer{
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~SoundBuffer()
|
~SoundBuffer(){
|
||||||
{
|
|
||||||
AL::Buffer::del(alBuffer);
|
AL::Buffer::del(alBuffer);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -112,10 +111,7 @@ SoundEmitter::~SoundEmitter(){
|
||||||
SoundBuffer::deref(iter->second);
|
SoundBuffer::deref(iter->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundEmitter::play(const std::string &filename,
|
void SoundEmitter::play(const std::string &filename, int volume, int pitch) {
|
||||||
int volume,
|
|
||||||
int pitch)
|
|
||||||
{
|
|
||||||
float _volume = clamp<int>(volume, 0, 100) / 100.0f;
|
float _volume = clamp<int>(volume, 0, 100) / 100.0f;
|
||||||
float _pitch = clamp<int>(pitch, 50, 150) / 100.0f;
|
float _pitch = clamp<int>(pitch, 50, 150) / 100.0f;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -126,9 +126,7 @@ struct SpritePrivate{
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Calculate effective (normalized) bush depth */
|
/* Calculate effective (normalized) bush depth */
|
||||||
float texBushDepth = (bushDepth / trans.getScale().y) -
|
float texBushDepth = (bushDepth / trans.getScale().y) - (srcRect->y + srcRect->height) + bitmap->height();
|
||||||
(srcRect->y + srcRect->height) +
|
|
||||||
bitmap->height();
|
|
||||||
|
|
||||||
efBushDepth = 1.0f - texBushDepth / bitmap->height();
|
efBushDepth = 1.0f - texBushDepth / bitmap->height();
|
||||||
}
|
}
|
||||||
|
|
@ -157,8 +155,7 @@ struct SpritePrivate{
|
||||||
/* Cut old connection */
|
/* Cut old connection */
|
||||||
srcRectCon.disconnect();
|
srcRectCon.disconnect();
|
||||||
/* Create new one */
|
/* Create new one */
|
||||||
srcRectCon = srcRect->valueChanged.connect
|
srcRectCon = srcRect->valueChanged.connect(sigc::mem_fun(this, &SpritePrivate::onSrcRectChange));
|
||||||
(sigc::mem_fun(this, &SpritePrivate::onSrcRectChange));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateVisibility(){
|
void updateVisibility(){
|
||||||
|
|
@ -355,8 +352,7 @@ void Sprite::setY(int value){
|
||||||
|
|
||||||
p->trans.setPosition(Vec2(getX(), value));
|
p->trans.setPosition(Vec2(getX(), value));
|
||||||
|
|
||||||
if (rgssVer >= 2)
|
if (rgssVer >= 2){
|
||||||
{
|
|
||||||
p->wave.dirty = true;
|
p->wave.dirty = true;
|
||||||
setSpriteY(value);
|
setSpriteY(value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,7 @@ int16_t Table::get(int x, int y, int z) const{
|
||||||
void Table::set(int16_t value, int x, int y, int z){
|
void Table::set(int16_t value, int x, int y, int z){
|
||||||
if (x < 0 || x >= xs
|
if (x < 0 || x >= xs
|
||||||
|| y < 0 || y >= ys
|
|| y < 0 || y >= ys
|
||||||
|| z < 0 || z >= zs)
|
|| z < 0 || z >= zs){
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,10 +82,7 @@ TexPool::TexPool(uint32_t maxMemSize){
|
||||||
TexPool::~TexPool(){
|
TexPool::~TexPool(){
|
||||||
std::list<TEXFBO>::iterator iter;
|
std::list<TEXFBO>::iterator iter;
|
||||||
|
|
||||||
for (iter = p->priorityQueue.begin();
|
for (iter = p->priorityQueue.begin(); iter != p->priorityQueue.end(); ++iter) {
|
||||||
iter != p->priorityQueue.end();
|
|
||||||
++iter)
|
|
||||||
{
|
|
||||||
TEXFBO obj = *iter;
|
TEXFBO obj = *iter;
|
||||||
TEXFBO::fini(obj);
|
TEXFBO::fini(obj);
|
||||||
--p->objCount;
|
--p->objCount;
|
||||||
|
|
@ -120,9 +117,7 @@ TEXFBO TexPool::request(int width, int height){
|
||||||
|
|
||||||
int maxSize = glState.caps.maxTexSize;
|
int maxSize = glState.caps.maxTexSize;
|
||||||
if (width > maxSize || height > maxSize)
|
if (width > maxSize || height > maxSize)
|
||||||
throw Exception(Exception::MKXPError,
|
throw Exception(Exception::MKXPError, "Texture dimensions [%d, %d] exceed hardware capabilities", width, height);
|
||||||
"Texture dimensions [%d, %d] exceed hardware capabilities",
|
|
||||||
width, height);
|
|
||||||
|
|
||||||
/* Nope, create it instead */
|
/* Nope, create it instead */
|
||||||
TEXFBO::init(cnode.obj);
|
TEXFBO::init(cnode.obj);
|
||||||
|
|
|
||||||
|
|
@ -45,14 +45,11 @@ static inline int wrap(int value, int range){
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Vec2i wrap(const Vec2i &value, int range){
|
static inline Vec2i wrap(const Vec2i &value, int range){
|
||||||
return Vec2i(wrap(value.x, range),
|
return Vec2i(wrap(value.x, range), wrap(value.y, range));
|
||||||
wrap(value.y, range));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int16_t tableGetWrapped(const Table &t, int x, int y, int z = 0){
|
static inline int16_t tableGetWrapped(const Table &t, int x, int y, int z = 0){
|
||||||
return t.get(wrap(x, t.xSize()),
|
return t.get(wrap(x, t.xSize()), wrap(y, t.ySize()), z);
|
||||||
wrap(y, t.ySize()),
|
|
||||||
z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the tile x/y on which this pixel x/y lies */
|
/* Calculate the tile x/y on which this pixel x/y lies */
|
||||||
|
|
|
||||||
|
|
@ -400,8 +400,7 @@ struct TilemapPrivate {
|
||||||
atlas.size = TileAtlas::minSize(atlas.efTilesetH, glState.caps.maxTexSize);
|
atlas.size = TileAtlas::minSize(atlas.efTilesetH, glState.caps.maxTexSize);
|
||||||
|
|
||||||
if (atlas.size.x < 0)
|
if (atlas.size.x < 0)
|
||||||
throw Exception(Exception::MKXPError,
|
throw Exception(Exception::MKXPError, "Cannot allocate big enough texture for tileset atlas");
|
||||||
"Cannot allocate big enough texture for tileset atlas");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateAutotileInfo(){
|
void updateAutotileInfo(){
|
||||||
|
|
@ -792,8 +791,7 @@ struct TilemapPrivate {
|
||||||
ZLayer *prev = elem.zlayers[0];
|
ZLayer *prev = elem.zlayers[0];
|
||||||
prev->finiUpdateZ(0);
|
prev->finiUpdateZ(0);
|
||||||
|
|
||||||
for (size_t i = 1; i < elem.activeLayers; ++i)
|
for (size_t i = 1; i < elem.activeLayers; ++i){
|
||||||
{
|
|
||||||
ZLayer *layer = elem.zlayers[i];
|
ZLayer *layer = elem.zlayers[i];
|
||||||
layer->finiUpdateZ(prev);
|
layer->finiUpdateZ(prev);
|
||||||
prev = layer;
|
prev = layer;
|
||||||
|
|
@ -1006,12 +1004,10 @@ void Tilemap::Autotiles::set(int i, Bitmap *bitmap){
|
||||||
p->invalidateAtlasContents();
|
p->invalidateAtlasContents();
|
||||||
|
|
||||||
p->autotilesCon[i].disconnect();
|
p->autotilesCon[i].disconnect();
|
||||||
p->autotilesCon[i] = bitmap->modified.connect
|
p->autotilesCon[i] = bitmap->modified.connect(sigc::mem_fun(p, &TilemapPrivate::invalidateAtlasContents));
|
||||||
(sigc::mem_fun(p, &TilemapPrivate::invalidateAtlasContents));
|
|
||||||
|
|
||||||
p->autotilesDispCon[i].disconnect();
|
p->autotilesDispCon[i].disconnect();
|
||||||
p->autotilesDispCon[i] = bitmap->wasDisposed.connect
|
p->autotilesDispCon[i] = bitmap->wasDisposed.connect(sigc::mem_fun(p, &TilemapPrivate::invalidateAtlasContents));
|
||||||
(sigc::mem_fun(p, &TilemapPrivate::invalidateAtlasContents));
|
|
||||||
|
|
||||||
p->updateAutotileInfo();
|
p->updateAutotileInfo();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,7 @@ static inline T clamp(T value, T min, T max){
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int findNextPow2(int start){
|
||||||
findNextPow2(int start){
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
while (i < start)
|
while (i < start)
|
||||||
i <<= 1;
|
i <<= 1;
|
||||||
|
|
|
||||||
|
|
@ -80,8 +80,7 @@ struct VorbisSource : ALDataSource{
|
||||||
|
|
||||||
if (error){
|
if (error){
|
||||||
SDL_CloseIO(&src);
|
SDL_CloseIO(&src);
|
||||||
throw Exception(Exception::MKXPError,
|
throw Exception(Exception::MKXPError, "Vorbisfile: Cannot read ogg file");
|
||||||
"Vorbisfile: Cannot read ogg file");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract bitstream info */
|
/* Extract bitstream info */
|
||||||
|
|
@ -91,8 +90,7 @@ struct VorbisSource : ALDataSource{
|
||||||
if (info.channels > 2){
|
if (info.channels > 2){
|
||||||
ov_clear(&vf);
|
ov_clear(&vf);
|
||||||
SDL_CloseIO(&src);
|
SDL_CloseIO(&src);
|
||||||
throw Exception(Exception::MKXPError,
|
throw Exception(Exception::MKXPError, "Cannot handle audio with more than 2 channels");
|
||||||
"Cannot handle audio with more than 2 channels");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
info.alFormat = chooseALFormat(sizeof(int16_t), info.channels);
|
info.alFormat = chooseALFormat(sizeof(int16_t), info.channels);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue