Spellforce-Spell-framework
Loading...
Searching...
No Matches
sf_wrappers.h
Go to the documentation of this file.
1#ifndef WRAPPERS_H
2#define WRAPPERS_H
3
4#if defined(__GNUC__) || defined(__clang__)
5#define LOG_PRINTF_FMT(fmt_idx, arg_idx) __attribute__((format(printf, fmt_idx, arg_idx)))
6#else
7#define LOG_PRINTF_FMT(fmt_idx, arg_idx)
8#endif
9
10#include "../../api/sfsf.h"
11#include "../../asi/sf_asi.h"
12
13typedef SF_String *(__thiscall *SF_String_ctor_ptr)(SF_String *, const char *);
14typedef void (__thiscall *SF_String_dtor_ptr)(SF_String *);
15typedef bool (__thiscall *has_spell_effect_ptr)(SF_CGdFigureToolbox *_this,
16 uint16_t param_1,
17 uint16_t param_2);
18
19void log_message(const char *filename, const char *message, ...);
20
22
23uint16_t __thiscall getCurrentStat(SF_CGdFigure *_this, uint16_t target, StatisticDataKey key);
24uint16_t __thiscall getMaxStat(SF_CGdFigure *_this, uint16_t target, StatisticDataKey key);
25
26
27uint32_t __thiscall getDistance(SF_Coord *pointA, SF_Coord *pointB);
28bool __thiscall isSiegeUnit (SF_CGdFigure *_this, uint16_t figure_index);
29
30extern bool __thiscall hasAuraActive(SF_CGdFigureToolbox *_this, uint16_t figure_id);
31extern bool __thiscall isActionMelee(SF_SGtFigureAction *_this);
32extern bool __thiscall hasSpellTag(uint16_t spell_id, SpellTag tag) __attribute__((optimize("-O0")));
33extern void __thiscall setupFigureIterator(CGdFigureIterator *iterator, SF_CGdSpell *spell);
34extern void __thiscall disposeFigureIterator(CGdFigureIterator *iterator);
35bool __thiscall hasBuildingTag(uint8_t building_type, BuildingTag tag) __attribute__((optimize("-O0")));
36
37uint32_t __thiscall getBuildingXData(SF_CGdBuildingToolbox *_this, uint16_t building_index, uint8_t key_type);
38
39bool __thiscall buildingIsScavenger(SF_CGdBuilding *_this, uint16_t building_index);
40bool __thiscall buildingIsFisher(SF_CGdBuilding *_this, uint16_t building_index);
41bool __thiscall buildingIsFoodstore(SF_CGdBuilding *_this, uint16_t building_index);
42bool __thiscall buildingIsForge(SF_CGdBuilding *_this, uint16_t building_index);
43bool __thiscall buildingIsGatherer(SF_CGdBuilding *_this, uint16_t building_index);
44bool __thiscall buildingIsHQ(SF_CGdBuilding *_this, uint16_t building_index);
45bool __thiscall buildingIsHunter(SF_CGdBuilding *_this, uint16_t building_index);
46bool __thiscall buildingIsIronMine(SF_CGdBuilding *_this, uint16_t building_index);
47bool __thiscall buildingIsMaceCarver(SF_CGdBuilding *_this, uint16_t building_index);
48bool __thiscall buildingIsMoonsilverMine(SF_CGdBuilding *_this, uint16_t building_index);
49bool __thiscall buildingIsQuarry(SF_CGdBuilding *_this, uint16_t building_index);
50bool __thiscall buildingIsSawmill(SF_CGdBuilding *_this, uint16_t building_index);
51bool __thiscall buildingIsSmelter(SF_CGdBuilding *_this, uint16_t building_index);
52bool __thiscall buildingIsStonecutter(SF_CGdBuilding *_this, uint16_t building_index);
53bool __thiscall buildingIsTemple(SF_CGdBuilding *_this, uint16_t building_index);
54bool __thiscall buildingIsTower(SF_CGdBuilding *_this, uint16_t building_index);
55bool __thiscall buildingIsWoodcutter(SF_CGdBuilding *_this, uint16_t building_index);
56bool __thiscall buildingIsShrine(SF_CGdBuilding *_this, uint16_t building_index);
57bool __thiscall buildingIsHabitable(SF_CGdBuilding *_this, uint16_t building_index);
58bool __thiscall buildingIsHabitableSingle(SF_CGdBuilding *_this, uint16_t building_index);
59bool __thiscall XDataExists(SF_CGdEffect *_this, uint16_t effect_index, SpellDataKey data);
60
61void __thiscall tryClearCheckSpellsBeforeJob(SF_CGdSpell *_this, uint16_t spell_index, uint16_t figure_index);
62
63extern void __thiscall spellEffectCallback(SF_CGdSpell *_this,
64 uint16_t source_index,
65 uint16_t spell_index,
66 bool (*condition)(SF_CGdSpell *_this,
67 uint16_t
68 spell_index,
69 uint16_t
70 walked_index),
71 void (*callback)(SF_CGdSpell *_this,
72 uint16_t
73 source_index,
74 uint16_t
75 walked_index,
76 uint16_t spell_index));
77
78extern void __thiscall addBonusMultToStatistic(SF_CGdFigure *figure,
80 uint16_t target, int8_t value);
81extern void __thiscall spellClearFigureFlag(SF_CGdSpell *spell,
82 uint16_t spell_index,
83 SpellFlagKey key);
84extern uint16_t __thiscall sf_get_spell_id(SF_CGdSpell *_this,
85 uint16_t spell_index);
86extern SFLog *setup_logger();
87
88extern uint16_t __thiscall getPhysDamageReduction(SF_CGdFigureToolbox *_this, uint16_t source_index,
89 uint16_t target_index,
90 uint16_t action_id);
91
92
93
94
95typedef uint16_t (__thiscall *get_phys_damage_reduction_ptr)(void *AutoClass34, uint16_t source_index,
96 uint16_t target_index,
97 uint16_t unkn);
99extern fidfree_ptr fidFree;
103
105
107extern "C" void log_warning(const char *format, ...) LOG_PRINTF_FMT(1, 2);
108
112extern "C" void log_warning_level(DebugLevel level, const char *format, ...) LOG_PRINTF_FMT(2, 3);
113extern "C" void log_info(const char *format, ...) LOG_PRINTF_FMT(1, 2);
114extern "C" void log_error(const char *format, ...) LOG_PRINTF_FMT(1, 2);
115extern "C" void log_debug(DebugLevel level, const char *format, ...);
116extern const char * debug_level_to_string(DebugLevel level);
118
119#endif
void log_error(const char *format,...)
bool __thiscall buildingIsForge(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsMoonsilverMine(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsShrine(SF_CGdBuilding *_this, uint16_t building_index)
void __thiscall addBonusMultToStatistic(SF_CGdFigure *figure, StatisticDataKey key, uint16_t target, int8_t value)
bool __thiscall buildingIsSawmill(SF_CGdBuilding *_this, uint16_t building_index)
uint32_t __thiscall getDistance(SF_Coord *pointA, SF_Coord *pointB)
Definition sf_wrappers.c:41
bool __thiscall buildingIsHabitable(SF_CGdBuilding *_this, uint16_t building_index)
void log_message(const char *filename, const char *message,...)
Definition sf_wrappers.c:91
bool __thiscall buildingIsGatherer(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsHunter(SF_CGdBuilding *_this, uint16_t building_index)
void log_warning_level(DebugLevel level, const char *format,...)
Logs a warning that is only shown once the log level reaches level.
bool __thiscall buildingIsScavenger(SF_CGdBuilding *_this, uint16_t building_index)
void log_warning(const char *format,...)
Logs a warning at DEBUG_INFO, i.e. always shown.
bool __thiscall buildingIsFisher(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsWoodcutter(SF_CGdBuilding *_this, uint16_t building_index)
uint16_t __thiscall getCurrentStat(SF_CGdFigure *_this, uint16_t target, StatisticDataKey key)
bool __thiscall XDataExists(SF_CGdEffect *_this, uint16_t effect_index, SpellDataKey data)
bool __thiscall buildingIsIronMine(SF_CGdBuilding *_this, uint16_t building_index)
void __thiscall setupFigureIterator(CGdFigureIterator *iterator, SF_CGdSpell *spell)
bool __thiscall buildingIsHQ(SF_CGdBuilding *_this, uint16_t building_index)
uint16_t __thiscall getPhysDamageReduction(SF_CGdFigureToolbox *_this, uint16_t source_index, uint16_t target_index, uint16_t action_id)
bool __thiscall buildingIsHabitableSingle(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall hasBuildingTag(uint8_t building_type, BuildingTag tag)
bool __thiscall isSiegeUnit(SF_CGdFigure *_this, uint16_t figure_index)
Definition sf_wrappers.c:66
bool __thiscall buildingIsFoodstore(SF_CGdBuilding *_this, uint16_t building_index)
has_spell_effect_ptr has_spell_effect
Definition sf_wrappers.c:31
bool __thiscall buildingIsStonecutter(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsTemple(SF_CGdBuilding *_this, uint16_t building_index)
void log_debug(DebugLevel level, const char *format,...)
bool __thiscall hasSpellTag(uint16_t spell_id, SpellTag tag)
const char * debug_level_to_string(DebugLevel level)
bool __thiscall hasAuraActive(SF_CGdFigureToolbox *_this, uint16_t figure_id)
SF_String_ctor_ptr g_create_sf_string
Definition sf_wrappers.c:29
void __thiscall spellClearFigureFlag(SF_CGdSpell *spell, uint16_t spell_index, SpellFlagKey key)
void __thiscall tryClearCheckSpellsBeforeJob(SF_CGdSpell *_this, uint16_t spell_index, uint16_t figure_index)
bool __thiscall buildingIsQuarry(SF_CGdBuilding *_this, uint16_t building_index)
uint16_t __thiscall getMaxStat(SF_CGdFigure *_this, uint16_t target, StatisticDataKey key)
void __thiscall disposeFigureIterator(CGdFigureIterator *iterator)
fidfree_ptr fidFree
Definition sf_wrappers.c:33
FUN_0069eaf0_ptr FUN_0069eaf0
Definition sf_wrappers.c:32
bool __thiscall buildingIsTower(SF_CGdBuilding *_this, uint16_t building_index)
SFLog * setup_logger()
void initialize_wrapper_data_hooks()
Definition sf_wrappers.c:80
SF_String_dtor_ptr g_destroy_sf_string
Definition sf_wrappers.c:30
uint16_t __thiscall sf_get_spell_id(SF_CGdSpell *_this, uint16_t spell_index)
void log_info(const char *format,...)
bool __thiscall isActionMelee(SF_SGtFigureAction *_this)
bool __thiscall buildingIsMaceCarver(SF_CGdBuilding *_this, uint16_t building_index)
bool __thiscall buildingIsSmelter(SF_CGdBuilding *_this, uint16_t building_index)
uint32_t __thiscall getBuildingXData(SF_CGdBuildingToolbox *_this, uint16_t building_index, uint8_t key_type)
void(* fidfree_ptr)(uint32_t *memory_ptr)
uint32_t(__thiscall * FUN_0069eaf0_ptr)(void *ac69, void *ac69_2, void *ac69_3, void *ac69_4)
get_reduced_damage_ptr g_get_reduced_damage
#define LOG_PRINTF_FMT(fmt_idx, arg_idx)
void __thiscall spellEffectCallback(SF_CGdSpell *_this, uint16_t source_index, uint16_t spell_index, bool(*condition)(SF_CGdSpell *_this, uint16_t spell_index, uint16_t walked_index), void(*callback)(SF_CGdSpell *_this, uint16_t source_index, uint16_t walked_index, uint16_t spell_index))
bool(__thiscall * has_spell_effect_ptr)(SF_CGdFigureToolbox *_this, uint16_t param_1, uint16_t param_2)
Definition sf_wrappers.h:15
SF_String *(__thiscall * SF_String_ctor_ptr)(SF_String *, const char *)
Definition sf_wrappers.h:13
void(__thiscall * SF_String_dtor_ptr)(SF_String *)
Definition sf_wrappers.h:14
DebugLevel global_debug_level
Definition sfsf.cpp:18
uint16_t(__thiscall * get_phys_damage_reduction_ptr)(void *AutoClass34, uint16_t source_index, uint16_t target_index, uint16_t unkn)
Definition sf_wrappers.h:95
A structure for the global list of figures and related statistics for them.