This commit is contained in:
@@ -18,14 +18,15 @@ uint32_t PkmnLib::Battling::DamageLibrary::GetDamage(CreatureLib::Battling::Exec
|
||||
return damage;
|
||||
}
|
||||
uint8_t PkmnLib::Battling::DamageLibrary::GetBasePower(CreatureLib::Battling::ExecutingAttack* attack,
|
||||
CreatureLib::Battling::Creature* target, uint8_t hitIndex,
|
||||
const HitData& hitData) const {
|
||||
[[maybe_unused]] CreatureLib::Battling::Creature* target,
|
||||
[[maybe_unused]] uint8_t hitIndex,
|
||||
[[maybe_unused]] const HitData& hitData) const {
|
||||
auto bp = attack->GetAttack()->GetAttack()->GetBasePower();
|
||||
// HOOK: modify base power.
|
||||
return bp;
|
||||
}
|
||||
float PkmnLib::Battling::DamageLibrary::GetStatModifier(CreatureLib::Battling::ExecutingAttack* attack,
|
||||
CreatureLib::Battling::Creature* target, uint8_t hitIndex,
|
||||
CreatureLib::Battling::Creature* target, uint8_t,
|
||||
const HitData& hitData) const {
|
||||
auto user = attack->GetUser();
|
||||
// HOOK: allow overriding for which users stat we use.
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
#define PKMNLIB_PKMNSCRIPT_HPP
|
||||
#include <CreatureLib/Battling/ScriptHandling/Script.hpp>
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
|
||||
namespace PkmnLib::Battling {
|
||||
class PkmnScript : public CreatureLib::Battling::Script {
|
||||
public:
|
||||
@@ -19,5 +22,6 @@ namespace PkmnLib::Battling {
|
||||
CreatureLib::Battling::Creature* winningMon, bool* shareExperience){};
|
||||
};
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#endif // PKMNLIB_PKMNSCRIPT_HPP
|
||||
|
||||
@@ -115,7 +115,7 @@ void AngelScriptResolver::RegisterTypes() {
|
||||
BasicScriptClass::Register(_engine);
|
||||
}
|
||||
|
||||
void AngelScriptResolver::MessageCallback(const asSMessageInfo* msg, void* param) {
|
||||
void AngelScriptResolver::MessageCallback(const asSMessageInfo* msg, void*) {
|
||||
const char* type = "ERR ";
|
||||
if (msg->type == asMSGTYPE_WARNING)
|
||||
type = "WARN";
|
||||
@@ -265,7 +265,7 @@ void AngelScriptResolver::LoadByteCodeFromFile(const char* file) {
|
||||
// Begin loading the type database
|
||||
auto types = stream->ReadTypes();
|
||||
|
||||
InitializeByteCode(stream, types);
|
||||
InitializeByteCode(types);
|
||||
Assert(fclose(rFile) == 0);
|
||||
delete stream;
|
||||
}
|
||||
@@ -297,11 +297,10 @@ void AngelScriptResolver::LoadByteCodeFromMemory(uint8_t* byte, size_t size) {
|
||||
// Begin loading the type database
|
||||
auto types = stream->ReadTypes();
|
||||
|
||||
InitializeByteCode(stream, types);
|
||||
InitializeByteCode(types);
|
||||
delete stream;
|
||||
}
|
||||
void AngelScriptResolver::InitializeByteCode(
|
||||
asIBinaryStream* stream,
|
||||
const ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, uint32_t>>& types) {
|
||||
|
||||
auto typeCount = _mainModule->GetObjectTypeCount();
|
||||
|
||||
@@ -25,8 +25,7 @@ private:
|
||||
|
||||
void RegisterTypes();
|
||||
void
|
||||
InitializeByteCode(asIBinaryStream* stream,
|
||||
const ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, uint32_t>>& types);
|
||||
InitializeByteCode(const ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, uint32_t>>& types);
|
||||
|
||||
public:
|
||||
~AngelScriptResolver() override {
|
||||
@@ -64,7 +63,7 @@ public:
|
||||
int r = _engine->RegisterObjectMethod(type, decl, asFunctionPtr(func), asCALL_CDECL_OBJFIRST);
|
||||
Assert(r >= 0);
|
||||
}
|
||||
void RegisterGlobalMethod(const char* decl, void*(func)(void*)) {
|
||||
void RegisterGlobalMethod(const char*, void*(func)(void*)) {
|
||||
auto r = _engine->RegisterGlobalFunction("decl", asFunctionPtr(func), asCALL_CDECL);
|
||||
Assert(r >= 0);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
#include <CreatureLib/Battling/ScriptHandling/Script.hpp>
|
||||
#define ANGELSCRIPT_DLL_LIBRARY_IMPORT
|
||||
#include <CreatureLib/Library/Exceptions/NotImplementedException.hpp>
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#include <cstdint>
|
||||
#include "../../../extern/angelscript_addons/scriptarray/scriptarray.h"
|
||||
#include "../../Battling/PkmnScript.hpp"
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
#include <Arbutils/Collections/Dictionary.hpp>
|
||||
#include <Arbutils/StringView.hpp>
|
||||
#include <CreatureLib/Library/Exceptions/CreatureException.hpp>
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
#include <cstring>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#ifndef PKMNLIB_CONTEXTPOOL_HPP
|
||||
#define PKMNLIB_CONTEXTPOOL_HPP
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
#include <vector>
|
||||
|
||||
class ContextPool {
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef PKMNLIB_BASICSCRIPTCLASS_HPP
|
||||
#define PKMNLIB_BASICSCRIPTCLASS_HPP
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
class BasicScriptClass {
|
||||
public:
|
||||
static void Register(asIScriptEngine* engine);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#ifndef PKMNLIB_REGISTERBATTLECLASS_HPP
|
||||
#define PKMNLIB_REGISTERBATTLECLASS_HPP
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
class RegisterBattleClass {
|
||||
static void RegisterChoiceQueue(asIScriptEngine* engine);
|
||||
static void RegisterBattle(asIScriptEngine* engine);
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef PKMNLIB_REGISTERBATTLELIBRARY_HPP
|
||||
#define PKMNLIB_REGISTERBATTLELIBRARY_HPP
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
class RegisterBattleLibrary {
|
||||
static void RegisterDamageLibrary(asIScriptEngine* engine);
|
||||
static void RegisterLibrary(asIScriptEngine* engine);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#ifndef PKMNLIB_REGISTEREXECUTINGATTACK_HPP
|
||||
#define PKMNLIB_REGISTEREXECUTINGATTACK_HPP
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
class RegisterExecutingAttack {
|
||||
static void RegisterHitData(asIScriptEngine* engine);
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef PKMNLIB_REGISTERPOKEMONCLASS_HPP
|
||||
#define PKMNLIB_REGISTERPOKEMONCLASS_HPP
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
class RegisterPokemonClass {
|
||||
static void RegisterDamageSource(asIScriptEngine* engine);
|
||||
static void RegisterMoveLearnMethod(asIScriptEngine* engine);
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef PKMNLIB_REGISTERTURNCHOICES_HPP
|
||||
#define PKMNLIB_REGISTERTURNCHOICES_HPP
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
class RegisterTurnChoices {
|
||||
static void RegisterTurnChoiceKindEnum(asIScriptEngine* engine);
|
||||
static void RegisterBaseTurnChoice(asIScriptEngine* engine);
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef PKMNLIB_CONSTSTRING_HPP
|
||||
#define PKMNLIB_CONSTSTRING_HPP
|
||||
#include <Arbutils/Assert.hpp>
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
class ConstStringRegister {
|
||||
public:
|
||||
static void Register(asIScriptEngine* engine);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#define BORROWED_PTR_GETTER_FUNC(o, returns, funcName) \
|
||||
static returns* funcName##Wrapper(o* obj) { return obj->funcName().GetRaw(); }
|
||||
#define UNIQUE_PTR_GETTER_FUNC(o, returns, funcName) \
|
||||
static returns* funcName##Wrapper(o* obj) { return obj->funcName().get(); }
|
||||
static returns* funcName##Wrapper(o* obj) { return obj->funcName().get(); }
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef PKMNLIB_REGISTEREFFECTPARAMETER_HPP
|
||||
#define PKMNLIB_REGISTEREFFECTPARAMETER_HPP
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
class RegisterEffectParameter {
|
||||
public:
|
||||
static void Register(asIScriptEngine* engine);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#ifndef PKMNLIB_REGISTERGROWTHRATETYPES_HPP
|
||||
#define PKMNLIB_REGISTERGROWTHRATETYPES_HPP
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
class RegisterGrowthRateTypes {
|
||||
static void RegisterGrowthRateType(asIScriptEngine* engine);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#ifndef PKMNLIB_REGISTERITEMTYPES_HPP
|
||||
#define PKMNLIB_REGISTERITEMTYPES_HPP
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
class RegisterItemTypes {
|
||||
static void RegisterItemCategoryEnum(asIScriptEngine* engine);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#ifndef PKMNLIB_REGISTERMOVETYPES_HPP
|
||||
#define PKMNLIB_REGISTERMOVETYPES_HPP
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
class RegisterMoveTypes {
|
||||
static void RegisterMoveCategory(asIScriptEngine* engine);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#ifndef PKMNLIB_REGISTERSPECIESTYPES_HPP
|
||||
#define PKMNLIB_REGISTERSPECIESTYPES_HPP
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
class RegisterSpeciesTypes {
|
||||
public:
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
#ifndef PKMNLIB_REGISTERSTATICLIBRARYTYPES_HPP
|
||||
#define PKMNLIB_REGISTERSTATICLIBRARYTYPES_HPP
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
class RegisterStaticLibraryTypes {
|
||||
static void RegisterLibrarySettingsType(asIScriptEngine* engine);
|
||||
static void RegisterLibraryType(asIScriptEngine* engine);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#ifndef PKMNLIB_REGISTERTYPELIBRARY_HPP
|
||||
#define PKMNLIB_REGISTERTYPELIBRARY_HPP
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#include <angelscript.h>
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
class RegisterTypeLibrary {
|
||||
static void RegisterTypeLibraryType(asIScriptEngine* engine);
|
||||
|
||||
Reference in New Issue
Block a user