Fixed ItemDropEvent logic

This commit is contained in:
KiritoDv 2024-12-28 19:25:23 -06:00 committed by Lywx
parent dd29a496d6
commit 4d28f402e5
6 changed files with 26 additions and 26 deletions

View File

@ -1568,7 +1568,7 @@ void Cutscene_DropVsItem(Player* player, ObjectId itemId, Item* item) {
item->obj.pos.y = player->pos.y; item->obj.pos.y = player->pos.y;
item->obj.pos.z = player->trueZpos; item->obj.pos.z = player->trueZpos;
item->obj.id = itemId; item->obj.id = itemId;
CALL_CANCELLABLE_EVENT(ItemDropEvent, item){ CALL_CANCELLABLE_EVENT(ItemDropEvent, item) {
Object_SetInfo(&item->info, item->obj.id); Object_SetInfo(&item->info, item->obj.id);
} }
} }

View File

@ -277,7 +277,7 @@ void Item_Load(Item* this, ObjectInit* objInit) {
this->obj.rot.z = objInit->rot.z; this->obj.rot.z = objInit->rot.z;
this->obj.id = objInit->id; this->obj.id = objInit->id;
this->width = 1.0f; this->width = 1.0f;
CALL_CANCELLABLE_EVENT(ItemDropEvent, this){ CALL_CANCELLABLE_EVENT(ItemDropEvent, this) {
Object_SetInfo(&this->info, this->obj.id); Object_SetInfo(&this->info, this->obj.id);
} }
} }
@ -1045,10 +1045,10 @@ void Scenery_CoStoneArch_Init(CoStoneArch* this, f32* hitboxData) {
item->obj.pos.y = this->obj.pos.y; item->obj.pos.y = this->obj.pos.y;
item->obj.pos.z = this->obj.pos.z; item->obj.pos.z = this->obj.pos.z;
item->obj.rot.y = this->obj.rot.y; item->obj.rot.y = this->obj.rot.y;
CALL_CANCELLABLE_EVENT(ItemDropEvent, item){ item->info.hitbox = LOAD_ASSET(hitboxData);
CALL_CANCELLABLE_EVENT(ItemDropEvent, item) {
Object_SetInfo(&item->info, item->obj.id); Object_SetInfo(&item->info, item->obj.id);
} }
item->info.hitbox = LOAD_ASSET(hitboxData);
break; break;
} }
} }
@ -1701,23 +1701,23 @@ void func_enmy_800660F0(Actor* this) {
item->obj.pos.z = this->obj.pos.z; item->obj.pos.z = this->obj.pos.z;
item->timer_4A = 8; item->timer_4A = 8;
CALL_CANCELLABLE_EVENT(ItemDropEvent, item){ CALL_CANCELLABLE_EVENT(ItemDropEvent, item) {
Object_SetInfo(&item->info, item->obj.id); Object_SetInfo(&item->info, item->obj.id);
} if ((item->obj.id == OBJ_ITEM_SILVER_RING) || (item->obj.id == OBJ_ITEM_BOMB) ||
(item->obj.id == OBJ_ITEM_LASERS)) {
item->unk_50 = 90.0f;
}
if ((item->obj.id == OBJ_ITEM_SILVER_RING) || (item->obj.id == OBJ_ITEM_BOMB) || if ((item->obj.id >= OBJ_ITEM_GOLD_RING) || (item->obj.id == OBJ_ITEM_1UP)) {
(item->obj.id == OBJ_ITEM_LASERS)) { item->unk_50 = 90.0f;
item->unk_50 = 90.0f; AUDIO_PLAY_SFX(NA_SE_ITEM_APPEAR, gDefaultSfxSource, 4);
} item->timer_48 = 1000;
if (item->obj.id == OBJ_ITEM_WING_REPAIR) {
if ((item->obj.id >= OBJ_ITEM_GOLD_RING) || (item->obj.id == OBJ_ITEM_1UP)) { AUDIO_PLAY_SFX(NA_SE_OB_WING, item->sfxSource, 0);
item->unk_50 = 90.0f; }
AUDIO_PLAY_SFX(NA_SE_ITEM_APPEAR, gDefaultSfxSource, 4);
item->timer_48 = 1000;
if (item->obj.id == OBJ_ITEM_WING_REPAIR) {
AUDIO_PLAY_SFX(NA_SE_OB_WING, item->sfxSource, 0);
} }
} }
break; break;
} }
} }

View File

@ -7012,7 +7012,7 @@ void Play_SpawnVsItem(ObjectId objId, Item* item) {
item->obj.pos.y = gScenery360[spawnIndex].obj.pos.y; item->obj.pos.y = gScenery360[spawnIndex].obj.pos.y;
item->obj.pos.z = gScenery360[spawnIndex].obj.pos.z; item->obj.pos.z = gScenery360[spawnIndex].obj.pos.z;
item->obj.id = objId; item->obj.id = objId;
CALL_CANCELLABLE_EVENT(ItemDropEvent, item){ CALL_CANCELLABLE_EVENT(ItemDropEvent, item) {
Object_SetInfo(&item->info, item->obj.id); Object_SetInfo(&item->info, item->obj.id);
} }
} }

View File

@ -90,7 +90,7 @@ void Corneria_Granga_SpawnItem(Boss* this, f32 x, f32 y, f32 z, ObjectId itemId)
gItems[i].obj.pos.x = x; gItems[i].obj.pos.x = x;
gItems[i].obj.pos.y = y; gItems[i].obj.pos.y = y;
gItems[i].obj.pos.z = z; gItems[i].obj.pos.z = z;
CALL_CANCELLABLE_EVENT(ItemDropEvent, &gItems[i]){ CALL_CANCELLABLE_EVENT(ItemDropEvent, &gItems[i]) {
Object_SetInfo(&gItems[i].info, gItems[i].obj.id); Object_SetInfo(&gItems[i].info, gItems[i].obj.id);
} }
break; break;
@ -596,10 +596,10 @@ void Corneria_CoGranga_1UpCheck(CoGranga* this) {
gItems[i].obj.pos.z = gPlayer[0].trueZpos + dest.z; gItems[i].obj.pos.z = gPlayer[0].trueZpos + dest.z;
gItems[i].timer_4A = 8; gItems[i].timer_4A = 8;
CALL_CANCELLABLE_EVENT(ItemDropEvent, &gItems[i]){ CALL_CANCELLABLE_EVENT(ItemDropEvent, &gItems[i]) {
Object_SetInfo(&gItems[i].info, gItems[i].obj.id); Object_SetInfo(&gItems[i].info, gItems[i].obj.id);
Effect_Effect384_Spawn(gItems[i].obj.pos.x, gItems[i].obj.pos.y, gItems[i].obj.pos.z, 5.0f, 0);
} }
Effect_Effect384_Spawn(gItems[i].obj.pos.x, gItems[i].obj.pos.y, gItems[i].obj.pos.z, 5.0f, 0);
break; break;
} }
} }

View File

@ -381,7 +381,7 @@ void Aquas_SpawnItem(Vec3f* pos, ObjectId objId) {
item->obj.pos.y = pos->y; item->obj.pos.y = pos->y;
item->obj.pos.z = pos->z; item->obj.pos.z = pos->z;
item->timer_4A = 2; item->timer_4A = 2;
CALL_CANCELLABLE_EVENT(ItemDropEvent, item){ CALL_CANCELLABLE_EVENT(ItemDropEvent, item) {
Object_SetInfo(&item->info, item->obj.id); Object_SetInfo(&item->info, item->obj.id);
} }
break; break;

View File

@ -155,7 +155,7 @@ void Andross_801878A8() {
item->obj.pos.z = -gLevelObjects[i].zPos1; item->obj.pos.z = -gLevelObjects[i].zPos1;
item->obj.pos.z += gLevelObjects[i].zPos2; item->obj.pos.z += gLevelObjects[i].zPos2;
item->obj.pos.y = gLevelObjects[i].yPos; item->obj.pos.y = gLevelObjects[i].yPos;
CALL_CANCELLABLE_EVENT(ItemDropEvent, item){ CALL_CANCELLABLE_EVENT(ItemDropEvent, item) {
Object_SetInfo(&item->info, item->obj.id); Object_SetInfo(&item->info, item->obj.id);
} }
item++; item++;
@ -238,7 +238,7 @@ void Andross_80187C5C(void) {
item->obj.pos.z = -gLevelObjects[i].zPos1; item->obj.pos.z = -gLevelObjects[i].zPos1;
item->obj.pos.z += gLevelObjects[i].zPos2; item->obj.pos.z += gLevelObjects[i].zPos2;
item->obj.pos.y = gLevelObjects[i].yPos; item->obj.pos.y = gLevelObjects[i].yPos;
CALL_CANCELLABLE_EVENT(ItemDropEvent, item){ CALL_CANCELLABLE_EVENT(ItemDropEvent, item) {
Object_SetInfo(&item->info, item->obj.id); Object_SetInfo(&item->info, item->obj.id);
} }
item++; item++;
@ -1637,10 +1637,10 @@ void Andross_Effect396_Update(Effect396* this) {
item->obj.pos.y = this->obj.pos.y; item->obj.pos.y = this->obj.pos.y;
item->obj.pos.z = this->obj.pos.z; item->obj.pos.z = this->obj.pos.z;
item->timer_4A = 8; item->timer_4A = 8;
CALL_CANCELLABLE_EVENT(ItemDropEvent, item){ item->unk_50 = 90.0f;
CALL_CANCELLABLE_EVENT(ItemDropEvent, item) {
Object_SetInfo(&item->info, item->obj.id); Object_SetInfo(&item->info, item->obj.id);
} }
item->unk_50 = 90.0f;
break; break;
} }
} }