Conversation
|
|
||
| const ActorInit Boss_Dodongo_InitVars = { | ||
| ACTOR_EN_DODONGO, | ||
| ACTOR_BOSS_DODONGO, |
There was a problem hiding this comment.
I see this enum was renamed from ACTOR_EN_DODONGO to ACTOR_BOSS_DODONGO, but Gohma's was renamed the opposite way? I'm sure this is probably authentic jank, but if you wouldn't mind elaborating I'd appreciate it.
There was a problem hiding this comment.
Actually I think I'm seeing it, King Dodongo had the regular Dodongo as it's actor ID and Gohma larvae had Queen Gohma's actor id. What effect would this have in game, if any? That seems like it would've caused some pretty big problems I would think.
There was a problem hiding this comment.
A look through the code tells me that these particular actors don't have their instance's IDs checked very often, so I guess this is harmless and a good idea to take care of here.
There was a problem hiding this comment.
Yep, it's a benign vanilla bug. I made sure to check that their IDs weren't used and to play through the areas where these actors were present to make sure bugs weren't introduced. I fixed the init vars so I could make the assumption that they were accurate while initializing the DB and that actor->id reflected the ActorDB entry for them. Without these changes, I'd have to do more record keeping.
dcvz
left a comment
There was a problem hiding this comment.
Approving pending the final naming on Lookup vs Retrieve
Kenix3
left a comment
There was a problem hiding this comment.
I'm curious why you didn't just load the original actor init struct and added support for two types of init structs. Shouldn't we be creating actor entries into the DB consistently?
138e50d to
a35874c
Compare
|
The reason I added a new init struct was that it allows us to make changes to how we initialize the table as we add new features (custom actors) that require actors to supply additional information. Already we add descriptions to them for the actor viewer. If we used 1 common struct, that would mean we'd have to update every In other words, doing it this way will save us a significant amount of pain in the future. I will add too that that's the reason why the |
05bd4a3 to
ba13e6b
Compare
dcvz
left a comment
There was a problem hiding this comment.
I like this very much! There are some suggestions about naming. They revolve around using GetEntry, AddEntry and so on.. but I would say if we aim for this to become the way to interact with Actors, we should just name them GetActor, AddActor, etc.
| entry.desc = desc.c_str(); | ||
| } | ||
|
|
||
| extern "C" ActorDBEntry* ActorDB_Retrieve(const int id) { |
There was a problem hiding this comment.
Is ActorDB the only way now to interact with Actors? If so, I would say let's name it:
| extern "C" ActorDBEntry* ActorDB_Retrieve(const int id) { | |
| extern "C" ActorDBEntry* GetActorEntry(const int id) { |
if not then I'd say let's go for
| extern "C" ActorDBEntry* ActorDB_Retrieve(const int id) { | |
| extern "C" ActorDBEntry* ActorDB_GetEntry(const int id) { |
There was a problem hiding this comment.
It is the only place to interact with certain information about actors, mainly for spawning them. But, I don't think GetActorEntry is appropriate. This is extern "C", so it is in the global namespace, and so I would like it to be namespaced as best we can. The Namespace_Name pattern is common, see OTRGlobals.h for a whole list of examples.
soh/soh/ActorDB.cpp
Outdated
| } | ||
|
|
||
| // Get the ActorDB::Enty for the given actor id. | ||
| ActorDB::Entry& ActorDB::Retrieve(const int id) { |
There was a problem hiding this comment.
| ActorDB::Entry& ActorDB::Retrieve(const int id) { | |
| ActorDB::Entry& ActorDB::GetEntry(const int id) { |
There was a problem hiding this comment.
There were previous discussions on naming this Retrieve to match the custom messages DB. I think naming this RetrieveEntry is good, but I don't want to break consistency with Get.
| } | ||
|
|
||
| // Get the id for a given actor by name. | ||
| int ActorDB::RetrieveId(const std::string& name) { |
There was a problem hiding this comment.
| int ActorDB::RetrieveId(const std::string& name) { | |
| int ActorDB::GetActorEntryId(const std::string& name) { |
| return &ActorDB::Instance->Retrieve(id).entry; | ||
| } | ||
|
|
||
| extern "C" int ActorDB_RetrieveId(const char* name) { |
There was a problem hiding this comment.
Same suggestion as above and as commented on the C++ counterpart
63324f1 to
01d1452
Compare
|
Note: there were some build failures on Linux due to different definitions of functions in |
Kenix3
left a comment
There was a problem hiding this comment.
This looks like a fantastic update to me!
|
Hmm, I just tested this and Link always seems to immediately fall through the floor. Maybe this doesn't work well with some of the more recent LUS changes? EDIT: Not sure what changed but now I seem to be getting random crashes all over the place. |
|
I think I figured it out, Windows did still need those other math functions. It compiled fine without them but had all kinds of weird issues at runtime. I'll PR to Roze's branch. |
|
Also, after being able to build and run correctly on Windows, I found that this also seems to fix issue #2861 |
Fix missing math functions on Windows.
Co-authored-by: Adam Bird <Archez@users.noreply.github.com>
This PR adds an important functionality for eventual custom actor mods: dynamic actor IDs. This allows us to dynamically add actors while the game is running, such as while loading mod OTRs. This is a drop-in replacement for vanilla actors, who will continue to have the same ID as the base game.
This replaces the actor DLF tables, so they have been removed, and some other cleanup was done for actor overlays.
There is no need for this to get merged anytime soon, but I wanted to get this up so that people can see it.
Build Artifacts