Skip to content

Commit

Permalink
fix build, update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Auto committed Jul 11, 2024
1 parent fc14110 commit 1d1b5ef
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
2 changes: 0 additions & 2 deletions docs/game_data/spel2.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions docs/src/includes/_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3213,9 +3213,10 @@ Type | Name | Description
[CustomTheme](#CustomTheme) | [new()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=CustomTheme) | Create a new theme with base dwelling and id 100.
string | [level_file](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=level_file) | Level file to load. Probably doesn't do much in custom themes, especially if you're forcing them in PRE_LOAD_LEVEL_FILES.
int | [theme](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=theme) | Theme index. Probably shouldn't collide with the vanilla ones. Purpose unknown.
int | [base_theme](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=base_theme) | Base [THEME](#THEME) to load enabled functions from, when no other theme is specified.
map<[DYNAMIC_TEXTURE](#DYNAMIC_TEXTURE), [TEXTURE](#TEXTURE)> | [textures](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=textures) | Add TEXTUREs here to override different dynamic textures.
| [override](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=override) | `override(THEME_OVERRIDE override, bool enabled)` To disable or enable theme functions using the base_theme.<br/>`override(THEME_OVERRIDE override, THEME theme)` To override a theme function with another theme.<br/>`override(THEME_OVERRIDE override, function func)` To override a theme function with a lua function.<br/>
nil | [override(THEME_OVERRIDE index, bool enabled_)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=override) | To disable or enable theme functions using the base_theme.
nil | [override(THEME_OVERRIDE index, int theme_)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=override) | To override a theme function with another theme.
nil | [override(THEME_OVERRIDE index, function func_)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=override) | To override a theme function with a lua function.
nil | [pre(THEME_OVERRIDE index, function func_)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=pre) | Set a callback to be called before this theme function.
nil | [post(THEME_OVERRIDE index, function func_)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=post) | Set a callback to be called after this theme function, to fix some changes it did for example.
int | [base_theme](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=base_theme) | Base [THEME](#THEME) to load enabled functions from, when no other theme is specified.
Expand Down
6 changes: 3 additions & 3 deletions src/game_api/color.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ struct Color
return {toRGB(r), toRGB(g), toRGB(b), toRGB(a)};
}
/// Changes color based on given RGBA colors in 0..255 range
Color& set_rgba(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) noexcept
Color& set_rgba(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
{
r = red / 255.0f;
g = green / 255.0f;
Expand All @@ -143,7 +143,7 @@ struct Color
return (toRGB(a) << 24) + (toRGB(b) << 16) + (toRGB(g) << 8) + (toRGB(r));
}
/// Changes color based on given uColor
Color& set_ucolor(const uColor color) noexcept
Color& set_ucolor(const uColor color)
{
uint8_t red = color & 0xFF;
uint8_t green = (color >> 8U) & 0xFF;
Expand All @@ -153,7 +153,7 @@ struct Color
}

/// Copies the values of different Color to this one
Color& set(Color& other) noexcept
Color& set(Color& other)
{
*this = other;
return *this;
Expand Down
36 changes: 18 additions & 18 deletions src/game_api/math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct Vec2
/// NoDoc
Vec2(const ImVec2&) noexcept;

Vec2& rotate(float angle, float px, float py) noexcept
Vec2& rotate(float angle, float px, float py)
{
const float sin_a{std::sin(angle)};
const float cos_a{std::cos(angle)};
Expand All @@ -45,7 +45,7 @@ struct Vec2
diff *= diff; // pow
return (float)std::sqrt(diff.x + diff.y);
}
Vec2& set(const Vec2& other) noexcept
Vec2& set(const Vec2& other)
{
*this = other;
return *this;
Expand Down Expand Up @@ -181,7 +181,7 @@ struct AABB
}

/// Fixes the AABB if any of the sides have negative length
AABB& abs() noexcept
AABB& abs()
{
if (left > right)
std::swap(left, right);
Expand All @@ -192,13 +192,13 @@ struct AABB

/// Grows or shrinks the AABB by the given amount in all directions.
/// If `amount < 0` and `abs(amount) > right/top - left/bottom` the respective dimension of the AABB will become `0`.
AABB& extrude(float amount) noexcept
AABB& extrude(float amount)
{
return extrude(amount, amount);
}
/// Grows or shrinks the AABB by the given amount in each direction.
/// If `amount_x/y < 0` and `abs(amount_x/y) > right/top - left/bottom` the respective dimension of the AABB will become `0`.
AABB& extrude(float amount_x, float amount_y) noexcept
AABB& extrude(float amount_x, float amount_y)
{
left -= amount_x;
right += amount_x;
Expand All @@ -218,7 +218,7 @@ struct AABB
return *this;
}
/// Offsets the AABB by the given offset.
AABB& offset(float off_x, float off_y) noexcept
AABB& offset(float off_x, float off_y)
{
left += off_x;
bottom += off_y;
Expand Down Expand Up @@ -280,7 +280,7 @@ struct AABB

return false;
}
AABB& set(const AABB& other) noexcept
AABB& set(const AABB& other)
{
*this = other;
return *this;
Expand Down Expand Up @@ -309,14 +309,14 @@ struct Triangle
Triangle(float ax, float ay, float bx, float by, float cx, float cy) noexcept
: A(ax, ay), B(bx, by), C(cx, cy){};

Triangle& offset(const Vec2& off) noexcept
Triangle& offset(const Vec2& off)
{
A += off;
B += off;
C += off;
return *this;
}
Triangle& offset(float x, float y) noexcept
Triangle& offset(float x, float y)
{
return offset({x, y});
}
Expand All @@ -334,7 +334,7 @@ struct Triangle
}
Triangle& operator=(const Triangle& a) = default;
/// Rotate triangle by an angle, the px/py are just coordinates, not offset from the center
Triangle& rotate(float angle, float px, float py) noexcept
Triangle& rotate(float angle, float px, float py)
{
const float sin_a{std::sin(angle)};
const float cos_a{std::cos(angle)};
Expand Down Expand Up @@ -371,7 +371,7 @@ struct Triangle
float a_cab = std::abs(std::atan2(ab.y * ac.x - ab.x * ac.y, ab.x * ac.x + ab.y * ac.y));
return {a_abc, a_cab, a_bca};
}
Triangle& scale(float scale) noexcept
Triangle& scale(float scale)
{
Vec2 centroid = center();
A = (A - centroid) * scale + centroid;
Expand All @@ -396,7 +396,7 @@ struct Triangle
{
return is_point_inside(Vec2{x, y}, epsilon);
}
Triangle& set(const Triangle& other) noexcept
Triangle& set(const Triangle& other)
{
*this = other;
return *this;
Expand Down Expand Up @@ -446,11 +446,11 @@ struct Quad
result.bottom = std::min({bottom_left_y, bottom_right_y, top_right_y, top_left_y});
return result;
}
Quad& offset(const Vec2& vec) noexcept
Quad& offset(const Vec2& vec)
{
return offset(vec.x, vec.y);
}
Quad& offset(float off_x, float off_y) noexcept
Quad& offset(float off_x, float off_y)
{
bottom_left_x += off_x;
bottom_right_x += off_x;
Expand Down Expand Up @@ -485,7 +485,7 @@ struct Quad
}

/// Rotates a Quad by an angle, px/py are not offsets, use `:get_AABB():center()` to get approximated center for simetrical quadrangle
Quad& rotate(float angle, float px, float py) noexcept
Quad& rotate(float angle, float px, float py)
{
const float sin_a{std::sin(angle)};
const float cos_a{std::cos(angle)};
Expand All @@ -509,7 +509,7 @@ struct Quad
return *this;
}

Quad& flip_horizontally() noexcept
Quad& flip_horizontally()
{
std::swap(top_left_x, top_right_x);
std::swap(top_left_y, top_right_y);
Expand All @@ -519,7 +519,7 @@ struct Quad
return *this;
}

Quad& flip_vertically() noexcept
Quad& flip_vertically()
{
std::swap(top_left_x, bottom_left_x);
std::swap(top_left_y, bottom_left_y);
Expand All @@ -542,7 +542,7 @@ struct Quad
{
return is_point_inside(Vec2{x, y}, epsilon);
}
Quad& set(const Quad& other) noexcept
Quad& set(const Quad& other)
{
*this = other;
return *this;
Expand Down
1 change: 1 addition & 0 deletions src/game_api/script/sol_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <cstdint>
#include <span>
#include <stdexcept>
#include <tuple>

template <class T>
struct ZeroIndexArray
Expand Down
7 changes: 4 additions & 3 deletions src/game_api/script/usertypes/color_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "aliases.hpp"
#include "color.hpp"
#include "script/sol_helper.hpp" // for self_return

namespace NColor
{
Expand Down Expand Up @@ -43,9 +44,9 @@ void register_usertypes(sol::state& lua)
color_type["fuchsia"] = &Color::fuchsia;
color_type["purple"] = &Color::purple;
color_type["get_rgba"] = &Color::get_rgba;
color_type["set_rgba"] = &Color::set_rgba;
color_type["set_rgba"] = self_return<&Color::set_rgba>();
color_type["get_ucolor"] = &Color::get_ucolor;
color_type["set_ucolor"] = &Color::set_ucolor;
color_type["set"] = &Color::set;
color_type["set_ucolor"] = self_return<&Color::set_ucolor>();
color_type["set"] = self_return<&Color::set>();
}
} // namespace NColor
1 change: 0 additions & 1 deletion src/game_api/script/usertypes/entity_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "render_api.hpp" // for RenderInfo, RenderInfo::flip_horiz...
#include "script/lua_backend.hpp" // for LuaBackend
#include "script/safe_cb.hpp" // for make_safe_cb
#include "script/sol_helper.hpp" // for self_return

namespace NEntity
{
Expand Down

0 comments on commit 1d1b5ef

Please sign in to comment.