mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-08-22 07:04:47 -04:00
de9c5d5101
* Impl SpawnParams * Added json submodule * Update json * Update * Works * Remove comment * Works refactor * Snowman and thwomp working * Impl hot air balloon * More progress * All OObjects are done * cleanup * Refactor 2Dpath to normal path * Update nlohmann json & fix compile * Rest of actors * MORE CHANGES * Finish actors * Done PR, some fix to collision viewer * Impl falling rocks * Add const * wip editor refactor * Property work * continue * Overridable editor properties * Actor saving/loading works now * Fix light alignment * Clarification * Impl penguin * params impl signs * properties impl falling rock * More property impls * impl air balloon * Add spawnParams to OObject Translate * Snowman translate better * impl hedgehog properly * properties impl trophy * thwomp progress * Finish impl properties * Fix compile * Fix cursor collisions * Move registered actors * Rename pathPoint XYZ to xyz * Fix editor pause bug * Clean up * Review comments * Remove SpawnParams struct from actor classes * Rename * Player Label First Iteration * Work now * Working 3d text * Fix boo bug * Finish AText actor * Fix spawnparams compile * Register AText * Finish Text Actor * Fix thwomp interpolation * Fix compile * Fix crab and hedgehog * Fix loading flagpole * Fix Hot Air Balloon * Turn zbuffer on for AText * Update --------- Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
33 lines
840 B
C++
33 lines
840 B
C++
#include <functional>
|
|
#include <unordered_map>
|
|
#include <string>
|
|
|
|
#include "Registry.h"
|
|
#include "engine/CoreMath.h"
|
|
|
|
extern "C" {
|
|
#include "actors.h"
|
|
#include "actor_types.h"
|
|
}
|
|
|
|
std::unordered_map<std::string, ActorRegistryEntry> gActorRegistry;
|
|
|
|
void RegisterActor(const std::string& name,
|
|
std::function<void(const SpawnParams&)> spawnFunc)
|
|
{
|
|
gActorRegistry[name] = { spawnFunc };
|
|
}
|
|
|
|
void Registry_SpawnActor(SpawnParams& params) {
|
|
auto it = gActorRegistry.find(params.Name);
|
|
if (it != gActorRegistry.end() && it->second.spawnFunc) {
|
|
printf("[Registry] Spawned %s\n", params.Name.c_str());
|
|
it->second.spawnFunc(params);
|
|
}
|
|
}
|
|
|
|
// @arg name Must be a resource name such as mk:car
|
|
bool Registry_Find(const std::string& name) {
|
|
return gActorRegistry.find(name) != gActorRegistry.end();
|
|
}
|