From 954b1f5c0d7469468cadf4ed659c8e819feb3fbc Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Sun, 21 Mar 2021 11:43:35 +0200 Subject: [PATCH] Use native types. And add more constructors. --- module/Misc/Official.cpp | 10 ++++++---- module/Misc/Official.hpp | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/module/Misc/Official.cpp b/module/Misc/Official.cpp index 3b0c309e..28e448ed 100644 --- a/module/Misc/Official.cpp +++ b/module/Misc/Official.cpp @@ -329,11 +329,13 @@ void Register_Official(HSQUIRRELVM vm) DerivedClass< LgRGBA, Color4 >(vm, RGBATn::Str) // Constructors .Ctor< LgRGBA::Value, LgRGBA::Value, LgRGBA::Value >() + .Ctor< LgRGBA::Value, LgRGBA::Value, LgRGBA::Value, LgRGBA::Value >() ); // -------------------------------------------------------------------------------------------- RootTable(vm).Bind(ARGBTn::Str, DerivedClass< LgARGB, Color4 >(vm, ARGBTn::Str) // Constructors + .Ctor< LgARGB::Value, LgARGB::Value, LgARGB::Value >() .Ctor< LgARGB::Value, LgARGB::Value, LgARGB::Value, LgARGB::Value >() ); // -------------------------------------------------------------------------------------------- @@ -361,7 +363,7 @@ void Register_Official(HSQUIRRELVM vm) RootTable(vm).Bind(WastedSettingsTn::Str, Class< LgWastedSettings >(vm, WastedSettingsTn::Str) // Constructors - .Ctor< uint32_t, uint32_t, float, float, LgRGB, uint32_t, uint32_t >() + .Ctor< uint32_t, uint32_t, float, float, const Color3 &, uint32_t, uint32_t >() // Member Variables .Var(_SC("DeathTime"), &LgWastedSettings::mDeathTime) .Var(_SC("FadeTime"), &LgWastedSettings::mFadeTime) @@ -655,7 +657,7 @@ struct LgPlayer void SetSecWorld(int world) const { Get().SetSecondaryWorld(world); } void SetTeam(int team) const { Get().SetTeam(team); } void SetSkin(int skin) const { Get().SetSkin(skin); } - void SetColour(const LgRGB & colour) const { Get().SetColor(colour); } + void SetColour(const Color3 & colour) const { Get().SetColor(colour); } void SetMoney(int money) const { Get().SetMoney(money); } void SetScore(int score) const { Get().SetScore(score); } void SetImmunity(uint32_t immunity) const { Get().SetImmunity(immunity); } @@ -1344,7 +1346,7 @@ SQMOD_NODISCARD static bool LgEnabledWallglitch() { return _Func->GetServerOptio SQMOD_NODISCARD static bool LgEnabledDisableBackfaceCulling() { return _Func->GetServerOption(vcmpServerOptionDisableBackfaceCulling) >= 1; } SQMOD_NODISCARD static bool LgEnabledDisableHeliBladeDamage() { return _Func->GetServerOption(vcmpServerOptionDisableHeliBladeDamage) >= 1; } // ------------------------------------------------------------------------------------------------ -SQMOD_NODISCARD static int LgCreateBlip(int world, const Vector3 & pos, int scale, const LgRGBA & color, int sprite) +SQMOD_NODISCARD static int LgCreateBlip(int world, const Vector3 & pos, int scale, const Color4 & color, int sprite) { return _Func->CreateCoordBlip(-1, world, pos.x, pos.y, pos.z, scale, color.GetRGBA(), sprite); } static void LgDestroyBlip(int blip) { _Func->DestroyCoordBlip(blip); } // ------------------------------------------------------------------------------------------------ @@ -1372,7 +1374,7 @@ static void LgSetUseClasses(bool toggle) { _Func->SetServerOption(vcmpServerOptionUseClasses, static_cast< uint8_t >(toggle)); } static bool LgUsingClasses() { return _Func->GetServerOption(vcmpServerOptionUseClasses) >= 1; } -static void LgAddClass(int team, const LgRGB & col, int skin, const Vector3 & pos, float angle, +static void LgAddClass(int team, const Color3 & col, int skin, const Vector3 & pos, float angle, int wep1, int ammo1, int wep2, int ammo2, int wep3, int ammo3) { _Func->AddPlayerClass(team, col.GetRGBA(), skin, pos.x, pos.y, pos.z, angle, wep1, ammo1, wep2, ammo2, wep3, ammo3); } // ------------------------------------------------------------------------------------------------ diff --git a/module/Misc/Official.hpp b/module/Misc/Official.hpp index 05d8cadd..a66cc278 100644 --- a/module/Misc/Official.hpp +++ b/module/Misc/Official.hpp @@ -400,7 +400,7 @@ struct LgWastedSettings uint32_t mFadeTime{0}; float mFadeInSpeed{0.0f}; float mFadeOutSpeed{0.0f}; - LgRGB mFadeColour{0}; + Color3 mFadeColour{0}; uint32_t mCorpseFadeDelay{0}; uint32_t mCorpseFadeTime{0}; @@ -413,7 +413,7 @@ struct LgWastedSettings * Construct with individually specified settings. */ LgWastedSettings(uint32_t death_time, uint32_t fade_time, float fade_in_speed, float fade_out_speed, - LgRGB fade_colour, uint32_t corpse_fade_delay, uint32_t corpse_fade_time) + const Color3 & fade_colour, uint32_t corpse_fade_delay, uint32_t corpse_fade_time) : mDeathTime(death_time) , mFadeTime(fade_time) , mFadeInSpeed(fade_in_speed)