Files
tww/src/d/d_bg_s_acch.cpp
T
2023-10-18 23:31:18 -04:00

307 lines
8.9 KiB
C++

//
// Generated by dtk
// Translation Unit: d_bg_s_acch.cpp
//
#include "d/d_bg_s_acch.h"
#include "d/d_bg_s.h"
#include "dolphin/types.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "f_op/f_op_actor_mng.h"
#include "d/d_com_inf_game.h"
#include "d/actor/d_a_sea.h"
#define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !(((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)) ) == 1));
#define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f);
#define CHECK_VEC3_RANGE(line, v) JUT_ASSERT(line, -1.0e32f < v.x && v.x < 1.0e32f && -1.0e32f < v.y && v.y < 1.0e32f && -1.0e32f < v.z && v.z < 1.0e32f)
#define CHECK_PVEC3_RANGE(line, v) JUT_ASSERT(line, -1.0e32f < v->x && v->x < 1.0e32f && -1.0e32f < v->y && v->y < 1.0e32f && -1.0e32f < v->z && v->z < 1.0e32f)
/* 800A257C-800A25F4 .text __ct__12dBgS_AcchCirFv */
dBgS_AcchCir::dBgS_AcchCir() {
m_flags = 0;
m_wall_rr = 0.0f;
field_0x2c = 0.0f;
m_wall_h = 0.0f;
m_wall_r = 0.0f;
m_wall_angle_y = 0;
m_wall_h_direct = 0.0f;
}
/* 800A25F4-800A25FC .text SetWallR__12dBgS_AcchCirFf */
void dBgS_AcchCir::SetWallR(f32 radius) {
m_wall_r = radius;
}
/* 800A25FC-800A2624 .text SetWall__12dBgS_AcchCirFff */
void dBgS_AcchCir::SetWall(f32 height, f32 radius) {
m_wall_h = height;
SetWallR(radius);
}
/* 800A2624-800A29B0 .text __dt__9dBgS_AcchFv */
dBgS_Acch::~dBgS_Acch() {
}
/* 800A29B0-800A2CFC .text __ct__9dBgS_AcchFv */
dBgS_Acch::dBgS_Acch() {
SetPolyPassChk(GetPolyPassChkInfo());
SetGrpPassChk(GetGrpPassChkInfo());
m_flags = 0;
SetRoofNone();
pm_pos = NULL;
pm_old_pos = NULL;
pm_speed = NULL;
m_ground_h = -1000000000.0f;
m_ground_up_h = 0.0f;
field_0x98 = 60.0f;
m_ground_up_h_diff = 0.0f;
field_0xb0 = 0;
field_0xb4 = 0.0f;
field_0xb8 = 0.0f;
m_tbl_size = 0;
pm_acch_cir = NULL;
m_roof_y = 0.0f;
m_roof_crr_height = 0.0f;
m_roof_height = 0.0f;
field_0xc8 = 200.0f;
pm_angle = NULL;
pm_shape_angle = NULL;
m_my_ac = NULL;
pm_out_poly_info = NULL;
m_sea_height = -1000000000.0f;
}
static void dummy1() {
OSReport("***********************************\ndBgS_Acch::copy constructer called.\n***********************************\n");
}
/* 800A2CFC-800A2D78 .text Init__9dBgS_AcchFv */
void dBgS_Acch::Init() {
ClrWallHit();
for (int i = 0; i < m_tbl_size; i++) {
pm_acch_cir[i].ClrWallHit();
pm_acch_cir[i].ClrWallHDirect();
}
}
/* 800A2D78-800A2E80 .text Set__9dBgS_AcchFP4cXyzP4cXyzP10fopAc_ac_ciP12dBgS_AcchCirP4cXyzP5csXyzP5csXyz */
void dBgS_Acch::Set(cXyz* pos, cXyz* old_pos, fopAc_ac_c* actor, int tbl_size, dBgS_AcchCir* acchCir, cXyz* speed,
csXyz* angle, csXyz* shape_angle) {
pm_pos = pos;
pm_old_pos = old_pos;
JUT_ASSERT(221, pm_pos != 0);
JUT_ASSERT(222, pm_old_pos != 0);
m_my_ac = actor;
SetActorPid(fopAcM_GetID(actor));
pm_speed = speed;
m_tbl_size = tbl_size;
pm_acch_cir = acchCir;
pm_angle = angle;
pm_shape_angle = shape_angle;
}
/* 800A2E80-800A2EE8 .text GroundCheckInit__9dBgS_AcchFR4dBgS */
void dBgS_Acch::GroundCheckInit(dBgS&) {
m_ground_h = -1000000000.0f;
if (m_flags & GRND_NONE) {
return;
}
m_gnd.SetExtChk(*(cBgS_Chk*)this);
field_0xb0 = ChkGroundHit();
ClrGroundHit();
ClrGroundLanding();
ClrGroundAway();
}
/* 800A2EE8-800A305C .text GroundCheck__9dBgS_AcchFR4dBgS */
void dBgS_Acch::GroundCheck(dBgS&) {
/* Nonmatching */
}
/* 800A305C-800A313C .text GroundRoofProc__9dBgS_AcchFR4dBgS */
void dBgS_Acch::GroundRoofProc(dBgS&) {
/* Nonmatching */
}
/* 800A313C-800A3460 .text LineCheck__9dBgS_AcchFR4dBgS */
void dBgS_Acch::LineCheck(dBgS&) {
/* Nonmatching */
}
/* 800A3460-800A3F50 .text CrrPos__9dBgS_AcchFR4dBgS */
void dBgS_Acch::CrrPos(dBgS& i_bgs) {
if (m_flags & 0x1) {
return;
}
JUT_ASSERT(494, pm_pos != 0);
JUT_ASSERT(495, pm_old_pos != 0);
CHECK_FLOAT_CLASS(535, pm_pos->x);
CHECK_FLOAT_CLASS(536, pm_pos->y);
CHECK_FLOAT_CLASS(537, pm_pos->z);
CHECK_PVEC3_RANGE(541, pm_pos);
i_bgs.MoveBgCrrPos(m_gnd, ChkGroundHit(), pm_pos, pm_angle, pm_shape_angle);
GroundCheckInit(i_bgs);
Init();
f32 lowH_R = GetWallAllLowH_R();
cXyz* temp9 = pm_old_pos;
cXyz* temp10 = pm_pos;
f32 distXZ2 = temp9->abs2XZ(*temp10);
f32 distY = pm_old_pos->y - pm_pos->y;
f32 lowH = GetWallAllLowH();
field_0xb4 = pm_pos->y;
f32 oldY = pm_old_pos->y;
f32 temp7 = lowH + oldY;
f32 temp8 = field_0x98 + pm_pos->y;
bool ranLineCheck = false;
OffLineCheckHit();
if (!ChkLineCheckNone() && !cM3d_IsZero(lowH_R)) {
if (distXZ2 > lowH_R*lowH_R || temp7 > temp8 || distY > field_0x98 || ChkLineCheck()) {
ranLineCheck = true;
LineCheck(i_bgs);
}
}
if (!(m_flags & WALL_NONE)) {
i_bgs.WallCorrect(this);
}
if (ChkWallHit() && ranLineCheck) {
LineCheck(i_bgs);
}
m_roof_height = 1000000000.0f;
if (!(m_flags & ROOF_NONE)) {
m_roof.SetExtChk(*(cBgS_Chk*)this);
ClrRoofHit();
cXyz roofPos = *pm_pos;
m_roof.SetPos(roofPos);
m_roof_y = i_bgs.RoofChk(&m_roof);
if (m_roof_y != 1000000000.0f && pm_pos->y + m_roof_crr_height > m_roof_y) {
m_roof_height = m_roof_y - m_roof_crr_height;
SetRoofHit();
}
}
if (!(m_flags & GRND_NONE)) {
ClrGroundFind();
GroundCheck(i_bgs);
GroundRoofProc(i_bgs);
} else if (m_roof_height < pm_pos->y) {
pm_pos->y = m_roof_height;
}
if (!(m_flags & WATER_NONE)) {
ClrWaterHit();
ClrWaterIn();
m_wtr.SetHeight(-1000000000.0f);
int room_no = i_bgs.GetRoomId(m_gnd);
if (m_ground_h != -1000000000.0f && 0 <= room_no && room_no < 64) {
JUT_ASSERT(693, 0 <= room_no && room_no < 64);
dBgW* bgw = dComIfGp_roomControl_getBgW(room_no);
if (bgw) {
f32 top;
f32 under;
bgw->GetTopUnder(&top, &under);
cXyz ground = *pm_pos;
ground.y = under;
m_wtr.Set(ground, top);
m_wtr.SetPassChkInfo(*this);
if (i_bgs.SplGrpChk(&m_wtr)) {
SetWaterHit();
if (m_wtr.GetHeight() > pm_pos->y) {
SetWaterIn();
}
JUT_ASSERT_FLOAT(718, m_wtr.GetHeight() >= ground.y);
JUT_ASSERT_FLOAT(719, m_wtr.GetHeight() <= top);
}
}
}
}
if (ChkSeaCheckOn()) {
m_flags &= ~SEA_IN;
m_sea_height = -1000000000.0f;
if (daSea_ChkArea(pm_pos->x, pm_pos->z)) {
m_sea_height = daSea_calcWave(pm_pos->x, pm_pos->z);
}
if (ChkSeaWaterHeight()) {
f32 wtr_height = m_wtr.GetHeight();
if (m_sea_height < wtr_height) {
m_sea_height = wtr_height;
}
}
if (m_sea_height > pm_pos->y) {
m_flags |= SEA_IN;
}
}
CHECK_FLOAT_CLASS(780, pm_pos->x);
CHECK_FLOAT_CLASS(781, pm_pos->y);
CHECK_FLOAT_CLASS(782, pm_pos->z);
CHECK_PVEC3_RANGE(786, pm_pos);
}
static void dummy2() {
OSReport("\033[43;30m**************************************\ndBgS_ObjAcch::copy constructer called.\n**************************************\n\033[m");
}
/* 800A3F50-800A3F8C .text GetWallAllR__9dBgS_AcchFv */
f32 dBgS_Acch::GetWallAllR() {
/* Nonmatching */
}
/* 800A3F8C-800A3FE4 .text SetWallCir__9dBgS_AcchFv */
void dBgS_Acch::SetWallCir() {
for (int i = 0; i < m_tbl_size; i++) {
pm_acch_cir[i].SetCir(*pm_pos);
}
}
/* 800A3FE4-800A4114 .text CalcWallBmdCyl__9dBgS_AcchFv */
void dBgS_Acch::CalcWallBmdCyl() {
/* Nonmatching */
}
/* 800A4114-800A4128 .text SetGroundUpY__9dBgS_AcchFf */
void dBgS_Acch::SetGroundUpY(f32 y) {
m_ground_up_h_diff = y - m_ground_up_h;
m_ground_up_h = y;
}
/* 800A4128-800A4178 .text GetWallAllLowH__9dBgS_AcchFv */
f32 dBgS_Acch::GetWallAllLowH() {
/* Nonmatching */
}
/* 800A4178-800A41E4 .text GetWallAllLowH_R__9dBgS_AcchFv */
f32 dBgS_Acch::GetWallAllLowH_R() {
/* Nonmatching */
}
/* 800A41E4-800A42B4 .text GetOnePolyInfo__9dBgS_AcchFP13cBgS_PolyInfo */
f32 dBgS_Acch::GetOnePolyInfo(cBgS_PolyInfo*) {
/* Nonmatching */
}
/* 800A42B4-800A4348 .text GetWallAddY__9dBgS_AcchFR3Veci */
f32 dBgS_Acch::GetWallAddY(Vec&, int) {
/* Nonmatching */
}
/* 800A4434-800A444C .text getBgW__20dStage_roomControl_cFi */
dBgW* dStage_roomControl_c::getBgW(int i_roomNo) {
return mStatus[i_roomNo].mpBgW;
}