Starship/src/main/fox_beam.c
petrie911 a0ec7a5516
Area 6 decomp, Object_408 -> boss, more overlay symbols in main (#70)
* 408

* more stuff

* brutal matches

* data and such

* gPlayer

* names and boss and such

* cat

* forgot something
2024-01-06 19:39:23 -03:00

2298 lines
96 KiB
C

#include "global.h"
static Vec3f D_8015F950;
void func_80035D30(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos) {
Object_8C_Initialize(obj8C);
obj8C->obj.status = 1;
obj8C->obj.id = OBJ_8C_351;
obj8C->obj.pos.x = xPos;
obj8C->obj.pos.y = yPos;
obj8C->obj.pos.z = zPos;
obj8C->vel.z = 0.0f;
obj8C->scale2 = 0.3f;
obj8C->unk_4A = 100;
obj8C->unk_48 = 3;
if (Rand_ZeroOne() < 0.5f) {
obj8C->unk_48 = -obj8C->unk_48;
}
Object_SetInfo(&obj8C->info, obj8C->obj.id);
}
void func_80035DEC(f32 xPos, f32 yPos, f32 zPos) {
s32 i;
for (i = 0; i < ARRAY_COUNT(gObjects8C); i++) {
if (gObjects8C[i].obj.status == 0) {
func_80035D30(&gObjects8C[i], xPos, yPos, zPos);
break;
}
}
}
void PlayerShot_Initialize(PlayerShot* shot) {
s32 i;
u8* ptr = (u8*) shot;
for (i = 0; i < sizeof(PlayerShot); i++, ptr++) {
*ptr = 0;
}
}
void func_80035E78(PlayerShot* shot) {
f32 var_fs0;
f32 var_fv0;
f32 var_fv1;
s32 var_v0;
if (shot->unk_5C == 0) {
shot->vel.x = shot->vel.y = shot->vel.z = shot->obj.rot.x = shot->obj.rot.y = shot->obj.rot.z = 0.0f;
shot->unk_44 = 1.0f;
shot->unk_5C = 1;
shot->unk_64 = 30;
shot->unk_58 = 150;
func_8001CE28(shot->playerNum, &shot->sfxPos);
D_Timer_80161A60 = 4;
if (shot->obj.pos.y < (D_80177940 + 450.0f)) {
D_80178480 = 15;
if (D_80161A88 == 2) {
func_8007D9DC(shot->obj.pos.x, D_80177940 + 2.0f, shot->obj.pos.z, shot->unk_48 * 0.1f,
shot->unk_48 * 3.0f, 0);
func_8007D9DC(shot->obj.pos.x, D_80177940 + 2.0f, shot->obj.pos.z, shot->unk_48 * 0.1f,
shot->unk_48 * 3.0f, 5);
func_8007D9DC(shot->obj.pos.x, D_80177940 + 2.0f, shot->obj.pos.z, shot->unk_48 * 0.1f,
shot->unk_48 * 3.0f, 10);
func_8007ADF4(shot->obj.pos.x, D_80177940, shot->obj.pos.z, shot->unk_48 * 0.05f, shot->unk_48 * 0.5f);
func_8007A6F0(&shot->obj.pos, 0x19000014);
} else {
func_80062B60(shot->obj.pos.x, shot->obj.pos.z, 0, shot->unk_48 * 3.0f);
}
}
if (gCurrentLevel == LEVEL_BOLSE) {
var_fv0 = 180.0f - (shot->obj.pos.y / 20.0f);
if (var_fv0 < 50.0f) {
var_fv0 = 50.0f;
}
var_fv1 = shot->obj.pos.y / 1000.0f;
if (var_fv1 > 2.0f) {
var_fv1 = 2.0f;
}
func_8007B550(shot->obj.pos.x, D_80177940 + 6.0f, shot->obj.pos.z, shot->unk_48 * (1.5f + var_fv1),
var_fv0);
}
if (gVersusMode) {
var_v0 = shot->playerNum + 10;
} else {
var_v0 = 0;
}
func_8007B344(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, shot->unk_48 * 1.5f, var_v0);
if (D_80178294 != 0) {
var_fs0 = 5.0f;
if (shot->obj.pos.y > 300.0f) {
var_fs0 = 1.0f;
} else if (shot->obj.pos.y > 200.0f) {
var_fs0 = 2.0f;
} else if (shot->obj.pos.y > 100.0f) {
var_fs0 = 3.0f;
} else if (shot->obj.pos.y > 0.0f) {
var_fs0 = 4.0f;
}
var_fs0 *= 2.0f;
func_8007AFD0(shot->obj.pos.x, shot->obj.pos.z, 50.0f, 0.0f, var_fs0);
func_8007AFD0(shot->obj.pos.x, shot->obj.pos.z, 46.0f, 19.0f, var_fs0);
func_8007AFD0(shot->obj.pos.x, shot->obj.pos.z, 35.0f, 35.0f, var_fs0);
func_8007AFD0(shot->obj.pos.x, shot->obj.pos.z, 19.0f, 46.0f, var_fs0);
func_8007AFD0(shot->obj.pos.x, shot->obj.pos.z, 0.0f, 50.0f, var_fs0);
func_8007AFD0(shot->obj.pos.x, shot->obj.pos.z, -50.0f, 0.0f, var_fs0);
func_8007AFD0(shot->obj.pos.x, shot->obj.pos.z, -46.0f, 19.0f, var_fs0);
func_8007AFD0(shot->obj.pos.x, shot->obj.pos.z, -35.0f, 35.0f, var_fs0);
func_8007AFD0(shot->obj.pos.x, shot->obj.pos.z, -19.0f, 46.0f, var_fs0);
}
}
}
void func_80036318(PlayerShot* shot) {
s32 var_v0_2;
s32 i;
if (shot->obj.id == PLAYERSHOT_4) {
Object_Kill(&shot->obj, &shot->sfxPos);
return;
}
shot->obj.pos.z = D_80178498; // strange order on the globals
shot->obj.pos.y = D_801784A0;
shot->obj.pos.x = D_8017849C;
if ((shot->obj.id == PLAYERSHOT_3) ||
((gCurrentLevel != LEVEL_AQUAS) && (shot->obj.id == PLAYERSHOT_8) && (shot->unk_5C != 0))) {
if (shot->obj.id == PLAYERSHOT_8) {
shot->obj.id = PLAYERSHOT_3;
shot->unk_5C = 0;
}
func_80035E78(shot);
} else if (shot->obj.id == PLAYERSHOT_8) {
shot->unk_44 = 7.5f;
for (i = 0; i < ARRAY_COUNT(gObjects2F4); i++) {
gObjects2F4[i].timer_0CA[shot->playerNum] = 0;
}
shot->vel.x = shot->vel.y = shot->vel.z = 0.0f;
if (gCurrentLevel == LEVEL_AQUAS) {
D_80178360 = D_80178364 = D_80178368 = 0;
func_8007B344(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 10.0f, 4);
func_8007C120(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 0.0f, 0.0f, 0.0f, 0.3f, 30);
} else {
if (gVersusMode) {
var_v0_2 = shot->playerNum + 10;
} else {
var_v0_2 = 12;
}
func_8007B344(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 10.0f, var_v0_2);
func_8007D2C8(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 4.0f);
}
} else {
shot->obj.status = 2;
shot->unk_60 = 0;
}
}
void func_80036528(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos, f32 yRot, f32 xRot, f32 scale, s32 unk44, s32 time) {
Object_8C_Initialize(obj8C);
obj8C->obj.status = 1;
obj8C->obj.id = OBJ_8C_344;
obj8C->obj.pos.x = xPos;
obj8C->obj.pos.y = yPos;
obj8C->obj.pos.z = zPos;
obj8C->obj.rot.y = yRot;
obj8C->obj.rot.x = xRot;
obj8C->scale2 = scale * 0.5f;
obj8C->unk_44 = unk44;
obj8C->unk_46 = 80;
obj8C->timer_50 = time;
Object_SetInfo(&obj8C->info, obj8C->obj.id);
func_800A6070(&obj8C->sfxPos, 0x29000000);
}
void func_800365E4(f32 xPos, f32 yPos, f32 zPos, f32 arg3, f32 arg4, f32 arg5, f32 yRot, f32 xRot, f32 scale, s32 unk44,
s32 time) {
s32 i;
if ((D_801784AC != 4) && (gLevelType == LEVELTYPE_PLANET) && (D_80161A88 != 2) && (gCurrentLevel != LEVEL_SOLAR) &&
(gCurrentLevel != LEVEL_BOLSE) && (gCurrentLevel != LEVEL_TRAINING) && (gCurrentLevel != LEVEL_ZONESS)) {
for (i = 0; i < 50; i++) {
if (gObjects8C[i].obj.status == 0) {
func_80036528(&gObjects8C[i], xPos, yPos, zPos, yRot, xRot, scale, unk44, time);
break;
}
}
}
}
void func_800366CC(Object_8C* obj8C, f32 xPos, f32 yPos, f32 zPos, f32 yRot, f32 scale) {
Object_8C_Initialize(obj8C);
obj8C->obj.status = 1;
obj8C->obj.id = OBJ_8C_345;
obj8C->obj.pos.x = xPos;
obj8C->obj.pos.y = yPos;
obj8C->obj.pos.z = zPos;
obj8C->obj.rot.y = yRot;
obj8C->scale2 = scale * 0.5f;
obj8C->timer_50 = 80;
Object_SetInfo(&obj8C->info, obj8C->obj.id);
func_800A6070(&obj8C->sfxPos, 0x29000000);
}
void func_80036770(f32 xPos, f32 yPos, f32 zPos, f32 yRot, f32 scale) {
s32 i;
if ((D_801784AC != 4) && (gLevelType == LEVELTYPE_PLANET) && (D_80161A88 <= 0) &&
(gCurrentLevel != LEVEL_TRAINING) && (gCurrentLevel != LEVEL_SOLAR) && (gCurrentLevel != LEVEL_ZONESS)) {
for (i = 0; i < 50; i++) {
if (gObjects8C[i].obj.status == 0) {
func_800366CC(&gObjects8C[i], xPos, yPos, zPos, yRot, scale);
func_8007D10C(xPos, yPos, zPos, 2.0f);
break;
}
}
}
if (gCurrentLevel == LEVEL_BOLSE) {
func_8007D10C(xPos, yPos, zPos, 2.0f);
}
}
s32 func_80036874(PlayerShot* shot, f32* hitboxData, Object* obj) {
s32 count;
f32 shotPx;
f32 shotPy;
f32 shotPz;
f32 xySizeMod;
f32 boxRotX;
f32 boxRotY;
f32 boxRotZ;
f32 rotateBox;
f32 checkDist;
Vec3f spAC;
Vec3f spA0;
s32 i;
Hitbox* hitbox;
checkDist = 2000.0f;
if ((gCurrentLevel == LEVEL_KATINA) || (gCurrentLevel == LEVEL_SECTOR_Y)) {
checkDist = 5000.0f;
} else if (gCurrentLevel == LEVEL_ZONESS) {
checkDist = 3500.0f;
}
if ((fabsf(shot->obj.pos.z - obj->pos.z) < checkDist) && (fabsf(shot->obj.pos.x - obj->pos.x) < checkDist) &&
(fabsf(shot->obj.pos.y - obj->pos.y) < checkDist)) {
count = *hitboxData;
if (count != 0) {
xySizeMod = 10.0f;
if ((shot->playerNum < 4) &&
((gLaserStrength[shot->playerNum] != LASERS_SINGLE) || (shot->obj.id == PLAYERSHOT_8))) {
xySizeMod += 30.0f;
}
hitboxData++;
for (i = 0; i < count; i++, hitboxData += 6) {
rotateBox = 0.0f;
boxRotZ = 0.0f;
boxRotY = 0.0f;
boxRotX = 0.0f;
if (hitboxData[0] >= HITBOX_UNK_3) {
return 0;
}
if (hitboxData[0] == HITBOX_UNK_2) {
rotateBox = 1.0f;
boxRotX = hitboxData[1];
boxRotY = hitboxData[2];
boxRotZ = hitboxData[3];
hitboxData += 4;
}
if ((obj->rot.y == 0.0f) && (obj->rot.z == 0.0f) && (obj->rot.x == 0.0f) && (rotateBox == 0.0f)) {
shotPx = shot->obj.pos.x;
shotPy = shot->obj.pos.y;
shotPz = shot->obj.pos.z;
} else {
Matrix_RotateZ(gCalcMatrix, -boxRotZ * M_DTOR, 0);
Matrix_RotateX(gCalcMatrix, -boxRotX * M_DTOR, 1);
Matrix_RotateY(gCalcMatrix, -boxRotY * M_DTOR, 1);
Matrix_RotateZ(gCalcMatrix, -obj->rot.z * M_DTOR, 1);
Matrix_RotateX(gCalcMatrix, -obj->rot.x * M_DTOR, 1);
Matrix_RotateY(gCalcMatrix, -obj->rot.y * M_DTOR, 1);
spAC.x = shot->obj.pos.x - obj->pos.x;
spAC.y = shot->obj.pos.y - obj->pos.y;
spAC.z = shot->obj.pos.z - obj->pos.z;
Matrix_MultVec3fNoTranslate(gCalcMatrix, &spAC, &spA0);
shotPx = obj->pos.x + spA0.x;
shotPy = obj->pos.y + spA0.y;
shotPz = obj->pos.z + spA0.z;
}
hitbox = (Hitbox*) hitboxData;
if ((fabsf(hitbox->z.offset + obj->pos.z - shotPz) < (hitbox->z.size + 50.0f)) &&
(fabsf(hitbox->x.offset + obj->pos.x - shotPx) < (hitbox->x.size + xySizeMod)) &&
(fabsf(hitbox->y.offset + obj->pos.y - shotPy) < (hitbox->y.size + xySizeMod))) {
if (shot->obj.id == PLAYERSHOT_4) {
Object_Kill(&shot->obj, &shot->sfxPos);
return 0;
}
if ((obj->id < 176) || (obj->id >= 292)) {
func_80036318(shot);
}
if ((obj->id == 15) || ((obj->id == 22) && (i == 0)) || ((obj->id == 10) && (i == 0)) ||
((obj->id == 13) && (i == 0)) || ((obj->id == 12) && (i < 3)) || (obj->id == 16) ||
(obj->id == 14)) {
if (shot->obj.pos.x - (obj->pos.x + hitbox->x.offset) < -hitbox->x.size) {
if (hitbox->z.size + (obj->pos.z + hitbox->z.offset) < shot->obj.pos.z) {
shot->obj.pos.z = hitbox->z.size + (obj->pos.z + hitbox->z.offset) - 5.0f;
}
func_800365E4((hitbox->x.offset + obj->pos.x) - (hitbox->x.size + 2.0f), shot->obj.pos.y,
shot->obj.pos.z, obj->pos.x, obj->pos.z, obj->rot.y, obj->rot.y + 90.0f, 0.0f,
2.0f, 1, 20);
return i + 1;
}
if (hitbox->x.size < shot->obj.pos.x - (obj->pos.x + hitbox->x.offset)) {
if ((hitbox->z.size + (obj->pos.z + hitbox->z.offset)) < shot->obj.pos.z) {
shot->obj.pos.z = hitbox->z.size + (obj->pos.z + hitbox->z.offset) - 5.0f;
}
func_800365E4(hitbox->x.size + (hitbox->x.offset + obj->pos.x) + 2.0f, shot->obj.pos.y,
shot->obj.pos.z, obj->pos.x, obj->pos.z, obj->rot.y, obj->rot.y + 90.0f, 0.0f,
2.0f, 1, 20);
return i + 1;
}
if (((hitbox->y.size + (obj->pos.y + hitbox->y.offset)) - 10.0f) <= shot->obj.pos.y) {
shot->obj.pos.y = ((hitbox->y.size + (obj->pos.y + hitbox->y.offset)) - 10.0f);
}
func_800365E4(shot->obj.pos.x, shot->obj.pos.y,
hitbox->z.size + (obj->pos.z + hitbox->z.offset) + 20.0f, obj->pos.x, obj->pos.z,
0.0f, 0.0f, 0.0f, 2.0f, 1, 20);
return i + 1;
}
if (obj->id < 161) {
func_8007A6F0(&shot->obj.pos, 0x29121007);
}
return i + 1;
}
}
}
}
return 0;
}
s32 func_80036F88(PlayerShot* shot, Object_2F4* obj2F4) {
s32 i;
f32* hitboxData;
f32 shotPx;
f32 shotPy;
f32 shotPz;
f32 xySizeMod;
Vec3f sp7C;
Vec3f sp70;
Hitbox* hitbox;
s32 count;
if ((fabsf(shot->obj.pos.z - obj2F4->obj.pos.z) < 2000.0f) &&
(fabsf(shot->obj.pos.y - obj2F4->obj.pos.y) < 2000.0f) &&
(fabsf(shot->obj.pos.x - obj2F4->obj.pos.x) < 2000.0f)) {
hitboxData = obj2F4->info.hitbox;
count = *hitboxData++;
if (count != 0) {
xySizeMod = 0.0f;
if (obj2F4->info.unk_16 == 1) {
xySizeMod = fabsf((obj2F4->obj.pos.z + D_80177D20) / 50.0f) + 10.0f;
if ((shot->playerNum < 4) &&
((gLaserStrength[shot->playerNum] != LASERS_SINGLE) || (shot->obj.id == PLAYERSHOT_8))) {
xySizeMod += 30.0f;
}
}
for (i = 0; i < count; i++, hitboxData += 6) {
if (obj2F4->info.unk_16 == 1) {
shotPx = shot->obj.pos.x;
shotPy = shot->obj.pos.y;
shotPz = shot->obj.pos.z;
} else {
if (hitboxData[0] == HITBOX_UNK_2) {
Matrix_RotateZ(gCalcMatrix, -hitboxData[3] * M_DTOR, 0);
Matrix_RotateX(gCalcMatrix, -hitboxData[1] * M_DTOR, 1);
Matrix_RotateY(gCalcMatrix, -hitboxData[2] * M_DTOR, 1);
Matrix_RotateZ(gCalcMatrix, -obj2F4->obj.rot.z * M_DTOR, 1);
Matrix_RotateX(gCalcMatrix, -obj2F4->obj.rot.x * M_DTOR, 1);
Matrix_RotateY(gCalcMatrix, -obj2F4->obj.rot.y * M_DTOR, 1);
hitboxData += 4;
} else {
Matrix_RotateZ(gCalcMatrix, -obj2F4->obj.rot.z * M_DTOR, 0);
Matrix_RotateX(gCalcMatrix, -obj2F4->obj.rot.x * M_DTOR, 1);
Matrix_RotateY(gCalcMatrix, -obj2F4->obj.rot.y * M_DTOR, 1);
}
if (((obj2F4->unk_2E8.z != 0.0f) || (obj2F4->unk_2E8.x != 0.0f) || (obj2F4->unk_0F4.z != 0.0f) ||
(obj2F4->unk_2E8.y != 0.0f)) &&
(obj2F4->unk_0B4 != 31)) {
Matrix_RotateZ(gCalcMatrix, -(obj2F4->unk_2E8.z + obj2F4->unk_0F4.z) * M_DTOR, 1);
Matrix_RotateX(gCalcMatrix, -obj2F4->unk_2E8.x * M_DTOR, 1);
Matrix_RotateY(gCalcMatrix, -obj2F4->unk_2E8.y * M_DTOR, 1);
}
sp7C.x = shot->obj.pos.x - obj2F4->obj.pos.x;
sp7C.y = shot->obj.pos.y - obj2F4->obj.pos.y;
sp7C.z = shot->obj.pos.z - obj2F4->obj.pos.z;
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp7C, &sp70);
shotPx = obj2F4->obj.pos.x + sp70.x;
shotPy = obj2F4->obj.pos.y + sp70.y;
shotPz = obj2F4->obj.pos.z + sp70.z;
}
hitbox = (Hitbox*) hitboxData;
if ((fabsf(hitbox->z.offset + obj2F4->obj.pos.z - shotPz) < (hitbox->z.size + 50.0f)) &&
(fabsf(hitbox->x.offset + obj2F4->obj.pos.x - shotPx) < (hitbox->x.size + xySizeMod)) &&
(fabsf(hitbox->y.offset + obj2F4->obj.pos.y - shotPy) < (hitbox->y.size + xySizeMod))) {
return i + 1;
}
}
}
}
return 0;
}
bool func_80037438(PlayerShot* shot, Object_2F4* obj2F4) {
Object* shotx = &shot->obj;
f32 temp_fv1 = obj2F4->obj.pos.x - shotx->pos.x;
f32 temp_fa0 = obj2F4->obj.pos.z - shotx->pos.z;
f32 var_fa1;
f32* hitboxData = obj2F4->info.hitbox;
if (((s32) hitboxData[0] != 0) && (sqrtf(SQ(temp_fv1) + SQ(temp_fa0)) <= 500.0f)) {
if (shot->playerNum < 4) {
temp_fv1 = obj2F4->obj.pos.x - gPlayer[0].camEye.x;
temp_fa0 = obj2F4->obj.pos.z + D_80177D20 - gPlayer[0].camEye.z;
var_fa1 = (sqrtf(SQ(temp_fv1) + SQ(temp_fa0)) / 50.0f) + 20.0f + 10.0f;
if (var_fa1 > 200.0f) {
var_fa1 = 200.0f;
}
if (shotx->id == PLAYERSHOT_8) {
var_fa1 = 30.0f;
} else if (gLaserStrength[shot->playerNum] != LASERS_SINGLE) {
var_fa1 += 30.0f;
}
if (fabsf(hitboxData[1] + obj2F4->obj.pos.z - shotx->pos.z) < (hitboxData[2] + var_fa1)) {
if (fabsf(hitboxData[3] + obj2F4->obj.pos.y - shotx->pos.y) < (hitboxData[4] + var_fa1)) {
if (fabsf(hitboxData[5] + obj2F4->obj.pos.x - shotx->pos.x) < (hitboxData[6] + var_fa1)) {
return true;
}
}
}
} else {
if (fabsf(hitboxData[1] + obj2F4->obj.pos.z - shotx->pos.z) < hitboxData[2]) {
if (fabsf(hitboxData[3] + obj2F4->obj.pos.y - shotx->pos.y) < hitboxData[4]) {
if (fabsf(hitboxData[5] + obj2F4->obj.pos.x - shotx->pos.x) < hitboxData[6]) {
return true;
}
}
}
}
}
return false;
}
bool func_80037698(PlayerShot* shot, Object_4C* obj4C) {
f32* temp_v0 = obj4C->info.hitbox;
if (((s32) temp_v0[0] != 0) && (fabsf(temp_v0[1] + obj4C->obj.pos.z - shot->obj.pos.z) < temp_v0[2]) &&
(fabsf(temp_v0[3] + obj4C->obj.pos.y - shot->obj.pos.y) < temp_v0[4]) &&
(fabsf(temp_v0[5] + obj4C->obj.pos.x - shot->obj.pos.x) < temp_v0[6])) {
return true;
}
return false;
}
bool func_8003774C(PlayerShot* shot, ObjectId objId, Object* obj) {
Vec3f sp7C;
Vec3f sp70;
Vec3f sp64;
Vec3f sp58;
Vec3f sp4C;
f32 sp44[2];
Vec3f sp38;
bool useCol2;
s32 pad1;
sp7C.x = obj->pos.x - shot->obj.pos.x;
sp7C.z = obj->pos.z - shot->obj.pos.z;
// undefined behavior: if this check fails, the function returns no value
if (((fabsf(sp7C.x) < 1100.0f) && (fabsf(sp7C.z) < 1100.0f) && (shot->obj.pos.y < 900.0f)) ||
(objId == OBJ_BOSS_313) || (objId == OBJ_UNK_1000) || (objId == OBJ_80_39)) {
Matrix_RotateY(gCalcMatrix, -obj->rot.y * M_DTOR, 0);
sp7C.x = shot->obj.pos.x - obj->pos.x;
sp7C.y = shot->obj.pos.y - obj->pos.y;
sp7C.z = shot->obj.pos.z - obj->pos.z;
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp7C, &sp70);
sp7C.x = shot->vel.x;
sp7C.y = shot->vel.y;
sp7C.z = shot->vel.z;
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp7C, &sp38);
sp64.x = obj->pos.x + sp70.x;
sp64.y = obj->pos.y + sp70.y;
sp64.z = obj->pos.z + sp70.z;
sp58.x = obj->pos.x;
sp58.y = obj->pos.y;
sp58.z = obj->pos.z;
useCol2 = false;
switch (objId) {
case OBJ_2F4_180:
objId = COL1_0;
break;
case OBJ_80_4:
case OBJ_80_5:
objId = COL2_1;
useCol2 = true;
break;
case OBJ_80_149:
objId = COL1_5;
break;
case OBJ_80_150:
objId = COL1_6;
break;
case OBJ_BOSS_308:
objId = COL1_4;
break;
case OBJ_BOSS_312:
objId = COL1_9;
break;
case OBJ_BOSS_309:
objId = COL1_7;
break;
case OBJ_UNK_1000:
objId = COL1_3;
break;
case OBJ_BOSS_313:
objId = COL1_8;
break;
case OBJ_80_39:
objId = COL1_1;
break;
case OBJ_80_120:
objId = COL2_18;
useCol2 = true;
break;
case OBJ_80_143:
objId = COL2_17;
useCol2 = true;
break;
case OBJ_80_124:
objId = COL2_15;
useCol2 = true;
break;
case OBJ_80_126:
objId = COL2_16;
useCol2 = true;
break;
case OBJ_80_47:
objId = COL2_7;
useCol2 = true;
break;
case OBJ_80_2:
objId = COL2_2;
useCol2 = true;
break;
case OBJ_80_3:
case OBJ_80_69:
objId = COL2_3;
useCol2 = true;
break;
case OBJ_80_140:
objId = COL2_4;
useCol2 = true;
break;
case OBJ_80_141:
objId = COL2_6;
useCol2 = true;
break;
case OBJ_80_117:
objId = COL2_14;
useCol2 = true;
break;
case OBJ_80_70:
objId = COL2_8;
useCol2 = true;
break;
case OBJ_80_72:
objId = COL2_9;
useCol2 = true;
break;
case OBJ_80_71:
objId = COL2_10;
useCol2 = true;
break;
case OBJ_80_73:
objId = COL2_11;
useCol2 = true;
break;
case OBJ_80_67:
objId = COL2_12;
useCol2 = true;
break;
case OBJ_80_74:
objId = COL2_13;
useCol2 = true;
break;
default:
objId = COL2_0;
useCol2 = true;
break;
}
if (!useCol2) {
if (func_800998FC(&sp64, &sp58, &sp38, objId, &sp4C, sp44) > 0) {
if (shot->obj.id == PLAYERSHOT_4) {
Object_Kill(&shot->obj, &shot->sfxPos);
return false;
}
func_80036318(shot);
func_8007A6F0(&shot->obj.pos, 0x29121007);
if (gCurrentLevel == LEVEL_METEO) {
Matrix_RotateY(gCalcMatrix, obj->rot.y * M_DTOR, 0);
sp7C.x = sp4C.x - obj->pos.x;
sp7C.y = sp4C.y - obj->pos.y;
sp7C.z = sp4C.z - obj->pos.z;
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp7C, &sp70);
shot->obj.pos.x = obj->pos.x + sp70.x;
shot->obj.pos.y = obj->pos.y + sp70.y;
shot->obj.pos.z = obj->pos.z + sp70.z;
}
if (gCurrentLevel == LEVEL_FORTUNA) {
func_8007BC7C(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 3.0f);
func_8007BC7C(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 3.0f);
}
return true;
}
} else if (func_800A3690(&sp64, &sp58, objId, &sp4C)) {
if (shot->obj.id == PLAYERSHOT_4) {
Object_Kill(&shot->obj, &shot->sfxPos);
return false;
}
func_80036318(shot);
func_8007A6F0(&shot->obj.pos, 0x29121007);
if (gCurrentLevel == LEVEL_FORTUNA) {
func_8007BC7C(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 3.0f);
func_8007BC7C(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 3.0f);
}
return true;
}
return false;
}
// return false;
}
void func_80037CF4(PlayerShot* shot, Object_2F4* obj2F4, s32 hitIndex) {
Vec3f sp44 = { 0.0f, 0.0f, -100.0f };
Vec3f sp38;
obj2F4->unk_0D0 = 1;
obj2F4->unk_0D2 = hitIndex - 1;
obj2F4->timer_0C2 = 2;
obj2F4->unk_0D6 = 10;
if ((shot->playerNum < 4) && (gPlayer[shot->playerNum].form != FORM_LANDMASTER)) {
switch (gLaserStrength[shot->playerNum]) {
case LASERS_TWIN:
obj2F4->unk_0D6 = 12;
break;
case LASERS_HYPER:
obj2F4->unk_0D6 = 15;
break;
}
} else if ((shot->playerNum >= 100) && (gCurrentLevel == LEVEL_SECTOR_X)) {
if ((gObjects2F4[shot->playerNum - 100].obj.id == 200) && (gObjects2F4[shot->playerNum - 100].unk_080 == 5)) {
obj2F4->unk_0D6 = 30;
}
}
if (shot->obj.id == PLAYERSHOT_9) {
obj2F4->unk_0D6 = 100;
} else if (shot->obj.id == PLAYERSHOT_8) {
if (gCurrentLevel == LEVEL_AQUAS) {
obj2F4->unk_0D6 = 31;
} else {
obj2F4->unk_0D0 = 2;
obj2F4->unk_0D6 = 30;
obj2F4->timer_0CA[shot->playerNum] = 0;
}
}
obj2F4->unk_0D4 = shot->playerNum + 1;
obj2F4->unk_0D8.x = shot->obj.pos.x;
obj2F4->unk_0D8.y = shot->obj.pos.y;
obj2F4->unk_0D8.z = shot->obj.pos.z;
if (((obj2F4->obj.id == OBJ_2F4_200) && (obj2F4->unk_0D2 == 0) &&
((obj2F4->unk_0B4 == 48) || (obj2F4->unk_0B4 == 49) || (obj2F4->unk_0B4 == 50))) ||
((obj2F4->obj.id == OBJ_2F4_197) && (obj2F4->unk_170 > 1.0f)) ||
((obj2F4->obj.id == OBJ_2F4_200) && (obj2F4->unk_0D2 == 0) && (obj2F4->unk_0B4 == 67)) ||
((obj2F4->obj.id == OBJ_2F4_261) && (shot->obj.id != PLAYERSHOT_8) &&
((obj2F4->unk_0B8 < 3) || (obj2F4->unk_0B8 >= 5))) ||
((obj2F4->obj.id == OBJ_2F4_260) && (shot->obj.id != PLAYERSHOT_8) && (obj2F4->timer_0BC != 0))) {
if ((obj2F4->obj.id == OBJ_2F4_261) && (obj2F4->unk_0B8 < 2)) {
obj2F4->unk_0B8 = 2;
}
if ((shot->obj.id == PLAYERSHOT_8) || (shot->obj.id == PLAYERSHOT_3)) {
func_80036318(shot);
} else {
shot->unk_64 = 25;
shot->obj.rot.y += 90.0f;
shot->obj.rot.x = Rand_ZeroOne() * 360.0f;
Matrix_RotateY(gCalcMatrix, shot->obj.rot.y * M_DTOR, 0);
Matrix_RotateX(gCalcMatrix, shot->obj.rot.x * M_DTOR, 1);
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp44, &sp38);
shot->vel.x = sp38.x;
shot->vel.y = sp38.y;
shot->vel.z = sp38.z;
shot->obj.pos.x += shot->vel.x * 5.0f;
shot->obj.pos.y += shot->vel.y * 5.0f;
shot->obj.pos.z += shot->vel.z * 5.0f;
obj2F4->timer_0C2 = 3;
func_80078E50(obj2F4->obj.pos.x, obj2F4->obj.pos.y, obj2F4->obj.pos.z, 8.0f);
Audio_PlaySfx(0x29121007, &obj2F4->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C);
func_800A668C(D_8017849C, D_801784A0, D_80178498);
}
} else {
func_80036318(shot);
}
}
void func_80038140(PlayerShot* shot) {
s32 i;
s32 temp_v0;
s32 spA4;
f32 temp_fa0;
f32 temp_fv0;
f32 temp_fv1;
f32 sp94;
Vec3f sp88;
Vec3f sp7C;
Object_2F4* obj2F4;
Boss* boss;
Object_58* obj58;
Object_4C* obj4C;
Object_80* obj80;
Object_8C* obj8C;
bool sp60;
Player* player;
sp60 = true;
if (shot->obj.id == PLAYERSHOT_4) {
sp60 = false;
}
if (sp60) {
for (i = 0, obj8C = gObjects8C; i < 100; i++, obj8C++) {
if ((obj8C->obj.status >= 2) && (obj8C->info.unk_19 != 0) &&
(fabsf(shot->obj.pos.z - obj8C->obj.pos.z) < 200.0f) &&
(fabsf(shot->obj.pos.x - obj8C->obj.pos.x) < 100.0f) &&
(fabsf(shot->obj.pos.y - obj8C->obj.pos.y) < 100.0f)) {
if (obj8C->info.unk_19 == 2) {
obj8C->unk_44 = 1;
} else {
Object_Kill(&obj8C->obj, &obj8C->sfxPos);
}
}
}
for (i = 0, obj2F4 = gObjects2F4; i < 60; i++, obj2F4++) {
if ((obj2F4->obj.status >= 2) && (obj2F4->timer_0C2 == 0)) {
switch (obj2F4->obj.id) {
case OBJ_2F4_180:
if (func_8003774C(shot, obj2F4->obj.id, &obj2F4->obj)) {
obj2F4->unk_0D0 = 1;
obj2F4->unk_0D2 = shot->playerNum;
return;
}
break;
case OBJ_2F4_200:
if (obj2F4->unk_0B4 == 42) {
if (func_8003774C(shot, OBJ_UNK_1000, &obj2F4->obj)) {
obj2F4->unk_0D0 = 1;
obj2F4->unk_0D2 = shot->playerNum;
return;
}
} else if (obj2F4->unk_0B4 == 63) {
temp_fv1 = fabsf(obj2F4->obj.pos.x - shot->obj.pos.x);
temp_fa0 = fabsf(obj2F4->obj.pos.y - shot->obj.pos.y);
temp_fv0 = fabsf(obj2F4->obj.pos.z - shot->obj.pos.z);
if (sqrtf(SQ(temp_fv1) + SQ(temp_fa0) + SQ(temp_fv0)) < 1000.0f) {
func_80037CF4(shot, obj2F4, 0);
}
} else {
temp_v0 = func_80036F88(shot, obj2F4);
if (temp_v0 != 0) {
func_80037CF4(shot, obj2F4, temp_v0);
return;
}
}
break;
default:
if (obj2F4->info.unk_16 != 0) {
if (obj2F4->obj.id == OBJ_2F4_197) {
if ((obj2F4->unk_0E4 >= 4) && (obj2F4->unk_0E4 < 10) &&
(((gCurrentLevel == LEVEL_VENOM_2) && (shot->playerNum < 104)) ||
((gCurrentLevel != LEVEL_VENOM_2) && (shot->playerNum == 0))) &&
(shot->obj.id != PLAYERSHOT_8) &&
(fabsf(obj2F4->obj.pos.x - shot->obj.pos.x) < 500.0f) &&
(fabsf(obj2F4->obj.pos.y - shot->obj.pos.y) < 300.0f) &&
(fabsf(obj2F4->obj.pos.z - shot->obj.pos.z) < 500.0f)) {
if (gCurrentLevel == LEVEL_VENOM_2) {
obj2F4->unk_094 = 1;
} else if (Rand_ZeroOne() < 0.1f) {
obj2F4->unk_094 = 1;
}
}
}
temp_v0 = func_80037438(shot, obj2F4);
if (temp_v0 != 0) {
func_80037CF4(shot, obj2F4, temp_v0);
return;
}
} else {
temp_v0 = func_80036874(shot, obj2F4->info.hitbox, &obj2F4->obj);
if (temp_v0 != 0) {
func_80037CF4(shot, obj2F4, temp_v0);
return;
}
}
break;
}
}
}
if (gLevelMode == LEVELMODE_ALL_RANGE) {
for (i = 0, player = gPlayer; i < gCamCount; i++, player++) {
temp_fv1 = 50.0f;
if (gVersusMode && (shot->playerNum < 4) &&
!((gLaserStrength[shot->playerNum] == LASERS_SINGLE) && (shot->obj.id != PLAYERSHOT_8))) {
temp_fv1 = 100.0f;
}
if (player->unk_280 >= 100) {
temp_fv1 = 150.0f;
}
if (player->form == FORM_LANDMASTER) {
temp_fv1 *= 2.0f;
temp_fa0 = temp_fv1 + 50.0f;
} else if (player->form == FORM_ON_FOOT) {
temp_fa0 = temp_fv1 + 50.0f;
} else {
temp_fa0 = temp_fv1;
}
if ((i != shot->playerNum) &&
((player->state_1C8 == PLAYERSTATE_1C8_3) || (player->state_1C8 == PLAYERSTATE_1C8_4)) &&
(fabsf(player->unk_138 - shot->obj.pos.z) < temp_fv1) &&
(fabsf(player->pos.x - shot->obj.pos.x) < temp_fv1) &&
(fabsf(player->pos.y - shot->obj.pos.y) < temp_fa0)) {
if (player->unk_280 >= 100) {
shot->obj.rot.y = player->unk_0E8 + player->unk_114 + 180.0f + 90.0f;
shot->obj.rot.x = Rand_ZeroOne() * 360.0f;
Matrix_RotateY(gCalcMatrix, shot->obj.rot.y * M_DTOR, 0);
Matrix_RotateX(gCalcMatrix, shot->obj.rot.x * M_DTOR, 1);
sp88.x = sp88.y = 0.0f;
sp88.z = -133.33333f;
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp88, &sp7C);
shot->vel.x = sp7C.x;
shot->vel.y = sp7C.y;
shot->vel.z = sp7C.z;
shot->obj.pos.x += 2.0f * shot->vel.x;
shot->obj.pos.y += 2.0f * shot->vel.y;
shot->obj.pos.z += 2.0f * shot->vel.z;
shot->unk_64 = 5;
Audio_PlaySfx(0x09007011, &player->unk_460, 0, &D_800C5D34, &D_800C5D34, &D_800C5D3C);
func_80078E50(player->pos.x, player->pos.y, player->unk_138, 8.0f);
} else {
func_80036318(shot);
if (player->unk_1F4 == 0) {
if (gPlayer[0].form == 3) {
Player_ApplyDamage(player, 0, 60);
} else {
Player_ApplyDamage(player, 0, 20);
}
player->unk_284 = 1;
if (gCamCount != 1) {
player->unk_288 = shot->playerNum + 1;
}
player->unk_0D8.x = shot->vel.x * 0.1f;
player->unk_0D8.y = shot->vel.y * 0.1f;
player->unk_0D8.z = shot->vel.z * 0.1f;
if (player->form != FORM_ON_FOOT) {
func_8007D1E0(player->pos.x, player->pos.y, player->unk_138, 2.0f);
}
}
}
}
}
}
}
if ((D_801784AC == 4) && func_E6A810_801B6AEC(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z + D_80177D20)) {
func_80036318(shot);
if (shot->obj.id != PLAYERSHOT_4) {
func_8007A900(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 2.0f, 255, 15, 0);
}
}
if ((D_80178294 != 0) && func_800A73E4(&sp94, &spA4, shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z)) {
func_80036318(shot);
if (shot->obj.id != PLAYERSHOT_4) {
func_8007B228(shot->obj.pos.x, sp94, shot->obj.pos.z, 1.0f);
}
}
if ((gLevelMode == LEVELMODE_ALL_RANGE) && (shot->playerNum < 110)) {
for (i = 0, obj58 = gObjects58; i < 200; i++, obj58++) {
if (obj58->obj.status == 2) {
if ((obj58->obj.id == OBJ_80_117) || (obj58->obj.id == OBJ_80_141) || (obj58->obj.id == OBJ_80_149) ||
(obj58->obj.id == OBJ_80_150) || (obj58->obj.id == OBJ_80_148) || (obj58->obj.id == OBJ_80_143) ||
(obj58->obj.id == OBJ_80_160) || (obj58->obj.id == OBJ_80_1) || (obj58->obj.id == OBJ_80_3) ||
(obj58->obj.id == OBJ_80_140)) {
func_8003774C(shot, obj58->obj.id, &obj58->obj);
} else {
func_80036874(shot, obj58->info.hitbox, &obj58->obj);
}
}
}
} else {
for (i = 0, obj80 = gObjects80; i < 50; i++, obj80++) {
if (obj80->obj.status == 2) {
if ((obj80->obj.id == OBJ_80_1) || (obj80->obj.id == OBJ_80_39) || (obj80->obj.id == OBJ_80_4) ||
(obj80->obj.id == OBJ_80_5) || (obj80->obj.id == OBJ_80_120) || (obj80->obj.id == OBJ_80_124) ||
(obj80->obj.id == OBJ_80_126) || (obj80->obj.id == OBJ_80_47) || (obj80->obj.id == OBJ_80_2) ||
(obj80->obj.id == OBJ_80_3) || (obj80->obj.id == OBJ_80_67) || (obj80->obj.id == OBJ_80_74) ||
(obj80->obj.id == OBJ_80_3)) {
func_8003774C(shot, obj80->obj.id, &obj80->obj);
} else {
temp_v0 = func_80036874(shot, obj80->info.hitbox, &obj80->obj);
if (temp_v0 != 0) {
obj80->unk_50 = 1;
obj80->unk_54 = temp_v0 - 1;
}
}
}
}
}
if (sp60) {
for (i = 0, obj4C = gObjects4C; i < 40; i++, obj4C++) {
if (obj4C->obj.status == 2) {
if (obj4C->obj.id != OBJ_4C_169) {
if (func_80037698(shot, obj4C)) {
obj4C->unk_46 = 1;
}
} else {
if (func_80036874(shot, obj4C->info.hitbox, &obj4C->obj) != 0) {
obj4C->unk_46 = 1;
}
}
}
}
}
for (i = 0, boss = gBosses; i < 4; i++, boss++) {
if ((boss->obj.status == 2) && (boss->timer_05A == 0)) {
if ((boss->obj.id == OBJ_BOSS_308) || (boss->obj.id == OBJ_BOSS_312) || (boss->obj.id == OBJ_BOSS_309) ||
(boss->obj.id == OBJ_BOSS_313)) {
func_8003774C(shot, boss->obj.id, &boss->obj);
} else if (boss->obj.id == OBJ_BOSS_310) {
temp_fv1 = fabsf(boss->obj.pos.x - shot->obj.pos.x) * .8333333f;
temp_fa0 = fabsf(boss->obj.pos.y - shot->obj.pos.y) * 2;
temp_fv0 = fabsf(boss->obj.pos.z - shot->obj.pos.z) * 0.8333333f;
if (sqrtf(SQ(temp_fv1) + SQ(temp_fa0) + SQ(temp_fv0)) < 1500.0f) {
if (shot->obj.id == PLAYERSHOT_4) {
Object_Kill(&shot->obj, &shot->sfxPos);
} else {
boss->unk_062 = 1;
func_80036318(shot);
Audio_PlaySfx(0x29001062, &shot->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C);
}
}
} else {
if (boss->obj.id == OBJ_BOSS_316) {
temp_fv1 = fabsf(boss->obj.pos.x - shot->obj.pos.x);
temp_fa0 = fabsf(boss->obj.pos.y - 300.0f - shot->obj.pos.y) * 7.42f;
temp_fv0 = fabsf(boss->obj.pos.z - shot->obj.pos.z);
if (sqrtf(SQ(temp_fv1) + SQ(temp_fa0) + SQ(temp_fv0)) < 2700.0f) {
if (shot->obj.id == PLAYERSHOT_4) {
Object_Kill(&shot->obj, &shot->sfxPos);
} else {
boss->unk_062 = 1;
boss->unk_066 = 100;
Audio_PlaySfx(0x29121007, &shot->sfxPos, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C);
func_80036318(shot);
}
}
}
temp_v0 = func_80036874(shot, boss->info.hitbox, &boss->obj);
if (temp_v0 != 0) {
if (shot->obj.id == PLAYERSHOT_4) {
Object_Kill(&shot->obj, &shot->sfxPos);
} else if (!((boss->obj.id == OBJ_BOSS_316) && (shot->playerNum != 0))) {
boss->unk_062 = 1;
if (shot->obj.id == PLAYERSHOT_3) {
boss->unk_062 = -1;
boss->unk_064 = 20;
} else if (shot->obj.id == PLAYERSHOT_8) {
if (gCurrentLevel == LEVEL_AQUAS) {
boss->unk_064 = 31;
} else {
boss->unk_064 = 30;
}
} else {
boss->unk_064 = 10;
if (shot->playerNum < 4) {
switch (gLaserStrength[shot->playerNum]) {
case LASERS_SINGLE:
case LASERS_TWIN:
break;
case LASERS_HYPER:
boss->unk_064 = 15;
break;
}
}
}
if (boss->obj.id == OBJ_BOSS_314) {
boss->swork[19] = shot->playerNum;
}
boss->unk_066 = temp_v0 - 1;
if (boss->obj.id == OBJ_BOSS_301) {
boss->swork[5] = shot->obj.id;
} else if (boss->obj.id == OBJ_BOSS_319) {
boss->fwork[47] = shot->obj.pos.x;
boss->fwork[48] = shot->obj.pos.y;
boss->fwork[49] = shot->obj.pos.z;
}
} else {
return;
}
}
}
}
}
}
void func_80038F34(PlayerShot* shot) {
Vec3f sp4C = { 0.0f, 0.0f, 0.0f };
s32 sp48 = 0;
Matrix_Translate(gGfxMatrix, shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z + D_80177D20, 1);
Matrix_MultVec3f(gGfxMatrix, &sp4C, &D_8015F950);
if ((D_8015F950.z < 0.0f) && (D_8015F950.z > -10000.0f)) {
if (fabsf(D_8015F950.x) < (fabsf(D_8015F950.z * 0.5f) + 500.0f)) {
if (fabsf(D_8015F950.y) < (fabsf(D_8015F950.z * 0.5f) + 500.0f)) {
sp48 = 1;
}
}
}
if (!sp48) {
if (!gVersusMode) {
Object_Kill(&shot->obj, &shot->sfxPos);
return;
}
} else {
shot->obj.rot.y = -gPlayer[gPlayerNum].unk_058;
Matrix_RotateY(gGfxMatrix, shot->obj.rot.y, 1);
Matrix_Scale(gGfxMatrix, 2.0f, 2.0f, 2.0f, 1);
if (shot->obj.id == PLAYERSHOT_7) {
Matrix_Scale(gGfxMatrix, 0.2f, 0.2f, 0.2f, 1);
}
Matrix_SetGfxMtx(&gMasterDisp);
RCP_SetupDL_40();
switch (shot->unk_60) {
case 0:
gSPDisplayList(gMasterDisp++, D_1026090);
break;
case 1:
gSPDisplayList(gMasterDisp++, D_1025800);
break;
case 2:
Matrix_Scale(gGfxMatrix, 1.5f, 0.7f, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_1025800);
break;
}
}
}
void func_80039210(PlayerShot* shot) {
f32 var_fv0;
f32 var_fv1;
u8 var_a1;
f32 sp70;
Gfx* sp6C;
sp6C = D_101AED0;
if (gCamCount < 4) {
RCP_SetupDL_21();
sp70 = 9.0f;
if ((shot->unk_58 == 0) || ((gCurrentLevel == LEVEL_METEO) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_2))) {
var_fv0 = 4.0f;
var_fv1 = 20.0f;
} else {
var_fv0 = 2.0f;
var_fv1 = 10.0f;
}
if ((gLaserStrength[0] > LASERS_SINGLE) && (shot->unk_58 == 0)) {
switch (gLaserStrength[0]) {
case LASERS_TWIN:
break;
case LASERS_HYPER:
sp6C = D_101AD20;
break;
}
if (gCurrentLevel == LEVEL_AQUAS) {
sp70 = 4.0f;
}
Matrix_Scale(gGfxMatrix, var_fv0, var_fv0, var_fv1, 1);
Matrix_RotateY(gGfxMatrix, M_PI, 1);
Matrix_Translate(gGfxMatrix, sp70, 0.f, 0.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, sp6C);
Matrix_Translate(gGfxMatrix, -(2.0f * sp70), 0.0f, 0.f, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, sp6C);
} else {
var_a1 = 0;
if ((gCurrentLevel != LEVEL_KATINA) && (shot->playerNum >= 104) && (shot->playerNum != 108)) {
if (gObjects2F4[shot->playerNum - 100].obj.id != 200) {
var_a1 = 1;
} else if (gObjects2F4[shot->playerNum - 100].unk_080 == 5) {
var_a1 = 2;
}
} else if (gCurrentLevel == LEVEL_KATINA) {
if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_2) {
if (shot->playerNum >= 104) {
if (gObjects2F4[shot->playerNum - 100].unk_0B6 == 0) {
var_a1 = 1;
}
if (gObjects2F4[shot->playerNum - 100].unk_0B6 == 2) {
var_a1 = 2;
}
}
} else if (gObjects2F4[shot->playerNum - 100].unk_0B6 == 34) {
var_a1 = 1;
}
}
switch (var_a1) {
case 0:
Matrix_Scale(gGfxMatrix, var_fv0, var_fv0, var_fv1, 1);
Matrix_RotateY(gGfxMatrix, M_PI, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_101AED0);
break;
case 1:
Matrix_Translate(gGfxMatrix, 0.0f, 0.f, 150.0f, 1);
Matrix_Scale(gGfxMatrix, 0.7f, 0.7f, 1.5f, 1);
Matrix_RotateY(gGfxMatrix, M_PI, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_101ABD0);
break;
case 2:
Matrix_Scale(gGfxMatrix, var_fv0, var_fv0, var_fv1, 1);
Matrix_RotateY(gGfxMatrix, M_PI, 1);
Matrix_Translate(gGfxMatrix, 25.0f, 0.0f, 0.f, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_101AED0);
sp6C = D_101AED0;
Matrix_Translate(gGfxMatrix, -50.0f, 0.0f, 0.f, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, sp6C);
break;
case 3:
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, 50.0f, 0.0f, 150.0f, 1);
Matrix_Scale(gGfxMatrix, 0.7f, 0.7f, 1.5f, 1);
Matrix_RotateY(gGfxMatrix, M_PI, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_101ABD0);
Matrix_Pop(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, -50.0f, 0.0f, 150.0f, 1);
Matrix_Scale(gGfxMatrix, 0.7f, 0.7f, 1.5f, 1);
Matrix_RotateY(gGfxMatrix, M_PI, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_101ABD0);
break;
}
}
} else {
RCP_SetupDL_64();
switch (shot->playerNum) {
case 0:
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 32, 255);
break;
case 1:
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 100, 200, 255);
break;
case 2:
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 32, 255, 32, 255);
break;
case 3:
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 32, 32, 255, 255);
break;
}
Matrix_Scale(gGfxMatrix, 6.0f, 4.0f, 10.0f, 1);
Matrix_RotateY(gGfxMatrix, M_PI, 1);
Matrix_SetGfxMtx(&gMasterDisp);
if (gLaserStrength[shot->playerNum] != LASERS_SINGLE) {
Matrix_Translate(gGfxMatrix, 6.0f, 0.0f, 0.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_302D120);
Matrix_Translate(gGfxMatrix, -12.0f, 0.0f, 0.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_302D120);
} else {
gSPDisplayList(gMasterDisp++, D_302D120);
}
}
}
static f32 D_800C9BD8[10] = { 100.0f, 100.0f, 0.0f, 0.0f, 0.0f, 50.0f, 0.0f, 40.0f, 30.0f, 100.0f };
static u8 D_800C9C00[4] = { 255, 255, 32, 32 };
static u8 D_800C9C04[4] = { 255, 32, 255, 32 };
static u8 D_800C9C08[4] = { 32, 32, 32, 255 };
void func_80039A50(PlayerShot* shot) {
Vec3f sp11C = { 0.0f, 0.0f, 0.0f };
s32 pad[4];
f32 var_fv1;
s32 sp104 = 0;
Matrix_Translate(gGfxMatrix, shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z + D_80177D20, 1);
Matrix_MultVec3f(gGfxMatrix, &sp11C, &D_8015F950);
if ((D_8015F950.z < 0.0f) && (D_8015F950.z > -10000.0f)) {
var_fv1 = fabsf(D_8015F950.x); // probably fake. The use of temps was likely different
if (var_fv1 < (fabsf(D_8015F950.z * 0.5f) + 500.0f)) {
if (fabsf(D_8015F950.y) < (fabsf(D_8015F950.z * 0.5f) + 500.0f)) {
sp104 = 1;
}
}
}
if (!sp104) {
if ((shot->obj.id != PLAYERSHOT_3) && (shot->unk_64 < 10) && !gVersusMode) {
Object_Kill(&shot->obj, &shot->sfxPos);
}
} else {
if ((shot->obj.id == PLAYERSHOT_5) || (shot->obj.id == PLAYERSHOT_6) || (shot->obj.id == PLAYERSHOT_7)) {
shot->obj.rot.y = (-gPlayer[gPlayerNum].unk_058 * 180.0f) / M_PI;
shot->obj.rot.x = (gPlayer[gPlayerNum].unk_05C * 180.0f) / M_PI;
}
if (shot->obj.id != PLAYERSHOT_2) {
Matrix_RotateY(gGfxMatrix, shot->obj.rot.y * M_DTOR, 1);
Matrix_RotateX(gGfxMatrix, shot->obj.rot.x * M_DTOR, 1);
Matrix_RotateZ(gGfxMatrix, shot->obj.rot.z * M_DTOR, 1);
if ((shot->obj.id == PLAYERSHOT_3) && (shot->unk_5C == 0)) {
Matrix_RotateZ(gGfxMatrix, shot->unk_34 * M_DTOR, 1);
Matrix_RotateY(gGfxMatrix, shot->unk_30 * M_DTOR, 1);
Matrix_RotateX(gGfxMatrix, shot->unk_2C * M_DTOR, 1);
}
}
Matrix_Translate(gGfxMatrix, 0.f, 0.f, D_800C9BD8[shot->obj.id], 1);
Matrix_SetGfxMtx(&gMasterDisp);
switch (shot->obj.id) {
case PLAYERSHOT_0:
case PLAYERSHOT_1:
func_80039210(shot);
break;
case PLAYERSHOT_3:
if (shot->unk_5C == 0) {
RCP_SetupDL(&gMasterDisp, 0x1D);
gSPDisplayList(gMasterDisp++, D_10231A0);
Matrix_Pop(&gGfxMatrix);
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z + D_80177D20, 1);
Matrix_RotateY(gGfxMatrix, -gPlayer[gPlayerNum].unk_058, 1);
Matrix_RotateX(gGfxMatrix, gPlayer[gPlayerNum].unk_05C, 1);
Matrix_RotateZ(gGfxMatrix, gFrameCount * 40.0f * M_DTOR, 1);
if (!(gFrameCount & 1)) {
Matrix_Scale(gGfxMatrix, 1.7f, 1.7f, 1.7f, 1);
} else {
Matrix_Scale(gGfxMatrix, 1.2f, 1.2f, 1.2f, 1);
}
RCP_SetupDL(&gMasterDisp, 0x31);
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255);
if (gVersusMode) {
switch (shot->playerNum) {
case 0:
gDPSetEnvColor(gMasterDisp++, 255, 255, 32, 128);
break;
case 1:
gDPSetEnvColor(gMasterDisp++, 255, 32, 32, 128);
break;
case 2:
gDPSetEnvColor(gMasterDisp++, 32, 255, 32, 128);
break;
case 3:
gDPSetEnvColor(gMasterDisp++, 32, 32, 255, 128);
break;
}
} else {
gDPSetEnvColor(gMasterDisp++, 0, 128, 255, 255);
}
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_1024AC0);
} else {
Matrix_Scale(gGfxMatrix, shot->unk_44, shot->unk_44, shot->unk_44, 1);
Matrix_SetGfxMtx(&gMasterDisp);
if (gVersusMode) {
RCP_SetupDL_49();
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, shot->unk_58);
switch (shot->playerNum) {
case 0:
gDPSetEnvColor(gMasterDisp++, 255, 255, 32, shot->unk_58);
break;
case 1:
gDPSetEnvColor(gMasterDisp++, 255, 32, 32, shot->unk_58);
break;
case 2:
gDPSetEnvColor(gMasterDisp++, 32, 255, 32, shot->unk_58);
break;
case 3:
gDPSetEnvColor(gMasterDisp++, 32, 32, 255, shot->unk_58);
break;
}
} else {
RCP_SetupDL_64_2();
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, shot->unk_58);
}
gSPDisplayList(gMasterDisp++, D_1031EC0);
}
break;
case PLAYERSHOT_5:
gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK);
RCP_SetupDL_40();
if (gVersusMode) {
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255);
gDPSetEnvColor(gMasterDisp++, D_800C9C00[shot->playerNum], D_800C9C04[shot->playerNum],
D_800C9C08[shot->playerNum], 255);
RCP_SetupDL(&gMasterDisp, 0x31);
if (gLaserStrength[shot->playerNum] != LASERS_SINGLE) {
Matrix_RotateZ(gGfxMatrix, gFrameCount * 48.0f * M_DTOR, 1);
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, 0.f, 50.0f, 0.0f, 1);
Matrix_RotateZ(gGfxMatrix, gFrameCount * 70.0f * M_DTOR, 1);
Matrix_Scale(gGfxMatrix, 2.0f, 2.0f, 2.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_301AD60);
Matrix_Pop(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, 0.0f, -50.0f, 0.0f, 1);
Matrix_RotateZ(gGfxMatrix, gFrameCount * 70.0f * M_DTOR, 1);
Matrix_Scale(gGfxMatrix, 2.0f, 2.0f, 2.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_301AD60);
} else {
if (!(gFrameCount & 1)) {
var_fv1 = M_PI;
} else {
var_fv1 = 0.0f;
}
Matrix_RotateY(gGfxMatrix, var_fv1, 1);
Matrix_RotateZ(gGfxMatrix, 0.5235988f, 1);
Matrix_Scale(gGfxMatrix, 2.0f, 2.0f, 2.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_301AD60);
}
} else {
if (!(gFrameCount & 1)) {
var_fv1 = M_PI;
} else {
var_fv1 = 0.0f;
}
Matrix_RotateY(gGfxMatrix, var_fv1, 1);
Matrix_RotateZ(gGfxMatrix, 0.5235988f, 1);
Matrix_Scale(gGfxMatrix, 1.0f, 0.65f, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp);
RCP_SetupDL_68();
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255);
gDPSetEnvColor(gMasterDisp++, 0, 255, 0, 0);
gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK);
gSPDisplayList(gMasterDisp++, D_3006940);
}
break;
case PLAYERSHOT_6:
case PLAYERSHOT_7:
Matrix_Scale(gGfxMatrix, shot->unk_44, shot->unk_44, shot->unk_44, 1);
Matrix_SetGfxMtx(&gMasterDisp);
RCP_SetupDL(&gMasterDisp, 0x31);
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255);
gDPSetEnvColor(gMasterDisp++, D_800C9C00[shot->playerNum], D_800C9C04[shot->playerNum],
D_800C9C08[shot->playerNum], 255);
if (gLaserStrength[shot->playerNum] != LASERS_SINGLE) {
Matrix_RotateZ(gGfxMatrix, gFrameCount * 48.0f * M_DTOR, 1);
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, 0.f, 40.0f, 0.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_301AEF0);
Matrix_Pop(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, 0.f, -40.0f, 0.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_301AEF0);
} else {
gSPDisplayList(gMasterDisp++, D_301AEF0);
}
break;
case PLAYERSHOT_8:
Matrix_RotateY(gGfxMatrix, M_PI, 1);
Matrix_SetGfxMtx(&gMasterDisp);
if (gCurrentLevel == LEVEL_AQUAS) {
RCP_SetupDL(&gMasterDisp, 0x3C);
gSPDisplayList(gMasterDisp++, D_600DB80);
Matrix_Pop(&gGfxMatrix);
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, shot->obj.pos.x, D_80177940, shot->obj.pos.z + D_80177D20, 1);
Matrix_Scale(gGfxMatrix, shot->unk_2C, shot->unk_30, shot->unk_34, 1);
RCP_SetupDL(&gMasterDisp, 0x31);
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 32, 32, 0, shot->unk_58);
gDPSetEnvColor(gMasterDisp++, 32, 16, 16, shot->unk_58);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_1024AC0);
} else if (shot->unk_5C == 0) {
if (!(shot->unk_44 > 1.5f)) {
Matrix_Pop(&gGfxMatrix);
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z + D_80177D20, 1);
Matrix_RotateY(gGfxMatrix, -gPlayer[gPlayerNum].unk_058, 1);
Matrix_RotateX(gGfxMatrix, gPlayer[gPlayerNum].unk_05C, 1);
Matrix_Push(&gGfxMatrix);
Matrix_Scale(gGfxMatrix, 20.0f, 20.0f, 20.0f, 1);
RCP_SetupDL(&gMasterDisp, 0x31);
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255);
if (gVersusMode) {
switch (shot->playerNum) {
case 0:
gDPSetEnvColor(gMasterDisp++, 255, 255, 32, 255);
break;
case 1:
gDPSetEnvColor(gMasterDisp++, 255, 32, 32, 255);
break;
case 2:
gDPSetEnvColor(gMasterDisp++, 32, 255, 32, 255);
break;
case 3:
gDPSetEnvColor(gMasterDisp++, 32, 32, 255, 255);
break;
}
} else {
gDPSetEnvColor(gMasterDisp++, 0, 255, 0, 255);
}
Matrix_RotateZ(gGfxMatrix, gFrameCount * 53.0f * M_DTOR, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_101C2E0);
Matrix_RotateZ(gGfxMatrix, gFrameCount * -53.0f * 2.0f * M_DTOR, 1);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_101C2E0);
Matrix_Pop(&gGfxMatrix);
if (!(gFrameCount & 1)) {
Matrix_Scale(gGfxMatrix, 1.7f, 1.7f, 1.7f, 1);
} else {
Matrix_Scale(gGfxMatrix, 1.3f, 1.3f, 1.3f, 1);
}
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_1024AC0);
}
} else {
RCP_SetupDL(&gMasterDisp, 0x1D);
gSPDisplayList(gMasterDisp++, D_10231A0);
Matrix_Pop(&gGfxMatrix);
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z + D_80177D20, 1);
Matrix_RotateY(gGfxMatrix, -gPlayer[gPlayerNum].unk_058, 1);
Matrix_RotateX(gGfxMatrix, gPlayer[gPlayerNum].unk_05C, 1);
if (!(gFrameCount & 1)) {
Matrix_Scale(gGfxMatrix, 1.2f, 1.2f, 1.2f, 1);
} else {
Matrix_Scale(gGfxMatrix, 1.5f, 1.5f, 1.5f, 1);
}
RCP_SetupDL(&gMasterDisp, 0x31);
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 0, 255);
gDPSetEnvColor(gMasterDisp++, 255, 128, 128, 255);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_1024AC0);
}
break;
case PLAYERSHOT_9:
Matrix_RotateY(gGfxMatrix, M_PI, 1);
Matrix_Scale(gGfxMatrix, 3.0f, 3.0f, 20.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp);
RCP_SetupDL_40();
gSPDisplayList(gMasterDisp++, D_E00DFB0);
break;
}
}
}
void func_8003AF88(PlayerShot* shot) {
switch (shot->obj.status) {
case 1:
func_80039A50(shot);
break;
case 2:
func_80038F34(shot);
break;
}
}
void func_8003AFD8(PlayerShot* shot) {
shot->unk_60++;
if (shot->unk_60 > 2) {
Object_Kill(&shot->obj, &shot->sfxPos);
}
}
void func_8003B00C(PlayerShot* shot, Player* player) {
Vec3f sp5C;
Vec3f sp50;
Vec3f sp44;
Vec3f sp38;
switch (shot->unk_5C) {
case 0:
Matrix_RotateY(gCalcMatrix, (player->unk_114 + player->unk_0E8 + 180.0f) * M_DTOR, 0);
Matrix_RotateX(gCalcMatrix, -(player->unk_0E4 * M_DTOR), 1);
Matrix_RotateZ(gCalcMatrix, -((player->unk_0F8 + player->unk_0F0) * M_DTOR), 1);
Matrix_Translate(gCalcMatrix, player->unk_084, player->unk_080, 0.0f, 1);
sp5C.x = 0.0f;
sp5C.y = 0.0f;
sp5C.z = player->unk_0D0 + 200.0f;
Matrix_MultVec3f(gCalcMatrix, &sp5C, &sp50);
shot->vel.x = sp50.x;
shot->vel.y = sp50.y;
shot->vel.z = sp50.z - player->unk_110;
sp5C.x = shot->unk_54;
sp5C.y = -15.0f;
sp5C.z = 0.0f;
Matrix_MultVec3f(gCalcMatrix, &sp5C, &sp44);
shot->unk_48 = player->pos.x + sp44.x;
shot->unk_4C = player->pos.y + sp44.y;
shot->unk_50 = player->unk_138 + sp44.z;
shot->unk_44 += 200.0f;
if (shot->unk_44 > 5000.0f) {
shot->unk_44 = 5000.0f;
}
for (sp5C.z = 0.0f; sp5C.z <= shot->unk_44; sp5C.z += 200.0f) {
Matrix_MultVec3f(gCalcMatrix, &sp5C, &sp38);
D_80178498 = shot->obj.pos.z;
D_801784A0 = shot->obj.pos.y;
D_8017849C = shot->obj.pos.x;
shot->obj.pos.x = player->pos.x + sp38.x;
shot->obj.pos.y = player->pos.y + sp38.y;
shot->obj.pos.z = player->unk_138 + sp38.z;
Matrix_Push(&gCalcMatrix);
func_80038140(shot);
Matrix_Pop(&gCalcMatrix);
if (shot->obj.pos.y < D_80177940) {
shot->unk_5C = 0;
func_80036770(shot->obj.pos.x, D_80177940 + 2.0f, shot->obj.pos.z, shot->obj.rot.y, 2.0f);
break;
} else if (shot->unk_5C == 2) {
shot->unk_5C = 0;
break;
}
}
shot->unk_64 = 30;
shot->obj.rot.y = player->unk_0E8 + player->unk_114;
if (!(gControllerHold->button & U_CBUTTONS) && !(gControllerHold->button & A_BUTTON)) {
shot->unk_5C = 1;
}
break;
case 1:
shot->unk_48 += shot->vel.x;
shot->unk_4C += shot->vel.y;
shot->unk_50 += shot->vel.z;
break;
case 2:
shot->obj.pos.x -= shot->vel.x;
shot->obj.pos.y -= shot->vel.y;
shot->obj.pos.z -= shot->vel.z;
shot->unk_48 += shot->vel.x;
shot->unk_4C += shot->vel.y;
shot->unk_50 += shot->vel.z;
if (!(gFrameCount & 3)) {
func_800A668C(D_8017849C, D_801784A0, D_80178498);
}
if ((fabsf(shot->obj.pos.x - shot->unk_48) < 200.0f) && (fabsf(shot->obj.pos.y - shot->unk_4C) < 200.0f) &&
(fabsf(shot->obj.pos.z - shot->unk_50) < 200.0f)) {
Object_Kill(&shot->obj, &shot->sfxPos);
return;
}
break;
}
if (shot->unk_64 == 0) {
Object_Kill(&shot->obj, &shot->sfxPos);
}
if (shot->unk_5C == 1) {
if (shot->obj.pos.y < D_80177940) {
func_80036318(shot);
func_80036770(shot->obj.pos.x, D_80177940 + 2.0f, shot->obj.pos.z, shot->obj.rot.y, 2.0f);
if (gCurrentLevel == LEVEL_FORTUNA) {
func_8007BC7C(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 3.0f);
func_8007BC7C(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 3.0f);
func_8007BC7C(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 3.0f);
}
}
func_80038140(shot);
}
}
void func_8003B55C(PlayerShot* shot, s32 index) {
Vec3f sp44;
Vec3f sp38;
if ((D_80161A88 == 2) && (shot->obj.pos.y < (D_80177940 + 50.0f)) && (index == 0)) {
func_8007ACE0(shot->obj.pos.x, D_80177940, shot->obj.pos.z, 0.1f, 1.5f, shot->obj.rot.y + 20.0f);
func_8007ACE0(shot->obj.pos.x, D_80177940, shot->obj.pos.z, 0.1f, 1.5f, shot->obj.rot.y - 20.0f);
}
if ((shot->obj.pos.y < D_80177940) && (D_801784AC != 4)) {
func_80036318(shot);
shot->obj.pos.y = D_80177940 + 2;
if (gCurrentLevel == LEVEL_BOLSE) {
func_8007A6F0(&shot->obj.pos, 0x29121007);
}
if ((gCamCount != 4) && (gCurrentLevel != LEVEL_AQUAS)) {
if ((shot->playerNum == 0) && (gLaserStrength[0] != LASERS_SINGLE) &&
(gPlayer[0].form != FORM_LANDMASTER)) {
Matrix_RotateY(gCalcMatrix, shot->obj.rot.y * M_DTOR, 0);
Matrix_RotateX(gCalcMatrix, shot->obj.rot.x * M_DTOR, 1);
Matrix_RotateZ(gCalcMatrix, shot->obj.rot.z * M_DTOR, 1);
sp44.y = sp44.z = 0.0f;
sp44.x = 40.0f;
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp44, &sp38);
func_80036770(shot->obj.pos.x + sp38.x, D_80177940 + 2.0f, shot->obj.pos.z + sp38.z, shot->obj.rot.y,
2.0f);
sp44.x = -40.0f;
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp44, &sp38);
func_80036770(shot->obj.pos.x + sp38.x, D_80177940 + 2.0f, shot->obj.pos.z + sp38.z, shot->obj.rot.y,
2.0f);
} else {
func_80036770(shot->obj.pos.x, D_80177940 + 2.0f, shot->obj.pos.z, shot->obj.rot.y, 2.0f);
}
}
if (D_80161A88 == 2) {
Object_Kill(&shot->obj, &shot->sfxPos);
return;
}
if (gCurrentLevel == LEVEL_FORTUNA) {
func_8007BC7C(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 3.0f);
func_8007BC7C(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 3.0f);
func_8007BC7C(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 3.0f);
}
if (gCurrentLevel == LEVEL_AQUAS) {
func_8007B8F8(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 3.0f);
func_8007B8F8(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 3.0f);
func_8007B8F8(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, 3.0f);
func_E16C50_801AC8A8(((Rand_ZeroOne() - 0.5f) * 10.0f) + shot->obj.pos.x,
((Rand_ZeroOne() - 0.5f) * 10.0f) + shot->obj.pos.y, shot->obj.pos.z, 0.8f, 0);
func_E16C50_801AC8A8(((Rand_ZeroOne() - 0.5f) * 10.0f) + shot->obj.pos.x,
((Rand_ZeroOne() - 0.5f) * 10.0f) + shot->obj.pos.y, shot->obj.pos.z, 0.8f, 0);
func_E16C50_801AC8A8(((Rand_ZeroOne() - 0.5f) * 10.0f) + shot->obj.pos.x,
((Rand_ZeroOne() - 0.5f) * 10.0f) + shot->obj.pos.y, shot->obj.pos.z, 0.8f, 0);
}
}
if (shot->unk_64 == 0) {
Object_Kill(&shot->obj, &shot->sfxPos);
return;
} else if ((shot->playerNum < 110) || (shot->unk_64 & 1)) {
func_80038140(shot);
}
}
void func_8003BA80(PlayerShot* shot) {
func_8003B55C(shot, 0);
}
void func_8003BAA0(PlayerShot* shot) {
func_8003B55C(shot, 0);
shot->unk_58 = 0;
}
void func_8003BACC(PlayerShot* shot) {
Vec3f sp3C;
Vec3f sp30;
Vec3f sp24;
func_8003B55C(shot, 0);
sp3C.x = shot->obj.pos.x;
sp3C.y = shot->obj.pos.y;
sp3C.z = shot->obj.pos.z;
sp30.x = 0.0f;
sp30.y = 0.0f;
sp30.z = 0.0f;
if (!func_800A3690(&sp3C, &sp30, COL2_5, &sp24)) {
func_80036318(shot);
}
shot->unk_58 = 0;
}
bool func_8003BB4C(PlayerShot* shot) {
s32 i;
s32 j;
f32 var_fa0;
Object_2F4* obj2F4;
Player* player;
if (gLevelMode == LEVELMODE_ON_RAILS) {
var_fa0 = 300.0f;
} else {
var_fa0 = 200.0f;
}
for (i = 0, obj2F4 = gObjects2F4; i < 60; i++, obj2F4++) {
if ((obj2F4->obj.status == 2) && (obj2F4->info.unk_1C != 0.0f) &&
((obj2F4->timer_0CA[shot->playerNum] == 0) && (fabsf(shot->obj.pos.x - obj2F4->obj.pos.x) <= var_fa0) &&
(fabsf(shot->obj.pos.y - (obj2F4->obj.pos.y + obj2F4->info.unk_1C)) <= var_fa0) &&
(fabsf(shot->obj.pos.z - obj2F4->obj.pos.z) <= var_fa0))) {
obj2F4->timer_0CA[shot->playerNum] = 20;
func_80060F30(gPlayer[shot->playerNum].unk_460_arr, 0x49008027, shot->playerNum);
for (j = 0; j < ARRAY_COUNT(gPlayerShots); j++) {
if (gPlayerShots[j].obj.id == PLAYERSHOT_4) {
Object_Kill(&gPlayerShots[j].obj, &gPlayerShots[j].sfxPos);
}
}
D_801615B8[shot->playerNum] = 3.0f;
D_801615A8[shot->playerNum] = 300.0f;
return true;
}
}
if (gVersusMode) {
for (i = 0, player = gPlayer; i < gCamCount; i++, player++) {
if ((player->state_1C8 == PLAYERSTATE_1C8_3) && (player->unk_4DC == 0) && (player->form != FORM_ON_FOOT) &&
(i != shot->playerNum) && (D_80177B00[i][shot->playerNum] == 0) &&
(fabsf(shot->obj.pos.x - player->pos.x) <= var_fa0) &&
(fabsf(shot->obj.pos.y - player->pos.y) <= var_fa0) &&
(fabsf(shot->obj.pos.z - player->unk_138) <= var_fa0)) {
D_80177B00[0][shot->playerNum] = D_80177B00[1][shot->playerNum] = D_80177B00[2][shot->playerNum] =
D_80177B00[3][shot->playerNum] = 0;
D_80177B00[i][shot->playerNum] = 20;
func_80060F30(gPlayer[shot->playerNum].unk_460_arr, 0x49008027, shot->playerNum);
for (j = 0; j < ARRAY_COUNT(gPlayerShots); j++) {
if (gPlayerShots[j].obj.id == PLAYERSHOT_4) {
Object_Kill(&gPlayerShots[j].obj, &gPlayerShots[j].sfxPos);
}
}
D_801615B8[shot->playerNum] = 3.0f;
D_801615A8[shot->playerNum] = 300.0f;
return true;
}
}
}
return false;
}
void func_8003BEF4(PlayerShot* shot) {
if (gVersusMode) {
if ((shot->obj.pos.y < D_80177940) || func_8003BB4C(shot) ||
!(gControllerHold[shot->playerNum].button & A_BUTTON) || (shot->unk_64 == 0)) {
Object_Kill(&shot->obj, &shot->sfxPos);
}
} else {
if ((shot->obj.pos.y < D_80177940) || func_8003BB4C(shot) ||
!(gControllerHold[gMainController].button & A_BUTTON) || (shot->unk_64 == 0)) {
Object_Kill(&shot->obj, &shot->sfxPos);
}
}
func_80038140(shot);
}
void func_8003C008(PlayerShot* shot) {
s32 i;
s32 j;
f32* hitboxData;
Boss* boss;
f32 temp_ft4;
f32 temp_ft5;
f32 var_fa1;
f32 var_fs2;
Vec3f sp8C;
Vec3f sp80;
s32 var_s6;
s32 count;
boss = gBosses;
for (i = 0; i < ARRAY_COUNT(gBosses); i++, boss++) {
if ((boss->obj.status == 2) && (boss->timer_05A == 0)) {
if (boss->obj.id == OBJ_BOSS_316) {
var_s6 = gFrameCount & 7;
var_fs2 = shot->unk_44 * 40.0f;
} else {
var_s6 = gFrameCount & 0xF;
var_fs2 = shot->unk_44 * 30.0f;
}
hitboxData = boss->info.hitbox;
count = *hitboxData++;
if (count != 0) {
for (j = 0; j < count; j++, hitboxData += 6) {
if (hitboxData[0] == HITBOX_UNK_2) {
Matrix_RotateZ(gCalcMatrix, -hitboxData[3] * M_DTOR, 0);
Matrix_RotateX(gCalcMatrix, -hitboxData[1] * M_DTOR, 1);
Matrix_RotateY(gCalcMatrix, -hitboxData[2] * M_DTOR, 1);
Matrix_RotateZ(gCalcMatrix, -boss->obj.rot.z * M_DTOR, 1);
Matrix_RotateX(gCalcMatrix, -boss->obj.rot.x * M_DTOR, 1);
Matrix_RotateY(gCalcMatrix, -boss->obj.rot.y * M_DTOR, 1);
hitboxData += 4;
} else {
Matrix_RotateZ(gCalcMatrix, -boss->obj.rot.z * M_DTOR, 0);
Matrix_RotateX(gCalcMatrix, -boss->obj.rot.x * M_DTOR, 1);
Matrix_RotateY(gCalcMatrix, -boss->obj.rot.y * M_DTOR, 1);
}
if ((j == var_s6) && (hitboxData[1] > -100.0f) && (hitboxData[3] > -100.0f)) {
sp8C.x = shot->obj.pos.x - boss->obj.pos.x;
sp8C.y = shot->obj.pos.y - boss->obj.pos.y;
sp8C.z = shot->obj.pos.z - boss->obj.pos.z;
Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp8C, &sp80);
temp_ft4 = (hitboxData[4] + boss->obj.pos.x) - (boss->obj.pos.x + sp80.x);
temp_ft5 = (hitboxData[2] + boss->obj.pos.y) - (boss->obj.pos.y + sp80.y);
var_fa1 = (hitboxData[0] + boss->obj.pos.z) - (boss->obj.pos.z + sp80.z);
if ((gLevelMode == LEVELMODE_ON_RAILS) && (var_fa1 < 0.0f)) {
var_fa1 *= 0.6f;
}
if (sqrtf(SQ(temp_ft4) + SQ(temp_ft5) + SQ(var_fa1)) < var_fs2) {
boss->unk_066 = j;
boss->unk_062 = -1;
boss->unk_064 = 20;
}
}
}
}
}
}
}
void func_8003C3D8(PlayerShot* shot) {
static u8 D_800C9C18[4] = { 255, 255, 32, 32 };
static u8 D_800C9C1C[4] = { 255, 32, 255, 32 };
static u8 D_800C9C20[4] = { 32, 32, 32, 255 };
f32 var_fv0;
D_80178370 = shot->obj.pos.x;
D_80178374 = shot->obj.pos.y;
D_80178378 = shot->obj.pos.z;
if (gVersusMode) {
D_80178360 = D_800C9C18[shot->playerNum];
D_80178364 = D_800C9C1C[shot->playerNum];
D_80178368 = D_800C9C20[shot->playerNum];
} else {
D_80178360 = 90;
D_80178364 = 90;
D_80178368 = 255;
}
var_fv0 = 0.7f;
if (shot->unk_5C != 0) {
var_fv0 = 1.0f;
}
Math_SmoothStepToF(&D_8017836C, var_fv0, 1.0f, 0.08f, 0.001f);
}
void func_8003C4D0(PlayerShot* shot, s32 unkD6) {
s32 i;
f32 sp68;
f32 sp64;
f32 sp60;
s32 pad[2];
Object_2F4* obj2F4;
Object_4C* obj4C;
Object_80* obj80;
Object_8C* obj8C;
Player* player;
f32 temp_fs2 = shot->unk_44 * 60.0f;
for (i = 0, obj80 = gObjects80; i < 50; i++, obj80++) {
if ((obj80->obj.status == 2) && (obj80->obj.id == OBJ_80_56)) {
sp68 = obj80->obj.pos.x - shot->obj.pos.x;
sp64 = obj80->obj.pos.y - shot->obj.pos.y;
sp60 = obj80->obj.pos.z - shot->obj.pos.z;
if (sqrtf(SQ(sp68) + SQ(sp64) + SQ(sp60)) < temp_fs2) {
obj80->unk_50 = 2;
}
obj80->unk_54 = 0;
}
}
for (i = 0, obj4C = gObjects4C; i < 40; i++, obj4C++) {
if ((obj4C->obj.status == 2) && ((obj4C->obj.id == OBJ_4C_163) || (obj4C->obj.id == OBJ_4C_169) ||
(obj4C->obj.id == OBJ_4C_161) || (obj4C->obj.id == OBJ_4C_162))) {
sp68 = obj4C->obj.pos.x - shot->obj.pos.x;
sp64 = obj4C->obj.pos.y - shot->obj.pos.y;
sp60 = obj4C->obj.pos.z - shot->obj.pos.z;
if (sqrtf(SQ(sp68) + SQ(sp64) + SQ(sp60)) < temp_fs2) {
obj4C->unk_46 = 1;
}
}
}
obj2F4 = gObjects2F4;
for (i = 0; i < 60; i++, obj2F4++) {
if ((obj2F4->obj.status == 2) && (obj2F4->timer_0C2 == 0) &&
!((gCurrentLevel == LEVEL_MACBETH) && (OBJ_2F4_205 <= obj2F4->obj.id) && (obj2F4->obj.id < OBJ_2F4_214)) &&
!((obj2F4->obj.id == OBJ_2F4_200) && (obj2F4->unk_080 != 0)) &&
((obj2F4->scale >= 0.0f) || (obj2F4->obj.id == OBJ_2F4_271))) {
sp68 = obj2F4->obj.pos.x - shot->obj.pos.x;
sp64 = obj2F4->obj.pos.y - shot->obj.pos.y;
sp60 = obj2F4->obj.pos.z - shot->obj.pos.z;
if ((gLevelMode == 0) && (sp60 < 0.0f)) {
sp60 *= 0.6f;
}
obj2F4->unk_0D8.x = shot->obj.pos.x;
obj2F4->unk_0D8.y = shot->obj.pos.y;
obj2F4->unk_0D8.z = shot->obj.pos.z;
if (sqrtf(SQ(sp68) + SQ(sp64) + SQ(sp60)) < temp_fs2) {
if ((obj2F4->obj.id == OBJ_2F4_193) || (obj2F4->obj.id == OBJ_2F4_186) ||
(obj2F4->obj.id == OBJ_2F4_190) || (obj2F4->obj.id == OBJ_2F4_202) ||
(obj2F4->obj.id == OBJ_2F4_201) || (obj2F4->obj.id == OBJ_2F4_187) ||
((obj2F4->obj.id == OBJ_2F4_200) && (obj2F4->unk_0B4 == 78)) ||
((obj2F4->obj.id == OBJ_2F4_200) && (obj2F4->unk_0B4 == 38)) || (obj2F4->obj.id == OBJ_2F4_196)) {
obj2F4->unk_0D0 = 2;
obj2F4->unk_0D2 = 0;
obj2F4->unk_0D4 = shot->playerNum + 1;
obj2F4->unk_0D6 = unkD6;
if (obj2F4->info.bonus != 0) {
shot->bonus++;
}
} else if ((obj2F4->obj.id == OBJ_2F4_200) && (obj2F4->scale >= 0.5f) && (unkD6 >= 31)) {
obj2F4->unk_0D4 = shot->playerNum + 1;
obj2F4->vel.x = sp68 * 0.03f;
obj2F4->vel.y = sp64 * 0.03f;
obj2F4->vel.z = sp60 * 0.03f;
obj2F4->obj.status = 3;
obj2F4->timer_0BC = (s32) (Rand_ZeroOne() * 15.0f) + 10;
obj2F4->timer_0BE = 0;
obj2F4->timer_04C = 4;
obj2F4->obj.rot.x = Math_ModF(obj2F4->obj.rot.x, 360.0f);
if (obj2F4->info.bonus != 0) {
shot->bonus++;
}
} else {
obj2F4->unk_0D0 = 2;
obj2F4->unk_0D2 = 0;
obj2F4->unk_0D4 = shot->playerNum + 1;
obj2F4->unk_0D6 = unkD6;
if (obj2F4->info.bonus != 0) {
shot->bonus++;
}
}
}
}
}
if (gCurrentLevel == LEVEL_MACBETH) {
func_E6A810_801AD144(shot);
} else if (gCurrentLevel == LEVEL_VENOM_1) {
func_DF4260_8019864C(shot);
} else {
func_8003C008(shot);
}
obj8C = gObjects8C;
for (i = 0; i < 100; i++, obj8C++) {
if (obj8C->obj.status == 2) {
sp68 = obj8C->obj.pos.x - shot->obj.pos.x;
sp64 = obj8C->obj.pos.y - shot->obj.pos.y;
sp60 = obj8C->obj.pos.z - shot->obj.pos.z;
if (sqrtf(SQ(sp68) + SQ(sp64) + SQ(sp60)) < temp_fs2) {
if (obj8C->info.unk_16 == 0) {
Object_Kill(&obj8C->obj, &obj8C->sfxPos);
}
if (obj8C->info.unk_16 == 2) {
obj8C->obj.pos.x += sp68 * 0.03f;
if (!((gLevelType == LEVELTYPE_PLANET) && (obj8C->obj.pos.y < 100.0f))) {
obj8C->obj.pos.y += sp64 * 0.03f;
}
obj8C->obj.pos.z += sp60 * 0.03f;
if ((obj8C->obj.id == OBJ_8C_392) && (obj8C->unk_4E == 0)) {
obj8C->unk_4E = 1;
obj8C->unk_44 = 176;
obj8C->unk_4C = 0;
obj8C->vel.x = obj8C->vel.y = obj8C->vel.z = 0.0f;
obj8C->scale2 = 20.0f;
}
}
}
}
}
if (gVersusMode) {
for (i = 0, player = gPlayer; i < gCamCount; i++, player++) {
if ((i != shot->playerNum) && (player->state_1C8 == PLAYERSTATE_1C8_3) && (player->unk_1F4 == 0)) {
sp68 = player->pos.x - shot->obj.pos.x;
sp64 = player->pos.y - shot->obj.pos.y;
sp60 = player->unk_138 - shot->obj.pos.z;
if (sqrtf(SQ(sp68) + SQ(sp64) + SQ(sp60)) < temp_fs2) {
player->unk_288 = shot->playerNum + 1;
switch (player->form) {
case 0:
Player_ApplyDamage(player, 0, 80);
break;
case 1:
Player_ApplyDamage(player, 0, 60);
break;
case 3:
Player_ApplyDamage(player, 0, 180);
break;
}
}
}
}
}
}
void func_8003CC08(PlayerShot* shot) {
f32 temp_fa0;
f32 temp_fa1;
f32 temp_fv1;
f32 var_ft5;
switch (shot->unk_5C) {
case 0:
if (shot->unk_64 == 0) {
func_80035E78(shot);
break;
}
if ((shot->obj.pos.y < D_80177940) && (D_801784AC != 4)) {
func_80035E78(shot);
break;
}
if ((gPlayer[shot->playerNum].form == FORM_LANDMASTER) || (gPlayer[shot->playerNum].form == FORM_ON_FOOT)) {
shot->vel.y -= 1.0f;
Math_SmoothStepToF(&shot->obj.rot.x, -90.0f, 0.05f, 1.0f, 0.0f);
}
if (shot->unk_64 < 25) {
if (gVersusMode) {
if (gControllerPress[shot->playerNum].button & gBombButton[shot->playerNum]) {
func_80035E78(shot);
break;
}
} else {
if (gControllerPress[gMainController].button & gBombButton[shot->playerNum]) {
func_80035E78(shot);
break;
}
}
}
if (!((gCurrentLevel == LEVEL_VENOM_ANDROSS) && (gBosses[0].obj.status == 2) &&
(gBosses[0].unk_04E == 17))) {
func_80038140(shot);
}
func_8003C3D8(shot);
break;
case 1:
D_8017812C = 2;
shot->obj.rot.y += 1.0f;
Math_SmoothStepToF(&shot->unk_44, shot->unk_48, 0.05f, 1.5f, 0.001f);
if ((shot->unk_64 > 0) && (shot->unk_64 < 30)) {
if (!gVersusMode &&
((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_3) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_5))) {
temp_fv1 = gPlayer[0].pos.x - shot->obj.pos.x;
temp_fa0 = gPlayer[0].pos.y - shot->obj.pos.y;
temp_fa1 = gPlayer[0].unk_138 - shot->obj.pos.z;
var_ft5 = sqrtf(SQ(temp_fv1) + SQ(temp_fa0) + SQ(temp_fa1)) * 0.01f;
if (var_ft5 > 60.0f) {
var_ft5 = 60.0f;
}
var_ft5 = 60.0f - var_ft5;
Math_SmoothStepToF(&D_801779A8[gMainController], var_ft5 + 5.0f, 1.0f, 3.0f, 0.0f);
}
func_8003C3D8(shot);
}
if (shot->unk_64 == 0) {
shot->unk_58 -= 8;
if (shot->unk_58 < 0) {
shot->unk_58 = 0;
Object_Kill(&shot->obj, &shot->sfxPos);
D_8017812C = 0;
}
}
func_8003C4D0(shot, 50);
break;
}
}
static Vec3f D_800C9C24 = { 0.0f, 0.0f, 0.0f };
void func_8003CF90(PlayerShot* shot) {
s32 i;
s32 var_a3;
f32 sp6C;
f32 sp68;
f32 sp64;
f32 sp60;
f32 sp5C;
f32 sp58;
Object_2F4* obj2F4;
Player* player;
if ((shot->obj.pos.y < D_80177940) || (shot->unk_64 == 1)) {
if ((D_80161A88 == 2) && (shot->obj.pos.y < D_80177940)) {
shot->unk_48 = 10.0f;
func_8007D9DC(shot->obj.pos.x, D_80177940 + 2.0f, shot->obj.pos.z, shot->unk_48 * 0.1f, shot->unk_48 * 3.0f,
0);
func_8007D9DC(shot->obj.pos.x, D_80177940 + 2.0f, shot->obj.pos.z, shot->unk_48 * 0.1f, shot->unk_48 * 3.0f,
5);
func_8007ADF4(shot->obj.pos.x, D_80177940, shot->obj.pos.z, shot->unk_48 * 0.05f, shot->unk_48 * 0.5f);
func_8007A6F0(&shot->obj.pos, 0x19000014);
}
func_80036318(shot);
} else {
var_a3 = 0;
if (shot->unk_60 == 0) {
for (i = 0, obj2F4 = gObjects2F4; i < 60; i++, obj2F4++) {
if ((obj2F4->obj.status == 2) && (obj2F4->info.unk_1C != 0.0f) &&
(obj2F4->timer_0CA[shot->playerNum] != 0)) {
var_a3 = 1;
obj2F4->timer_0CA[shot->playerNum] = 2;
D_800C9C24 = obj2F4->obj.pos;
D_800C9C24.y += obj2F4->info.unk_1C;
}
}
for (i = 0, player = gPlayer; i < gCamCount; i++, player++) {
if (((player->state_1C8 == PLAYERSTATE_1C8_3) || (player->state_1C8 == PLAYERSTATE_1C8_5)) &&
(D_80177B00[i][shot->playerNum] != 0)) {
var_a3 = 1;
D_80177B00[i][shot->playerNum] = 2;
D_800C9C24.x = player->pos.x;
if (player->form == FORM_ARWING) {
D_800C9C24.y = player->pos.y;
} else {
D_800C9C24.y = player->pos.y + 30.0f;
}
D_800C9C24.z = player->unk_138;
}
}
if (var_a3 != 0) {
sp6C = shot->obj.pos.x - D_800C9C24.x;
sp68 = shot->obj.pos.y - D_800C9C24.y;
sp64 = shot->obj.pos.z - D_800C9C24.z;
sp58 = Math_RadToDeg(Math_Atan2F(sp6C, sp64));
sp5C = Math_RadToDeg(-Math_Atan2F(sp68, sqrtf(SQ(sp6C) + SQ(sp64))));
if (shot->unk_30 >= 360.0f) {
shot->unk_30 -= 360.0f;
}
if (shot->unk_30 < 0.0f) {
shot->unk_30 += 360.0f;
}
if (shot->unk_2C >= 360.0f) {
shot->unk_2C -= 360.0f;
}
if (shot->unk_2C < 0.0f) {
shot->unk_2C += 360.0f;
}
Math_SmoothStepToAngle(&shot->unk_30, sp58, 1.0f, shot->unk_50, 0.0f);
Math_SmoothStepToAngle(&shot->unk_2C, sp5C, 1.0f, shot->unk_50, 0.0f);
shot->unk_64 = 30;
} else {
shot->unk_60 = 1;
}
}
Math_SmoothStepToF(&shot->unk_50, 360.0f, 1.0f, 3.0f, 0.f);
if (shot->unk_60 != 0) {
Math_SmoothStepToF(&shot->unk_54, 169.0f, 1.0f, 13.0f, 0.f);
} else {
Math_SmoothStepToF(&shot->unk_54, 91.0f, 1.0f, 7.7999997f, 0.f);
}
if (!((gPlayer[shot->playerNum].form == FORM_LANDMASTER) && (shot->unk_60 != 0))) {
Vec3f sp44;
Vec3f sp38;
shot->obj.rot.y = shot->unk_30;
shot->obj.rot.x = shot->unk_2C;
Matrix_RotateY(gCalcMatrix, shot->obj.rot.y * 0.017453292f, 0);
Matrix_RotateX(gCalcMatrix, shot->obj.rot.x * 0.017453292f, 1);
sp44.x = sp44.y = 0.0f;
sp44.z = -(shot->unk_54 + 40.0f);
Matrix_MultVec3f(gCalcMatrix, &sp44, &sp38);
shot->vel.x = sp38.x;
shot->vel.y = sp38.y;
shot->vel.z = sp38.z;
}
func_80038140(shot);
D_80178370 = shot->obj.pos.x;
D_80178374 = shot->obj.pos.y;
D_80178378 = shot->obj.pos.z;
D_80178360 = 90;
D_80178364 = 180;
D_80178368 = 90;
Math_SmoothStepToF(&D_8017836C, 0.6f, 1.0f, 0.08f, 0.001f);
}
}
void func_8003D54C(PlayerShot* shot, s32 index) {
s32 teamId;
s32 bonus;
shot->obj.pos.x += shot->vel.x;
shot->obj.pos.y += shot->vel.y;
shot->obj.pos.z += shot->vel.z;
switch (shot->obj.id) {
case PLAYERSHOT_0:
func_8003B55C(shot, index);
break;
case PLAYERSHOT_1:
case PLAYERSHOT_9:
func_8003B55C(shot, index);
break;
case PLAYERSHOT_2:
func_8003B00C(shot, &gPlayer[shot->playerNum]);
break;
case PLAYERSHOT_3:
func_8003CC08(shot);
break;
case PLAYERSHOT_4:
func_8003BEF4(shot);
break;
case PLAYERSHOT_5:
func_8003BA80(shot);
break;
case PLAYERSHOT_6:
func_8003BAA0(shot);
break;
case PLAYERSHOT_7:
func_8003BACC(shot);
break;
case PLAYERSHOT_8:
if (shot->unk_44 > 1.5f) {
func_8003C4D0(shot, 30);
if (shot->bonus != 0) {
if (gVersusMode) {
D_80177C30[shot->playerNum] += shot->bonus;
} else {
bonus = shot->bonus;
if (shot->bonus > 10) {
bonus = 100;
}
func_80077240(shot->obj.pos.x, shot->obj.pos.y, shot->obj.pos.z, bonus);
gHitCount += shot->bonus;
}
if ((shot->bonus >= 7) && (D_80178284 == 0) && (gLevelMode == LEVELMODE_ON_RAILS) &&
((gTeamShields[1] > 0) || (gTeamShields[2] > 0) || (gTeamShields[3] > 0))) {
do {
teamId = (s32) (Rand_ZeroOne() * 2.9f) + 1;
} while (gTeamShields[teamId] <= 0);
switch (teamId) {
case 1:
func_800BA808(gMsg_ID_7100, RCID_FALCO);
break;
case 2:
func_800BA808(gMsg_ID_15252, RCID_SLIPPY);
break;
case 3:
func_800BA808(gMsg_ID_17160, RCID_PEPPY);
break;
}
}
}
Object_Kill(&shot->obj, &shot->sfxPos);
func_8007A6F0(&shot->obj.pos, 0x0903502E);
} else if (gCurrentLevel == LEVEL_AQUAS) {
func_E16C50_801ABA40(shot);
} else {
func_8003CF90(shot);
}
break;
}
}
void func_8003D854(PlayerShot* shot) {
s32 i;
s32 var_s5;
switch (shot->obj.status) {
case 0:
break;
case 1:
var_s5 = 1;
switch (shot->obj.id) {
case PLAYERSHOT_9:
var_s5 = 4;
break;
case PLAYERSHOT_0:
case PLAYERSHOT_1:
if ((shot->unk_58 == 0) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_2)) {
var_s5 = 4;
} else {
var_s5 = 3;
}
break;
case PLAYERSHOT_5:
var_s5 = 2;
break;
}
for (i = 0; i < var_s5 && (shot->obj.status == 1); i++) {
if (shot->unk_64 > 0) {
shot->unk_64--;
}
D_80178498 = shot->obj.pos.z;
D_801784A0 = shot->obj.pos.y;
D_8017849C = shot->obj.pos.x;
func_8003D54C(shot, i);
}
break;
case 2:
func_8003AFD8(shot);
break;
}
}
void func_8003D9B8(void) {
s32 i;
for (i = 0; i < 16; i++) {
gPlayerShots[i].index = i;
func_8003D854(&gPlayerShots[i]);
}
}
void func_8003DA0C(void) {
s32 i;
for (i = 0; i < 16; i++) {
gPlayerShots[i].index = i;
if (gPlayerShots[i].obj.status != 0) {
if (!((D_80161410 < 0) && (gPlayerShots[i].obj.rot.x < -10.0f))) {
Matrix_Push(&gGfxMatrix);
func_8003AF88(&gPlayerShots[i]);
Matrix_Pop(&gGfxMatrix);
}
if (D_80161410 > 0) {
func_8005F290(&gPlayerShots[i].sfxPos, &D_8015F950);
}
}
}
}