Better sanity check exclamation box hook (#536)
Also makes the parent object of the spawned object the exclamation box for spawned stars to work properly
This commit is contained in:
parent
66f2f1dee4
commit
f9f4c61921
|
@ -133,6 +133,7 @@ void exclamation_box_spawn_contents(struct Struct802C0DF0 *a0, u8 a1) {
|
||||||
|
|
||||||
struct Object* luaSpawnedObject = NULL;
|
struct Object* luaSpawnedObject = NULL;
|
||||||
if ((luaSpawnedObject = smlua_call_exclamation_box_hook(o, true)) != NULL) {
|
if ((luaSpawnedObject = smlua_call_exclamation_box_hook(o, true)) != NULL) {
|
||||||
|
luaSpawnedObject->parentObj = o; // Allows spawned stars to work like it was a normal exclamation box
|
||||||
(void *)smlua_call_exclamation_box_hook(luaSpawnedObject, false);
|
(void *)smlua_call_exclamation_box_hook(luaSpawnedObject, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1842,11 +1842,13 @@ struct Object* smlua_call_exclamation_box_hook(struct Object* obj, bool write) {
|
||||||
struct Object* returnObject = NULL;
|
struct Object* returnObject = NULL;
|
||||||
if (write) {
|
if (write) {
|
||||||
returnObject = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
|
returnObject = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
|
||||||
|
if (!gSmLuaConvertSuccess || returnObject == NULL) {
|
||||||
|
LOG_LUA("Return value type is invalid for writeFunction: %d", lua_type(L, 1));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
if (!gSmLuaConvertSuccess) { return NULL; }
|
|
||||||
|
|
||||||
return returnObject;
|
return returnObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue