1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-07 14:50:15 +00:00

Fix EnBombf_Update (#290)

* fix colliderinit typo

* EnBombf_Update OK

* fix thisx to effect call
This commit is contained in:
fig02 2020-07-23 18:29:24 -04:00 committed by GitHub
parent e3afc9ab5c
commit c94aaa327a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 112 additions and 697 deletions

View file

@ -65,23 +65,22 @@ void EnBom_SetupAction(EnBom* this, EnBomActionFunc actionFunc) {
void EnBom_Init(Actor* thisx, GlobalContext* globalCtx) {
EnBom* this = THIS;
Actor_ProcessInitChain(&this->actor, sInitChain);
ActorShape_Init(&this->actor.shape, 700.0f, ActorShadow_DrawFunc_Circle, 16.0f);
this->actor.colChkInfo.mass = 200;
this->actor.colChkInfo.unk_10 = 5;
this->actor.colChkInfo.unk_12 = 0xA;
Actor_ProcessInitChain(thisx, sInitChain);
ActorShape_Init(&thisx->shape, 700.0f, ActorShadow_DrawFunc_Circle, 16.0f);
thisx->colChkInfo.mass = 200;
thisx->colChkInfo.unk_10 = 5;
thisx->colChkInfo.unk_12 = 0xA;
this->timer = 70;
this->flashSpeedScale = 7;
Collider_InitCylinder(globalCtx, &this->bombCollider);
Collider_InitJntSph(globalCtx, &this->explosionCollider);
Collider_SetCylinder(globalCtx, &this->bombCollider, &this->actor, &sCylinderInit);
Collider_SetJntSph(globalCtx, &this->explosionCollider, &this->actor, &sJntSphInit,
&this->explosionColliderItems[0]);
Collider_SetCylinder(globalCtx, &this->bombCollider, thisx, &sCylinderInit);
Collider_SetJntSph(globalCtx, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderItems[0]);
this->explosionColliderItems[0].body.toucher.damage += (thisx->shape.rot.z & 0xFF00) >> 8;
this->actor.shape.rot.z &= 0xFF;
if (this->actor.shape.rot.z & 0x80) {
this->actor.shape.rot.z |= 0xFF00;
thisx->shape.rot.z &= 0xFF;
if (thisx->shape.rot.z & 0x80) {
thisx->shape.rot.z |= 0xFF00;
}
EnBom_SetupAction(this, EnBom_Move);
@ -204,37 +203,37 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad[2];
EnBom* this = THIS;
this->actor.gravity = -1.2f;
thisx->gravity = -1.2f;
if (this->timer != 0) {
this->timer--;
}
if (this->timer == 67) {
Audio_PlayActorSound2(&this->actor, NA_SE_PL_TAKE_OUT_SHIELD);
Actor_SetScale(&this->actor, 0.01f);
Audio_PlayActorSound2(thisx, NA_SE_PL_TAKE_OUT_SHIELD);
Actor_SetScale(thisx, 0.01f);
}
if ((this->actor.xzDistFromLink >= 20.0f) || (ABS(this->actor.yDistFromLink) >= 80.0f)) {
if ((thisx->xzDistFromLink >= 20.0f) || (ABS(thisx->yDistFromLink) >= 80.0f)) {
this->bumpOn = true;
}
this->actionFunc(this, globalCtx);
func_8002E4B4(globalCtx, &this->actor, 5.0f, 10.0f, 15.0f, 0x1F);
func_8002E4B4(globalCtx, thisx, 5.0f, 10.0f, 15.0f, 0x1F);
if (this->actor.params == BOMB_BODY) {
if (thisx->params == BOMB_BODY) {
if (this->timer < 63) {
dustAccel.y = 0.2f;
// spawn spark effect on even frames
effPos = this->actor.posRot.pos;
effPos = thisx->posRot.pos;
effPos.y += 17.0f;
if ((globalCtx->gameplayFrames % 2) == 0) {
func_80029184(globalCtx, this, &effPos, &effVelocity, &effAccel);
func_80029184(globalCtx, thisx, &effPos, &effVelocity, &effAccel);
}
Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_IGNIT - SFX_FLAG);
Audio_PlayActorSound2(thisx, NA_SE_IT_BOMB_IGNIT - SFX_FLAG);
effPos.y += 3.0f;
func_8002829C(globalCtx, &effPos, &effVelocity, &dustAccel, &dustColor, &dustColor, 0x32, 5);
@ -243,22 +242,22 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) {
if ((this->bombCollider.base.acFlags & 2) ||
((this->bombCollider.base.maskA & 2) && (this->bombCollider.base.oc->type == ACTORTYPE_ENEMY))) {
this->timer = 0;
this->actor.shape.rot.z = 0;
thisx->shape.rot.z = 0;
} else {
// if a lit stick touches the bomb, set timer to 100
// these bombs never have a timer over 70, so this isnt used
if ((this->timer > 100) && func_8008EF5C(globalCtx, &this->actor.posRot.pos, 30.0f, 50.0f)) {
if ((this->timer > 100) && func_8008EF5C(globalCtx, &thisx->posRot.pos, 30.0f, 50.0f)) {
this->timer = 100;
}
}
dustAccel.y = 0.2f;
effPos = this->actor.posRot.pos;
effPos = thisx->posRot.pos;
effPos.y += 10.0f;
// double bomb flash speed and adjust red color at certain times during the countdown
if ((this->timer == 3) || (this->timer == 20) || (this->timer == 40)) {
this->actor.shape.rot.z = 0;
thisx->shape.rot.z = 0;
this->flashSpeedScale >>= 1;
}
@ -269,58 +268,58 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) {
}
if (this->timer < 3) {
Actor_SetScale(&this->actor, this->actor.scale.x + 0.002f);
Actor_SetScale(thisx, thisx->scale.x + 0.002f);
}
if (this->timer == 0) {
effPos = this->actor.posRot.pos;
effPos = thisx->posRot.pos;
effPos.y += 10.0f;
if (func_8002F410(&this->actor, globalCtx)) {
if (func_8002F410(thisx, globalCtx)) {
effPos.y += 30.0f;
}
func_80028E84(globalCtx, &effPos, &effVelocity, &bomb2Accel, 0x64, (this->actor.shape.rot.z * 6) + 0x13);
func_80028E84(globalCtx, &effPos, &effVelocity, &bomb2Accel, 0x64, (thisx->shape.rot.z * 6) + 0x13);
effPos.y = this->actor.groundY;
if (this->actor.groundY > -32000.0f) {
effPos.y = thisx->groundY;
if (thisx->groundY > -32000.0f) {
func_80029024(globalCtx, &effPos, &effVelocity, &effAccel);
}
Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOMB_EXPLOSION);
Audio_PlayActorSound2(thisx, NA_SE_IT_BOMB_EXPLOSION);
if (globalCtx) {};
globalCtx->envCtx.unk_8C[3] = globalCtx->envCtx.unk_8C[4] = globalCtx->envCtx.unk_8C[5] = 0xFA;
globalCtx->envCtx.unk_8C[0] = globalCtx->envCtx.unk_8C[1] = globalCtx->envCtx.unk_8C[2] = 0xFA;
func_8005AA1C(&globalCtx->cameras[0], 2, 0xB, 8);
this->actor.params = BOMB_EXPLOSION;
thisx->params = BOMB_EXPLOSION;
this->timer = 10;
this->actor.flags |= 0x20;
thisx->flags |= 0x20;
EnBom_SetupAction(this, EnBom_Explode);
}
}
Actor_SetHeight(&this->actor, 20.0f);
Actor_SetHeight(thisx, 20.0f);
if (this->actor.params <= BOMB_BODY) {
Collider_CylinderUpdate(&this->actor, &this->bombCollider);
if (thisx->params <= BOMB_BODY) {
Collider_CylinderUpdate(thisx, &this->bombCollider);
// if link is not holding the bomb anymore and bump conditions are met, subscribe to OC
if (!func_8002F410(&this->actor, globalCtx) && this->bumpOn) {
if (!func_8002F410(thisx, globalCtx) && this->bumpOn) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bombCollider.base);
}
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bombCollider.base);
}
if ((this->actor.scale.x >= 0.01f) && (this->actor.params != BOMB_EXPLOSION)) {
if (this->actor.waterY >= 20.0f) {
func_8002A9F4(globalCtx, &this->actor.projectedPos, NA_SE_IT_BOMB_UNEXPLOSION, 1, 1, 0xA);
Actor_Kill(&this->actor);
if ((thisx->scale.x >= 0.01f) && (thisx->params != BOMB_EXPLOSION)) {
if (thisx->waterY >= 20.0f) {
func_8002A9F4(globalCtx, &thisx->projectedPos, NA_SE_IT_BOMB_UNEXPLOSION, 1, 1, 0xA);
Actor_Kill(thisx);
return;
}
if (this->actor.bgCheckFlags & 0x40) {
this->actor.bgCheckFlags &= ~0x40;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_BOMB_DROP_WATER);
if (thisx->bgCheckFlags & 0x40) {
thisx->bgCheckFlags &= ~0x40;
Audio_PlayActorSound2(thisx, NA_SE_EV_BOMB_DROP_WATER);
}
}
}
@ -335,10 +334,10 @@ void EnBom_Draw(Actor* thisx, GlobalContext* globalCtx) {
gfxCtx = globalCtx->state.gfxCtx;
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_bom.c", 913);
if (this->actor.params == BOMB_BODY) {
if (thisx->params == BOMB_BODY) {
func_80093D18(globalCtx->state.gfxCtx);
func_800D1FD4(&globalCtx->mf_11DA0);
func_8002EBCC(&this->actor, globalCtx, 0);
func_8002EBCC(thisx, globalCtx, 0);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bom.c", 928),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);