Spellforce-Spell-framework
Toggle main menu visibility
Loading...
Searching...
No Matches
sf_registry.cpp
Go to the documentation of this file.
1
19
20
#include "
../core/sf_modloader.h
"
21
#include "
../core/sf_wrappers.h
"
22
#include "
../core/sf_hooks.h
"
23
#include "
../core/sf_campaign_module.h
"
24
#include "
../core/sf_screens_module.h
"
25
26
#include "
sf_registry.h
"
27
#include "
sf_vanilla_registry.h
"
28
#include "
sf_mod_registry.h
"
29
#include "
sf_error_registry.h
"
30
31
#include "
spell_data_registries/sf_spelltype_registry.h
"
32
#include "
spell_data_registries/sf_spelleffect_registry.h
"
33
#include "
spell_data_registries/sf_spellend_registry.h
"
34
#include "
spell_data_registries/sf_spellrefresh_registry.h
"
35
#include "
spell_data_registries/sf_subeffect_registry.h
"
36
#include "
spell_data_registries/sf_spelldamage_registry.h
"
37
#include "
spell_data_registries/sf_enchant_registry.h
"
38
39
40
#include <windows.h>
41
#include <iostream>
42
43
// Exposed in sfsf.h
44
SpellforceSpellFramework
frameworkAPI
;
45
SFMod
*
g_current_mod
;
46
SFMod
*
g_framework_mod
;
47
57
void
registerFrameworkAPI
()
58
{
59
log_info
(
"| - Loading framework with API Addresses"
);
60
frameworkAPI
.figureAPI = &
figureAPI
;
61
frameworkAPI
.spellAPI = &
spellAPI
;
62
frameworkAPI
.uiAPI = &
uiAPI
;
63
frameworkAPI
.toolboxAPI = &
toolboxAPI
;
64
frameworkAPI
.iteratorAPI = &
iteratorAPI
;
65
frameworkAPI
.registrationAPI = &
registrationAPI
;
66
frameworkAPI
.logAPI =
setup_logger
();
67
frameworkAPI
.effectAPI = &
effectAPI
;
68
frameworkAPI
.aiAPI = &
aiAPI
;
69
frameworkAPI
.buildingAPI = &
buildingAPI
;
70
log_info
(
"| - Loading framework with create_mod_info Address"
);
71
frameworkAPI
.createModInfo = &
createModInfo
;
72
73
74
log_info
(
"| - Loading Default Mod Information"
);
75
char
version_tag_buffer[128];
76
sprintf_s(version_tag_buffer,
sizeof
(version_tag_buffer),
"%d.%d.%d-%s"
,
SPELLFRAMEWORK_VERSION_MAJOR
,
77
SPELLFRAMEWORK_VERSION_MINOR
,
SPELLFRAMEWORK_VERSION_PATCH
,
SPELLFRAMEWORK_TAG
);
78
79
g_framework_mod
=
createModInfo
(
"Spellforce Spell Framework"
, version_tag_buffer,
80
"Muddykat, UnSchtalch and shovel_knight"
,
81
"A Modding Framework to ease the creation of new Spells in the game Spellforce Platinum Edition."
);
82
g_current_mod
=
g_framework_mod
;
83
register_mod_for_listing
(
g_framework_mod
,
MOD_TYPE_FRAMEWORK
);
84
}
85
113
void
initialize_framework
()
114
{
115
116
log_info
(
117
"|=====| Spellforce Spell Framework Configuration Phase Start |=====|"
);
118
119
log_info
(
"| - Initializing Data Hooks"
);
120
121
initialize_data_hooks
();
122
123
log_info
(
"| - Linking API functions"
);
124
125
registerFrameworkAPI
();
126
127
log_info
(
"| - Initialization of Vanilla Spells"
);
128
129
initialize_vanilla_spells
();
130
131
log_info
(
"| - Effect Handlers"
);
132
133
register_vanilla_effect_handlers
();
134
135
log_info
(
"| - Registration of Vanilla Spell End Handlers"
);
136
137
register_vanilla_spell_end_handlers
();
138
139
log_info
(
"| - Registration of Vanilla Sub Effect Handlers"
);
140
141
register_vanilla_sub_effect_handlers
();
142
log_info
(
"| - Registration of Vanilla Enchantnments Chance Handlers"
);
143
register_vanilla_enchants_handlers
();
144
145
log_info
(
"| - Registration of Vanilla Spell Refresh Handlers"
);
146
147
register_vanilla_spell_refresh_handlers
();
148
149
log_info
(
"| - Registration of Vanilla Spell Deal Damage Handlers"
);
150
register_vanilla_spell_damage_handlers
();
151
152
log_info
(
"| - Registration of Vanilla Building Done Handlers"
);
153
initialize_vanilla_buildings
();
154
155
log_info
(
156
"|======| Spellforce Spell Framework Configuration Phase End |======|"
);
157
log_info
(
158
"|+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.|"
);
159
log_info
(
160
"|===== ===== ======| Core Module Phase Start |===== ===== ======-|"
);
161
162
initialize_screens_module
();
163
initialize_campaign_module
();
164
165
log_info
(
166
"|====== ===== =====| Core Module Phase End |===== ===== ======--|"
);
167
log_info
(
168
"|+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.|"
);
169
log_info
(
170
"|====== ====== ======| Mod Loading Phase Start |====== ====== =====|"
);
171
172
initialize_mods
();
173
174
log_info
(
175
"|====== ====== ======| Mod Loading Phase End |====== ====== ======-|"
);
176
log_info
(
177
"|+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.|"
);
178
log_info
(
179
"|====== === ======| Mod Registration Phase Start |====== === ======|"
);
180
181
register_mod_spells
();
182
register_mod_buildings
();
183
184
log_info
(
185
"|====== ==== ======| Mod Registration Phase End |====== ==== ======|"
);
186
log_info
(
187
"|+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.+.|"
);
188
log_info
(
189
"|=== === ===| Spellforce Spell Framework Working (^_^) |=== === ===|"
);
190
log_info
(
191
"|======================| Injecting Assembly |======================|"
);
192
}
registrationAPI
RegistrationFunctions * registrationAPI
Definition
TestMod.cpp:14
spellAPI
SpellFunctions * spellAPI
Definition
TestMod.cpp:11
figureAPI
FigureFunctions * figureAPI
Definition
TestMod.cpp:13
toolboxAPI
ToolboxFunctions * toolboxAPI
Definition
TestMod.cpp:12
initialize_campaign_module
void initialize_campaign_module()
Creates the module's mod entry and loads sfsf\campaigns*.json.
Definition
sf_campaign_module.c:258
register_mod_for_listing
void register_mod_for_listing(SFMod *mod, ModType type)
Adds a mod to the list rendered by the in-game mod list screen.
Definition
sf_error_registry.cpp:205
MOD_TYPE_FRAMEWORK
@ MOD_TYPE_FRAMEWORK
Definition
sf_error_registry.h:42
initialize_data_hooks
void initialize_data_hooks()
Used to initialize all disparate hooks in one place.
Definition
sf_hooks.c:61
effectAPI
EffectFunctions effectAPI
Definition
sf_hooks.c:45
uiAPI
UiFunctions uiAPI
Definition
sf_hooks.c:50
iteratorAPI
IteratorFunctions iteratorAPI
Definition
sf_hooks.c:49
buildingAPI
BuildingFunctions buildingAPI
Definition
sf_hooks.c:47
aiAPI
AiFunctions aiAPI
Definition
sf_hooks.c:51
initialize_screens_module
void initialize_screens_module()
Loads and validates sfsf\screens.json.
Definition
sf_screens_module.c:113
setup_logger
SFLog * setup_logger()
Definition
sf_wrappers.c:199
log_info
void log_info(const char *format,...)
Definition
sf_wrappers.c:140
sf_campaign_module.h
register_vanilla_enchants_handlers
void register_vanilla_enchants_handlers()
Definition
sf_enchant_registry.cpp:47
sf_enchant_registry.h
sf_error_registry.h
sf_hooks.h
createModInfo
SFMod * createModInfo(const char *mod_id, const char *mod_version, const char *mod_author, const char *mod_description)
Definition
sf_ui_wrappers.c:781
register_mod_buildings
void register_mod_buildings()
Definition
sf_mod_registry.cpp:607
register_mod_spells
void register_mod_spells()
Registers the mod spells and performs basic conflict checking.
Definition
sf_mod_registry.cpp:331
sf_mod_registry.h
initialize_mods
void initialize_mods()
Definition
sf_modloader.c:100
sf_modloader.h
g_current_mod
SFMod * g_current_mod
Definition
sf_registry.cpp:45
g_framework_mod
SFMod * g_framework_mod
Definition
sf_registry.cpp:46
frameworkAPI
SpellforceSpellFramework frameworkAPI
Definition
sf_registry.cpp:44
registerFrameworkAPI
void registerFrameworkAPI()
Registers the framework API addresses.
Definition
sf_registry.cpp:57
initialize_framework
void initialize_framework()
Initializes the Spellforce Spell Framework (SFSF).
Definition
sf_registry.cpp:113
sf_registry.h
SPELLFRAMEWORK_TAG
#define SPELLFRAMEWORK_TAG
Definition
sf_registry.h:3
sf_screens_module.h
register_vanilla_spell_damage_handlers
void __thiscall register_vanilla_spell_damage_handlers()
Definition
sf_spelldamage_registry.cpp:41
sf_spelldamage_registry.h
register_vanilla_effect_handlers
void register_vanilla_effect_handlers()
Definition
sf_spelleffect_registry.cpp:41
sf_spelleffect_registry.h
register_vanilla_spell_end_handlers
void register_vanilla_spell_end_handlers()
Definition
sf_spellend_registry.cpp:42
sf_spellend_registry.h
register_vanilla_spell_refresh_handlers
void register_vanilla_spell_refresh_handlers()
Definition
sf_spellrefresh_registry.cpp:36
sf_spellrefresh_registry.h
sf_spelltype_registry.h
register_vanilla_sub_effect_handlers
void register_vanilla_sub_effect_handlers()
Definition
sf_subeffect_registry.cpp:41
sf_subeffect_registry.h
initialize_vanilla_buildings
void initialize_vanilla_buildings()
Definition
sf_vanilla_registry.cpp:14
initialize_vanilla_spells
void initialize_vanilla_spells()
Definition
sf_vanilla_registry.cpp:621
sf_vanilla_registry.h
sf_wrappers.h
SPELLFRAMEWORK_VERSION_PATCH
#define SPELLFRAMEWORK_VERSION_PATCH
Definition
sfsf.h:20
SPELLFRAMEWORK_VERSION_MAJOR
#define SPELLFRAMEWORK_VERSION_MAJOR
Definition
sfsf.h:18
SPELLFRAMEWORK_VERSION_MINOR
#define SPELLFRAMEWORK_VERSION_MINOR
Definition
sfsf.h:19
SFMod
Definition
sf_general_structures.h:811
SpellforceSpellFramework
Represents the Spellforce Spell Framework API.This structure serves as the central interface for inte...
Definition
sfsf.h:42
src
internal
registry
sf_registry.cpp
Generated by
1.17.0