diff --git a/.gitignore b/.gitignore index 2c5a8cf..df3990f 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ __pycache__/ .vscode tilesetnpp.json + +docs/ diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 0000000..dea9786 --- /dev/null +++ b/Doxyfile @@ -0,0 +1,305 @@ +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = "Collab RPG" +PROJECT_NUMBER = +PROJECT_BRIEF = +PROJECT_LOGO = +OUTPUT_DIRECTORY = docs +CREATE_SUBDIRS = NO +CREATE_SUBDIRS_LEVEL = 8 +ALLOW_UNICODE_NAMES = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +JAVADOC_BANNER = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +PYTHON_DOCSTRING = YES +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +OPTIMIZE_OUTPUT_SLICE = NO +EXTENSION_MAPPING = +MARKDOWN_SUPPORT = YES +TOC_INCLUDE_HEADINGS = 5 +MARKDOWN_ID_STYLE = DOXYGEN +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +GROUP_NESTED_COMPOUNDS = NO +SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 +NUM_PROC_THREADS = 1 +TIMESTAMP = DATETIME +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_PRIV_VIRTUAL = NO +EXTRACT_PACKAGE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +RESOLVE_UNNAMED_PARAMS = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = SYSTEM +HIDE_SCOPE_NAMES = YES +HIDE_COMPOUND_REFERENCE= NO +SHOW_HEADERFILE = YES +SHOW_INCLUDE_FILES = YES +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_FILES = YES +SHOW_NAMESPACES = YES +FILE_VERSION_FILTER = +LAYOUT_FILE = +CITE_BIB_FILES = +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_IF_INCOMPLETE_DOC = YES +WARN_NO_PARAMDOC = NO +WARN_IF_UNDOC_ENUM_VAL = NO +WARN_AS_ERROR = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LINE_FORMAT = "at line $line of file $file" +WARN_LOGFILE = +INPUT = src +INPUT_ENCODING = UTF-8 +INPUT_FILE_ENCODING = +FILE_PATTERNS = *.h \ + *.md +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +FILTER_SOURCE_PATTERNS = +USE_MDFILE_AS_MAINPAGE = +FORTRAN_COMMENT_AFTER = 72 +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +CLANG_ASSISTED_PARSING = NO +CLANG_ADD_INC_PATHS = YES +CLANG_OPTIONS = +CLANG_DATABASE_PATH = +ALPHABETICAL_INDEX = YES +IGNORE_PREFIX = +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_EXTRA_STYLESHEET = +HTML_EXTRA_FILES = +HTML_COLORSTYLE = AUTO_LIGHT +HTML_COLORSTYLE_HUE = 359 +HTML_COLORSTYLE_SAT = 0 +HTML_COLORSTYLE_GAMMA = 240 +HTML_DYNAMIC_MENUS = YES +HTML_DYNAMIC_SECTIONS = NO +HTML_CODE_FOLDING = YES +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_FEEDURL = +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +CHM_INDEX_ENCODING = +BINARY_TOC = NO +TOC_EXPAND = NO +SITEMAP_URL = +GENERATE_QHP = NO +QCH_FILE = +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +QHP_CUST_FILTER_NAME = +QHP_CUST_FILTER_ATTRS = +QHP_SECT_FILTER_ATTRS = +QHG_LOCATION = +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +FULL_SIDEBAR = NO +ENUM_VALUES_PER_LINE = 4 +TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +OBFUSCATE_EMAILS = YES +HTML_FORMULA_FORMAT = png +FORMULA_FONTSIZE = 10 +FORMULA_MACROFILE = +USE_MATHJAX = NO +MATHJAX_VERSION = MathJax_2 +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = +MATHJAX_EXTENSIONS = +MATHJAX_CODEFILE = +SEARCHENGINE = YES +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHENGINE_URL = +SEARCHDATA_FILE = searchdata.xml +EXTERNAL_SEARCH_ID = +EXTRA_SEARCH_MAPPINGS = +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = +MAKEINDEX_CMD_NAME = makeindex +LATEX_MAKEINDEX_CMD = makeindex +COMPACT_LATEX = YES +PAPER_TYPE = a4 +EXTRA_PACKAGES = +LATEX_HEADER = +LATEX_FOOTER = +LATEX_EXTRA_STYLESHEET = +LATEX_EXTRA_FILES = +PDF_HYPERLINKS = NO +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +LATEX_BIB_STYLE = plain +LATEX_EMOJI_DIRECTORY = +GENERATE_RTF = YES +RTF_OUTPUT = rtf +COMPACT_RTF = YES +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_SUBDIR = +MAN_LINKS = NO +GENERATE_XML = NO +XML_OUTPUT = xml +XML_PROGRAMLISTING = YES +XML_NS_MEMB_FILE_SCOPE = NO +GENERATE_DOCBOOK = NO +DOCBOOK_OUTPUT = docbook +GENERATE_AUTOGEN_DEF = NO +GENERATE_SQLITE3 = NO +SQLITE3_OUTPUT = sqlite3 +SQLITE3_RECREATE_DB = YES +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +DOT_NUM_THREADS = 0 +DOT_COMMON_ATTR = "fontname=Helvetica,fontsize=10" +DOT_EDGE_ATTR = "labelfontname=Helvetica,labelfontsize=10" +DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4" +DOT_FONTPATH = +CLASS_GRAPH = TEXT +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +UML_LIMIT_NUM_FIELDS = 10 +DOT_UML_DETAILS = NO +DOT_WRAP_THRESHOLD = 17 +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DIR_GRAPH_MAX_DEPTH = 1 +DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = NO +DOT_PATH = +DOTFILE_DIRS = +DIA_PATH = +DIAFILE_DIRS = +PLANTUML_JAR_PATH = +PLANTUML_CFG_FILE = +PLANTUML_INCLUDE_PATH = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +MSCGEN_TOOL = +MSCFILE_DIRS = \ No newline at end of file diff --git a/STYLE.md b/STYLE.md index fae5c75..30f2bc2 100644 --- a/STYLE.md +++ b/STYLE.md @@ -6,7 +6,7 @@ Variables names in sneak_case. Name your procedures as following: `filename_whatitdoes`. -The procedures are documented using sphinx. +The procedures are documented using doxygen in the Java style. We're using `clang-formatter` to keep the code readable. Please run it before committing your code as following: `clang-format -i *` in the `src` folder. diff --git a/assets/converters.py b/assets/converters.py index c3ddc50..cfb2ea8 100644 --- a/assets/converters.py +++ b/assets/converters.py @@ -427,3 +427,9 @@ def convert_dialog(input: str, output: str, params: dict, target): sys.stderr.write(f"ERROR: Failed convert dialogs.\n" + f" Error message: {e}\n") sys.exit(1) + +def convert_world(input: str, output: str, params: dict, target): + # (Mibi88) WIP + world_struct = fxconv.Structure() + name = os.path.splitext(os.path.basename(input))[0] + fxconv.elf(world_struct, output, f"_{name}", **target) diff --git a/assets/WorldRPG.world b/assets/worldRPG.world similarity index 100% rename from assets/WorldRPG.world rename to assets/worldRPG.world diff --git a/src/dialogs.h b/src/dialogs.h index dae2adf..27448b2 100644 --- a/src/dialogs.h +++ b/src/dialogs.h @@ -8,32 +8,37 @@ #include #include -/* dialogs_text_opt() +/** * * Show some text in a box with word wrap for dialogs. * - * game: The game struct of the current game. - * face: A bopti_image_t of the face of the person who's saying this - * text. This bopti_image_t should have a width of F_WIDTH and - * a height of F_HEIGHT. - * text: The text to display. - * call_before_end: A function called when the end of the text was displayed and - * the user pressed EXE (or wait_continue was true). His - * parameter game is the game struct passed to showtext_opt, - * and i is the current position in text. - * start_anim: A boolean, that, if he's true, makes that a little animation - * is shown at the start of showtext_opt. - * end_anim: A boolean, that, if he's true, makes that a little animation - * is shown at the end of showtext_opt. - * for_each_screen: A function called before a page of the dialog gets drawn. - * His parameter game is the game struct passed to - * showtext_opt, and i is the current position in text. - * line_duration: How many ms showtext_opt will wait after a line has been - * drawn. - * update_screen: When he's true showtext_opt will update the screen after - * drawing a line etc. - * start_i: At which position I start displaying the text. - * wait_continue: If I should wait that EXE is pressed after drawing a page. + * @param game The game struct of the current game. + * @param face A bopti_image_t of the face of the person who's saying + * this text. This bopti_image_t should have a width of + * F_WIDTH and a height of F_HEIGHT. + * @param text The text to display. + * @param call_before_end A function called when the end of the text was + * displayed and the user pressed SHIFT (or wait_continue + * was true). His parameter game is the game struct + * passed to showtext_opt, and i is the current position + * in text. + * @param start_anim A boolean, that, if he's true, makes that a little + * animation is shown at the start of showtext_opt. + * @param end_anim A boolean, that, if he's true, makes that a little + * animation is shown at the end of showtext_opt. + * @param for_each_screen A function called before a page of the dialog gets + * drawn. + * His parameter game is the game struct passed to + * showtext_opt, and i is the current position in text. + * @param line_duration How many ms showtext_opt will wait after a line has + * been drawn. + * @param update_screen When he's true showtext_opt will update the screen + * after drawing a line etc. + * @param start_i At which position I start displaying the text. + * @param wait_continue If I should wait that EXE is pressed after drawing a + * page. + * + * @return TODO */ int dialogs_text_opt(Game *game, bopti_image_t *face, char *text, @@ -43,51 +48,54 @@ int dialogs_text_opt(Game *game, bopti_image_t *face, char *text, int line_duration, bool update_screen, unsigned int start_i, bool wait_continue); -/* dialogs_text() +/** * * Calls dialogs_text_opt with default parameters. * - * game: The game struct of the current game. - * face: A bopti_image_t of the face of the person who's saying this - * text. This bopti_image_t should have a width of F_WIDTH and a - * height of F_HEIGHT. - * text: The text to display. - * dialog_start: A boolean, that, if he's true, makes that a little animation is - * shown at the start of showtext_opt. - * dialog_end: A boolean, that, if he's true, makes that a little animation is - * shown at the end of showtext_opt. + * @param game The game struct of the current game. + * @param face A bopti_image_t of the face of the person who's saying + * this text. This bopti_image_t should have a width of + * F_WIDTH and a height of F_HEIGHT. + * @param text The text to display. + * @param dialog_start A boolean, that, if he's true, makes that a little + * animation is shown at the start of showtext_opt. + * @param dialog_end A boolean, that, if he's true, makes that a little + * animation is shown at the end of showtext_opt. */ void dialogs_text(Game *game, bopti_image_t *face, char *text, bool dialog_start, bool dialog_end); -/* dialogs_ask() +/** * * Like dialogs_text, but lets the user choose between multiple possible * choices after displaying the text. * - * game: The game struct of the current game. - * face: A bopti_image_t of the face of the person who's saying this - * text. This bopti_image_t should have a width of F_WIDTH and a - * height of F_HEIGHT. - * text: The text to display. - * start: A boolean, that, if he's true, makes that a little animation - * is shown at the start of showtext_opt. - * end: A boolean, that, if he's true, makes that a little animation - * is shown at the end of showtext_opt. - * choices: A pointer to null-terminated strings that are one after the - * other in memory. They should be one null-terminated string - * for each possible choice. - * choice_amount: The amount of possible choices in the choices zero-terminated - * strings. - * default_choice: The choice choosen by default when the dialog just opened. + * @param game The game struct of the current game. + * @param face A bopti_image_t of the face of the person who's saying + * this text. This bopti_image_t should have a width of + * F_WIDTH and a height of F_HEIGHT. + * @param text The text to display. + * @param start A boolean, that, if he's true, makes that a little + * animation is shown at the start of showtext_opt. + * @param end A boolean, that, if he's true, makes that a little + * animation is shown at the end of showtext_opt. + * @param choices A pointer to null-terminated strings that are one after + * the other in memory. They should be one null-terminated + * string for each possible choice. + * @param choice_amount The amount of possible choices in the choices + * zero-terminated strings. + * @param default_choice The choice choosen by default when the dialog just + * opened. */ int dialogs_ask(Game *game, bopti_image_t *face, char *text, bool start, bool end, char *choices, int choices_amount, int default_choice); -/* TODO: Doc. */ +/** + * TODO: Doc. + */ void dialogs_initiate_sequence(Game *game, bopti_image_t *face, uint32_t dialogNumber); diff --git a/src/events.h b/src/events.h index a095283..c87b35b 100644 --- a/src/events.h +++ b/src/events.h @@ -32,13 +32,13 @@ typedef enum { OP_AMOUNT } Operation; -/* events_init_handler() +/** * * Initialize an event handler. * handler: The Event handler to initialize. */ void events_init_handler(EventHandler *handler); -/* events_bind_variable() +/** * * Bind a variable. Binding a variable allows it to be modified by messages * passed to the event handler using tags written as following: @@ -55,7 +55,7 @@ void events_init_handler(EventHandler *handler); * refer to this variable in a tag. */ int events_bind_variable(EventHandler *handler, int *var, char *name); -/* events_parse_string() +/** * handler: The event handler. * message: The message to parse. */ diff --git a/src/game.h b/src/game.h index f42269a..0f8999c 100644 --- a/src/game.h +++ b/src/game.h @@ -228,20 +228,20 @@ typedef struct { int mana; /* Only for testing events TODO: Remove this! */ } Game; -/* TODO: Doc! */ +/** TODO: Doc! */ void game_init(Game *game); -/* (Mibi88) TODO: Describe what this function is doing. */ +/** (Mibi88) TODO: Describe what this function is doing. */ void game_logic(Game *game); -/* game_draw() +/** * * Draws everything on screen. * game: The game struct. */ void game_draw(Game *game); -/* game_render_indicator() +/** * * This render a small sign on the upper left corner of the screen * if the player can do an action @@ -249,14 +249,14 @@ void game_draw(Game *game); */ void game_render_indicator(Game *game); -/* game_get_inputs() +/** * * Handle key presses. * game: The game struct. */ void game_get_inputs(Game *game); -/* TODO: Doc! */ +/** TODO: Doc! */ void game_update_animations(Game *game, unsigned char ms); #endif diff --git a/src/map.h b/src/map.h index 249f148..2e5a481 100644 --- a/src/map.h +++ b/src/map.h @@ -15,14 +15,14 @@ /* to avoid circular references between map.h, game.h and player.h */ /* only methods propotypes are now in dedicated header files */ -/* map_render() +/** * * Draws the map map on the entire screen to be viewed by the player player. * game: The game struct. */ void map_render(Game *game); -/* map_render_by_layer() +/** * * Draws the map layer on the entire screen to be viewed by the player player. * game: The game struct. @@ -30,7 +30,7 @@ void map_render(Game *game); */ void map_render_by_layer(Game *game, int layer); -/* map_get_tile() +/** * * Get the tile at (x, y) of the map map. If the tile is located outside of the * screen, MAP_OUTSIDE is returned. @@ -41,7 +41,7 @@ void map_render_by_layer(Game *game, int layer); */ short int map_get_tile(Game *game, int x, int y, int l); -/* map_get_walkable() +/** * * Returns what is in the walkable layer at (x, y). * game: The game struct. @@ -50,6 +50,7 @@ short int map_get_tile(Game *game, int x, int y, int l); */ short int map_get_walkable(Game *game, int x, int y); +/// TODO: Doc Map *map_get_for_tile(Game *game, int x, int y); #endif diff --git a/src/memory.h b/src/memory.h index bff49ab..fb91b89 100644 --- a/src/memory.h +++ b/src/memory.h @@ -2,7 +2,7 @@ #define MEMORY_H #include -/* memory_is_in() +/** * * returns true if item is in array. * array: The array to search in. diff --git a/src/player.h b/src/player.h index a34bd75..95ee7c6 100644 --- a/src/player.h +++ b/src/player.h @@ -18,7 +18,7 @@ typedef struct { /* to avoid circular references between map.h, game.h and player.h */ /* only methods propotypes are now in dedicated header files */ -/* player_draw() +/** * * Draws the player. This function should be called after drawing the * map! @@ -26,7 +26,7 @@ typedef struct { */ void player_draw(Game *game); -/* player_move() +/** * * Move the player in a direction. * game: The game struct. @@ -38,7 +38,7 @@ void player_move(Game *game, Direction direction); * is pressed)*/ void player_action(Game *game); -/* player_collision() +/** * * Check if the player is in collision with the map or a NPC. Checkpos is used * to check the axis where the player is not moving. @@ -49,7 +49,7 @@ void player_action(Game *game); bool player_collision(Game *game, Direction direction, Checkpos nomov_axis_check); -/* player_fix_position() +/** * * Fix the position of the player so that he's not a bit inside of a hard block * after a collision. @@ -59,7 +59,7 @@ bool player_collision(Game *game, Direction direction, */ void player_fix_position(Game *game, bool fix_x, bool fix_y); -/* player_damage() +/** * * Apply damage to player * game: The game struct.