Spellforce-Spell-framework
Loading...
Searching...
No Matches
sf_mod_registry.cpp
Go to the documentation of this file.
1#include "sf_mod_registry.h"
2#include "sf_error_registry.h"
3
13
20
21
22#include <windows.h>
23#include <iostream>
24#include <map>
25#include <list>
26#include <cstdint>
27#include <stdio.h>
28#include <stdarg.h>
29#include <stdlib.h>
30#include <string.h>
32
33std::list<SFBuilding *> g_internal_building_list;
34
35SFBuilding *__thiscall registerBuilding(uint8_t building_type)
36{
37 SFBuilding *building = new SFBuilding;
38 building->building_json_name[0] = '\0';
39 building->building_id = building_type;
40 building->parent_mod = g_current_mod;
41 g_internal_building_list.push_back(building);
42 building->done_handler = nullptr;
43 building->entry_handler = nullptr;
44 building->flags = 0;
45 building->building_tags = 0;
46 return building;
47}
48
49void __thiscall linkBuildingJSON(SFBuilding *building, const char *building_json_name)
50{
51 strncpy(building->building_json_name, building_json_name, sizeof(building->building_json_name) - 1);
52}
53
55{
56 building->done_handler = handler;
57}
58
60{
61 building->entry_handler = handler;
62}
63
64void __thiscall applyBuildingTag(SFBuilding *building, BuildingTag tag)
65{
66 uint32_t current_tags = building->building_tags;
67 building->building_tags = current_tags | tag;
68}
69
70std::list<SFSpell *> g_internal_spell_list;
71
72SFSpell *__thiscall registerSpell(uint16_t spell_id)
73{
74 SFSpell *sf_spell = new SFSpell;
75 sf_spell->spell_id = spell_id;
76 sf_spell->spell_effect_id = 0x00;
77 sf_spell->spell_tags = 0x0;
78
79 sf_spell->spell_type_handler = nullptr;
80 sf_spell->spell_effect_handler = nullptr;
81 sf_spell->spell_end_handler = nullptr;
82 sf_spell->spell_onhit_handler = nullptr;
83 sf_spell->spell_refresh_handler = nullptr;
84 sf_spell->sub_effect_handler = nullptr;
85 sf_spell->parent_mod = g_current_mod;
86 sf_spell->deal_damage_handler = nullptr;
87 sf_spell->ai_aoe_handler = nullptr;
88 sf_spell->ai_single_handler = nullptr;
89 sf_spell->ai_avoidance_handler = nullptr;
90 sf_spell->phys_rain_handler = nullptr;
91 sf_spell->spell_enchtant_handler = nullptr;
92 sf_spell->phys_effect_handler = nullptr;
93
96 g_internal_spell_list.push_back(sf_spell);
97
98 return sf_spell;
99}
100
101void __thiscall applySpellTag(SFSpell *spell, SpellTag tag)
102{
103 uint16_t current_tags = spell->spell_tags;
104 spell->spell_tags = current_tags | tag;
105}
106
107void __thiscall linkPhysRainHandler(SFSpell *spell, sub_effect_handler_ptr handler)
108{
109 spell->phys_rain_handler = handler;
110}
111
113{
114 spell->phys_effect_handler = handler;
115}
116
117void __thiscall linkTypeHandler(SFSpell *spell, handler_ptr typeHandler)
118{
119 spell->spell_type_handler = typeHandler;
120}
121
123{
124 spell->ai_single_handler = handler;
125}
126
128{
129 spell->ai_avoidance_handler = handler;
130}
131
132void __thiscall linkAOEAIHandler(SFSpell *spell, ai_aoe_handler_ptr handler)
133{
134 spell->ai_aoe_handler = handler;
135}
136
137void __thiscall linkOnHitHandler(SFSpell *spell, onhit_handler_ptr onhitHandler, OnHitPhase phase)
138{
139 spell->spell_onhit_handler = onhitHandler;
140 spell->hit_phase = phase;
141}
142
143void __thiscall linkEffectHandler(SFSpell *spell, uint16_t spell_effect_id, handler_ptr effectHandler)
144{
145 spell->spell_effect_id = spell_effect_id;
146 spell->spell_effect_handler = effectHandler;
147}
148
149void __thiscall linkEndHandler(SFSpell *spell, handler_ptr endHandler)
150{
151 spell->spell_end_handler = endHandler;
152}
153
155{
156 spell->sub_effect_handler = handler;
157}
158
159void __thiscall linkRefreshHandler(SFSpell *spell, refresh_handler_ptr handler)
160{
161 spell->spell_refresh_handler = handler;
162}
163
165{
166 spell->deal_damage_handler = handler;
167 spell->damage_phase = phase;
168}
169
171{
172 spell->spell_enchtant_handler = handler;
173}
174
175uint16_t __thiscall getSpellTags(uint16_t spell_line_id)
176{
177 for (auto &entry : g_internal_spell_list)
178 {
179 if (entry->spell_id == spell_line_id)
180 {
181 return entry->spell_tags;
182 }
183 }
184 return 0x0;
185}
186
187uint32_t __thiscall getBuildingTags(uint8_t building_type)
188{
189 for (auto &entry : g_internal_building_list)
190 {
191 if (entry->building_id == building_type)
192 {
193 return entry->building_tags;
194 }
195 }
196 return 0x0;
197}
198
199uint8_t __thiscall getRacialSmelter (uint8_t race)
200{
201 for (auto &entry : g_internal_building_list)
202 {
203 if (entry->race == race)
204 {
205 if (entry->building_tags & BuildingTag::SMELTER_BUILDING)
206 {
207 return entry->building_id;
208 }
209 }
210 }
211 return 0x0;
212}
213
214uint8_t __thiscall getRacialFoodstore(uint8_t race)
215{
216 for (auto &entry : g_internal_building_list)
217 {
218 if (entry->race == race)
219 {
220 if (entry->building_tags & BuildingTag::FOODSTORE_BUILDING)
221 {
222 return entry->building_id;
223 }
224 }
225 }
226 return 0x0;
227}
228
229uint8_t __thiscall getRacialSawmill(uint8_t race)
230{
231 for (auto &entry : g_internal_building_list)
232 {
233 if (entry->race == race)
234 {
235 if (entry->building_tags & BuildingTag::SAWMILL_BUILDING)
236 {
237 return entry->building_id;
238 }
239 }
240 }
241 return 0x0;
242}
243
244uint8_t __thiscall getRacialStonecutter(uint8_t race)
245{
246 for (auto &entry : g_internal_building_list)
247 {
248 if (entry->race == race)
249 {
250 if (entry->building_tags & BuildingTag::STONEMASON_BUILDING)
251 {
252 return entry->building_id;
253 }
254 }
255 }
256 return 0x0;
257}
258
259uint8_t __thiscall getRacialWoodcutter(uint8_t race)
260{
261 for (auto &entry : g_internal_building_list)
262 {
263 if (entry->race == race)
264 {
265 if (entry->building_tags & BuildingTag::WOODCUTTER_BUILDING)
266 {
267 return entry->building_id;
268 }
269 }
270 }
271 return 0x0;
272}
273
274uint8_t __thiscall getRacialIronMine(uint8_t race)
275{
276 for (auto &entry : g_internal_building_list)
277 {
278 if (entry->race == race)
279 {
280 if ((entry->building_tags & BuildingTag::MINER_BUILDING) &&
281 (entry->building_tags & ~(BuildingTag::MOONSILVER_BUILDING)))
282 {
283 return entry->building_id;
284 }
285 }
286 }
287 return 0x0;
288}
289uint8_t __thiscall getRacialQuarry(uint8_t race)
290{
291 for (auto &entry : g_internal_building_list)
292 {
293 if (entry->race == race)
294 {
295 if (entry->building_tags & BuildingTag::QUARRY_BUILDING)
296 {
297 return entry->building_id;
298 }
299 }
300 }
301 return 0x0;
302}
303
304/* TODO
305 uint8_t __thiscall getRacialSmallHQ(uint8_t race)
306 {
307
308 }
309 uint8_t __thiscall getRacialMediumHQ(uint8_t race)
310 {
311
312 }
313 uint8_t __thiscall getRacialLargeHQ(uint8_t race)
314 {
315
316 }
317 */
318
332{
333 SFMod *temp = g_current_mod;
334 uint8_t spell_count_for_mod = 0;
335 for (SFSpell *spell_data : g_internal_spell_list)
336 {
337 uint16_t spell_id = spell_data->spell_id;
338 uint16_t spell_effect_id = spell_data->spell_effect_id;
339 handler_ptr spell_type_handler = spell_data->spell_type_handler;
340 handler_ptr spell_effect_handler = spell_data->spell_effect_handler;
341 handler_ptr spell_end_handler = spell_data->spell_end_handler;
342 refresh_handler_ptr spell_refresh_handler = spell_data->spell_refresh_handler;
343 sub_effect_handler_ptr sub_effect_handler = spell_data->sub_effect_handler;
344 onhit_handler_ptr onhit_handler = spell_data->spell_onhit_handler;
345 damage_handler_ptr deal_damage_handler = spell_data->deal_damage_handler;
346 ai_aoe_handler_ptr ai_aoe_handler = spell_data->ai_aoe_handler;
347 ai_avoidance_handler_ptr ai_avoidance_handler = spell_data->ai_avoidance_handler;
348 ai_single_handler_ptr ai_single_handler = spell_data->ai_single_handler;
349 sub_effect_handler_ptr phys_rain_handler = spell_data->phys_rain_handler;
350 phys_effect_handler_ptr phys_effect_handler = spell_data->phys_effect_handler;
351 enchant_handler_ptr enchant_handler = spell_data->spell_enchtant_handler;
352 SpellDamagePhase damage_phase = spell_data->damage_phase;
353 OnHitPhase onhit_phase = spell_data->hit_phase;
354 SFMod *parent_mod = spell_data->parent_mod;
355 g_current_mod = spell_data->parent_mod;
356
357 if (temp != g_current_mod)
358 {
359 if (spell_count_for_mod != 0)
360 {
361 char spell_count_info[256];
362 snprintf(spell_count_info, sizeof(spell_count_info),
363 "| - Finished Registration of %d spells for %s",
364 spell_count_for_mod, temp->mod_id);
365 log_info(spell_count_info);
366 spell_count_for_mod = 0;
367 }
368
369 char info[256];
370 snprintf(info, sizeof(info),
371 "| - Starting Registration for [%s by %s]",
372 parent_mod->mod_id, parent_mod->mod_author);
373 log_info(info);
374 temp = g_current_mod;
375 }
376 else
377 {
378 spell_count_for_mod = spell_count_for_mod + 1;
379 }
380
381 // Check for conflicts. Vanilla spells are registered by the framework
382 // mod
383 claim_numeric_id(CONFLICT_SPELL_ID, spell_id, parent_mod, 242, "Spell ID");
384
385 if (spell_effect_id != 0x00)
386 {
387 claim_numeric_id(CONFLICT_SPELL_EFFECT_ID, spell_effect_id, parent_mod,
388 0xa6, "Spell Effect ID");
389 }
390
391 // Do Registration
392 if (spell_type_handler != nullptr)
393 {
394 registerSpellTypeHandler(spell_id, spell_type_handler);
395 }
396
397 if (spell_effect_handler != nullptr)
398 {
399 registerEffectHandler(spell_effect_id, spell_effect_handler);
400 }
401
402 if (spell_refresh_handler != nullptr)
403 {
404 registerSpellRefreshHandler(spell_id, spell_refresh_handler);
405 }
406
407 if (spell_end_handler != nullptr)
408 {
409 registerSpellEndHandler(spell_id, spell_end_handler);
410 }
411
412 if (sub_effect_handler != nullptr)
413 {
414 registerSubEffectHandler(spell_id, sub_effect_handler);
415 }
416
417 if (onhit_handler != nullptr)
418 {
419 registerOnHitHandler(spell_id, onhit_handler, onhit_phase);
420 }
421
422 if (deal_damage_handler != nullptr)
423 {
424 registerSpellDamageHandler(spell_id, deal_damage_handler,
425 damage_phase);
426 }
427
428 if(ai_single_handler != nullptr)
429 {
430 registerAiSingleTargetHandler(spell_id, ai_single_handler);
431 }
432
433 if(ai_aoe_handler != nullptr)
434 {
435 registerAiAOEHandler(spell_id, ai_aoe_handler);
436 }
437
438 if(ai_avoidance_handler != nullptr)
439 {
440 registerAiAvoidanceHandler(spell_id, ai_avoidance_handler);
441 }
442 if (phys_rain_handler != nullptr)
443 {
444 registerPhysRainHandler(spell_id, phys_rain_handler);
445 }
446 if (phys_effect_handler != nullptr)
447 {
448 registerPhysEffectHandler(spell_id, phys_effect_handler);
449 }
450 if (enchant_handler != nullptr)
451 {
452 registerEnchantHandler(spell_id, enchant_handler);
453 }
454 }
455
456 if (spell_count_for_mod != 0)
457 {
458 char spell_count_info[256];
459 snprintf(spell_count_info, sizeof(spell_count_info),
460 "| - Finished Registration of %d spells for %s",
461 spell_count_for_mod, temp->mod_id);
462 log_info(spell_count_info);
463 spell_count_for_mod = 0;
464 }
465}
466
470
471int32_t recalcCoord(int32_t value)
472{
473 return (value * 140) / 0x10000;
474}
475
477{
478 log_debug(DEBUG_HIGH, "ID %d", entry->data->id);
479 log_debug(DEBUG_HIGH, "Some flags %d %d", entry->data->unknown[0], entry->data->unknown[1]);
480
481 uint32_t posX = entry->data->centerX;
482 uint32_t posY = entry->data->centerY;
483 log_debug(DEBUG_HIGH, "Center point %d, %d", recalcCoord(posX), recalcCoord(posY));
484
485 uint8_t shadows = entry->data->shadows[0];
486 log_debug(DEBUG_HIGH, "Shadows %d", shadows);
487
488 uint8_t poly_count = entry->data->poly_count;
489 log_debug(DEBUG_HIGH, "Polygon count %d", poly_count);
490
491 uint8_t list_len = ((uint32_t)entry->data->collisions[0].data - (uint32_t)entry->data->collisions[0].first) >> 3;
492 log_debug(DEBUG_HIGH, "List length %d", list_len);
493
494 for (int i = 0; i<list_len; i++)
495 {
496 int32_t *offset = (int32_t *)entry->data->collisions[0].first;
497 log_debug(DEBUG_HIGH, "Collision point %d, %d", recalcCoord(offset[i*2]), recalcCoord(offset[i*2 + 1]));
498 }
499}
500
501void addCollisionEntry(uint_list_node *list, int32_t posX, int32_t posY, int8_t index)
502{
503 uint32_t *offset = list->first;
504 offset[index*2] = (posX * 0x10000) / 140;
505 offset[index*2+1] = (posY * 0x10000) / 140;
506}
507
509{
510 SF_CGdResource *CGdResource = (SF_CGdResource *)(*(uint32_t *)ASI::AddrOf(0x94867C));
511 BuildingAuxEntry *core_entry = (BuildingAuxEntry *)((uint32_t)CGdResource + 0x8);
512
516
517 astruct32 new_building = {0};
518 BuildingAuxEntry_related new_entry = {0};
519
520 if(!src->found_id)
521 {
522 log_error("Missing Required 'id' field in buidling JSON: %s", building->building_json_name);
523 return;
524 }
525
526 building->building_id = src->id;
527
528 AddBuilding(CGdResource, &new_building, &building->building_id);
529 auto &bd = new_building.ref1->building;
530
531 bd.id = building->building_id;
532 bd.race = building->race;
533 bd.can_enter = building->can_enter;
534 bd.slot_count = building->slot_count;
535 bd.building_required = building->building_required;
536 bd.worker_cycle = building->worker_cycle;
537 bd.name_id = building->name_id;
538 bd.health = building->health;
539 bd.ext_description_id = building->ext_description_id;
540 bd.initial_angle = building->initial_angle;
541 bd.flags = building->flags;
542
543 AddAuxData(core_entry, &new_entry, &building->building_id);
544 new_entry.data->centerX = (building->centerX * 0x10000) / 140;
545 new_entry.data->centerY = (building->centerY * 0x10000) / 140;
546 memcpy(new_entry.data->shadows, building->shadows, sizeof(building->shadows));
547
548 for (int i = 0; i < src->collision_count; i++)
549 {
550 int point_count = src->collisions[i].point_count;
551 setListSize(&(new_entry.data->collisions[i]), point_count);
552 for(int k = 0; k < point_count; k++)
553 {
554 WorldCoord wc = src->collisions[i].points[k];
555 addCollisionEntry(&(new_entry.data->collisions[i]), wc.X, wc.Y, k);
556 }
557 }
558
559 new_entry.data->poly_count = building->poly_count;
560 new_entry.data->resource_req_num = building->resource_req_num;
561 for (int i = 0; i < building->resource_req_num; ++i)
562 {
563 new_entry.data->resource_req_type[i] = building->resource_req_type[i];
564 new_entry.data->resource_req_amount[i] = building->resource_req_amount[i];
565 }
566
567 AddAuxData(core_entry, &new_entry, &building->building_id);
568 dumpAuxEntry(&new_entry);
569
570 log_info("%s has successfully registered the [%s] building to the game using ID [%u]", g_current_mod->mod_id,
571 building->building_json_name, building->building_id);
572}
573
574uint8_t get_resource_id(const char *resource_name)
575{
576 if (!strncmp("wood",resource_name, 5))
577 {
578 return 1;
579 }
580 if (!strncmp("stone",resource_name, 6))
581 {
582 return 2;
583 }
584 if (!strncmp("moonsilver",resource_name, 11))
585 {
586 return 4;
587 }
588 if (!strncmp("food",resource_name, 5))
589 {
590 return 5;
591 }
592 if (!strncmp("iron",resource_name, 5))
593 {
594 return 7;
595 }
596 if (!strncmp("aria",resource_name, 5))
597 {
598 return 18;
599 }
600 if (!strncmp("lenya",resource_name, 5))
601 {
602 return 19;
603 }
604 return 0;
605}
606
608{
609 SFMod *temp = g_current_mod;
610 int building_count_for_mod = 0;
611
612 for (SFBuilding *building_data : g_internal_building_list)
613 {
614 SFMod *parent_mod = building_data->parent_mod;
615 g_current_mod = parent_mod;
616
617 if (temp != g_current_mod)
618 {
619 if (building_count_for_mod > 0)
620 {
621 char log_line[256];
622 snprintf(log_line, sizeof(log_line), "| - Finished Registration of %d buildings for %s",
623 building_count_for_mod, temp->mod_id);
624 log_info(log_line);
625 building_count_for_mod = 0;
626 }
627
628 char info[256];
629 snprintf(info, sizeof(info), "| - Starting Registration for [%s by %s]",
630 parent_mod->mod_id, parent_mod->mod_author);
631 log_info(info);
632 temp = g_current_mod;
633 }
634 else
635 {
636 building_count_for_mod++;
637 }
638
639 Building parsed_building;
640 if (strlen(building_data->building_json_name) != 0)
641 {
642 if (!parse_building_json_entrypoint(building_data->building_json_name, g_current_mod->mod_id,
643 &parsed_building))
644 {
645 log_error("Building JSON structure invalid: %s", building_data->building_json_name);
646 continue;
647 }
648
649 building_data->race = parsed_building.race;
650 building_data->can_enter = parsed_building.can_enter;
651 building_data->slot_count = parsed_building.slot_count;
652 building_data->building_required = parsed_building.building_required;
653 building_data->worker_cycle = 0;
654 building_data->name_id = parsed_building.name_id;
655 building_data->health = parsed_building.health;
656 building_data->ext_description_id = parsed_building.description_id;
657 building_data->initial_angle = 0;
658 building_data->flags = parsed_building.flags;
659 building_data->centerX = parsed_building.center_x;
660 building_data->centerY = parsed_building.center_y;
661
662 building_data->poly_count = parsed_building.collision_count;
663 building_data->resource_req_num = parsed_building.resource_count;
664 for (int i = 0; i < parsed_building.resource_count && i < MAX_RESOURCES; i++)
665 {
666 building_data->resource_req_type[i] = get_resource_id(parsed_building.resources[i].type);
667 if (building_data->resource_req_type[i] != 0)
668 {
669 building_data->resource_req_amount[i] = parsed_building.resources[i].amount;
670 }
671 else
672 {
673 building_data->resource_req_amount[i] = 0;
674 }
675 }
676 for (int i = 0; i < parsed_building.collision_count && i < MAX_COLLISIONS; i++)
677 {
678 building_data->shadows[i] = parsed_building.collisions[i].shadow;
679 }
680
681 register_building_to_game(building_data, &parsed_building);
682 }
683
684 claim_numeric_id(CONFLICT_BUILDING_ID, building_data->building_id, parent_mod,
685 0xd1, "Building ID");
686
687 if (building_data->done_handler != nullptr)
688 {
689 registerBuildingDoneHandler(building_data->building_id, building_data->done_handler);
690 }
691 if (building_data->entry_handler != nullptr)
692 {
693 registerBuildingEntryHandler(building_data->building_id, building_data->entry_handler);
694 }
695 }
696}
bool claim_numeric_id(ConflictDomain domain, uint32_t id, SFMod *mod, uint32_t vanilla_max, const char *id_label)
Claims a numeric ID within a domain for a mod.
@ CONFLICT_SPELL_EFFECT_ID
@ CONFLICT_SPELL_ID
@ CONFLICT_BUILDING_ID
void log_error(const char *format,...)
void log_debug(DebugLevel level, const char *format,...)
void log_info(const char *format,...)
int AddrOf(int offset)
returns "real" virtual address of given memory offset
Definition sf_asi.h:135
void registerAiAOEHandler(uint16_t spell_line, ai_aoe_handler_ptr handler)
void registerAiAvoidanceHandler(uint16_t spell_line, ai_avoidance_handler_ptr handler)
void registerAiSingleTargetHandler(uint16_t spell_line, ai_single_handler_ptr handler)
void registerBuildingDoneHandler(uint8_t building_type, building_done_handler_ptr handler)
void registerBuildingEntryHandler(uint8_t building_type, building_entry_handler_ptr handler)
bool parse_building_json_entrypoint(const char *building_json_name, const char *mod_id, Building *out_building)
#define MAX_RESOURCES
#define MAX_COLLISIONS
void(__thiscall * addBuildingAuxData_ptr)(void *_this, BuildingAuxEntry_related *entry, uint8_t *building_id)
void(__thiscall * addBuilding_ptr)(void *_this, void *struct1, void *struct2)
void(__thiscall * setCollisionListSize_ptr)(uint_list_node *_this, uint8_t list_size)
void(__thiscall * sub_effect_handler_ptr)(SF_CGdEffect *, uint16_t effect_index)
void registerEnchantHandler(uint16_t spell_line, enchant_handler_ptr handler)
@ SMELTER_BUILDING
@ MOONSILVER_BUILDING
@ WOODCUTTER_BUILDING
@ FOODSTORE_BUILDING
@ QUARRY_BUILDING
@ STONEMASON_BUILDING
@ SAWMILL_BUILDING
void addCollisionEntry(uint_list_node *list, int32_t posX, int32_t posY, int8_t index)
void __thiscall linkAOEAIHandler(SFSpell *spell, ai_aoe_handler_ptr handler)
void __thiscall linkEndHandler(SFSpell *spell, handler_ptr endHandler)
SFBuilding *__thiscall registerBuilding(uint8_t building_type)
uint8_t __thiscall getRacialIronMine(uint8_t race)
void __thiscall linkDealDamageHandler(SFSpell *spell, damage_handler_ptr handler, SpellDamagePhase phase)
uint8_t __thiscall getRacialWoodcutter(uint8_t race)
void dumpAuxEntry(BuildingAuxEntry_related *entry)
void __thiscall applySpellTag(SFSpell *spell, SpellTag tag)
uint8_t __thiscall getRacialStonecutter(uint8_t race)
void register_mod_buildings()
void __thiscall applyBuildingTag(SFBuilding *building, BuildingTag tag)
uint32_t __thiscall getBuildingTags(uint8_t building_type)
void __thiscall linkTypeHandler(SFSpell *spell, handler_ptr typeHandler)
int32_t recalcCoord(int32_t value)
void __thiscall linkEnchantChanceHandler(SFSpell *spell, enchant_handler_ptr handler)
void __thiscall linkOnHitHandler(SFSpell *spell, onhit_handler_ptr onhitHandler, OnHitPhase phase)
void __thiscall linkPhysEffectHandler(SFSpell *spell, phys_effect_handler_ptr handler)
std::list< SFBuilding * > g_internal_building_list
void __thiscall linkRefreshHandler(SFSpell *spell, refresh_handler_ptr handler)
uint8_t __thiscall getRacialFoodstore(uint8_t race)
std::list< SFSpell * > g_internal_spell_list
void __thiscall linkEffectHandler(SFSpell *spell, uint16_t spell_effect_id, handler_ptr effectHandler)
void __thiscall linkSingleTargetAIHandler(SFSpell *spell, ai_single_handler_ptr handler)
void __thiscall linkBuildingJSON(SFBuilding *building, const char *building_json_name)
setCollisionListSize_ptr setListSize
uint8_t __thiscall getRacialQuarry(uint8_t race)
uint8_t get_resource_id(const char *resource_name)
void register_mod_spells()
Registers the mod spells and performs basic conflict checking.
void __thiscall linkAvoidanceAIHandler(SFSpell *spell, ai_avoidance_handler_ptr handler)
void register_building_to_game(SFBuilding *building, const Building *src)
addBuildingAuxData_ptr AddAuxData
void __thiscall linkBuildingDoneHandler(SFBuilding *building, building_done_handler_ptr handler)
void __thiscall linkPhysRainHandler(SFSpell *spell, sub_effect_handler_ptr handler)
uint8_t __thiscall getRacialSawmill(uint8_t race)
void __thiscall linkSubEffectHandler(SFSpell *spell, sub_effect_handler_ptr handler)
SFSpell *__thiscall registerSpell(uint16_t spell_id)
uint8_t __thiscall getRacialSmelter(uint8_t race)
void __thiscall linkBuildingEntryHandler(SFBuilding *building, building_entry_handler_ptr handler)
addBuilding_ptr AddBuilding
uint16_t __thiscall getSpellTags(uint16_t spell_line_id)
SFMod * g_current_mod
void registerOnHitHandler(uint16_t spell_line_id, onhit_handler_ptr handler, OnHitPhase phase)
void registerPhysRainHandler(uint16_t spell_line_id, sub_effect_handler_ptr handler)
void registerPhysEffectHandler(uint16_t spell_line_id, phys_effect_handler_ptr handler)
void(__thiscall * building_done_handler_ptr)(SF_CGdBuildingToolbox *_this, uint16_t building_index)
uint16_t(__thiscall * phys_effect_handler_ptr)(SF_CGdEffect *_this, uint16_t source, uint16_t target, bool *isSpellDamage, uint16_t damage)
uint16_t(__thiscall * damage_handler_ptr)(SF_CGdFigureToolbox *_toolbox, uint16_t source, uint16_t target, uint16_t current_damage, uint16_t is_spell_damage, uint32_t is_ranged_damage, uint16_t spell_id)
uint32_t(__thiscall * ai_single_handler_ptr)(SF_CGdBattleDevelopment *_this, uint16_t target_index, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
uint32_t(__thiscall * ai_aoe_handler_ptr)(SF_CGdBattleDevelopment *_this, SF_Coord *position, uint16_t spell_line, SF_CGdResourceSpell *spell_data)
void(__thiscall * building_entry_handler_ptr)(SF_CGdFigureJobs *_this, uint16_t figure_id, uint16_t building_id)
uint16_t(__thiscall * enchant_handler_ptr)(SF_CGdFigure *_this, uint16_t figure_id)
uint32_t(__thiscall * ai_avoidance_handler_ptr)(CGdAIBattleData *_this, uint16_t figure_index, uint16_t spell_line)
uint16_t(__thiscall * onhit_handler_ptr)(SF_CGdFigureJobs *, uint16_t source, uint16_t target, uint16_t damage)
void registerSpellDamageHandler(uint16_t spell_line_id, damage_handler_ptr handler, SpellDamagePhase phase)
void registerEffectHandler(uint16_t spell_job, handler_ptr handler)
void registerSpellEndHandler(uint16_t spell_line, handler_ptr handler)
void registerSpellRefreshHandler(uint16_t spell_line_id, refresh_handler_ptr handler)
void registerSpellTypeHandler(uint16_t spell_index, handler_ptr handler)
void registerSubEffectHandler(uint16_t spell_line, sub_effect_handler_ptr handler)
int(__thiscall * refresh_handler_ptr)(SF_CGdSpell *, uint16_t)
Definition sfsf.h:31
void(__thiscall * handler_ptr)(SF_CGdSpell *, uint16_t)
Definition sfsf.h:30
BuildingAuxEntry * data
uint32_t centerY
uint8_t id
uint8_t shadows[5]
uint8_t poly_count
uint8_t unknown[2]
uint8_t resource_req_type[5]
uint16_t resource_req_amount[5]
uint8_t resource_req_num
uint32_t centerX
uint_list_node collisions[5]
Resource resources[5]
Collision collisions[5]
WorldCoord points[255]
building_done_handler_ptr done_handler
building_entry_handler_ptr entry_handler
uint16_t resource_req_amount[5]
char mod_author[128]
enchant_handler_ptr spell_enchtant_handler
handler_ptr spell_effect_handler
ai_avoidance_handler_ptr ai_avoidance_handler
damage_handler_ptr deal_damage_handler
sub_effect_handler_ptr phys_rain_handler
ai_single_handler_ptr ai_single_handler
SpellDamagePhase damage_phase
refresh_handler_ptr spell_refresh_handler
handler_ptr spell_end_handler
sub_effect_handler_ptr sub_effect_handler
onhit_handler_ptr spell_onhit_handler
ai_aoe_handler_ptr ai_aoe_handler
handler_ptr spell_type_handler
phys_effect_handler_ptr phys_effect_handler
BuildingResource building