2023-11-16 05:14:33 +03:00
|
|
|
#include "global.h"
|
2024-03-29 22:09:14 +03:00
|
|
|
#include "assets/ast_corneria.h"
|
2024-03-15 00:31:03 +03:00
|
|
|
#include "assets/ast_sector_x.h"
|
2024-03-27 07:07:41 +03:00
|
|
|
#include "assets/ast_sector_y.h"
|
|
|
|
#include "assets/ast_sector_z.h"
|
2024-04-01 19:54:47 +03:00
|
|
|
#include "assets/ast_venom_1.h"
|
2024-04-02 03:08:01 +03:00
|
|
|
#include "assets/ast_venom_2.h"
|
|
|
|
#include "assets/ast_katina.h"
|
|
|
|
#include "assets/ast_fortuna.h"
|
2024-03-15 00:31:03 +03:00
|
|
|
#include "assets/ast_aquas.h"
|
2024-04-01 04:04:45 +03:00
|
|
|
#include "assets/ast_bolse.h"
|
|
|
|
#include "assets/ast_meteo.h"
|
2024-04-02 03:08:01 +03:00
|
|
|
#include "assets/ast_solar.h"
|
2024-03-29 20:40:09 +03:00
|
|
|
#include "assets/ast_macbeth.h"
|
2024-03-28 17:13:34 +03:00
|
|
|
#include "assets/ast_titania.h"
|
2024-03-15 00:31:03 +03:00
|
|
|
#include "assets/ast_andross.h"
|
2024-03-17 07:06:28 +03:00
|
|
|
#include "assets/ast_area_6.h"
|
|
|
|
#include "assets/ast_training.h"
|
2024-03-30 02:19:29 +03:00
|
|
|
#include "assets/ast_versus.h"
|
2024-04-01 21:17:46 +03:00
|
|
|
#include "assets/ast_zoness.h"
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
s32 D_enmy_Timer_80161670[4];
|
2024-04-09 01:25:56 +03:00
|
|
|
s32 gLastPathChange;
|
|
|
|
u8 gMissedZoSearchlight;
|
2023-12-09 21:53:24 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
ObjectInit* gLevelObjectInits[] = {
|
2024-07-06 15:47:49 +03:00
|
|
|
aCoOnRailsLevelObjects, D_ME_6026CC4, D_SX_602A164, D_A6_6023F64,
|
|
|
|
D_A6_60287A4, D_SY_602E4F4, D_VE1_6007E74, D_SO_601F234,
|
|
|
|
D_ZO_6026714, D_ANDROSS_C035154, D_TR_6006AA4, D_MA_6031000,
|
|
|
|
D_TI_6006C60, D_AQ_602E5C8, D_FO_600EAD4, NULL,
|
|
|
|
D_KA_6011044, D_BO_600FF74, D_SZ_6006EB4, D_VE2_6014D94,
|
|
|
|
D_versus_302DE3C,
|
2023-11-27 00:27:05 +03:00
|
|
|
};
|
2024-04-03 02:20:08 +03:00
|
|
|
static s32 D_enmy_800CFDF4[] = {
|
2024-07-06 15:47:49 +03:00
|
|
|
/* 0 */ OBJ_SCENERY_CO_STONE_ARCH,
|
2024-04-05 23:11:36 +03:00
|
|
|
/* 1 */ OBJ_ITEM_SILVER_RING,
|
|
|
|
/* 2 */ OBJ_ITEM_SILVER_RING,
|
|
|
|
/* 3 */ OBJ_ITEM_SILVER_RING,
|
|
|
|
/* 4 */ OBJ_ITEM_SILVER_RING,
|
|
|
|
/* 5 */ OBJ_ITEM_BOMB,
|
|
|
|
/* 6 */ OBJ_ITEM_BOMB,
|
|
|
|
/* 7 */ OBJ_ITEM_BOMB,
|
|
|
|
/* 8 */ OBJ_ITEM_BOMB,
|
|
|
|
/* 9 */ OBJ_ITEM_LASERS,
|
|
|
|
/* 10 */ OBJ_ITEM_LASERS,
|
|
|
|
/* 11 */ OBJ_ITEM_LASERS,
|
|
|
|
/* 12 */ OBJ_ITEM_LASERS,
|
|
|
|
/* 13 */ OBJ_ITEM_1UP,
|
|
|
|
/* 14 */ OBJ_ITEM_GOLD_RING,
|
|
|
|
/* 15 */ OBJ_ITEM_GOLD_RING,
|
|
|
|
/* 16 */ OBJ_ITEM_GOLD_RING,
|
|
|
|
/* 17 */ OBJ_ITEM_GOLD_RING,
|
|
|
|
/* 18 */ OBJ_ITEM_GOLD_RING,
|
|
|
|
/* 19 */ OBJ_ITEM_LASERS,
|
|
|
|
/* 20 */ OBJ_ITEM_BOMB,
|
|
|
|
/* 21 */ OBJ_ITEM_SILVER_RING,
|
|
|
|
/* 22 */ OBJ_ITEM_SILVER_RING,
|
|
|
|
/* 23 */ OBJ_ITEM_WING_REPAIR,
|
2024-07-06 15:47:49 +03:00
|
|
|
/* 24 */ OBJ_SCENERY_CO_STONE_ARCH,
|
2024-04-05 23:11:36 +03:00
|
|
|
/* 25 */ OBJ_ITEM_SILVER_STAR,
|
2023-11-27 00:27:05 +03:00
|
|
|
};
|
2024-04-03 02:20:08 +03:00
|
|
|
static f32 D_enmy_800CFE5C[] = {
|
2023-11-27 00:27:05 +03:00
|
|
|
0.0f, 1.0f, 0.5f, 0.33f, 0.25f, 1.0f, 0.5f, 0.33f, 0.25f, 1.0f, 0.5f, 0.33f, 0.25f,
|
|
|
|
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 0.1f, 1.0f, 1.0f, 1.0f,
|
|
|
|
};
|
2024-04-03 02:20:08 +03:00
|
|
|
static Vec3f D_enmy_800CFEC4[] = {
|
2023-11-27 00:27:05 +03:00
|
|
|
{ 0.0f, 0.0f, 50.0f }, { -50.0f, 0.0f, 0.0f }, { 50.0f, 0.0f, 0.0f },
|
|
|
|
{ 0.0f, 50.0f, 0.0f }, { 0.0f, 0.0f, -50.0f }, { 0.0f, -50.0f, 0.0f },
|
|
|
|
};
|
2024-04-03 02:20:08 +03:00
|
|
|
static Vec3f D_enmy_800CFF0C[] = {
|
2023-11-27 00:27:05 +03:00
|
|
|
{ 0.0f, 0.0f, 0.0f }, { 0.0f, -90.0f, 0.0f }, { 0.0f, 90.0f, 0.0f },
|
|
|
|
{ -90.0f, 0.0f, 0.0f }, { 0.0f, 180.0f, 0.0f }, { 90.0f, 0.0f, 0.0f },
|
|
|
|
};
|
2024-04-26 01:01:25 +03:00
|
|
|
u32 gWarpRingSfx[] = {
|
2024-05-06 04:07:32 +03:00
|
|
|
NA_SE_WARP_RING_1, NA_SE_WARP_RING_2, NA_SE_WARP_RING_3, NA_SE_WARP_RING_4, NA_SE_WARP_RING_5,
|
|
|
|
NA_SE_WARP_RING_6, NA_SE_WARP_RING_7, NA_SE_WARP_RING_7, NA_SE_WARP_RING_7,
|
2023-11-27 00:27:05 +03:00
|
|
|
};
|
|
|
|
|
2024-05-07 01:45:24 +03:00
|
|
|
void Object_PlayerSfx(f32* pos, u32 sfxId, s32 playerNum) {
|
2024-03-27 07:07:41 +03:00
|
|
|
PRINTF("CHIME SET \n");
|
|
|
|
PRINTF("BOMB SET 1\n");
|
|
|
|
PRINTF("BOMB SET 2\n");
|
|
|
|
PRINTF("center_X %f\n");
|
|
|
|
PRINTF("Enm->obj.pos.x %f\n");
|
2023-12-20 22:32:50 +03:00
|
|
|
if (!gVersusMode) {
|
2024-03-01 21:57:44 +03:00
|
|
|
AUDIO_PLAY_SFX(sfxId, gDefaultSfxSource, 4);
|
2023-11-16 05:14:33 +03:00
|
|
|
} else {
|
2024-05-07 01:45:24 +03:00
|
|
|
AUDIO_PLAY_SFX(sfxId, pos, playerNum);
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-21 23:42:06 +03:00
|
|
|
void Object_Kill(Object* obj, f32* sfxSrc) {
|
|
|
|
obj->status = OBJ_FREE;
|
2024-03-01 21:57:44 +03:00
|
|
|
Audio_KillSfxBySource(sfxSrc);
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
bool func_enmy_80060FE4(Vec3f* arg0, f32 arg1) {
|
2024-07-06 15:47:49 +03:00
|
|
|
Vec3f src;
|
|
|
|
Vec3f dest;
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
if ((gLevelMode != LEVELMODE_ALL_RANGE) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO)) {
|
2023-12-04 21:50:52 +03:00
|
|
|
return true;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
Matrix_RotateY(gCalcMatrix, gPlayer[gPlayerNum].camYaw, MTXF_NEW);
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
src.x = arg0->x - gPlayer[gPlayerNum].cam.eye.x;
|
|
|
|
src.y = 0.0f;
|
|
|
|
src.z = arg0->z - gPlayer[gPlayerNum].cam.eye.z;
|
|
|
|
|
|
|
|
Matrix_MultVec3fNoTranslate(gCalcMatrix, &src, &dest);
|
|
|
|
|
|
|
|
if ((dest.z < 1000.0f) && (arg1 < dest.z) && (fabsf(dest.x) < (fabsf(dest.z * 0.5f) + 2000.0f))) {
|
2023-12-04 21:50:52 +03:00
|
|
|
return true;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2023-12-04 21:50:52 +03:00
|
|
|
return false;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
// Unused
|
2024-04-03 02:20:08 +03:00
|
|
|
bool func_enmy_80061148(Vec3f* arg0, f32 arg1) {
|
2024-07-06 15:47:49 +03:00
|
|
|
Vec3f src;
|
|
|
|
Vec3f dest;
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2023-12-24 22:28:35 +03:00
|
|
|
if (gLevelMode != LEVELMODE_ALL_RANGE) {
|
2023-12-04 21:50:52 +03:00
|
|
|
return true;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) {
|
2024-04-03 02:20:08 +03:00
|
|
|
return func_enmy_80060FE4(arg0, arg1);
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
Matrix_RotateY(gCalcMatrix, gPlayer[gPlayerNum].camYaw, MTXF_NEW);
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
src.x = arg0->x - gPlayer[gPlayerNum].cam.eye.x;
|
|
|
|
src.y = 0.0f;
|
|
|
|
src.z = arg0->z - gPlayer[gPlayerNum].cam.eye.z;
|
|
|
|
|
|
|
|
Matrix_MultVec3fNoTranslate(gCalcMatrix, &src, &dest);
|
|
|
|
|
|
|
|
if ((dest.z < 0.0f) && (arg1 < dest.z) && (fabsf(dest.x) < (fabsf(dest.z * 0.5f) + 500.0f))) {
|
2023-12-04 21:50:52 +03:00
|
|
|
return true;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2023-12-04 21:50:52 +03:00
|
|
|
return false;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
|
2023-12-20 22:32:50 +03:00
|
|
|
void Object_SetInfo(ObjectInfo* info, u32 objId) {
|
2024-05-05 00:24:24 +03:00
|
|
|
*info = gObjectInfo[objId];
|
|
|
|
info->hitbox = SEGMENTED_TO_VIRTUAL(gObjectInfo[objId].hitbox);
|
2024-08-15 07:02:52 +03:00
|
|
|
if (gLevelMode == LEVELMODE_TURRET) {
|
2024-05-02 23:46:51 +03:00
|
|
|
info->cullDistance += 200.0f;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Scenery_Initialize(Scenery* this) {
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
2024-07-06 15:47:49 +03:00
|
|
|
u8* ptr = (u8*) this;
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-04-23 05:51:20 +03:00
|
|
|
for (i = 0; i < sizeof(Scenery); i++, ptr++) {
|
2023-12-20 22:32:50 +03:00
|
|
|
*ptr = 0;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Sprite_Initialize(Sprite* this) {
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
2024-07-06 15:47:49 +03:00
|
|
|
u8* ptr = (u8*) this;
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
for (i = 0; i < sizeof(Sprite); i++, ptr++) {
|
2023-12-20 22:32:50 +03:00
|
|
|
*ptr = 0;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Actor_Initialize(Actor* this) {
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
2024-07-06 15:47:49 +03:00
|
|
|
u8* ptr = (u8*) this;
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-01-14 01:45:37 +03:00
|
|
|
for (i = 0; i < sizeof(Actor); i++, ptr++) {
|
2023-12-20 22:32:50 +03:00
|
|
|
*ptr = 0;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
this->scale = 1.0f;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Boss_Initialize(Boss* this) {
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
2024-07-06 15:47:49 +03:00
|
|
|
u8* ptr = (u8*) this;
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-01-07 01:39:23 +03:00
|
|
|
for (i = 0; i < sizeof(Boss); i++, ptr++) {
|
2023-12-20 22:32:50 +03:00
|
|
|
*ptr = 0;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
this->scale = 1.0f;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Item_Initialize(Item* this) {
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
2024-07-06 15:47:49 +03:00
|
|
|
u8* ptr = (u8*) this;
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2023-12-20 22:32:50 +03:00
|
|
|
for (i = 0; i < sizeof(Item); i++, ptr++) {
|
|
|
|
*ptr = 0;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Effect_Initialize(Effect* this) {
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
2024-07-06 15:47:49 +03:00
|
|
|
u8* ptr = (u8*) this;
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-01-13 16:43:04 +03:00
|
|
|
for (i = 0; i < sizeof(Effect); i++, ptr++) {
|
2023-12-20 22:32:50 +03:00
|
|
|
*ptr = 0;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
this->scale2 = 1.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scenery_Load(Scenery* this, ObjectInit* objInit) {
|
|
|
|
Scenery_Initialize(this);
|
|
|
|
this->obj.status = OBJ_INIT;
|
|
|
|
this->obj.pos.z = -objInit->zPos1;
|
|
|
|
this->obj.pos.z += -3000.0f + objInit->zPos2;
|
|
|
|
this->obj.pos.x = objInit->xPos;
|
|
|
|
this->obj.pos.y = objInit->yPos;
|
|
|
|
this->obj.rot.x = objInit->rot.x;
|
|
|
|
this->obj.rot.y = objInit->rot.y;
|
|
|
|
this->obj.rot.z = objInit->rot.z;
|
|
|
|
this->obj.id = objInit->id;
|
|
|
|
Object_SetInfo(&this->info, this->obj.id);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Sprite_Load(Sprite* this, ObjectInit* objInit) {
|
|
|
|
Sprite_Initialize(this);
|
|
|
|
this->obj.status = OBJ_INIT;
|
|
|
|
this->obj.pos.z = -objInit->zPos1;
|
|
|
|
this->obj.pos.z += -3000.0f + objInit->zPos2;
|
|
|
|
this->obj.pos.x = objInit->xPos;
|
|
|
|
this->obj.pos.y = objInit->yPos;
|
|
|
|
this->obj.rot.y = objInit->rot.y;
|
|
|
|
this->obj.rot.x = objInit->rot.x;
|
|
|
|
this->obj.rot.z = objInit->rot.z;
|
|
|
|
this->obj.id = objInit->id;
|
|
|
|
Object_SetInfo(&this->info, this->obj.id);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Actor_Load(Actor* this, ObjectInit* objInit) {
|
|
|
|
Actor_Initialize(this);
|
|
|
|
this->obj.status = OBJ_INIT;
|
|
|
|
this->obj.pos.z = -objInit->zPos1;
|
|
|
|
this->obj.pos.z += -3000.0f + objInit->zPos2;
|
|
|
|
this->obj.pos.x = objInit->xPos;
|
|
|
|
this->obj.pos.y = objInit->yPos;
|
|
|
|
this->obj.rot.y = objInit->rot.y;
|
|
|
|
this->obj.rot.x = objInit->rot.x;
|
|
|
|
this->obj.rot.z = objInit->rot.z;
|
|
|
|
this->obj.id = objInit->id;
|
|
|
|
Object_SetInfo(&this->info, this->obj.id);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Boss_Load(Boss* this, ObjectInit* objInit) {
|
|
|
|
Boss_Initialize(this);
|
|
|
|
this->obj.status = OBJ_INIT;
|
|
|
|
this->obj.pos.z = -objInit->zPos1;
|
|
|
|
this->obj.pos.z += -3000.0f + objInit->zPos2;
|
|
|
|
this->obj.pos.x = objInit->xPos;
|
|
|
|
this->obj.pos.y = objInit->yPos;
|
|
|
|
this->obj.rot.y = objInit->rot.y;
|
|
|
|
this->obj.rot.x = objInit->rot.x;
|
|
|
|
this->obj.rot.z = objInit->rot.z;
|
|
|
|
this->obj.id = objInit->id;
|
|
|
|
Object_SetInfo(&this->info, this->obj.id);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Item_Load(Item* this, ObjectInit* objInit) {
|
|
|
|
Item_Initialize(this);
|
|
|
|
this->obj.status = OBJ_INIT;
|
|
|
|
this->obj.pos.z = -objInit->zPos1;
|
|
|
|
this->obj.pos.z += -3000.0f + objInit->zPos2;
|
|
|
|
this->obj.pos.x = objInit->xPos;
|
|
|
|
this->obj.pos.y = objInit->yPos;
|
|
|
|
this->obj.rot.y = objInit->rot.y;
|
|
|
|
this->obj.rot.x = objInit->rot.x;
|
|
|
|
this->obj.rot.z = objInit->rot.z;
|
|
|
|
this->obj.id = objInit->id;
|
|
|
|
this->width = 1.0f;
|
|
|
|
Object_SetInfo(&this->info, this->obj.id);
|
|
|
|
}
|
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
void Effect_Effect346_Setup(Effect346* this, f32 xPos, f32 yPos, f32 zPos) {
|
2024-07-06 15:47:49 +03:00
|
|
|
Effect_Initialize(this);
|
|
|
|
this->obj.status = OBJ_INIT;
|
|
|
|
this->obj.id = OBJ_EFFECT_346;
|
|
|
|
this->timer_50 = 50;
|
|
|
|
this->scale2 = 0.2f;
|
|
|
|
|
2023-12-14 17:41:43 +03:00
|
|
|
if (gCurrentLevel == LEVEL_AQUAS) {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->timer_50 = 200;
|
|
|
|
this->scale2 = 0.3f;
|
|
|
|
this->scale1 = RAND_FLOAT(255.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
this->obj.pos.x = xPos;
|
|
|
|
this->obj.pos.y = yPos;
|
|
|
|
this->obj.pos.z = zPos;
|
|
|
|
this->obj.rot.z = RAND_FLOAT(360.0f);
|
|
|
|
|
|
|
|
Object_SetInfo(&this->info, this->obj.id);
|
|
|
|
|
2023-12-24 22:28:35 +03:00
|
|
|
if (gLevelType == LEVELTYPE_PLANET) {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->info.cullDistance = 100.0f;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
void func_enmy_80061A4C(void) {
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
2023-12-19 17:54:50 +03:00
|
|
|
f32 x;
|
|
|
|
f32 y;
|
|
|
|
f32 z;
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-01-13 16:43:04 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gEffects); i++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gEffects[i].obj.status == OBJ_FREE) {
|
2024-01-29 00:27:23 +03:00
|
|
|
x = gPlayer[0].pos.x + RAND_FLOAT_CENTERED(400.0f) + (5.0f * gPlayer[0].vel.x);
|
|
|
|
y = gPlayer[0].pos.y + RAND_FLOAT_CENTERED(400.0f) + (5.0f * gPlayer[0].vel.y);
|
2024-05-02 23:46:51 +03:00
|
|
|
z = -gPathProgress - 500.0f;
|
|
|
|
if (gPathVelZ < 0.0f) {
|
|
|
|
z = -gPathProgress + 500.0f;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
Effect_Effect346_Setup(&gEffects[i], x, y, z);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
// For Aquas
|
2024-04-03 02:20:08 +03:00
|
|
|
void func_enmy_80061B68(void) {
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
2023-12-19 17:54:50 +03:00
|
|
|
f32 x;
|
|
|
|
f32 y;
|
|
|
|
f32 z;
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-01-13 16:43:04 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gEffects); i++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gEffects[i].obj.status == OBJ_FREE) {
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-01-29 00:27:23 +03:00
|
|
|
x = gPlayer[0].pos.x + RAND_FLOAT_CENTERED(2000.0f) + (5.0f * gPlayer[0].vel.x);
|
2023-12-19 17:54:50 +03:00
|
|
|
y = 0;
|
2024-04-23 05:51:20 +03:00
|
|
|
while (y <= gGroundHeight) {
|
2024-01-29 00:27:23 +03:00
|
|
|
y = gPlayer[0].pos.y + RAND_FLOAT_CENTERED(2000.0f) + (5.0f * gPlayer[0].vel.y);
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-05-02 23:46:51 +03:00
|
|
|
z = -gPathProgress - 3000.0f;
|
|
|
|
if (gPathVelZ < 0.0f) {
|
|
|
|
z = -gPathProgress + 1000.0f;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
Effect_Effect346_Setup(&gEffects[i], x, y, z);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
// Unused
|
2024-04-03 02:20:08 +03:00
|
|
|
void func_enmy_80061CD0(void) {
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
2023-12-19 17:54:50 +03:00
|
|
|
f32 x;
|
|
|
|
f32 y;
|
|
|
|
f32 z;
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-01-13 16:43:04 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gEffects); i++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gEffects[i].obj.status == OBJ_FREE) {
|
2024-01-29 00:27:23 +03:00
|
|
|
x = gPlayer[gPlayerNum].pos.x + RAND_FLOAT_CENTERED(3000.0f) + (5.0f * gPlayer[gPlayerNum].vel.x);
|
|
|
|
y = gPlayer[gPlayerNum].pos.y + 1000.0f + RAND_FLOAT_CENTERED(500.0f) + (5.0f * gPlayer[gPlayerNum].vel.y);
|
2024-05-02 23:46:51 +03:00
|
|
|
z = -gPathProgress - RAND_FLOAT(2000.0f);
|
|
|
|
if (gPathVelZ < 0.0f) {
|
|
|
|
z = -gPathProgress + 1000.0f;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
Effect_Effect346_Setup(&gEffects[i], x, y, z);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
// Unused
|
2024-07-06 15:47:49 +03:00
|
|
|
void func_enmy_80061E48(Actor* this, f32 xPos, f32 yPos, f32 zPos) {
|
|
|
|
Actor_Initialize(this);
|
|
|
|
this->obj.status = OBJ_INIT;
|
2024-08-12 17:58:54 +03:00
|
|
|
|
|
|
|
this->obj.id = OBJ_ACTOR_ME_METEOR_1;
|
2023-11-16 05:14:33 +03:00
|
|
|
if (Rand_ZeroOne() < 0.5f) {
|
2024-08-12 17:58:54 +03:00
|
|
|
this->obj.id = OBJ_ACTOR_ME_LASER_CANNON_1;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
if (Rand_ZeroOne() < 0.5f) {
|
2024-08-12 17:58:54 +03:00
|
|
|
this->obj.id = OBJ_ACTOR_ME_METEOR_2;
|
2024-07-06 15:47:49 +03:00
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
this->obj.pos.x = xPos;
|
|
|
|
this->obj.pos.y = yPos;
|
|
|
|
this->obj.pos.z = zPos;
|
|
|
|
this->vel.z = 10.0f;
|
|
|
|
Object_SetInfo(&this->info, this->obj.id);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ActorEvent_Load(ActorEvent* this, ObjectInit* objInit, s32 index) {
|
|
|
|
Vec3f src;
|
|
|
|
|
|
|
|
Actor_Initialize(this);
|
|
|
|
this->obj.status = OBJ_ACTIVE;
|
|
|
|
this->index = index;
|
|
|
|
this->obj.pos.z = -objInit->zPos1;
|
|
|
|
this->obj.pos.z += -3000.0f + objInit->zPos2;
|
|
|
|
this->obj.pos.x = objInit->xPos;
|
|
|
|
this->obj.pos.y = objInit->yPos;
|
|
|
|
this->obj.rot.y = this->rot_0F4.y = objInit->rot.y;
|
|
|
|
this->obj.rot.x = this->rot_0F4.x = objInit->rot.x;
|
|
|
|
this->rot_0F4.z = objInit->rot.z;
|
|
|
|
this->obj.id = OBJ_ACTOR_EVENT;
|
|
|
|
this->timer_0C2 = 10;
|
|
|
|
this->eventType = EVID_FFF;
|
|
|
|
this->aiType = objInit->id - ACTOR_EVENT_ID;
|
|
|
|
|
|
|
|
Object_SetInfo(&this->info, this->obj.id);
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
this->info.cullDistance = 3000.0f;
|
|
|
|
this->fwork[25] = 20000.0f;
|
|
|
|
this->iwork[1] = gPrevEventActorIndex;
|
|
|
|
this->iwork[10] = gActors[gPrevEventActorIndex].aiType;
|
|
|
|
this->fwork[22] = gArwingSpeed;
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2024-05-05 00:24:24 +03:00
|
|
|
Matrix_RotateZ(gCalcMatrix, -gFormationInitRot.z * M_DTOR, MTXF_NEW);
|
|
|
|
Matrix_RotateX(gCalcMatrix, -gFormationInitRot.x * M_DTOR, MTXF_APPLY);
|
|
|
|
Matrix_RotateY(gCalcMatrix, -gFormationInitRot.y * M_DTOR, MTXF_APPLY);
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
src.x = this->obj.pos.x - gFormationInitPos.x;
|
|
|
|
src.y = this->obj.pos.y - gFormationInitPos.y;
|
|
|
|
src.z = this->obj.pos.z - gFormationInitPos.z;
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
Matrix_MultVec3fNoTranslate(gCalcMatrix, &src, &this->vwork[28]);
|
|
|
|
this->iwork[9] = gFormationLeaderIndex;
|
2024-04-11 19:55:32 +03:00
|
|
|
gPrevEventActorIndex = index;
|
2024-07-06 15:47:49 +03:00
|
|
|
Actor_Update(this);
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void Object_Load(ObjectInit* objInit, f32 xMax, f32 xMin, f32 yMax, f32 yMin) {
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
if ((xMax > objInit->xPos - gPlayer[0].xPath) && (objInit->xPos - gPlayer[0].xPath > xMin) &&
|
|
|
|
(yMax > objInit->yPos - gPlayer[0].yPath) && (objInit->yPos - gPlayer[0].yPath > yMin)) {
|
2024-05-07 01:45:24 +03:00
|
|
|
if (objInit->id < OBJ_SCENERY_MAX) {
|
2024-04-23 05:51:20 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gScenery); i++) {
|
|
|
|
if (gScenery[i].obj.status == OBJ_FREE) {
|
|
|
|
Scenery_Load(&gScenery[i], objInit);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-05-07 01:45:24 +03:00
|
|
|
if ((objInit->id >= OBJ_SPRITE_START) && (objInit->id < OBJ_SPRITE_MAX)) {
|
2024-04-09 01:25:56 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gSprites); i++) {
|
|
|
|
if (gSprites[i].obj.status == OBJ_FREE) {
|
|
|
|
Sprite_Load(&gSprites[i], objInit);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-05-07 01:45:24 +03:00
|
|
|
if ((objInit->id >= OBJ_ACTOR_START) && (objInit->id < OBJ_ACTOR_MAX)) {
|
2024-08-12 17:58:54 +03:00
|
|
|
if ((objInit->id == OBJ_ACTOR_AQ_JELLYFISH) || (objInit->id == OBJ_ACTOR_ZO_SEARCHLIGHT)) {
|
2024-01-14 01:45:37 +03:00
|
|
|
for (i = ARRAY_COUNT(gActors) - 1; i >= 0; i--) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gActors[i].obj.status == OBJ_FREE) {
|
2024-01-14 01:45:37 +03:00
|
|
|
Actor_Load(&gActors[i], objInit);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2024-04-05 23:11:36 +03:00
|
|
|
} else if (objInit->id == OBJ_ACTOR_TEAM_BOSS) {
|
2023-11-16 05:14:33 +03:00
|
|
|
for (i = 0; i < 3; i++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gActors[i].obj.status == OBJ_FREE) {
|
2024-01-14 01:45:37 +03:00
|
|
|
Actor_Load(&gActors[i], objInit);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2024-01-14 01:45:37 +03:00
|
|
|
for (i = 4; i < ARRAY_COUNT(gActors); i++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gActors[i].obj.status == OBJ_FREE) {
|
2024-01-14 01:45:37 +03:00
|
|
|
Actor_Load(&gActors[i], objInit);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-05-07 01:45:24 +03:00
|
|
|
if ((objInit->id >= OBJ_BOSS_START) && (objInit->id < OBJ_BOSS_MAX)) {
|
2024-01-07 01:39:23 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gBosses); i++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gBosses[i].obj.status == OBJ_FREE) {
|
2024-01-07 01:39:23 +03:00
|
|
|
Boss_Load(&gBosses[i], objInit);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-05-07 01:45:24 +03:00
|
|
|
if ((objInit->id >= OBJ_ITEM_START) && (objInit->id < OBJ_ITEM_MAX)) {
|
2023-12-20 22:32:50 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gItems); i++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gItems[i].obj.status == OBJ_FREE) {
|
2023-12-24 22:28:35 +03:00
|
|
|
Item_Load(&gItems[i], objInit);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
if ((objInit->id >= OBJ_EFFECT_START) && (objInit->id <= OBJ_ID_MAX)) {
|
2023-12-19 17:54:50 +03:00
|
|
|
switch (objInit->id) {
|
2023-12-20 22:32:50 +03:00
|
|
|
case OBJ_UNK_403:
|
2024-04-03 02:20:08 +03:00
|
|
|
D_MA_801BA1E8 = 99;
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
2023-12-20 22:32:50 +03:00
|
|
|
case OBJ_UNK_404:
|
2024-04-03 02:20:08 +03:00
|
|
|
D_MA_801BA1E8 = 0;
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
2023-12-20 22:32:50 +03:00
|
|
|
case OBJ_UNK_405:
|
2024-04-03 02:20:08 +03:00
|
|
|
D_MA_801BA1E8 = 98;
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
2023-12-20 22:32:50 +03:00
|
|
|
case OBJ_UNK_402:
|
2024-04-03 02:20:08 +03:00
|
|
|
D_Andross_801A7F78 = objInit->rot.z * 0.1f;
|
|
|
|
D_Andross_801A7F60 = -(f32) objInit->rot.x;
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ENV_SMALL_ROCKS_ENABLE:
|
2024-05-11 23:53:37 +03:00
|
|
|
gDrawSmallRocks++;
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ENV_SMALL_ROCKS_DISABLE:
|
2024-05-11 23:53:37 +03:00
|
|
|
if (gDrawSmallRocks > 0) {
|
|
|
|
gDrawSmallRocks--;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2024-05-07 01:45:24 +03:00
|
|
|
if (objInit->id > OBJ_ID_MAX) {
|
2024-01-14 01:45:37 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gActors); i++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gActors[i].obj.status == OBJ_FREE) {
|
2024-04-20 22:18:31 +03:00
|
|
|
ActorEvent_Load(&gActors[i], objInit, i);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
void func_enmy_80062568(void) {
|
2024-04-09 01:25:56 +03:00
|
|
|
ObjectInit* objInit;
|
2024-07-06 15:47:49 +03:00
|
|
|
s32 i;
|
2023-12-14 17:41:43 +03:00
|
|
|
s32 temp = gCurrentLevel; // seems fake
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-11-16 05:14:33 +03:00
|
|
|
if (1) {}
|
2024-04-09 01:25:56 +03:00
|
|
|
gLevelObjects = SEGMENTED_TO_VIRTUAL(gLevelObjectInits[temp]);
|
2024-07-06 15:47:49 +03:00
|
|
|
i = gSavedObjectLoadIndex - 40;
|
|
|
|
objInit = &gLevelObjects[i];
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
for (; i < gSavedObjectLoadIndex; i++, objInit++) {
|
2024-04-09 01:25:56 +03:00
|
|
|
Object_Load(objInit, 4000.0f, -4000.0f, 4000.0f, -4000.0f);
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-26 01:01:25 +03:00
|
|
|
void Object_LoadLevelObjects(void) {
|
2023-12-19 17:54:50 +03:00
|
|
|
ObjectInit* objInit;
|
2024-04-09 01:25:56 +03:00
|
|
|
f32 xMax;
|
|
|
|
f32 xMin;
|
|
|
|
f32 yMax;
|
|
|
|
f32 yMin;
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
|
|
|
s32 j;
|
|
|
|
|
2024-04-23 05:51:20 +03:00
|
|
|
if ((gCurrentLevel == LEVEL_METEO) && (gLevelPhase == 1)) {
|
2024-04-09 01:25:56 +03:00
|
|
|
gLevelObjects = SEGMENTED_TO_VIRTUAL(D_ME_602B148);
|
2024-04-23 05:51:20 +03:00
|
|
|
} else if ((gCurrentLevel == LEVEL_SECTOR_X) && (gLevelPhase == 1)) {
|
2024-04-09 01:25:56 +03:00
|
|
|
gLevelObjects = SEGMENTED_TO_VIRTUAL(D_SX_602F18C);
|
2024-04-23 05:51:20 +03:00
|
|
|
} else if ((gCurrentLevel == LEVEL_VENOM_ANDROSS) && (gLevelPhase == 1)) {
|
2024-04-09 01:25:56 +03:00
|
|
|
gLevelObjects = SEGMENTED_TO_VIRTUAL(D_ANDROSS_C0356A4);
|
2024-04-23 05:51:20 +03:00
|
|
|
} else if ((gCurrentLevel == LEVEL_VENOM_1) && (gLevelPhase == 1)) {
|
2024-04-09 01:25:56 +03:00
|
|
|
gLevelObjects = SEGMENTED_TO_VIRTUAL(D_VE1_6010088);
|
2023-11-16 05:14:33 +03:00
|
|
|
} else {
|
2024-04-09 01:25:56 +03:00
|
|
|
gLevelObjects = SEGMENTED_TO_VIRTUAL(gLevelObjectInits[gCurrentLevel]);
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2024-05-11 23:53:37 +03:00
|
|
|
if (gGroundClipMode == 0) {
|
|
|
|
for (j = 0; j < gDrawSmallRocks; j++) {
|
2023-12-14 17:41:43 +03:00
|
|
|
if (gCurrentLevel == LEVEL_AQUAS) {
|
2024-04-03 02:20:08 +03:00
|
|
|
func_enmy_80061B68();
|
2023-11-16 05:14:33 +03:00
|
|
|
} else {
|
2024-04-03 02:20:08 +03:00
|
|
|
func_enmy_80061A4C();
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2023-12-14 17:41:43 +03:00
|
|
|
if (gCurrentLevel == LEVEL_METEO) {
|
2024-04-09 01:25:56 +03:00
|
|
|
yMax = xMax = 10000.0f;
|
|
|
|
yMin = xMin = -10000.0f;
|
2023-12-14 17:41:43 +03:00
|
|
|
} else if (gCurrentLevel == LEVEL_SECTOR_Y) {
|
2024-04-09 01:25:56 +03:00
|
|
|
yMax = xMax = 6000.0f;
|
|
|
|
yMin = xMin = -6000.0f;
|
2023-12-14 17:41:43 +03:00
|
|
|
} else if (gCurrentLevel == LEVEL_VENOM_1) {
|
2024-04-09 01:25:56 +03:00
|
|
|
yMax = xMax = 3500.0f;
|
|
|
|
yMin = xMin = -3500.0f;
|
2023-11-16 05:14:33 +03:00
|
|
|
} else {
|
2024-04-09 01:25:56 +03:00
|
|
|
yMax = xMax = 4000.0f;
|
|
|
|
yMin = xMin = -4000.0f;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
|
2024-05-11 23:53:37 +03:00
|
|
|
if ((gPlayer[0].pathChangeTimer != 0) && (gPlayer[0].pathChangeYaw < 0.0f)) {
|
2024-04-09 01:25:56 +03:00
|
|
|
xMax = 10000.0f;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-05-11 23:53:37 +03:00
|
|
|
if ((gPlayer[0].pathChangeTimer != 0) && (gPlayer[0].pathChangeYaw > 0.0f)) {
|
2024-04-09 01:25:56 +03:00
|
|
|
xMin = -10000.0f;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
gLastPathChange = 0;
|
2023-11-16 05:14:33 +03:00
|
|
|
|
2024-04-26 01:01:25 +03:00
|
|
|
for (i = 0, objInit = &gLevelObjects[gObjectLoadIndex]; i < 10000; i++, gObjectLoadIndex++, objInit++) {
|
2024-05-07 01:45:24 +03:00
|
|
|
if (objInit->id <= OBJ_INVALID) {
|
|
|
|
break;
|
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
if ((gPathProgress <= objInit->zPos1) && (objInit->zPos1 <= gPathProgress + 200.0f)) {
|
2024-04-05 23:11:36 +03:00
|
|
|
if ((gCurrentLevel == LEVEL_VENOM_1) && (objInit->id >= ACTOR_EVENT_ID)) {
|
2024-05-02 23:46:51 +03:00
|
|
|
if (((objInit->rot.y < 180.0f) && (objInit->xPos < gPlayer[0].xPath)) ||
|
|
|
|
((objInit->rot.y > 180.0f) && (gPlayer[0].xPath < objInit->xPos))) {
|
2024-04-09 01:25:56 +03:00
|
|
|
Object_Load(objInit, xMax, xMin, yMax, yMin);
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
} else {
|
2024-04-09 01:25:56 +03:00
|
|
|
Object_Load(objInit, xMax, xMin, yMax, yMin);
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
void func_enmy_80062B60(f32 xPos, f32 zPos, s32 state, f32 scale) {
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
|
|
|
|
2023-12-24 22:28:35 +03:00
|
|
|
if (gLevelType == LEVELTYPE_PLANET) {
|
2024-01-13 16:43:04 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gEffects); i++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gEffects[i].obj.status == OBJ_FREE) {
|
2024-01-13 16:43:04 +03:00
|
|
|
Effect_Initialize(&gEffects[i]);
|
2024-01-21 23:42:06 +03:00
|
|
|
gEffects[i].obj.status = OBJ_INIT;
|
2024-01-13 16:43:04 +03:00
|
|
|
gEffects[i].obj.id = OBJ_EFFECT_348;
|
|
|
|
gEffects[i].obj.pos.x = xPos;
|
2024-04-23 05:51:20 +03:00
|
|
|
gEffects[i].obj.pos.y = gGroundHeight + 3.0f;
|
2024-01-13 16:43:04 +03:00
|
|
|
gEffects[i].obj.pos.z = zPos;
|
|
|
|
gEffects[i].scale2 = 10.0f;
|
2024-01-24 17:45:55 +03:00
|
|
|
gEffects[i].scale1 = scale;
|
2024-01-13 16:43:04 +03:00
|
|
|
gEffects[i].unk_44 = 80;
|
2024-01-24 17:45:55 +03:00
|
|
|
gEffects[i].state = state;
|
2024-01-13 16:43:04 +03:00
|
|
|
Object_SetInfo(&gEffects[i].info, gEffects[i].obj.id);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
void func_enmy_80062C38(f32 xPos, f32 yPos) {
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
|
|
|
|
2023-12-24 22:28:35 +03:00
|
|
|
if (gLevelType == LEVELTYPE_PLANET) {
|
2024-01-13 16:43:04 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gEffects); i++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gEffects[i].obj.status == OBJ_FREE) {
|
2024-01-13 16:43:04 +03:00
|
|
|
Effect_Initialize(&gEffects[i]);
|
2024-01-21 23:42:06 +03:00
|
|
|
gEffects[i].obj.status = OBJ_INIT;
|
2024-01-13 16:43:04 +03:00
|
|
|
gEffects[i].obj.id = OBJ_EFFECT_349;
|
|
|
|
gEffects[i].obj.pos.x = xPos;
|
2024-04-23 05:51:20 +03:00
|
|
|
gEffects[i].obj.pos.y = gGroundHeight + 3.0f;
|
2024-01-13 16:43:04 +03:00
|
|
|
gEffects[i].obj.pos.z = yPos;
|
|
|
|
gEffects[i].scale2 = 1.0f;
|
|
|
|
gEffects[i].scale1 = 1.3f;
|
|
|
|
gEffects[i].unk_44 = 120;
|
|
|
|
Object_SetInfo(&gEffects[i].info, gEffects[i].obj.id);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
void func_enmy_80062D04(f32 xPos, f32 yPos) {
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
|
|
|
|
2024-01-13 16:43:04 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gEffects); i++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gEffects[i].obj.status == OBJ_FREE) {
|
2024-01-13 16:43:04 +03:00
|
|
|
Effect_Initialize(&gEffects[i]);
|
2024-01-21 23:42:06 +03:00
|
|
|
gEffects[i].obj.status = OBJ_INIT;
|
2024-01-13 16:43:04 +03:00
|
|
|
gEffects[i].obj.id = OBJ_EFFECT_350;
|
|
|
|
gEffects[i].obj.pos.x = xPos;
|
2024-04-23 05:51:20 +03:00
|
|
|
gEffects[i].obj.pos.y = gGroundHeight + 3.0f;
|
2024-01-13 16:43:04 +03:00
|
|
|
gEffects[i].obj.pos.z = yPos;
|
|
|
|
gEffects[i].scale2 = 3.0f;
|
|
|
|
gEffects[i].scale1 = 2.0f;
|
|
|
|
gEffects[i].unk_44 = 120;
|
|
|
|
Object_SetInfo(&gEffects[i].info, gEffects[i].obj.id);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
bool Object_CheckHitboxCollision(Vec3f* pos, f32* hitboxData, Object* obj, f32 xRot, f32 yRot, f32 zRot) {
|
2023-12-20 22:32:50 +03:00
|
|
|
s32 i;
|
2023-12-19 17:54:50 +03:00
|
|
|
Vec3f hitRot;
|
|
|
|
Vec3f hitPos;
|
|
|
|
f32 rotate;
|
2023-12-20 22:32:50 +03:00
|
|
|
s32 count;
|
2023-11-16 05:14:33 +03:00
|
|
|
Vec3f sp80;
|
|
|
|
Vec3f sp74;
|
2023-12-19 17:54:50 +03:00
|
|
|
Hitbox* hitbox;
|
|
|
|
|
2023-12-20 22:32:50 +03:00
|
|
|
count = *hitboxData;
|
|
|
|
if (count != 0) {
|
|
|
|
hitboxData++;
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2023-12-20 22:32:50 +03:00
|
|
|
for (i = 0; i < count; i++, hitboxData += 6) {
|
2023-12-19 17:54:50 +03:00
|
|
|
rotate = 0.0f;
|
|
|
|
hitRot.x = hitRot.y = hitRot.z = 0.0f;
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2024-04-11 19:55:32 +03:00
|
|
|
if (*hitboxData >= HITBOX_SHADOW) {
|
2024-01-03 00:33:26 +03:00
|
|
|
return false;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-04-11 19:55:32 +03:00
|
|
|
if (*hitboxData == HITBOX_ROTATED) {
|
2023-12-19 17:54:50 +03:00
|
|
|
rotate = 1.0f;
|
2023-12-20 22:32:50 +03:00
|
|
|
hitRot.x = hitboxData[1];
|
|
|
|
hitRot.y = hitboxData[2];
|
|
|
|
hitRot.z = hitboxData[3];
|
|
|
|
hitboxData += 4;
|
2023-12-19 17:54:50 +03:00
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2023-12-19 17:54:50 +03:00
|
|
|
if ((obj->rot.y == 0.0f) && (obj->rot.z == 0.0f) && (obj->rot.x == 0.0f) && (rotate == 0.0f)) {
|
|
|
|
hitPos.x = pos->x;
|
|
|
|
hitPos.y = pos->y;
|
|
|
|
hitPos.z = pos->z;
|
2023-11-16 05:14:33 +03:00
|
|
|
} else {
|
2024-04-16 02:38:19 +03:00
|
|
|
Matrix_RotateZ(gCalcMatrix, -hitRot.z * M_DTOR, MTXF_NEW);
|
|
|
|
Matrix_RotateX(gCalcMatrix, -hitRot.x * M_DTOR, MTXF_APPLY);
|
|
|
|
Matrix_RotateY(gCalcMatrix, -hitRot.y * M_DTOR, MTXF_APPLY);
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
Matrix_RotateZ(gCalcMatrix, -obj->rot.z * M_DTOR, MTXF_APPLY);
|
|
|
|
Matrix_RotateX(gCalcMatrix, -obj->rot.x * M_DTOR, MTXF_APPLY);
|
|
|
|
Matrix_RotateY(gCalcMatrix, -obj->rot.y * M_DTOR, MTXF_APPLY);
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2023-12-19 17:54:50 +03:00
|
|
|
if ((xRot != 0.0f) || (yRot != 0.0f) || (zRot != 0.0f)) {
|
2024-04-16 02:38:19 +03:00
|
|
|
Matrix_RotateZ(gCalcMatrix, -zRot * M_DTOR, MTXF_APPLY);
|
|
|
|
Matrix_RotateX(gCalcMatrix, -xRot * M_DTOR, MTXF_APPLY);
|
|
|
|
Matrix_RotateY(gCalcMatrix, -yRot * M_DTOR, MTXF_APPLY);
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2023-12-19 17:54:50 +03:00
|
|
|
sp80.x = pos->x - obj->pos.x;
|
|
|
|
sp80.y = pos->y - obj->pos.y;
|
|
|
|
sp80.z = pos->z - obj->pos.z;
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2023-11-24 22:11:20 +03:00
|
|
|
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp80, &sp74);
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2023-12-19 17:54:50 +03:00
|
|
|
hitPos.x = obj->pos.x + sp74.x;
|
|
|
|
hitPos.y = obj->pos.y + sp74.y;
|
|
|
|
hitPos.z = obj->pos.z + sp74.z;
|
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2023-12-19 17:54:50 +03:00
|
|
|
hitbox = (Hitbox*) hitboxData;
|
|
|
|
if (((hitbox->z.size + 20.0f) > fabsf(hitbox->z.offset + obj->pos.z - hitPos.z)) &&
|
|
|
|
((hitbox->x.size + 20.0f) > fabsf(hitbox->x.offset + obj->pos.x - hitPos.x)) &&
|
|
|
|
((hitbox->y.size + 10.0f) > fabsf(hitbox->y.offset + obj->pos.y - hitPos.y))) {
|
2023-12-04 21:50:52 +03:00
|
|
|
return true;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-12-04 21:50:52 +03:00
|
|
|
return false;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
bool Object_CheckSingleHitbox(Vec3f* checkPos, f32* hitboxData, Vec3f* hitboxPos) {
|
2023-12-19 17:54:50 +03:00
|
|
|
if ((s32) hitboxData[0] != 0) {
|
2024-04-16 02:38:19 +03:00
|
|
|
if ((fabsf(hitboxData[1] + hitboxPos->z - checkPos->z) < (hitboxData[2] + 20.0f)) &&
|
|
|
|
(fabsf(hitboxData[5] + hitboxPos->x - checkPos->x) < (hitboxData[6] + 20.0f)) &&
|
|
|
|
(fabsf(hitboxData[3] + hitboxPos->y - checkPos->y) < (hitboxData[4] + 20.0f))) {
|
2023-12-19 17:54:50 +03:00
|
|
|
return true;
|
|
|
|
}
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2023-12-04 21:50:52 +03:00
|
|
|
return false;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
bool Object_CheckPolyCollision(Vec3f* pos, Vec3f* vel, ObjectId objId, Object* obj) {
|
2023-11-16 05:14:33 +03:00
|
|
|
Vec3f sp74;
|
|
|
|
Vec3f sp68;
|
2024-04-16 02:38:19 +03:00
|
|
|
Vec3f relPos;
|
|
|
|
Vec3f objPos;
|
2023-11-16 05:14:33 +03:00
|
|
|
Vec3f sp44;
|
2024-01-03 00:33:26 +03:00
|
|
|
s32 colId;
|
2024-04-07 07:05:58 +03:00
|
|
|
s32 pad1[2];
|
|
|
|
f32 sp30[2];
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 pad2;
|
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
sp74.x = pos->x - obj->pos.x;
|
|
|
|
sp74.z = pos->z - obj->pos.z;
|
2024-08-12 17:58:54 +03:00
|
|
|
|
|
|
|
if (((fabsf(sp74.x) < 1100.0f) && (fabsf(sp74.z) < 1100.0f)) || (objId == OBJ_ACTOR_ME_MOLAR_ROCK)) {
|
2024-04-16 02:38:19 +03:00
|
|
|
sp74.y = pos->y - obj->pos.y;
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
Matrix_RotateY(gCalcMatrix, -obj->rot.y * M_DTOR, MTXF_NEW);
|
2023-11-24 22:11:20 +03:00
|
|
|
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp74, &sp68);
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
relPos.x = obj->pos.x + sp68.x;
|
|
|
|
relPos.y = obj->pos.y + sp68.y;
|
|
|
|
relPos.z = obj->pos.z + sp68.z;
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
objPos.x = obj->pos.x;
|
|
|
|
objPos.y = obj->pos.y;
|
|
|
|
objPos.z = obj->pos.z;
|
2024-08-12 17:58:54 +03:00
|
|
|
|
|
|
|
if ((objId == OBJ_ACTOR_ME_MOLAR_ROCK) || (objId == OBJ_SCENERY_FO_MOUNTAIN_2) ||
|
|
|
|
(objId == OBJ_SCENERY_FO_MOUNTAIN_3) || (objId == OBJ_BOSS_FO_BASE) || (objId == OBJ_BOSS_SZ_GREAT_FOX) ||
|
|
|
|
(objId == OBJ_BOSS_VE2_BASE) || (objId == OBJ_BOSS_BO_BASE) || (objId == OBJ_SCENERY_ME_TUNNEL)) {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL1_0;
|
2024-08-12 17:58:54 +03:00
|
|
|
if (objId == OBJ_BOSS_VE2_BASE) {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL1_9;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-05-02 23:46:51 +03:00
|
|
|
if (objId == OBJ_SCENERY_ME_TUNNEL) {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL1_1;
|
2024-08-12 17:58:54 +03:00
|
|
|
} else if (objId == OBJ_BOSS_FO_BASE) {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL1_4;
|
2024-08-12 17:58:54 +03:00
|
|
|
} else if (objId == OBJ_BOSS_BO_BASE) {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL1_7;
|
2024-08-12 17:58:54 +03:00
|
|
|
} else if (objId == OBJ_SCENERY_FO_MOUNTAIN_2) {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL1_5;
|
2024-08-12 17:58:54 +03:00
|
|
|
} else if (objId == OBJ_SCENERY_FO_MOUNTAIN_3) {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL1_6;
|
2024-07-06 15:47:49 +03:00
|
|
|
} else if (objId == OBJ_BOSS_SZ_GREAT_FOX) {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL1_8;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-04-16 02:38:19 +03:00
|
|
|
if (func_col1_800998FC(&relPos, &objPos, vel, colId, &sp44, sp30) > 0) {
|
2023-12-04 21:50:52 +03:00
|
|
|
return true;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
} else {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL2_0;
|
2024-07-06 15:47:49 +03:00
|
|
|
if (objId == OBJ_SCENERY_CO_BUMP_2) {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL2_2;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
if (objId == OBJ_SCENERY_CO_BUMP_3) {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL2_3;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
if (objId == OBJ_SCENERY_VS_PYRAMID_1) {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL2_4;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
if (objId == OBJ_SCENERY_VS_PYRAMID_2) {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL2_6;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
if (objId == OBJ_SCENERY_AQ_CORAL_REEF_1) {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL2_14;
|
2024-07-06 15:47:49 +03:00
|
|
|
} else if ((objId == OBJ_SCENERY_CO_BUMP_4) || (objId == OBJ_SCENERY_CO_BUMP_5)) {
|
2024-01-03 00:33:26 +03:00
|
|
|
colId = COL2_1;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
if (func_col2_800A3690(&relPos, &objPos, colId, &sp44)) {
|
2023-12-04 21:50:52 +03:00
|
|
|
return true;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-12-04 21:50:52 +03:00
|
|
|
return false;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
s32 Object_CheckCollision(s32 index, Vec3f* pos, Vec3f* vel, s32 mode) {
|
2024-04-23 05:51:20 +03:00
|
|
|
Scenery360* scenery360;
|
|
|
|
Scenery* scenery;
|
2024-04-09 01:25:56 +03:00
|
|
|
Sprite* sprite;
|
2024-01-07 01:39:23 +03:00
|
|
|
Boss* boss;
|
2024-01-14 01:45:37 +03:00
|
|
|
Actor* actor;
|
2023-11-16 05:14:33 +03:00
|
|
|
Vec3f temp;
|
|
|
|
s32 i;
|
|
|
|
|
2023-12-24 22:28:35 +03:00
|
|
|
if ((gLevelMode == LEVELMODE_ALL_RANGE) && (gCurrentLevel != LEVEL_KATINA)) {
|
2024-04-23 05:51:20 +03:00
|
|
|
scenery360 = gScenery360;
|
|
|
|
for (i = 0; i < 200; i++, scenery360++) {
|
|
|
|
if (scenery360->obj.status == OBJ_ACTIVE) {
|
2024-07-06 15:47:49 +03:00
|
|
|
if ((scenery360->obj.id == OBJ_SCENERY_CO_BUMP_1) || (scenery360->obj.id == OBJ_SCENERY_CO_BUMP_3) ||
|
2024-08-12 17:58:54 +03:00
|
|
|
(scenery360->obj.id == OBJ_SCENERY_AQ_CORAL_REEF_1) ||
|
|
|
|
(scenery360->obj.id == OBJ_SCENERY_VS_PYRAMID_2) ||
|
|
|
|
(scenery360->obj.id == OBJ_SCENERY_FO_MOUNTAIN_3) ||
|
|
|
|
(scenery360->obj.id == OBJ_SCENERY_FO_MOUNTAIN_2) ||
|
|
|
|
(scenery360->obj.id == OBJ_SCENERY_FO_MOUNTAIN_1) ||
|
|
|
|
(scenery360->obj.id == OBJ_SCENERY_VS_PYRAMID_1)) {
|
2024-04-23 05:51:20 +03:00
|
|
|
if (Object_CheckPolyCollision(pos, vel, scenery360->obj.id, &scenery360->obj)) {
|
2023-11-16 05:14:33 +03:00
|
|
|
return 999;
|
|
|
|
}
|
2024-04-23 05:51:20 +03:00
|
|
|
} else if ((fabsf(pos->x - scenery360->obj.pos.x) < 2000.0f) &&
|
|
|
|
(fabsf(pos->z - scenery360->obj.pos.z) < 2000.0f)) {
|
|
|
|
if (Object_CheckHitboxCollision(pos, scenery360->info.hitbox, &scenery360->obj, 0.0f, 0.0f, 0.0f)) {
|
2023-11-16 05:14:33 +03:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
scenery = &gScenery[0];
|
2024-04-23 05:51:20 +03:00
|
|
|
for (i = 0; (i < ARRAY_COUNT(gScenery)) && (gLevelMode == LEVELMODE_ON_RAILS); i++, scenery++) {
|
|
|
|
if (scenery->obj.status == OBJ_ACTIVE) {
|
2024-07-06 15:47:49 +03:00
|
|
|
if ((scenery->obj.id == OBJ_SCENERY_CO_BUMP_1) || (scenery->obj.id == OBJ_SCENERY_CO_BUMP_4) ||
|
|
|
|
(scenery->obj.id == OBJ_SCENERY_CO_BUMP_5) || (scenery->obj.id == OBJ_SCENERY_CO_BUMP_2) ||
|
|
|
|
(scenery->obj.id == OBJ_SCENERY_ME_TUNNEL) || (scenery->obj.id == OBJ_SCENERY_CO_BUMP_3)) {
|
2024-04-23 05:51:20 +03:00
|
|
|
if (Object_CheckPolyCollision(pos, vel, scenery->obj.id, &scenery->obj)) {
|
2023-11-16 05:14:33 +03:00
|
|
|
return 2;
|
|
|
|
}
|
2024-04-23 05:51:20 +03:00
|
|
|
} else if ((fabsf(pos->x - scenery->obj.pos.x) < 2000.0f) &&
|
|
|
|
(fabsf(pos->z - scenery->obj.pos.z) < 2000.0f)) {
|
|
|
|
if (Object_CheckHitboxCollision(pos, scenery->info.hitbox, &scenery->obj, 0.0f, 0.0f, 0.0f)) {
|
2023-11-16 05:14:33 +03:00
|
|
|
return i + 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
sprite = &gSprites[0];
|
2024-04-09 01:25:56 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gSprites); i++, sprite++) {
|
|
|
|
if ((sprite->obj.status == OBJ_ACTIVE) && (fabsf(pos->x - sprite->obj.pos.x) < 500.0f) &&
|
|
|
|
(fabsf(pos->z - sprite->obj.pos.z) < 500.0f) &&
|
2024-04-16 02:38:19 +03:00
|
|
|
Object_CheckSingleHitbox(pos, sprite->info.hitbox, &sprite->obj.pos)) {
|
2024-04-09 01:25:56 +03:00
|
|
|
if ((sprite->obj.id == OBJ_SPRITE_FO_POLE) || (sprite->obj.id == OBJ_SPRITE_CO_TREE) ||
|
|
|
|
(sprite->obj.id == OBJ_SPRITE_CO_TREE)) {
|
2024-08-12 17:58:54 +03:00
|
|
|
sprite->destroy = true;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
if ((mode == 0) || (mode == 2) || (mode == 3)) {
|
|
|
|
if (mode != 2) {
|
2024-07-06 15:47:49 +03:00
|
|
|
boss = &gBosses[0];
|
2024-01-07 01:39:23 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gBosses); i++, boss++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (boss->obj.status == OBJ_ACTIVE) {
|
2024-08-12 17:58:54 +03:00
|
|
|
if ((boss->obj.id == OBJ_BOSS_FO_BASE) || (boss->obj.id == OBJ_BOSS_VE2_BASE) ||
|
|
|
|
(boss->obj.id == OBJ_BOSS_SZ_GREAT_FOX) || (boss->obj.id == OBJ_BOSS_BO_BASE)) {
|
2024-04-16 02:38:19 +03:00
|
|
|
if (Object_CheckPolyCollision(pos, vel, boss->obj.id, &boss->obj)) {
|
2023-11-16 05:14:33 +03:00
|
|
|
return 2;
|
|
|
|
}
|
2024-08-12 17:58:54 +03:00
|
|
|
} else if (boss->obj.id == OBJ_BOSS_BO_BASE_SHIELD) {
|
2024-01-07 01:39:23 +03:00
|
|
|
temp.x = fabsf(boss->obj.pos.x - pos->x) * (5.0f / 6.0f);
|
|
|
|
temp.y = fabsf(boss->obj.pos.y - pos->y) * 2;
|
|
|
|
temp.z = fabsf(boss->obj.pos.z - pos->z) * (5.0f / 6.0f);
|
2024-03-12 22:46:25 +03:00
|
|
|
if ((VEC3F_MAG(&temp)) < 1500.0f) {
|
2024-01-14 04:09:13 +03:00
|
|
|
boss->dmgType = DMG_BEAM;
|
2023-11-16 05:14:33 +03:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
} else {
|
2024-08-12 17:58:54 +03:00
|
|
|
if (boss->obj.id == OBJ_BOSS_KA_SAUCERER) {
|
2024-01-07 01:39:23 +03:00
|
|
|
temp.x = fabsf(boss->obj.pos.x - pos->x);
|
|
|
|
temp.y = fabsf(boss->obj.pos.y - 300.0f - pos->y) * 7.42f;
|
|
|
|
temp.z = fabsf(boss->obj.pos.z - pos->z);
|
2024-03-12 22:46:25 +03:00
|
|
|
if ((VEC3F_MAG(&temp)) < 2700.0f) {
|
2023-11-16 05:14:33 +03:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
2024-01-07 01:39:23 +03:00
|
|
|
if ((fabsf(pos->x - boss->obj.pos.x) < 2000.0f) &&
|
|
|
|
(fabsf(pos->z - boss->obj.pos.z) < 2000.0f)) {
|
2024-04-16 02:38:19 +03:00
|
|
|
if (Object_CheckHitboxCollision(pos, boss->info.hitbox, &boss->obj, 0.0f, 0.0f, 0.0f)) {
|
2023-11-16 05:14:33 +03:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
actor = &gActors[0];
|
2024-01-14 01:45:37 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gActors); i++, actor++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if ((actor->obj.status >= OBJ_ACTIVE) && (fabsf(pos->x - actor->obj.pos.x) < 1000.0f) &&
|
2024-01-14 01:45:37 +03:00
|
|
|
(fabsf(pos->z - actor->obj.pos.z) < 1500.0f) && (index != i) && (actor->info.unk_16 != 2) &&
|
2024-04-05 23:11:36 +03:00
|
|
|
!((actor->obj.id == OBJ_ACTOR_ALLRANGE) && (actor->aiType <= AI360_PEPPY)) && (actor->timer_0C2 == 0)) {
|
2024-08-12 17:58:54 +03:00
|
|
|
if (actor->obj.id == OBJ_ACTOR_ME_MOLAR_ROCK) {
|
2024-04-16 02:38:19 +03:00
|
|
|
if (Object_CheckPolyCollision(pos, vel, actor->obj.id, &actor->obj)) {
|
2023-11-16 05:14:33 +03:00
|
|
|
return 2;
|
|
|
|
}
|
2024-01-14 01:45:37 +03:00
|
|
|
} else if (actor->scale < 0.0f) {
|
2024-04-16 02:38:19 +03:00
|
|
|
if (Object_CheckHitboxCollision(pos, actor->info.hitbox, &actor->obj, actor->vwork[29].x,
|
2024-05-11 23:53:37 +03:00
|
|
|
actor->vwork[29].y, actor->vwork[29].z + actor->rot_0F4.z)) {
|
2024-05-05 00:24:24 +03:00
|
|
|
actor->dmgType = DMG_BEAM;
|
2024-01-21 23:42:06 +03:00
|
|
|
actor->damage = 10;
|
2024-05-02 23:46:51 +03:00
|
|
|
actor->dmgPart = -1;
|
2024-04-23 05:51:20 +03:00
|
|
|
actor->hitPos.x = pos->x;
|
|
|
|
actor->hitPos.y = pos->y;
|
|
|
|
actor->hitPos.z = pos->z;
|
2023-11-16 05:14:33 +03:00
|
|
|
return 2;
|
|
|
|
}
|
2024-04-16 02:38:19 +03:00
|
|
|
} else if ((mode != 2) && (mode != 3)) {
|
|
|
|
if (Object_CheckSingleHitbox(pos, actor->info.hitbox, &actor->obj.pos)) {
|
2024-05-05 00:24:24 +03:00
|
|
|
actor->dmgType = DMG_BEAM;
|
2024-01-21 23:42:06 +03:00
|
|
|
actor->damage = 10;
|
2024-05-02 23:46:51 +03:00
|
|
|
actor->dmgPart = -1;
|
2024-04-05 23:11:36 +03:00
|
|
|
if (!(((actor->obj.id == OBJ_ACTOR_EVENT) && (actor->iwork[12] != 0)) ||
|
|
|
|
((actor->obj.id == OBJ_ACTOR_ALLRANGE) &&
|
2024-07-06 15:47:49 +03:00
|
|
|
((actor->aiType < AI360_ENEMY) || (actor->aiType >= AI360_GREAT_FOX))))) {
|
2024-01-21 23:42:06 +03:00
|
|
|
actor->health = 0;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2024-04-23 05:51:20 +03:00
|
|
|
actor->hitPos.x = pos->x;
|
|
|
|
actor->hitPos.y = pos->y;
|
|
|
|
actor->hitPos.z = pos->z;
|
2023-12-15 23:09:49 +03:00
|
|
|
return 1;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-12-15 23:09:49 +03:00
|
|
|
return 0;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
void Actor_CoRadar_Init(Scenery* this) {
|
2023-11-16 05:14:33 +03:00
|
|
|
s32 i;
|
|
|
|
|
2024-01-14 01:45:37 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gActors); i++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gActors[i].obj.status == OBJ_FREE) {
|
2024-01-14 01:45:37 +03:00
|
|
|
Actor_Initialize(&gActors[i]);
|
2024-01-21 23:42:06 +03:00
|
|
|
gActors[i].obj.status = OBJ_INIT;
|
2024-08-12 17:58:54 +03:00
|
|
|
gActors[i].obj.id = OBJ_ACTOR_CO_RADAR;
|
2024-07-06 15:47:49 +03:00
|
|
|
gActors[i].obj.pos.x = this->obj.pos.x;
|
|
|
|
gActors[i].obj.pos.y = this->obj.pos.y;
|
|
|
|
gActors[i].obj.pos.z = this->obj.pos.z;
|
2024-01-29 00:27:23 +03:00
|
|
|
gActors[i].obj.rot.y = RAND_FLOAT(360.0f);
|
2024-01-14 01:45:37 +03:00
|
|
|
Object_SetInfo(&gActors[i].info, gActors[i].obj.id);
|
2023-11-16 05:14:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
void Scenery_Corneria_Init(CoDoors* this) {
|
2023-11-18 18:44:33 +03:00
|
|
|
s32 i;
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
this->obj.pos.y = gGroundHeight;
|
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gSprites); i++) {
|
|
|
|
if (gSprites[i].obj.status == OBJ_FREE) {
|
|
|
|
Sprite_Initialize(&gSprites[i]);
|
|
|
|
gSprites[i].obj.status = OBJ_INIT;
|
|
|
|
gSprites[i].obj.id = OBJ_SPRITE_FOG_SHADOW;
|
2024-07-06 15:47:49 +03:00
|
|
|
gSprites[i].sceneryId = this->obj.id;
|
|
|
|
gSprites[i].obj.pos.x = this->obj.pos.x;
|
2024-04-09 01:25:56 +03:00
|
|
|
gSprites[i].obj.pos.y = 5.0f;
|
2024-07-06 15:47:49 +03:00
|
|
|
gSprites[i].obj.pos.z = this->obj.pos.z;
|
|
|
|
|
|
|
|
if ((this->obj.id == OBJ_SCENERY_CO_STONE_ARCH) || (this->obj.id == OBJ_SCENERY_CO_HIGHWAY_1) ||
|
|
|
|
(this->obj.id == OBJ_SCENERY_CO_HIGHWAY_2) || (this->obj.id == OBJ_SCENERY_CO_DOORS) ||
|
|
|
|
(this->obj.id == OBJ_SCENERY_CO_ARCH_1) || (this->obj.id == OBJ_SCENERY_CO_ARCH_2) ||
|
|
|
|
(this->obj.id == OBJ_SCENERY_CO_ARCH_3)) {
|
|
|
|
gSprites[i].obj.rot.y = this->obj.rot.y;
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-04-09 01:25:56 +03:00
|
|
|
gSprites[i].obj.rot.y = 44.9f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
Object_SetInfo(&gSprites[i].info, gSprites[i].obj.id);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
void Scenery_CoStoneArch_Init(CoStoneArch* this, f32* hitboxData) {
|
2023-11-18 18:44:33 +03:00
|
|
|
s32 i;
|
2023-12-20 22:32:50 +03:00
|
|
|
Item* item;
|
2023-11-18 18:44:33 +03:00
|
|
|
|
2023-12-20 22:32:50 +03:00
|
|
|
for (i = 0, item = gItems; i < ARRAY_COUNT(gItems); i++, item++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (item->obj.status == OBJ_FREE) {
|
2023-12-20 22:32:50 +03:00
|
|
|
Item_Initialize(&gItems[i]);
|
2024-01-21 23:42:06 +03:00
|
|
|
item->obj.status = OBJ_INIT;
|
2024-04-09 01:25:56 +03:00
|
|
|
item->obj.id = OBJ_ITEM_RING_CHECK;
|
2024-07-06 15:47:49 +03:00
|
|
|
item->obj.pos.x = this->obj.pos.x;
|
|
|
|
item->obj.pos.y = this->obj.pos.y;
|
|
|
|
item->obj.pos.z = this->obj.pos.z;
|
|
|
|
item->obj.rot.y = this->obj.rot.y;
|
2023-12-20 22:32:50 +03:00
|
|
|
Object_SetInfo(&item->info, item->obj.id);
|
|
|
|
item->info.hitbox = SEGMENTED_TO_VIRTUAL(hitboxData);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
// Unused
|
2024-04-03 02:20:08 +03:00
|
|
|
void func_enmy_80063F4C(s32 arg0) {
|
2024-08-12 17:58:54 +03:00
|
|
|
/* Unimplemented */
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
void func_enmy_80063F58(Item* item) {
|
2024-05-02 23:46:51 +03:00
|
|
|
item->width = item->obj.rot.z * 100.0f;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
void func_enmy_80063F74(Item* item) {
|
2024-05-02 23:46:51 +03:00
|
|
|
item->width = item->obj.rot.z * 100.0f;
|
2023-11-16 05:14:33 +03:00
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-01-03 00:33:26 +03:00
|
|
|
void Object_Init(s32 index, ObjectId objId) {
|
2024-08-12 17:58:54 +03:00
|
|
|
s32 i;
|
|
|
|
s32 j;
|
|
|
|
f32 xRot;
|
|
|
|
f32 zRot;
|
2023-11-18 18:44:33 +03:00
|
|
|
f32 sp4C;
|
2023-12-19 17:54:50 +03:00
|
|
|
PosRot* var_v0;
|
2023-11-18 18:44:33 +03:00
|
|
|
|
2023-12-14 17:41:43 +03:00
|
|
|
switch (objId) {
|
2024-04-09 01:25:56 +03:00
|
|
|
case OBJ_SPRITE_CO_SMOKE:
|
2024-07-06 15:47:49 +03:00
|
|
|
Effect_SpawnTimedSfxAtPos(&gSprites[index].obj.pos, NA_SE_OB_SMOKE);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_TI_GREAT_FOX:
|
2024-05-06 04:07:32 +03:00
|
|
|
AUDIO_PLAY_SFX(NA_SE_GREATFOX_ENGINE, gActors[index].sfxSource, 0);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
case OBJ_SCENERY_CO_WATERFALL:
|
2024-05-06 04:07:32 +03:00
|
|
|
AUDIO_PLAY_SFX(NA_SE_FALL, gScenery[index].sfxSource, 0);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-04-05 23:11:36 +03:00
|
|
|
case OBJ_ACTOR_TEAM_BOSS:
|
|
|
|
ActorTeamBoss_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ZO_BIRD:
|
2024-01-14 01:45:37 +03:00
|
|
|
gActors[index].fwork[10] = fabsf(Math_ModF(gActors[index].obj.pos.x, 100.0f));
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ZO_BARRIER:
|
|
|
|
Zoness_ZoBarrier_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-01-13 16:43:04 +03:00
|
|
|
case OBJ_EFFECT_368:
|
2023-12-14 17:41:43 +03:00
|
|
|
if (gCurrentLevel == LEVEL_TITANIA) {
|
2024-08-12 17:58:54 +03:00
|
|
|
Ground_801B6E20(gEffects[index].obj.pos.x, gEffects[index].obj.pos.z + gPathProgress, &xRot, &sp4C,
|
|
|
|
&zRot);
|
2024-01-13 16:43:04 +03:00
|
|
|
gEffects[index].obj.pos.y = sp4C + 3.0f;
|
2024-08-12 17:58:54 +03:00
|
|
|
gEffects[index].obj.rot.x = RAD_TO_DEG(xRot);
|
|
|
|
gEffects[index].obj.rot.z = RAD_TO_DEG(zRot);
|
2023-12-14 17:41:43 +03:00
|
|
|
} else if (gCurrentLevel == LEVEL_MACBETH) {
|
2024-01-21 23:42:06 +03:00
|
|
|
gEffects[index].obj.status = OBJ_FREE;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-05-02 23:46:51 +03:00
|
|
|
case OBJ_SCENERY_TI_RIB_0:
|
2024-08-12 17:58:54 +03:00
|
|
|
Scenery_CoStoneArch_Init(&gScenery[index], D_TI_6006940);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-05-02 23:46:51 +03:00
|
|
|
case OBJ_SCENERY_TI_RIB_1:
|
2024-08-12 17:58:54 +03:00
|
|
|
Scenery_CoStoneArch_Init(&gScenery[index], D_TI_600695C);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-05-02 23:46:51 +03:00
|
|
|
case OBJ_SCENERY_TI_RIB_2:
|
2024-08-12 17:58:54 +03:00
|
|
|
Scenery_CoStoneArch_Init(&gScenery[index], D_TI_6006978);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-05-02 23:46:51 +03:00
|
|
|
case OBJ_SCENERY_TI_RIB_3:
|
2024-08-12 17:58:54 +03:00
|
|
|
Scenery_CoStoneArch_Init(&gScenery[index], D_TI_6006994);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-05-02 23:46:51 +03:00
|
|
|
case OBJ_SCENERY_TI_RIB_4:
|
2024-08-12 17:58:54 +03:00
|
|
|
Scenery_CoStoneArch_Init(&gScenery[index], D_TI_60069B0);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-05-02 23:46:51 +03:00
|
|
|
case OBJ_SCENERY_TI_RIB_5:
|
2024-08-12 17:58:54 +03:00
|
|
|
Scenery_CoStoneArch_Init(&gScenery[index], D_TI_60069CC);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-05-02 23:46:51 +03:00
|
|
|
case OBJ_SCENERY_TI_RIB_6:
|
2024-08-12 17:58:54 +03:00
|
|
|
Scenery_CoStoneArch_Init(&gScenery[index], D_TI_60069E8);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-05-02 23:46:51 +03:00
|
|
|
case OBJ_SCENERY_TI_RIB_7:
|
2024-08-12 17:58:54 +03:00
|
|
|
Scenery_CoStoneArch_Init(&gScenery[index], D_TI_6006A04);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-05-02 23:46:51 +03:00
|
|
|
case OBJ_SCENERY_TI_RIB_8:
|
2024-08-12 17:58:54 +03:00
|
|
|
Scenery_CoStoneArch_Init(&gScenery[index], D_TI_6006A20);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_SCENERY_CO_RADAR_DISH:
|
|
|
|
Actor_CoRadar_Init(&gScenery[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2023-12-20 22:32:50 +03:00
|
|
|
case OBJ_ITEM_CHECKPOINT:
|
2024-04-26 01:01:25 +03:00
|
|
|
if (gSavedObjectLoadIndex != 0) {
|
2024-01-21 23:42:06 +03:00
|
|
|
gItems[index].obj.status = OBJ_FREE;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2023-12-20 22:32:50 +03:00
|
|
|
case OBJ_ITEM_METEO_WARP:
|
2024-04-09 01:25:56 +03:00
|
|
|
if (gRingPassCount < 0) {
|
2024-01-21 23:42:06 +03:00
|
|
|
gItems[index].obj.status = OBJ_FREE;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-04-09 01:25:56 +03:00
|
|
|
case OBJ_ITEM_PATH_SPLIT_Y:
|
|
|
|
case OBJ_ITEM_PATH_TURN_UP:
|
|
|
|
case OBJ_ITEM_PATH_TURN_DOWN:
|
2024-04-03 02:20:08 +03:00
|
|
|
func_enmy_80063F74(&gItems[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-04-09 01:25:56 +03:00
|
|
|
case OBJ_ITEM_PATH_SPLIT_X:
|
|
|
|
case OBJ_ITEM_PATH_TURN_LEFT:
|
2024-04-03 02:20:08 +03:00
|
|
|
func_enmy_80063F58(&gItems[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-04-09 01:25:56 +03:00
|
|
|
case OBJ_ITEM_PATH_TURN_RIGHT:
|
|
|
|
if (((gRingPassCount >= 7) && (gCurrentLevel == LEVEL_CORNERIA) && (gTeamShields[TEAM_ID_FALCO] > 0)) ||
|
2023-12-14 17:41:43 +03:00
|
|
|
(gCurrentLevel != LEVEL_CORNERIA)) {
|
2024-04-03 02:20:08 +03:00
|
|
|
func_enmy_80063F58(&gItems[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-01-21 23:42:06 +03:00
|
|
|
gItems[index].obj.status = OBJ_FREE;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
case OBJ_SCENERY_CO_STONE_ARCH:
|
2024-08-12 17:58:54 +03:00
|
|
|
Scenery_CoStoneArch_Init(&gScenery[index], gItemRingCheckHitbox);
|
2023-11-18 18:44:33 +03:00
|
|
|
/* fallthrough */
|
2024-07-06 15:47:49 +03:00
|
|
|
case OBJ_SCENERY_CO_HIGHWAY_1:
|
|
|
|
case OBJ_SCENERY_CO_HIGHWAY_2:
|
|
|
|
case OBJ_SCENERY_CO_ARCH_1:
|
|
|
|
case OBJ_SCENERY_CO_ARCH_2:
|
|
|
|
case OBJ_SCENERY_CO_ARCH_3:
|
|
|
|
case OBJ_SCENERY_CO_DOORS:
|
2024-08-12 17:58:54 +03:00
|
|
|
Scenery_Corneria_Init(&gScenery[index]);
|
2023-12-19 17:54:50 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ME_LASER_CANNON_2:
|
2024-01-14 01:45:37 +03:00
|
|
|
gActors[index].fwork[0] = gActors[index].obj.pos.x;
|
|
|
|
gActors[index].fwork[1] = gActors[index].obj.pos.y;
|
|
|
|
gActors[index].obj.rot.z = gActors[index].obj.rot.x;
|
|
|
|
gActors[index].obj.rot.x = 0.0f;
|
2023-12-19 17:54:50 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ME_METEOR_2:
|
|
|
|
case OBJ_ACTOR_ME_LASER_CANNON_1:
|
2024-01-14 01:45:37 +03:00
|
|
|
gActors[index].unk_046 = gFogRed;
|
|
|
|
gActors[index].unk_048 = gFogNear;
|
2024-01-29 00:27:23 +03:00
|
|
|
gActors[index].obj.rot.x = RAND_FLOAT(360.0f);
|
|
|
|
gActors[index].obj.rot.y = RAND_FLOAT(360.0f);
|
2023-12-19 17:54:50 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ME_METEOR_1:
|
2024-01-29 00:27:23 +03:00
|
|
|
gActors[index].obj.rot.x = RAND_FLOAT(360.0f);
|
|
|
|
gActors[index].obj.rot.y = RAND_FLOAT(360.0f);
|
2024-01-21 23:42:06 +03:00
|
|
|
gActors[index].health = 200;
|
2023-12-19 17:54:50 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ME_HOPBOT:
|
2024-01-21 23:42:06 +03:00
|
|
|
gActors[index].health = 30;
|
2023-12-19 17:54:50 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ZO_RADARBUOY:
|
2024-01-14 01:45:37 +03:00
|
|
|
if (gPlayer[0].pos.z < gActors[index].obj.pos.z) {
|
2024-03-01 21:57:44 +03:00
|
|
|
Object_Kill(&gActors[index].obj, gActors[index].sfxSource);
|
2023-12-19 17:54:50 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ZO_DODORA_WP_COUNT:
|
|
|
|
gActors[index].iwork[0] = gZoDodoraWaypointCount;
|
|
|
|
gZoDodoraWaypointCount++;
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ZO_DODORA:
|
|
|
|
gZoDodoraWaypointCount = 0;
|
2024-05-11 23:53:37 +03:00
|
|
|
gActors[index].rot_0F4.x = gActors[index].obj.rot.x;
|
|
|
|
gActors[index].rot_0F4.y = gActors[index].obj.rot.y;
|
2024-01-14 01:45:37 +03:00
|
|
|
gActors[index].obj.rot.x = gActors[index].obj.rot.y = 0.0f;
|
|
|
|
gActors[index].fwork[2] = gActors[index].obj.pos.y;
|
2024-08-12 17:58:54 +03:00
|
|
|
var_v0 = gZoDodoraPosRots;
|
|
|
|
for (i = 0; i < 200; i++, var_v0++) {
|
2024-01-14 01:45:37 +03:00
|
|
|
var_v0->pos.x = gActors[index].obj.pos.x;
|
|
|
|
var_v0->pos.y = gActors[index].obj.pos.y;
|
|
|
|
var_v0->pos.z = gActors[index].obj.pos.z;
|
|
|
|
var_v0->rot.x = gActors[index].obj.rot.x;
|
|
|
|
var_v0->rot.y = gActors[index].obj.rot.y;
|
|
|
|
var_v0->rot.z = gActors[index].obj.rot.z;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ME_MORA:
|
2024-01-14 01:45:37 +03:00
|
|
|
gActors[index].unk_046 = 100;
|
2024-08-12 17:58:54 +03:00
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
if (gMeMoraStatus[i] == 0) {
|
|
|
|
gMeMoraStatus[i] = 1;
|
|
|
|
gActors[index].unk_046 = i;
|
|
|
|
for (j = 0; j < 100; j++) {
|
|
|
|
gMeMoraYpos[i][j] = gActors[index].obj.pos.y;
|
|
|
|
gMeMoraZpos[i][j] = gActors[index].obj.pos.z;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2024-01-14 01:45:37 +03:00
|
|
|
if (gActors[index].unk_046 == 100) {
|
2024-01-21 23:42:06 +03:00
|
|
|
gActors[index].obj.status = OBJ_FREE;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
case OBJ_MISSILE_SEEK_TEAM:
|
|
|
|
case OBJ_MISSILE_SEEK_PLAYER:
|
2024-05-06 04:07:32 +03:00
|
|
|
AUDIO_PLAY_SFX(NA_SE_EN_MISSILE_ENGINE, gActors[index].sfxSource, 4);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_CO_SKIBOT:
|
2024-05-11 23:53:37 +03:00
|
|
|
gActors[index].drawShadow = true;
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_BOSS_AND_ANDROSS:
|
|
|
|
Andross_AndAndross_Init(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_BOSS_KA_SAUCERER:
|
|
|
|
Katina_KaSaucerer_Init(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_BOSS_SY_SHOGUN:
|
|
|
|
SectorY_SyShogun_Init(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_MA_LOCOMOTIVE:
|
|
|
|
case OBJ_ACTOR_MA_TRAIN_CAR_1:
|
|
|
|
case OBJ_ACTOR_MA_TRAIN_CAR_2:
|
|
|
|
case OBJ_ACTOR_MA_TRAIN_CAR_3:
|
|
|
|
case OBJ_ACTOR_MA_TRAIN_CAR_4:
|
|
|
|
case OBJ_ACTOR_MA_TRAIN_CAR_5:
|
|
|
|
case OBJ_ACTOR_MA_TRAIN_CAR_6:
|
|
|
|
case OBJ_ACTOR_MA_TRAIN_CAR_7:
|
|
|
|
Macbeth_Train_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-01-14 01:45:37 +03:00
|
|
|
case OBJ_ACTOR_207:
|
2024-08-12 17:58:54 +03:00
|
|
|
Macbeth_Actor207_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_MA_RAILROAD_SWITCH:
|
|
|
|
Macbeth_MaMaRailroadSwitch_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_MA_BOULDER:
|
|
|
|
Macbeth_MaBoulder_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_MA_RAILWAY_SIGNAL:
|
|
|
|
Macbeth_MaRailwaySignal_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_MA_HORIZONTAL_LOCK_BAR:
|
|
|
|
case OBJ_ACTOR_MA_VERTICAL_LOCK_BAR:
|
|
|
|
Macbeth_LockBars_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_MA_BARRIER:
|
|
|
|
Macbeth_MaBarrier_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_SCENERY_MA_PROXIMITY_LIGHT:
|
|
|
|
Macbeth_MaProximityLight_Init(&gScenery[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
case OBJ_ACTOR_CO_GARUDA_2:
|
|
|
|
case OBJ_ACTOR_CO_GARUDA_3:
|
2024-08-12 17:58:54 +03:00
|
|
|
Corneria_CoIBeam_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
/* fallthrough */
|
2024-07-06 15:47:49 +03:00
|
|
|
case OBJ_ACTOR_CO_GARUDA_1:
|
2024-01-21 23:42:06 +03:00
|
|
|
gActors[index].health = 24;
|
2024-05-06 04:07:32 +03:00
|
|
|
AUDIO_PLAY_SFX(NA_SE_EN_TANK_RB_ENGINE, gActors[index].sfxSource, 4);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_BOSS_ME_CRUSHER:
|
|
|
|
Meteo_MeCrusher_Init(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_BOSS_UNK_299:
|
2024-04-05 23:11:36 +03:00
|
|
|
Boss299_Init(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_BOSS_UNK_300:
|
2024-04-05 23:11:36 +03:00
|
|
|
Boss300_Init(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
case OBJ_BOSS_CO_GRANGA:
|
|
|
|
Corneria_Granga_Init(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
case OBJ_BOSS_CO_CARRIER:
|
2024-08-12 17:58:54 +03:00
|
|
|
Corneria_CoCarrier_Init(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_BOSS_A6_GORGON:
|
|
|
|
Area6_A6Gorgon_Init(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_TI_BOMB:
|
|
|
|
Titania_TiBomb_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_TI_RASCO:
|
|
|
|
Titania_TiRasco_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_TI_FEKUDA:
|
|
|
|
Titania_TiFekuda_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_TI_DESERT_CRAWLER:
|
|
|
|
Titania_TiDesertCrawler_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_TI_DELPHOR:
|
|
|
|
Titania_TiDelphor_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_TI_DELPHOR_HEAD:
|
|
|
|
Titania_TiDelphorHead_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-04-09 01:25:56 +03:00
|
|
|
case OBJ_SPRITE_TI_CACTUS:
|
2024-08-12 17:58:54 +03:00
|
|
|
Titania_TiCactus_Init(&gSprites[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_BOSS_TI_GORAS:
|
|
|
|
Titania_TiGoras_Init(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ZO_Z_GULL:
|
|
|
|
Zoness_ZoEnergyBall_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ZO_ENERGY_BALL:
|
|
|
|
Zoness_ZoEnergyBall_Init2(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_BOSS_ZO_SARUMARINE:
|
|
|
|
Zoness_ZoSarumarine_Init(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ZO_CARGOSHIP:
|
|
|
|
Zoness_ZoCargoShip_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ZO_CONTAINER:
|
|
|
|
Zoness_ZoContainer_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ZO_SUPPLYCRANE:
|
|
|
|
Zoness_ZoSupplyCrane_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-01-14 01:45:37 +03:00
|
|
|
case OBJ_ACTOR_255:
|
2024-08-12 17:58:54 +03:00
|
|
|
Aquas_Actor255_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-01-14 01:45:37 +03:00
|
|
|
case OBJ_ACTOR_256:
|
2024-08-12 17:58:54 +03:00
|
|
|
Aquas_Actor256_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-01-14 01:45:37 +03:00
|
|
|
case OBJ_ACTOR_257:
|
2024-08-12 17:58:54 +03:00
|
|
|
Aquas_Actor257_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_BOSS_AQ_BACOON:
|
|
|
|
Aquas_AqBacoon_Init(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_AQ_ANGLERFISH:
|
|
|
|
Aquas_AqAnglerFish_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_AQ_SPINDLYFISH:
|
|
|
|
Aquas_AqSpindlyFish_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_AQ_GAROA:
|
|
|
|
Aquas_AqGaroa_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_SCENERY_TI_PILLAR:
|
|
|
|
Titania_TiPillar_Init(&gScenery[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_BOSS_VE1_GOLEMECH:
|
|
|
|
Venom1_Ve1Golemech_Init(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_VE1_PILLAR_1:
|
|
|
|
Venom1_Ve1Pillar1_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_VE1_PILLAR_2:
|
|
|
|
case OBJ_ACTOR_VE1_PILLAR_3:
|
|
|
|
Venom1_Ve1Pillar2_3_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_VE1_PILLAR_4:
|
|
|
|
Venom1_Ve1Pillar4_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_VE1_MONKEY_STATUE:
|
|
|
|
Venom1_Ve1MonkeyStatue_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_AQ_BOULDER:
|
|
|
|
Venom1_AqBoulder_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_AQ_JELLYFISH:
|
|
|
|
Venom1_AqJellyfish_Init(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Scenery_UpdateTitaniaBones(Scenery* this) {
|
2023-11-18 18:44:33 +03:00
|
|
|
f32 sp2C;
|
|
|
|
f32 sp28;
|
|
|
|
f32 sp24;
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
if ((gGroundType == 4) && (this->state == 0)) {
|
|
|
|
Ground_801B6E20(this->obj.pos.x, this->obj.pos.z + gPathProgress, &sp2C, &sp24, &sp28);
|
|
|
|
this->obj.pos.y = sp24 + 3.0f;
|
|
|
|
this->obj.rot.x = RAD_TO_DEG(sp2C);
|
|
|
|
this->obj.rot.z = RAD_TO_DEG(sp28);
|
|
|
|
this->state++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
void func_enmy_80065380(MeMeteor2* this, f32 xPos, f32 yPos, f32 zPos, f32 arg4, f32 arg5, f32 arg6) {
|
2024-07-06 15:47:49 +03:00
|
|
|
Actor_Initialize(this);
|
|
|
|
this->obj.status = OBJ_ACTIVE;
|
2024-08-12 17:58:54 +03:00
|
|
|
this->obj.id = OBJ_ACTOR_ME_METEOR_2;
|
2024-07-06 15:47:49 +03:00
|
|
|
this->timer_0BC = RAND_INT(10.0f) + 10;
|
|
|
|
this->timer_0C2 = 30;
|
|
|
|
this->vel.x = arg4;
|
|
|
|
this->vel.y = arg5;
|
|
|
|
this->vel.z = arg6;
|
|
|
|
this->obj.pos.x = xPos;
|
|
|
|
this->obj.pos.y = yPos;
|
|
|
|
this->obj.pos.z = zPos;
|
|
|
|
this->unk_046 = 255;
|
|
|
|
this->unk_048 = 900;
|
|
|
|
this->obj.rot.z = RAND_FLOAT(360.0f);
|
|
|
|
this->obj.rot.y = RAND_FLOAT(360.0f);
|
|
|
|
Object_SetInfo(&this->info, this->obj.id);
|
2023-12-19 17:54:50 +03:00
|
|
|
}
|
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
void func_enmy_8006546C(f32 xPos, f32 yPos, f32 zPos, f32 arg3, f32 arg4, f32 arg5) {
|
2023-11-18 18:44:33 +03:00
|
|
|
s32 i;
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-01-14 01:45:37 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gActors); i++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gActors[i].obj.status == OBJ_FREE) {
|
2024-04-03 02:20:08 +03:00
|
|
|
func_enmy_80065380(&gActors[i], xPos, yPos, zPos, arg3, arg4, arg5);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
void func_enmy_800654E4(Object* obj) {
|
2023-11-18 18:44:33 +03:00
|
|
|
f32 temp_fs0;
|
|
|
|
f32 temp_fs1;
|
2024-08-12 17:58:54 +03:00
|
|
|
s32 i;
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
func_effect_8007D2C8(obj->pos.x, obj->pos.y, obj->pos.z, 12.0f);
|
2024-08-12 17:58:54 +03:00
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
2024-04-03 02:20:08 +03:00
|
|
|
func_enmy_8006546C(obj->pos.x, obj->pos.y, obj->pos.z, RAND_FLOAT_CENTERED(40.0f), RAND_FLOAT_CENTERED(40.0f),
|
|
|
|
RAND_FLOAT(-20.0f));
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
void func_enmy_800655C8(ActorMissileSeekTeam* this, f32 xPos, f32 yPos, f32 zPos, s32 eventType) {
|
2024-07-06 15:47:49 +03:00
|
|
|
Actor_Initialize(this);
|
|
|
|
this->obj.status = OBJ_INIT;
|
|
|
|
this->obj.id = OBJ_MISSILE_SEEK_TEAM;
|
|
|
|
this->obj.pos.x = xPos;
|
|
|
|
this->obj.pos.y = yPos;
|
|
|
|
this->obj.pos.z = zPos;
|
2024-08-12 17:58:54 +03:00
|
|
|
this->eventType = eventType;
|
2024-07-06 15:47:49 +03:00
|
|
|
this->timer_0BE = 50;
|
|
|
|
if (this->eventType == 1) {
|
|
|
|
this->timer_0BE = 30;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
this->fwork[5] = 15.0f;
|
|
|
|
Object_SetInfo(&this->info, this->obj.id);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
void func_enmy_8006566C(f32 xPos, f32 yPos, f32 zPos, s32 arg3) {
|
2023-11-18 18:44:33 +03:00
|
|
|
s32 i;
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-01-14 01:45:37 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gActors); i++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gActors[i].obj.status == OBJ_FREE) {
|
2024-04-03 02:20:08 +03:00
|
|
|
func_enmy_800655C8(&gActors[i], xPos, yPos, zPos, arg3);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
void ActorMissileSeek_Update(Actor* this) {
|
2024-02-12 03:47:23 +03:00
|
|
|
s32 i;
|
|
|
|
s32 j;
|
2023-11-18 18:44:33 +03:00
|
|
|
f32 spD4;
|
|
|
|
f32 spD0;
|
|
|
|
f32 spCC;
|
2024-02-12 03:47:23 +03:00
|
|
|
f32 var_fv0;
|
2023-11-18 18:44:33 +03:00
|
|
|
s32 spC4;
|
2024-02-12 03:47:23 +03:00
|
|
|
s32 var_ra;
|
2023-11-18 18:44:33 +03:00
|
|
|
s32 spB4[3];
|
|
|
|
s32 spA8[3];
|
2024-02-12 03:47:23 +03:00
|
|
|
s32 temp_a3_2;
|
2023-11-18 18:44:33 +03:00
|
|
|
Vec3f sp98;
|
|
|
|
Vec3f sp8C;
|
|
|
|
f32 sp88;
|
|
|
|
f32 sp84;
|
|
|
|
f32 sp80;
|
|
|
|
f32 sp7C;
|
|
|
|
f32 sp78;
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-02-12 03:47:23 +03:00
|
|
|
var_ra = (gLevelMode == LEVELMODE_ALL_RANGE) ? 2 : 0;
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
if (this->iwork[2] == 0) {
|
|
|
|
if (this->obj.id == OBJ_MISSILE_SEEK_TEAM) {
|
2024-02-12 03:47:23 +03:00
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
spB4[i] = gTeamShields[i + 1];
|
|
|
|
spA8[i] = var_ra + i;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-02-12 03:47:23 +03:00
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
for (j = i + 1; j < 3; j++) {
|
|
|
|
if (spB4[i] < spB4[j]) {
|
|
|
|
temp_a3_2 = spB4[j];
|
|
|
|
spB4[j] = spB4[i];
|
|
|
|
spB4[i] = temp_a3_2;
|
|
|
|
temp_a3_2 = spA8[j];
|
|
|
|
spA8[j] = spA8[i];
|
|
|
|
spA8[i] = temp_a3_2;
|
|
|
|
}
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-01-17 18:36:58 +03:00
|
|
|
switch (gGameFrameCount % 6U) {
|
2023-11-18 18:44:33 +03:00
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
spC4 = spA8[2];
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
spC4 = spA8[1];
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
spC4 = spA8[0];
|
|
|
|
break;
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2023-12-24 22:28:35 +03:00
|
|
|
if (gLevelMode == LEVELMODE_ALL_RANGE) {
|
2023-12-20 22:32:50 +03:00
|
|
|
if (gTeamShields[spC4 - 1] > 0) {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->iwork[1] = spC4;
|
2023-12-14 20:58:53 +03:00
|
|
|
goto label;
|
|
|
|
} else {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->iwork[1] = 10000;
|
2023-12-14 20:58:53 +03:00
|
|
|
}
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2023-12-20 22:32:50 +03:00
|
|
|
if (gTeamShields[spC4 + 1] > 0) {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->iwork[1] = spC4;
|
2023-12-14 20:58:53 +03:00
|
|
|
goto label;
|
|
|
|
} else {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->iwork[1] = 10000;
|
2023-12-14 20:58:53 +03:00
|
|
|
}
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
this->iwork[1] = 10000;
|
2023-12-14 20:58:53 +03:00
|
|
|
label:
|
2024-07-06 15:47:49 +03:00
|
|
|
this->iwork[2] = 1;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
spC4 = this->iwork[1];
|
2023-11-18 18:44:33 +03:00
|
|
|
if ((spC4 == var_ra) || ((var_ra + 1) == spC4) || ((var_ra + 2) == spC4)) {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->fwork[29] = gActors[spC4].obj.pos.z;
|
|
|
|
this->fwork[28] = gActors[spC4].obj.pos.y;
|
|
|
|
this->fwork[27] = gActors[spC4].obj.pos.x;
|
|
|
|
if ((fabsf(this->obj.pos.x - gActors[spC4].obj.pos.x) < 400.0f) &&
|
|
|
|
(fabsf(this->obj.pos.z - gActors[spC4].obj.pos.z) < 400.0f)) {
|
2024-01-29 00:27:23 +03:00
|
|
|
if (RAND_FLOAT(spC4 - 1) < 0.6f) {
|
2024-02-12 03:47:23 +03:00
|
|
|
gActors[spC4].iwork[10] = 1;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->fwork[29] = gPlayer[0].trueZpos;
|
|
|
|
this->fwork[28] = gPlayer[0].pos.y;
|
|
|
|
this->fwork[27] = gPlayer[0].pos.x;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
if (this->timer_0BC != 0) {
|
|
|
|
Math_SmoothStepToAngle(&this->obj.rot.x, 0.0f, 0.3f, 4.0f, 0.001f);
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-07-06 15:47:49 +03:00
|
|
|
if ((this->iwork[10] == 0) && ((fabsf(this->fwork[27] - this->obj.pos.x) > 300.0f) ||
|
|
|
|
(fabsf(this->fwork[29] - this->obj.pos.z) > 300.0f))) {
|
|
|
|
this->fwork[0] += 5.0f;
|
|
|
|
this->fwork[1] += 8.0f;
|
|
|
|
sp88 = this->fwork[27] - this->obj.pos.x;
|
|
|
|
sp80 = this->fwork[29] - this->obj.pos.z;
|
2024-02-12 03:47:23 +03:00
|
|
|
sp80 = sqrtf(SQ(sp88) + SQ(sp80)) * 0.2f;
|
2024-07-06 15:47:49 +03:00
|
|
|
if (this->eventType == 1) {
|
2023-11-18 18:44:33 +03:00
|
|
|
sp80 = 0.1f;
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
spD0 = SIN_DEG(this->fwork[0]) * sp80;
|
|
|
|
sp88 = COS_DEG(this->fwork[1]) * sp80;
|
|
|
|
spD4 = COS_DEG(this->obj.rot.y) * sp88;
|
|
|
|
spCC = -SIN_DEG(this->obj.rot.y) * sp88;
|
2024-02-12 03:47:23 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
sp88 = (this->fwork[27] + spD4) - this->obj.pos.x;
|
|
|
|
sp84 = (this->fwork[28] + spD0) - this->obj.pos.y;
|
|
|
|
sp80 = (this->fwork[29] + spCC) - this->obj.pos.z;
|
2023-11-30 05:44:42 +03:00
|
|
|
sp78 = Math_RadToDeg(Math_Atan2F(sp88, sp80));
|
2024-02-12 03:47:23 +03:00
|
|
|
sp80 = sqrtf(SQ(sp88) + SQ(sp80));
|
|
|
|
sp7C = Math_RadToDeg(-Math_Atan2F(sp84, sp80));
|
2024-07-06 15:47:49 +03:00
|
|
|
sp84 = Math_SmoothStepToAngle(&this->obj.rot.y, sp78, 0.3f, 4.0f, 0.001f);
|
|
|
|
Math_SmoothStepToAngle(&this->obj.rot.x, sp7C, 0.3f, 4.0f, 0.001f);
|
2024-01-14 01:45:37 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
if ((fabsf(this->fwork[27] - this->obj.pos.x) < 60.0f) && (fabsf(this->fwork[28] - this->obj.pos.y) < 60.0f) &&
|
|
|
|
(fabsf(this->fwork[29] - this->obj.pos.z) < 60.0f) && ((spC4 == 2) || (spC4 == 3) || (spC4 == 4))) {
|
2024-05-05 00:24:24 +03:00
|
|
|
gActors[spC4].dmgType = DMG_BEAM;
|
2024-01-21 23:42:06 +03:00
|
|
|
gActors[spC4].damage = 20;
|
2024-05-05 00:24:24 +03:00
|
|
|
gActors[spC4].dmgSource = DMG_SRC_2;
|
2024-07-06 15:47:49 +03:00
|
|
|
Effect_SpawnTimedSfxAtPos(&this->obj.pos, NA_SE_EN_EXPLOSION_S);
|
|
|
|
func_effect_8007D2C8(this->obj.pos.x, this->obj.pos.y, this->obj.pos.z, 5.0f);
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Math_Vec3fFromAngles(&sp98, this->obj.rot.x, this->obj.rot.y, this->fwork[5]);
|
|
|
|
|
|
|
|
this->vel.x = sp98.x;
|
|
|
|
this->vel.y = sp98.y;
|
|
|
|
this->vel.z = sp98.z - gPathVelZ;
|
|
|
|
|
|
|
|
if (this->eventType == 0) {
|
|
|
|
this->obj.rot.z += 5.0f;
|
|
|
|
}
|
|
|
|
if (this->eventType == 1) {
|
|
|
|
if (this->timer_0BE == 0) {
|
|
|
|
this->timer_0BE = 30;
|
|
|
|
Math_Vec3fFromAngles(&sp98, this->obj.rot.x, this->obj.rot.y, 120.0f);
|
|
|
|
func_effect_8007F04C(OBJ_EFFECT_ENEMY_LASER_1, this->obj.pos.x + sp98.x, this->obj.pos.y + sp98.y,
|
|
|
|
this->obj.pos.z + sp98.z, this->obj.rot.x, this->obj.rot.y, this->obj.rot.z, 0.0f,
|
2024-04-09 01:25:56 +03:00
|
|
|
0.0f, 0.0f, sp98.x, sp98.y, sp98.z, 1.0f);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
var_fv0 = 330.0f;
|
|
|
|
if (sp84 < 0.0f) {
|
|
|
|
var_fv0 = 30.0f;
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
Math_SmoothStepToAngle(&this->obj.rot.z, var_fv0, 0.1f, 3.0f, 0.01f);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((gGroundType == 4) && Ground_801B6AEC(this->obj.pos.x, this->obj.pos.y, this->obj.pos.z + gPathProgress)) {
|
|
|
|
func_effect_8007D2C8(this->obj.pos.x, this->obj.pos.y, this->obj.pos.z, 5.0f);
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
|
|
|
}
|
|
|
|
|
|
|
|
sp8C.x = this->vel.x;
|
|
|
|
sp8C.y = this->vel.y;
|
|
|
|
sp8C.z = this->vel.z;
|
|
|
|
|
|
|
|
if ((Object_CheckCollision(this->index, &this->obj.pos, &sp8C, 1) != 0) || (this->dmgType != DMG_NONE) ||
|
|
|
|
(this->obj.pos.y < (gGroundHeight + 10.0f)) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE)) {
|
|
|
|
func_effect_8007D2C8(this->obj.pos.x, this->obj.pos.y, this->obj.pos.z, 3.0f);
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
|
|
|
if (this->dmgType != DMG_NONE) {
|
|
|
|
this->itemDrop = DROP_SILVER_RING_50p;
|
2023-12-14 17:41:43 +03:00
|
|
|
if ((gCurrentLevel == LEVEL_CORNERIA)) {
|
2023-12-24 22:28:35 +03:00
|
|
|
if (gLevelMode == LEVELMODE_ALL_RANGE) {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->itemDrop = DROP_SILVER_RING_50p;
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->itemDrop = DROP_SILVER_RING_25p;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2023-12-14 17:41:43 +03:00
|
|
|
if (gCurrentLevel == LEVEL_AREA_6) {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->itemDrop = DROP_SILVER_RING_10p;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
Actor_Despawn(this);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
Effect_SpawnTimedSfxAtPos(&this->obj.pos, NA_SE_EN_EXPLOSION_S);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-12-24 22:28:35 +03:00
|
|
|
if (gLevelMode == LEVELMODE_ON_RAILS) {
|
2024-07-06 15:47:49 +03:00
|
|
|
if (fabsf(this->obj.pos.z - gPlayer[0].trueZpos) < 100.0f) {
|
|
|
|
this->iwork[10] = 1;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
if (gPlayer[0].cam.eye.z < (this->obj.pos.z + gPathProgress)) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void func_enmy_800660F0(Actor* this) {
|
|
|
|
Item* item;
|
2023-11-18 18:44:33 +03:00
|
|
|
s32 i;
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
for (item = &gItems[0], i = 0; i < ARRAY_COUNT(gItems); i++, item++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (item->obj.status == OBJ_FREE) {
|
2023-12-20 22:32:50 +03:00
|
|
|
Item_Initialize(item);
|
2024-01-21 23:42:06 +03:00
|
|
|
item->obj.status = OBJ_INIT;
|
2024-07-06 15:47:49 +03:00
|
|
|
item->obj.id = D_enmy_800CFDF4[this->itemDrop];
|
|
|
|
item->obj.pos.x = this->obj.pos.x;
|
|
|
|
item->obj.pos.y = this->obj.pos.y;
|
|
|
|
item->obj.pos.z = this->obj.pos.z;
|
2023-12-24 22:28:35 +03:00
|
|
|
item->timer_4A = 8;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-12-20 22:32:50 +03:00
|
|
|
Object_SetInfo(&item->info, item->obj.id);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-12-20 22:32:50 +03:00
|
|
|
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;
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-12-20 22:32:50 +03:00
|
|
|
if ((item->obj.id >= OBJ_ITEM_GOLD_RING) || (item->obj.id == OBJ_ITEM_1UP)) {
|
|
|
|
item->unk_50 = 90.0f;
|
2024-05-06 04:07:32 +03:00
|
|
|
AUDIO_PLAY_SFX(NA_SE_ITEM_APPEAR, gDefaultSfxSource, 4);
|
2023-12-24 22:28:35 +03:00
|
|
|
item->timer_48 = 1000;
|
2023-12-20 22:32:50 +03:00
|
|
|
if (item->obj.id == OBJ_ITEM_WING_REPAIR) {
|
2024-05-06 04:07:32 +03:00
|
|
|
AUDIO_PLAY_SFX(NA_SE_OB_WING, item->sfxSource, 0);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Actor_Despawn(Actor* this) {
|
2024-01-14 01:45:37 +03:00
|
|
|
Actor* otherActor;
|
2023-11-18 18:44:33 +03:00
|
|
|
s32 i;
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2023-12-20 22:32:50 +03:00
|
|
|
if (gVersusMode) {
|
2024-07-06 15:47:49 +03:00
|
|
|
if ((this->dmgSource >= 1) && (this->dmgSource < 4 + 1) && !VS_TIME_UP(gVsCountdown)) {
|
|
|
|
gPlayerScores[this->dmgSource - 1] += this->info.bonus;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
} else if (!((this->obj.id == OBJ_ACTOR_ALLRANGE) && (this->animFrame == 1))) {
|
|
|
|
if ((this->dmgSource == AI360_FOX + 1) && (this->info.bonus != 0)) {
|
|
|
|
gHitCount += this->info.bonus;
|
2024-04-03 02:20:08 +03:00
|
|
|
D_ctx_80177850 = 15;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-05 23:11:36 +03:00
|
|
|
if ((gLevelMode == LEVELMODE_ALL_RANGE) && (gDropHitCountItem != 0)) {
|
|
|
|
switch (gDropHitCountItem) {
|
2023-11-18 18:44:33 +03:00
|
|
|
case 9:
|
2023-12-14 17:41:43 +03:00
|
|
|
if (gCurrentLevel == LEVEL_KATINA) {
|
2024-01-25 16:43:39 +03:00
|
|
|
Radio_PlayMessage(gMsg_ID_18031, RCID_BILL);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
/* fallthrough */
|
|
|
|
case 4:
|
|
|
|
case 19:
|
|
|
|
case 29:
|
2024-07-06 15:47:49 +03:00
|
|
|
this->itemDrop = DROP_GOLD_RING_1;
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
|
|
|
case 14:
|
2024-07-06 15:47:49 +03:00
|
|
|
this->itemDrop = DROP_LASERS;
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
|
|
|
}
|
2024-04-05 23:11:36 +03:00
|
|
|
gDropHitCountItem = 0;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
if (this->obj.id == OBJ_ACTOR_ALLRANGE) {
|
|
|
|
if ((this->aiType >= AI360_WOLF) && (this->aiType < AI360_KATT)) {
|
|
|
|
AllRange_GetStarWolfHits(this);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
if (this->itemDrop) {
|
|
|
|
if (D_enmy_800CFE5C[this->itemDrop] < 0.0f) {
|
|
|
|
otherActor = &gActors[0];
|
2024-01-14 01:45:37 +03:00
|
|
|
for (i = 0, otherActor = gActors; i < ARRAY_COUNT(gActors); i++, otherActor++) {
|
2024-07-06 15:47:49 +03:00
|
|
|
if ((otherActor->obj.status != OBJ_FREE) && (otherActor->index != this->index) &&
|
|
|
|
(otherActor->iwork[15] == this->iwork[15])) {
|
2023-11-18 18:44:33 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
func_enmy_800660F0(this);
|
2024-05-06 04:07:32 +03:00
|
|
|
AUDIO_PLAY_SFX(NA_SE_ITEM_APPEAR, gDefaultSfxSource, 4);
|
2024-07-06 15:47:49 +03:00
|
|
|
} else if (this->itemDrop == DROP_TEAM_MESG) {
|
2024-04-09 01:25:56 +03:00
|
|
|
if (gTeamShields[TEAM_ID_PEPPY] > 0) {
|
2024-01-25 16:43:39 +03:00
|
|
|
Radio_PlayMessage(gMsg_ID_20261, RCID_PEPPY);
|
2024-04-09 01:25:56 +03:00
|
|
|
} else if (gTeamShields[TEAM_ID_SLIPPY] > 0) {
|
2024-01-25 16:43:39 +03:00
|
|
|
Radio_PlayMessage(gMsg_ID_20263, RCID_SLIPPY);
|
2024-04-09 01:25:56 +03:00
|
|
|
} else if (gTeamShields[TEAM_ID_FALCO] > 0) {
|
2024-01-25 16:43:39 +03:00
|
|
|
Radio_PlayMessage(gMsg_ID_20262, RCID_FALCO);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
} else if (Rand_ZeroOne() <= D_enmy_800CFE5C[this->itemDrop]) {
|
|
|
|
func_enmy_800660F0(this);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
void ActorSkibot_Update(ActorSkibot* this) {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->gravity = 0.4f;
|
|
|
|
|
|
|
|
if (this->obj.pos.y <= gGroundHeight + 130.0f) {
|
|
|
|
this->obj.pos.y = gGroundHeight + 130.0f;
|
|
|
|
this->vel.y = 0.0f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
this->vel.x = SIN_DEG(this->obj.rot.y) * this->fwork[0];
|
|
|
|
this->vel.z = COS_DEG(this->obj.rot.y) * this->fwork[0];
|
|
|
|
|
|
|
|
switch (this->state) {
|
2023-11-18 18:44:33 +03:00
|
|
|
case 0:
|
2024-07-06 15:47:49 +03:00
|
|
|
if (this->fwork[0] < 20.0f) {
|
|
|
|
this->fwork[0] += 0.5f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
this->animFrame++;
|
|
|
|
if (Animation_GetFrameCount(&D_CO_6029528) < this->animFrame) {
|
|
|
|
this->animFrame = 0;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
if ((this->obj.rot.z < 15.0f) && (this->animFrame < 20)) {
|
|
|
|
this->obj.rot.z += 1.0f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
if ((this->obj.rot.z > -15.0f) && (this->animFrame > 20)) {
|
|
|
|
this->obj.rot.z -= 1.0f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
if ((this->animFrame == 20) || (this->animFrame == 40)) {
|
|
|
|
this->state++;
|
|
|
|
this->timer_0BC = 20;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-11-18 18:44:33 +03:00
|
|
|
case 1:
|
2024-07-06 15:47:49 +03:00
|
|
|
if (this->obj.rot.z > 0.0f) {
|
|
|
|
this->obj.rot.z -= 0.5f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
if (this->obj.rot.z < 0.0f) {
|
|
|
|
this->obj.rot.z += 0.5f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
if (this->fwork[0] > 0.0f) {
|
|
|
|
this->fwork[0] -= 0.3f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
if (this->timer_0BC == 0) {
|
|
|
|
this->state = 0;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
this->scale = 0.8f;
|
|
|
|
|
|
|
|
if (this->dmgType != DMG_NONE) {
|
|
|
|
this->obj.status = OBJ_DYING;
|
|
|
|
this->vel.y = RAND_FLOAT(5.0f) + 6.0f;
|
|
|
|
if (this->dmgType == DMG_EXPLOSION) {
|
|
|
|
this->vel.y = -2.0f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
this->vel.z = -15.0f;
|
|
|
|
this->gravity = 0.5f;
|
|
|
|
func_effect_8007D2C8(this->obj.pos.x, this->obj.pos.y + 30.0f, this->obj.pos.z, 13.0f);
|
|
|
|
AUDIO_PLAY_SFX(NA_SE_EN_EXPLOSION_S, this->sfxSource, 4);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
void func_enmy_8006684C(ActorSkibot* this) {
|
2023-11-22 17:56:29 +03:00
|
|
|
s32 pad;
|
2023-11-18 18:44:33 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
if (this->timer_0BE != 0) {
|
|
|
|
this->vel.z = 0.0f;
|
|
|
|
this->vel.x = 0.0f;
|
|
|
|
this->vel.y = 0.0f;
|
|
|
|
if (this->timer_0BE == 1) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
|
|
|
this->itemDrop = DROP_SILVER_RING;
|
|
|
|
Actor_Despawn(this);
|
|
|
|
AUDIO_PLAY_SFX(NA_SE_EN_EXPLOSION_M, this->sfxSource, 4);
|
|
|
|
BonusText_Display(this->obj.pos.x, this->obj.pos.y + 250.0f, this->obj.pos.z, 3);
|
2023-12-14 17:41:43 +03:00
|
|
|
gHitCount += 3;
|
2024-04-03 02:20:08 +03:00
|
|
|
D_ctx_80177850 = 15;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
} else {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->obj.rot.x += 11.0f;
|
|
|
|
this->obj.rot.y += 7.0f;
|
|
|
|
if (this->vel.y < -3.0f) {
|
2024-08-12 17:58:54 +03:00
|
|
|
Effect386_Spawn1(this->obj.pos.x, this->obj.pos.y + 30.0f, this->obj.pos.z, 0.0f, 0.0f, 0.0f, 7.0f, 5);
|
2024-07-06 15:47:49 +03:00
|
|
|
this->timer_0BE = 3;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
void ActorRadar_Update(CoRadar* this) {
|
2024-07-06 15:47:49 +03:00
|
|
|
if (this->timer_0BC != 0) {
|
|
|
|
if (this->timer_0BC == 1) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
} else {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->obj.rot.y += 5.0f;
|
|
|
|
if (this->dmgType != DMG_NONE) {
|
|
|
|
func_effect_8007D0E0(this->obj.pos.x, this->obj.pos.y + 130.0f, this->obj.pos.z, 8.0f);
|
2024-08-12 17:58:54 +03:00
|
|
|
Effect386_Spawn1(this->obj.pos.x, this->obj.pos.y + 130.0f, this->obj.pos.z, 0.0f, 0.0f, 0.0f, 4.0f, 5);
|
2024-07-06 15:47:49 +03:00
|
|
|
this->timer_0BC = 4;
|
|
|
|
Effect_SpawnTimedSfxAtPos(&this->obj.pos, NA_SE_OB_EXPLOSION_S);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
void MeMolarRock_Update(MeMolarRock* this) {
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void func_enmy_80066A8C(CoBuilding9* this) {
|
|
|
|
Vec3f src;
|
|
|
|
Vec3f dest;
|
2023-11-18 18:44:33 +03:00
|
|
|
f32 yf;
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
src.z = 0.0f;
|
|
|
|
src.x = -120.0f;
|
|
|
|
|
|
|
|
if (this->obj.rot.y > 90.0f) {
|
|
|
|
src.x = 120.0f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-11-18 18:44:33 +03:00
|
|
|
for (yf = 0.0f; yf < 680.0f; yf += 100.0f) {
|
2024-07-06 15:47:49 +03:00
|
|
|
Matrix_RotateY(gCalcMatrix, this->obj.rot.y * M_DTOR, MTXF_NEW);
|
|
|
|
Matrix_RotateX(gCalcMatrix, this->obj.rot.x * M_DTOR, MTXF_APPLY);
|
|
|
|
src.y = yf;
|
|
|
|
Matrix_MultVec3fNoTranslate(gCalcMatrix, &src, &dest);
|
|
|
|
func_effect_8007D0E0(this->obj.pos.x + dest.x, this->obj.pos.y + dest.y, this->obj.pos.z + dest.z, 4.0f);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void func_enmy_80066C00(CoBuilding9* this) {
|
|
|
|
Vec3f src;
|
|
|
|
Vec3f dest;
|
2023-11-18 18:44:33 +03:00
|
|
|
f32 zf;
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
src.y = 30.0f;
|
|
|
|
src.x = -100.0f;
|
|
|
|
|
|
|
|
if (this->obj.rot.y > 90.0f) {
|
|
|
|
src.x = 100.0f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
Matrix_RotateY(gCalcMatrix, this->obj.rot.y * M_DTOR, MTXF_NEW);
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2023-11-18 18:44:33 +03:00
|
|
|
for (zf = -180.0f; zf <= 0.0f; zf += 30.0f) {
|
2024-07-06 15:47:49 +03:00
|
|
|
src.z = zf;
|
|
|
|
Matrix_MultVec3fNoTranslate(gCalcMatrix, &src, &dest);
|
|
|
|
func_effect_8007D0E0(this->obj.pos.x + dest.x, this->obj.pos.y + dest.y, this->obj.pos.z + dest.z,
|
2024-04-03 02:20:08 +03:00
|
|
|
RAND_FLOAT(1.0f) + 2.0f);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void CoBuilding9_Update(CoBuilding9* this) {
|
|
|
|
switch (this->state) {
|
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
|
2023-11-18 18:44:33 +03:00
|
|
|
case 1:
|
2024-07-06 15:47:49 +03:00
|
|
|
func_enmy_80066C00(this);
|
|
|
|
this->state++;
|
|
|
|
AUDIO_PLAY_SFX(NA_SE_EN_DAMAGE_L, this->sfxSource, 4);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-11-18 18:44:33 +03:00
|
|
|
case 2:
|
2024-07-06 15:47:49 +03:00
|
|
|
this->vel.x += 0.05f;
|
|
|
|
this->obj.rot.x += this->vel.x;
|
|
|
|
if (this->obj.rot.x >= 90.0f) {
|
|
|
|
this->obj.rot.x = 90.0f;
|
|
|
|
this->unk_44 = 40;
|
|
|
|
func_enmy_80066A8C(this);
|
|
|
|
this->state = 0;
|
2024-04-05 23:11:36 +03:00
|
|
|
gCameraShake = 25;
|
2024-07-06 15:47:49 +03:00
|
|
|
AUDIO_PLAY_SFX(NA_SE_EN_METAL_BOUND_M, this->sfxSource, 4);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void func_enmy_80066E80(Scenery* this) {
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void Sprite167_Update(Sprite167* this) {
|
|
|
|
this->obj.rot.y += 0.2f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
// World-aligned billboarding
|
|
|
|
void SceneryRotateTowardsCamera(Scenery* this) {
|
|
|
|
this->obj.rot.y = 0.0f;
|
|
|
|
if (gPlayer[0].cam.eye.x < this->obj.pos.x) {
|
|
|
|
this->obj.rot.y = 271.0f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void func_enmy_80066EE4(Sprite* this) {
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
void Item_CheckBounds(Item* this) {
|
2023-11-18 18:44:33 +03:00
|
|
|
f32 var_fa1;
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_STANDBY)) {
|
2024-05-02 23:46:51 +03:00
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if ((gLevelMode == LEVELMODE_ON_RAILS) && (gLastPathChange == 0)) {
|
2023-11-18 18:44:33 +03:00
|
|
|
var_fa1 = 900.0f;
|
2023-12-24 22:28:35 +03:00
|
|
|
if (gPlayer[0].form != FORM_ARWING) {
|
2023-11-18 18:44:33 +03:00
|
|
|
var_fa1 = 600.0f;
|
|
|
|
}
|
2024-05-02 23:46:51 +03:00
|
|
|
if (this->obj.pos.x > gPlayer[0].xPath + var_fa1) {
|
|
|
|
Math_SmoothStepToF(&this->obj.pos.x, gPlayer[0].xPath + var_fa1, 0.1f, 10.0f, 0.01f);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-05-02 23:46:51 +03:00
|
|
|
if (this->obj.pos.x < gPlayer[0].xPath - var_fa1) {
|
|
|
|
Math_SmoothStepToF(&this->obj.pos.x, gPlayer[0].xPath - var_fa1, 0.1f, 10.0f, 0.01f);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
if (this->obj.pos.y > 650.0f) {
|
|
|
|
Math_SmoothStepToF(&this->obj.pos.y, 650.0f, 0.1f, 10.0f, 0.01f);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-12-24 22:28:35 +03:00
|
|
|
if (gLevelType == LEVELTYPE_PLANET) {
|
2024-05-02 23:46:51 +03:00
|
|
|
if (this->obj.pos.y < gGroundHeight + 70.0f) {
|
|
|
|
Math_SmoothStepToF(&this->obj.pos.y, gGroundHeight + 70.0f, 0.1f, 5.0f, 0.01f);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-05-11 23:53:37 +03:00
|
|
|
if ((gCurrentLevel == LEVEL_AQUAS) && gBossActive) {
|
2024-05-02 23:46:51 +03:00
|
|
|
this->obj.pos.z += 20.0f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-05-02 23:46:51 +03:00
|
|
|
} else if (this->obj.pos.y < -500.0f) {
|
|
|
|
Math_SmoothStepToF(&this->obj.pos.y, -500.0f, 0.1f, 5.0f, 0.01f);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
if (gVersusMode && (this->index == 0) && (gItems[1].obj.status == OBJ_ACTIVE)) {
|
|
|
|
if (fabsf(this->obj.pos.x - gItems[1].obj.pos.x) < 200.0f) {
|
|
|
|
if (fabsf(this->obj.pos.z - gItems[1].obj.pos.z) < 200.0f) {
|
|
|
|
this->obj.pos.x = this->obj.pos.x - 5.0f;
|
|
|
|
this->obj.pos.z = this->obj.pos.z - 5.0f;
|
2023-12-20 22:32:50 +03:00
|
|
|
gItems[1].obj.pos.x += 5.0f;
|
|
|
|
gItems[1].obj.pos.z += 5.0f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
void Item_SpinPickup(Item* this) {
|
|
|
|
s32 sparkleMask;
|
2024-07-06 15:47:49 +03:00
|
|
|
Vec3f src;
|
|
|
|
Vec3f dest;
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
Math_SmoothStepToF(&this->unk_50, 10.0f, 1.0f, 2.0f, 0.0f);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
if (this->unk_50 > 30.0f) {
|
|
|
|
sparkleMask = 1 - 1;
|
|
|
|
} else if (this->unk_50 > 20.0f) {
|
|
|
|
sparkleMask = 2 - 1;
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-05-02 23:46:51 +03:00
|
|
|
sparkleMask = 8 - 1;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
if ((sparkleMask & gGameFrameCount) == 0) {
|
2024-04-16 02:38:19 +03:00
|
|
|
Matrix_RotateY(gCalcMatrix, gGameFrameCount * 23.0f * M_DTOR, MTXF_NEW);
|
2024-07-06 15:47:49 +03:00
|
|
|
src.x = 50.0f;
|
|
|
|
src.y = RAND_FLOAT_CENTERED(120.0f);
|
|
|
|
src.z = 0.0f;
|
|
|
|
Matrix_MultVec3fNoTranslate(gCalcMatrix, &src, &dest);
|
2024-08-12 17:58:54 +03:00
|
|
|
Effect_Effect393_Spawn(this->obj.pos.x + dest.x, this->obj.pos.y + dest.y, this->obj.pos.z + dest.z, 3.0f);
|
2023-12-19 17:54:50 +03:00
|
|
|
}
|
2024-05-02 23:46:51 +03:00
|
|
|
this->obj.rot.y += this->unk_50;
|
|
|
|
this->obj.rot.y = Math_ModF(this->obj.rot.y, 360.0f);
|
2023-12-19 17:54:50 +03:00
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Actor_SetupDebris70(ActorDebris* this, f32 xPos, f32 yPos, f32 zPos, f32 xRot, f32 yRot, f32 xVel, f32 yVel,
|
|
|
|
f32 zVel) {
|
|
|
|
Actor_Initialize(this);
|
|
|
|
this->obj.status = OBJ_ACTIVE;
|
|
|
|
this->obj.id = OBJ_ACTOR_DEBRIS;
|
|
|
|
this->state = 70;
|
|
|
|
this->obj.pos.x = xPos;
|
|
|
|
this->obj.pos.y = yPos;
|
|
|
|
this->obj.pos.z = zPos;
|
|
|
|
this->obj.rot.x = xRot;
|
|
|
|
this->obj.rot.y = yRot;
|
|
|
|
this->vel.x = xVel;
|
|
|
|
this->vel.y = yVel;
|
|
|
|
this->vel.z = zVel;
|
|
|
|
this->timer_0BC = RAND_INT(15.0f) + 25.0f;
|
|
|
|
this->gravity = 0.5f;
|
|
|
|
Object_SetInfo(&this->info, this->obj.id);
|
2023-12-19 17:54:50 +03:00
|
|
|
}
|
|
|
|
|
2024-05-07 01:45:24 +03:00
|
|
|
void Actor_SpawnDebris70(f32 xPos, f32 yPos, f32 zPos, f32 xRot, f32 yRot, f32 arg5, f32 arg6, f32 arg7) {
|
2023-11-18 18:44:33 +03:00
|
|
|
s32 i;
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-05-05 23:29:59 +03:00
|
|
|
for (i = ARRAY_COUNT(gActors) - 1; i >= 50; i--) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (gActors[i].obj.status == OBJ_FREE) {
|
2024-05-07 01:45:24 +03:00
|
|
|
Actor_SetupDebris70(&gActors[i], xPos, yPos, zPos, xRot, yRot, arg5, arg6, arg7);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void ActorSupplies_Update(ActorSupplies* this) {
|
2024-01-07 01:39:23 +03:00
|
|
|
Player* player = &gPlayer[0];
|
2023-11-18 18:44:33 +03:00
|
|
|
s32 i;
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.rot.y += 1.0f;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-12-24 22:28:35 +03:00
|
|
|
if (gLevelMode == LEVELMODE_ALL_RANGE) {
|
2023-12-14 17:41:43 +03:00
|
|
|
if (gCurrentLevel == LEVEL_SECTOR_Z) {
|
2024-04-09 01:25:56 +03:00
|
|
|
Math_SmoothStepToF(&this->obj.pos.x, -2000.0f, 0.05f, 60.0f, 0.01f);
|
|
|
|
Math_SmoothStepToF(&this->obj.pos.y, -200.0f, 0.05f, 3.0f, 0.01f);
|
|
|
|
Math_SmoothStepToF(&this->obj.pos.z, 0.0f, 0.05f, 0.f, 0.01f);
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-04-09 01:25:56 +03:00
|
|
|
Math_SmoothStepToF(&this->obj.pos.y, 300.0f, 0.05f, 50.0f, 0.01f);
|
2023-12-19 17:54:50 +03:00
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-05 00:24:24 +03:00
|
|
|
if (this->dmgType != DMG_NONE) {
|
|
|
|
this->dmgType = DMG_NONE;
|
2024-04-09 01:25:56 +03:00
|
|
|
this->health -= this->damage;
|
|
|
|
if (this->health <= 0) {
|
2024-07-06 15:47:49 +03:00
|
|
|
Effect_SpawnTimedSfxAtPos(&this->obj.pos, NA_SE_EN_EXPLOSION_S);
|
2024-04-09 01:25:56 +03:00
|
|
|
func_effect_8007D2C8(this->obj.pos.x, this->obj.pos.y, this->obj.pos.z, 5.0f);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-08-15 08:55:25 +03:00
|
|
|
if (((player[0].arwing.rightWingState <= WINGSTATE_BROKEN) ||
|
2024-08-15 08:52:41 +03:00
|
|
|
(player[0].arwing.leftState <= WINGSTATE_BROKEN)) &&
|
2023-12-24 22:28:35 +03:00
|
|
|
(player[0].form != FORM_LANDMASTER)) {
|
2024-04-09 01:25:56 +03:00
|
|
|
this->itemDrop = DROP_WING_REPAIR;
|
2024-01-03 00:33:26 +03:00
|
|
|
} else if (gPlayer[0].shields < 128) {
|
2024-04-09 01:25:56 +03:00
|
|
|
this->itemDrop = DROP_SILVER_STAR;
|
2024-01-03 00:33:26 +03:00
|
|
|
} else if ((gLaserStrength[0] == LASERS_SINGLE) && (player[0].form != FORM_LANDMASTER)) {
|
2024-04-09 01:25:56 +03:00
|
|
|
this->itemDrop = DROP_LASERS;
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-04-09 01:25:56 +03:00
|
|
|
this->itemDrop = DROP_BOMB;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
Actor_Despawn(this);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-11-18 18:44:33 +03:00
|
|
|
for (i = 0; i < 6; i++) {
|
2024-05-07 01:45:24 +03:00
|
|
|
Actor_SpawnDebris70(D_enmy_800CFEC4[i].x + this->obj.pos.x, D_enmy_800CFEC4[i].y + this->obj.pos.y,
|
|
|
|
D_enmy_800CFEC4[i].z + this->obj.pos.z, D_enmy_800CFF0C[i].y + this->obj.rot.y,
|
|
|
|
D_enmy_800CFF0C[i].x + this->obj.rot.x, RAND_FLOAT_CENTERED(40.0f),
|
|
|
|
RAND_FLOAT(10.0f) + 10.0f, RAND_FLOAT_CENTERED(40.0f));
|
2024-08-12 17:58:54 +03:00
|
|
|
Effect_Effect357_Spawn50(this->obj.pos.x, this->obj.pos.y, this->obj.pos.z, 0.6f);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2024-04-16 02:38:19 +03:00
|
|
|
gRadarMarks[63].status = 1;
|
|
|
|
gRadarMarks[63].type = 103;
|
2024-04-09 01:25:56 +03:00
|
|
|
gRadarMarks[63].pos.x = this->obj.pos.x;
|
|
|
|
gRadarMarks[63].pos.y = this->obj.pos.y;
|
|
|
|
gRadarMarks[63].pos.z = this->obj.pos.z;
|
2024-05-02 23:46:51 +03:00
|
|
|
gRadarMarks[63].yRot = 0.0f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void ActorSupplies_Draw(Actor* this) {
|
2023-11-18 18:44:33 +03:00
|
|
|
s32 i;
|
|
|
|
|
2023-11-24 22:11:20 +03:00
|
|
|
Lights_SetOneLight(&gMasterDisp, -60, -60, 60, 150, 150, 150, 20, 20, 20);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-11-18 18:44:33 +03:00
|
|
|
for (i = 0; i < 6; i++) {
|
2023-11-24 22:11:20 +03:00
|
|
|
Matrix_Push(&gGfxMatrix);
|
2024-04-16 02:38:19 +03:00
|
|
|
Matrix_Translate(gGfxMatrix, D_enmy_800CFEC4[i].x, D_enmy_800CFEC4[i].y, D_enmy_800CFEC4[i].z, MTXF_APPLY);
|
|
|
|
Matrix_RotateY(gGfxMatrix, D_enmy_800CFF0C[i].y * M_DTOR, MTXF_APPLY);
|
|
|
|
Matrix_RotateX(gGfxMatrix, D_enmy_800CFF0C[i].x * M_DTOR, MTXF_APPLY);
|
2023-11-18 18:44:33 +03:00
|
|
|
Matrix_SetGfxMtx(&gMasterDisp);
|
|
|
|
gSPDisplayList(gMasterDisp++, D_10177C0);
|
2023-11-24 22:11:20 +03:00
|
|
|
Matrix_Pop(&gGfxMatrix);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-12-14 17:41:43 +03:00
|
|
|
Lights_SetOneLight(&gMasterDisp, gLight1x, gLight1y, gLight1z, gLight1R, gLight1G, gLight1B, gAmbientR, gAmbientG,
|
|
|
|
gAmbientB);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
void func_enmy_80067A40(void) {
|
2024-05-06 04:07:32 +03:00
|
|
|
AUDIO_PLAY_SFX(NA_SE_WING_REPAIR, gPlayer[0].sfxSource, 0);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-08-15 08:55:25 +03:00
|
|
|
if (gPlayer[0].arwing.rightWingState <= WINGSTATE_BROKEN) {
|
2024-04-26 01:01:25 +03:00
|
|
|
gRightWingFlashTimer[0] = 1050;
|
2024-08-15 08:55:25 +03:00
|
|
|
gPlayer[0].arwing.rightWingState = WINGSTATE_INTACT;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-08-15 08:52:41 +03:00
|
|
|
if (gPlayer[0].arwing.leftState <= WINGSTATE_BROKEN) {
|
2024-04-26 01:01:25 +03:00
|
|
|
gLeftWingFlashTimer[0] = 1050;
|
2024-08-15 08:52:41 +03:00
|
|
|
gPlayer[0].arwing.leftState = WINGSTATE_INTACT;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-12-07 03:16:49 +03:00
|
|
|
if (gExpertMode) {
|
2023-12-14 17:41:43 +03:00
|
|
|
gRightWingHealth[0] = gLeftWingHealth[0] = 10;
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2023-12-14 17:41:43 +03:00
|
|
|
gRightWingHealth[0] = gLeftWingHealth[0] = 60;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void Item1up_Update(Item1UP* this) {
|
2024-05-02 23:46:51 +03:00
|
|
|
Item_CheckBounds(this);
|
|
|
|
Item_SpinPickup(this);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->collected) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2024-05-07 01:45:24 +03:00
|
|
|
Object_PlayerSfx(gPlayer[this->playerNum].sfxSource, NA_SE_ONE_UP, this->playerNum);
|
2023-12-14 17:41:43 +03:00
|
|
|
if (gCurrentLevel != LEVEL_TRAINING) {
|
2024-04-09 01:25:56 +03:00
|
|
|
gLifeCount[this->playerNum]++;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_48 == 1) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void ItemPickup_Update(Item* this) {
|
2024-05-02 23:46:51 +03:00
|
|
|
Item_CheckBounds(this);
|
|
|
|
Item_SpinPickup(this);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->state == 0) {
|
|
|
|
switch (this->obj.id) {
|
2023-12-20 22:32:50 +03:00
|
|
|
case OBJ_ITEM_BOMB:
|
2024-05-02 23:46:51 +03:00
|
|
|
this->width = 18.0f;
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->collected) {
|
|
|
|
this->timer_4A = 50;
|
|
|
|
this->state = 1;
|
|
|
|
this->timer_48 = 20;
|
|
|
|
this->unk_50 = 60.0f;
|
|
|
|
gBombCount[this->playerNum]++;
|
2024-05-07 01:45:24 +03:00
|
|
|
Object_PlayerSfx(gPlayer[this->playerNum].sfxSource, NA_SE_BOMB_GET, this->playerNum);
|
|
|
|
Object_PlayerSfx(gPlayer[this->playerNum].sfxSource, NA_SE_BOMB_GAUGE_UP, this->playerNum);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-12-20 22:32:50 +03:00
|
|
|
case OBJ_ITEM_LASERS:
|
2024-05-02 23:46:51 +03:00
|
|
|
this->width = 18.0f;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->collected) {
|
|
|
|
this->timer_4A = 50;
|
|
|
|
this->state = 1;
|
|
|
|
this->timer_48 = 20;
|
|
|
|
this->unk_50 = 60.0f;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
gLaserStrength[this->playerNum]++;
|
|
|
|
if (gLaserStrength[this->playerNum] > LASERS_HYPER) {
|
|
|
|
gLaserStrength[this->playerNum] = LASERS_HYPER;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-07 01:45:24 +03:00
|
|
|
Object_PlayerSfx(gPlayer[this->playerNum].sfxSource, NA_SE_TWIN_LASER_GET, this->playerNum);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-12-07 03:16:49 +03:00
|
|
|
if (gExpertMode) {
|
2024-04-09 01:25:56 +03:00
|
|
|
gRightWingHealth[this->playerNum] = gLeftWingHealth[this->playerNum] = 10;
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-04-09 01:25:56 +03:00
|
|
|
gRightWingHealth[this->playerNum] = gLeftWingHealth[this->playerNum] = 60;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-26 01:01:25 +03:00
|
|
|
gRightWingFlashTimer[this->playerNum] = 1030;
|
|
|
|
gLeftWingFlashTimer[this->playerNum] = 1030;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
2024-05-02 23:46:51 +03:00
|
|
|
Math_SmoothStepToF(&this->width, 2.5f, 1.0f, 0.5f, 0.0f);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.pos.x += (gPlayer[this->playerNum].pos.x - this->obj.pos.x) * 0.5f;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (gPlayer[this->playerNum].form == FORM_LANDMASTER) {
|
|
|
|
this->obj.pos.y += ((gPlayer[this->playerNum].pos.y + 50.0f) - this->obj.pos.y) * 0.5f;
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.pos.y += (gPlayer[this->playerNum].pos.y - this->obj.pos.y) * 0.5f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
this->obj.pos.z += (gPlayer[this->playerNum].trueZpos - this->obj.pos.z) * 0.5f;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_48 == 0) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void ItemLasers_Update(ItemLasers* this) {
|
2024-01-03 00:33:26 +03:00
|
|
|
if (!gVersusMode &&
|
2024-08-15 08:55:25 +03:00
|
|
|
((gPlayer[0].arwing.leftState <= WINGSTATE_BROKEN) || (gPlayer[0].arwing.rightWingState <= WINGSTATE_BROKEN))) {
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.id = OBJ_ITEM_WING_REPAIR;
|
|
|
|
Object_SetInfo(&this->info, this->obj.id);
|
|
|
|
this->timer_48 = 2000;
|
2024-05-06 04:07:32 +03:00
|
|
|
AUDIO_PLAY_SFX(NA_SE_OB_WING, this->sfxSource, 0);
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-04-09 01:25:56 +03:00
|
|
|
ItemPickup_Update(this);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void ItemSupplyRing_Update(Item* this) {
|
2024-07-06 15:47:49 +03:00
|
|
|
Vec3f src;
|
|
|
|
Vec3f dest;
|
2023-11-18 18:44:33 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
switch (this->state) {
|
2023-11-18 18:44:33 +03:00
|
|
|
case 0:
|
2024-05-02 23:46:51 +03:00
|
|
|
Math_SmoothStepToF(&this->width, 0.4f, 1.0f, 0.05f, 0.0f);
|
|
|
|
Item_CheckBounds(this);
|
|
|
|
Item_SpinPickup(this);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->collected) {
|
|
|
|
this->state = 1;
|
|
|
|
this->timer_48 = 50;
|
|
|
|
if (this->obj.id == OBJ_ITEM_SILVER_RING) {
|
|
|
|
gPlayer[this->playerNum].heal += 32;
|
2024-05-07 01:45:24 +03:00
|
|
|
Object_PlayerSfx(gPlayer[this->playerNum].sfxSource, NA_SE_SHIELD_RING, this->playerNum);
|
2024-04-09 01:25:56 +03:00
|
|
|
} else if (this->obj.id == OBJ_ITEM_GOLD_RING) {
|
2023-12-14 17:41:43 +03:00
|
|
|
gGoldRingCount[0]++;
|
|
|
|
if (gGoldRingCount[0] == 3) {
|
2024-05-07 01:45:24 +03:00
|
|
|
Object_PlayerSfx(gPlayer[this->playerNum].sfxSource, NA_SE_SHIELD_UPGRADE, this->playerNum);
|
2023-12-14 17:41:43 +03:00
|
|
|
} else if (gGoldRingCount[0] == 6) {
|
2024-05-07 01:45:24 +03:00
|
|
|
Object_PlayerSfx(gPlayer[this->playerNum].sfxSource, NA_SE_ONE_UP, this->playerNum);
|
2023-12-14 17:41:43 +03:00
|
|
|
if (gCurrentLevel != LEVEL_TRAINING) {
|
2024-04-09 01:25:56 +03:00
|
|
|
gLifeCount[this->playerNum]++;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
gPlayer[this->playerNum].heal += 32;
|
|
|
|
BonusText_Display(gPlayer[this->playerNum].pos.x, gPlayer[this->playerNum].pos.y,
|
2024-05-02 23:46:51 +03:00
|
|
|
gPlayer[this->playerNum].trueZpos, BONUS_TEXT_1UP);
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-04-09 01:25:56 +03:00
|
|
|
gPlayer[this->playerNum].heal += 32;
|
2024-05-07 01:45:24 +03:00
|
|
|
Object_PlayerSfx(gPlayer[this->playerNum].sfxSource, NA_SE_GOLD_RING, this->playerNum);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
} else {
|
2024-04-09 01:25:56 +03:00
|
|
|
gPlayer[this->playerNum].heal += 128;
|
2024-05-07 01:45:24 +03:00
|
|
|
Object_PlayerSfx(gPlayer[this->playerNum].sfxSource, NA_SE_SHIELD_RING_M, this->playerNum);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if ((this->obj.id == OBJ_ITEM_GOLD_RING) && (this->timer_48 == 1)) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-11-18 18:44:33 +03:00
|
|
|
case 1:
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_48 > 30) {
|
2024-05-02 23:46:51 +03:00
|
|
|
Math_SmoothStepToF(&this->width, 1.0f, 1.0f, 0.06f, 0.0f);
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-05-02 23:46:51 +03:00
|
|
|
Math_SmoothStepToF(&this->width, 0.0f, 1.0f, 0.06f, 0.0f);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.pos.x += (gPlayer[this->playerNum].pos.x - this->obj.pos.x) * 0.5f;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (gPlayer[this->playerNum].form == FORM_LANDMASTER) {
|
|
|
|
this->obj.pos.y += (gPlayer[this->playerNum].pos.y + 50.0f - this->obj.pos.y) * 0.5f;
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.pos.y += (gPlayer[this->playerNum].pos.y - this->obj.pos.y) * 0.5f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-11 23:53:37 +03:00
|
|
|
if (gPlayer[0].alternateView && (gLevelMode == LEVELMODE_ON_RAILS)) {
|
2024-05-02 23:46:51 +03:00
|
|
|
this->obj.pos.z += (gPlayer[this->playerNum].trueZpos - 300.0f - this->obj.pos.z) * 0.3f;
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-05-02 23:46:51 +03:00
|
|
|
this->obj.pos.z += (gPlayer[this->playerNum].trueZpos - this->obj.pos.z) * 0.5f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.rot.z += 22.0f;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
Math_SmoothStepToAngle(&this->obj.rot.y, Math_RadToDeg(-gPlayer[this->playerNum].camYaw), 0.2f, 10.0f,
|
2024-01-24 17:45:55 +03:00
|
|
|
0.0f);
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_48 == 0) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
if (this->width > 0.3f) {
|
2024-04-16 02:38:19 +03:00
|
|
|
Matrix_RotateY(gCalcMatrix, this->obj.rot.y * M_DTOR, MTXF_NEW);
|
|
|
|
Matrix_RotateZ(gCalcMatrix, gGameFrameCount * 37.0f * M_DTOR, MTXF_APPLY);
|
2024-07-06 15:47:49 +03:00
|
|
|
src.x = 0.0f;
|
|
|
|
src.y = this->width * 100.0f;
|
|
|
|
src.z = 0.0f;
|
|
|
|
Matrix_MultVec3fNoTranslate(gCalcMatrix, &src, &dest);
|
2024-08-12 17:58:54 +03:00
|
|
|
Effect_Effect393_Spawn(this->obj.pos.x + dest.x, this->obj.pos.y + dest.y, this->obj.pos.z + dest.z,
|
|
|
|
3.5f);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void ItemSilverStar_Update(ItemSilverStar* this) {
|
|
|
|
ItemSupplyRing_Update(this);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void ItemGoldRing_Update(ItemGoldRing* this) {
|
|
|
|
ItemSupplyRing_Update(this);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void ItemWingRepair_Update(ItemWingRepair* this) {
|
2024-05-02 23:46:51 +03:00
|
|
|
Item_CheckBounds(this);
|
|
|
|
Item_SpinPickup(this);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->collected) {
|
2024-04-03 02:20:08 +03:00
|
|
|
func_enmy_80067A40();
|
2024-04-09 01:25:56 +03:00
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_48 == 1) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void ItemMeteoWarp_Update(ItemMeteoWarp* this) {
|
2024-05-02 23:46:51 +03:00
|
|
|
Item_CheckBounds(this);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->state > 0) {
|
|
|
|
if (this->state == 1) {
|
|
|
|
this->obj.rot.z -= 10.0f;
|
|
|
|
this->obj.pos.x += (gPlayer[this->playerNum].pos.x - this->obj.pos.x) * 0.3f;
|
|
|
|
this->obj.pos.y += (gPlayer[this->playerNum].pos.y - this->obj.pos.y) * 0.3f;
|
2024-05-02 23:46:51 +03:00
|
|
|
this->obj.pos.z += (gPlayer[this->playerNum].trueZpos - this->obj.pos.z) * 0.3f;
|
|
|
|
this->width -= 5.0f;
|
|
|
|
if (this->width < 0.0f) {
|
|
|
|
this->width = 0.0f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
this->unk_44 -= 10;
|
|
|
|
if (this->unk_44 < 0) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
} else {
|
2024-05-02 23:46:51 +03:00
|
|
|
this->width = 100.0f;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (gRingPassCount < 0) {
|
|
|
|
this->state = 2;
|
|
|
|
this->unk_44 = 255;
|
|
|
|
} else if (this->collected) {
|
|
|
|
this->state = 1;
|
|
|
|
this->unk_44 = 255;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
gPlayer[this->playerNum].meteoWarpTimer = 100;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-26 01:01:25 +03:00
|
|
|
AUDIO_PLAY_SFX(gWarpRingSfx[gRingPassCount], gPlayer[0].sfxSource, 0);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (gRingPassCount == 0) {
|
2024-04-26 01:01:25 +03:00
|
|
|
gPlayer[0].boostSpeed = 0.0f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
gRingPassCount++;
|
|
|
|
if (gRingPassCount >= 7) {
|
2024-04-16 02:38:19 +03:00
|
|
|
gPlayer[0].state_1C8 = PLAYERSTATE_1C8_ENTER_WARP_ZONE;
|
2024-05-02 23:46:51 +03:00
|
|
|
gPlayer[0].csState = 0;
|
2024-05-06 04:07:32 +03:00
|
|
|
AUDIO_PLAY_SFX(NA_SE_WARP_HOLE, gDefaultSfxSource, 0);
|
2024-04-25 07:14:49 +03:00
|
|
|
gMissionStatus = MISSION_WARP;
|
|
|
|
gLeveLClearStatus[gCurrentLevel] = 1;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void ItemCheckpoint_Update(ItemCheckpoint* this) {
|
2024-07-06 15:47:49 +03:00
|
|
|
TeamId i;
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
Item_CheckBounds(this);
|
2024-04-09 01:25:56 +03:00
|
|
|
this->unk_58 -= this->unk_44;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->state > 0) {
|
|
|
|
this->unk_44++;
|
|
|
|
this->obj.pos.x += (gPlayer[this->playerNum].pos.x - this->obj.pos.x) * 0.3f;
|
|
|
|
if (gPlayer[this->playerNum].form == FORM_LANDMASTER) {
|
|
|
|
this->obj.pos.y += (gPlayer[this->playerNum].pos.y + 50.0f - this->obj.pos.y) * 0.3f;
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.pos.y += (gPlayer[this->playerNum].pos.y - this->obj.pos.y) * 0.3f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-05-11 23:53:37 +03:00
|
|
|
if (gPlayer[0].alternateView) {
|
2024-05-02 23:46:51 +03:00
|
|
|
this->obj.pos.z += (gPlayer[this->playerNum].trueZpos - 200.0f - this->obj.pos.z) * 0.3f;
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-05-02 23:46:51 +03:00
|
|
|
this->obj.pos.z += (gPlayer[this->playerNum].trueZpos - 100.0f - this->obj.pos.z) * 0.3f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_48 == 0) {
|
2024-05-02 23:46:51 +03:00
|
|
|
Math_SmoothStepToF(&this->width, 5.0f, 0.2f, 15.0f, 0.01f);
|
2024-04-09 01:25:56 +03:00
|
|
|
Math_SmoothStepToF(&this->unk_50, 0.0f, 0.1f, 0.03f, 0.0f);
|
|
|
|
Math_SmoothStepToF(&this->unk_54, 4.0f, 0.1f, 0.2f, 0.01f);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-05-02 23:46:51 +03:00
|
|
|
if (this->width <= 6.5f) {
|
2024-04-09 01:25:56 +03:00
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
} else {
|
2024-04-09 01:25:56 +03:00
|
|
|
this->unk_44 = 2;
|
|
|
|
this->unk_50 = 1.0f;
|
|
|
|
this->unk_54 = 1.0f;
|
2024-05-02 23:46:51 +03:00
|
|
|
this->width = 100.0f;
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->collected) {
|
|
|
|
gPlayer[this->playerNum].heal = 128;
|
|
|
|
this->state++;
|
|
|
|
this->timer_48 = 15;
|
2024-04-26 01:01:25 +03:00
|
|
|
gSavedGroundSurface = gGroundSurface;
|
2024-05-02 23:46:51 +03:00
|
|
|
gSavedPathProgress = -this->obj.pos.z;
|
|
|
|
gSavedPathProgress -= 250.0f;
|
2024-04-26 01:01:25 +03:00
|
|
|
gSavedObjectLoadIndex = gObjectLoadIndex;
|
2024-04-09 01:25:56 +03:00
|
|
|
gSavedZoSearchlightStatus = gMissedZoSearchlight;
|
2023-12-19 17:54:50 +03:00
|
|
|
gSavedHitCount = gHitCount;
|
2024-04-09 01:25:56 +03:00
|
|
|
for (i = TEAM_ID_FALCO; i <= TEAM_ID_PEPPY; i++) {
|
2023-12-20 22:32:50 +03:00
|
|
|
gSavedTeamShields[i] = gTeamShields[i];
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-05-06 04:07:32 +03:00
|
|
|
AUDIO_PLAY_SFX(NA_SE_CHECKPOINT, gDefaultSfxSource, 4);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
void ItemRingCheck_Update(Item* this) {
|
|
|
|
if (this->collected) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2024-04-09 01:25:56 +03:00
|
|
|
gRingPassCount++;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void ItemPathChange_Update(Item* this) {
|
|
|
|
gLastPathChange = this->obj.id;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-16 02:38:19 +03:00
|
|
|
if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_ACTIVE) {
|
2024-04-09 01:25:56 +03:00
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2024-04-23 05:51:20 +03:00
|
|
|
} else if (((gCurrentLevel == LEVEL_METEO) || (gCurrentLevel == LEVEL_SECTOR_X)) && (gLevelPhase == 1)) {
|
2024-04-16 02:38:19 +03:00
|
|
|
gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE;
|
2024-05-02 23:46:51 +03:00
|
|
|
gPlayer[0].csState = 0;
|
2024-04-09 01:25:56 +03:00
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-12-14 17:41:43 +03:00
|
|
|
} else if (gCurrentLevel == LEVEL_TRAINING) {
|
2024-04-16 02:38:19 +03:00
|
|
|
gPlayer[0].state_1C8 = PLAYERSTATE_1C8_START_360;
|
2024-05-02 23:46:51 +03:00
|
|
|
gPlayer[0].csState = 0;
|
2024-04-09 01:25:56 +03:00
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
|
|
|
} else if (this->state == 0) {
|
2024-05-02 23:46:51 +03:00
|
|
|
if (((this->obj.pos.z + gPathProgress) > -2700.0f) && (fabsf(this->obj.pos.x - gPlayer[0].pos.x) < 1000.0f)) {
|
2024-04-09 01:25:56 +03:00
|
|
|
switch (this->obj.id) {
|
|
|
|
case OBJ_ITEM_PATH_SPLIT_Y:
|
|
|
|
case OBJ_ITEM_PATH_TURN_UP:
|
|
|
|
case OBJ_ITEM_PATH_TURN_DOWN:
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-04-09 01:25:56 +03:00
|
|
|
case OBJ_ITEM_PATH_SPLIT_X:
|
|
|
|
gPlayer[0].flags_228 = PFLAG_228_4 | PFLAG_228_5;
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-04-09 01:25:56 +03:00
|
|
|
case OBJ_ITEM_PATH_TURN_LEFT:
|
|
|
|
gPlayer[0].flags_228 = PFLAG_228_5;
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-04-09 01:25:56 +03:00
|
|
|
case OBJ_ITEM_PATH_TURN_RIGHT:
|
|
|
|
gPlayer[0].flags_228 = PFLAG_228_4;
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->collected) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
gPlayer[0].pathStep = 0.0f;
|
2024-05-11 23:53:37 +03:00
|
|
|
gPlayer[0].pathChangeTimer = this->width * 0.05f;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
switch (this->obj.id) {
|
|
|
|
case OBJ_ITEM_PATH_SPLIT_X:
|
|
|
|
if (this->obj.pos.x < gPlayer[0].pos.x) {
|
2024-05-11 23:53:37 +03:00
|
|
|
gPlayer[0].pathChangeYaw = -30.0f;
|
2024-05-02 23:46:51 +03:00
|
|
|
gPlayer[0].xPathTarget = gPlayer[0].xPath + this->width;
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-05-11 23:53:37 +03:00
|
|
|
gPlayer[0].pathChangeYaw = 30.0f;
|
2024-05-02 23:46:51 +03:00
|
|
|
gPlayer[0].xPathTarget = gPlayer[0].xPath - this->width;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
case OBJ_ITEM_PATH_TURN_LEFT:
|
2024-05-11 23:53:37 +03:00
|
|
|
gPlayer[0].pathChangeYaw = 30.0f;
|
2024-05-02 23:46:51 +03:00
|
|
|
gPlayer[0].xPathTarget = gPlayer[0].xPath - this->width;
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
case OBJ_ITEM_PATH_TURN_RIGHT:
|
2024-05-11 23:53:37 +03:00
|
|
|
gPlayer[0].pathChangeYaw = -30.0f;
|
2024-05-02 23:46:51 +03:00
|
|
|
gPlayer[0].xPathTarget = gPlayer[0].xPath + this->width;
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
case OBJ_ITEM_PATH_SPLIT_Y:
|
|
|
|
if (this->obj.pos.y < gPlayer[0].pos.y) {
|
2024-05-11 23:53:37 +03:00
|
|
|
gPlayer[0].pathChangePitch = 30.0f;
|
2024-05-02 23:46:51 +03:00
|
|
|
gPlayer[0].yPathTarget = gPlayer[0].yPath + this->width;
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-05-11 23:53:37 +03:00
|
|
|
gPlayer[0].pathChangePitch = -30.0f;
|
2024-05-02 23:46:51 +03:00
|
|
|
gPlayer[0].yPathTarget = gPlayer[0].yPath - this->width;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
case OBJ_ITEM_PATH_TURN_UP:
|
2024-05-11 23:53:37 +03:00
|
|
|
gPlayer[0].pathChangePitch = 30.0f;
|
2024-05-02 23:46:51 +03:00
|
|
|
gPlayer[0].yPathTarget = gPlayer[0].yPath + this->width;
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
case OBJ_ITEM_PATH_TURN_DOWN:
|
2024-05-11 23:53:37 +03:00
|
|
|
gPlayer[0].pathChangePitch = -30.0f;
|
2024-05-02 23:46:51 +03:00
|
|
|
gPlayer[0].yPathTarget = gPlayer[0].yPath - this->width;
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void Sprite_UpdateDoodad(Sprite* this) {
|
2024-05-02 23:46:51 +03:00
|
|
|
this->obj.rot.y =
|
|
|
|
(Math_Atan2F(gPlayer[0].cam.eye.x - this->obj.pos.x, gPlayer[0].cam.eye.z - (this->obj.pos.z + gPathProgress)) *
|
|
|
|
180.0f) /
|
|
|
|
M_PI;
|
2024-05-11 23:53:37 +03:00
|
|
|
if (this->destroy) {
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.status = OBJ_FREE;
|
2024-07-06 15:47:49 +03:00
|
|
|
Effect_SpawnTimedSfxAtPos(&this->obj.pos, NA_SE_OB_EXPLOSION_S);
|
2024-04-09 01:25:56 +03:00
|
|
|
switch (this->obj.id) {
|
|
|
|
case OBJ_SPRITE_CO_POLE:
|
|
|
|
func_effect_8007D074(this->obj.pos.x, this->obj.pos.y + 160.0f, this->obj.pos.z, 4.0f);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
|
|
|
default:
|
2024-04-09 01:25:56 +03:00
|
|
|
case OBJ_SPRITE_TI_CACTUS:
|
|
|
|
func_effect_8007D074(this->obj.pos.x, this->obj.pos.y + 96.0f, this->obj.pos.z, 5.0f);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 18:57:03 +03:00
|
|
|
|
2024-04-05 23:11:36 +03:00
|
|
|
void Object_Dying(s32 index, ObjectId objId) {
|
2023-12-14 17:41:43 +03:00
|
|
|
switch (objId) {
|
2024-04-05 23:11:36 +03:00
|
|
|
case OBJ_ACTOR_EVENT:
|
|
|
|
ActorEvent_Dying(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-05 23:11:36 +03:00
|
|
|
case OBJ_ACTOR_ALLRANGE:
|
2023-12-24 22:28:35 +03:00
|
|
|
if (gCurrentLevel == LEVEL_VENOM_ANDROSS) {
|
2024-04-03 02:20:08 +03:00
|
|
|
Andross_801888F4(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-04-03 02:20:08 +03:00
|
|
|
func_enmy2_800763A4(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ME_HOPBOT:
|
2024-04-03 02:20:08 +03:00
|
|
|
func_enmy2_800763A4(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ME_MORA:
|
|
|
|
MeMora_Dying(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ME_LASER_CANNON_1:
|
2024-04-03 02:20:08 +03:00
|
|
|
Meteo_80187B08(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ME_METEOR_1:
|
2024-03-01 21:57:44 +03:00
|
|
|
Object_Kill(&gActors[index].obj, gActors[index].sfxSource);
|
2024-04-03 02:20:08 +03:00
|
|
|
func_effect_8007D2C8(gActors[index].obj.pos.x, gActors[index].obj.pos.y, gActors[index].obj.pos.z, 20.0f);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ME_METEOR_2:
|
2024-03-01 21:57:44 +03:00
|
|
|
Object_Kill(&gActors[index].obj, gActors[index].sfxSource);
|
2024-04-03 02:20:08 +03:00
|
|
|
func_effect_8007D2C8(gActors[index].obj.pos.x, gActors[index].obj.pos.y, gActors[index].obj.pos.z, 10.0f);
|
2024-04-09 01:25:56 +03:00
|
|
|
Actor_Despawn(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_CO_SKIBOT:
|
2024-04-03 02:20:08 +03:00
|
|
|
func_enmy_8006684C(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_BOSS_TI_GORAS:
|
2024-04-03 02:20:08 +03:00
|
|
|
Titania_801990DC(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_TI_RASCO:
|
|
|
|
Titania_TiRasco_Dying(&gActors[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_BOSS_VE1_GOLEMECH:
|
|
|
|
Venom1_Ve1Golemech_Dying(&gBosses[index]);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Actor_Move(Actor* this) {
|
2024-05-02 23:46:51 +03:00
|
|
|
f32 var_fv0;
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
this->obj.pos.x += this->vel.x;
|
|
|
|
this->obj.pos.z += this->vel.z;
|
|
|
|
this->obj.pos.y += this->vel.y;
|
|
|
|
this->vel.y -= this->gravity;
|
2023-12-14 17:41:43 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
if (!gCullObjects || (this->obj.id == OBJ_ACTOR_TEAM_BOSS) ||
|
|
|
|
((gCurrentLevel == LEVEL_MACBETH) && (this->obj.id != OBJ_ACTOR_EVENT))) {
|
2024-05-02 23:46:51 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
var_fv0 = 4000.0f;
|
2024-08-12 17:58:54 +03:00
|
|
|
if ((this->obj.id == OBJ_ACTOR_ZO_DODORA) || (gCurrentLevel == LEVEL_MACBETH) ||
|
2024-07-06 15:47:49 +03:00
|
|
|
((this->obj.id == OBJ_ACTOR_EVENT) && (this->eventType == EVID_56))) {
|
2024-05-02 23:46:51 +03:00
|
|
|
var_fv0 = 8000.0f;
|
|
|
|
} else if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ENTER_WARP_ZONE) {
|
|
|
|
var_fv0 = 100000.0f;
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
if (((gPlayer[0].cam.eye.z + this->info.cullDistance) < (this->obj.pos.z + gPathProgress)) ||
|
|
|
|
((this->obj.pos.z + gPathProgress) < -15000.0f) || (this->obj.pos.y < (gPlayer[0].yPath - var_fv0)) ||
|
|
|
|
((gPlayer[0].yPath + var_fv0) < this->obj.pos.y) || ((gPlayer[0].xPath + var_fv0) < this->obj.pos.x) ||
|
|
|
|
(this->obj.pos.x < (gPlayer[0].xPath - var_fv0))) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
|
|
|
|
|
|
|
switch (this->obj.id) {
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ZO_DODORA:
|
|
|
|
gZoDodoraWaypointCount = 0;
|
2024-05-02 23:46:51 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_TI_DESERT_CRAWLER:
|
2024-07-06 15:47:49 +03:00
|
|
|
Titania_8018E3B0(this);
|
2024-05-02 23:46:51 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ME_MORA:
|
|
|
|
gMeMoraStatus[this->unk_046] = 0;
|
2024-05-02 23:46:51 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
case OBJ_ACTOR_EVENT:
|
2024-07-06 15:47:49 +03:00
|
|
|
if ((this->eventType >= EVID_200) && (this->eventType < EVID_300)) {
|
2024-08-12 17:58:54 +03:00
|
|
|
gMeMoraStatus[this->unk_046] = 0;
|
2024-07-06 15:47:49 +03:00
|
|
|
} else if ((this->eventType == EVID_SX_WARP_GATE) && (this->unk_046 != 2)) {
|
2024-05-02 23:46:51 +03:00
|
|
|
gRingPassCount = -1;
|
|
|
|
}
|
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-08-12 17:58:54 +03:00
|
|
|
case OBJ_ACTOR_ZO_RADARBUOY:
|
2024-05-02 23:46:51 +03:00
|
|
|
gMissedZoSearchlight = true;
|
|
|
|
break;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Boss_Move(Boss* this) {
|
|
|
|
this->obj.pos.x += this->vel.x;
|
|
|
|
this->obj.pos.y += this->vel.y;
|
|
|
|
this->obj.pos.z += this->vel.z;
|
|
|
|
this->vel.y -= this->gravity;
|
|
|
|
|
|
|
|
if (gCullObjects && ((this->obj.pos.z + gPathProgress) > (this->info.cullDistance - gPlayer[0].cam.eye.z))) {
|
|
|
|
if (gPlayer[0].cam.eye.z) {} //! FAKE
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Scenery_Move(Scenery* this) {
|
2024-04-16 02:38:19 +03:00
|
|
|
if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) {
|
2024-07-06 15:47:49 +03:00
|
|
|
this->obj.pos.z += this->effectVel.z;
|
|
|
|
if (this->info.cullDistance < this->obj.pos.z) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-01-21 23:42:06 +03:00
|
|
|
} else if ((gLevelMode == LEVELMODE_ON_RAILS) && (gBossActive != 2)) {
|
2024-07-06 15:47:49 +03:00
|
|
|
f32 temp_fv0 = fabsf(this->obj.pos.x - gPlayer[0].cam.eye.x);
|
2023-11-18 18:44:33 +03:00
|
|
|
f32 var_fa0 = 500.0f;
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
if ((this->obj.id == OBJ_SCENERY_CO_HIGHWAY_1) || (this->obj.id == OBJ_SCENERY_CO_HIGHWAY_2)) {
|
2023-11-18 18:44:33 +03:00
|
|
|
var_fa0 = 1000.0f;
|
|
|
|
}
|
2024-03-27 23:06:28 +03:00
|
|
|
temp_fv0 = ((temp_fv0 - var_fa0) < 0.0f) ? 0.0f : (temp_fv0 - var_fa0) * 1.7f;
|
2024-05-02 23:46:51 +03:00
|
|
|
if ((fabsf(gPlayer[0].yRot_114) > 1.0f) || (gCurrentLevel == LEVEL_MACBETH)) {
|
2023-11-18 18:44:33 +03:00
|
|
|
temp_fv0 = 0.0f;
|
|
|
|
}
|
2024-04-16 02:38:19 +03:00
|
|
|
temp_fv0 -= gPlayer[0].cam.eye.z;
|
2024-07-06 15:47:49 +03:00
|
|
|
if ((this->info.cullDistance - temp_fv0) < (this->obj.pos.z + gPathProgress)) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Sprite_Move(Sprite* this) {
|
2024-05-02 23:46:51 +03:00
|
|
|
if (gCullObjects) {
|
2024-07-06 15:47:49 +03:00
|
|
|
f32 temp_fv0 = fabsf(this->obj.pos.x - gPlayer[0].cam.eye.x);
|
2023-11-18 18:44:33 +03:00
|
|
|
f32 var_fa0 = 500.0f;
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
if (((this->obj.id == OBJ_SPRITE_FOG_SHADOW) &&
|
|
|
|
((this->sceneryId == OBJ_SCENERY_CO_HIGHWAY_1) || (this->sceneryId == OBJ_SCENERY_CO_HIGHWAY_2))) ||
|
|
|
|
(this->obj.id == OBJ_SCENERY_CO_HIGHWAY_3)) {
|
2023-11-18 18:44:33 +03:00
|
|
|
var_fa0 = 1000.0f;
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-03-27 23:06:28 +03:00
|
|
|
temp_fv0 = ((temp_fv0 - var_fa0) < 0.0f) ? 0.0f * 1.7f : (temp_fv0 - var_fa0) * 1.7f;
|
2024-04-16 02:38:19 +03:00
|
|
|
temp_fv0 -= gPlayer[0].cam.eye.z;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
if ((this->info.cullDistance - temp_fv0) < (this->obj.pos.z + gPathProgress)) {
|
|
|
|
this->obj.status = OBJ_FREE;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Effect_Move(Effect* this) {
|
|
|
|
this->obj.pos.x += this->vel.x;
|
|
|
|
this->obj.pos.y += this->vel.y;
|
|
|
|
this->obj.pos.z += this->vel.z;
|
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
if (gCullObjects) {
|
2024-07-06 15:47:49 +03:00
|
|
|
if ((gPlayer[0].cam.eye.z + this->info.cullDistance) < (this->obj.pos.z + gPathProgress)) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
|
|
|
} else if ((fabsf(this->obj.pos.y - gPlayer[0].cam.eye.y) > 25000.0f) ||
|
|
|
|
(fabsf(this->obj.pos.x - gPlayer[0].cam.eye.x) > 25000.0f)) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
void Item_Move(Item* this) {
|
2024-05-02 23:46:51 +03:00
|
|
|
if (gCullObjects) {
|
2024-04-16 02:38:19 +03:00
|
|
|
f32 temp = (0.0f - gPlayer[0].cam.eye.z);
|
2023-11-18 18:44:33 +03:00
|
|
|
|
2024-07-06 15:47:49 +03:00
|
|
|
if ((this->info.cullDistance - temp) < (this->obj.pos.z + gPathProgress)) {
|
|
|
|
Object_Kill(&this->obj, this->sfxSource);
|
|
|
|
if ((this->obj.id == OBJ_ITEM_METEO_WARP) && (this->state == 0)) {
|
2024-04-09 01:25:56 +03:00
|
|
|
gRingPassCount = -1;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void Actor_Update(Actor* this) {
|
2023-11-18 18:44:33 +03:00
|
|
|
s32 i;
|
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_0BC != 0) {
|
|
|
|
this->timer_0BC--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_0BE != 0) {
|
|
|
|
this->timer_0BE--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_0C0 != 0) {
|
|
|
|
this->timer_0C0--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_0C2 != 0) {
|
|
|
|
this->timer_0C2--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_0C6 != 0) {
|
|
|
|
this->timer_0C6--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-12-20 22:32:50 +03:00
|
|
|
if (gVersusMode) {
|
2023-12-14 17:41:43 +03:00
|
|
|
for (i = 0; i < gCamCount; i++) {
|
2024-04-23 05:51:20 +03:00
|
|
|
if (this->lockOnTimers[i] != 0) {
|
2023-12-20 22:32:50 +03:00
|
|
|
if (!(gControllerHold[i].button & A_BUTTON)) {
|
2024-04-23 05:51:20 +03:00
|
|
|
this->lockOnTimers[i]--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2023-12-24 22:28:35 +03:00
|
|
|
gChargeTimers[i] = 0;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2024-04-25 07:14:49 +03:00
|
|
|
} else if (this->lockOnTimers[TEAM_ID_FOX] != 0) {
|
2023-12-24 22:28:35 +03:00
|
|
|
if (!(gControllerHold[gMainController].button & A_BUTTON)) {
|
2024-04-25 07:14:49 +03:00
|
|
|
this->lockOnTimers[TEAM_ID_FOX]--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2023-12-24 22:28:35 +03:00
|
|
|
gChargeTimers[0] = 0;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_0C4 != 0) {
|
|
|
|
this->timer_0C4--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
switch (this->obj.status) {
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_INIT:
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.status = OBJ_ACTIVE;
|
|
|
|
Object_Init(this->index, this->obj.id);
|
2024-08-12 17:58:54 +03:00
|
|
|
if (this->obj.id != OBJ_ACTOR_ZO_RADARBUOY) {
|
2024-04-09 01:25:56 +03:00
|
|
|
Actor_Move(this);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_ACTIVE:
|
2024-04-09 01:25:56 +03:00
|
|
|
Actor_Move(this);
|
|
|
|
if ((this->obj.status != OBJ_FREE) && (this->info.action != NULL)) {
|
|
|
|
this->info.action(&this->obj);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_DYING:
|
2024-04-09 01:25:56 +03:00
|
|
|
Actor_Move(this);
|
|
|
|
if (this->obj.status != OBJ_FREE) {
|
|
|
|
Object_Dying(this->index, this->obj.id);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void Boss_Update(Boss* this) {
|
|
|
|
if (this->timer_050 != 0) {
|
|
|
|
this->timer_050--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_052 != 0) {
|
|
|
|
this->timer_052--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_054 != 0) {
|
|
|
|
this->timer_054--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_056 != 0) {
|
|
|
|
this->timer_056--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_058 != 0) {
|
|
|
|
this->timer_058--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_05A != 0) {
|
|
|
|
this->timer_05A--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_05C != 0) {
|
|
|
|
this->timer_05C--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
switch (this->obj.status) {
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_INIT:
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.status = OBJ_ACTIVE;
|
|
|
|
Object_Init(this->index, this->obj.id);
|
|
|
|
Boss_Move(this);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_ACTIVE:
|
2024-04-09 01:25:56 +03:00
|
|
|
Boss_Move(this);
|
|
|
|
if ((this->obj.status != OBJ_FREE) && (this->info.action != NULL)) {
|
|
|
|
this->info.action(&this->obj);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_DYING:
|
2024-04-09 01:25:56 +03:00
|
|
|
Boss_Move(this);
|
|
|
|
if (this->obj.status != OBJ_FREE) {
|
|
|
|
Object_Dying(this->index, this->obj.id);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-23 05:51:20 +03:00
|
|
|
void Scenery_Update(Scenery* this) {
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_4C != 0) {
|
|
|
|
this->timer_4C--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
switch (this->obj.status) {
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_INIT:
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.status = OBJ_ACTIVE;
|
|
|
|
Object_Init(this->index, this->obj.id);
|
2024-04-23 05:51:20 +03:00
|
|
|
Scenery_Move(this);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_ACTIVE:
|
2024-04-23 05:51:20 +03:00
|
|
|
Scenery_Move(this);
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->info.action != NULL) {
|
|
|
|
this->info.action(&this->obj);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void Sprite_Update(Sprite* this) {
|
|
|
|
switch (this->obj.status) {
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_INIT:
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.status = OBJ_ACTIVE;
|
|
|
|
Object_Init(this->index, this->obj.id);
|
|
|
|
Sprite_Move(this);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_ACTIVE:
|
2024-04-09 01:25:56 +03:00
|
|
|
Sprite_Move(this);
|
|
|
|
if (this->info.action != NULL) {
|
|
|
|
this->info.action(&this->obj);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_DYING:
|
2024-04-09 01:25:56 +03:00
|
|
|
Sprite_Move(this);
|
|
|
|
Object_Dying(this->index, this->obj.id);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void Item_Update(Item* this) {
|
|
|
|
if (this->timer_48 != 0) {
|
|
|
|
this->timer_48--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer_4A != 0) {
|
|
|
|
this->timer_4A--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
switch (this->obj.status) {
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_INIT:
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.status = OBJ_ACTIVE;
|
|
|
|
Object_Init(this->index, this->obj.id);
|
|
|
|
Item_Move(this);
|
2023-11-18 18:44:33 +03:00
|
|
|
break;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_ACTIVE:
|
2024-04-09 01:25:56 +03:00
|
|
|
Item_Move(this);
|
|
|
|
if (this->info.action != NULL) {
|
|
|
|
this->info.action(&this->obj);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void Effect_Update(Effect* this) {
|
|
|
|
if (this->timer_50 != 0) {
|
|
|
|
this->timer_50--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
switch (this->obj.status) {
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_INIT:
|
2024-04-09 01:25:56 +03:00
|
|
|
this->obj.status = OBJ_ACTIVE;
|
|
|
|
Object_Init(this->index, this->obj.id);
|
2023-11-18 18:44:33 +03:00
|
|
|
/* fallthrough */
|
2024-01-21 23:42:06 +03:00
|
|
|
case OBJ_ACTIVE:
|
2024-04-09 01:25:56 +03:00
|
|
|
Effect_Move(this);
|
|
|
|
if ((this->obj.status != OBJ_FREE) && (this->info.action != NULL)) {
|
|
|
|
this->info.action(&this->obj);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void TexturedLine_Update(TexturedLine* this) {
|
2023-11-18 18:44:33 +03:00
|
|
|
Vec3f sp44;
|
|
|
|
Vec3f sp38;
|
2024-05-02 23:46:51 +03:00
|
|
|
f32 dx;
|
|
|
|
f32 dy;
|
|
|
|
f32 dz;
|
2023-11-18 18:44:33 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->timer != 0) {
|
|
|
|
this->timer--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
dx = this->posAA.x - this->posBB.x;
|
|
|
|
dy = this->posAA.y - this->posBB.y;
|
|
|
|
dz = this->posAA.z - this->posBB.z;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
this->yRot = Math_Atan2F(dx, dz);
|
|
|
|
this->xRot = -Math_Atan2F(dy, sqrtf(SQ(dx) + SQ(dz)));
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->mode != 4) {
|
2024-05-02 23:46:51 +03:00
|
|
|
this->zScale = sqrtf(SQ(dx) + SQ(dy) + SQ(dz));
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-07 07:05:58 +03:00
|
|
|
|
2023-12-14 17:41:43 +03:00
|
|
|
if (gGameState == GSTATE_PLAY) {
|
2024-04-09 01:25:56 +03:00
|
|
|
if (((this->mode == 1) || (this->mode == 101) || (this->mode == 50)) &&
|
2024-05-02 23:46:51 +03:00
|
|
|
(gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) && (gPlayer[0].hitTimer == 0)) {
|
|
|
|
Matrix_RotateX(gCalcMatrix, -this->xRot, MTXF_NEW);
|
|
|
|
Matrix_RotateY(gCalcMatrix, -this->yRot, MTXF_APPLY);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
sp44.x = gPlayer[gPlayerNum].pos.x - this->posAA.x;
|
|
|
|
sp44.y = gPlayer[gPlayerNum].pos.y - this->posAA.y;
|
|
|
|
sp44.z = gPlayer[gPlayerNum].trueZpos - this->posAA.z;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2023-11-24 22:11:20 +03:00
|
|
|
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp44, &sp38);
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
sp38.x += this->posAA.x;
|
|
|
|
sp38.y += this->posAA.y;
|
|
|
|
sp38.z += this->posAA.z;
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
if ((fabsf(sp38.x - this->posAA.x) < 30.0f) && (fabsf(sp38.y - this->posAA.y) < 30.0f) &&
|
|
|
|
(sp38.z < this->posAA.z) && ((this->posAA.z - this->zScale) < sp38.z)) {
|
2023-12-14 17:41:43 +03:00
|
|
|
if (gCurrentLevel == LEVEL_AQUAS) {
|
2023-12-24 22:28:35 +03:00
|
|
|
Player_ApplyDamage(&gPlayer[0], 0, 30);
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2023-12-24 22:28:35 +03:00
|
|
|
Player_ApplyDamage(&gPlayer[0], 0, 20);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-09 01:25:56 +03:00
|
|
|
if (this->mode < 100) {
|
|
|
|
this->mode = 0;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
if (((this->posAA.z + gPathProgress) > 1000.0f) && (gLevelMode != LEVELMODE_ALL_RANGE)) {
|
2024-04-09 01:25:56 +03:00
|
|
|
this->mode = 0;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
if (((this->mode == 3) || (this->mode == 50)) && (this->timer == 0)) {
|
|
|
|
this->mode = 0;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-17 07:06:28 +03:00
|
|
|
void TexturedLine_UpdateAll(void) {
|
|
|
|
TexturedLine* texLine;
|
2024-01-24 17:45:55 +03:00
|
|
|
s32 i;
|
2023-11-18 18:44:33 +03:00
|
|
|
|
2024-03-17 07:06:28 +03:00
|
|
|
for (i = 0, texLine = gTexturedLines; i < ARRAY_COUNT(gTexturedLines); i++, texLine++) {
|
|
|
|
if (texLine->mode != 0) {
|
|
|
|
TexturedLine_Update(texLine);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-09 01:25:56 +03:00
|
|
|
void Object_Update(void) {
|
2023-11-18 18:44:33 +03:00
|
|
|
s32 i;
|
|
|
|
s32 pad;
|
2024-04-23 05:51:20 +03:00
|
|
|
Scenery360* scenery360;
|
2024-01-14 01:45:37 +03:00
|
|
|
Actor* actor;
|
2024-01-07 01:39:23 +03:00
|
|
|
Boss* boss;
|
2024-04-09 01:25:56 +03:00
|
|
|
Sprite* sprite;
|
2024-04-23 05:51:20 +03:00
|
|
|
Scenery* scenery;
|
2023-12-20 22:32:50 +03:00
|
|
|
Item* item;
|
2024-01-13 16:43:04 +03:00
|
|
|
Effect* effect;
|
2023-11-18 18:44:33 +03:00
|
|
|
|
2024-05-02 23:46:51 +03:00
|
|
|
gCullObjects = false;
|
2023-12-24 22:28:35 +03:00
|
|
|
if ((gLevelMode == LEVELMODE_ON_RAILS) &&
|
2024-04-16 02:38:19 +03:00
|
|
|
((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_INIT) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) ||
|
|
|
|
(gPlayer[0].state_1C8 == PLAYERSTATE_1C8_DOWN) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ENTER_WARP_ZONE) ||
|
|
|
|
(gPlayer[0].state_1C8 == PLAYERSTATE_1C8_START_360) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_NEXT))) {
|
2024-05-02 23:46:51 +03:00
|
|
|
gCullObjects = true;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2023-12-24 22:28:35 +03:00
|
|
|
if (gLevelMode != LEVELMODE_ALL_RANGE) {
|
2024-04-16 02:38:19 +03:00
|
|
|
if ((gLoadLevelObjects != 0) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO)) {
|
2024-04-26 01:01:25 +03:00
|
|
|
Object_LoadLevelObjects();
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
2024-04-23 05:51:20 +03:00
|
|
|
for (i = 0, scenery = gScenery; i < ARRAY_COUNT(gScenery); i++, scenery++) {
|
|
|
|
if (scenery->obj.status != OBJ_FREE) {
|
|
|
|
scenery->index = i;
|
|
|
|
Scenery_Update(scenery);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2023-12-20 22:32:50 +03:00
|
|
|
} else if (gVersusMode) {
|
2024-04-23 05:51:20 +03:00
|
|
|
for (i = 0, scenery360 = gScenery360; i < 200; i++, scenery360++) {
|
2024-08-12 17:58:54 +03:00
|
|
|
if ((scenery360->obj.status != OBJ_FREE) && (scenery360->obj.id == OBJ_SCENERY_VS_SPACE_JUNK_3)) {
|
2024-04-09 01:25:56 +03:00
|
|
|
if ((i % 2) != 0) {
|
2024-04-23 05:51:20 +03:00
|
|
|
scenery360->obj.rot.y += 0.5f;
|
2023-11-18 18:44:33 +03:00
|
|
|
} else {
|
2024-04-23 05:51:20 +03:00
|
|
|
scenery360->obj.rot.y -= 0.5f;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
for (i = 0, sprite = &gSprites[0]; i < ARRAY_COUNT(gSprites); i++, sprite++) {
|
2024-04-09 01:25:56 +03:00
|
|
|
if (sprite->obj.status != OBJ_FREE) {
|
|
|
|
sprite->index = i;
|
|
|
|
Sprite_Update(sprite);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
for (i = 0, boss = &gBosses[0]; i < ARRAY_COUNT(gBosses); i++, boss++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (boss->obj.status != OBJ_FREE) {
|
2024-01-07 01:39:23 +03:00
|
|
|
boss->index = i;
|
|
|
|
Boss_Update(boss);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
for (i = 0, actor = &gActors[0]; i < ARRAY_COUNT(gActors); i++, actor++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (actor->obj.status != OBJ_FREE) {
|
2024-01-14 01:45:37 +03:00
|
|
|
actor->index = i;
|
|
|
|
Actor_Update(actor);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
for (i = 0, item = &gItems[0]; i < ARRAY_COUNT(gItems); i++, item++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (item->obj.status != OBJ_FREE) {
|
2023-12-20 22:32:50 +03:00
|
|
|
item->index = i;
|
|
|
|
Item_Update(item);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
|
|
|
for (i = 0, effect = &gEffects[0]; i < ARRAY_COUNT(gEffects); i++, effect++) {
|
2024-01-21 23:42:06 +03:00
|
|
|
if (effect->obj.status != OBJ_FREE) {
|
2024-01-13 16:43:04 +03:00
|
|
|
effect->index = i;
|
|
|
|
Effect_Update(effect);
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-03-17 07:06:28 +03:00
|
|
|
TexturedLine_UpdateAll();
|
2024-07-06 15:47:49 +03:00
|
|
|
|
2024-04-03 02:20:08 +03:00
|
|
|
for (i = 0; i < ARRAY_COUNT(D_enmy_Timer_80161670); i++) {
|
|
|
|
if (D_enmy_Timer_80161670[i] != 0) {
|
|
|
|
D_enmy_Timer_80161670[i]--;
|
2023-11-18 18:44:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|