lbreakouthd: update to 1.1.9, adopt

This commit is contained in:
Mihail Ivanchev 2023-12-31 11:41:10 +01:00 committed by classabbyamp
parent 4d9397f355
commit 6c7462e4e9
3 changed files with 23 additions and 747 deletions

View File

@ -1,743 +0,0 @@
uint is not portable, use unsigned int instead. Fixes musl.
--xtraeme
--- a/src/clientgame.cpp 2018-12-21 19:43:51.000000000 +0100
+++ b/src/clientgame.cpp 2019-06-10 11:04:25.230551850 +0200
@@ -88,7 +88,7 @@ int ClientGame::init(const string& setna
ClientPlayer *ClientGame::getNextPlayer()
{
ClientPlayer *p = NULL;
- uint startId = curPlayer;
+ unsigned int startId = curPlayer;
do {
curPlayer++;
@@ -107,7 +107,7 @@ ClientPlayer *ClientGame::getNextPlayer(
* pis is what controls have been activated
* return flags what has to be rendered new
*/
-int ClientGame::update(uint ms, double rx, PaddleInputState &pis)
+int ClientGame::update(unsigned int ms, double rx, PaddleInputState &pis)
{
int oldScore = game->paddles[0]->score;
int ret = 0;
--- a/src/clientgame.h 2019-03-07 15:36:01.000000000 +0100
+++ b/src/clientgame.h 2019-06-10 11:04:25.226551802 +0200
@@ -21,19 +21,19 @@
class ClientPlayer {
string name;
- uint lives;
- uint maxLives;
+ unsigned int lives;
+ unsigned int maxLives;
int score;
- uint level;
+ unsigned int level;
Level snapshot;
public:
- ClientPlayer(const string &n, uint l, uint ml) :
+ ClientPlayer(const string &n, unsigned int l, unsigned int ml) :
name(n), lives(l), maxLives(ml), score(0), level(0) {
_loginfo("Added player %s\n",n.c_str());
};
const string& getName() { return name; }
- uint getLives() { return lives; }
- uint getMaxLives() { return maxLives; }
+ unsigned int getLives() { return lives; }
+ unsigned int getMaxLives() { return maxLives; }
void gainLife() {
if (lives < maxLives)
lives++;
@@ -48,11 +48,11 @@ public:
score += s;
return score;
}
- void setLives(uint l) { lives = l; }
+ void setLives(unsigned int l) { lives = l; }
void setScore(int s) { score = s; }
- uint getLevel() { return level; }
- uint nextLevel() { return ++level; }
- void setLevel(uint l) { level = l; }
+ unsigned int getLevel() { return level; }
+ unsigned int nextLevel() { return ++level; }
+ void setLevel(unsigned int l) { level = l; }
void setLevelSnapshot(const Level *l) {
if (l == NULL)
game_get_level_snapshot(&snapshot);
@@ -100,7 +100,7 @@ class ClientGame {
Game *game; /* current game context */
Hiscores hiscores;
vector<unique_ptr<ClientPlayer>> players;
- uint curPlayer;
+ unsigned int curPlayer;
ClientPlayer *lastDeadPlayer;
string msg;
Timeout frictionTimeout;
@@ -114,12 +114,12 @@ public:
ClientGame(Config &cfg);
~ClientGame();
int init(const string& setname, int levelid = 0);
- int update(uint ms, double rx, PaddleInputState &pis);
+ int update(unsigned int ms, double rx, PaddleInputState &pis);
Game *getGameContext() { return game; }
string getLevelsetName() { return levelset->name; }
void getCurrentLevelNameAndAuthor(string &name, string &author) {
ClientPlayer *p = players[curPlayer].get();
- uint lid = p->getLevel();
+ unsigned int lid = p->getLevel();
if (lid >= (uint)levelset->count) {
name = "none";
author = "none"; /* is done, should not happen */
@@ -131,8 +131,8 @@ public:
int getLevelCount() { return levelset->count; }
HiscoreChart *getHiscoreChart() { return hiscores.get(levelset->name); }
ClientPlayer* getCurrentPlayer() {return players[curPlayer].get(); }
- uint getCurrentPlayerId() {return curPlayer; }
- void setCurrentPlayerId(uint id) {
+ unsigned int getCurrentPlayerId() {return curPlayer; }
+ void setCurrentPlayerId(unsigned int id) {
curPlayer = id;
/* adjust paddle score */
game->paddles[0]->score = players[curPlayer]->getScore();
@@ -143,7 +143,7 @@ public:
void updateHiscores();
const string& getPlayerMessage() { return msg; }
vector<unique_ptr<ClientPlayer>>& getPlayers() { return players; }
- void resumePlayer(uint pid, uint lives, int score, uint level) {
+ void resumePlayer(unsigned int pid, unsigned int lives, int score, unsigned int level) {
players[pid]->setLives(lives);
players[pid]->setScore(score);
players[pid]->setLevel(level);
--- a/src/menu.cpp 2018-11-24 14:35:44.000000000 +0100
+++ b/src/menu.cpp 2019-06-10 11:04:25.231551862 +0200
@@ -24,7 +24,7 @@ extern SDL_Renderer *mrc;
Font *MenuItem::fNormal = NULL;
Font *MenuItem::fFocus = NULL;
Font *MenuItem::fTooltip = NULL;
-uint MenuItem::tooltipWidth = 300;
+unsigned int MenuItem::tooltipWidth = 300;
/** Helper to render a part of the menu item. Position is determined
* by given alignment. */
--- a/src/menu.h 2018-12-22 13:30:58.000000000 +0100
+++ b/src/menu.h 2019-06-10 11:04:25.227551814 +0200
@@ -59,7 +59,7 @@ protected:
}
public:
static Font *fNormal, *fFocus, *fTooltip;
- static uint tooltipWidth;
+ static unsigned int tooltipWidth;
MenuItem(const string &c, const string &tt, int aid = AID_NONE) :
caption(c), lblNormal(true), lblFocus(true),
@@ -97,7 +97,7 @@ public:
}
}
- virtual void update(uint ms) {
+ virtual void update(unsigned int ms) {
if (!focus && fadingAlpha > 0) {
fadingAlpha -= 0.7*ms;
if (fadingAlpha < 0)
@@ -211,9 +211,9 @@ public:
setValue(options[v]);
}
MenuItemList(const string &c, const string &tt, int aid,
- int &v, const char **opts, uint optNum)
+ int &v, const char **opts, unsigned int optNum)
: MenuItemRange(c,tt,aid,v,0,optNum-1,1) {
- for (uint i = 0; i < optNum; i++)
+ for (unsigned int i = 0; i < optNum; i++)
options.push_back(opts[i]);
setValue(options[v]);
}
@@ -247,10 +247,10 @@ class MenuItemIntList : public MenuItemR
vector<int> options;
public:
MenuItemIntList(const string &c, const string &tt,
- int &v, const int *opts, uint optNum)
+ int &v, const int *opts, unsigned int optNum)
: MenuItemRange(c,tt,AID_NONE,idx,0,optNum-1,1), val(v) {
idx = 0;
- for (uint i = 0; i < optNum; i++) {
+ for (unsigned int i = 0; i < optNum; i++) {
if (opts[i] == val)
idx = i;
options.push_back(opts[i]);
@@ -334,7 +334,7 @@ public:
int w = theme.menuItemWidth;
int x = theme.menuX - w/2;
int y = theme.menuY - h/2;
- for (uint i = 0; i < items.size(); i++) {
+ for (unsigned int i = 0; i < items.size(); i++) {
MenuItemSub *sub = dynamic_cast<MenuItemSub*>(items[i].get());
items[i]->setGeometry(x, y + i*theme.menuItemHeight,
w, theme.menuItemHeight);
@@ -342,7 +342,7 @@ public:
sub->getSubMenu()->adjust();
}
}
- void update(uint ms) {
+ void update(unsigned int ms) {
for (auto& i : items)
i->update(ms);
}
--- a/src/mixer.h 2019-03-07 20:54:45.000000000 +0100
+++ b/src/mixer.h 2019-06-10 11:04:25.228551826 +0200
@@ -63,7 +63,7 @@ public:
_loginfo("Mixer closed\n");
}
}
- void setVolume(uint v) { /* v is 0..100 */
+ void setVolume(unsigned int v) { /* v is 0..100 */
if (v > 100)
v = 100;
v = v * MIX_MAX_VOLUME / 100;
--- a/src/sdl.cpp 2019-03-07 14:07:05.000000000 +0100
+++ b/src/sdl.cpp 2019-06-10 11:04:25.231551862 +0200
@@ -484,7 +484,7 @@ void Font::writeText(int x, int y, const
SDL_DestroyTexture(tex);
}
-void Label::setText(Font &font, const string &str, uint maxw)
+void Label::setText(Font &font, const string &str, unsigned int maxw)
{
if (str == "") {
empty = true;
--- a/src/sdl.h 2019-03-07 13:15:07.000000000 +0100
+++ b/src/sdl.h 2019-06-10 11:04:25.228551826 +0200
@@ -209,7 +209,7 @@ public:
return TTF_SizeText(font,str.c_str(),w,h);
return 0;
};
- int getWrappedTextSize(const string& str, uint maxw, int *w, int *h) {
+ int getWrappedTextSize(const string& str, unsigned int maxw, int *w, int *h) {
*w = *h = 0;
SDL_Surface *surf = TTF_RenderUTF8_Blended_Wrapped(
font, str.c_str(), clr, maxw);
@@ -275,7 +275,7 @@ public:
b = -1;
border = b;
}
- void setText(Font &f, const string &str, uint max = 0);
+ void setText(Font &f, const string &str, unsigned int max = 0);
void clearText() {
empty = true;
}
@@ -295,12 +295,12 @@ public:
void setAlpha(int a) {
img.setAlpha(a);
}
- uint getHeight() {
+ unsigned int getHeight() {
if (empty)
return 0;
return img.getHeight();
}
- uint getWidth() {
+ unsigned int getWidth() {
if (empty)
return 0;
return img.getWidth();
--- a/src/selectdlg.cpp 2018-12-21 20:02:48.000000000 +0100
+++ b/src/selectdlg.cpp 2019-06-10 11:04:25.232551874 +0200
@@ -31,17 +31,17 @@ SetInfo::SetInfo(const string &n, Theme
author = "?";
/* create empty preview */
- uint sw = theme.menuBackground.getWidth();
- uint sh = theme.menuBackground.getHeight();
- uint bw = theme.bricks.getGridWidth();
- uint bh = theme.bricks.getGridHeight();
- uint soff = bh/3;
+ unsigned int sw = theme.menuBackground.getWidth();
+ unsigned int sh = theme.menuBackground.getHeight();
+ unsigned int bw = theme.bricks.getGridWidth();
+ unsigned int bh = theme.bricks.getGridHeight();
+ unsigned int soff = bh/3;
preview.create(MAPWIDTH*theme.bricks.getGridWidth(),
MAPHEIGHT*theme.bricks.getGridHeight());
SDL_SetRenderTarget(mrc, preview.getTex());
Image& wallpaper = theme.wallpapers[rand()%theme.numWallpapers];
- for (uint wy = 0; wy < sh; wy += wallpaper.getHeight())
- for (uint wx = 0; wx < sw; wx += wallpaper.getWidth())
+ for (unsigned int wy = 0; wy < sh; wy += wallpaper.getHeight())
+ for (unsigned int wx = 0; wx < sw; wx += wallpaper.getWidth())
wallpaper.copy(wx,wy);
theme.frameShadow.copy(soff,soff);
@@ -64,7 +64,7 @@ SetInfo::SetInfo(const string &n, Theme
string fpath = getFullLevelsetPath(n);
string lines[5+EDIT_HEIGHT];
ifstream ifs(fpath);
- uint offset = 0;
+ unsigned int offset = 0;
if (!ifs.is_open()) {
_logerr("Levelset %s not found, no preview created\n",n.c_str());
@@ -72,7 +72,7 @@ SetInfo::SetInfo(const string &n, Theme
SDL_SetRenderTarget(mrc, NULL);
return;
}
- for (uint i = 0; i < 5+EDIT_HEIGHT; i++)
+ for (unsigned int i = 0; i < 5+EDIT_HEIGHT; i++)
getline(ifs,lines[i]);
if (lines[0].find("Version") != string::npos) {
version = trimString(lines[0].substr(lines[0].find(':')+1));
@@ -89,8 +89,8 @@ SetInfo::SetInfo(const string &n, Theme
/* add bricks of first level
* XXX direct access to brick conversion table from libgame */
- for (uint j = 0; j < EDITHEIGHT; j++)
- for (uint i = 0; i < EDITWIDTH; i++) {
+ for (unsigned int j = 0; j < EDITHEIGHT; j++)
+ for (unsigned int i = 0; i < EDITWIDTH; i++) {
int k = -1;
for ( k = 0; k < BRICK_COUNT; k++ )
if (lines[4+offset+j][i] == brick_conv_table[k].c)
@@ -99,8 +99,8 @@ SetInfo::SetInfo(const string &n, Theme
theme.bricksShadow.copy(brick_conv_table[k].id,0,
(i+1)*bw+bh/3, (1+j)*bh+bh/3);
}
- for (uint j = 0; j < EDITHEIGHT; j++)
- for (uint i = 0; i < EDITWIDTH; i++) {
+ for (unsigned int j = 0; j < EDITHEIGHT; j++)
+ for (unsigned int i = 0; i < EDITWIDTH; i++) {
int k = -1;
for ( k = 0; k < BRICK_COUNT; k++ )
if (lines[4+offset+j][i] == brick_conv_table[k].c)
@@ -117,8 +117,8 @@ SetInfo::SetInfo(const string &n, Theme
/** Create levelset list and previews + layout. */
void SelectDialog::init()
{
- uint sw = theme.menuBackground.getWidth();
- uint sh = theme.menuBackground.getHeight();
+ unsigned int sw = theme.menuBackground.getWidth();
+ unsigned int sh = theme.menuBackground.getHeight();
vector<string> list, list2;
list.push_back(_(TOURNAMENT));
@@ -185,7 +185,7 @@ void SelectDialog::render()
font.setColor(theme.menuFontColorNormal);
font.write(lx, ly-ch, _("<Previous Page>"));
}
- for (uint i = 0; i < vlen; i++, y += ch) {
+ for (unsigned int i = 0; i < vlen; i++, y += ch) {
if (pos + i < entries.size() && sel == (int)(pos + i))
font.setColor(theme.menuFontColorFocus);
else
--- a/src/selectdlg.h 2018-10-31 18:49:34.000000000 +0100
+++ b/src/selectdlg.h 2019-06-10 11:04:25.228551826 +0200
@@ -21,7 +21,7 @@ class SetInfo {
string name;
string version;
string author;
- uint levels;
+ unsigned int levels;
Image preview;
public:
SetInfo(const string &name, Theme &theme);
@@ -40,12 +40,12 @@ class SelectDialog {
bool quitReceived;
vector<unique_ptr<SetInfo>> entries;
int sel;
- uint pos, max, vlen;
+ unsigned int pos, max, vlen;
int tx, ty; /* centered title position */
int lx, ly; /* list start */
- uint cw, ch; /* cell size */
+ unsigned int cw, ch; /* cell size */
int px, py;
- uint pw, ph; /* preview geometry */
+ unsigned int pw, ph; /* preview geometry */
Image background;
--- a/src/sprite.cpp 2018-09-02 18:47:18.000000000 +0200
+++ b/src/sprite.cpp 2019-06-10 11:04:25.232551874 +0200
@@ -24,7 +24,7 @@ extern SDL_Renderer *mrc;
Particle::Particle(GridImage &simg, int _gx, int _gy,
int _sx, int _sy, int _sw, int _sh,
double px, double py, double vx, double vy,
- double vpms, uint lifetime)
+ double vpms, unsigned int lifetime)
: img(simg), gx(_gx), gy(_gy), sx(_sx), sy(_sy), sw(_sw), sh(_sh),
pos(px,py), vel(vx,vy)
{
--- a/src/sprite.h 2018-09-02 18:47:18.000000000 +0200
+++ b/src/sprite.h 2019-06-10 11:04:25.229551838 +0200
@@ -19,21 +19,21 @@
class Sprite {
public:
virtual ~Sprite() {};
- virtual int update(uint ms) = 0; /* return 1 if to be removed, 0 otherwise */
+ virtual int update(unsigned int ms) = 0; /* return 1 if to be removed, 0 otherwise */
virtual void render() = 0;
};
class Animation : public Sprite {
GridImage& img;
- uint id;
+ unsigned int id;
int x, y; /* position on screen */
FrameCounter fc;
public:
- Animation(GridImage &_img, uint _id, uint delay, int _x, int _y)
+ Animation(GridImage &_img, unsigned int _id, unsigned int delay, int _x, int _y)
: img(_img), id(_id), x(_x), y(_y) {
fc.init(img.getGridSizeX(), delay);
}
- int update(uint ms) {
+ int update(unsigned int ms) {
if (fc.update(ms))
return 1; /* die */
return 0;
@@ -50,8 +50,8 @@ class Particle : public Sprite {
SmoothCounter sc;
public:
Particle(GridImage &simg, int gx, int gy, int sx, int sy, int sw, int sh,
- double px, double py, double vx, double vy, double vpms, uint lifetime);
- int update(uint ms) {
+ double px, double py, double vx, double vy, double vpms, unsigned int lifetime);
+ int update(unsigned int ms) {
pos.add(ms, vel);
return sc.update(ms);
}
--- a/src/theme.cpp 2019-03-07 15:14:49.000000000 +0100
+++ b/src/theme.cpp 2019-06-10 11:04:25.233551886 +0200
@@ -22,12 +22,12 @@ extern SDL_Renderer *mrc;
/** Load resources and scale if necessary using bricks screen height.
* Whatever is missing: Fall back to Standard theme. */
-void Theme::load(string name, uint screenWidth, uint screenHeight,
- uint brickScreenWidth, uint brickScreenHeight,
+void Theme::load(string name, unsigned int screenWidth, unsigned int screenHeight,
+ unsigned int brickScreenWidth, unsigned int brickScreenHeight,
int antialiasing)
{
string path, fpath;
- uint iw, ih;
+ unsigned int iw, ih;
if (name[0] == '~')
path = getHomeDir() + "/" + CONFIGDIR + "/themes/" + name.substr(1);
@@ -376,7 +376,7 @@ void Theme::load(string name, uint scree
/* load and scale up to 10 wallpapers */
string wpath = stdPath;
- uint wbfh = sbfh, wbfw = sbfw; /* for scaling */
+ unsigned int wbfh = sbfh, wbfw = sbfw; /* for scaling */
if (fileExists(path + "/back0.png") || fileExists(path + "/back0.jpg")) {
wpath = path;
wbfh = brickFileHeight;
--- a/src/theme.h 2019-03-07 15:05:53.000000000 +0100
+++ b/src/theme.h 2019-06-10 11:04:25.229551838 +0200
@@ -33,37 +33,37 @@ class Theme {
string stdPath; /* path to standard theme for fallbacks */
bool oldTheme;
int boardX;
- uint boardWidth;
+ unsigned int boardWidth;
/* loaded from theme.ini */
string title;
string author;
string version;
- uint brickFileWidth;
- uint brickFileHeight;
+ unsigned int brickFileWidth;
+ unsigned int brickFileHeight;
int shadowOffset;
string fontSmallName;
- uint fontSmallSize;
+ unsigned int fontSmallSize;
string fontNormalName;
- uint fontNormalSize;
+ unsigned int fontNormalSize;
SDL_Color fontColorNormal;
SDL_Color fontColorHighlight;
- uint shotFrameNum;
- uint shotAnimDelay;
- uint weaponFrameNum;
- uint weaponAnimDelay;
- uint explFrameNum;
- uint explAnimDelay;
- uint shineFrameNum;
- uint shineAnimDelay;
- uint menuX, menuY, menuItemWidth, menuItemHeight;
+ unsigned int shotFrameNum;
+ unsigned int shotAnimDelay;
+ unsigned int weaponFrameNum;
+ unsigned int weaponAnimDelay;
+ unsigned int explFrameNum;
+ unsigned int explAnimDelay;
+ unsigned int shineFrameNum;
+ unsigned int shineAnimDelay;
+ unsigned int menuX, menuY, menuItemWidth, menuItemHeight;
string menuFontNormalName, menuFontFocusName;
- uint menuFontNormalSize, menuFontFocusSize;
+ unsigned int menuFontNormalSize, menuFontFocusSize;
SDL_Color menuFontColorNormal, menuFontColorFocus;
Image menuBackground;
Image wallpapers[MAXWALLPAPERS];
- uint numWallpapers;
+ unsigned int numWallpapers;
Image frame, frameShadow;
GridImage bricks, bricksShadow;
GridImage paddles, paddlesShadow;
@@ -106,8 +106,8 @@ public:
{
stdPath = string(DATADIR) + "/themes/Standard";
}
- void load(string name, uint screenWidth, uint screenHeight,
- uint brickScreenWidth, uint brickScreenHeight,
+ void load(string name, unsigned int screenWidth, unsigned int screenHeight,
+ unsigned int brickScreenWidth, unsigned int brickScreenHeight,
int antialiasing);
};
--- a/src/tools.cpp 2018-11-04 12:04:17.000000000 +0100
+++ b/src/tools.cpp 2019-06-10 11:04:25.233551886 +0200
@@ -94,7 +94,7 @@ int FileParser::get(const string& k, int
v = stoi(str);
return ret;
}
-int FileParser::get(const string& k, uint &v)
+int FileParser::get(const string& k, unsigned int &v)
{
string str;
int ret = get(k,str);
--- a/src/tools.h 2018-10-31 12:23:22.000000000 +0100
+++ b/src/tools.h 2019-06-10 11:04:25.229551838 +0200
@@ -95,7 +95,7 @@ public:
FileParser(const string& fname);
int get(const string& k, string &v);
int get(const string& k, int &v);
- int get(const string& k, uint &v);
+ int get(const string& k, unsigned int &v);
int get(const string& k, uint8_t &v);
int get(const string& k, double &v);
};
@@ -167,7 +167,7 @@ public:
class FrameCounter : public SmoothCounter {
public:
- void init(uint max, uint delay) {
+ void init(unsigned int max, unsigned int delay) {
SmoothCounter::init(SCT_REPEAT, 0, -0.01 + max, delay);
}
int get() { return SmoothCounter::get(); }
--- a/src/view.cpp 2019-03-08 19:13:31.000000000 +0100
+++ b/src/view.cpp 2019-06-10 11:04:25.234551898 +0200
@@ -74,7 +74,7 @@ View::View(Config &cfg, ClientGame &_cg)
/** (Re)Initialize window, theme and menu.
* t is theme name, r=0 means fullscreen, otherwise vertical resolution. */
-void View::init(string t, uint r)
+void View::init(string t, unsigned int r)
{
_loginfo("Initializing View (Theme=%s, Resolution=%d)\n",t.c_str(),r);
@@ -648,7 +648,7 @@ void View::renderBackgroundImage() {
/* lives */
ClientPlayer *cp = cgame.getCurrentPlayer();
- for (uint i = 0; i < cp->getMaxLives(); i++)
+ for (unsigned int i = 0; i < cp->getMaxLives(); i++)
theme.life.copy(0, i < cp->getLives(), 0, (MAPHEIGHT-i-1)*bh);
SDL_SetRenderTarget(mrc,NULL);
@@ -739,12 +739,12 @@ void View::renderScoreImage()
void View::renderExtrasImage()
{
Game *game = cgame.getGameContext();
- uint bw = brickScreenWidth, bh = brickScreenHeight;
- uint xstart = (imgExtras.getWidth() - 3*bw) / 4;
- uint ystart = (imgExtras.getHeight() - 3*bh) / 4;
- uint xoff = bw + xstart;
- uint yoff = bh + ystart;
- uint x = xstart, y = ystart;
+ unsigned int bw = brickScreenWidth, bh = brickScreenHeight;
+ unsigned int xstart = (imgExtras.getWidth() - 3*bw) / 4;
+ unsigned int ystart = (imgExtras.getHeight() - 3*bh) / 4;
+ unsigned int xoff = bw + xstart;
+ unsigned int yoff = bh + ystart;
+ unsigned int x = xstart, y = ystart;
SDL_SetRenderTarget(mrc, imgExtras.getTex());
SDL_SetRenderDrawColor(mrc,0,0,0,0);
@@ -846,14 +846,14 @@ bool View::showInfo(const vector<string>
{
Font &font = theme.fSmall;
bool ret = true;
- uint h = text.size() * font.getLineHeight();
+ unsigned int h = text.size() * font.getLineHeight();
int tx = mw->getWidth()/2;
int ty = (mw->getHeight() - h)/2;
darkenScreen();
font.setAlign(ALIGN_X_CENTER | ALIGN_Y_TOP);
- for (uint i = 0; i < text.size(); i++) {
+ for (unsigned int i = 0; i < text.size(); i++) {
font.write(tx,ty,text[i]);
ty += font.getLineHeight();
}
@@ -964,12 +964,12 @@ void View::createSprites()
}
}
-void View::getBallViewInfo(Ball *ball, int *x, int *y, uint *type)
+void View::getBallViewInfo(Ball *ball, int *x, int *y, unsigned int *type)
{
Game *game = cgame.getGameContext(); /* direct lib game context */
Paddle *paddle = game->paddles[0]; /* local paddle always at bottom */
- uint bt = 0;
+ unsigned int bt = 0;
double px = ball->cur.x;
double py = ball->cur.y;
if (ball->attached) {
@@ -1395,7 +1395,7 @@ void View::saveGame()
ofs << "difficulty=" << config.diff << "\n";
ofs << "curplayer=" << cgame.getCurrentPlayerId() << "\n";
ofs << "players=" << players.size() << "\n";
- for (uint i = 0; i < players.size(); i++) {
+ for (unsigned int i = 0; i < players.size(); i++) {
ofs << "player" << i << " {\n";
ofs << " name=" << players[i]->getName() << "\n";
ofs << " level=" << players[i]->getLevel() << "\n";
@@ -1432,18 +1432,18 @@ int View::resumeGame()
fp.get(string("player") + to_string(i) + ".name",config.player_names[i]);
/* initialize game to level of current player */
- uint pid = 0;
+ unsigned int pid = 0;
fp.get("curplayer",pid);
if (pid >= MAX_PLAYERS)
pid = 0;
- uint levid = 0;
+ unsigned int levid = 0;
fp.get(string("player") + to_string(pid) + ".level",levid);
cgame.init(setname,levid);
/* adjust players */
for (int i = 0; i < config.player_count; i++) {
string prefix = string("player") + to_string(i) + ".";
- uint level = 0, lives = 3;
+ unsigned int level = 0, lives = 3;
int score = 0;
fp.get(prefix + "score",score);
fp.get(prefix + "level",level);
@@ -1529,8 +1529,8 @@ void View::renderBalls(bool shadow)
Ball *ball;
list_reset(game->balls);
while ( ( ball = (Ball*)list_next( game->balls ) ) != 0 ) {
- uint type;
- uint alpha = 255;
+ unsigned int type;
+ unsigned int alpha = 255;
int px, py;
getBallViewInfo(ball, &px, &py, &type);
if (type == 1) /* energy ball */
@@ -1561,7 +1561,7 @@ void View::updateResumeGameTooltip()
/* XXX multiple locations... */
const char *diffNames[] = {_("Kids"),_("Easy"),_("Medium"),_("Hard") } ;
string text, str;
- uint diff, pnum;
+ unsigned int diff, pnum;
FileParser fp(saveFileName);
fp.get("levelset",text);
fp.get("difficulty",diff);
@@ -1573,10 +1573,10 @@ void View::updateResumeGameTooltip()
text += to_string(pnum);
text += _(" player(s)\n");
- for (uint i = 0; i < pnum; i++) {
+ for (unsigned int i = 0; i < pnum; i++) {
string prefix = string("player") + to_string(i) + ".";
string name;
- uint level = 0, lives = 3;
+ unsigned int level = 0, lives = 3;
int score = 0;
fp.get(prefix + "name",name);
fp.get(prefix + "score",score);
@@ -1591,7 +1591,7 @@ void View::updateResumeGameTooltip()
resumeMenuItem->setTooltip(text);
}
-void View::renderExtraHelp(GridImage &img, uint gx, uint gy, const string &str, int x, int y)
+void View::renderExtraHelp(GridImage &img, unsigned int gx, unsigned int gy, const string &str, int x, int y)
{
img.copy(gx,gy,x,y);
theme.fSmall.setAlign(ALIGN_X_LEFT | ALIGN_Y_CENTER);
@@ -1621,7 +1621,7 @@ void View::showHelp()
;
int x = brickScreenWidth, y = brickScreenHeight;
- uint maxw = brickScreenWidth * 10;
+ unsigned int maxw = brickScreenWidth * 10;
darkenScreen();
--- a/src/view.h 2019-03-07 15:44:36.000000000 +0100
+++ b/src/view.h 2019-06-10 11:04:25.229551838 +0200
@@ -105,7 +105,7 @@ class View {
void showHelp();
void createParticles(BrickHit *hit);
void createSprites();
- void getBallViewInfo(Ball *ball, int *x, int *y, uint *type);
+ void getBallViewInfo(Ball *ball, int *x, int *y, unsigned int *type);
void playSounds();
void createMenus();
void grabInput(int grab);
@@ -116,14 +116,14 @@ class View {
void darkenScreen(int alpha = 32);
void initTitleLabel();
void updateResumeGameTooltip();
- void renderExtraHelp(GridImage &img, uint gx, uint gy, const string &str, int x, int y);
+ void renderExtraHelp(GridImage &img, unsigned int gx, unsigned int gy, const string &str, int x, int y);
void runBrickDestroyDlg();
void waitForInputRelease();
void getNewShinePosition();
public:
View(Config &cfg, ClientGame &_cg);
~View();
- void init(string t, uint r);
+ void init(string t, unsigned int r);
void run();
void render();
void runMenu();
--- a/src/clientgame.cpp 2019-06-10 11:08:55.515756485 +0200
+++ b/src/clientgame.cpp 2019-06-10 11:09:17.964021355 +0200
@@ -95,7 +95,7 @@ ClientPlayer *ClientGame::getNextPlayer(
if (curPlayer == players.size())
curPlayer = 0;
p = players[curPlayer].get();
- if (p->getLives() > 0 && p->getLevel() < (uint)levelset->count)
+ if (p->getLives() > 0 && p->getLevel() < (unsigned int)levelset->count)
return p;
} while (curPlayer != startId);
return NULL;
@@ -192,7 +192,7 @@ int ClientGame::update(unsigned int ms,
ClientPlayer *p = players[curPlayer].get();
/* bonus levels are just skipped on failure */
if (game->winner == PADDLE_BOTTOM || game->level_type != LT_NORMAL) {
- if (p->nextLevel() < (uint)levelset->count)
+ if (p->nextLevel() < (unsigned int)levelset->count)
p->setLevelSnapshot(levelset->levels[p->getLevel()]);
else {
strprintf(msg,_("Congratulations, %s, you cleared all levels!"),p->getName().c_str());
--- a/src/clientgame.h 2019-06-10 11:10:30.500877231 +0200
+++ b/src/clientgame.h 2019-06-10 11:10:41.972012581 +0200
@@ -120,7 +120,7 @@ public:
void getCurrentLevelNameAndAuthor(string &name, string &author) {
ClientPlayer *p = players[curPlayer].get();
unsigned int lid = p->getLevel();
- if (lid >= (uint)levelset->count) {
+ if (lid >= (unsigned int)levelset->count) {
name = "none";
author = "none"; /* is done, should not happen */
} else {

View File

@ -0,0 +1,18 @@
diff --git a/src/tools.h b/src/tools.h
index a77bd52..2a68a92 100644
--- a/src/tools.h
+++ b/src/tools.h
@@ -21,10 +21,10 @@ using namespace std;
#include <stdlib.h>
#include <math.h>
#include <dirent.h>
-#ifdef WIN32
- #include <stdint.h>
+//#ifdef WIN32
+ #include <cstdint>
typedef uint32_t uint;
-#endif
+//#endif
#include <list>
#include <string>
#include <vector>

View File

@ -1,14 +1,15 @@
# Template file for 'lbreakouthd'
pkgname=lbreakouthd
version=1.0.6
version=1.1.9
revision=1
build_style=gnu-configure
configure_args="--localstatedir=/var/${pkgname}"
makedepends="SDL2-devel SDL2_mixer-devel SDL2_image-devel SDL2_ttf-devel"
depends="desktop-file-utils hicolor-icon-theme"
short_desc="Scalable 16:9 remake of LBreakout2"
maintainer="Orphaned <orphan@voidlinux.org>"
maintainer="Mihail Ivanchev <contact@ivanchev.net>"
license="GPL-2.0-or-later"
homepage="http://lgames.sourceforge.net/LBreakoutHD/"
homepage="https://lgames.sourceforge.net/LBreakoutHD/"
distfiles="${SOURCEFORGE_SITE}/lgames/$pkgname-$version.tar.gz"
checksum=df5f8ad88bcf20bd34e1dfd77697b49a168d83ad43d8fdf5a3fee1fe272e15bd
checksum=1c8cd9707ff2181457ffd53216e472bac024ce0ce144490c44d68ffbabd00be1
nocheckperms=yes # uses a world-writable .hscr file for global leaderboard