From cee848899590199081c8ade4736662a8a5dc4a2f Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Tue, 1 Jul 2014 09:34:31 -0500 Subject: [PATCH] Added MOAR boards. --- src/boards.cpp | 353 +++++++++++++++++++++++++++++++++++++++++++++- src/boards.h | 2 +- src/gameboard.cpp | 8 +- src/mainwin.cpp | 2 +- 4 files changed, 356 insertions(+), 9 deletions(-) diff --git a/src/boards.cpp b/src/boards.cpp index 7ade832..8cf5ed7 100644 --- a/src/boards.cpp +++ b/src/boards.cpp @@ -21,6 +21,7 @@ // . = Spot to move box to // + = Spot to move box to, that already has a box on it // o = Player initial position +// * = Player initial position, that has a spot under it // - = Do not draw anything here // @@ -271,9 +272,359 @@ static const struct { }; +static const struct { + unsigned int width, height; + unsigned char state[10 * 7 + 40 + 1]; } board019 = { 10, 7, + "-@@@@@@@--" + "-@ @@@" + "@@X@@@ @" + "@ o X X @" + "@ ..@ X @@" + "@@..@ @-" + "-@@@@@@@@-" + "Untitled1" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[8 * 6 + 40 + 1]; } board020 = { 8, 6, + "---@@@@@" + "@@@@ .@" + "@ X +@" + "@ XX X.@" + "@@o@@..@" + "-@@@@@@@" + "Untitled2" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[7 * 7 + 40 + 1]; } board021 = { 7, 7, + "@@@@@@@" + "@. .@" + "@ X@X @" + "@.XoX.@" + "@ X@X @" + "@. .@" + "@@@@@@@" + "Cornered" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[7 * 7 + 40 + 1]; } board022 = { 7, 7, + "@@@@@@@" + "@ . @" + "@ X@X @" + "@. + .@" + "@ X@X @" + "@ .o @" + "@@@@@@@" + "Diamond" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[9 * 7 + 40 + 1]; } board023 = { 9, 7, + "@@@@@@@@-" + "@ o @-" + "@ X.. @@" + "@@@..@ @" + "--@@XXX @" + "---@ @" + "---@@@@@@" + "Untitled3" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[8 * 8 + 40 + 1]; } board024 = { 8, 8, + "@@@@@@@@" + "@ o @" + "@ XX@ @" + "@@ X @@" + "-@.X @-" + "-@@. @@-" + "--@..@--" + "--@@@@--" + "Untitled4" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[8 * 8 + 40 + 1]; } board025 = { 8, 8, + "-@@@@@@-" + "-@. ..@-" + "-@. X.@-" + "@@@ X@@" + "@ X X @" + "@ @X@@ @" + "@ o @" + "@@@@@@@@" + "Untitled5" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[7 * 7 + 40 + 1]; } board026 = { 7, 7, + "-@@@@@@" + "@@ . o@" + "@ X X @" + "@. + .@" + "@ X X @" + "@@ . @@" + "-@@@@@-" + "Untitled6" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[8 * 7 + 40 + 1]; } board027 = { 8, 7, + "--@@@@@@" + "--@ @" + "@@@XXX @" + "@o X.. @" + "@ X...@@" + "@@@@ @-" + "---@@@@-" + "Untitled7" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[12 * 5 + 40 + 1]; } board028 = { 12, 5, + "@@@@@@@@@@@@" + "@ ... X @" + "@ XXX+++ Xo@" + "@ ... X @" + "@@@@@@@@@@@@" + "Untitled8" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[8 * 7 + 40 + 1]; } board029 = { 8, 7, + "@@@@@@@@" + "@ @ @" + "@ X..X @" + "@oX.+ @@" + "@ X..X @" + "@ @ @" + "@@@@@@@@" + "Untitled9" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[11 * 9 + 40 + 1]; } board030 = { 11, 9, + "--@@@@@----" + "--@ @----" + "@@@X.X@@@@@" + "@ . X @" + "@ @@X@@ o @" + "@ . @@@@@" + "@@@ . @----" + "--@ @----" + "--@@@@@----" + "Untitled10" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[11 * 7 + 40 + 1]; } board031 = { 11, 7, + "---@@@@@@@@" + "@@@@ . @" + "@ X X X. @" + "@ .@@@@.@@" + "@ X.X X o@-" + "@ . @@@@-" + "@@@@@@@----" + "Untitled11" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[8 * 7 + 40 + 1]; } board032 = { 8, 7, + "-@@@@@--" + "-@ @@@" + "@@X@o .@" + "@ XX@.@" + "@ @X .@" + "@ .@" + "@@@@@@@@" + "Untitled12" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[9 * 8 + 40 + 1]; } board033 = { 9, 8, + "---@@@@@-" + "@@@@. @@" + "@ X.X. @" + "@oX@ @X @" + "@ X. . @" + "@@@@X@X @" + "--@. . @" + "--@@@@@@@" + "Untitled13" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[9 * 8 + 40 + 1]; } board034 = { 9, 8, + "---@@@@@-" + "---@ o @-" + "---@XXX@-" + "@@@@ @-" + "@ .@X@@" + "@ X.X. .@" + "@ @.@.@@" + "@@@@@@@@-" + "Untitled14" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[9 * 8 + 40 + 1]; } board035 = { 9, 8, + "@@@@@@---" + "@ @---" + "@ X @@@@" + "@ X+..+ @" + "@ +..+X @" + "@@@@ X @" + "---@ o @" + "---@@@@@@" + "Untitled15" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[7 * 6 + 40 + 1]; } board036 = { 7, 6, + "@@@@@@@" + "@ + @" + "@ .+. @" + "@ XXX @" + "@ o. @" + "@@@@@@@" + "Untitled16" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[8 * 7 + 40 + 1]; } board037 = { 8, 7, + "@@@@@@@@" + "@.. @" + "@..X Xo@" + "@X@XXX@@" + "@..X X @" + "@.. @" + "@@@@@@@@" + "Untitled17" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[9 * 8 + 40 + 1]; } board038 = { 9, 8, + "---@@@@@@" + "@@@@. o@" + "@ XXX @" + "@.@@.@@.@" + "@ X @" + "@ X.@ @@" + "@@@@ @-" + "---@@@@@-" + "Untitled18" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[12 * 7 + 40 + 1]; } board039 = { 12, 7, + "--@@@@@@@@@@" + "@@@ . @" + "@ @@X@@ @" + "@ oX. . .X@@" + "@@ X@@X@@ @ " + "-@ . @ " + "-@@@@@@@@@@ " + "Untitled19" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[9 * 7 + 40 + 1]; } board040 = { 9, 7, + "@@@@@@@@@" + "@. . .@" + "@@XXXXX@@" + "@..o+ ..@" + "@@XXXXX@@" + "@. . .@" + "@@@@@@@@@" + "Untitled20" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[8 * 7 + 40 + 1]; } board041 = { 8, 7, + "@@@@@---" + "@ @---" + "@ X@@@@" + "@.+*+ @" + "@ XX+ @" + "@ . @" + "@@@@@@@@" + "Untitled21" +}; + + +static const struct { + unsigned int width, height; + unsigned char state[9 * 7 + 40 + 1]; } board042 = { 9, 7, + "-@@@@@@@-" + "@@.X X.@@" + "@.+ X +.@" + "@ XoX @" + "@.+ X +.@" + "@@.X X.@@" + "-@@@@@@@-" + "Untitled22" +}; + + const void * boards[] = { &board001, &board002, &board003, &board004, &board005, &board006, &board007, &board008, &board009, &board010, &board011, &board012, &board013, &board014, &board015, &board016, - &board017, &board018, //&board019, &board020, &board021, &board022, &board023, &board024, + &board017, &board018, &board019, &board020, &board021, &board022, &board023, &board024, + &board025, &board026, &board027, &board028, &board029, &board030, &board031, &board032, + &board033, &board034, &board035, &board036, &board037, &board038, &board039, &board040, + &board041, &board042, //&board043, &board044, &board045, &board046, &board047, &board048, +// &board049, &board050, &board051, &board052, &board053, &board054, &board055, &board056, +// &board057, &board058, &board059, &board060, &board061, &board062, &board063, &board064, +// &board065, &board066, &board067, &board068, &board069, &board070, &board071, &board072, +// &board073, &board074, &board075, &board076, &board077, &board078, &board079, &board080, +// &board081, &board082, &board083, &board084, &board085, &board086, &board087, &board088, +// &board089, &board090, &board091, &board092, &board093, &board094, &board095, &board096, +// &board097, &board098, &board099, &board100, &board101, &board102, &board103, &board104, }; diff --git a/src/boards.h b/src/boards.h index f2a8a2f..e14b564 100644 --- a/src/boards.h +++ b/src/boards.h @@ -12,7 +12,7 @@ struct Board { unsigned char state[]; // Board data }; -#define NUMBER_OF_BOARDS 18 +#define NUMBER_OF_BOARDS 42 extern const void * boards[]; #endif // __BOARDS_H__ diff --git a/src/gameboard.cpp b/src/gameboard.cpp index 92a0bab..e39d2e5 100644 --- a/src/gameboard.cpp +++ b/src/gameboard.cpp @@ -47,9 +47,9 @@ GameBoard::GameBoard(int boardNumber) initialBoard[i] = GTBoxSpot; else if (c == '+') initialBoard[i] = GTBox | GTBoxSpot; - else if (c == 'o') + else if (c == 'o' || c == '*') { - initialBoard[i] = GTSpace; + initialBoard[i] = (c == '*' ? GTBoxSpot : GTSpace); initialX = i % width, initialY = i / width; } else @@ -150,7 +150,6 @@ int GameBoard::Move(int dx, int dy, char cell1, char cell2) // Player is moving into an unoccupied space... if (cell1 == GTSpace) { -// var += direction; playerX += dx, playerY += dy; undo[numMoves].dx = dx, undo[numMoves].dy = dy, undo[numMoves].type = PMWalk; numMoves++; @@ -159,13 +158,10 @@ int GameBoard::Move(int dx, int dy, char cell1, char cell2) // Player is pushing a box into an unoccupied space... else if ((cell1 == GTBox) && (cell2 == GTSpace)) { -// var += direction; playerX += dx, playerY += dy; board[playerX + (playerY * width)] &= GTBoxSpot; -// var += direction; playerX += dx, playerY += dy; board[playerX + (playerY * width)] |= GTBox; -// var -= direction; playerX -= dx, playerY -= dy; undo[numMoves].dx = dx, undo[numMoves].dy = dy, undo[numMoves].type = PMPush; numMoves++; diff --git a/src/mainwin.cpp b/src/mainwin.cpp index 9b8fb29..010f27f 100644 --- a/src/mainwin.cpp +++ b/src/mainwin.cpp @@ -272,7 +272,7 @@ void MainWin::ResetGame(void) void MainWin::AboutGame(void) { - QMessageBox::about(this, tr("About Warehouse Man Deluxe"), tr("Warehouse Man Deluxe Version 1.0\n\nCopyright © 2014 Underground Software\n\nWritten by James L. Hammons")); + QMessageBox::about(this, tr("About Warehouse Man Deluxe"), tr("Warehouse Man Deluxe Version 1.0\n\nCopyright (C) 2014 Underground Software\n\nWritten by James L. Hammons")); } -- 2.37.2