From 63394ac74f55b9ac547d8e46fc7b24138f10caf3 Mon Sep 17 00:00:00 2001 From: "Ryan \"Lofenyy\" Medeiros" Date: Sat, 1 Jul 2023 02:46:24 -0600 Subject: [PATCH] Updated ReadMe file. --- README.md | 19 +++++++++++- Source/editMaps.c | 63 +++++++++++++++++--------------------- Source/engineCore.c | 4 +++ Source/engineMaps.c | 42 ++++++++++++------------- Source/engineMaps.h | 2 ++ Source/playJoycon.c | 3 +- Tools/comment-checker.sh | 5 ++- Tools/copyright-checker.sh | 4 +++ 8 files changed, 82 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index a002ca3..1baf597 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,25 @@ Currently, the only supported platform is GNU/Linux. Support for other operating ## Contributing -Please feel free to play around with the map editor and send me your creations to be merged into the greater world. I'm also very open to bug reports, support requests, and code contributions. You can create an issue report at 'https://gitea.com/lofenyy/LibreWands/'. You can support my efforts at [LiberaPay.](https://liberapay.com/lofenyy/) +There are a vast number of ways you can contribute to this project. Any and all help is greatly appreciated. +* Help design the world using the map editor. +* Help design the world with pencil and paper. +* Help build and tune the game engine. +* Help write the game. +* Help hunt for bugs. +* Submit issue reports. +* Edit this README file. +* Edit our Makefile. +* Advocate for better standards compliance. +* Optimise our software. +* Help implement multiplayer. +* Help write our documentation. +* Develop software quality tests. +* Package this software for your favourite operating system. +* Spread the word about this project. +* Tell me how I can make contributing easier. +* Support my efforts at [LiberaPay.](https://liberapay.com/lofenyy/) ## Copyright Notice diff --git a/Source/editMaps.c b/Source/editMaps.c index 095e937..fd080f4 100644 --- a/Source/editMaps.c +++ b/Source/editMaps.c @@ -63,10 +63,10 @@ int main() halfdelay(2); clear(); - // For all existing base tiles, draw them. + // For all existing base tiles, draw them. for (int C = 0; C < map[aMap].nBase; C++) { - //If this tile is active, unwalkable, invisible and white-on-blue + // If this tile is active, unwalkable, invisible and white-on-blue if ((map[aMap].Base[C].active) && (map[aMap].Base[C].walk == 0) && (map[aMap].Base[C].t == ' ') && (map[aMap].Base[C].c == 48)) { @@ -76,27 +76,27 @@ int main() tile_W[A % 8]); attroff(COLOR_PAIR(map[aMap].Base[C].c)); } - //If this tile isn't all-of-the-above + // If this tile isn't all-of-the-above else if (map[aMap].Base[C].active) { - //Draw it normally + // Draw it normally attron(COLOR_PAIR(map[aMap].Base[C].c)); mvprintw(map[aMap].Base[C].y - y, map[aMap].Base[C].x - x, "%c", map[aMap].Base[C].t); attroff(COLOR_PAIR(map[aMap].Base[C].c)); } - //If we're hovering over this base tile + // If we're hovering over this base tile if ((map[aMap].Base[C].x - (xmax / 2) == x) && (map[aMap].Base[C].y - (ymax / 2) == y)) { - //Print out useful info in the bottom-left screen + // Print out useful info in the bottom-left screen mvprintw(ymax - 2, 0, "Walkable: %s\nColor: %i", map[aMap].Base[C].walk ? "True" : "False", map[aMap].Base[C].c); } } - // For all existing info tiles, draw them. + // For all existing info tiles, draw them. for (int C = 0; C < map[aMap].nInfo; C++) { // If the given info tile is active @@ -108,7 +108,7 @@ int main() map[aMap].Info[C].t); attroff(COLOR_PAIR(map[aMap].Info[C].c)); } - + // If we're hovering over the given info tile if ((map[aMap].Info[C].x - (xmax / 2) == x) && (map[aMap].Info[C].y - (ymax / 2) == y)) @@ -118,7 +118,7 @@ int main() } } - // For all existing item tiles, draw them. + // For all existing item tiles, draw them. for (int C = 0; C < map[aMap].nItem; C++) { // If the given item tile is active @@ -130,7 +130,7 @@ int main() map[aMap].Item[C].t); attroff(COLOR_PAIR(map[aMap].Item[C].c)); } - + // If we're hovering over the given item tile if ((map[aMap].Item[C].x - (xmax / 2) == x) && (map[aMap].Item[C].y - (ymax / 2) == y)) @@ -140,7 +140,7 @@ int main() } } - // For all existing door tiles, draw them. + // For all existing door tiles, draw them. for (int C = 0; C < map[aMap].nDoor; C++) { // If the given door tile is active @@ -152,12 +152,12 @@ int main() map[aMap].Door[C].t); attroff(COLOR_PAIR(map[aMap].Door[C].c)); } - + // If we're hovering over the given item tile if ((map[aMap].Door[C].x - (xmax / 2) == x) && (map[aMap].Door[C].y - (ymax / 2) == y)) { - //Print out useful info in the bottom-left screen + // Print out useful info in the bottom-left screen mvprintw(ymax - 2, 0, "Status: %s\nMap: %i X: %li Y: %li", map[aMap].Door[C].lock ? "Locked" : "Unlocked", map[aMap].Door[C].ID, map[aMap].Door[C].nx, @@ -165,7 +165,7 @@ int main() } } - // For all existing character tiles, draw them. + // For all existing character tiles, draw them. for (int C = 0; C < map[aMap].nChar; C++) { // If the given char tile is active @@ -177,36 +177,29 @@ int main() map[aMap].Char[C].t); attroff(COLOR_PAIR(map[aMap].Char[C].c)); } - + // If we're hovering over the given item tile if ((map[aMap].Char[C].x - (xmax / 2) == x) && (map[aMap].Char[C].y - (ymax / 2) == y)) { - //Print out useful info in the bottom-left screen + // Print out useful info in the bottom-left screen mvprintw(ymax - 1, 0, "Name: %s - Type: %s - Moves: %s", map[aMap].Char[C].name, map[aMap].Char[C].type ? "Aggressive" : "Passive", map[aMap].Char[C].move ? "Yes" : "No"); - mvprintw(ymax - 2, 0, "Dialogue 1: %s", - map[aMap].Char[C].dialog1); - mvprintw(ymax - 3, 0, "Dialogue 2: %s", - map[aMap].Char[C].dialog2); - mvprintw(ymax - 4, 0, - "Monsters: %i-%i %i-%i %i-%i %i-%i %i-%i", - map[aMap].Char[C].mon[0].type, - map[aMap].Char[C].mon[0].level, - map[aMap].Char[C].mon[1].type, - map[aMap].Char[C].mon[1].level, - map[aMap].Char[C].mon[2].type, - map[aMap].Char[C].mon[2].level, - map[aMap].Char[C].mon[3].type, - map[aMap].Char[C].mon[3].level, - map[aMap].Char[C].mon[4].type, - map[aMap].Char[C].mon[4].level); + mvprintw(ymax - 2, 0, "Dialogue 1: %s", map[aMap].Char[C].dialog1); + mvprintw(ymax - 3, 0, "Dialogue 2: %s", map[aMap].Char[C].dialog2); + mvprintw( + ymax - 4, 0, "Monsters: %i-%i %i-%i %i-%i %i-%i %i-%i", + map[aMap].Char[C].mon[0].type, map[aMap].Char[C].mon[0].level, + map[aMap].Char[C].mon[1].type, map[aMap].Char[C].mon[1].level, + map[aMap].Char[C].mon[2].type, map[aMap].Char[C].mon[2].level, + map[aMap].Char[C].mon[3].type, map[aMap].Char[C].mon[3].level, + map[aMap].Char[C].mon[4].type, map[aMap].Char[C].mon[4].level); } } - // Display coordinates and tool/tips in the top left. + // Display coordinates and tool/tips in the top left. attron(COLOR_PAIR(0)); mvprintw(0, 0, "Map: %i X: %li Y: %li", aMap, x, y); mvprintw(1, 0, "Tooltip: %c Color: %i Walkable: %s", (char)tip, tipColor, @@ -225,7 +218,7 @@ int main() break; } - // Get and process our user input. + // Get and process our user input. k = getch(); if (k == KEY_UP) y--; @@ -249,7 +242,7 @@ int main() turnTip(); if (k == ' ') addBase(); - if (tool == 1) //If continuous painting is on + if (tool == 1) // If continuous painting is on addBase(); if (k == 'i') addInfo(); diff --git a/Source/engineCore.c b/Source/engineCore.c index bf9db0c..badf766 100644 --- a/Source/engineCore.c +++ b/Source/engineCore.c @@ -11,6 +11,10 @@ // You should have received a copy of the GNU General Public License along with LibreWands. If // not, see https://www.gnu.org/licenses/. +// --- + +#include + // To run at the beginning of the game. void initEngine() { diff --git a/Source/engineMaps.c b/Source/engineMaps.c index 65fa361..f90fb4e 100644 --- a/Source/engineMaps.c +++ b/Source/engineMaps.c @@ -275,41 +275,41 @@ int delTile() // If our cursor is over it, if ((map[aMap].Base[C].x == x + (xmax / 2)) && (map[aMap].Base[C].y == y + (ymax / 2))) - // Deactivate it + // Deactivate it map[aMap].Base[C].active = 0; - + // For every info tile for (int C = 0; C < map[aMap].nInfo; C++) // If our cursor is over it, if ((map[aMap].Info[C].x == x + (xmax / 2)) && (map[aMap].Info[C].y == y + (ymax / 2))) - // Deactivate it + // Deactivate it map[aMap].Info[C].active = 0; - + // For every item tile for (int C = 0; C < map[aMap].nItem; C++) // If our cursor is over it, if ((map[aMap].Item[C].x == x + (xmax / 2)) && (map[aMap].Item[C].y == y + (ymax / 2))) - // Deactivate it + // Deactivate it map[aMap].Item[C].active = 0; - + // For every door tile for (int C = 0; C < map[aMap].nDoor; C++) // If our cursor is over it, if ((map[aMap].Door[C].x == x + (xmax / 2)) && (map[aMap].Door[C].y == y + (ymax / 2))) - // Deactivate it + // Deactivate it map[aMap].Door[C].active = 0; - + // For every char tile for (int C = 0; C < map[aMap].nChar; C++) // If our cursor is over it, if ((map[aMap].Char[C].x == x + (xmax / 2)) && (map[aMap].Char[C].y == y + (ymax / 2))) - // Deactivate it + // Deactivate it map[aMap].Char[C].active = 0; - + // Exit gracefully return 0; } @@ -395,14 +395,14 @@ int saveMap() FILE *fp = fopen(buffer, "w"); if (fp == NULL) return 1; - + // Save our header, with the number of active maps. fprintf(fp, "\n", nMap); // For every map for (uint_fast8_t C = 0; C < nMap; C++) { - //Print out a header giving valuable info for memory allocation. + // Print out a header giving valuable info for memory allocation. fprintf(fp, "\t\n", @@ -413,7 +413,7 @@ int saveMap() { if (map[C].Base[B].active) { - //Print out an XML tag with its info. + // Print out an XML tag with its info. fprintf(fp, "\t\t\n", @@ -426,7 +426,7 @@ int saveMap() { if (map[C].Info[B].active) { - //Print out an XML tag with its info. + // Print out an XML tag with its info. fprintf(fp, "\t\t\n", @@ -439,7 +439,7 @@ int saveMap() { if (map[C].Item[B].active) { - //Print out an XML tag with its info. + // Print out an XML tag with its info. fprintf(fp, "\t\t\n", @@ -452,7 +452,7 @@ int saveMap() { if (map[C].Door[B].active) { - //Print out an XML tag with its info. + // Print out an XML tag with its info. fprintf( fp, "\t\t\n"); - + // Exit gracefully fclose(fp); return 0; @@ -551,7 +551,7 @@ int loadMap() &map[iMap].nBase, &map[iMap].nInfo, &map[iMap].nItem, &map[iMap].nDoor, &map[iMap].nChar); - // Allocate our memory, return 1 on error. + // Allocate our memory, return 1 on error. map[iMap].Base = realloc(map[iMap].Base, map[iMap].nBase * sizeof(struct Base)); if (map[iMap].Base == NULL) @@ -582,8 +582,8 @@ int loadMap() { // This makes it work for some reason. strncpy(buffer, "", 256); - - //Switch maps and reset our values + + // Switch maps and reset our values iMap++; iBase = 0; iInfo = 0; diff --git a/Source/engineMaps.h b/Source/engineMaps.h index 3b04b3a..9abe769 100644 --- a/Source/engineMaps.h +++ b/Source/engineMaps.h @@ -11,6 +11,8 @@ // You should have received a copy of the GNU General Public License along with LibreWands. If // not, see https://www.gnu.org/licenses/. +// --- + // For more information on the world maps part of this game engine, see the LibreWands book. // Monsters that characters sometimes carry. See char below. diff --git a/Source/playJoycon.c b/Source/playJoycon.c index 0e54db8..1884dc3 100644 --- a/Source/playJoycon.c +++ b/Source/playJoycon.c @@ -12,7 +12,6 @@ // not, see https://www.gnu.org/licenses/. #include "engineCore.c" -#include // Get controller input and display which button was last pressed. int main() @@ -67,7 +66,7 @@ int main() mvprintw(7, 2, "START"); // Print our cursor on the same line as the coresponding button press. - mvprintw(a, 0, ">"); + mvprintw(cursorPos, 0, ">"); refresh(); } endwin(); diff --git a/Tools/comment-checker.sh b/Tools/comment-checker.sh index 732499f..fd54b51 100755 --- a/Tools/comment-checker.sh +++ b/Tools/comment-checker.sh @@ -8,7 +8,10 @@ # You should have received a copy of the GNU General Public License along with LibreWands. If not, see https://www.gnu.org/licenses/. -# 20% Appears to be a good value. +# --- + +# Calculates the percentage of commented lines ofer total lines of code. +# 20% Appears to be an excellent value. 17.5 is good, and 15 is okay. if [ -z "$1" ] then diff --git a/Tools/copyright-checker.sh b/Tools/copyright-checker.sh index ebfb70c..4783f83 100755 --- a/Tools/copyright-checker.sh +++ b/Tools/copyright-checker.sh @@ -6,5 +6,9 @@ # You should have received a copy of the GNU General Public License along with LibreWands. If not, see https://www.gnu.org/licenses/. +# --- + +# Checks for files with missing copyright information + find ../ -type f -not -path '../Build/*' -not -path '../.git/*' -not -name 'LICENSE' | xargs grep -LE "This file is part of LibreWands."