mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-23 03:22:08 +00:00
Make comments more consistent
- Changes most `/* comments */` to `// comments` - Changes `/**` block comments consistently to `/*` - Adds consistent license comments to all files Also renames `T_POP_SET` to `T_Z80_SET`
This commit is contained in:
@@ -153,7 +153,7 @@ static void printUsage(void) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Parses a number at the beginning of a string, moving the pointer to skip the parsed characters
|
||||
* Returns the provided errVal on error
|
||||
*/
|
||||
@@ -179,7 +179,7 @@ static uint16_t parseNumber(char *&string, char const *errPrefix, uint16_t errVa
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Turns a digit into its numeric value in the current base, if it has one.
|
||||
* Maximum is inclusive. The string_view is modified to "consume" all digits.
|
||||
* Returns 255 on parse failure (including wrong char for base), in which case
|
||||
@@ -248,7 +248,7 @@ static void registerInput(char const *arg) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Turn an "at-file"'s contents into an argv that `getopt` can handle
|
||||
* @param argPool Argument characters will be appended to this vector, for storage purposes.
|
||||
*/
|
||||
@@ -317,7 +317,7 @@ static std::vector<size_t> readAtFile(std::string const &path, std::vector<char>
|
||||
} while (c != '\n' && c != EOF); // End if we reached EOL
|
||||
}
|
||||
}
|
||||
/**
|
||||
/*
|
||||
* Parses an arg vector, modifying `options` as options are read.
|
||||
* The three booleans are for the "auto path" flags, since their processing must be deferred to the
|
||||
* end of option parsing.
|
||||
@@ -785,7 +785,7 @@ void Palette::addColor(uint16_t color) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the ID of the color in the palette, or `size()` if the color is not in
|
||||
*/
|
||||
uint8_t Palette::indexOf(uint16_t color) const {
|
||||
|
||||
@@ -39,12 +39,12 @@ namespace packing {
|
||||
// Tile | Proto-palette
|
||||
// Page | Palette
|
||||
|
||||
/**
|
||||
/*
|
||||
* A reference to a proto-palette, and attached attributes for sorting purposes
|
||||
*/
|
||||
struct ProtoPalAttrs {
|
||||
size_t const protoPalIndex;
|
||||
/**
|
||||
/*
|
||||
* Pages from which we are banned (to prevent infinite loops)
|
||||
* This is dynamic because we wish not to hard-cap the amount of palettes
|
||||
*/
|
||||
@@ -62,7 +62,7 @@ struct ProtoPalAttrs {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* A collection of proto-palettes assigned to a palette
|
||||
* Does not contain the actual color indices because we need to be able to remove elements
|
||||
*/
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
}
|
||||
const_iterator end() const { return const_iterator{&_assigned, _assigned.end()}; }
|
||||
|
||||
/**
|
||||
/*
|
||||
* Assigns a new ProtoPalAttrs in a free slot, assuming there is one
|
||||
* Args are passed to the `ProtoPalAttrs`'s constructor
|
||||
*/
|
||||
@@ -198,7 +198,7 @@ private:
|
||||
return colors;
|
||||
}
|
||||
public:
|
||||
/**
|
||||
/*
|
||||
* Returns the number of distinct colors
|
||||
*/
|
||||
size_t volume() const { return uniqueColors().size(); }
|
||||
@@ -208,7 +208,7 @@ public:
|
||||
return colors.size() <= options.maxOpaqueColors();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Computes the "relative size" of a proto-palette on this palette
|
||||
*/
|
||||
double relSizeOf(ProtoPalette const &protoPal) const {
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
return relSize;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Computes the "relative size" of a set of proto-palettes on this palette
|
||||
*/
|
||||
template<typename Iter>
|
||||
@@ -237,7 +237,7 @@ public:
|
||||
addUniqueColors(colors, std::forward<Iter>(begin), end, protoPals);
|
||||
return colors.size();
|
||||
}
|
||||
/**
|
||||
/*
|
||||
* Computes the "relative size" of a set of colors on this palette
|
||||
*/
|
||||
template<typename Iter>
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* This file is part of RGBDS.
|
||||
*
|
||||
* Copyright (c) 2022, Eldred Habert and RGBDS contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "gfx/pal_sorting.hpp"
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ void parseInlinePalSpec(char const * const rawArg) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Tries to read some magic bytes from the provided `file`.
|
||||
* Returns whether the magic was correctly read.
|
||||
*/
|
||||
@@ -191,7 +191,7 @@ static T readBE(U const *bytes) {
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* **Appends** the first line read from `file` to the end of the provided `buffer`.
|
||||
*/
|
||||
static void readLine(std::filebuf &file, std::string &buffer) {
|
||||
@@ -214,7 +214,7 @@ static void readLine(std::filebuf &file, std::string &buffer) {
|
||||
}
|
||||
|
||||
// FIXME: Normally we'd use `std::from_chars`, but that's not available with GCC 7
|
||||
/**
|
||||
/*
|
||||
* Parses the initial part of a string_view, advancing the "read index" as it does
|
||||
*/
|
||||
static uint16_t parseDec(std::string const &str, std::string::size_type &n) {
|
||||
|
||||
@@ -42,7 +42,7 @@ class ImagePalette {
|
||||
public:
|
||||
ImagePalette() = default;
|
||||
|
||||
/**
|
||||
/*
|
||||
* Registers a color in the palette.
|
||||
* If the newly inserted color "conflicts" with another one (different color, but same CGB
|
||||
* color), then the other color is returned. Otherwise, `nullptr` is returned.
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Reads a PNG and notes all of its colors
|
||||
*
|
||||
* This code is more complicated than strictly necessary, but that's because of the API
|
||||
@@ -466,7 +466,7 @@ public:
|
||||
};
|
||||
|
||||
class RawTiles {
|
||||
/**
|
||||
/*
|
||||
* A tile which only contains indices into the image's global palette
|
||||
*/
|
||||
class RawTile {
|
||||
@@ -481,7 +481,7 @@ private:
|
||||
std::vector<RawTile> _tiles;
|
||||
|
||||
public:
|
||||
/**
|
||||
/*
|
||||
* Creates a new raw tile, and returns a reference to it so it can be filled in
|
||||
*/
|
||||
RawTile &newTile() {
|
||||
@@ -491,7 +491,7 @@ public:
|
||||
};
|
||||
|
||||
struct AttrmapEntry {
|
||||
/**
|
||||
/*
|
||||
* This field can either be a proto-palette ID, or `transparent` to indicate that the
|
||||
* corresponding tile is fully transparent. If you are looking to get the palette ID for this
|
||||
* attrmap entry while correctly handling the above, use `getPalID`.
|
||||
@@ -831,7 +831,7 @@ struct UniqueTiles {
|
||||
UniqueTiles(UniqueTiles const &) = delete;
|
||||
UniqueTiles(UniqueTiles &&) = default;
|
||||
|
||||
/**
|
||||
/*
|
||||
* Adds a tile to the collection, and returns its ID
|
||||
*/
|
||||
std::tuple<uint16_t, TileData::MatchType> addTile(Png::TilesVisitor::Tile const &tile,
|
||||
@@ -857,7 +857,7 @@ struct UniqueTiles {
|
||||
auto end() const { return tiles.end(); }
|
||||
};
|
||||
|
||||
/**
|
||||
/*
|
||||
* Generate tile data while deduplicating unique tiles (via mirroring if enabled)
|
||||
* Additionally, while we have the info handy, convert from the 16-bit "global" tile IDs to
|
||||
* 8-bit tile IDs + the bank bit; this will save the work when we output the data later (potentially
|
||||
@@ -986,16 +986,17 @@ void process() {
|
||||
protoPalettes[n] = tileColors; // Override them
|
||||
// Remove any other proto-palettes that we encompass
|
||||
// (Example [(0, 1), (0, 2)], inserting (0, 1, 2))
|
||||
/* The following code does its job, except that references to the removed
|
||||
/*
|
||||
* The following code does its job, except that references to the removed
|
||||
* proto-palettes are not updated, causing issues.
|
||||
* TODO: overlap might not be detrimental to the packing algorithm.
|
||||
* Investigation is necessary, especially if pathological cases are found.
|
||||
|
||||
for (size_t i = protoPalettes.size(); --i != n;) {
|
||||
if (tileColors.compare(protoPalettes[i]) == ProtoPalette::WE_BIGGER) {
|
||||
protoPalettes.erase(protoPalettes.begin() + i);
|
||||
}
|
||||
}
|
||||
*
|
||||
* for (size_t i = protoPalettes.size(); --i != n;) {
|
||||
* if (tileColors.compare(protoPalettes[i]) == ProtoPalette::WE_BIGGER) {
|
||||
* protoPalettes.erase(protoPalettes.begin() + i);
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
[[fallthrough]];
|
||||
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
/*
|
||||
* This file is part of RGBDS.
|
||||
*
|
||||
* Copyright (c) 2022, Eldred Habert and RGBDS contributors.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "gfx/rgba.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
Reference in New Issue
Block a user