1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 06:10:21 +00:00

Demo_Kekkai, its object, and its cutscenes (#627)

* first pass

* scene

* object

* name

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "44f5d7cb9"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "44f5d7cb9"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* now with cutscenes

* one last name

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "0305ec2c2"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "0305ec2c2"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* ZAPD works

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "2e1174063"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "2e1174063"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* now with vtx arrays

* revert zap changes

* review

Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Fig02 <fig02srl@gmail.com>
This commit is contained in:
petrie911 2021-02-01 13:52:23 -06:00 committed by GitHub
parent 1fbc0f1943
commit 6615d212eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 455 additions and 1410 deletions

View file

@ -5,6 +5,7 @@
*/
#include "z_bg_gnd_darkmeiro.h"
#include "objects/object_demo_kekkai/object_demo_kekkai.h"
#define FLAGS 0x00000030
@ -34,10 +35,6 @@ const ActorInit Bg_Gnd_Darkmeiro_InitVars = {
NULL,
};
extern Gfx D_060088B0[];
extern Gfx D_0600BEC0[];
extern CollisionHeader D_0600C080;
void BgGndDarkmeiro_ToggleBlock(BgGndDarkmeiro* this, GlobalContext* globalCtx) {
if (this->actionFlags & 2) {
if (this->timer1 == 0) {
@ -63,7 +60,7 @@ void BgGndDarkmeiro_Init(Actor* thisx, GlobalContext* globalCtx) {
this->dyna.actor.flags |= 0x80;
break;
case DARKMEIRO_CLEAR_BLOCK:
CollisionHeader_GetVirtual(&D_0600C080, &colHeader);
CollisionHeader_GetVirtual(&gClearBlockCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx2, &globalCtx2->colCtx.dyna, &this->dyna.actor, colHeader);
if (((this->dyna.actor.params >> 8) & 0x3F) == 0x3F) {
this->updateFunc = BgGndDarkmeiro_UpdateStaticBlock;
@ -181,7 +178,7 @@ void BgGndDarkmeiro_Update(Actor* thisx, GlobalContext* globalCtx) {
}
void BgGndDarkmeiro_DrawInvisiblePath(Actor* thisx, GlobalContext* globalCtx) {
Gfx_DrawDListXlu(globalCtx, D_060088B0);
Gfx_DrawDListXlu(globalCtx, gShadowTrialPathDL);
}
void BgGndDarkmeiro_DrawSwitchBlock(Actor* thisx, GlobalContext* globalCtx) {
@ -202,11 +199,11 @@ void BgGndDarkmeiro_DrawSwitchBlock(Actor* thisx, GlobalContext* globalCtx) {
}
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_darkmeiro.c", 378);
//@bug Due to a bug in the display list, the transparency data is not used.
//! @bug Due to a bug in the display list, the transparency data is not used.
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 198, 202, 208, this->timer2);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_darkmeiro.c", 380);
Gfx_DrawDListXlu(globalCtx, D_0600BEC0);
Gfx_DrawDListXlu(globalCtx, gClearBlockDL);
}
}
@ -215,5 +212,5 @@ void BgGndDarkmeiro_DrawStaticBlock(Actor* thisx, GlobalContext* globalCtx) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 198, 202, 208, 255);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_darkmeiro.c", 393);
Gfx_DrawDListXlu(globalCtx, D_0600BEC0);
Gfx_DrawDListXlu(globalCtx, gClearBlockDL);
}

View file

@ -5,6 +5,7 @@
*/
#include "z_bg_gnd_firemeiro.h"
#include "objects/object_demo_kekkai/object_demo_kekkai.h"
#define FLAGS 0x00000030
@ -19,8 +20,8 @@ void func_808795AC(BgGndFiremeiro* this, GlobalContext* globalCtx);
void func_80879668(BgGndFiremeiro* this, GlobalContext* globalCtx);
void func_80879808(BgGndFiremeiro* this, GlobalContext* globalCtx);
extern UNK_TYPE D_0600E210;
extern UNK_TYPE D_0600ECD8;
// extern Gfx gFireTrialPlatformDL[];
// extern CollisionHeader gFireTrialPlatformCol;
/*
const ActorInit Bg_Gnd_Firemeiro_InitVars = {

View file

@ -5,6 +5,7 @@
*/
#include "z_bg_gnd_iceblock.h"
#include "objects/object_demo_kekkai/object_demo_kekkai.h"
#define FLAGS 0x00000030
@ -24,9 +25,6 @@ void BgGndIceblock_Draw(Actor* thisx, GlobalContext* globalCtx);
void BgGndIceblock_Idle(BgGndIceblock* this, GlobalContext* globalCtx);
void BgGndIceblock_Slide(BgGndIceblock* this, GlobalContext* globalCtx);
extern Gfx D_06004420[];
extern CollisionHeader D_06004618;
const ActorInit Bg_Gnd_Iceblock_InitVars = {
ACTOR_BG_GND_ICEBLOCK,
ACTORCAT_PROP,
@ -55,7 +53,7 @@ void BgGndIceblock_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK);
CollisionHeader_GetVirtual(&D_06004618, &colHeader);
CollisionHeader_GetVirtual(&gWaterTrialIceBlockCol, &colHeader);
this->targetPos = this->dyna.actor.home.pos;
this->actionFunc = BgGndIceblock_Idle;
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
@ -358,5 +356,5 @@ void BgGndIceblock_Draw(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BgGndIceblock* this = THIS;
Gfx_DrawDListOpa(globalCtx, D_06004420);
Gfx_DrawDListOpa(globalCtx, gWaterTrialIceBlockDL);
}

View file

@ -5,6 +5,7 @@
*/
#include "z_bg_gnd_nisekabe.h"
#include "objects/object_demo_kekkai/object_demo_kekkai.h"
#define FLAGS 0x00000010
@ -27,8 +28,6 @@ const ActorInit Bg_Gnd_Nisekabe_InitVars = {
(ActorFunc)BgGndNisekabe_Draw,
};
static Gfx* sDLists[] = { 0x06009230, 0x0600A390, 0x0600B4A0 };
void BgGndNisekabe_Init(Actor* thisx, GlobalContext* globalCtx) {
BgGndNisekabe* this = THIS;
@ -45,17 +44,22 @@ void BgGndNisekabe_Update(Actor* thisx, GlobalContext* globalCtx) {
if (globalCtx->actorCtx.unk_03 != 0) {
this->actor.flags |= 0x80;
} else {
this->actor.flags &= 0xFFFFFF7F;
this->actor.flags &= ~0x80;
}
}
void BgGndNisekabe_Draw(Actor* thisx, GlobalContext* globalCtx) {
static Gfx* dLists[] = {
gLightTrialFakeWallDL,
gGanonsCastleUnusedFakeWallDL,
gGanonsCastleScrubsFakeWallDL,
};
BgGndNisekabe* this = THIS;
u32 index = this->actor.params & 0xFF;
if ((this->actor.flags & 0x80) == 0x80) {
Gfx_DrawDListXlu(globalCtx, sDLists[index]);
Gfx_DrawDListXlu(globalCtx, dLists[index]);
} else {
Gfx_DrawDListOpa(globalCtx, sDLists[index]);
Gfx_DrawDListOpa(globalCtx, dLists[index]);
}
}

View file

@ -5,6 +5,7 @@
*/
#include "z_bg_gnd_soulmeiro.h"
#include "objects/object_demo_kekkai/object_demo_kekkai.h"
#include "global.h"
#define FLAGS 0x00000000
@ -59,13 +60,9 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP),
};
static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
static Gfx* D_8087B578[] = { 0x06007C00, 0x06002320, 0x060035A0 };
void BgGndSoulmeiro_Init(Actor* thisx, GlobalContext* globalCtx) {
BgGndSoulmeiro* this = THIS;
s32 pad;
BgGndSoulmeiro* this = THIS;
Actor_ProcessInitChain(&this->actor, sInitChain);
this->actionFunc = NULL;
@ -107,61 +104,54 @@ void BgGndSoulmeiro_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void func_8087AF38(BgGndSoulmeiro* this, GlobalContext* globalCtx) {
static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
Vec3f vecA;
Vec3f vecB;
s16 temp_1;
s16 temp_2;
f32 temp_3;
f32 temp_4;
f32 distXZ;
s32 i;
BgGndSoulmeiro* this2;
Actor* thisx = &this->actor;
if (this->unk_198 != 0) {
this->unk_198--;
}
if (this->unk_198 == 20) {
Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F);
this->actor.draw = NULL;
Flags_SetSwitch(globalCtx, (thisx->params >> 8) & 0x3F);
thisx->draw = NULL;
}
// This should be this->unk_198 == 0, this is required to match
if (!this->unk_198) {
Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F);
Flags_SetSwitch(globalCtx, (thisx->params >> 8) & 0x3F);
Actor_Kill(&this->actor);
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_MIR_RAY, this->actor.world.pos.x, this->actor.world.pos.y,
this->actor.world.pos.z, 0, 0, 0, 9);
return;
}
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_MIR_RAY, thisx->world.pos.x, thisx->world.pos.y,
thisx->world.pos.z, 0, 0, 0, 9);
} else if ((this->unk_198 % 6) == 0) {
s32 i;
s16 temp_2 = Rand_ZeroOne() * (10922.0f); // This should be: 0x10000 / 6.0f
if (1) {}
if ((this->unk_198 % 6) == 0) {
temp_2 = Rand_ZeroOne() * (10922.0f); // This should be: 0x10000 / 6.0f
vecA.y = 0.0f;
vecB.y = this->actor.world.pos.y;
vecB.y = thisx->world.pos.y;
this2 = this;
for (i = 0; i < 6; i++) {
temp_1 = Rand_CenteredFloat(0x2800) + temp_2;
temp_3 = Math_SinS(temp_1);
temp_4 = Math_CosS(temp_1);
vecB.x = this2->actor.world.pos.x + (120.0f * temp_3);
vecB.z = this2->actor.world.pos.z + (120.0f * temp_4);
distXZ = Math_Vec3f_DistXZ(&this2->actor.home.pos, &vecB) * (1.0f / 120.0f);
s16 temp_1 = Rand_CenteredFloat(0x2800) + temp_2;
f32 temp_3 = Math_SinS(temp_1);
f32 temp_4 = Math_CosS(temp_1);
f32 distXZ;
vecB.x = thisx->world.pos.x + (120.0f * temp_3);
vecB.z = thisx->world.pos.z + (120.0f * temp_4);
distXZ = Math_Vec3f_DistXZ(&thisx->home.pos, &vecB) * (1.0f / 120.0f);
if (distXZ < 0.7f) {
temp_3 = Math_SinS(temp_1 + 0x8000);
temp_4 = Math_CosS(temp_1 + 0x8000);
vecB.x = this->actor.world.pos.x + (120.0f * temp_3);
vecB.z = this->actor.world.pos.z + (120.0f * temp_4);
distXZ = Math_Vec3f_DistXZ(&this->actor.home.pos, &vecB) * (1.0f / 120.0f);
vecB.x = thisx->world.pos.x + (120.0f * temp_3);
vecB.z = thisx->world.pos.z + (120.0f * temp_4);
distXZ = Math_Vec3f_DistXZ(&thisx->home.pos, &vecB) * (1.0f / 120.0f);
}
vecA.x = 4.0f * temp_3 * distXZ;
vecA.y = 0.0f;
vecA.z = 4.0f * temp_4 * distXZ;
EffectSsDeadDb_Spawn(globalCtx, &this->actor.home.pos, &vecA, &sZeroVec, 60, 6, 255, 255, 150, 170, 255, 0,
EffectSsDeadDb_Spawn(globalCtx, &thisx->home.pos, &vecA, &zeroVec, 60, 6, 255, 255, 150, 170, 255, 0,
0, 1, 14, true);
temp_2 += 0x2AAA;
}
@ -177,15 +167,14 @@ void func_8087B284(BgGndSoulmeiro* this, GlobalContext* globalCtx) {
Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->unk_198 = 40;
this->actionFunc = func_8087AF38;
return;
} else {
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
}
void func_8087B350(BgGndSoulmeiro* this, GlobalContext* globalCtx) {
if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) {
this->actor.draw = BgGndSoulmeiro_Draw;
} else {
@ -202,6 +191,11 @@ void BgGndSoulmeiro_Update(Actor* thisx, GlobalContext* globalCtx) {
}
void BgGndSoulmeiro_Draw(Actor* thisx, GlobalContext* globalCtx) {
static Gfx* dLists[] = {
gSpiritTrialWebDL,
gSpiritTrialLightSourceDL,
gSpiritTrialLightFloorDL,
};
s32 params = thisx->params & 0xFF;
if (1) {}
@ -209,19 +203,17 @@ void BgGndSoulmeiro_Draw(Actor* thisx, GlobalContext* globalCtx) {
switch (params) {
case 0:
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_soulmeiro.c", 398);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_gnd_soulmeiro.c", 400),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_8087B578[params]);
gSPDisplayList(POLY_XLU_DISP++, dLists[params]);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_gnd_soulmeiro.c", 403);
break;
case 1:
Gfx_DrawDListXlu(globalCtx, D_8087B578[params]);
Gfx_DrawDListXlu(globalCtx, dLists[params]);
break;
case 2:
Gfx_DrawDListOpa(globalCtx, D_8087B578[params]);
Gfx_DrawDListOpa(globalCtx, dLists[params]);
break;
}
}

View file

@ -1,4 +1,12 @@
/**
* File: z_demo_kekkai.c
* Overlay: ovl_Demo_Kekkai
* Description: Ganon's castle barriers
*/
#include "z_demo_kekkai.h"
#include "objects/object_demo_kekkai/object_demo_kekkai.h"
#include "scenes/dungeons/ganontika/ganontika_scene.h"
#define FLAGS 0x00000030
@ -7,15 +15,14 @@
void DemoKekkai_Init(Actor* thisx, GlobalContext* globalCtx);
void DemoKekkai_Destroy(Actor* thisx, GlobalContext* globalCtx);
void DemoKekkai_Update(Actor* thisx, GlobalContext* globalCtx);
void DemoKekkai_Draw(Actor* thisx, GlobalContext* globalCtx);
void DemoKekkai_DrawTowerBarrier(Actor* thisx, GlobalContext* globalCtx);
extern UNK_TYPE D_06004930;
extern UNK_TYPE D_06004F00;
extern UNK_TYPE D_06004FD0;
extern UNK_TYPE D_06005A30;
extern UNK_TYPE D_06005CB0;
void DemoKekkai_TrialBarrierDispel(Actor* thisx, GlobalContext* globalCtx);
void DemoKekkai_TrialBarrierIdle(Actor* thisx, GlobalContext* globalCtx);
void DemoKekkai_DrawTrialBarrier(Actor* thisx, GlobalContext* globalCtx);
void DemoKekkai_TowerBarrier(DemoKekkai* this, GlobalContext* globalCtx);
/*
const ActorInit Demo_Kekkai_InitVars = {
ACTOR_DEMO_KEKKAI,
ACTORCAT_ITEMACTION,
@ -25,10 +32,10 @@ const ActorInit Demo_Kekkai_InitVars = {
(ActorFunc)DemoKekkai_Init,
(ActorFunc)DemoKekkai_Destroy,
(ActorFunc)DemoKekkai_Update,
(ActorFunc)DemoKekkai_Draw,
(ActorFunc)DemoKekkai_DrawTowerBarrier,
};
static ColliderCylinderInit D_8098E0B0 = {
static ColliderCylinderInit sCylinderInit = {
{
COLTYPE_NONE,
AT_ON | AT_TYPE_ENEMY,
@ -47,23 +54,285 @@ static ColliderCylinderInit D_8098E0B0 = {
},
{ 680, 220, 120, { 0, 0, 0 } },
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Kekkai/func_8098CFD0.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Kekkai/DemoKekkai_Init.s")
static u8 sEnergyColors[] = {
/* Water prim */ 170, 255, 255, /* env */ 0, 50, 255,
/* Light prim */ 255, 255, 170, /* env */ 200, 255, 0,
/* Fire prim */ 255, 255, 170, /* env */ 200, 0, 0,
/* Shadow prim */ 255, 170, 255, /* env */ 100, 0, 200,
/* Spirit prim */ 255, 255, 170, /* env */ 255, 120, 0,
/* Forest prim */ 255, 255, 170, /* env */ 0, 200, 0,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Kekkai/DemoKekkai_Destroy.s")
s32 DemoKekkai_CheckEventFlag(s32 params) {
static s32 eventFlags[] = { 0xC3, 0xBC, 0xBF, 0xBE, 0xBD, 0xAD, 0xBB };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Kekkai/func_8098D280.s")
if ((params < KEKKAI_TOWER) || (params > KEKKAI_FOREST)) {
return true;
}
return Flags_GetEventChkInf(eventFlags[params]);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Kekkai/func_8098D4D4.s")
void DemoKekkai_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
DemoKekkai* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Kekkai/DemoKekkai_Update.s")
this->sfxFlag = 0;
this->energyAlpha = 1.0f;
Actor_SetScale(thisx, 0.1f);
thisx->colChkInfo.mass = MASS_IMMOVABLE;
Collider_InitCylinder(globalCtx, &this->collider1);
Collider_SetCylinder(globalCtx, &this->collider1, thisx, &sCylinderInit);
Collider_InitCylinder(globalCtx, &this->collider2);
Collider_SetCylinder(globalCtx, &this->collider2, thisx, &sCylinderInit);
Collider_UpdateCylinder(thisx, &this->collider1);
Collider_UpdateCylinder(thisx, &this->collider2);
this->timer = 0;
this->barrierScrollRate = 1.0f;
this->barrierScroll = 0.0f;
switch (thisx->params) {
case KEKKAI_TOWER:
this->updateFunc = DemoKekkai_TowerBarrier;
this->collider2.dim.radius = thisx->scale.x * 6100.0f;
this->collider2.dim.height = thisx->scale.y * 5000.0f;
this->collider2.dim.yShift = 300;
break;
case KEKKAI_WATER:
case KEKKAI_LIGHT:
case KEKKAI_FIRE:
case KEKKAI_SHADOW:
case KEKKAI_SPIRIT:
case KEKKAI_FOREST:
this->energyAlpha = 1.0f;
this->orbScale = 1.0f;
Actor_SetScale(thisx, 0.1f);
thisx->update = DemoKekkai_TrialBarrierIdle;
thisx->draw = DemoKekkai_DrawTrialBarrier;
this->collider1.dim.radius = thisx->scale.x * 120.0f;
this->collider1.dim.height = thisx->scale.y * 2000.0f;
this->collider1.dim.yShift = 0;
this->collider2.dim.radius = thisx->scale.x * 320.0f;
this->collider2.dim.height = thisx->scale.y * 510.0f;
this->collider2.dim.yShift = 95;
break;
}
if (DemoKekkai_CheckEventFlag(thisx->params)) {
if (thisx->params == KEKKAI_TOWER) {
globalCtx->envCtx.unk_BF = 1;
}
Actor_Kill(thisx);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Kekkai/func_8098D71C.s")
void DemoKekkai_Destroy(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
DemoKekkai* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Kekkai/func_8098D87C.s")
Collider_DestroyCylinder(globalCtx, &this->collider1);
Collider_DestroyCylinder(globalCtx, &this->collider2);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Kekkai/func_8098D9C0.s")
void DemoKekkai_SpawnParticles(DemoKekkai* this, GlobalContext* globalCtx) {
static Vec3f vel = { 0.0f, 0.0f, 0.0f };
static Vec3f accel = { 0.0f, 0.0f, 0.0f };
static Color_RGBA8 lightYellow = { 255, 255, 170, 0 };
static Color_RGBA8 darkRed = { 200, 0, 0, 0 };
Vec3f pos;
s32 i;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Kekkai/DemoKekkai_Draw.s")
for (i = 0; i < 85; i++) {
s16 roll = Rand_ZeroFloat(65535.0f);
s16 yaw = Rand_ZeroFloat(65535.0f);
vel.x = Math_SinS(yaw) * Math_CosS(roll) * Rand_ZeroFloat(8.0f);
vel.z = Math_CosS(yaw) * Math_CosS(roll) * Rand_ZeroFloat(8.0f);
vel.y = Math_SinS(roll) * Rand_ZeroFloat(3.0f);
pos.x = (vel.x * 7.0f) + this->actor.world.pos.x;
pos.y = (vel.y * 20.0f) + this->actor.world.pos.y + 120.0f;
pos.z = (vel.z * 7.0f) + this->actor.world.pos.z;
EffectSsKiraKira_SpawnFocused(globalCtx, &pos, &vel, &accel, &lightYellow, &darkRed, 3000,
(s32)Rand_ZeroFloat(40.0f) + 45);
}
}
void DemoKekkai_TowerBarrier(DemoKekkai* this, GlobalContext* globalCtx) {
if ((globalCtx->csCtx.state != 0) && (globalCtx->csCtx.npcActions[0] != NULL) &&
(globalCtx->csCtx.npcActions[0]->action != 1) && (globalCtx->csCtx.npcActions[0]->action == 2)) {
if (!(this->sfxFlag & 1)) {
func_800F3F3C(0xC);
this->sfxFlag |= 1;
}
if (this->barrierScrollRate < 7.0f) {
this->barrierScrollRate += 0.2f;
} else {
this->timer++;
if (this->timer > 100) {
Flags_SetEventChkInf(0xC3);
Actor_Kill(&this->actor);
return;
} else if (this->timer > 40) {
this->actor.scale.z = this->actor.scale.x += 0.003f;
}
}
}
if (!(this->sfxFlag & 1)) {
func_8002F974(&this->actor, NA_SE_EV_TOWER_BARRIER - SFX_FLAG);
}
}
void DemoKekkai_Update(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
DemoKekkai* this = THIS;
if (this->energyAlpha > 0.99f) {
if ((this->collider1.base.atFlags & AT_HIT) || (this->collider2.base.atFlags & AT_HIT)) {
func_8002F71C(globalCtx, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f);
}
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base);
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider2.base);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base);
}
this->updateFunc(this, globalCtx);
this->barrierScroll += this->barrierScrollRate;
if (this->barrierScroll > 65536.0f) {
this->barrierScroll -= 65536.0f;
}
}
void DemoKekkai_TrialBarrierDispel(Actor* thisx, GlobalContext* globalCtx) {
static u16 csFrames[] = { 0, 280, 280, 280, 280, 280, 280 };
s32 pad;
DemoKekkai* this = THIS;
if (globalCtx->csCtx.frames == csFrames[this->actor.params]) {
func_800F3F3C(0xA);
}
if (this->energyAlpha >= 0.05f) {
this->energyAlpha -= 0.05f;
} else {
this->energyAlpha = 0.0f;
}
if (this->timer < 40) {
this->orbScale = ((80 - this->timer) * (f32)this->timer * 0.000625f) + 1.0f;
} else if (this->timer < 50) {
this->orbScale = 2.0f;
} else if (this->timer == 50) {
Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_RING_EXPLOSION);
DemoKekkai_SpawnParticles(this, globalCtx);
} else {
this->orbScale = 0.0f;
}
if (this->orbScale != 0.0f) {
func_8002F974(&this->actor, NA_SE_EV_TOWER_ENERGY - SFX_FLAG);
}
this->timer++;
}
static CutsceneData* sSageCutscenes[] = {
NULL,
gWaterTrialSageCs,
gLightTrialSageCs,
gFireTrialSageCs,
gShadowTrialSageCs,
gSpiritTrialSageCs,
gForestTrialSageCs,
};
void DemoKekkai_TrialBarrierIdle(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
DemoKekkai* this = THIS;
if (this->collider1.base.atFlags & AT_HIT) {
func_8002F71C(globalCtx, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 5.0f);
}
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider1.base);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base);
if (this->collider2.base.acFlags & AC_HIT) {
func_80078884(NA_SE_SY_CORRECT_CHIME);
// I got it
LOG_STRING("当ったよ", "../z_demo_kekkai.c", 572);
this->actor.update = DemoKekkai_TrialBarrierDispel;
this->timer = 0;
globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(sSageCutscenes[this->actor.params]);
gSaveContext.cutsceneTrigger = 1;
}
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base);
func_8002F974(&this->actor, NA_SE_EV_TOWER_ENERGY - SFX_FLAG);
}
void DemoKekkai_DrawTrialBarrier(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
s32 frames = globalCtx->gameplayFrames & 0xFFFF;
u8 alphaIndex[102] = {
1, 1, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 1, 0, 0, 1, 2, 2,
1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1, 1, 0, 0, 0, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 1, 0, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 0, 0,
};
s32 colorIndex;
DemoKekkai* this = THIS;
u8 alphas[3];
Vtx* energyVtx = SEGMENTED_TO_VIRTUAL(gTrialBarrierEnergyVtx);
s32 i;
if (this->orbScale != 0.0f) {
if (1) {}
alphas[2] = (s32)(this->energyAlpha * 202.0f);
alphas[1] = (s32)(this->energyAlpha * 126.0f);
alphas[0] = 0;
for (i = 0; i < 102; i++) {
energyVtx[i].v.cn[3] = alphas[alphaIndex[i]];
}
colorIndex = (this->actor.params - 1) * 6;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_kekkai.c", 632);
func_80093D84(globalCtx->state.gfxCtx);
Matrix_Push();
Matrix_Translate(0.0f, 1200.0f, 0.0f, MTXMODE_APPLY);
Matrix_Scale(this->orbScale, this->orbScale, this->orbScale, MTXMODE_APPLY);
Matrix_Translate(0.0f, -1200.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_kekkai.c", 639),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(POLY_XLU_DISP++, 0x09,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 5, frames * -10, 0x20, 0x20, 1, frames * 5,
frames * -10, 0x20, 0x20));
gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierOrbDL);
Matrix_Pull();
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_kekkai.c", 656),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 50, 0, 100, 255);
gSPSegment(POLY_XLU_DISP++, 0x0A,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x20, 1, frames, frames, 0x20, 0x20));
gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierFloorDL);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, sEnergyColors[colorIndex + 0], sEnergyColors[colorIndex + 1],
sEnergyColors[colorIndex + 2], 255);
gDPSetEnvColor(POLY_XLU_DISP++, sEnergyColors[colorIndex + 3], sEnergyColors[colorIndex + 4],
sEnergyColors[colorIndex + 5], 128);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 5, frames * -10, 0x20, 0x20, 1, frames * 5,
frames * -10, 0x20, 0x40));
gSPDisplayList(POLY_XLU_DISP++, gTrialBarrierEnergyDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_kekkai.c", 696);
}
}
void DemoKekkai_DrawTowerBarrier(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
DemoKekkai* this = THIS;
s32 scroll;
scroll = (s32)this->barrierScroll & 0xFFFF;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_kekkai.c", 705);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_kekkai.c", 707),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 255, 170, 255, 255);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 2, scroll * -4, 0x20, 0x40, 1, scroll * 2,
scroll * -4, 0x20, 0x40));
gSPDisplayList(POLY_XLU_DISP++, gTowerBarrierDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_kekkai.c", 722);
}

View file

@ -6,11 +6,31 @@
struct DemoKekkai;
typedef void (*DemoKekkaiUpdateFunc)(struct DemoKekkai* this, GlobalContext* globalCtx);
typedef struct DemoKekkai {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0xB0];
/* 0x014C */ ColliderCylinder collider1;
/* 0x0198 */ ColliderCylinder collider2;
/* 0x01E4 */ f32 energyAlpha;
/* 0x01E8 */ f32 orbScale;
/* 0x01EC */ f32 barrierScroll;
/* 0x01F0 */ f32 barrierScrollRate;
/* 0x01F4 */ u16 timer;
/* 0x01F6 */ u16 sfxFlag;
/* 0x01F8 */ DemoKekkaiUpdateFunc updateFunc;
} DemoKekkai; // size = 0x01FC
extern const ActorInit Demo_Kekkai_InitVars;
typedef enum {
/* 0 */ KEKKAI_TOWER,
/* 1 */ KEKKAI_WATER,
/* 2 */ KEKKAI_LIGHT,
/* 3 */ KEKKAI_FIRE,
/* 4 */ KEKKAI_SHADOW,
/* 5 */ KEKKAI_SPIRIT,
/* 6 */ KEKKAI_FOREST
} DemoKekkaiType;
#endif

View file

@ -5,6 +5,7 @@
*/
#include "z_door_shutter.h"
#include "objects/object_demo_kekkai/object_demo_kekkai.h"
#include "overlays/actors/ovl_Boss_Goma/z_boss_goma.h"
#include "objects/gameplay_keep/gameplay_keep.h"
@ -99,7 +100,7 @@ static ShutterInfo D_80998134[] = {
{ 0x06003890, gDungeonDoorDL, 130, 12, 20, 15 },
{ 0x06001D10, gDungeonDoorDL, 130, 12, 20, 15 },
{ 0x060010D0, gDungeonDoorDL, 130, 12, 20, 15 },
{ 0x060020D0, gDungeonDoorDL, 130, 12, 20, 15 },
{ gGanonsCastleDoorDL, gDungeonDoorDL, 130, 12, 20, 15 },
{ 0x060000C0, gDungeonDoorDL, 130, 12, 20, 15 },
};

View file

@ -5,6 +5,7 @@
*/
#include "z_object_kankyo.h"
#include "objects/object_demo_kekkai/object_demo_kekkai.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#define FLAGS 0x02000030
@ -17,7 +18,6 @@ void ObjectKankyo_Update(Actor* thisx, GlobalContext* globalCtx);
void ObjectKankyo_Draw(Actor* thisx, GlobalContext* globalCtx);
extern UNK_TYPE D_01000000;
extern UNK_TYPE D_06005FF0;
extern UNK_TYPE D_06009620;
/*