Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 35 additions & 16 deletions src/overlays/actors/hm_pack/ovl_En_Wiz/z_en_wiz.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,28 @@

#include "z_en_wiz.h"
#include "overlays/actors/hm_pack/ovl_En_Wiz/z_en_wiz_fire.h"
#include "assets_hm_pack/objects/object_wiz/object_wiz.h"

#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4)
#include "assets/objects/hm_pack/object_wiz/object_wiz.h"

#include "libc64/qrand.h"
#include "attributes.h"
#include "gfx.h"
#include "gfx_setupdl.h"
#include "ichain.h"
#include "rand.h"
#include "segmented_address.h"
#include "sfx.h"
#include "sys_math.h"
#include "sys_matrix.h"
#include "z_en_item00.h"
#include "z_lib.h"
#include "z64draw.h"
#include "z64effect.h"
#include "z64item.h"
#include "z64play.h"
#include "z64player.h"
#include "z64save.h"

#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED)

typedef enum {
/* 0 */ CASTTYPE_FIRE,
Expand All @@ -23,8 +42,8 @@ typedef enum {
/* 3 */ CASTTYPE_ICE = 4
} CastType;

#define TARGET_ON (this->actor.flags |= ACTOR_FLAG_0)
#define TARGET_OFF (this->actor.flags &= ~ACTOR_FLAG_0)
#define TARGET_ON (this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED)
#define TARGET_OFF (this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED)

// uncomment this to only run DoNothing
// #define TEST
Expand Down Expand Up @@ -59,7 +78,7 @@ void EnWiz_Teleport(EnWiz* this, PlayState* play);

void EnWiz_DoNothing(EnWiz* this, PlayState* play);

ActorInit En_Wiz_InitVars = {
ActorProfile En_Wiz_Profile = {
ACTOR_EN_WIZ,
ACTORCAT_ENEMY,
FLAGS,
Expand All @@ -73,19 +92,19 @@ ActorInit En_Wiz_InitVars = {

static ColliderCylinderInit sCylinderInit = {
{
COLTYPE_HIT0,
COL_MATERIAL_HIT0,
AT_NONE,
AC_ON | AC_TYPE_PLAYER,
OC1_ON | OC1_TYPE_ALL,
OC2_TYPE_2,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK0,
ELEM_MATERIAL_UNK0,
{ 0xFFCFFFFF, 0x00, 0x00 },
{ 0xFFCFFFFF, 0x00, 0x00 },
TOUCH_NONE,
BUMP_ON,
AT_NONE,
ACELEM_ON,
OCELEM_ON,
},
{ 55, 70, 0, { 0 } },
Expand Down Expand Up @@ -156,10 +175,10 @@ static EnemySpawnTable sEnemySpawnTable[] = {
};

static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 350, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_CONTINUE),
ICHAIN_U8(targetMode, 2, ICHAIN_STOP),
ICHAIN_F32(cullingVolumeDistance, 2000, ICHAIN_CONTINUE),
ICHAIN_F32(cullingVolumeScale, 350, ICHAIN_CONTINUE),
ICHAIN_F32(cullingVolumeDownward, 1000, ICHAIN_CONTINUE),
ICHAIN_U8(attentionPriority, 2, ICHAIN_STOP),
};

void EnWiz_InitCollision(Actor* thisx, PlayState* play) {
Expand Down Expand Up @@ -600,7 +619,7 @@ void EnWiz_SetupFrozen(Actor* thisx) {
}
Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE);

this->collider.base.colType = COLTYPE_HARD;
this->collider.elem.elemMaterial = COL_MATERIAL_HARD;
this->collider.base.acFlags |= AC_HARD;

this->actionFunc = EnWiz_Frozen;
Expand All @@ -617,7 +636,7 @@ void EnWiz_Frozen(EnWiz* this, PlayState* play) {
this->actionFunc = EnWiz_DoNothing;
this->timer = 40;
#else
this->collider.base.colType = COLTYPE_HIT0;
this->collider.elem.elemMaterial = COL_MATERIAL_HIT0;
this->collider.base.acFlags &= ~AC_HARD;
EnWiz_SetupDisappear(this);
#endif
Expand Down
3 changes: 2 additions & 1 deletion src/overlays/actors/hm_pack/ovl_En_Wiz/z_en_wiz.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

#include "ultra64.h"
#include "global.h"
#include "assets_hm_pack/objects/object_wiz/object_wiz.h"
#include "z64actor.h"
#include "assets/objects/hm_pack/object_wiz/object_wiz.h"

struct EnWiz;

Expand Down
74 changes: 46 additions & 28 deletions src/overlays/actors/hm_pack/ovl_En_Wiz/z_en_wiz_fire.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,27 @@

#include "z_en_wiz_fire.h"
#include "overlays/actors/hm_pack/ovl_En_Wiz/z_en_wiz.h"
#include "assets_hm_pack/objects/object_wiz/object_wiz.h"

#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_27)
#include "assets/objects/hm_pack/object_wiz/object_wiz.h"

#include "libc64/qrand.h"
#include "attributes.h"
#include "gfx.h"
#include "gfx_setupdl.h"
#include "ichain.h"
#include "rand.h"
#include "segmented_address.h"
#include "sfx.h"
#include "sys_matrix.h"
#include "z_en_item00.h"
#include "z_lib.h"
#include "z64draw.h"
#include "z64effect.h"
#include "z64item.h"
#include "z64play.h"
#include "z64player.h"
#include "z64save.h"

#define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_HOSTILE)

#define THIS ((EnWizFire*)thisx)

Expand Down Expand Up @@ -39,7 +57,7 @@ typedef enum {

static s32 sPoolHitByIceArrow = false;

ActorInit En_Wiz_Fire_InitVars = {
ActorProfile En_Wiz_Fire_Profile = {
ACTOR_EN_WIZ_FIRE,
ACTORCAT_ENEMY,
FLAGS,
Expand All @@ -53,19 +71,19 @@ ActorInit En_Wiz_Fire_InitVars = {

static ColliderCylinderInit sCylinderInit = {
{
COLTYPE_NONE,
COL_MATERIAL_NONE,
AT_ON | AT_TYPE_ENEMY,
AC_ON | AC_TYPE_PLAYER,
OC1_NONE,
OC2_TYPE_1,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK0,
ELEM_MATERIAL_UNK0,
{ 0xF7CFFFFF, 0x09, 0x10 },
{ 0x01001202, 0x00, 0x00 },
TOUCH_ON | TOUCH_SFX_NORMAL,
BUMP_ON,
ATELEM_ON | ATELEM_SFX_NORMAL,
ACELEM_ON,
OCELEM_NONE,
},
{ 0, 0, 0, { 0, 0, 0 } },
Expand All @@ -78,26 +96,26 @@ void EnWizFire_Init(Actor* thisx, PlayState* play) {
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);

this->type = EN_WIZ_FIRE_GET_TYPE(&this->actor);
this->actor.targetMode = 3;
this->actor.attentionPriority = 3;
this->wallCheckTimer = 10;
this->alpha = 255.0f;

if (!Player_HasMirrorShieldEquipped(play)) {
this->collider.info.toucher.dmgFlags = 0x20000000;
this->collider.elem.atDmgInfo.dmgFlags = 0x20000000;
}

switch (this->type) {
case EN_WIZ_FIRE_TYPE_ICE_MAGIC_PROJECTILE:
this->isIceType = true;
this->collider.info.toucher.damage = 8;
this->collider.info.toucher.effect = 2;
this->collider.info.bumper.dmgFlags = (0x1000000 | 0x800 | 0x200 | 0x2);
this->collider.elem.atDmgInfo.damage = 8;
this->collider.elem.atDmgInfo.effect = 2;
this->collider.elem.atDmgInfo.dmgFlags = (0x1000000 | 0x800 | 0x200 | 0x2);
this->type = EN_WIZ_FIRE_TYPE_MAGIC_PROJECTILE;
// fallthrough
case EN_WIZ_FIRE_TYPE_MAGIC_PROJECTILE:
if (this->type == EN_WIZ_FIRE_TYPE_ICE_MAGIC_PROJECTILE) {
this->type = EN_WIZ_FIRE_TYPE_MAGIC_PROJECTILE;
this->collider.info.toucher.damage = 8;
this->collider.elem.atDmgInfo.damage = 8;
}
// fallthrough
case EN_WIZ_FIRE_TYPE_ARCING_MAGIC_PROJECTILE:
Expand All @@ -109,7 +127,7 @@ void EnWizFire_Init(Actor* thisx, PlayState* play) {
this->actor.draw = EnWizFire_DrawSmallFlame;
this->smallFlameScroll = Rand_S16Offset(0, 10000);
this->action = EN_WIZ_FIRE_ACTION_SMALL_FLAME;
this->collider.info.toucher.damage = 2;
this->collider.elem.atDmgInfo.damage = 2;
this->actionFunc = EnWiz_SetupSmallFlame;
break;

Expand Down Expand Up @@ -273,7 +291,7 @@ void EnWiz_MoveMagicProjectile(EnWizFire* this, PlayState* play) {
if ((this->type != EN_WIZ_FIRE_TYPE_REFLECTED_MAGIC_PROJECTILE) && (this->timer != 0)) {
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
if (this->collider.info.acHitInfo->toucher.dmgFlags == 0x1000) {
if (this->collider.elem.atDmgInfo.dmgFlags == 0x1000) {
this->timer = 0;
this->hitByIceArrow = true;
SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_ICE_MELT);
Expand All @@ -284,8 +302,8 @@ void EnWiz_MoveMagicProjectile(EnWizFire* this, PlayState* play) {
Actor_PlaySfx(&this->actor, NA_SE_IT_SHIELD_REFLECT_MG);
this->collider.base.atFlags &= ~(AT_TYPE_ENEMY | AT_BOUNCED | AT_HIT);
this->collider.base.atFlags |= AT_TYPE_PLAYER;
this->collider.info.toucher.dmgFlags = 0x20;
this->collider.info.toucher.damage = 2;
this->collider.elem.atDmgInfo.dmgFlags = 0x20;
this->collider.elem.atDmgInfo.damage = 2;
this->timer = 100;
this->type = EN_WIZ_FIRE_TYPE_REFLECTED_MAGIC_PROJECTILE;
this->actor.velocity.x *= -1.0f;
Expand Down Expand Up @@ -332,7 +350,7 @@ void EnWiz_SmallFlame(EnWizFire* this, PlayState* play) {
this->timer -= 10;
}

if (this->collider.info.acHitInfo->toucher.dmgFlags == 0x1000) {
if (this->collider.elem.atDmgInfo.dmgFlags == 0x1000) {
this->timer = 0;
this->hitByIceArrow = true;
SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EV_ICE_MELT);
Expand Down Expand Up @@ -399,7 +417,7 @@ void EnWiz_Pool(EnWizFire* this, PlayState* play) {

if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
if (!sPoolHitByIceArrow && (this->collider.info.acHitInfo->toucher.dmgFlags == 0x1000)) {
if (!sPoolHitByIceArrow && (this->collider.elem.atDmgInfo.dmgFlags == 0x1000)) {
sPoolHitByIceArrow = true;
this->hitByIceArrow = true;
this->poolTimer = 0;
Expand Down Expand Up @@ -587,7 +605,7 @@ void EnWizFire_DrawIcePool(EnWizFire* this, PlayState* play) {
Matrix_Translate(this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z, MTXMODE_NEW);
Matrix_Scale(this->poolScale, this->poolScale, this->poolScale, MTXMODE_APPLY);

gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_wiz_fire.c", __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_XLU_DISP++, play->state.gfxCtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s8)this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 40, 30, 80);
Expand All @@ -600,7 +618,7 @@ void EnWizFire_DrawIcePool(EnWizFire* this, PlayState* play) {

Matrix_RotateY(BINANG_TO_RAD(0), MTXMODE_APPLY);

gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_wiz_fire.c", __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_XLU_DISP++, play->state.gfxCtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gWizrobeIcePoolShineDL);
}

Expand All @@ -625,7 +643,7 @@ void EnWizFire_DrawFirePoolAndFlame(EnWizFire* this, PlayState* play2) {
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, -play->state.frames % 128, 0, 0x20, 0x20, 1,
(play->state.frames * 2) % 128, 0, 0x20, 0x20));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_wiz_fire.c", __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_XLU_DISP++, play->state.gfxCtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 40, 0, (s8)this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 245, 255, 128);
Expand All @@ -647,7 +665,7 @@ void EnWizFire_DrawFirePoolAndFlame(EnWizFire* this, PlayState* play2) {

Matrix_Scale(this->fireSmokeScale, this->fireSmokeScale, this->fireSmokeScale, MTXMODE_APPLY);

gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_wiz_fire.c", __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_XLU_DISP++, play->state.gfxCtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gWizrobeFireSmokeDL);

Matrix_Pop();
Expand All @@ -664,7 +682,7 @@ void EnWizFire_DrawFirePoolAndFlame(EnWizFire* this, PlayState* play2) {

Matrix_Scale(this->bigFlameScale, this->bigFlameScale, this->bigFlameScale, MTXMODE_APPLY);

gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_wiz_fire.c", __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_XLU_DISP++, play->state.gfxCtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gWizrobeBigFlameDL);
}

Expand Down Expand Up @@ -700,7 +718,7 @@ void EnWizFire_Draw(Actor* thisx, PlayState* play) {
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_RotateZ(BINANG_TO_RAD(this->actor.world.rot.z), MTXMODE_APPLY);

gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_wiz_fire.c", __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_XLU_DISP++, play->state.gfxCtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gWizrobeMagicProjectileDL);
}
}
Expand Down Expand Up @@ -735,7 +753,7 @@ void EnWizFire_DrawSmallFlame(Actor* thisx, PlayState* play) {

Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);

gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_wiz_fire.c", __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_XLU_DISP++, play->state.gfxCtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gWizrobeSmallFlameDL);

CLOSE_DISPS(play->state.gfxCtx, "../z_en_wiz_fire.c", __LINE__);
Expand Down Expand Up @@ -820,7 +838,7 @@ void EnWizFire_DrawEffects(EnWizFire* this, PlayState* play) {
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY);

gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_wiz_fire.c", __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_XLU_DISP++, gfxCtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2);
gSPClearGeometryMode(POLY_XLU_DISP++, G_CULL_BACK | G_FOG);
gSPDisplayList(POLY_XLU_DISP++, gWizrobeIceSmokeModelDL);
Expand Down
1 change: 1 addition & 0 deletions src/overlays/actors/hm_pack/ovl_En_Wiz/z_en_wiz_fire.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "ultra64.h"
#include "global.h"
#include "z64actor.h"

typedef enum {
/* 0 */ EN_WIZ_FIRE_TYPE_MAGIC_PROJECTILE,
Expand Down
Loading