diff --git a/src/sharedstate.cpp b/src/sharedstate.cpp index 18ef7f1..c19cc34 100644 --- a/src/sharedstate.cpp +++ b/src/sharedstate.cpp @@ -222,8 +222,7 @@ GlobalIBO &SharedState::globalIBO(){ void SharedState::bindTex(){ TEX::bind(p->globalTex); - if (p->globalTexDirty) - { + if (p->globalTexDirty){ TEX::allocEmpty(p->globalTexW, p->globalTexH); p->globalTexDirty = false; } diff --git a/src/soundemitter.cpp b/src/soundemitter.cpp index 88eb695..cd9a2f1 100644 --- a/src/soundemitter.cpp +++ b/src/soundemitter.cpp @@ -57,7 +57,6 @@ struct SoundBuffer{ static SoundBuffer *ref(SoundBuffer *buffer){ ++buffer->refCount; - return buffer; } diff --git a/src/tileatlas.cpp b/src/tileatlas.cpp index b3521d0..f44b36a 100644 --- a/src/tileatlas.cpp +++ b/src/tileatlas.cpp @@ -44,8 +44,8 @@ static const int atAreaH = 128*7 + atBuffer; /* Autotile area */ static const int atArea = atAreaW * atAreaH; -static const int tilesetW = 256; -static const int tsLaneW = tilesetW / 2; +static const unsigned short tilesetW = 256; +static const unsigned short tsLaneW = tilesetW / 2; static int freeArea(int width, int height){ return width * height - atArea; diff --git a/src/tilemap.cpp b/src/tilemap.cpp index bcb08fc..65a406f 100644 --- a/src/tilemap.cpp +++ b/src/tilemap.cpp @@ -56,7 +56,7 @@ static const int tilesetW = 8 * 32; static const int autotileW = 3 * 32; static const int autotileH = 4 * 32; -static const int autotileCount = 7; +static const unsigned char autotileCount = 7; static const int atAreaW = autotileW * 4; static const int atAreaH = autotileH * autotileCount; @@ -64,8 +64,8 @@ static const int atAreaH = autotileH * autotileCount; static const int tsLaneW = tilesetW / 2; /* Map viewport size */ //TODO: разные значения под разные разрешения экрана для оптимизации -static const int viewpW = 42; -static const int viewpH = 26; +static const char viewpW = 42; +static const char viewpH = 26; static const size_t zlayersMax = viewpH + 5; @@ -973,7 +973,7 @@ void ZLayer::drawInt(){ } int ZLayer::calculateZ(TilemapPrivate *p, int index){ - return 32 * (index + p->viewpPos.y + 1) - p->origin.y; + return 32 * (index + p->viewpPos.y + 1) - p->origin.y; } void ZLayer::initUpdateZ(){ diff --git a/src/tilequad.cpp b/src/tilequad.cpp index de6b359..c9d2429 100644 --- a/src/tilequad.cpp +++ b/src/tilequad.cpp @@ -37,8 +37,7 @@ int oneDimCount(int tileDimension, int destDimension){ } int twoDimCount(int tileW, int tileH, int destW, int destH) { - return oneDimCount(tileW, destW) * - oneDimCount(tileH, destH); + return oneDimCount(tileW, destW) * oneDimCount(tileH, destH); } int buildH(const IntRect &sourceRect, int width, int x, int y, Vertex *verts){ @@ -52,8 +51,7 @@ int buildH(const IntRect &sourceRect, int width, int x, int y, Vertex *verts){ FloatRect destRect(x, y, sourceRect.w, sourceRect.h); /* Full size quads */ - for (int x = 0; x < fullCount; ++x) - { + for (int x = 0; x < fullCount; ++x){ Vertex *vert = &verts[x*4]; Quad::setTexRect(vert, _sourceRect); @@ -62,8 +60,7 @@ int buildH(const IntRect &sourceRect, int width, int x, int y, Vertex *verts){ destRect.x += sourceRect.w; } - if (partSize) - { + if (partSize){ Vertex *vert = &verts[fullCount*4]; _sourceRect.w = partSize; @@ -87,8 +84,7 @@ int buildV(const IntRect &sourceRect, int height, int ox, int oy, Vertex *verts) FloatRect destRect(ox, oy, sourceRect.w, sourceRect.h); /* Full size quads */ - for (int y = 0; y < fullCount; ++y) - { + for (int y = 0; y < fullCount; ++y){ Vertex *vert = &verts[y*4]; Quad::setTexRect(vert, _sourceRect); @@ -97,8 +93,7 @@ int buildV(const IntRect &sourceRect, int height, int ox, int oy, Vertex *verts) destRect.y += sourceRect.h; } - if (partSize) - { + if (partSize){ Vertex *vert = &verts[fullCount*4]; _sourceRect.h = partSize; @@ -128,16 +123,14 @@ int build(const IntRect &sourceRect, const IntRect &destRect, Vertex *verts) { int qCount = 0; int v = 0; - for (int i = 0; i < fullCount; ++i) - { + for (int i = 0; i < fullCount; ++i){ qCount += buildH(sourceRect, width, ox, oy, &verts[v]); v += rowTileCount*4; oy += sourceRect.h; } - if (partSize) - { + if (partSize){ IntRect partSourceRect = sourceRect; partSourceRect.h = partSize; diff --git a/src/util.h b/src/util.h index ba6cfd1..5c74c80 100644 --- a/src/util.h +++ b/src/util.h @@ -27,8 +27,7 @@ #include #include -static inline int -wrapRange(int value, int min, int max){ +static inline int wrapRange(int value, int min, int max){ if (value >= min && value <= max) return value; diff --git a/src/viewport.cpp b/src/viewport.cpp index 5a47121..083621d 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -75,11 +75,9 @@ struct ViewportPrivate{ } void recomputeOnScreen(){ - SDL_Rect r1 = { screenRect.x, screenRect.y, - screenRect.w, screenRect.h }; + SDL_Rect r1 = { screenRect.x, screenRect.y, screenRect.w, screenRect.h }; - SDL_Rect r2 = { rect->x, rect->y, - rect->width, rect->height }; + SDL_Rect r2 = { rect->x, rect->y, rect->width, rect->height }; SDL_Rect result; isOnScreen = SDL_GetRectIntersection(&r1, &r2, &result); diff --git a/src/vorbissource.cpp b/src/vorbissource.cpp index 690cecd..b10f743 100644 --- a/src/vorbissource.cpp +++ b/src/vorbissource.cpp @@ -28,7 +28,6 @@ #include static size_t vfRead(void *ptr, size_t size, size_t nmemb, void *datasource) { - //size_t SDL_ReadIO(SDL_IOStream *context, void *ptr, size_t size); return SDL_ReadIO(static_cast(datasource), ptr, size); } @@ -44,7 +43,7 @@ static ov_callbacks OvCallbacks ={ vfRead, vfSeek, 0, - vfTell + vfTell }; struct VorbisSource : ALDataSource{ @@ -63,7 +62,7 @@ struct VorbisSource : ALDataSource{ } loop; struct{ - int channels; + unsigned short channels; int rate; int frameSize; ALenum alFormat; @@ -176,8 +175,7 @@ struct VorbisSource : ALDataSource{ } while (canRead > 16){ - long res = ov_read(&vf, static_cast(bufPtr), - canRead, 0, sizeof(int16_t), 1, 0); + long res = ov_read(&vf, static_cast(bufPtr), canRead, 0, sizeof(int16_t), 1, 0); if (res < 0){ /* Read error */