diff --git a/include/JSystem/J3DGraphBase/J3DMaterial.h b/include/JSystem/J3DGraphBase/J3DMaterial.h index 4113522218..e6b668d27f 100644 --- a/include/JSystem/J3DGraphBase/J3DMaterial.h +++ b/include/JSystem/J3DGraphBase/J3DMaterial.h @@ -82,6 +82,8 @@ public: void setTevColor(u32 i, const J3DGXColorS10* i_color) { mTevBlock->setTevColor(i, i_color); } void setTevKColor(u32 i, const J3DGXColor* i_color) { mTevBlock->setTevKColor(i, i_color); } + void setAmbColor(u32 i, const J3DGXColor* i_color) { mColorBlock->setAmbColor(i, i_color); } + void setLight(u32 i, J3DLightObj* i_lightobj) { mColorBlock->setLight(i, i_lightobj); } void setMaterialAnm(J3DMaterialAnm* i_anm) { mMaterialAnm = i_anm; } void setCullMode(u8 i_mode) { mColorBlock->setCullMode(i_mode); } void setTexMtx(u32 idx, J3DTexMtx* mtx) { mTexGenBlock->setTexMtx(idx, mtx); } diff --git a/include/d/d_kankyo.h b/include/d/d_kankyo.h index 0929c15577..6e0da0c62b 100644 --- a/include/d/d_kankyo.h +++ b/include/d/d_kankyo.h @@ -3,58 +3,13 @@ #include "JSystem/J3DGraphBase/J3DStruct.h" #include "d/d_kankyo_wether.h" -#include "m_Do/m_Do_ext.h" #include "f_pc/f_pc_base.h" +#include "m_Do/m_Do_ext.h" class JPABaseEmitter; class cBgS_PolyInfo; class color_RGB_class; -void dKy_set_nexttime(f32); -void dKy_itudemo_se(); -BOOL dKy_darkworld_spot_check(char const* stageName, int roomNo); -void dKy_darkworld_Area_set(char const* stageName, int roomNo); -void dKy_FiveSenses_fullthrottle_dark(); -s32 dKy_daynight_check(); -void dKy_clear_game_init(); -void dKy_setLight_init(); -u8 dKy_pol_sound_get(cBgS_PolyInfo const* param_0); -void dKy_depth_dist_set(void* param_0); -void dKy_instant_rainchg(); -void dKy_instant_timechg(f32); -static void dKy_set_vrboxsoracol_ratio(f32 ratio); -static void dKy_set_vrboxkumocol_ratio(f32 ratio); -void dKy_actor_addcol_set(s16 param_0, s16 param_1, s16 param_2, f32 param_3); -void dKy_fog_startendz_set(f32 param_0, f32 param_1, f32 param_2); -static void dKy_vrbox_addcol_set(s16 param_0, s16 param_1, s16 param_2, f32 param_3); -void dKy_GxFog_set(); -static void GxFog_set(); -static void GxXFog_set(); -u8 dKy_pol_argument_get(cBgS_PolyInfo const* i_poly); -void dKy_Sound_set(cXyz i_pos, int param_1, fpc_ProcID i_actorID, int param_3); -void dKy_bg_MAxx_proc(void* param_0); -void dKy_change_colpat(u8 colpat); -void dKy_BossLight_set(cXyz* param_0, _GXColor* param_1, f32 param_2, u8 param_3); -void dKy_custom_colset(u8 prevGather, u8 curGather, f32 blend); -void dKy_setLight(); -cXyz dKy_plight_near_pos(); -void dKy_BossSpotLight_set(cXyz* param_0, f32 param_1, f32 param_2, f32 param_3, _GXColor* param_4, - f32 param_5, u8 param_6, u8 param_7); -static void dKy_calc_color_set(_GXColorS10* param_0, color_RGB_class* param_1, - color_RGB_class* param_2, color_RGB_class* param_3, - color_RGB_class* param_4, f32 param_5, f32 param_6, - _GXColorS10 param_7, f32 param_8); -static void dKy_twilight_camelight_set(); -u8 dKy_shadow_mode_check(u8 mode); -void dKy_shadow_mode_set(u8 mode); -void dKy_shadow_mode_reset(u8 mode); -void dKy_Itemgetcol_chg_on(); -void dKy_actor_addcol_amb_set(s16 r, s16 g, s16 b, f32 factor); -void dKy_bg_addcol_amb_set(s16 r, s16 g, s16 b, f32 factor); -int dKy_WolfEyeLight_set(cXyz* param_0, f32 param_1, f32 param_2, f32 param_3, - GXColor* param_4, f32 param_5, u8 param_6, u8 param_7); -BOOL dKy_TeachWind_existence_chk(); - struct LIGHT_INFLUENCE { /* 0x00 */ cXyz mPosition; /* 0x0C */ GXColorS10 mColor; @@ -90,10 +45,10 @@ struct EFLIGHT_PROC { }; struct SND_INFLUENCE { - /* 0x00 */ cXyz field_0x0; + /* 0x00 */ cXyz position; /* 0x0C */ int field_0xc; - /* 0x10 */ int field_0x10; - /* 0x14 */ u32 field_0x14; + /* 0x10 */ int timer; + /* 0x14 */ fpc_ProcID actor_id; }; struct DALKMIST_INFLUENCE { @@ -151,16 +106,19 @@ struct EF_THUNDER { }; struct GB_MAPLE_COL_CHANGE { - /* 0x00 */ J3DLightObj field_0x0; + /* 0x00 */ J3DLightObj light_obj; }; // Size: 0x74 -// most of these members are guesses, fix later struct LightStatus { - /* 0x00 */ Vec field_0x0; + /* 0x00 */ Vec position; /* 0x0C */ Vec field_0xc; - /* 0x18 */ GXColor field_0x18; - /* 0x1C */ Vec field_0x1c; - /* 0x28 */ Vec field_0x28; + /* 0x18 */ GXColor color; + /* 0x1C */ int field_0x1c; + /* 0x20 */ f32 field_0x20; + /* 0x24 */ f32 field_0x24; + /* 0x28 */ f32 field_0x28; + /* 0x2C */ f32 field_0x2c; + /* 0x30 */ f32 field_0x30; /* 0x34 */ f32 field_0x34; /* 0x38 */ Vec mLightDir; /* 0x44 */ f32 mCutoff; @@ -184,39 +142,33 @@ class dKy_tevstr_c { public: // Supposedly exists but didn't work. Might be too big to inline. // See dPa_modelEcallBack::model_c::set. - //inline dKy_tevstr_c& operator=(const dKy_tevstr_c& b); - + // inline dKy_tevstr_c& operator=(const dKy_tevstr_c& b); + /* 0x000 */ J3DLightObj mLightObj; /* 0x074 */ J3DLightObj mLights[6]; - /* 0x32C */ cXyz field_0x32c; + /* 0x32C */ cXyz field_0x32c; // some light pos, unsure how it differs /* 0x338 */ cXyz mLightPosWorld; /* 0x344 */ f32 field_0x344; - /* 0x348 */ GXColorS10 mColorC0; - /* 0x350 */ GXColorS10 mColorK0; - /* 0x358 */ GXColorS10 mFogColor; - /* 0x360 */ u8 field_0x360; - /* 0x361 */ u8 field_0x361; - /* 0x362 */ u8 field_0x362; - /* 0x363 */ u8 field_0x363; - /* 0x364 */ u8 mLightInf; - /* 0x365 */ u8 field_0x365; - /* 0x366 */ u8 field_0x366; - /* 0x367 */ u8 field_0x367; + /* 0x348 */ GXColorS10 AmbCol; + /* 0x350 */ GXColorS10 FogCol; + /* 0x358 */ GXColorS10 TevColor; + /* 0x360 */ GXColor TevKColor; + /* 0x364 */ GXColor mLightInf; /* 0x368 */ f32 mFogStartZ; /* 0x36C */ f32 mFogEndZ; - /* 0x370 */ f32 mColpatBlend; + /* 0x370 */ f32 pat_ratio; /* 0x374 */ f32 field_0x374; - /* 0x378 */ u16 field_0x378; - /* 0x37A */ u8 field_0x37a; + /* 0x378 */ u16 Material_id; // Used for some sort of special material handling when non-0 + /* 0x37A */ u8 Type; /* 0x37B */ u8 mInitTimer; - /* 0x37C */ u8 mEnvrIdxCurr; - /* 0x37D */ u8 mEnvrIdxPrev; - /* 0x37E */ u8 mColpatCurr; - /* 0x37F */ u8 mColpatPrev; - /* 0x380 */ s8 mRoomNo; - /* 0x381 */ u8 mEnvrIdxOverride; + /* 0x37C */ u8 UseCol; + /* 0x37D */ u8 PrevCol; + /* 0x37E */ u8 wether_pat1; + /* 0x37F */ u8 wether_pat0; + /* 0x380 */ s8 room_no; // Room Color + /* 0x381 */ u8 YukaCol; // Floor (Poly) Color /* 0x382 */ u8 mLightMode; - /* 0x383 */ u8 mInitType; + /* 0x383 */ u8 Material_use_fg; /* 0x384 */ u8 field_0x384; /* 0x385 */ u8 field_0x385; }; // Size = 0x388 @@ -252,6 +204,13 @@ struct dKy_pol_sound_struct { u8 data[8]; }; +enum dKy_LIGHT_SIZE { + LIGHT_SIZE_S, + LIGHT_SIZE_M, + LIGHT_SIZE_L, + LIGHT_SIZE_LL, +}; + class dScnKy_env_light_c { public: /* 8019F2E8 */ dScnKy_env_light_c(); @@ -262,13 +221,13 @@ public: /* 8019FBD4 */ void setLight_palno_get(u8*, u8*, u8*, u8*, u8*, u8*, u8*, u8*, f32*, int*, int*, f32*, u8*); /* 801A040C */ void setLight(); - /* 801A133C */ void setLight_bg(dKy_tevstr_c*, _GXColorS10*, _GXColorS10*, f32*, f32*); - /* 801A16C0 */ void setLight_actor(dKy_tevstr_c*, _GXColorS10*, f32*, f32*); - /* 801A1D64 */ void settingTevStruct_colget_actor(cXyz*, dKy_tevstr_c*, _GXColorS10*, - _GXColorS10*, f32*, f32*); + /* 801A133C */ void setLight_bg(dKy_tevstr_c*, GXColorS10*, GXColorS10*, f32*, f32*); + /* 801A16C0 */ void setLight_actor(dKy_tevstr_c*, GXColorS10*, f32*, f32*); + /* 801A1D64 */ void settingTevStruct_colget_actor(cXyz*, dKy_tevstr_c*, GXColorS10*, + GXColorS10*, f32*, f32*); /* 801A1F58 */ void settingTevStruct_colget_player(dKy_tevstr_c*); - /* 801A2128 */ void settingTevStruct_plightcol_plus(cXyz*, dKy_tevstr_c*, _GXColorS10, - _GXColorS10, u8); + /* 801A2128 */ void settingTevStruct_plightcol_plus(cXyz*, dKy_tevstr_c*, GXColorS10, + GXColorS10, u8); /* 801A37C4 */ void settingTevStruct(int, cXyz*, dKy_tevstr_c*); /* 801A441C */ void setLightTevColorType(J3DModelData*, dKy_tevstr_c*); /* 801A4DA0 */ void setLightTevColorType_MAJI(J3DModelData*, dKy_tevstr_c*); @@ -281,55 +240,55 @@ public: /* 801ADBBC */ virtual ~dScnKy_env_light_c() {} - void setLightTevColorType(J3DModel* i_model, dKy_tevstr_c* tevstr) { - setLightTevColorType(i_model->getModelData(), tevstr); + void setLightTevColorType(J3DModel* model_p, dKy_tevstr_c* tevstr_p) { + setLightTevColorType(model_p->getModelData(), tevstr_p); } - void setLightTevColorType_MAJI(J3DModel* i_model, dKy_tevstr_c* tevstr) { - setLightTevColorType_MAJI(i_model->getModelData(), tevstr); + void setLightTevColorType_MAJI(J3DModel* model_p, dKy_tevstr_c* tevstr_p) { + setLightTevColorType_MAJI(model_p->getModelData(), tevstr_p); } public: /* 0x0000 */ // vtable - /* 0x0004 */ stage_palette_info_class* mpDmPalet; - /* 0x0008 */ stage_pselect_info_class* mpDmPselect; - /* 0x000C */ stage_envr_info_class* mpDmEnvr; - /* 0x0010 */ stage_vrboxcol_info_class* mpDmVrbox; - /* 0x0014 */ dKyd_lightSchejule* mpSchedule; - /* 0x0018 */ LIGHT_INFLUENCE mBaseLightInfluence; + /* 0x0004 */ stage_palette_info_class* stage_palette_info; + /* 0x0008 */ stage_pselect_info_class* stage_pselect_info; + /* 0x000C */ stage_envr_info_class* stage_envr_info; + /* 0x0010 */ stage_vrboxcol_info_class* stage_vrboxcol_info; + /* 0x0014 */ dKyd_lightSchejule* light_schedule; + /* 0x0018 */ LIGHT_INFLUENCE base_light; /* 0x0038 */ LIGHT_INFLUENCE mLightInfluence[30]; - /* 0x03F8 */ LIGHT_INFLUENCE* mPointLight[100]; - /* 0x0588 */ LIGHT_INFLUENCE* mEfPLight[5]; - /* 0x059C */ u8 field_0x59c[400]; - /* 0x072C */ LIGHT_INFLUENCE* field_0x72c[5]; - /* 0x0740 */ LIGHT_INFLUENCE field_0x740; - /* 0x0760 */ u8 field_0x760[4]; - /* 0x0764 */ LIGHT_INFLUENCE mBGpartsActiveLight[2]; - /* 0x07A4 */ EFLIGHT_PROC mSwordLight; - /* 0x07CC */ stage_plight_info_class* stagPlightInfo; // might be part of EFLIGHT_PROC - /* 0x07D0 */ WIND_INFLUENCE* mPntWind[30]; - /* 0x0848 */ WIND_INF_ENTITY mWindInfluenceEntity[5]; - /* 0x0974 */ SND_INFLUENCE mSound; - /* 0x098C */ u8 field_0x98c; // often set to room no - /* 0x0990 */ DALKMIST_INFLUENCE* mDalkmistInf[10]; - /* 0x09B8 */ DUNGEON_LIGHT mDungeonLights[8]; + /* 0x03F8 */ LIGHT_INFLUENCE* pointlight[100]; + /* 0x0588 */ LIGHT_INFLUENCE* efplight[5]; + /* 0x059C */ u8 unk_0x59c[0x72C - 0x59C]; + /* 0x072C */ LIGHT_INFLUENCE* unk_0x72c[5]; // only ever set to NULL in plight_init + /* 0x0740 */ LIGHT_INFLUENCE unk_0x740; + /* 0x0760 */ u8 unk_0x760[0x764 - 0x760]; + /* 0x0764 */ LIGHT_INFLUENCE bgparts_active_light[2]; + /* 0x07A4 */ EFLIGHT_PROC eflight; + /* 0x07CC */ stage_plight_info_class* stage_plight_info; + /* 0x07D0 */ WIND_INFLUENCE* pntwind[30]; + /* 0x0848 */ WIND_INF_ENTITY wind_inf_entity[5]; + /* 0x0974 */ SND_INFLUENCE sound_influence; + /* 0x098C */ u8 player_room_no; + /* 0x0990 */ DALKMIST_INFLUENCE* dalkmist_influence[10]; + /* 0x09B8 */ DUNGEON_LIGHT dungeonlight[8]; /* 0x0C18 */ BOSS_LIGHT field_0x0c18[8]; /* 0x0D58 */ BOSS_LIGHT field_0x0d58[6]; - /* 0x0E48 */ GB_WIND_INFLUENCE mWind; + /* 0x0E48 */ GB_WIND_INFLUENCE global_wind_influence; /* 0x0E5C */ f32 custom_windpower; - /* 0x0E60 */ f32 field_0xe60; - /* 0x0E64 */ u16 field_0xe64; - /* 0x0E66 */ u16 field_0xe66; - /* 0x0E68 */ s16 mEvtWindAngleX; - /* 0x0E6A */ s16 mEvtWindAngleY; - /* 0x0E6C */ u8 field_0xe6c; - /* 0x0E6D */ u8 mEvtWindSet; - /* 0x0E6E */ u8 mTeachWindExist; - /* 0x0E6F */ u8 field_0xe6f; + /* 0x0E60 */ f32 unk_0xe60; + /* 0x0E64 */ u16 unk_0xe64; + /* 0x0E66 */ u16 unk_0xe66; + /* 0x0E68 */ s16 evt_wind_angle_x; + /* 0x0E6A */ s16 evt_wind_angle_y; + /* 0x0E6C */ u8 unk_0xe6c; + /* 0x0E6D */ u8 evt_wind_go; + /* 0x0E6E */ u8 TeachWind_existence; + /* 0x0E6F */ u8 unk_0xe6f; /* 0x0E70 */ bool mSunInitialized; /* 0x0E74 */ dKankyo_sun_Packet* mpSunPacket; /* 0x0E78 */ dKankyo_sunlenz_Packet* mpSunLenzPacket; /* 0x0E7C */ bool mRainInitialized; - /* 0x0E80 */ int mRainCount; + /* 0x0E80 */ int raincnt; /* 0x0E84 */ dKankyo_rain_Packet* mpRainPacket; /* 0x0E88 */ bool mSnowInitialized; /* 0x0E8C */ int mSnowCount; @@ -362,16 +321,16 @@ public: /* 0x0F24 */ int field_0xf24; /* 0x0F28 */ dKankyo_odour_Packet* mpOdourPacket; /* 0x0F2C */ u8 field_0xf2c; - /* 0x0F30 */ J3DModel* mpUndwaterEfModel; + /* 0x0F30 */ J3DModel* undwater_ef_model; /* 0x0F34 */ f32 field_0xf34; - /* 0x0F38 */ JKRSolidHeap* mpUndwaterEfHeap; - /* 0x0F3C */ u8 field_0xf3c; - /* 0x0F3D */ u8 field_0xf3d; - /* 0x0F40 */ f32 field_0xf40; - /* 0x0F44 */ JPABaseEmitter* field_0xf44; - /* 0x0F48 */ JPABaseEmitter* field_0xf48; - /* 0x0F4C */ JPABaseEmitter* field_0xf4c; - /* 0x0F50 */ GB_MAPLE_COL_CHANGE field_0xf50[2]; + /* 0x0F38 */ JKRSolidHeap* undwater_ef_heap; + /* 0x0F3C */ u8 senses_mode; + /* 0x0F3D */ u8 now_senses_effect; + /* 0x0F40 */ f32 senses_effect_strength; + /* 0x0F44 */ JPABaseEmitter* senses_ef_emitter0; + /* 0x0F48 */ JPABaseEmitter* senses_ef_emitter1; + /* 0x0F4C */ JPABaseEmitter* senses_ef_emitter2; + /* 0x0F50 */ GB_MAPLE_COL_CHANGE global_maple_col_change[2]; /* 0x1038 */ u8 field_0x1038; /* 0x103C */ int field_0x103c; /* 0x1040 */ u8 field_0x1040[4]; @@ -382,147 +341,147 @@ public: /* 0x1051 */ u8 field_0x1051; /* 0x1054 */ int field_0x1054; /* 0x1058 */ dKankyo_evil_Packet* mpEvilPacket; - /* 0x105C */ mDoExt_btkAnm* mpUndwaterBtk; - /* 0x1060 */ kytag08_class* field_0x1060; - /* 0x1064 */ Vec field_0x1064; - /* 0x1070 */ cXyz mSunPos2; - /* 0x107C */ cXyz mPLightNearPos; - /* 0x1088 */ cXyz mSunPos; - /* 0x1094 */ cXyz mMoonPos; + /* 0x105C */ mDoExt_btkAnm* undwater_btk; + /* 0x1060 */ kytag08_class* fog_avoid_tag; + /* 0x1064 */ Vec field_0x1064; // some light direction + /* 0x1070 */ cXyz sun_light_pos; + /* 0x107C */ cXyz plight_near_pos; + /* 0x1088 */ cXyz sun_pos; + /* 0x1094 */ cXyz moon_pos; /* 0x10A0 */ cXyz field_0x10a0; /* 0x10AC */ GXFogAdjTable mXFogTbl; - /* 0x10C0 */ GXColorS10 mVrSkyCol; - /* 0x10C8 */ GXColorS10 mVrkumoCol; - /* 0x10D0 */ GXColorS10 mVrShitaGumoCol; - /* 0x10D8 */ GXColorS10 mVrShitaUneiCol; - /* 0x10E0 */ GXColorS10 mVrKasumiCol; - /* 0x10E8 */ GXColorS10 mVrOkuKasumiCol; + /* 0x10C0 */ GXColorS10 vrbox_sky_col; + /* 0x10C8 */ GXColorS10 vrbox_kumo_top_col; + /* 0x10D0 */ GXColorS10 vrbox_kumo_bottom_col; + /* 0x10D8 */ GXColorS10 vrbox_kumo_shadow_col; + /* 0x10E0 */ GXColorS10 vrbox_kasumi_outer_col; + /* 0x10E8 */ GXColorS10 vrbox_kasumi_inner_col; /* 0x10F0 */ GXColorS10 field_0x10f0; /* 0x10F8 */ GXColorS10 field_0x10f8; - /* 0x1100 */ GXColorS10 mActorAmbience; - /* 0x1108 */ GXColorS10 mTerrainAmbienceBG[4]; - /* 0x1128 */ GXColorS10 field_0x1128[6]; - /* 0x1158 */ GXColorS10 mFogColor; - /* 0x1160 */ GXColorS10 mActorAddColAmb; - /* 0x1168 */ u8 field_0x1168[8]; - /* 0x1170 */ GXColorS10 mBgAddColAmb; - /* 0x1178 */ u8 field_0x1178[8]; - /* 0x1180 */ GXColorS10 mBg1AddColAmb; - /* 0x1188 */ u8 field_0x1188[8]; - /* 0x1190 */ GXColorS10 mBg2AddColAmb; - /* 0x1198 */ u8 field_0x1198[8]; - /* 0x11A0 */ GXColorS10 mBg3AddColAmb; - /* 0x11A8 */ u8 field_0x11a8[8]; - /* 0x11B0 */ GXColorS10 mFogAddCol; - /* 0x11B8 */ GXColorS10 mVrboxAddcolSky0; - /* 0x11C0 */ GXColorS10 mVrboxAddcolKasumi; - /* 0x11C8 */ f32 field_0x11c8; - /* 0x11CC */ f32 field_0x11cc; - /* 0x11D0 */ f32 field_0x11d0; - /* 0x11D4 */ f32 mDiceWeatherChangeTime; - /* 0x11D8 */ f32 mDiceWeatherTime; - /* 0x11DC */ f32 mColPatBlend; + /* 0x1100 */ GXColorS10 actor_amb_col; + /* 0x1108 */ GXColorS10 bg_amb_col[4]; + /* 0x1128 */ GXColorS10 dungeonlight_col[6]; + /* 0x1158 */ GXColorS10 fog_col; + /* 0x1160 */ GXColorS10 actor_addcol_amb; + /* 0x1168 */ u8 unk_0x1168[8]; // probably unused GXColorS10 + /* 0x1170 */ GXColorS10 bg_addcol_amb; + /* 0x1178 */ u8 unk_0x1178[8]; // probably unused GXColorS10 + /* 0x1180 */ GXColorS10 bg1_addcol_amb; + /* 0x1188 */ u8 unk_0x1188[8]; // probably unused GXColorS10 + /* 0x1190 */ GXColorS10 bg2_addcol_amb; + /* 0x1198 */ u8 unk_0x1198[8]; // probably unused GXColorS10 + /* 0x11A0 */ GXColorS10 bg3_addcol_amb; + /* 0x11A8 */ u8 unk_0x11a8[8]; // probably unused GXColorS10 + /* 0x11B0 */ GXColorS10 addcol_fog; + /* 0x11B8 */ GXColorS10 vrbox_addcol_sky0; + /* 0x11C0 */ GXColorS10 vrbox_addcol_kasumi; + /* 0x11C8 */ f32 unk_0x11c8; // used as a ratio, but only ever set to 1.0 + /* 0x11CC */ f32 unk_0x11cc; // used as a ratio, but only ever set to 1.0 + /* 0x11D0 */ f32 unk_0x11d0; // used as a ratio, but only ever set to 1.0 + /* 0x11D4 */ f32 dice_wether_change_time; + /* 0x11D8 */ f32 dice_wether_time; + /* 0x11DC */ f32 pat_ratio; /* 0x11E0 */ f32 mColPatBlendGather; /* 0x11E4 */ f32 mFogNear; /* 0x11E8 */ f32 mFogFar; /* 0x11EC */ f32 field_0x11ec; /* 0x11F0 */ f32 field_0x11f0; /* 0x11F4 */ f32 field_0x11f4; - /* 0x11F8 */ f32 mColAllcolRatio; - /* 0x11FC */ f32 mColActColRatio; - /* 0x1200 */ f32 mColBgColRatio; - /* 0x1204 */ f32 mColFogColRatio; - /* 0x1208 */ f32 mColVrboxSoraColRatio; - /* 0x120C */ f32 mColVrboxKumocolRatio; + /* 0x11F8 */ f32 now_allcol_ratio; + /* 0x11FC */ f32 now_actcol_ratio; + /* 0x1200 */ f32 now_bgcol_ratio; + /* 0x1204 */ f32 now_fogcol_ratio; + /* 0x1208 */ f32 now_vrboxsoracol_ratio; + /* 0x120C */ f32 now_vrboxkumocol_ratio; /* 0x1210 */ f32 field_0x1210; - /* 0x1214 */ f32 mAllcolRatio; - /* 0x1218 */ f32 mActcolRatio; - /* 0x121C */ f32 mBgcolRatio; - /* 0x1220 */ f32 mFogcolRatio; - /* 0x1224 */ f32 mVrboxSoracolRatio; - /* 0x1228 */ f32 mVrboxKumocolRatio; + /* 0x1214 */ f32 allcol_ratio; + /* 0x1218 */ f32 actcol_ratio; + /* 0x121C */ f32 bgcol_ratio; + /* 0x1220 */ f32 fogcol_ratio; + /* 0x1224 */ f32 vrboxsoracol_ratio; + /* 0x1228 */ f32 vrboxkumocol_ratio; /* 0x122C */ f32 field_0x122c; /* 0x1230 */ f32 field_0x1230; /* 0x1234 */ f32 field_0x1234; /* 0x1238 */ f32 field_0x1238; /* 0x123C */ f32 field_0x123c; /* 0x1240 */ f32 field_0x1240; - /* 0x1244 */ f32 mDaytime; - /* 0x1248 */ f32 mNexttime; - /* 0x124C */ f32 mTimeSpeed; - /* 0x1250 */ f32 mDarkDaytime; + /* 0x1244 */ f32 daytime; + /* 0x1248 */ f32 nexttime; + /* 0x124C */ f32 time_change_rate; + /* 0x1250 */ f32 dark_daytime; /* 0x1254 */ f32 field_0x1254; /* 0x1258 */ f32 field_0x1258; - /* 0x125C */ f32 mPaletteTerrainLightEffect; - /* 0x1260 */ f32 mGrassLightEffectRate; + /* 0x125C */ f32 bg_light_influence; + /* 0x1260 */ f32 grass_light_inf_rate; /* 0x1264 */ f32 field_0x1264; /* 0x1268 */ f32 field_0x1268; /* 0x126C */ f32 field_0x126c; /* 0x1270 */ f32 mDemoAttentionPoint; - /* 0x1274 */ f32 mTime; // ? + /* 0x1274 */ f32 old_time; // saved time of day before entering twilight. time set back to this when leaving twilight /* 0x1278 */ f32 field_0x1278; /* 0x127C */ f32 field_0x127c; /* 0x1280 */ int field_0x1280; /* 0x1284 */ u8 field_0x1284[4]; - /* 0x1288 */ u32 mMoyaSE; - /* 0x128C */ u8 field_0x128c[12]; - /* 0x1298 */ int mDiceWeatherCounter; - /* 0x129C */ int mRainCountOrig; + /* 0x1288 */ u32 moya_se; + /* 0x128C */ u8 unk_0x128c[0x1298 - 0x128C]; + /* 0x1298 */ int dice_wether_counter; + /* 0x129C */ int base_raincnt; /* 0x12A0 */ int field_0x12a0; /* 0x12A4 */ int mPlayerPLightIdx; /* 0x12A8 */ int mPlayerEfLightIdx; - /* 0x12AC */ u8 field_0x12ac[4]; + /* 0x12AC */ u8 field_0x12ac[0x12B0 - 0x12AC]; /* 0x12B0 */ int field_0x12b0; - /* 0x12B4 */ int mSchbitTimer; - /* 0x12B8 */ u8 field_0x12b8[4]; + /* 0x12B4 */ int schbit_timer; + /* 0x12B8 */ u8 field_0x12b8[0x12BC - 0x12B8]; /* 0x12BC */ u16 mFogAdjCenter; /* 0x12BE */ u16 mDate; /* 0x12C0 */ s16 mActorLightEffect; - /* 0x12C2 */ u8 mColPatPrev; - /* 0x12C3 */ u8 mColPatCurr; + /* 0x12C2 */ u8 wether_pat0; + /* 0x12C3 */ u8 wether_pat1; /* 0x12C4 */ u8 mColpatPrevGather; /* 0x12C5 */ u8 mColpatCurrGather; - /* 0x12C6 */ u8 mEnvrIdxPrev; - /* 0x12C7 */ u8 mEnvrIdxCurr; + /* 0x12C6 */ u8 PrevCol; + /* 0x12C7 */ u8 UseCol; /* 0x12C8 */ u8 mColpatWeather; - /* 0x12C9 */ u8 mDiceWeatherMode; - /* 0x12CA */ u8 mDiceWeatherState; - /* 0x12CB */ u8 mDiceWeatherCurrPattern; + /* 0x12C9 */ u8 dice_wether_mode; + /* 0x12CA */ u8 dice_wether_state; + /* 0x12CB */ u8 dice_wether_pat; /* 0x12CC */ u8 field_0x12cc; /* 0x12CD */ u8 mColPatMode; /* 0x12CE */ u8 mColPatModeGather; /* 0x12CF */ u8 mFogAdjEnable; /* 0x12D0 */ u8 mFogAdjTableType; - /* 0x12D1 */ u8 mItemGetCol_chg; - /* 0x12D2 */ u8 mInitAnmTimer; - /* 0x12D3 */ u8 mSchBit; - /* 0x12D4 */ bool mVrboxInvisible; + /* 0x12D1 */ u8 Itemgetcol_chg; + /* 0x12D2 */ u8 light_init_timer; + /* 0x12D3 */ u8 schbit; + /* 0x12D4 */ bool hide_vrbox; /* 0x12D5 */ u8 mContrastFlag; /* 0x12D6 */ u8 field_0x12d6; - /* 0x12D7 */ u8 mShadowMode; - /* 0x12D8 */ u8 mCameraInWater; - /* 0x12DC */ dKy_pol_efftbl_struct* mResPolEfftbl; - /* 0x12E0 */ dKy_pol_effcol_struct* mResPolEffcol; - /* 0x12E4 */ dKy_pol_efftbl_struct* mResPolEfftbl2; - /* 0x12E8 */ dKy_pol_effcol_struct* mResPolEffcol2; - /* 0x12EC */ dKy_pol_sound_struct* mResPolSound; - /* 0x12F0 */ dKy_pol_arg_struct* mResPolArg; - /* 0x12F4 */ dKy_color_data_struct* mResColorDataTbl; + /* 0x12D7 */ u8 shadow_mode; + /* 0x12D8 */ u8 camera_water_in_status; + /* 0x12DC */ dKy_pol_efftbl_struct* pol_efftbl; + /* 0x12E0 */ dKy_pol_effcol_struct* pol_effcol; + /* 0x12E4 */ dKy_pol_efftbl_struct* pol_efftbl2; + /* 0x12E8 */ dKy_pol_effcol_struct* pol_effcol2; + /* 0x12EC */ dKy_pol_sound_struct* pol_sound; + /* 0x12F0 */ dKy_pol_arg_struct* pol_arg; + /* 0x12F4 */ dKy_color_data_struct* colordata_tbl; /* 0x12F8 */ u8 mFogDensity; /* 0x12F9 */ u8 field_0x12f9; - /* 0x12FA */ u8 mIsBlure; - /* 0x12FB */ u8 field_0x12fb; + /* 0x12FA */ u8 is_blure; + /* 0x12FB */ u8 using_time_control_tag; /* 0x12FC */ s8 field_0x12fc; - /* 0x12FD */ u8 mDarktimeWeek; - /* 0x12FE */ u8 mPondSeason; + /* 0x12FD */ u8 darktime_week; + /* 0x12FE */ u8 fishing_hole_season; /* 0x1300 */ s16 field_0x1300; /* 0x1302 */ s16 field_0x1302; /* 0x1304 */ f32 mWaterSurfaceShineRate; - /* 0x1308 */ u8 field_0x1308; - /* 0x1309 */ u8 field_0x1309; + /* 0x1308 */ u8 light_mask_type; + /* 0x1309 */ u8 light_size; /* 0x130A */ u8 field_0x130a; /* 0x130B */ u8 field_0x130b; - /* 0x130C */ u8 field_0x130c; + /* 0x130C */ u8 staffroll_next_timer; }; // Size: 0x1310 extern dScnKy_env_light_c g_env_light; @@ -551,65 +510,110 @@ enum dKy_dice_wether_state { DICE_STATE_NEXT_e, }; -u8 dKy_darkworld_stage_check(char const*, int); +void dKy_set_nexttime(f32 nexttime); +void dKy_itudemo_se(); +BOOL dKy_darkworld_spot_check(char const* stageName, int roomNo); +void dKy_darkworld_Area_set(char const* stageName, int roomNo); +void dKy_FiveSenses_fullthrottle_dark(); +BOOL dKy_daynight_check(); +void dKy_clear_game_init(); +void dKy_setLight_init(); +u8 dKy_pol_sound_get(const cBgS_PolyInfo* polyinfo_p); +void dKy_depth_dist_set(void* process_p); +void dKy_instant_rainchg(); +void dKy_instant_timechg(f32 time); +void dKy_set_vrboxsoracol_ratio(f32 ratio); +void dKy_set_vrboxkumocol_ratio(f32 ratio); +void dKy_actor_addcol_set(s16 r, s16 g, s16 b, f32 ratio); +void dKy_fog_startendz_set(f32 param_0, f32 param_1, f32 ratio); +void dKy_vrbox_addcol_set(s16 r, s16 g, s16 b, f32 ratio); +void dKy_GxFog_set(); +u8 dKy_pol_argument_get(const cBgS_PolyInfo* polyinfo_p); +void dKy_Sound_set(cXyz pos, int param_1, fpc_ProcID actor_id, int timer); +void dKy_bg_MAxx_proc(void* bg_model_p); +void dKy_change_colpat(u8 colpat); +int dKy_BossLight_set(cXyz* pos_p, GXColor* color_p, f32 ref_dist, u8 param_3); +void dKy_custom_colset(u8 prevGather, u8 curGather, f32 blend); +void dKy_setLight(); +cXyz dKy_plight_near_pos(); +int dKy_BossSpotLight_set(cXyz* pos_p, f32 angle_x, f32 angle_y, f32 cutoff, GXColor* color_p, + f32 ref_dist, u8 spot_type, u8 distattn_type); +void dKy_calc_color_set(GXColorS10* out_color_p, color_RGB_class* color_a_start_p, + color_RGB_class* color_b_start_p, color_RGB_class* color_a_end_p, + color_RGB_class* color_b_end_p, f32 color_ratio, f32 blend_ratio, + GXColorS10 add_col, f32 scale); +void dKy_twilight_camelight_set(); +u8 dKy_shadow_mode_check(u8 mode); +void dKy_shadow_mode_set(u8 mode); +void dKy_shadow_mode_reset(u8 mode); +void dKy_Itemgetcol_chg_on(); +void dKy_actor_addcol_amb_set(s16 r, s16 g, s16 b, f32 ratio); +void dKy_bg_addcol_amb_set(s16 r, s16 g, s16 b, f32 ratio); +int dKy_WolfEyeLight_set(cXyz* pos_p, f32 angle_x, f32 angle_y, f32 cutoff, GXColor* color_p, + f32 ref_dist, u8 spot_type, u8 distattn_type); +BOOL dKy_TeachWind_existence_chk(); +u8 dKy_darkworld_stage_check(char const* stageName, int roomNo); BOOL dKy_withwarp_capture_check(); bool dKy_darkworld_check(); void dKy_undwater_filter_draw(); BOOL dKy_camera_water_in_status_check(); -static int dKy_Outdoor_check(); -s32 dKy_getdaytime_hour(); -s32 dKy_getdaytime_minute(); -s32 dKy_get_dayofweek(); -s32 dKy_getDarktime_minute(); -s32 dKy_getDarktime_hour(); -static void dKy_Sound_init(); -void dKy_setLight_nowroom(char); -void dKy_setLight_nowroom_actor(dKy_tevstr_c*); +int dKy_Outdoor_check(); +int dKy_getdaytime_hour(); +int dKy_getdaytime_minute(); +int dKy_get_dayofweek(); +int dKy_getDarktime_minute(); +int dKy_getDarktime_hour(); +void dKy_Sound_init(); +void dKy_setLight_nowroom(char room_no); +void dKy_setLight_nowroom_actor(dKy_tevstr_c* tevstr_p); void dKy_setLight_again(); -void dKy_GxFog_tevstr_set(dKy_tevstr_c*); -void dKy_plight_set(LIGHT_INFLUENCE* param_0); -void dKy_plight_priority_set(LIGHT_INFLUENCE* param_0); -void dKy_efplight_set(LIGHT_INFLUENCE* param_0); -void dKy_efplight_cut(LIGHT_INFLUENCE* param_0); -void dKy_tevstr_init(dKy_tevstr_c* param_0, s8 param_1, u8 param_2); +void dKy_GxFog_tevstr_set(dKy_tevstr_c* tevstr_p); +void dKy_plight_set(LIGHT_INFLUENCE* light_inf_p); +void dKy_plight_priority_set(LIGHT_INFLUENCE* light_inf_p); +void dKy_efplight_set(LIGHT_INFLUENCE* light_inf_p); +void dKy_efplight_cut(LIGHT_INFLUENCE* light_inf_p); +void dKy_tevstr_init(dKy_tevstr_c* tevstr_p, s8 room_no, u8 floorCol); SND_INFLUENCE* dKy_Sound_get(); -void dKy_plight_cut(LIGHT_INFLUENCE* param_0); -void dKy_dalkmist_inf_set(DALKMIST_INFLUENCE*); -void dKy_dalkmist_inf_cut(DALKMIST_INFLUENCE*); +void dKy_plight_cut(LIGHT_INFLUENCE* light_inf_p); +void dKy_dalkmist_inf_set(DALKMIST_INFLUENCE* dalkmist_inf_p); +void dKy_dalkmist_inf_cut(DALKMIST_INFLUENCE* dalkmist_inf_p); int dKy_rain_check(); void dKy_set_allcol_ratio(f32 ratio); void dKy_set_actcol_ratio(f32 ratio); void dKy_set_bgcol_ratio(f32 ratio); void dKy_set_fogcol_ratio(f32 ratio); void dKy_set_vrboxcol_ratio(f32 ratio); -f32 dKy_get_parcent(f32 param_0, f32 param_1, f32 param_2); -void dKy_setLight_nowroom_grass(char param_0, f32 param_1); -void dKy_Global_amb_set(dKy_tevstr_c* i_tevstr); -u8 dKy_pol_eff_prim_get(cBgS_PolyInfo const* param_0, _GXColor* param_1); -void dKy_pol_eff_env_get(cBgS_PolyInfo const* param_0, _GXColor* param_1); -u8 dKy_pol_eff_alpha_get(cBgS_PolyInfo const* param_0); -f32 dKy_pol_eff_ratio_get(cBgS_PolyInfo const* param_0); -void dKy_pol_eff2_prim_get(cBgS_PolyInfo const* param_0, _GXColor* param_1); -void dKy_pol_eff2_env_get(cBgS_PolyInfo const* param_0, _GXColor* param_1); -u8 dKy_pol_eff2_alpha_get(cBgS_PolyInfo const* param_0); -f32 dKy_pol_eff2_ratio_get(cBgS_PolyInfo const* param_0); -u8 dKy_pol_efftype_get(cBgS_PolyInfo const* param_0); -u8 dKy_pol_efftype2_get(cBgS_PolyInfo const* param_0); -void dKy_ParticleColor_get_actor(cXyz* param_0, dKy_tevstr_c* param_1, _GXColor* param_2, - _GXColor* param_3, _GXColor* param_4, _GXColor* param_5, - f32 param_6); -void dKy_ParticleColor_get_bg(cXyz* param_0, dKy_tevstr_c* param_1, _GXColor* param_2, - _GXColor* param_3, _GXColor* param_4, _GXColor* param_5, - f32 param_6); -_GXColor dKy_light_influence_col(_GXColor* param_0, f32 param_1); -static void dKy_WaterIn_Light_set(); -void dKy_SordFlush_set(cXyz param_0, int param_1); +f32 dKy_get_parcent(f32 max, f32 min, f32 value); +void dKy_setLight_nowroom_grass(char room_no, f32 light_ratio); +void dKy_Global_amb_set(dKy_tevstr_c* tevstr_p); +u8 dKy_pol_eff_prim_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p); +u8 dKy_pol_eff_env_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p); +u8 dKy_pol_eff_alpha_get(const cBgS_PolyInfo* polyinfo_p); +f32 dKy_pol_eff_ratio_get(const cBgS_PolyInfo* polyinfo_p); +u8 dKy_pol_eff2_prim_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p); +u8 dKy_pol_eff2_env_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p); +u8 dKy_pol_eff2_alpha_get(const cBgS_PolyInfo* polyinfo_p); +f32 dKy_pol_eff2_ratio_get(const cBgS_PolyInfo* polyinfo_p); +u8 dKy_pol_efftype_get(const cBgS_PolyInfo* polyinfo_p); +u8 dKy_pol_efftype2_get(const cBgS_PolyInfo* polyinfo_p); +void dKy_ParticleColor_get_actor(cXyz* param_0, dKy_tevstr_c* tevstr_p, GXColor* param_2, + GXColor* param_3, GXColor* param_4, GXColor* param_5, f32 param_6); +void dKy_ParticleColor_get_bg(cXyz* param_0, dKy_tevstr_c* tevstr_p, GXColor* param_2, + GXColor* param_3, GXColor* param_4, GXColor* param_5, f32 param_6); +GXColor dKy_light_influence_col(GXColor* param_0, f32 param_1); +void dKy_WaterIn_Light_set(); +void dKy_SordFlush_set(cXyz light_pos, int light_type); void dKy_camera_water_in_status_set(u8 status); -void dKy_mock_light_every_set(LIGHT_INFLUENCE* param_0); -f32 dKy_move_room_ratio(dKy_tevstr_c* param_0, s8* param_1); +void dKy_mock_light_every_set(LIGHT_INFLUENCE* light_inf_p); +f32 dKy_move_room_ratio(dKy_tevstr_c* tevstr_p, s8* room_no_p); void dKy_bg1_addcol_amb_set(s16 r, s16 g, s16 b, f32 factor); void dKy_vrbox_addcol_sky0_set(s16 r, s16 g, s16 b, f32 factor); void dKy_vrbox_addcol_kasumi_set(s16 r, s16 g, s16 b, f32 factor); void dKy_addcol_fog_set(s16 r, s16 g, s16 b, f32 factor); +cXyz dKy_light_influence_pos(int light_id); +BOOL dKy_SunMoon_Light_Check(); +void dKy_bgparts_activelight_set(LIGHT_INFLUENCE* light_inf_p, int bgpart_id); +void dKy_bgparts_activelight_cut(int bgpart_id); +int dKy_Indoor_check(); #endif /* D_KANKYO_D_KANKYO_H */ diff --git a/include/d/d_kankyo_data.h b/include/d/d_kankyo_data.h index 47d94c53ea..748e13b3a2 100644 --- a/include/d/d_kankyo_data.h +++ b/include/d/d_kankyo_data.h @@ -11,12 +11,12 @@ struct color_RGB_class { // Invented name; Used as u8 `darkLv` in dKydata_darkworldInfo_c. enum dKyd_DARKLV { - FARON = 0, - ELDIN = 1, - LANAYRU = 2, - TEST = 5, // Only used with nonexistent test stages - UNCLEARABLE = 6, // Default. Palace of Twilight stages use this - ALWAYS_DARK = 8, // Unused. Forces Twilight + KY_DARKLV_FARON = 0, + KY_DARKLV_ELDIN = 1, + KY_DARKLV_LANAYRU = 2, + KY_DARKLV_TEST = 5, // Only used with nonexistent test stages + KY_DARKLV_UNCLEARABLE = 6, // Default. Palace of Twilight stages use this + KY_DARKLV_ALWAYS = 8, // Unused. Forces Twilight }; class dKydata_darkworldInfo_c { @@ -53,7 +53,7 @@ enum BloomType { }; #define BLOOMINFO_MAX 64 -class dkydata_bloomInfo_info_class { +class dKydata_BloomInfo_c { public: /* 0x0 */ u8 mType; /* 0x1 */ u8 mThreshold; @@ -76,10 +76,10 @@ void* dKyd_dmvrbox_getp(); dKyd_lightSchejule* dKyd_schejule_getp(); dKyd_lightSchejule* dKyd_schejule_boss_getp(); void dKyd_xfog_table_set(u8); -void* dKyd_maple_col_getp(); +color_RGB_class* dKyd_maple_col_getp(); dKydata_darkworldInfo_c* dKyd_darkworld_tbl_getp(); dKydata_lightsizeInfo_c* dKyd_light_size_tbl_getp(); dKydata_lightsizeInfo_c* dKyd_light_tw_size_tbl_getp(); -dkydata_bloomInfo_info_class* dKyd_BloomInf_tbl_getp(int); +dKydata_BloomInfo_c* dKyd_BloomInf_tbl_getp(int); #endif /* D_KANKYO_D_KANKYO_DATA_H */ diff --git a/include/d/d_kankyo_wether.h b/include/d/d_kankyo_wether.h index 30d35b37df..be03a14643 100644 --- a/include/d/d_kankyo_wether.h +++ b/include/d/d_kankyo_wether.h @@ -108,7 +108,7 @@ public: /* 0x0018 */ RAIN_EFF mRainEff[250]; /* 0x36C8 */ f32 field_0x36c8; /* 0x36CC */ f32 field_0x36cc; - /* 0x36D0 */ s16 mRainCount; + /* 0x36D0 */ s16 raincnt; /* 0x36D2 */ u8 field_0x36D2[6]; /* 0x36D8 */ cXyz mCamEyePos; /* 0x36E4 */ cXyz mCamCenterPos; diff --git a/include/d/d_stage.h b/include/d/d_stage.h index 93a30143db..0d5c81196f 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -10,12 +10,12 @@ class JKRExpHeap; struct stage_vrboxcol_info_class { - /* 0x00 */ color_RGB_class field_0x0; - /* 0x03 */ color_RGB_class field_0x3; - /* 0x06 */ color_RGB_class field_0x6; - /* 0x09 */ GXColor field_0x9; - /* 0x0D */ GXColor field_0xd; - /* 0x11 */ GXColor field_0x11; + /* 0x00 */ color_RGB_class sky_col; + /* 0x03 */ color_RGB_class kumo_top_col; + /* 0x06 */ color_RGB_class kumo_bottom_col; + /* 0x09 */ GXColor kumo_shadow_col; + /* 0x0D */ GXColor kasumi_outer_col; + /* 0x11 */ GXColor kasumi_inner_col; }; // Size: 0x18 // Virt @@ -90,48 +90,45 @@ struct stage_scls_info_dummy_class { struct stage_pure_lightvec_info_class { // LGT - /* 0x00 */ Vec m_position; - /* 0x0C */ f32 m_radius; - /* 0x10 */ f32 m_directionX; - /* 0x14 */ f32 m_directionY; - /* 0x18 */ f32 m_spotCutoff; - /* 0x1C */ u8 field_0x1c; - /* 0x1D */ u8 field_0x1d; - /* 0x1E */ u8 field_0x1e; - /* 0x1F */ u8 field_0x1f; + /* 0x00 */ Vec position; + /* 0x0C */ f32 radius; + /* 0x10 */ f32 directionX; + /* 0x14 */ f32 directionY; + /* 0x18 */ f32 spotCutoff; + /* 0x1C */ u8 spot_type; + /* 0x1D */ u8 dist_atten_type; + /* 0x1E */ u8 flags; + /* 0x1F */ u8 switch_no; }; // Size: 0x20 -// Col struct stage_pselect_info_class { - /* 0x0 */ u8 mPalIdx[8]; - /* 0x8 */ f32 mChangeRate; + /* 0x0 */ u8 palette_id[8]; + /* 0x8 */ f32 change_rate; }; // Size: 0xC struct stage_plight_info_class { - // LGHT - /* 0x00 */ Vec m_position; - /* 0x0C */ f32 m_radius; - /* 0x10 */ u8 field_0x10[0x18 - 0x10]; - /* 0x18 */ color_RGB_class m_color; - /* 0x1B */ u8 m_fluctuation; + /* 0x00 */ Vec position; + /* 0x0C */ f32 power; + /* 0x10 */ u8 unk_0x10[0x18 - 0x10]; + /* 0x18 */ color_RGB_class color; + /* 0x1B */ u8 fluctuation; }; // Size: 0x1C -// PALE struct stage_palette_info_class { - /* 0x00 */ color_RGB_class mActorAmbColor; - /* 0x03 */ color_RGB_class mBgAmbColor[4]; - /* 0x0F */ color_RGB_class mPlightColor[6]; - /* 0x21 */ color_RGB_class mFogColor; - /* 0x24 */ f32 mFogStartZ; - /* 0x28 */ f32 mFogEndZ; - /* 0x2C */ u8 mVirtIdx; - /* 0x2D */ u8 mTerrainLightInfluence; - /* 0x2E */ u8 mCloudShadowDensity; - /* 0x2F */ u8 field_0x2f; - /* 0x30 */ u8 mBloomTblIdx; - /* 0x31 */ u8 mBgAmbColor1A; - /* 0x32 */ u8 mBgAmbColor2A; - /* 0x33 */ u8 mBgAmbColor3A; + /* 0x00 */ color_RGB_class actor_amb_col; + /* 0x03 */ color_RGB_class bg_amb_col[4]; + /* 0x0F */ color_RGB_class plight_col[6]; + /* 0x21 */ color_RGB_class fog_col; + /* 0x24 */ f32 fog_start_z; + /* 0x28 */ f32 fog_end_z; + /* 0x2C */ u8 vrboxcol_id; + /* 0x2D */ u8 bg_light_influence; + /* 0x2E */ u8 cloud_shadow_density; + /* 0x2F */ u8 unk_0x2f; + /* 0x30 */ u8 bloom_tbl_id; + /* 0x31 */ u8 BG1_amb_alpha; + /* 0x32 */ u8 BG2_amb_alpha; + /* 0x33 */ u8 BG3_amb_alpha; }; // Size: 0x34 struct stage_map_info_class { @@ -146,7 +143,7 @@ struct stage_map_info_dummy_class { }; struct stage_envr_info_class { - /* 0x0 */ u8 m_pselectID[65]; + /* 0x0 */ u8 pselect_id[65]; }; // Size: 0x41 struct stage_camera2_data_class { @@ -1160,6 +1157,10 @@ inline u8 dStage_FileList_dt_GetDefaultCamera(dStage_FileList_dt_c* p_fList) { return p_fList->mDefaultCamera; } +inline u8 dStage_FileList_dt_GRASSLIGHT(dStage_FileList_dt_c* p_fList) { + return (p_fList->mParameters >> 7) & 0xFF; +} + inline f32 dStage_FileList2_dt_GetLeftRmX(dStage_FileList2_dt_c* p_fList2) { return p_fList2->mLeftRmX; } diff --git a/include/dolphin/dolphin.h b/include/dolphin/dolphin.h index 05d5c7f367..45beac4b57 100644 --- a/include/dolphin/dolphin.h +++ b/include/dolphin/dolphin.h @@ -6,6 +6,7 @@ #include #include #include +#include //#include #include #include diff --git a/include/dolphin/gf/GFPixel.h b/include/dolphin/gf/GFPixel.h index 7386c07ad5..bffbc6a7db 100644 --- a/include/dolphin/gf/GFPixel.h +++ b/include/dolphin/gf/GFPixel.h @@ -1,5 +1,9 @@ #ifndef GFPIXEL_H #define GFPIXEL_H +#include + +void GFSetFog(GXFogType param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4, + GXColor param_5); #endif /* GFPIXEL_H */ diff --git a/src/d/actor/d_a_alink.cpp b/src/d/actor/d_a_alink.cpp index a244aa314f..05707963b6 100644 --- a/src/d/actor/d_a_alink.cpp +++ b/src/d/actor/d_a_alink.cpp @@ -6248,7 +6248,7 @@ s32 daAlink_c::setRoomInfo() { roomID = dComIfG_Bgsp().GetRoomId(mLinkAcch.m_gnd); if (roomID != fopAcM_GetRoomNo(this)) { - tevStr.mRoomNo = roomID; + tevStr.room_no = roomID; mVoiceReverbIntensity = dComIfGp_getReverb(roomID); field_0x814.SetRoomId(roomID); fopAcM_SetRoomNo(this, roomID); @@ -6259,7 +6259,7 @@ s32 daAlink_c::setRoomInfo() { roomID = fopAcM_GetRoomNo(this); } - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mLinkAcch.m_gnd); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mLinkAcch.m_gnd); field_0x3174 = dComIfG_Bgsp().GetGroundCode(mLinkAcch.m_gnd); field_0x2fbb = dComIfG_Bgsp().GetPolyAtt0(mLinkAcch.m_gnd); mGndPolySpecialCode = dComIfG_Bgsp().GetSpecialCode(mLinkAcch.m_gnd); diff --git a/src/d/actor/d_a_alink_grab.inc b/src/d/actor/d_a_alink_grab.inc index 3b0e486e9c..e74f1ae9de 100644 --- a/src/d/actor/d_a_alink_grab.inc +++ b/src/d/actor/d_a_alink_grab.inc @@ -206,8 +206,8 @@ void daAlink_c::setGrabItemPos() { daPy_frameCtrl_c* sp1C = &mUnderFrameCtrl[0]; s8 sp8 = fopAcM_GetRoomNo(this); - temp_r3->tevStr.mRoomNo = sp8; - temp_r3->tevStr.mEnvrIdxOverride = tevStr.mEnvrIdxOverride; + temp_r3->tevStr.room_no = sp8; + temp_r3->tevStr.YukaCol = tevStr.YukaCol; fopAcM_SetRoomNo(temp_r3, sp8); BOOL sp18 = checkGrabCarryActor(); diff --git a/src/d/actor/d_a_alink_hook.inc b/src/d/actor/d_a_alink_hook.inc index 4fb82bb9b7..7e1600e9bf 100644 --- a/src/d/actor/d_a_alink_hook.inc +++ b/src/d/actor/d_a_alink_hook.inc @@ -33,10 +33,10 @@ void daAlink_c::hsChainShape_c::draw() { sp5C->getShape()->loadPreDrawSetting(); GXColor sp58; - sp58.r = temp_r29->mColorC0.r; - sp58.g = temp_r29->mColorC0.g; - sp58.b = temp_r29->mColorC0.b; - sp58.a = temp_r29->mColorC0.a; + sp58.r = temp_r29->AmbCol.r; + sp58.g = temp_r29->AmbCol.g; + sp58.b = temp_r29->AmbCol.b; + sp58.a = temp_r29->AmbCol.a; GXSetChanAmbColor(GX_COLOR0A0, sp58); GXSetChanMatColor(GX_COLOR0A0, g_whiteColor); diff --git a/src/d/actor/d_a_alink_link.inc b/src/d/actor/d_a_alink_link.inc index 5edba8c70a..bc5a17b03b 100644 --- a/src/d/actor/d_a_alink_link.inc +++ b/src/d/actor/d_a_alink_link.inc @@ -3910,12 +3910,12 @@ void daAlink_c::setWaterDropColor(const J3DGXColorS10* i_color) { /* 800CC7DC-800CC7FC 0C711C 0020+00 2/2 0/0 0/0 .text initTevCustomColor__9daAlink_cFv */ void daAlink_c::initTevCustomColor() { - tevStr.field_0x367 = 0; - tevStr.mFogColor.r = 0; - tevStr.mFogColor.g = 0; - tevStr.mFogColor.b = 0; - tevStr.field_0x360 = 0; - tevStr.field_0x362 = 0; + tevStr.mLightInf.a = 0; + tevStr.TevColor.r = 0; + tevStr.TevColor.g = 0; + tevStr.TevColor.b = 0; + tevStr.TevKColor.r = 0; + tevStr.TevKColor.b = 0; } /* 800CC7FC-800CD78C 0C713C 0F90+00 1/1 0/0 0/0 .text draw__9daAlink_cFv */ @@ -3946,13 +3946,13 @@ int daAlink_c::draw() { if (mClothesChangeWaitTimer != 0) { if (mProcID == PROC_METAMORPHOSE) { if (mProcVar3.field_0x300e > 0) { - tevStr.mFogColor.r = 255; + tevStr.TevColor.r = 255; } else { - tevStr.mFogColor.r = -255; + tevStr.TevColor.r = -255; } - tevStr.mFogColor.g = tevStr.mFogColor.r; - tevStr.mFogColor.b = tevStr.mFogColor.r; + tevStr.TevColor.g = tevStr.TevColor.r; + tevStr.TevColor.b = tevStr.TevColor.r; g_env_light.setLightTevColorType_MAJI(mpWlChangeModel, &tevStr); mDoExt_modelEntryDL(mpWlChangeModel); @@ -3965,22 +3965,22 @@ int daAlink_c::draw() { BOOL var_r31 = 1; if (field_0x06f4 != NULL) { - field_0x06f4->getTevColorReg(0, &tevStr.mFogColor); + field_0x06f4->getTevColorReg(0, &tevStr.TevColor); } else if (mProcID == PROC_METAMORPHOSE || mProcID == PROC_DUNGEON_WARP || mProcID == PROC_DUNGEON_WARP_SCN_START) { - tevStr.mFogColor.r = mProcVar3.field_0x300e; - tevStr.mFogColor.g = mProcVar3.field_0x300e; - tevStr.mFogColor.b = mProcVar3.field_0x300e; + tevStr.TevColor.r = mProcVar3.field_0x300e; + tevStr.TevColor.g = mProcVar3.field_0x300e; + tevStr.TevColor.b = mProcVar3.field_0x300e; } else if (field_0x346c != 0.0f) { f32 var_f2 = fabsf(field_0x346c); - tevStr.mFogColor.r = var_f2 * daAlinkHIO_wolf_c0::m.mLightDropR; - tevStr.mFogColor.g = var_f2 * daAlinkHIO_wolf_c0::m.mLightDropG; - tevStr.mFogColor.b = var_f2 * daAlinkHIO_wolf_c0::m.mLightDropB; + tevStr.TevColor.r = var_f2 * daAlinkHIO_wolf_c0::m.mLightDropR; + tevStr.TevColor.g = var_f2 * daAlinkHIO_wolf_c0::m.mLightDropG; + tevStr.TevColor.b = var_f2 * daAlinkHIO_wolf_c0::m.mLightDropB; } else if (checkFreezeDamage()) { - tevStr.mFogColor.r = daAlinkHIO_damage_c0::m.mFreezeR; - tevStr.mFogColor.g = daAlinkHIO_damage_c0::m.mFreezeG; - tevStr.mFogColor.b = daAlinkHIO_damage_c0::m.mFreezeB; + tevStr.TevColor.r = daAlinkHIO_damage_c0::m.mFreezeR; + tevStr.TevColor.g = daAlinkHIO_damage_c0::m.mFreezeG; + tevStr.TevColor.b = daAlinkHIO_damage_c0::m.mFreezeB; } else if (mDamageTimer != 0) { if (!checkMagicArmorNoDamage()) { int color_timer = mDamageTimer + mDamageColorTime; @@ -4001,25 +4001,25 @@ int daAlink_c::draw() { } f32 var_f2 = fabsf(cM_ssin(color_timer * 0x800)); - tevStr.field_0x360 = r * var_f2; - tevStr.field_0x361 = g * var_f2; - tevStr.field_0x362 = b * var_f2; + tevStr.TevKColor.r = r * var_f2; + tevStr.TevKColor.g = g * var_f2; + tevStr.TevKColor.b = b * var_f2; var_r31 = 0; } } else if (mIceDamageWaitTimer != 0) { f32 temp_f4 = 1.0f - (mIceDamageWaitTimer * (1.0f / daAlinkHIO_damage_c0::m.mFreezeTime)); f32 temp_f3 = 1.0f - temp_f4; - tevStr.mFogColor.r = (temp_f4 * daAlinkHIO_damage_c0::m.mFreezeInitR) + + tevStr.TevColor.r = (temp_f4 * daAlinkHIO_damage_c0::m.mFreezeInitR) + (temp_f3 * daAlinkHIO_damage_c0::m.mFreezeR); - tevStr.mFogColor.g = (temp_f4 * daAlinkHIO_damage_c0::m.mFreezeInitG) + + tevStr.TevColor.g = (temp_f4 * daAlinkHIO_damage_c0::m.mFreezeInitG) + (temp_f3 * daAlinkHIO_damage_c0::m.mFreezeG); - tevStr.mFogColor.b = (temp_f4 * daAlinkHIO_damage_c0::m.mFreezeInitB) + + tevStr.TevColor.b = (temp_f4 * daAlinkHIO_damage_c0::m.mFreezeInitB) + (temp_f3 * daAlinkHIO_damage_c0::m.mFreezeB); } else if (field_0x32b0[0].r != 0) { - tevStr.mFogColor.r = field_0x32b0[0].r; - tevStr.mFogColor.g = field_0x32b0[0].g; - tevStr.mFogColor.b = field_0x32b0[0].b; + tevStr.TevColor.r = field_0x32b0[0].r; + tevStr.TevColor.g = field_0x32b0[0].g; + tevStr.TevColor.b = field_0x32b0[0].b; var_r29 = 1; } else { var_r31 = 0; @@ -4036,7 +4036,7 @@ int daAlink_c::draw() { setWaterDropColor(&field_0x32b0[1]); } else { mSwordUpColorIntensity = 0.0f; - setWaterDropColor((J3DGXColorS10*)&tevStr.mFogColor); + setWaterDropColor((J3DGXColorS10*)&tevStr.TevColor); } } else { if (checkMagicArmorWearAbility()) { @@ -4060,9 +4060,9 @@ int daAlink_c::draw() { } } - tevStr.field_0x360 = 0; - tevStr.field_0x361 = 0; - tevStr.field_0x362 = 0; + tevStr.TevKColor.r = 0; + tevStr.TevKColor.g = 0; + tevStr.TevKColor.b = 0; if (checkSwordDraw()) { modelDraw(mSwordModel, temp_r30); @@ -4147,9 +4147,9 @@ int daAlink_c::draw() { modelDraw(mpLinkFaceModel, var_r3); } - tevStr.field_0x360 = 0; - tevStr.field_0x361 = 0; - tevStr.field_0x362 = 0; + tevStr.TevKColor.r = 0; + tevStr.TevKColor.g = 0; + tevStr.TevKColor.b = 0; if (checkSwordDraw()) { if (!checkNoResetFlg3(FLG3_UNK_80000000)) { @@ -4164,9 +4164,9 @@ int daAlink_c::draw() { if (checkShieldDraw()) { BOOL var_r24_2; if (checkWoodShieldEquip() && field_0x2fcb != 0 && mProcID != PROC_METAMORPHOSE) { - tevStr.mFogColor.r = -((120 - field_0x2fcb) * 32) / 120; - tevStr.mFogColor.g = tevStr.mFogColor.r; - tevStr.mFogColor.b = tevStr.mFogColor.r; + tevStr.TevColor.r = -((120 - field_0x2fcb) * 32) / 120; + tevStr.TevColor.g = tevStr.TevColor.r; + tevStr.TevColor.b = tevStr.TevColor.r; var_r24_2 = 1; } else { var_r24_2 = 0; @@ -4174,16 +4174,16 @@ int daAlink_c::draw() { modelDraw(mShieldModel, var_r3); if (var_r24_2) { - tevStr.mFogColor.r = 0; - tevStr.mFogColor.g = 0; - tevStr.mFogColor.b = 0; + tevStr.TevColor.r = 0; + tevStr.TevColor.g = 0; + tevStr.TevColor.b = 0; } } if (var_r29) { - tevStr.mFogColor.r = 0; - tevStr.mFogColor.g = 0; - tevStr.mFogColor.b = 0; + tevStr.TevColor.r = 0; + tevStr.TevColor.g = 0; + tevStr.TevColor.b = 0; } if (checkItemDraw()) { @@ -4228,22 +4228,22 @@ int daAlink_c::draw() { } if (checkEquipHeavyBoots()) { - GXColorS10 color = tevStr.mFogColor; + GXColorS10 color = tevStr.TevColor; for (int i = 0; i < 2; i++) { JPABaseEmitter* emitter_p = dComIfGp_particle_getEmitter(field_0x3228[i][0]); if (emitter_p != NULL) { - tevStr.mFogColor.r = 5; - tevStr.mFogColor.g = tevStr.mFogColor.r; - tevStr.mFogColor.b = tevStr.mFogColor.r; + tevStr.TevColor.r = 5; + tevStr.TevColor.g = tevStr.TevColor.r; + tevStr.TevColor.b = tevStr.TevColor.r; } else { - tevStr.mFogColor = color; + tevStr.TevColor = color; } modelDraw(mpLinkBootModels[i], temp_r30); } - tevStr.mFogColor = color; + tevStr.TevColor = color; } } diff --git a/src/d/actor/d_a_arrow.cpp b/src/d/actor/d_a_arrow.cpp index baa96ef665..4401511f5f 100644 --- a/src/d/actor/d_a_arrow.cpp +++ b/src/d/actor/d_a_arrow.cpp @@ -356,12 +356,12 @@ void daArrow_c::setRoomInfo() { if (fopAcM_gc_c::gndCheck(¤t.pos)) { roomNo = fopAcM_gc_c::getRoomId(); - tevStr.mEnvrIdxOverride = fopAcM_gc_c::getPolyColor(); + tevStr.YukaCol = fopAcM_gc_c::getPolyColor(); } else { roomNo = dComIfGp_roomControl_getStayNo(); } - tevStr.mRoomNo = roomNo; + tevStr.room_no = roomNo; field_0x64c.SetRoomId(roomNo); fopAcM_SetRoomNo(this, roomNo); } @@ -519,9 +519,9 @@ int daArrow_c::procWait() { u32 param = fopAcM_GetParam(this); if (param == 1 || param == 2) { - tevStr.mFogColor.r = 0; - tevStr.mFogColor.g = 0; - tevStr.mFogColor.b = 0; + tevStr.TevColor.r = 0; + tevStr.TevColor.g = 0; + tevStr.TevColor.b = 0; daAlink_c* link = daAlink_getAlinkActorClass(); if (mArrowType == 1) { @@ -1162,9 +1162,9 @@ int daArrow_c::draw() { } if (field_0x943 != 0) { - tevStr.mFogColor.r = link->getFreezeR(); - tevStr.mFogColor.g = link->getFreezeG(); - tevStr.mFogColor.b = link->getFreezeB(); + tevStr.TevColor.r = link->getFreezeR(); + tevStr.TevColor.g = link->getFreezeG(); + tevStr.TevColor.b = link->getFreezeB(); } g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr); diff --git a/src/d/actor/d_a_b_bq.cpp b/src/d/actor/d_a_b_bq.cpp index c841506dc5..76147e2234 100644 --- a/src/d/actor/d_a_b_bq.cpp +++ b/src/d/actor/d_a_b_bq.cpp @@ -2515,8 +2515,8 @@ static int daB_BQ_Create(fopAc_ac_c* i_this) { } g_env_light.mColpatWeather = 6; - g_env_light.mColPatPrev = 6; - g_env_light.mColPatCurr = 6; + g_env_light.wether_pat0 = 6; + g_env_light.wether_pat1 = 6; fish_set(a_this); return cPhs_ERROR_e; } diff --git a/src/d/actor/d_a_b_yo.cpp b/src/d/actor/d_a_b_yo.cpp index bb0ebb2ada..f0a93f3919 100644 --- a/src/d/actor/d_a_b_yo.cpp +++ b/src/d/actor/d_a_b_yo.cpp @@ -3457,8 +3457,8 @@ cPhs__Step daB_YO_c::create() { mColorMode = 4; mColBlend = 1.0f; g_env_light.mColpatWeather = 2; - g_env_light.mColPatPrev = 2; - g_env_light.mColPatCurr = 2; + g_env_light.wether_pat0 = 2; + g_env_light.wether_pat1 = 2; fopAcM_OffStatus(this, 0x4000); } else { diff --git a/src/d/actor/d_a_b_zant.cpp b/src/d/actor/d_a_b_zant.cpp index 47a7afc816..6fdbae0cf7 100644 --- a/src/d/actor/d_a_b_zant.cpp +++ b/src/d/actor/d_a_b_zant.cpp @@ -4782,7 +4782,7 @@ void daB_ZANT_c::initNextRoom() { } } - tevStr.mRoomNo = warp_next_room[mFightPhase]; + tevStr.room_no = warp_next_room[mFightPhase]; } /* 8064B868-8064C1C0 00D848 0958+00 2/1 0/0 0/0 .text executeRoomChange__10daB_ZANT_cFv diff --git a/src/d/actor/d_a_bg.cpp b/src/d/actor/d_a_bg.cpp index 695af44f5e..5ca934a491 100644 --- a/src/d/actor/d_a_bg.cpp +++ b/src/d/actor/d_a_bg.cpp @@ -641,7 +641,7 @@ int daBg_c::draw() { const char* name = modelData->getMaterialName()->getName(j); if (!memcmp(&name[3], "MA12", 4)) { - if (g_env_light.mColPatCurr == 6) { + if (g_env_light.wether_pat1 == 6) { field_0x5f0 = 0; } } else if (!memcmp(&name[3], "MA18", 4)) { @@ -661,7 +661,7 @@ int daBg_c::draw() { } else if (!memcmp(&name[3], "MA09", 4)) { bgData->mBtkAnmSpeed = 1.0f - (1.0f - g_env_light.mWaterSurfaceShineRate) * 0.9f; } else if (!memcmp(&name[3], "MA05", 4)) { - bgData->mpTevStr->field_0x378 |= (u8)j; + bgData->mpTevStr->Material_id |= (u8)j; } if (!strcmp(dComIfGp_getStartStageName(), "F_SP127") || @@ -675,7 +675,7 @@ int daBg_c::draw() { s16 var_r0; s16 var_r3; s16 var_r5; - switch (g_env_light.mPondSeason) { + switch (g_env_light.fishing_hole_season) { case 2: var_r5 = -3; var_r0 = 0; @@ -698,21 +698,21 @@ int daBg_c::draw() { break; } - f32 temp_f2 = bgData->mpTevStr->mColorC0.r / 10.0f; + f32 temp_f2 = bgData->mpTevStr->AmbCol.r / 10.0f; f32 var_f2 = temp_f2 * temp_f2; if (var_f2 > 1.0f) { var_f2 = 1.0f; } colorS10.r = var_r5 * var_f2; - f32 temp_f2_2 = bgData->mpTevStr->mColorC0.g / 10.0f; + f32 temp_f2_2 = bgData->mpTevStr->AmbCol.g / 10.0f; f32 var_f2_2 = temp_f2_2 * temp_f2_2; if (var_f2_2 > 1.0f) { var_f2_2 = 1.0f; } colorS10.g = var_r0 * var_f2_2; - f32 temp_f2_3 = bgData->mpTevStr->mColorC0.b / 10.0f; + f32 temp_f2_3 = bgData->mpTevStr->AmbCol.b / 10.0f; f32 var_f2_3 = temp_f2_3 * temp_f2_3; if (var_f2_3 > 1.0f) { var_f2_3 = 1.0f; @@ -900,4 +900,4 @@ extern "C" void calc__11J3DTexNoAnmCFPUs() { // NONMATCHING } -/* 804593A8-804593A8 000034 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ \ No newline at end of file +/* 804593A8-804593A8 000034 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ diff --git a/src/d/actor/d_a_boomerang.cpp b/src/d/actor/d_a_boomerang.cpp index 57ca99d939..a360598b62 100644 --- a/src/d/actor/d_a_boomerang.cpp +++ b/src/d/actor/d_a_boomerang.cpp @@ -1021,11 +1021,11 @@ void daBoomerang_c::setRoomInfo() { int roomNo; if (field_0x980 != -1000000000.0f) { roomNo = dComIfG_Bgsp().GetRoomId(field_0xd6c); - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(field_0xd6c); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(field_0xd6c); } else { roomNo = dComIfGp_roomControl_getStayNo(); } - tevStr.mRoomNo = roomNo; + tevStr.room_no = roomNo; field_0x953 = dComIfGp_getReverb(roomNo); field_0x9d0.SetRoomId(roomNo); fopAcM_SetRoomNo(this, roomNo); diff --git a/src/d/actor/d_a_door_dbdoor00.cpp b/src/d/actor/d_a_door_dbdoor00.cpp index 3af2db98f7..c9a4939add 100644 --- a/src/d/actor/d_a_door_dbdoor00.cpp +++ b/src/d/actor/d_a_door_dbdoor00.cpp @@ -165,7 +165,7 @@ int daDbDoor00_c::CreateInit() { u8 fRoomNo = door_param2_c::getFRoomNo(this); if (fopAcM_GetRoomNo(this) == -1) { fopAcM_SetRoomNo(this, fRoomNo); - tevStr.mRoomNo = current.roomNo; + tevStr.room_no = current.roomNo; } dComIfG_Bgsp().Regist(mpBgW, this); field_0x584 = 1; diff --git a/src/d/actor/d_a_door_knob00.cpp b/src/d/actor/d_a_door_knob00.cpp index 8b62427b0f..23ee222b5d 100644 --- a/src/d/actor/d_a_door_knob00.cpp +++ b/src/d/actor/d_a_door_knob00.cpp @@ -153,7 +153,7 @@ void daKnob20_c::calcMtx() { int daKnob20_c::CreateInit() { int rt = dComIfG_Bgsp().Regist(field_0x5a0, this); JUT_ASSERT(299, rt == 0); - tevStr.mRoomNo = current.roomNo; + tevStr.room_no = current.roomNo; setAction(ACTION_INIT); attention_info.position.y += 150.0f; eyePos.y += 150.0f; @@ -165,7 +165,7 @@ int daKnob20_c::CreateInit() { field_0x5a0->Move(); eventInfo.setArchiveName(getEvArcName()); setEventId(); - tevStr.mLightInf = knob_param_c::getDoorLightInf(this); + tevStr.mLightInf.r = knob_param_c::getDoorLightInf(this); return 1; } diff --git a/src/d/actor/d_a_door_mbossL1.cpp b/src/d/actor/d_a_door_mbossL1.cpp index d6e494042c..ab7cf52675 100644 --- a/src/d/actor/d_a_door_mbossL1.cpp +++ b/src/d/actor/d_a_door_mbossL1.cpp @@ -530,7 +530,7 @@ int daMBdoorL1_c::CreateInit() { } else { lightInf = door_param2_c::getMBLightInf(this); } - tevStr.mLightInf = lightInf; + tevStr.mLightInf.r = lightInf; return 1; } diff --git a/src/d/actor/d_a_door_shutter.cpp b/src/d/actor/d_a_door_shutter.cpp index 7ada4c7a00..9e2795cf14 100644 --- a/src/d/actor/d_a_door_shutter.cpp +++ b/src/d/actor/d_a_door_shutter.cpp @@ -790,7 +790,7 @@ int daDoor20_c::CreateInit() { &field_0x8b8, fopAcM_GetSpeed_p(this), NULL, NULL); int rt = dComIfG_Bgsp().Regist(field_0x5c4, this); JUT_ASSERT(1512, !rt); - tevStr.mRoomNo = current.roomNo; + tevStr.room_no = current.roomNo; setAction(ACTION_INIT); attention_info.position.y += 150.0f; eyePos.y += 150.0f; @@ -1314,7 +1314,7 @@ int daDoor20_c::execute() { } else { lightInf = door_param2_c::getBLightInf(this); } - tevStr.mLightInf = lightInf; + tevStr.mLightInf.r = lightInf; if (strcmp(dComIfGp_getStartStageName(), "D_MN05") != 0 && strcmp(dComIfGp_getStartStageName(), "D_MN04") != 0) { field_0x6de.CrrPos(dComIfG_Bgsp()); } @@ -1541,19 +1541,19 @@ int daDoor20_c::drawCheck(int param_1) { door_param2_c::getBackOption(this); int stayNo = dComIfGp_roomControl_getStayNo(); if (fRoomNo == stayNo || bRoomNo == stayNo) { - tevStr.mRoomNo = stayNo; + tevStr.room_no = stayNo; } else { if (dComIfGp_roomControl_checkRoomDisp(fRoomNo)) { - tevStr.mRoomNo = fRoomNo; + tevStr.room_no = fRoomNo; } else if (dComIfGp_roomControl_checkRoomDisp(bRoomNo)) { - tevStr.mRoomNo = bRoomNo; + tevStr.room_no = bRoomNo; } } if (field_0x678 != -1) { - tevStr.mRoomNo = field_0x674; + tevStr.room_no = field_0x674; } - fopAcM_SetRoomNo(this, tevStr.mRoomNo); - if (!dComIfGp_roomControl_checkRoomDisp(tevStr.mRoomNo)) { + fopAcM_SetRoomNo(this, tevStr.room_no); + if (!dComIfGp_roomControl_checkRoomDisp(tevStr.room_no)) { return 1; } else { return 1; diff --git a/src/d/actor/d_a_e_vt.cpp b/src/d/actor/d_a_e_vt.cpp index 1231398edb..fba56f4167 100644 --- a/src/d/actor/d_a_e_vt.cpp +++ b/src/d/actor/d_a_e_vt.cpp @@ -3969,8 +3969,8 @@ int daE_VA_c::create() { if (mSwNo != 0xFF && dComIfGs_isSwitch(mSwNo, fopAcM_GetRoomNo(this))) { g_env_light.mColpatWeather = 4; - g_env_light.mColPatPrev = 4; - g_env_light.mColPatCurr = 4; + g_env_light.wether_pat0 = 4; + g_env_light.wether_pat1 = 4; return cPhs_ERROR_e; } @@ -4028,8 +4028,8 @@ int daE_VA_c::create() { attention_info.distances[fopAc_attn_BATTLE_e] = 62; g_env_light.mColpatWeather = 2; - g_env_light.mColPatPrev = 2; - g_env_light.mColPatCurr = 2; + g_env_light.wether_pat0 = 2; + g_env_light.wether_pat1 = 2; if (daPy_getPlayerActorClass()->current.pos.z >= 1850.0f) { cDmr_SkipInfo = 0; @@ -4046,14 +4046,14 @@ int daE_VA_c::create() { mKankyoColType = 0; g_env_light.mColpatWeather = 2; - g_env_light.mColPatPrev = 2; - g_env_light.mColPatCurr = 2; + g_env_light.wether_pat0 = 2; + g_env_light.wether_pat1 = 2; } else { mAction = ACTION_DEMO_OP_WAIT_e; mKankyoColType = 5; g_env_light.mColpatWeather = 3; - g_env_light.mColPatPrev = 3; - g_env_light.mColPatCurr = 3; + g_env_light.wether_pat0 = 3; + g_env_light.wether_pat1 = 3; } daE_VA_Execute(this); diff --git a/src/d/actor/d_a_kytag00.cpp b/src/d/actor/d_a_kytag00.cpp index b5112bd847..8821d73fc1 100644 --- a/src/d/actor/d_a_kytag00.cpp +++ b/src/d/actor/d_a_kytag00.cpp @@ -87,7 +87,7 @@ static void wether_tag_move(kytag00_class* i_this) { } var_f9 *= (var_f8 * i_this->field_0x588); - if (g_env_light.mEnvrIdxPrev == g_env_light.mEnvrIdxCurr) { + if (g_env_light.PrevCol == g_env_light.UseCol) { i_this->field_0x56d = 1; switch (i_this->field_0x56f) { @@ -140,14 +140,14 @@ static void wether_tag_move(kytag00_class* i_this) { /* 8046BD60-8046BDA4 0006C0 0044+00 1/1 0/0 0/0 .text raincnt_set__Ff */ static void raincnt_set(f32 param_0) { int cnt = param_0 * param_0 * param_0 * 250.0f; - if (cnt > g_env_light.mRainCountOrig) { - g_env_light.mRainCount = cnt; + if (cnt > g_env_light.base_raincnt) { + g_env_light.raincnt = cnt; } } /* 8046BDA4-8046BDB8 000704 0014+00 1/1 0/0 0/0 .text raincnt_cut__Fv */ static void raincnt_cut() { - g_env_light.mRainCount = g_env_light.mRainCountOrig; + g_env_light.raincnt = g_env_light.base_raincnt; } /* 8046BDB8-8046BEB8 000718 0100+00 3/2 0/0 0/0 .text wether_tag_efect_reset__FP13kytag00_class */ @@ -332,7 +332,7 @@ static void wether_tag_efect_move(kytag00_class* i_this) { break; case 11: g_env_light.mMoyaMode = 50; - g_env_light.mMoyaCount = var_f9 * 50.0f * g_env_light.field_0xf40; + g_env_light.mMoyaCount = var_f9 * 50.0f * g_env_light.senses_effect_strength; break; case 12: g_env_light.mMoyaMode = 5; diff --git a/src/d/actor/d_a_kytag01.cpp b/src/d/actor/d_a_kytag01.cpp index 610a9d45fd..a5daf5384a 100644 --- a/src/d/actor/d_a_kytag01.cpp +++ b/src/d/actor/d_a_kytag01.cpp @@ -183,10 +183,10 @@ static int daKytag01_Create(fopAc_ac_c* i_this) { if (a_this->mStartPoint == dComIfGs_getStartPoint() && i_this->home.roomNo == dComIfGp_roomControl_getStayNo()) { - a_this->field_0x59e = g_env_light.mColPatPrev; + a_this->field_0x59e = g_env_light.wether_pat0; g_env_light.mColpatWeather = a_this->field_0x59d; - g_env_light.mColPatPrev = a_this->field_0x59d; - g_env_light.mColPatCurr = g_env_light.mColPatPrev; + g_env_light.wether_pat0 = a_this->field_0x59d; + g_env_light.wether_pat1 = g_env_light.wether_pat0; } } else { a_this->mNamiSize = (int)((fopAcM_GetParam(i_this) >> 0x10) & 0xFF); diff --git a/src/d/actor/d_a_kytag02.cpp b/src/d/actor/d_a_kytag02.cpp index 67f21dd9ef..5ff019540b 100644 --- a/src/d/actor/d_a_kytag02.cpp +++ b/src/d/actor/d_a_kytag02.cpp @@ -22,7 +22,7 @@ static int daKytag02_Execute(kytag02_class* i_this) { dKyw_evt_wind_set(0, i_this->current.angle.y); if (i_this->field_0x578 != 99) { - env_light->mTeachWindExist = 1; + env_light->TeachWind_existence = 1; env_light->mMoyaMode = 4; env_light->mMoyaCount = 50; @@ -57,18 +57,18 @@ static int daKytag02_Execute(kytag02_class* i_this) { i_this->field_0x574--; } } else { - env_light->mTeachWindExist = 0xFF; + env_light->TeachWind_existence = 0xFF; env_light->custom_windpower = 0.3f; } } else { env_light = dKy_getEnvlight(); - env_light->mEvtWindSet = 0; + env_light->evt_wind_go = 0; if (i_this->field_0x578 != 99) { env_light->mMoyaCount = 0; } - env_light->mTeachWindExist = 0; + env_light->TeachWind_existence = 0; } if (i_this->field_0x578 != 99) { @@ -91,9 +91,9 @@ static int daKytag02_IsDelete(kytag02_class* i_this) { static int daKytag02_Delete(kytag02_class* i_this) { dScnKy_env_light_c* env_light = dKy_getEnvlight(); - env_light->mEvtWindSet = 0; + env_light->evt_wind_go = 0; env_light->mMoyaCount = 0; - env_light->mTeachWindExist = 0; + env_light->TeachWind_existence = 0; return 1; } @@ -118,9 +118,9 @@ static int daKytag02_Create(fopAc_ac_c* i_this) { dKyw_evt_wind_set(0, a_this->current.angle.y); if (a_this->field_0x578 == 99) { - env_light->mTeachWindExist = 0xFF; + env_light->TeachWind_existence = 0xFF; } else { - env_light->mTeachWindExist = 1; + env_light->TeachWind_existence = 1; env_light->mMoyaMode = 4; env_light->mMoyaCount = 50; } diff --git a/src/d/actor/d_a_kytag03.cpp b/src/d/actor/d_a_kytag03.cpp index 7745fd957e..ff73bec026 100644 --- a/src/d/actor/d_a_kytag03.cpp +++ b/src/d/actor/d_a_kytag03.cpp @@ -365,7 +365,7 @@ static int daKytag03_Execute(kytag03_class* i_this) { i_this->mpEmitter->setGlobalEnvColor(0x44, 0x1A, 0x6B); } - i_this->mpEmitter->setGlobalAlpha(kankyo->field_0xf40 * 223.0f + 32.0f); + i_this->mpEmitter->setGlobalAlpha(kankyo->senses_effect_strength * 223.0f + 32.0f); } if (i_this->field_0x585 != dComIfGs_getCollectSmell()) { diff --git a/src/d/actor/d_a_kytag06.cpp b/src/d/actor/d_a_kytag06.cpp index 4c4552ac9c..f8db5e7501 100644 --- a/src/d/actor/d_a_kytag06.cpp +++ b/src/d/actor/d_a_kytag06.cpp @@ -13,32 +13,32 @@ static void dice_wether_init(u8 i_weatherMode, f32 i_weatherTime, f32 i_currentTime) { dScnKy_env_light_c* env_light = dKy_getEnvlight(); - env_light->mDiceWeatherMode = i_weatherMode; - env_light->mDiceWeatherTime = + env_light->dice_wether_mode = i_weatherMode; + env_light->dice_wether_time = i_currentTime + i_weatherTime + cM_rndF(i_weatherTime) + cM_rndF(i_weatherTime); - if (env_light->mDiceWeatherTime >= 360.0f) { - env_light->mDiceWeatherTime -= 360.0f; + if (env_light->dice_wether_time >= 360.0f) { + env_light->dice_wether_time -= 360.0f; } } /* 80857918-808579EC 000198 00D4+00 1/1 0/0 0/0 .text dice_wether_execute__FUcff */ static void dice_wether_execute(u8 i_weatherMode, f32 i_weatherTime, f32 i_currentTime) { dScnKy_env_light_c* env_light = dKy_getEnvlight(); - env_light->mDiceWeatherMode = i_weatherMode; + env_light->dice_wether_mode = i_weatherMode; - if (env_light->mDiceWeatherMode != DICE_MODE_DONE_e) { - env_light->mDiceWeatherTime = + if (env_light->dice_wether_mode != DICE_MODE_DONE_e) { + env_light->dice_wether_time = i_currentTime + i_weatherTime + cM_rndF(i_weatherTime) + cM_rndF(i_weatherTime); - if (env_light->mDiceWeatherTime >= 360.0f) { - env_light->mDiceWeatherTime -= 360.0f; + if (env_light->dice_wether_time >= 360.0f) { + env_light->dice_wether_time -= 360.0f; } - env_light->mDiceWeatherCounter++; + env_light->dice_wether_counter++; } else { - env_light->mDiceWeatherMode = DICE_MODE_SUNNY_e; - env_light->mDiceWeatherState++; + env_light->dice_wether_mode = DICE_MODE_SUNNY_e; + env_light->dice_wether_state++; } } @@ -48,13 +48,13 @@ static void dice_rain_minus() { if ((g_Counter.mCounter0 & 3) == 0) { // run block every 4 frames - if (env_light->mRainCount > 40) { - env_light->mRainCount -= 3; - } else if (env_light->mRainCount != 0) { - env_light->mRainCount--; + if (env_light->raincnt > 40) { + env_light->raincnt -= 3; + } else if (env_light->raincnt != 0) { + env_light->raincnt--; } - dKyw_rain_set(env_light->mRainCount); + dKyw_rain_set(env_light->raincnt); } } @@ -99,86 +99,86 @@ static void dKy_event_proc() { dScnKy_env_light_c* env_light = dKy_getEnvlight(); - if (!g_env_light.mCameraInWater) { - if (g_env_light.mInitAnmTimer == 0) { + if (!g_env_light.camera_water_in_status) { + if (g_env_light.light_init_timer == 0) { f32 current_time = dComIfGs_getTime(); - switch (env_light->mDiceWeatherState) { + switch (env_light->dice_wether_state) { case DICE_STATE_RESET_e: - if (current_time > env_light->mDiceWeatherChangeTime && - current_time - env_light->mDiceWeatherChangeTime < 15.0f) + if (current_time > env_light->dice_wether_change_time && + current_time - env_light->dice_wether_change_time < 15.0f) { - env_light->mDiceWeatherState = DICE_STATE_INIT_e; + env_light->dice_wether_state = DICE_STATE_INIT_e; } break; case DICE_STATE_INIT_e: u8 table_no = cM_rndF(12.99f); if (table_no >= 8) { - env_light->mDiceWeatherState = DICE_STATE_NEXT_e; + env_light->dice_wether_state = DICE_STATE_NEXT_e; } else { - env_light->mDiceWeatherCurrPattern = S_wether_table[table_no]; - env_light->mDiceWeatherCounter = 0; + env_light->dice_wether_pat = S_wether_table[table_no]; + env_light->dice_wether_counter = 0; - switch (env_light->mDiceWeatherCurrPattern) { + switch (env_light->dice_wether_pat) { case 0: - dice_wether_init(S_wether_mode_pat01[env_light->mDiceWeatherCounter], - S_wether_time_pat01[env_light->mDiceWeatherCounter], + dice_wether_init(S_wether_mode_pat01[env_light->dice_wether_counter], + S_wether_time_pat01[env_light->dice_wether_counter], current_time); break; case 1: - dice_wether_init(S_wether_mode_pat02[env_light->mDiceWeatherCounter], - S_wether_time_pat02[env_light->mDiceWeatherCounter], + dice_wether_init(S_wether_mode_pat02[env_light->dice_wether_counter], + S_wether_time_pat02[env_light->dice_wether_counter], current_time); break; case 2: - dice_wether_init(S_wether_mode_pat03[env_light->mDiceWeatherCounter], - S_wether_time_pat03[env_light->mDiceWeatherCounter], + dice_wether_init(S_wether_mode_pat03[env_light->dice_wether_counter], + S_wether_time_pat03[env_light->dice_wether_counter], current_time); break; case 3: - dice_wether_init(S_wether_mode_pat04[env_light->mDiceWeatherCounter], - S_wether_time_pat04[env_light->mDiceWeatherCounter], + dice_wether_init(S_wether_mode_pat04[env_light->dice_wether_counter], + S_wether_time_pat04[env_light->dice_wether_counter], current_time); break; case 4: - dice_wether_init(S_wether_mode_pat05[env_light->mDiceWeatherCounter], - S_wether_time_pat05[env_light->mDiceWeatherCounter], + dice_wether_init(S_wether_mode_pat05[env_light->dice_wether_counter], + S_wether_time_pat05[env_light->dice_wether_counter], current_time); break; } - env_light->mDiceWeatherCounter++; - env_light->mDiceWeatherState++; + env_light->dice_wether_counter++; + env_light->dice_wether_state++; } break; case DICE_STATE_EXEC_e: - if (current_time > env_light->mDiceWeatherTime && - current_time - env_light->mDiceWeatherTime < 180.0f) + if (current_time > env_light->dice_wether_time && + current_time - env_light->dice_wether_time < 180.0f) { - switch (env_light->mDiceWeatherCurrPattern) { + switch (env_light->dice_wether_pat) { case 0: - dice_wether_execute(S_wether_mode_pat01[env_light->mDiceWeatherCounter], - S_wether_time_pat01[env_light->mDiceWeatherCounter], + dice_wether_execute(S_wether_mode_pat01[env_light->dice_wether_counter], + S_wether_time_pat01[env_light->dice_wether_counter], current_time); break; case 1: - dice_wether_execute(S_wether_mode_pat02[env_light->mDiceWeatherCounter], - S_wether_time_pat02[env_light->mDiceWeatherCounter], + dice_wether_execute(S_wether_mode_pat02[env_light->dice_wether_counter], + S_wether_time_pat02[env_light->dice_wether_counter], current_time); break; case 2: - dice_wether_execute(S_wether_mode_pat03[env_light->mDiceWeatherCounter], - S_wether_time_pat03[env_light->mDiceWeatherCounter], + dice_wether_execute(S_wether_mode_pat03[env_light->dice_wether_counter], + S_wether_time_pat03[env_light->dice_wether_counter], current_time); break; case 3: - dice_wether_execute(S_wether_mode_pat04[env_light->mDiceWeatherCounter], - S_wether_time_pat04[env_light->mDiceWeatherCounter], + dice_wether_execute(S_wether_mode_pat04[env_light->dice_wether_counter], + S_wether_time_pat04[env_light->dice_wether_counter], current_time); break; case 4: - dice_wether_execute(S_wether_mode_pat05[env_light->mDiceWeatherCounter], - S_wether_time_pat05[env_light->mDiceWeatherCounter], + dice_wether_execute(S_wether_mode_pat05[env_light->dice_wether_counter], + S_wether_time_pat05[env_light->dice_wether_counter], current_time); break; } @@ -186,24 +186,24 @@ static void dKy_event_proc() { break; case DICE_STATE_NEXT_e: u8 time_table_no = cM_rndF(7.99f); - env_light->mDiceWeatherChangeTime = current_time + S_time_table[time_table_no]; + env_light->dice_wether_change_time = current_time + S_time_table[time_table_no]; - if (env_light->mDiceWeatherChangeTime >= 360.0f) { - env_light->mDiceWeatherChangeTime -= 360.0f; + if (env_light->dice_wether_change_time >= 360.0f) { + env_light->dice_wether_change_time -= 360.0f; } - env_light->mDiceWeatherState = DICE_STATE_RESET_e; + env_light->dice_wether_state = DICE_STATE_RESET_e; break; } if (g_env_light.field_0x130b == 1) { - env_light->mDiceWeatherMode = DICE_MODE_UNK6_e; + env_light->dice_wether_mode = DICE_MODE_UNK6_e; } if (g_env_light.mColPatMode == 0 && g_env_light.mColPatModeGather == 0) { u8 weather_colpat; - switch (env_light->mDiceWeatherMode) { + switch (env_light->dice_wether_mode) { case DICE_MODE_SUNNY_e: weather_colpat = 0; if (g_env_light.mThunderEff.mMode == 1) { @@ -219,21 +219,21 @@ static void dKy_event_proc() { break; case DICE_MODE_RAIN_LIGHT_e: weather_colpat = 1; - if (env_light->mRainCount < 40) { - env_light->mRainCount++; - dKyw_rain_set(env_light->mRainCount); + if (env_light->raincnt < 40) { + env_light->raincnt++; + dKyw_rain_set(env_light->raincnt); } else { - env_light->mRainCount--; - dKyw_rain_set(env_light->mRainCount); + env_light->raincnt--; + dKyw_rain_set(env_light->raincnt); } break; case DICE_MODE_THUNDER_HEAVY_e: g_env_light.mThunderEff.mMode = 1; case DICE_MODE_RAIN_HEAVY_e: weather_colpat = 2; - if (env_light->mRainCount < 250) { - env_light->mRainCount++; - dKyw_rain_set(env_light->mRainCount); + if (env_light->raincnt < 250) { + env_light->raincnt++; + dKyw_rain_set(env_light->raincnt); } break; case DICE_MODE_THUNDER_LIGHT_e: @@ -247,13 +247,13 @@ static void dKy_event_proc() { g_env_light.mThunderEff.mMode = 0; } - if (env_light->mRainCount > 2) { - env_light->mRainCount -= 2; + if (env_light->raincnt > 2) { + env_light->raincnt -= 2; } else { - env_light->mRainCount = 0; + env_light->raincnt = 0; } - dKyw_rain_set(env_light->mRainCount); + dKyw_rain_set(env_light->raincnt); } if (env_light->mColpatWeather != weather_colpat) { @@ -264,7 +264,7 @@ static void dKy_event_proc() { if (g_env_light.mColPatMode == 0 && g_env_light.mColPatModeGather == 0 && g_env_light.mColpatCurrGather != 0xFF && - g_env_light.mColPatCurr != g_env_light.mColpatCurrGather) + g_env_light.wether_pat1 != g_env_light.mColpatCurrGather) { g_env_light.mColPatBlendGather = 0.0f; } @@ -328,12 +328,12 @@ static void daKytag06_lv7_boss_wether_proc(kytag06_class* i_this, u8 param_1) { switch (param_1) { case 0: weather_colpat = 0; - if (env_light->mRainCount > 20) { - env_light->mRainCount -= 4; - } else if (env_light->mRainCount != 0) { - env_light->mRainCount--; + if (env_light->raincnt > 20) { + env_light->raincnt -= 4; + } else if (env_light->raincnt != 0) { + env_light->raincnt--; } - dKyw_rain_set(env_light->mRainCount); + dKyw_rain_set(env_light->raincnt); break; case 1: weather_colpat = 1; @@ -341,16 +341,16 @@ static void daKytag06_lv7_boss_wether_proc(kytag06_class* i_this, u8 param_1) { break; case 2: weather_colpat = 2; - if (env_light->mRainCount < 250) { - env_light->mRainCount++; - dKyw_rain_set(env_light->mRainCount); + if (env_light->raincnt < 250) { + env_light->raincnt++; + dKyw_rain_set(env_light->raincnt); } g_env_light.mThunderEff.mMode = 1; break; } - if (env_light->mColpatWeather != weather_colpat && !g_env_light.mCameraInWater) { + if (env_light->mColpatWeather != weather_colpat && !g_env_light.camera_water_in_status) { g_env_light.mColpatWeather = weather_colpat; dKy_change_colpat(weather_colpat); } @@ -458,12 +458,12 @@ static void daKytag06_wether_proc(kytag06_class* i_this, u8 param_1) { if ((g_Counter.mCounter0 & 3) == 0) { // run block every 4 frames - if (env_light->mRainCount < 40) { - env_light->mRainCount++; - dKyw_rain_set(env_light->mRainCount); + if (env_light->raincnt < 40) { + env_light->raincnt++; + dKyw_rain_set(env_light->raincnt); } else { - env_light->mRainCount--; - dKyw_rain_set(env_light->mRainCount); + env_light->raincnt--; + dKyw_rain_set(env_light->raincnt); } } @@ -474,9 +474,9 @@ static void daKytag06_wether_proc(kytag06_class* i_this, u8 param_1) { case 3: weather_colpat = 1; - if (env_light->mRainCount < 250) { - env_light->mRainCount++; - dKyw_rain_set(env_light->mRainCount); + if (env_light->raincnt < 250) { + env_light->raincnt++; + dKyw_rain_set(env_light->raincnt); } if (env_light->mSnowCount != 0) { @@ -487,9 +487,9 @@ static void daKytag06_wether_proc(kytag06_class* i_this, u8 param_1) { g_env_light.mThunderEff.mMode = 1; weather_colpat = 1; - if (env_light->mRainCount < 250) { - env_light->mRainCount++; - dKyw_rain_set(env_light->mRainCount); + if (env_light->raincnt < 250) { + env_light->raincnt++; + dKyw_rain_set(env_light->raincnt); } if (env_light->mSnowCount != 0) { @@ -527,7 +527,7 @@ static void daKytag06_wether_proc(kytag06_class* i_this, u8 param_1) { break; } - if (env_light->mColpatWeather != weather_colpat && !g_env_light.mCameraInWater) { + if (env_light->mColpatWeather != weather_colpat && !g_env_light.camera_water_in_status) { g_env_light.mColpatWeather = weather_colpat; dKy_change_colpat(weather_colpat); } @@ -608,13 +608,13 @@ static void daKytag06_type_07_Execute(kytag06_class* i_this) { if (camera != NULL) { if (camera->lookat.eye.y > 0.0f) { dKy_BossLight_set(&spX, &color, i_this->mWindPower * 2.0f, 0); - g_env_light.mTerrainAmbienceBG[3].r = (u8)(i_this->mWindPower * 230.0f + 25.0f); - g_env_light.mTerrainAmbienceBG[3].g = (u8)(i_this->mWindPower * 215.0f + 30.0f); - g_env_light.mTerrainAmbienceBG[3].b = (u8)(i_this->mWindPower * 155.0f + 25.0f); + g_env_light.bg_amb_col[3].r = (u8)(i_this->mWindPower * 230.0f + 25.0f); + g_env_light.bg_amb_col[3].g = (u8)(i_this->mWindPower * 215.0f + 30.0f); + g_env_light.bg_amb_col[3].b = (u8)(i_this->mWindPower * 155.0f + 25.0f); } else { - g_env_light.mTerrainAmbienceBG[3].r = 0; - g_env_light.mTerrainAmbienceBG[3].g = 0; - g_env_light.mTerrainAmbienceBG[3].b = 0; + g_env_light.bg_amb_col[3].r = 0; + g_env_light.bg_amb_col[3].g = 0; + g_env_light.bg_amb_col[3].b = 0; g_env_light.mThunderEff.mMode = 0; } } @@ -776,9 +776,9 @@ static void daKytag06_type_06_Execute(kytag06_class* i_this) { break; } - g_env_light.mTerrainAmbienceBG[3].r = (u8)(i_this->mWindPower * 245.0f + 10.0f); - g_env_light.mTerrainAmbienceBG[3].g = (u8)(i_this->mWindPower * 185.0f + 15.0f); - g_env_light.mTerrainAmbienceBG[3].b = (u8)(i_this->mWindPower * 130.0f + 20.0f); + g_env_light.bg_amb_col[3].r = (u8)(i_this->mWindPower * 245.0f + 10.0f); + g_env_light.bg_amb_col[3].g = (u8)(i_this->mWindPower * 185.0f + 15.0f); + g_env_light.bg_amb_col[3].b = (u8)(i_this->mWindPower * 130.0f + 20.0f); static cXyz c_pos(0.0f, 0.0f, 0.0f); @@ -967,8 +967,8 @@ static void daKytag06_type_03_Execute(kytag06_class* i_this) { case 2: if ((g_Counter.mCounter0 & 7) == 0) { // run block every 8 frames - if (g_env_light.mRainCount < 250) { - g_env_light.mRainCount++; + if (g_env_light.raincnt < 250) { + g_env_light.raincnt++; } else { i_this->mMode++; } @@ -1103,8 +1103,8 @@ static int daKytag06_Execute(kytag06_class* i_this) { break; case 2: if (i_this->field_0x578 > 900) { - if (g_env_light.mRainCount < 250) { - g_env_light.mRainCount++; + if (g_env_light.raincnt < 250) { + g_env_light.raincnt++; } else { i_this->field_0x591++; } @@ -1129,8 +1129,8 @@ static int daKytag06_Execute(kytag06_class* i_this) { if (i_this->field_0x578 > 0) { g_env_light.mThunderEff.mMode = 0; - if (g_env_light.mRainCount > 0) { - g_env_light.mRainCount--; + if (g_env_light.raincnt > 0) { + g_env_light.raincnt--; } else { i_this->field_0x591++; } @@ -1251,10 +1251,10 @@ static void daKytag06_type03_init(fopAc_ac_c* i_this) { if (dComIfGs_isSwitch(a_this->mSwNo, stayNo)) { a_this->mMode = 9; - g_env_light.mRainCount = 250; + g_env_light.raincnt = 250; g_env_light.mColpatWeather = a_this->field_0x591; - g_env_light.mColPatPrev = a_this->field_0x591; - g_env_light.mColPatCurr = a_this->field_0x591; + g_env_light.wether_pat0 = a_this->field_0x591; + g_env_light.wether_pat1 = a_this->field_0x591; } } } else if (a_this->field_0x597 == 2 && dComIfGp_roomControl_getStayNo() != 0) { @@ -1320,8 +1320,8 @@ static int daKytag06_Create(fopAc_ac_c* i_this) { default: if (strcmp(dComIfGp_getStartStageName(), "T_MUKAO") != 0) { g_env_light.mColpatWeather = 3; - g_env_light.mColPatPrev = 3; - g_env_light.mColPatCurr = 3; + g_env_light.wether_pat0 = 3; + g_env_light.wether_pat1 = 3; } else { dComIfGs_setTime(210.0f); } diff --git a/src/d/actor/d_a_kytag08.cpp b/src/d/actor/d_a_kytag08.cpp index 80fb97e4a1..3443f61b6a 100644 --- a/src/d/actor/d_a_kytag08.cpp +++ b/src/d/actor/d_a_kytag08.cpp @@ -267,7 +267,7 @@ static int daKytag08_Create(fopAc_ac_c* i_this) { a_this->mAvoidPos.y = 100.0f; a_this->mTargetAvoidPos = a_this->mAvoidPos; - env_light->field_0x1060 = a_this; + env_light->fog_avoid_tag = a_this; } return phase; diff --git a/src/d/actor/d_a_kytag11.cpp b/src/d/actor/d_a_kytag11.cpp index 80bde2223b..21f3c7e37c 100644 --- a/src/d/actor/d_a_kytag11.cpp +++ b/src/d/actor/d_a_kytag11.cpp @@ -48,17 +48,17 @@ static int daKytag11_Execute(kytag11_class* i_this) { if (!i_this->mInitTimeChange) { if (i_this->mNewTime != 0x1F) { - env_light->mDaytime = dComIfGs_getTime(); + env_light->daytime = dComIfGs_getTime(); f32 new_time = i_this->mNewTime * 15.0f; - env_light->mDaytime = new_time; + env_light->daytime = new_time; dComIfGs_setTime(new_time); } i_this->mInitTimeChange = true; } - env_light->field_0x12fb = 1; + env_light->using_time_control_tag = 1; if (i_this->mStopTime != 0x1F && i_this->mStopTime == (u8)dKy_getdaytime_hour()) { return 1; @@ -67,19 +67,19 @@ static int daKytag11_Execute(kytag11_class* i_this) { f32 new_env_time = ((i_this->mEnvTime / 255.0f) * 0.5f); f32 current_time = dComIfGs_getTime(); - env_light->mDaytime = current_time; + env_light->daytime = current_time; env_light->mDate = dComIfGs_getDate(); new_env_time = current_time + new_env_time; - env_light->mDaytime = new_env_time; + env_light->daytime = new_env_time; if ((u32)new_env_time >= 360.0f) { - env_light->mDaytime = 0.0f; + env_light->daytime = 0.0f; env_light->mDate++; dKankyo_DayProc(); } - dComIfGs_setTime(env_light->mDaytime); + dComIfGs_setTime(env_light->daytime); dComIfGs_setDate(env_light->mDate); return 1; diff --git a/src/d/actor/d_a_kytag12.cpp b/src/d/actor/d_a_kytag12.cpp index d47c9321f1..b92b24cd59 100644 --- a/src/d/actor/d_a_kytag12.cpp +++ b/src/d/actor/d_a_kytag12.cpp @@ -278,9 +278,9 @@ static int daKytag12_Execute_standard(kytag12_class* i_this) { } for (int j = 0; j < 10; j++) { - if (g_env_light.mDalkmistInf[j] != NULL && - g_env_light.mDalkmistInf[j]->mPos.abs(effect_p->mBasePos) < - g_env_light.mDalkmistInf[j]->field_0xc + 100.0f) + if (g_env_light.dalkmist_influence[j] != NULL && + g_env_light.dalkmist_influence[j]->mPos.abs(effect_p->mBasePos) < + g_env_light.dalkmist_influence[j]->field_0xc + 100.0f) { if (effect_p->mStatus != 2 && effect_p->field_0x40 == 0 && var_r23 < 1) { cXyz spF4; @@ -587,9 +587,9 @@ static int daKytag12_Execute_arrival(kytag12_class* i_this) { } for (int j = 0; j < 10; j++) { - if (g_env_light.mDalkmistInf[j] != NULL && - g_env_light.mDalkmistInf[j]->mPos.abs(effect_p->mBasePos) < - g_env_light.mDalkmistInf[j]->field_0xc + 100.0f) + if (g_env_light.dalkmist_influence[j] != NULL && + g_env_light.dalkmist_influence[j]->mPos.abs(effect_p->mBasePos) < + g_env_light.dalkmist_influence[j]->field_0xc + 100.0f) { if (effect_p->mStatus != 3 && effect_p->field_0x40 == 0 && var_r21 < 1) { sp80 = effect_p->mBasePos; @@ -892,9 +892,9 @@ static int daKytag12_Execute_R00(kytag12_class* i_this) { } for (int j = 0; j < 10; j++) { - if (g_env_light.mDalkmistInf[j] != NULL && - g_env_light.mDalkmistInf[j]->mPos.abs(effect_p->mBasePos) < - g_env_light.mDalkmistInf[j]->field_0xc + 100.0f) + if (g_env_light.dalkmist_influence[j] != NULL && + g_env_light.dalkmist_influence[j]->mPos.abs(effect_p->mBasePos) < + g_env_light.dalkmist_influence[j]->field_0xc + 100.0f) { if (effect_p->mStatus != 2 && effect_p->field_0x40 == 0 && var_r24 < 1) { cXyz spA4; diff --git a/src/d/actor/d_a_kytag15.cpp b/src/d/actor/d_a_kytag15.cpp index a94cb2aba9..67a2cf178d 100644 --- a/src/d/actor/d_a_kytag15.cpp +++ b/src/d/actor/d_a_kytag15.cpp @@ -59,7 +59,7 @@ static int daKytag15_Execute(kytag15_class* i_this) { } else { cLib_addCalc(&i_this->field_0x590, 0.0f, 0.05f, 0.01f, 1.0E-8f); } - } else if (g_env_light.mColPatPrev == 11) { + } else if (g_env_light.wether_pat0 == 11) { cLib_addCalc(&i_this->field_0x590, 1.0f, 0.05f, 0.01f, 1.0E-8f); } diff --git a/src/d/actor/d_a_kytag17.cpp b/src/d/actor/d_a_kytag17.cpp index 8e2432b179..144b99cfc7 100644 --- a/src/d/actor/d_a_kytag17.cpp +++ b/src/d/actor/d_a_kytag17.cpp @@ -35,7 +35,7 @@ static int daKytag17_Create(fopAc_ac_c* i_this) { fopAcM_SetupActor(a_this, kytag17_class); a_this->mParameters = fopAcM_GetParam(a_this); - g_env_light.field_0x1308 = a_this->mParameters; + g_env_light.light_mask_type = a_this->mParameters; return cPhs_COMPLEATE_e; } diff --git a/src/d/actor/d_a_midna.cpp b/src/d/actor/d_a_midna.cpp index a850c90891..01a87d2718 100644 --- a/src/d/actor/d_a_midna.cpp +++ b/src/d/actor/d_a_midna.cpp @@ -1044,11 +1044,11 @@ void daMidna_c::setRoomInfo() { int room_no; if (fopAcM_gc_c::gndCheck(¤t.pos)) { room_no = fopAcM_gc_c::getRoomId(); - tevStr.mEnvrIdxOverride = fopAcM_gc_c::getPolyColor(); + tevStr.YukaCol = fopAcM_gc_c::getPolyColor(); } else { room_no = dComIfGp_roomControl_getStayNo(); } - tevStr.mRoomNo = room_no; + tevStr.room_no = room_no; mReverb = dComIfGp_getReverb(room_no); fopAcM_SetRoomNo(this, room_no); } @@ -3266,12 +3266,12 @@ int daMidna_c::draw() { if (checkSetAnime(0, ANM_RETURN)) { f32 end_frame = mpMorf->getEndFrame(); f32 frame = mpMorf->getFrame(); - tevStr.mFogColor.r = (frame / end_frame) * -32.0f; - tevStr.mFogColor.g = tevStr.mFogColor.r; - tevStr.mFogColor.b = tevStr.mFogColor.r; + tevStr.TevColor.r = (frame / end_frame) * -32.0f; + tevStr.TevColor.g = tevStr.TevColor.r; + tevStr.TevColor.b = tevStr.TevColor.r; } else if (link->getIceDamageWaitTimer() != 0 || link->checkFreezeDamage() != 0) { - tevStr.mFogColor = link->tevStr.mFogColor; - field_0x6e0 = link->tevStr.mFogColor; + tevStr.TevColor = link->tevStr.TevColor; + field_0x6e0 = link->tevStr.TevColor; if (dKy_darkworld_check()) { field_0x6e8 = (J3DGXColor)l_normalKColor; field_0x6ec = (J3DGXColor)l_normalKColor2; @@ -3311,7 +3311,7 @@ int daMidna_c::draw() { } else { g_env_light.settingTevStruct(1, ¤t.pos, &tevStr); if (field_0x668 != NULL) { - field_0x668->getTevColorReg(0, &tevStr.mFogColor); + field_0x668->getTevColorReg(0, &tevStr.TevColor); } g_env_light.setLightTevColorType_MAJI(mpGokouBmd, &tevStr); mDoExt_modelEntryDL(mpGokouBmd); @@ -3359,9 +3359,9 @@ int daMidna_c::draw() { mDoExt_modelEntryDL(mpDemoHDTmpBmd); } - tevStr.mFogColor.r = 0; - tevStr.mFogColor.g = 0; - tevStr.mFogColor.b = 0; + tevStr.TevColor.r = 0; + tevStr.TevColor.g = 0; + tevStr.TevColor.b = 0; dComIfGd_setList(); if (bvar1 && !checkStateFlg1(FLG1_SHADOW_NO_DRAW)) { diff --git a/src/d/actor/d_a_mirror.cpp b/src/d/actor/d_a_mirror.cpp index 469f7ba448..8d34d4144d 100644 --- a/src/d/actor/d_a_mirror.cpp +++ b/src/d/actor/d_a_mirror.cpp @@ -207,10 +207,10 @@ void dMirror_packet_c::modelDraw(J3DModel* i_model, Mtx param_1) { JUT_ASSERT(kankyo != 0); GXColor color = {0}; - color.r = kankyo->mTerrainAmbienceBG[0].r; - color.g = kankyo->mTerrainAmbienceBG[0].g; - color.b = kankyo->mTerrainAmbienceBG[0].b; - color.a = kankyo->mTerrainAmbienceBG[0].a; + color.r = kankyo->bg_amb_col[0].r; + color.g = kankyo->bg_amb_col[0].g; + color.b = kankyo->bg_amb_col[0].b; + color.a = kankyo->bg_amb_col[0].a; J3DModelData* modelData = i_model->getModelData(); u16 materialNum = modelData->getMaterialNum(); diff --git a/src/d/actor/d_a_nbomb.cpp b/src/d/actor/d_a_nbomb.cpp index 2b3b39e1a6..9b4e42697d 100644 --- a/src/d/actor/d_a_nbomb.cpp +++ b/src/d/actor/d_a_nbomb.cpp @@ -485,13 +485,13 @@ void daNbomb_c::setRoomInfo() { int room_no; if (mAcch.GetGroundH() != -1000000000.0f) { room_no = dComIfG_Bgsp().GetRoomId(mAcch.m_gnd); - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mAcch.m_gnd); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mAcch.m_gnd); mPolySound = dKy_pol_sound_get(&mAcch.m_gnd); } else { room_no = dComIfGp_roomControl_getStayNo(); } - tevStr.mRoomNo = room_no; + tevStr.room_no = room_no; mSoundReverb = dComIfGp_getReverb(room_no); mCcStts.SetRoomId(room_no); fopAcM_SetRoomNo(this, room_no); @@ -1679,9 +1679,9 @@ int daNbomb_c::draw() { } if (checkStateFlg0(FLG0_FROZEN)) { - tevStr.mFogColor.r = player->getFreezeR(); - tevStr.mFogColor.g = player->getFreezeG(); - tevStr.mFogColor.b = player->getFreezeB(); + tevStr.TevColor.r = player->getFreezeR(); + tevStr.TevColor.g = player->getFreezeG(); + tevStr.TevColor.b = player->getFreezeB(); } g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr); diff --git a/src/d/actor/d_a_npc.cpp b/src/d/actor/d_a_npc.cpp index 413a3bac9b..bef8fe3ecd 100644 --- a/src/d/actor/d_a_npc.cpp +++ b/src/d/actor/d_a_npc.cpp @@ -1465,26 +1465,26 @@ int daNpcT_c::draw(int param_0, int i_setEffMtx, f32 param_2, GXColorS10* i_colo return 1; } - tevStr.mFogColor.r = 0; - tevStr.mFogColor.g = 0; - tevStr.mFogColor.b = 0; - tevStr.mFogColor.a = 0; + tevStr.TevColor.r = 0; + tevStr.TevColor.g = 0; + tevStr.TevColor.b = 0; + tevStr.TevColor.a = 0; if (i_color != NULL) { - tevStr.mFogColor.r = i_color->r; - tevStr.mFogColor.g = i_color->g; - tevStr.mFogColor.b = i_color->b; - tevStr.mFogColor.a = i_color->a; + tevStr.TevColor.r = i_color->r; + tevStr.TevColor.g = i_color->g; + tevStr.TevColor.b = i_color->b; + tevStr.TevColor.a = i_color->a; } if (field_0xdb8 != 0 && mTimer != 0) { f32 r = (f32)mTimer / (f32)field_0xdb8; if (cM3d_IsZero(r) == false) { - tevStr.mFogColor.r = r * 20.0f; + tevStr.TevColor.r = r * 20.0f; } } else if (param_0 != 0) { - tevStr.mFogColor.g = 20; + tevStr.TevColor.g = 20; } if (field_0xd98 & 0x800) { @@ -1555,8 +1555,8 @@ int daNpcT_c::draw(int param_0, int i_setEffMtx, f32 param_2, GXColorS10* i_colo /* 80148C70-80148CCC 1435B0 005C+00 1/1 0/0 58/58 .text setEnvTevColor__8daNpcT_cFv */ void daNpcT_c::setEnvTevColor() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(field_0x930); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(field_0x930); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(field_0x930); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(field_0x930); } /* 80148CCC-80148D10 14360C 0044+00 1/1 0/0 58/58 .text setRoomNo__8daNpcT_cFv */ @@ -2861,8 +2861,8 @@ void daBaseNpc_c::mainProc() { /* 8014F0A0-8014F0FC 1499E0 005C+00 1/1 0/0 2/2 .text setEnvTevColor__11daBaseNpc_cFv */ void daBaseNpc_c::setEnvTevColor() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mBgSPolyInfo); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(mBgSPolyInfo); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mBgSPolyInfo); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(mBgSPolyInfo); } /* 8014F0FC-8014F140 149A3C 0044+00 1/1 0/0 2/2 .text setRoomNo__11daBaseNpc_cFv */ @@ -3708,19 +3708,19 @@ int daNpcF_c::draw(BOOL i_isTest, BOOL param_1, f32 i_shadowDepth, _GXColorS10* } if (cM3d_IsZero_inverted(damage_ratio)) { - tevStr.mFogColor.r = (s16)(damage_ratio * 20.0f); - tevStr.mFogColor.g = 0; + tevStr.TevColor.r = (s16)(damage_ratio * 20.0f); + tevStr.TevColor.g = 0; } else if (i_isTest) { - tevStr.mFogColor.g = 20; - tevStr.mFogColor.r = 0; + tevStr.TevColor.g = 20; + tevStr.TevColor.r = 0; } else if (i_fogColor != NULL) { - tevStr.mFogColor.r = i_fogColor->r; - tevStr.mFogColor.g = i_fogColor->g; - tevStr.mFogColor.b = i_fogColor->b; - tevStr.mFogColor.a = i_fogColor->a; + tevStr.TevColor.r = i_fogColor->r; + tevStr.TevColor.g = i_fogColor->g; + tevStr.TevColor.b = i_fogColor->b; + tevStr.TevColor.a = i_fogColor->a; } else { - tevStr.mFogColor.g = 0; - tevStr.mFogColor.r = 0; + tevStr.TevColor.g = 0; + tevStr.TevColor.r = 0; } if (mTwilight) { @@ -4000,8 +4000,8 @@ BOOL daNpcF_c::setBrkAnm(J3DAnmTevRegKey* i_brk, J3DModelData* i_modelData, f32 /* 80152D84-80152DE0 14D6C4 005C+00 1/1 0/0 40/40 .text setEnvTevColor__8daNpcF_cFv */ void daNpcF_c::setEnvTevColor() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mGndChk); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(mGndChk); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mGndChk); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(mGndChk); } /* 80152DE0-80152E24 14D720 0044+00 1/1 0/0 40/40 .text setRoomNo__8daNpcF_cFv */ diff --git a/src/d/actor/d_a_npc_cd.cpp b/src/d/actor/d_a_npc_cd.cpp index 0ee7475308..c857304b03 100644 --- a/src/d/actor/d_a_npc_cd.cpp +++ b/src/d/actor/d_a_npc_cd.cpp @@ -674,8 +674,8 @@ int daNpcCd_c::removeResrc(int idx, int param_1) { /* 80156D1C-80156D78 15165C 005C+00 0/0 0/0 1/1 .text setEnvTevCol__9daNpcCd_cFv */ void daNpcCd_c::setEnvTevCol() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mAcch.m_gnd); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(mAcch.m_gnd); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mAcch.m_gnd); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(mAcch.m_gnd); } /* 80156D78-80156DBC 1516B8 0044+00 0/0 0/0 1/1 .text setRoomNo__9daNpcCd_cFv */ @@ -1485,4 +1485,4 @@ void __sinit_d_a_npc_cd_cpp(){// NONMATCHING REGISTER_CTORS(0x80157A10, __sinit_d_a_npc_cd_cpp); #pragma pop -/* 80392FE8-80392FE8 01F648 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ \ No newline at end of file +/* 80392FE8-80392FE8 01F648 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ diff --git a/src/d/actor/d_a_npc_cd2.cpp b/src/d/actor/d_a_npc_cd2.cpp index d52d2f50cb..4c3dffda3a 100644 --- a/src/d/actor/d_a_npc_cd2.cpp +++ b/src/d/actor/d_a_npc_cd2.cpp @@ -1783,8 +1783,8 @@ int daNpcCd2_c::removeResrc(int idx, int param_1) { /* 80158D88-80158DE4 1536C8 005C+00 0/0 0/0 4/4 .text setEnvTevCol__10daNpcCd2_cFv */ void daNpcCd2_c::setEnvTevCol() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mAcch.m_gnd); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(mAcch.m_gnd); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mAcch.m_gnd); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(mAcch.m_gnd); } /* 80158DE4-80158E28 153724 0044+00 0/0 0/0 4/4 .text setRoomNo__10daNpcCd2_cFv */ @@ -2164,4 +2164,4 @@ void __sinit_d_a_npc_cd2_cpp(){// NONMATCHING #pragma push #pragma force_active on REGISTER_CTORS(0x8015A90C, __sinit_d_a_npc_cd2_cpp); -#pragma pop \ No newline at end of file +#pragma pop diff --git a/src/d/actor/d_a_npc_fish.cpp b/src/d/actor/d_a_npc_fish.cpp index ac8bdf0a00..b36a5a3dbd 100644 --- a/src/d/actor/d_a_npc_fish.cpp +++ b/src/d/actor/d_a_npc_fish.cpp @@ -35,7 +35,7 @@ static void fish_set(fopAc_ac_c* i_this, fish_data_s* data) { } u32 param = data->param; pos = data->pos; - if ((param == 1u) && envLight->mPondSeason != 2) { + if ((param == 1u) && envLight->fishing_hole_season != 2) { param = 2; } param |= data->field_0x10 << 8; @@ -138,9 +138,9 @@ static int daNpc_Fish_Create(fopAc_ac_c* i_this) { } else { dScnKy_env_light_c* envLight = dKy_getEnvlight(); s32 param = 0; - if (envLight->mPondSeason == 2) { + if (envLight->fishing_hole_season == 2) { param = 160; - } else if (envLight->mPondSeason == 3) { + } else if (envLight->fishing_hole_season == 3) { param = 64; } if (param != 0) { @@ -149,7 +149,7 @@ static int daNpc_Fish_Create(fopAc_ac_c* i_this) { NULL, -1); } } - if (g_env_light.mPondSeason == 2) { + if (g_env_light.fishing_hole_season == 2) { for (int i = 0; i < 4; i++) { pos.set(cM_rndFX(700.0f) + -2936.0f, 0.0f, cM_rndFX(700.0f) + -7865.0f); csXyz angle(0, 0, -1); diff --git a/src/d/actor/d_a_npc_zrz.cpp b/src/d/actor/d_a_npc_zrz.cpp index 81f79a43d4..5905f4922b 100644 --- a/src/d/actor/d_a_npc_zrz.cpp +++ b/src/d/actor/d_a_npc_zrz.cpp @@ -450,22 +450,22 @@ int daNpc_zrZ_c::draw(int i_isTest, int param_1, f32 i_shadowDepth, _GXColorS10* } if (cM3d_IsZero_inverted(damage_ratio)) { - tevStr.mFogColor.r = (s16)(damage_ratio * 20.0f); - tevStr.mFogColor.g = 0; + tevStr.TevColor.r = (s16)(damage_ratio * 20.0f); + tevStr.TevColor.g = 0; } else if (i_isTest) { - tevStr.mFogColor.g = 20; - tevStr.mFogColor.r = 0; + tevStr.TevColor.g = 20; + tevStr.TevColor.r = 0; } else if (i_fogColor != NULL) { - tevStr.mFogColor.r = i_fogColor->r; - tevStr.mFogColor.g = i_fogColor->g; - tevStr.mFogColor.b = i_fogColor->b; - tevStr.mFogColor.a = i_fogColor->a; + tevStr.TevColor.r = i_fogColor->r; + tevStr.TevColor.g = i_fogColor->g; + tevStr.TevColor.b = i_fogColor->b; + tevStr.TevColor.a = i_fogColor->a; } else { - tevStr.mFogColor.g = 0; - tevStr.mFogColor.r = 0; + tevStr.TevColor.g = 0; + tevStr.TevColor.r = 0; } - if (tevStr.mFogColor.a == 0) { + if (tevStr.TevColor.a == 0) { return 1; } @@ -656,7 +656,7 @@ void daNpc_zrZ_c::setParam() { mAcchCir.SetWallH(daNpc_zrZ_Param_c::m.mWallH); gravity = daNpc_zrZ_Param_c::m.mGravity; - u32 uvar4 = cLib_minMaxLimit(tevStr.mFogColor.a * 100 / 0xff, 1, 100); + u32 uvar4 = cLib_minMaxLimit(tevStr.TevColor.a * 100 / 0xff, 1, 100); mCreatureSound.startCreatureSoundLevel(Z2SE_ZRZ_MV, uvar4, -1); } @@ -1053,14 +1053,14 @@ void daNpc_zrZ_c::reset() { if (mDemoMode == DEMO_WAIT) { mIsLeading = false; - tevStr.mFogColor.a = 0; + tevStr.TevColor.a = 0; mpNextActionFn = &wait; } else if (mDemoMode == DEMO_COME_HERE || mDemoMode == DEMO_COME_HERE_2) { mIsLeading = false; - tevStr.mFogColor.a = 0xff; + tevStr.TevColor.a = 0xff; } else { mIsLeading = true; - tevStr.mFogColor.a = 0xff; + tevStr.TevColor.a = 0xff; } setLookMode(LOOK_NONE); @@ -1688,20 +1688,20 @@ BOOL daNpc_zrZ_c::ECut_helpPrince(int i_staffID) { case 40: if (cLib_calcTimer(&mEventTimer) == 0) { ret = true; - tevStr.mFogColor.a = 0xff; + tevStr.TevColor.a = 0xff; } else { - tevStr.mFogColor.a = (u8)((60 - mEventTimer) / 60.0f * 255.0f); + tevStr.TevColor.a = (u8)((60 - mEventTimer) / 60.0f * 255.0f); } break; case 103: if (cLib_calcTimer(&mEventTimer) == 0) { ret = true; - tevStr.mFogColor.a = 0; + tevStr.TevColor.a = 0; } else if (mEventTimer > 30) { - tevStr.mFogColor.a = (u8)((mEventTimer - 30) / 30.0f * 255.0f); + tevStr.TevColor.a = (u8)((mEventTimer - 30) / 30.0f * 255.0f); } else { - tevStr.mFogColor.a = 0; + tevStr.TevColor.a = 0; } break; @@ -1988,11 +1988,11 @@ BOOL daNpc_zrZ_c::ECut_clothesGet(int i_staffID) { case 90: if (cLib_calcTimer(&mEventTimer) == 0) { ret = true; - tevStr.mFogColor.a = 0; + tevStr.TevColor.a = 0; } else if (mEventTimer > 0) { - tevStr.mFogColor.a = (u8)(mEventTimer / 120.0f * 255.0f); + tevStr.TevColor.a = (u8)(mEventTimer / 120.0f * 255.0f); } else { - tevStr.mFogColor.a = 0; + tevStr.TevColor.a = 0; } break; @@ -2074,11 +2074,11 @@ BOOL daNpc_zrZ_c::ECut_getAfter(int i_staffID) { case 90: if (cLib_calcTimer(&mEventTimer) == 0) { ret = true; - tevStr.mFogColor.a = 0; + tevStr.TevColor.a = 0; } else if (mEventTimer > 0) { - tevStr.mFogColor.a = (u8)(mEventTimer / 120.0f * 255.0f); + tevStr.TevColor.a = (u8)(mEventTimer / 120.0f * 255.0f); } else { - tevStr.mFogColor.a = 0; + tevStr.TevColor.a = 0; } break; @@ -2131,7 +2131,7 @@ BOOL daNpc_zrZ_c::ECut_sealRelease(int i_staffID) { break; case 10: - if (tevStr.mFogColor.a <= 0x1e) { + if (tevStr.TevColor.a <= 0x1e) { ret = true; } break; @@ -2150,7 +2150,7 @@ BOOL daNpc_zrZ_c::ECut_sealRelease(int i_staffID) { if (prm >= 10) { cXyz pos = mPath.getPntPos(mPath.getIdx()); if (!mPath.chkPassedDst(current.pos)) { - cLib_chaseS(&tevStr.mFogColor.a, 8, 8); + cLib_chaseS(&tevStr.TevColor.a, 8, 8); cLib_addCalc2(&mSpeed, daNpc_zrZ_Param_c::m.mMaxSpeed, 0.1f, 1.0f); s16 ang_y = cLib_targetAngleY(¤t.pos, &pos); s16 ang_x = cLib_targetAngleX(&pos, ¤t.pos); @@ -2158,7 +2158,7 @@ BOOL daNpc_zrZ_c::ECut_sealRelease(int i_staffID) { cLib_addCalcAngleS2(&mMoveAngle.x, ang_x, 2, 0x800); } else { mSpeed = 0.0f; - cLib_chaseS(&tevStr.mFogColor.a, 0xff, 8); + cLib_chaseS(&tevStr.TevColor.a, 0xff, 8); mIsMoving = false; } } else { @@ -2191,7 +2191,7 @@ BOOL daNpc_zrZ_c::ECut_srSkip(int i_staffID) { current.pos = mPath.getPntPos(mPath.getIdx()); old.pos = current.pos; setAngle(fopAcM_searchPlayerAngleY(this)); - tevStr.mFogColor.a = 0xff; + tevStr.TevColor.a = 0xff; mIsMoving = false; if (mpRockActor != NULL) { fopAcM_delete(mpRockActor); @@ -2344,8 +2344,8 @@ BOOL daNpc_zrZ_c::comeHere(void* param_0) { if (!dComIfGs_isSwitch(mSwitch1, fopAcM_GetRoomNo(this))) { dComIfGs_onSwitch(mSwitch1, fopAcM_GetRoomNo(this)); } - cLib_chaseS(&tevStr.mFogColor.a, 0, 4); - if (tevStr.mFogColor.a == 0) { + cLib_chaseS(&tevStr.TevColor.a, 0, 4); + if (tevStr.TevColor.a == 0) { fopAcM_delete(this); } } @@ -2446,10 +2446,10 @@ BOOL daNpc_zrZ_c::comeHere2(void* param_0) { mOrderEvtNo = EVT_SEAL_RELEASE; break; } else { - cLib_chaseS(&tevStr.mFogColor.a, 0x14, 8); + cLib_chaseS(&tevStr.TevColor.a, 0x14, 8); } } else { - cLib_chaseS(&tevStr.mFogColor.a, 0xff, 8); + cLib_chaseS(&tevStr.TevColor.a, 0xff, 8); } cLib_addCalc2(&mSpeed, daNpc_zrZ_Param_c::m.mMaxSpeed, 0.1f, 1.0f); @@ -2459,7 +2459,7 @@ BOOL daNpc_zrZ_c::comeHere2(void* param_0) { cLib_addCalcAngleS2(&mMoveAngle.x, angle_x, 2, 0x800); } else { cLib_chaseF(&mSpeed, 0.0f, 3.0f); - cLib_chaseS(&tevStr.mFogColor.a, 0xff, 8); + cLib_chaseS(&tevStr.TevColor.a, 0xff, 8); } cXyz move_speed(0.0f, 0.0f, mSpeed); diff --git a/src/d/actor/d_a_obj_automata.cpp b/src/d/actor/d_a_obj_automata.cpp index 19fdf2cd7b..f6c3b95dc0 100644 --- a/src/d/actor/d_a_obj_automata.cpp +++ b/src/d/actor/d_a_obj_automata.cpp @@ -264,8 +264,8 @@ int daObj_AutoMata_c::setAnm(int param_1, bool param_2) { /* 80BA6634-80BA6690 001034 005C+00 2/2 0/0 0/0 .text setEnvTevColor__16daObj_AutoMata_cFv */ void daObj_AutoMata_c::setEnvTevColor() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mGndChk); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(mGndChk); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mGndChk); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(mGndChk); } /* 80BA6690-80BA66D4 001090 0044+00 2/2 0/0 0/0 .text setRoomNo__16daObj_AutoMata_cFv */ diff --git a/src/d/actor/d_a_obj_bed.cpp b/src/d/actor/d_a_obj_bed.cpp index 6935166361..2a0f6127a4 100644 --- a/src/d/actor/d_a_obj_bed.cpp +++ b/src/d/actor/d_a_obj_bed.cpp @@ -146,8 +146,8 @@ int daObj_Bed_c::isDelete() { /* 80BADF34-80BADF90 0009B4 005C+00 2/2 0/0 0/0 .text setEnvTevColor__11daObj_Bed_cFv */ void daObj_Bed_c::setEnvTevColor() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mGndChk); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(mGndChk); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mGndChk); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(mGndChk); } /* 80BADF90-80BADFD0 000A10 0040+00 2/2 0/0 0/0 .text setRoomNo__11daObj_Bed_cFv */ diff --git a/src/d/actor/d_a_obj_bombf.cpp b/src/d/actor/d_a_obj_bombf.cpp index 37c8e51964..3f3138e62d 100644 --- a/src/d/actor/d_a_obj_bombf.cpp +++ b/src/d/actor/d_a_obj_bombf.cpp @@ -32,7 +32,7 @@ int daObjBombf_c::create() { } fopAcM_SetMtx(this, field_0x570->getBaseTRMtx()); - tevStr.mRoomNo = fopAcM_GetRoomNo(this); + tevStr.room_no = fopAcM_GetRoomNo(this); attention_info.position = current.pos; eyePos = attention_info.position; field_0x574 = 0xffffffff; diff --git a/src/d/actor/d_a_obj_boumato.cpp b/src/d/actor/d_a_obj_boumato.cpp index 3f4ea6fed6..9a1b9be676 100644 --- a/src/d/actor/d_a_obj_boumato.cpp +++ b/src/d/actor/d_a_obj_boumato.cpp @@ -315,8 +315,8 @@ void daObj_BouMato_c::setSwayParam(fopAc_ac_c* param_1) { /* 80BBC19C-80BBC1F8 00129C 005C+00 2/2 0/0 0/0 .text setEnvTevColor__15daObj_BouMato_cFv */ void daObj_BouMato_c::setEnvTevColor() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mGndChk); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(mGndChk); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mGndChk); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(mGndChk); } /* 80BBC1F8-80BBC23C 0012F8 0044+00 2/2 0/0 0/0 .text setRoomNo__15daObj_BouMato_cFv */ diff --git a/src/d/actor/d_a_obj_carry.cpp b/src/d/actor/d_a_obj_carry.cpp index e213177079..787f3dc0e4 100644 --- a/src/d/actor/d_a_obj_carry.cpp +++ b/src/d/actor/d_a_obj_carry.cpp @@ -2579,7 +2579,7 @@ s32 daObjCarry_c::CreateInit_ironball() { eyePos = current.pos; fopAcM_SetRoomNo(this,getRoomNo(l_saveID)); - tevStr.mRoomNo = fopAcM_GetRoomNo(this); + tevStr.room_no = fopAcM_GetRoomNo(this); if (chkSttsFlag(l_saveID,1)) { mDraw = 1; diff --git a/src/d/actor/d_a_obj_cdoor.cpp b/src/d/actor/d_a_obj_cdoor.cpp index 7cb3bf051b..b37f15c269 100644 --- a/src/d/actor/d_a_obj_cdoor.cpp +++ b/src/d/actor/d_a_obj_cdoor.cpp @@ -82,7 +82,7 @@ cPhs__Step daObjCdoor_c::create() { return cPhs_ERROR_e; } fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); - tevStr.mRoomNo = dStage_roomControl_c::mStayNo; + tevStr.room_no = dStage_roomControl_c::mStayNo; fopAcM_setCullSizeBox2(this, mpModel->getModelData()); mSw = fopAcM_GetParam(this) & 0xff; mChainID = -1; diff --git a/src/d/actor/d_a_obj_crope.cpp b/src/d/actor/d_a_obj_crope.cpp index 330cee9623..e9f202b86a 100644 --- a/src/d/actor/d_a_obj_crope.cpp +++ b/src/d/actor/d_a_obj_crope.cpp @@ -310,7 +310,7 @@ int daObjCrope_c::create() { mCcStts.SetRoomId(fopAcM_GetRoomNo(this)); mCollider.Set(l_sphSrc); mCollider.SetStts(&mCcStts); - tevStr.mRoomNo = fopAcM_GetRoomNo(this); + tevStr.room_no = fopAcM_GetRoomNo(this); gravity = -5.0f; cXyz cStack_68; cXyz cStack_74; diff --git a/src/d/actor/d_a_obj_digplace.cpp b/src/d/actor/d_a_obj_digplace.cpp index 7cdfa7d1d1..715dc3e61f 100644 --- a/src/d/actor/d_a_obj_digplace.cpp +++ b/src/d/actor/d_a_obj_digplace.cpp @@ -36,7 +36,7 @@ int daObjDigpl_c::create() { attention_info.position = current.pos; eyePos = attention_info.position; - tevStr.mRoomNo = dComIfGp_roomControl_getStayNo(); + tevStr.room_no = dComIfGp_roomControl_getStayNo(); fopAcM_SetMin(this, -550.0f, -250.0f, -550.0f); fopAcM_SetMax(this, 550.0f, 250.0f, 550.0f); attention_info.distances[fopAc_attn_ETC_e] = 27; diff --git a/src/d/actor/d_a_obj_fchain.cpp b/src/d/actor/d_a_obj_fchain.cpp index 2f72392739..a6c51c3119 100644 --- a/src/d/actor/d_a_obj_fchain.cpp +++ b/src/d/actor/d_a_obj_fchain.cpp @@ -39,7 +39,7 @@ int daObjFchain_c::create() { 0x10) == 0) { return cPhs_ERROR_e; } - tevStr.mRoomNo = dComIfGp_roomControl_getStayNo(); + tevStr.room_no = dComIfGp_roomControl_getStayNo(); mShape.setUserArea((u32)this); current.pos.y += 3.0f; s16 local_58 = shape_angle.y; @@ -283,10 +283,10 @@ void daObjFchain_shape_c::draw() { material->loadSharedDL(); material->getShape()->loadPreDrawSetting(); GXColor ambColor; - ambColor.r = tevStr->mColorC0.r; - ambColor.g = tevStr->mColorC0.g; - ambColor.b = tevStr->mColorC0.b; - ambColor.a = tevStr->mColorC0.a; + ambColor.r = tevStr->AmbCol.r; + ambColor.g = tevStr->AmbCol.g; + ambColor.b = tevStr->AmbCol.b; + ambColor.a = tevStr->AmbCol.a; GXSetChanAmbColor(GX_COLOR0A0, ambColor); GXSetChanMatColor(GX_COLOR0A0, g_whiteColor); dKy_setLight_again(); diff --git a/src/d/actor/d_a_obj_gra_rock.cpp b/src/d/actor/d_a_obj_gra_rock.cpp index e13fe09261..12d56a97d8 100644 --- a/src/d/actor/d_a_obj_gra_rock.cpp +++ b/src/d/actor/d_a_obj_gra_rock.cpp @@ -93,8 +93,8 @@ void daObjGraRock_c::bombParticleSet() { /* 80C11730-80C1178C 0006B0 005C+00 1/1 0/0 0/0 .text setEnvTevColor__14daObjGraRock_cFv */ void daObjGraRock_c::setEnvTevColor() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mGndChk); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(mGndChk); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mGndChk); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(mGndChk); } /* 80C1178C-80C117D0 00070C 0044+00 1/1 0/0 0/0 .text setRoomNo__14daObjGraRock_cFv */ diff --git a/src/d/actor/d_a_obj_grave_stone.cpp b/src/d/actor/d_a_obj_grave_stone.cpp index 90d294ba86..7374bea911 100644 --- a/src/d/actor/d_a_obj_grave_stone.cpp +++ b/src/d/actor/d_a_obj_grave_stone.cpp @@ -118,8 +118,8 @@ int daGraveStone_c::setPrtcl() { /* 80C12A38-80C12A94 0004B8 005C+00 2/2 0/0 0/0 .text setEnvTevColor__14daGraveStone_cFv */ void daGraveStone_c::setEnvTevColor() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mGndChk); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(mGndChk); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mGndChk); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(mGndChk); } /* 80C12A94-80C12AD8 000514 0044+00 2/2 0/0 0/0 .text setRoomNo__14daGraveStone_cFv */ diff --git a/src/d/actor/d_a_obj_movebox.cpp b/src/d/actor/d_a_obj_movebox.cpp index 37fc1b4233..93d99fd95e 100644 --- a/src/d/actor/d_a_obj_movebox.cpp +++ b/src/d/actor/d_a_obj_movebox.cpp @@ -1180,8 +1180,8 @@ int daObjMovebox::Act_c::Execute(Mtx** param_0) { mBgc.proc_vertical(this); if (mBgc.field_0x5c >= 0) { - tevStr.mRoomNo = current.roomNo; - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mBgc.M_gnd_work[mBgc.field_0x5c]); + tevStr.room_no = current.roomNo; + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mBgc.M_gnd_work[mBgc.field_0x5c]); } if (field_0x8fc > 0) { diff --git a/src/d/actor/d_a_obj_oiltubo.cpp b/src/d/actor/d_a_obj_oiltubo.cpp index b4b5004aa7..321ec16ce0 100644 --- a/src/d/actor/d_a_obj_oiltubo.cpp +++ b/src/d/actor/d_a_obj_oiltubo.cpp @@ -240,8 +240,8 @@ void daObj_Oiltubo_c::setParam() { /* 80CA7318-80CA7374 000C78 005C+00 2/2 0/0 0/0 .text setEnvTevColor__15daObj_Oiltubo_cFv */ void daObj_Oiltubo_c::setEnvTevColor() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mGroundChk); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(mGroundChk); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mGroundChk); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(mGroundChk); } /* 80CA7374-80CA73B8 000CD4 0044+00 2/2 0/0 0/0 .text setRoomNo__15daObj_Oiltubo_cFv */ diff --git a/src/d/actor/d_a_obj_pleaf.cpp b/src/d/actor/d_a_obj_pleaf.cpp index 33a09c5e7e..4652af37c6 100644 --- a/src/d/actor/d_a_obj_pleaf.cpp +++ b/src/d/actor/d_a_obj_pleaf.cpp @@ -122,8 +122,8 @@ int daObj_Pleaf_c::isDelete() { /* 80CB15E8-80CB1644 000988 005C+00 2/2 0/0 0/0 .text setEnvTevColor__13daObj_Pleaf_cFv */ void daObj_Pleaf_c::setEnvTevColor() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mGndChk); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(mGndChk); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mGndChk); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(mGndChk); } /* 80CB1644-80CB1684 0009E4 0040+00 2/2 0/0 0/0 .text setRoomNo__13daObj_Pleaf_cFv */ diff --git a/src/d/actor/d_a_obj_ss_item.cpp b/src/d/actor/d_a_obj_ss_item.cpp index f1cb2cbabe..484004a6e3 100644 --- a/src/d/actor/d_a_obj_ss_item.cpp +++ b/src/d/actor/d_a_obj_ss_item.cpp @@ -295,8 +295,8 @@ void daObj_SSItem_c::setParam() { /* 80CE7C24-80CE7C80 001084 005C+00 2/2 0/0 0/0 .text setEnvTevColor__14daObj_SSItem_cFv */ void daObj_SSItem_c::setEnvTevColor() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mGndChk); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(mGndChk); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mGndChk); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(mGndChk); } /* 80CE7C80-80CE7CC4 0010E0 0044+00 2/2 0/0 0/0 .text setRoomNo__14daObj_SSItem_cFv */ diff --git a/src/d/actor/d_a_obj_tmoon.cpp b/src/d/actor/d_a_obj_tmoon.cpp index b0e1da7a9d..c51ff44696 100644 --- a/src/d/actor/d_a_obj_tmoon.cpp +++ b/src/d/actor/d_a_obj_tmoon.cpp @@ -77,7 +77,7 @@ int daObjTMoon_c::execute() { /* 80D12EB4-80D12EDC 000394 0028+00 1/1 0/0 0/0 .text draw__12daObjTMoon_cFv */ int daObjTMoon_c::draw() { - g_env_light.mMoonPos = current.pos; + g_env_light.moon_pos = current.pos; return 1; } diff --git a/src/d/actor/d_a_obj_tornado.cpp b/src/d/actor/d_a_obj_tornado.cpp index d6c0316b0d..5334f28eb5 100644 --- a/src/d/actor/d_a_obj_tornado.cpp +++ b/src/d/actor/d_a_obj_tornado.cpp @@ -206,7 +206,7 @@ int daObjTrnd_c::draw() { /* 80D1C298-80D1C2CC 000978 0034+00 1/1 0/0 0/0 .text _delete__11daObjTrnd_cFv */ int daObjTrnd_c::_delete() { - dKy_getEnvlight()->mEvtWindSet = 0; + dKy_getEnvlight()->evt_wind_go = 0; cutPntWind(); return 1; } diff --git a/src/d/actor/d_a_obj_tornado2.cpp b/src/d/actor/d_a_obj_tornado2.cpp index 2c322d8949..dbc0262da8 100644 --- a/src/d/actor/d_a_obj_tornado2.cpp +++ b/src/d/actor/d_a_obj_tornado2.cpp @@ -390,7 +390,7 @@ int daObjTrnd2_c::draw() { /* 80D1D2E8-80D1D330 000E88 0048+00 1/1 0/0 0/0 .text _delete__12daObjTrnd2_cFv */ int daObjTrnd2_c::_delete() { - dKy_getEnvlight()->mEvtWindSet = 0; + dKy_getEnvlight()->evt_wind_go = 0; cutPntWind(); endParticle(); return 1; diff --git a/src/d/actor/d_a_obj_wchain.cpp b/src/d/actor/d_a_obj_wchain.cpp index ba0d62f934..dbe980d135 100644 --- a/src/d/actor/d_a_obj_wchain.cpp +++ b/src/d/actor/d_a_obj_wchain.cpp @@ -44,7 +44,7 @@ cPhs__Step daObjWchain_c::create() { if (!fopAcM_entrySolidHeap(this, daObjWchain_createHeap, 0x820)) { return cPhs_ERROR_e; } - tevStr.mRoomNo = dStage_roomControl_c::mStayNo; + tevStr.room_no = dStage_roomControl_c::mStayNo; attention_info.position = current.pos; eyePos = attention_info.position; attention_info.distances[fopAc_attn_LOCK_e] = 0x1c; @@ -317,10 +317,10 @@ void daObjWchain_shape_c::draw() { material->loadSharedDL(); material->getShape()->loadPreDrawSetting(); GXColor amb_color; - amb_color.r = tevstr.mColorC0.r; - amb_color.g = tevstr.mColorC0.g; - amb_color.b = tevstr.mColorC0.b; - amb_color.a = tevstr.mColorC0.a; + amb_color.r = tevstr.AmbCol.r; + amb_color.g = tevstr.AmbCol.g; + amb_color.b = tevstr.AmbCol.b; + amb_color.a = tevstr.AmbCol.a; GXSetChanAmbColor(GX_COLOR0A0, amb_color); GXSetChanMatColor(GX_COLOR0A0, g_whiteColor); dKy_setLight_again(); diff --git a/src/d/actor/d_a_obj_window.cpp b/src/d/actor/d_a_obj_window.cpp index 359bf7cd91..50acb7843a 100644 --- a/src/d/actor/d_a_obj_window.cpp +++ b/src/d/actor/d_a_obj_window.cpp @@ -57,7 +57,7 @@ int daObjWindow_c::Create() { mCyl.Set(l_cyl_src); mCyl.SetStts(&mStts); } - tevStr.mLightInf = getLightInf(); + tevStr.mLightInf.r = getLightInf(); return 1; } diff --git a/src/d/actor/d_a_obj_yel_bag.cpp b/src/d/actor/d_a_obj_yel_bag.cpp index 84c94fd1d4..6ca1b475a2 100644 --- a/src/d/actor/d_a_obj_yel_bag.cpp +++ b/src/d/actor/d_a_obj_yel_bag.cpp @@ -383,8 +383,8 @@ int daObj_YBag_c::isDelete() { /* 80D3D468-80D3D4C4 001468 005C+00 2/2 0/0 0/0 .text setEnvTevColor__12daObj_YBag_cFv */ void daObj_YBag_c::setEnvTevColor() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mGndChk); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(mGndChk); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mGndChk); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(mGndChk); } /* 80D3D4C4-80D3D508 0014C4 0044+00 2/2 0/0 0/0 .text setRoomNo__12daObj_YBag_cFv */ diff --git a/src/d/actor/d_a_obj_zra_rock.cpp b/src/d/actor/d_a_obj_zra_rock.cpp index fab692c1e1..b334ccf24f 100644 --- a/src/d/actor/d_a_obj_zra_rock.cpp +++ b/src/d/actor/d_a_obj_zra_rock.cpp @@ -31,8 +31,8 @@ void daObjZraRock_c::setBaseMtx() { /* 80D44DCC-80D44E28 00018C 005C+00 1/1 0/0 0/0 .text setEnvTevColor__14daObjZraRock_cFv */ void daObjZraRock_c::setEnvTevColor() { - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mGndChk); - tevStr.mRoomNo = dComIfG_Bgsp().GetRoomId(mGndChk); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mGndChk); + tevStr.room_no = dComIfG_Bgsp().GetRoomId(mGndChk); } /* 80D44E28-80D44E68 0001E8 0040+00 1/1 0/0 0/0 .text setRoomNo__14daObjZraRock_cFv */ diff --git a/src/d/actor/d_a_spinner.cpp b/src/d/actor/d_a_spinner.cpp index 7412c4c10e..5036f1d0b8 100644 --- a/src/d/actor/d_a_spinner.cpp +++ b/src/d/actor/d_a_spinner.cpp @@ -462,12 +462,12 @@ void daSpinner_c::setRoomInfo() { int roomNo; if (mAcch.GetGroundH() != -1000000000.0f) { roomNo = dComIfG_Bgsp().GetRoomId(mAcch.m_gnd); - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mAcch.m_gnd); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mAcch.m_gnd); } else { roomNo = dComIfGp_roomControl_getStayNo(); } - tevStr.mRoomNo = roomNo; + tevStr.room_no = roomNo; field_0xa6e = dComIfGp_getReverb(roomNo); mStts.SetRoomId(roomNo); fopAcM_SetRoomNo(this, roomNo); diff --git a/src/d/actor/d_a_tag_hjump.cpp b/src/d/actor/d_a_tag_hjump.cpp index 73b63b4840..ac6469d3d0 100644 --- a/src/d/actor/d_a_tag_hjump.cpp +++ b/src/d/actor/d_a_tag_hjump.cpp @@ -44,7 +44,7 @@ int daTagHjump_c::create() { if (phase == cPhs_COMPLEATE_e) { fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); - tevStr.mRoomNo = fopAcM_GetRoomNo(this); + tevStr.room_no = fopAcM_GetRoomNo(this); mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); mDoMtx_stack_c::YrotM(shape_angle.y); diff --git a/src/d/actor/d_a_tag_lantern.cpp b/src/d/actor/d_a_tag_lantern.cpp index e57659700b..a2d14cef6b 100644 --- a/src/d/actor/d_a_tag_lantern.cpp +++ b/src/d/actor/d_a_tag_lantern.cpp @@ -48,13 +48,13 @@ int daTag_Lantern_c::Execute() { s32 room_no; if (mGroundCross != -1000000000.0f) { room_no = dComIfG_Bgsp().GetRoomId(mGndChk); - tevStr.mEnvrIdxOverride = dComIfG_Bgsp().GetPolyColor(mGndChk); + tevStr.YukaCol = dComIfG_Bgsp().GetPolyColor(mGndChk); } else { room_no = dComIfGp_roomControl_getStayNo(); } - tevStr.mRoomNo = room_no; - fopAcM_SetRoomNo(this, tevStr.mRoomNo); + tevStr.room_no = room_no; + fopAcM_SetRoomNo(this, tevStr.room_no); attention_info.flags = 0; attention_info.position = current.pos; eyePos = attention_info.position; diff --git a/src/d/actor/d_a_vrbox.cpp b/src/d/actor/d_a_vrbox.cpp index 6a39ec2c0a..b3124cbbac 100644 --- a/src/d/actor/d_a_vrbox.cpp +++ b/src/d/actor/d_a_vrbox.cpp @@ -17,7 +17,7 @@ static int daVrbox_Draw(vrbox_class* i_this) { daVrbox_color_set(i_this); - if (g_env_light.mVrboxInvisible) { + if (g_env_light.hide_vrbox) { return 1; } @@ -64,16 +64,16 @@ static int daVrbox_Draw(vrbox_class* i_this) { /* 804986B8-80498850 000218 0198+00 1/1 0/0 0/0 .text daVrbox_color_set__FP11vrbox_class */ static int daVrbox_color_set(vrbox_class* i_this) { - if ((g_env_light.mVrKasumiCol.r + g_env_light.mVrKasumiCol.g + - g_env_light.mVrKasumiCol.b + g_env_light.mVrSkyCol.r + g_env_light.mVrSkyCol.g + - g_env_light.mVrSkyCol.b + g_env_light.mVrkumoCol.r + g_env_light.mVrkumoCol.g + - g_env_light.mVrkumoCol.b) == 0) + if ((g_env_light.vrbox_kasumi_outer_col.r + g_env_light.vrbox_kasumi_outer_col.g + + g_env_light.vrbox_kasumi_outer_col.b + g_env_light.vrbox_sky_col.r + g_env_light.vrbox_sky_col.g + + g_env_light.vrbox_sky_col.b + g_env_light.vrbox_kumo_top_col.r + g_env_light.vrbox_kumo_top_col.g + + g_env_light.vrbox_kumo_top_col.b) == 0) { - g_env_light.mVrboxInvisible = true; + g_env_light.hide_vrbox = true; return 1; } - g_env_light.mVrboxInvisible = false; + g_env_light.hide_vrbox = false; J3DModelData* modelData = i_this->mpSoraModel->getModelData(); J3DGXColorS10 color; @@ -83,9 +83,9 @@ static int daVrbox_color_set(vrbox_class* i_this) { material_0->setCullMode(0); material_0->change(); - color.r = g_env_light.mVrSkyCol.r; - color.g = g_env_light.mVrSkyCol.g; - color.b = g_env_light.mVrSkyCol.b; + color.r = g_env_light.vrbox_sky_col.r; + color.g = g_env_light.vrbox_sky_col.g; + color.b = g_env_light.vrbox_sky_col.b; color.a = 255; material_0->setTevColor(0, &color); } @@ -95,10 +95,10 @@ static int daVrbox_color_set(vrbox_class* i_this) { material_1->setCullMode(0); material_1->change(); - color.r = g_env_light.mVrOkuKasumiCol.r; - color.g = g_env_light.mVrOkuKasumiCol.g; - color.b = g_env_light.mVrOkuKasumiCol.b; - color.a = g_env_light.mVrOkuKasumiCol.a; + color.r = g_env_light.vrbox_kasumi_inner_col.r; + color.g = g_env_light.vrbox_kasumi_inner_col.g; + color.b = g_env_light.vrbox_kasumi_inner_col.b; + color.a = g_env_light.vrbox_kasumi_inner_col.a; material_1->setTevColor(0, &color); } @@ -142,7 +142,7 @@ static int daVrbox_Create(fopAc_ac_c* i_this) { if (fopAcM_entrySolidHeap(this_, daVrbox_solidHeapCB, 0xC60)) { dComIfGp_onStatus(1); - g_env_light.mVrboxInvisible = false; + g_env_light.hide_vrbox = false; } else { phase = cPhs_ERROR_e; } diff --git a/src/d/actor/d_a_vrbox2.cpp b/src/d/actor/d_a_vrbox2.cpp index bad20117af..2ded84120c 100644 --- a/src/d/actor/d_a_vrbox2.cpp +++ b/src/d/actor/d_a_vrbox2.cpp @@ -240,10 +240,10 @@ static int daVrbox2_Draw(vrbox2_class* i_this) { fogInfo_p->mType = 2; } - if ((g_env_light.mVrKasumiCol.r + g_env_light.mVrKasumiCol.g + - g_env_light.mVrKasumiCol.b + g_env_light.mVrSkyCol.r + g_env_light.mVrSkyCol.g + - g_env_light.mVrSkyCol.b + g_env_light.mVrkumoCol.r + g_env_light.mVrkumoCol.g + - g_env_light.mVrkumoCol.b) == 0) + if ((g_env_light.vrbox_kasumi_outer_col.r + g_env_light.vrbox_kasumi_outer_col.g + + g_env_light.vrbox_kasumi_outer_col.b + g_env_light.vrbox_sky_col.r + g_env_light.vrbox_sky_col.g + + g_env_light.vrbox_sky_col.b + g_env_light.vrbox_kumo_top_col.r + g_env_light.vrbox_kumo_top_col.g + + g_env_light.vrbox_kumo_top_col.b) == 0) { return 1; } @@ -283,7 +283,7 @@ static int daVrbox2_Draw(vrbox2_class* i_this) { sp14 = sun_p->mPos[0]; if (strcmp(dComIfGp_getStartStageName(), "F_SP102") == 0) { - dKyr_get_vectle_calc(&camera_p->lookat.eye, &g_env_light.mSunPos, &sp8); + dKyr_get_vectle_calc(&camera_p->lookat.eye, &g_env_light.sun_pos, &sp8); sp14.x = camera_p->lookat.eye.x + (8000.0f * sp8.x); sp14.y = camera_p->lookat.eye.y + (8000.0f * sp8.y); sp14.z = camera_p->lookat.eye.z + (8000.0f * sp8.z); @@ -296,7 +296,7 @@ static int daVrbox2_Draw(vrbox2_class* i_this) { mDoMtx_stack_c::XrotM(0x7FFF - temp_r19); f32 scale; - if (g_env_light.mDaytime < 255.0f) { + if (g_env_light.daytime < 255.0f) { f32 temp_f4 = 1.0f - lenz_p->mDistFalloff; scale = 1.0f; @@ -305,8 +305,8 @@ static int daVrbox2_Draw(vrbox2_class* i_this) { } } else { f32 var_f1; - if (g_env_light.mDaytime < 270.0f) { - var_f1 = dKy_get_parcent(270.0f, 240.0f, g_env_light.mDaytime); + if (g_env_light.daytime < 270.0f) { + var_f1 = dKy_get_parcent(270.0f, 240.0f, g_env_light.daytime); } else { var_f1 = 1.0f; } @@ -420,10 +420,10 @@ SECTION_DEAD static char const* const stringBase_80499AD4 = "R_SP30"; static int daVrbox2_color_set(vrbox2_class* i_this) { dKankyo_sun_Packet* sun_p = g_env_light.mpSunPacket; - if ((g_env_light.mVrKasumiCol.r + g_env_light.mVrKasumiCol.g + - g_env_light.mVrKasumiCol.b + g_env_light.mVrSkyCol.r + g_env_light.mVrSkyCol.g + - g_env_light.mVrSkyCol.b + g_env_light.mVrkumoCol.r + g_env_light.mVrkumoCol.g + - g_env_light.mVrkumoCol.b) == 0) + if ((g_env_light.vrbox_kasumi_outer_col.r + g_env_light.vrbox_kasumi_outer_col.g + + g_env_light.vrbox_kasumi_outer_col.b + g_env_light.vrbox_sky_col.r + g_env_light.vrbox_sky_col.g + + g_env_light.vrbox_sky_col.b + g_env_light.vrbox_kumo_top_col.r + g_env_light.vrbox_kumo_top_col.g + + g_env_light.vrbox_kumo_top_col.b) == 0) { return 1; } @@ -500,16 +500,16 @@ static int daVrbox2_color_set(vrbox2_class* i_this) { kumo_material0->setCullMode(0); kumo_material0->change(); - k_color.r = g_env_light.mVrShitaGumoCol.r; - k_color.g = g_env_light.mVrShitaGumoCol.g; - k_color.b = g_env_light.mVrShitaGumoCol.b; - k_color.a = g_env_light.mVrkumoCol.a; + k_color.r = g_env_light.vrbox_kumo_bottom_col.r; + k_color.g = g_env_light.vrbox_kumo_bottom_col.g; + k_color.b = g_env_light.vrbox_kumo_bottom_col.b; + k_color.a = g_env_light.vrbox_kumo_top_col.a; kumo_material0->setTevKColor(0, &k_color); - color.r = g_env_light.mVrShitaUneiCol.r; - color.g = g_env_light.mVrShitaUneiCol.g; - color.b = g_env_light.mVrShitaUneiCol.b; - color.a = (u8)g_env_light.mVrkumoCol.a; + color.r = g_env_light.vrbox_kumo_shadow_col.r; + color.g = g_env_light.vrbox_kumo_shadow_col.g; + color.b = g_env_light.vrbox_kumo_shadow_col.b; + color.a = (u8)g_env_light.vrbox_kumo_top_col.a; kumo_material0->setTevColor(0, &color); } @@ -518,16 +518,16 @@ static int daVrbox2_color_set(vrbox2_class* i_this) { kumo_material1->setCullMode(0); kumo_material1->change(); - k_color.r = g_env_light.mVrShitaGumoCol.r; - k_color.g = g_env_light.mVrShitaGumoCol.g; - k_color.b = g_env_light.mVrShitaGumoCol.b; - k_color.a = g_env_light.mVrkumoCol.a; + k_color.r = g_env_light.vrbox_kumo_bottom_col.r; + k_color.g = g_env_light.vrbox_kumo_bottom_col.g; + k_color.b = g_env_light.vrbox_kumo_bottom_col.b; + k_color.a = g_env_light.vrbox_kumo_top_col.a; kumo_material1->setTevKColor(0, &k_color); - color.r = g_env_light.mVrShitaUneiCol.r; - color.g = g_env_light.mVrShitaUneiCol.g; - color.b = g_env_light.mVrShitaUneiCol.b; - color.a = g_env_light.mVrkumoCol.a; + color.r = g_env_light.vrbox_kumo_shadow_col.r; + color.g = g_env_light.vrbox_kumo_shadow_col.g; + color.b = g_env_light.vrbox_kumo_shadow_col.b; + color.a = g_env_light.vrbox_kumo_top_col.a; kumo_material1->setTevColor(0, &color); } @@ -537,10 +537,10 @@ static int daVrbox2_color_set(vrbox2_class* i_this) { kasumim_material0->setCullMode(0); kasumim_material0->change(); - color.r = g_env_light.mVrKasumiCol.r; - color.g = g_env_light.mVrKasumiCol.g; - color.b = g_env_light.mVrKasumiCol.b; - color.a = g_env_light.mVrKasumiCol.a; + color.r = g_env_light.vrbox_kasumi_outer_col.r; + color.g = g_env_light.vrbox_kasumi_outer_col.g; + color.b = g_env_light.vrbox_kasumi_outer_col.b; + color.a = g_env_light.vrbox_kasumi_outer_col.a; kasumim_material0->setTevColor(0, &color); } @@ -563,7 +563,7 @@ static int daVrbox2_color_set(vrbox2_class* i_this) { k_color.a = sun_p->field_0x74.a; if (i == 1) { - if (g_env_light.mDaytime > 255.0f || g_env_light.mDaytime < 97.5f) { + if (g_env_light.daytime > 255.0f || g_env_light.daytime < 97.5f) { cLib_addCalc(&sun_p->field_0x64, 1.0f, 0.2f, 0.1f, 0.0001f); } else { cLib_addCalc(&sun_p->field_0x64, 0.0f, 0.2f, 0.1f, 0.0001f); @@ -599,7 +599,7 @@ static int daVrbox2_color_set(vrbox2_class* param_0) { /* 804997E8-8049982C 000DE8 0044+00 1/0 0/0 0/0 .text daVrbox2_Execute__FP12vrbox2_class */ static int daVrbox2_Execute(vrbox2_class* i_this) { - if (g_env_light.mDaytime > FLOAT_LABEL(lit_3837)) { + if (g_env_light.daytime > FLOAT_LABEL(lit_3837)) { i_this->mSunBtk.play(); } diff --git a/src/d/actor/d_grass.inc b/src/d/actor/d_grass.inc index 236239b164..6dd01f54b1 100644 --- a/src/d/actor/d_grass.inc +++ b/src/d/actor/d_grass.inc @@ -270,7 +270,7 @@ void dGrass_packet_c::update() { mtx[1][3] = data_p->m_pos.y; mtx[2][3] = data_p->m_pos.z; - if (g_env_light.mInitAnmTimer == 1) { + if (g_env_light.light_init_timer == 1) { mAngleZ[i] = 0; } @@ -456,4 +456,4 @@ dGrass_data_c::~dGrass_data_c() {} /* 8052097C-80520988 004D1C 000C+00 1/1 0/0 0/0 .text __ct__13dGrass_data_cFv */ dGrass_data_c::dGrass_data_c() { m_state = 0; -} \ No newline at end of file +} diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index 029bdbf754..ecf756e756 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -764,7 +764,7 @@ int dComIfG_play_c::getLayerNo_common_common(const char* i_stageName, int i_room // Stage is Fishing Pond or Hena's Hut else if (!strcmp(i_stageName, "F_SP127") || !strcmp(i_stageName, "R_SP127")) { - switch (g_env_light.mPondSeason) { + switch (g_env_light.fishing_hole_season) { case 1: o_layer = 0; break; @@ -2296,7 +2296,7 @@ BOOL dComIfGs_wolfeye_effect_check() { dScnKy_env_light_c* env_light = dKy_getEnvlight(); BOOL ret = false; - if (env_light->field_0xf3d == 1 && env_light->field_0xf40 > 0.6) { + if (env_light->now_senses_effect == 1 && env_light->senses_effect_strength > 0.6) { ret = true; } return ret; @@ -2383,12 +2383,12 @@ BOOL dComIfGs_isVisitedRoom(int param_0) { /* 8002FCF4-8002FD08 02A634 0014+00 0/0 1/1 0/0 .text dComIfGs_staffroll_next_go__Fv */ void dComIfGs_staffroll_next_go() { - g_env_light.field_0x130c = true; + g_env_light.staffroll_next_timer = true; } /* 8002FD08-8002FD18 02A648 0010+00 0/0 1/1 0/0 .text dComIfGs_staffroll_next_go_check__Fv */ u8 dComIfGs_staffroll_next_go_check() { - return g_env_light.field_0x130c; + return g_env_light.staffroll_next_timer; } /* 80450608-8045060C 000088 0004+00 0/0 6/6 11/11 .sdata g_whiteColor */ diff --git a/src/d/d_demo.cpp b/src/d/d_demo.cpp index 5b43cb6996..095d087b8b 100644 --- a/src/d/d_demo.cpp +++ b/src/d/d_demo.cpp @@ -1118,13 +1118,13 @@ int dDemo_c::update() { dScnKy_env_light_c* env_light = &g_env_light; if (dComIfGs_staffroll_next_go_check() > 10) { - env_light->field_0x130c = 0; + env_light->staffroll_next_timer = 0; m_mode = 2; } else { if (dComIfGs_staffroll_next_go_check() == 1) { mDoGph_gInf_c::fadeOut(0.1f, g_blackColor); } - env_light->field_0x130c++; + env_light->staffroll_next_timer++; } } diff --git a/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index 2938215ae4..2c5f03cdd0 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -1212,7 +1212,7 @@ static void setkankyoShadow(dKy_tevstr_c* param_0, f32* param_1) { *param_1 *= env_light->field_0x1238; } - if ((env_light->mShadowMode & 4) && param_0 != NULL) { + if ((env_light->shadow_mode & 4) && param_0 != NULL) { *param_1 *= param_0->field_0x344; } @@ -1220,8 +1220,8 @@ static void setkankyoShadow(dKy_tevstr_c* param_0, f32* param_1) { *param_1 += env_light->mThunderEff.mFlashTimer; } - if (g_env_light.mSwordLight.mState == 2) { - f32 fvar1 = g_env_light.mSwordLight.mFrame / 15.0f; + if (g_env_light.eflight.mState == 2) { + f32 fvar1 = g_env_light.eflight.mFrame / 15.0f; if (fvar1 > 1.0f) { fvar1 = 1.0f; } @@ -1307,8 +1307,8 @@ u32 dDlst_shadowReal_c::set(u32 i_key, J3DModel* i_model, cXyz* param_2, f32 par } else { sp60 = dKy_plight_near_pos(); - if (!(env_light->mShadowMode & 4) && - ((env_light->mShadowMode & 1) || (env_light->mShadowMode & 2))) + if (!(env_light->shadow_mode & 4) && + ((env_light->shadow_mode & 1) || (env_light->shadow_mode & 2))) { sp60 = g_env_light.field_0x10a0; param_5->mLightPosWorld = g_env_light.field_0x10a0; diff --git a/src/d/d_kankyo.cpp b/src/d/d_kankyo.cpp index eebe0196eb..a54004be5b 100644 --- a/src/d/d_kankyo.cpp +++ b/src/d/d_kankyo.cpp @@ -1,24 +1,20 @@ -// -// Generated By: dol2asm -// Translation Unit: d/kankyo/d_kankyo -// - #include "d/d_kankyo.h" -#include "JSystem/J3DGraphBase/J3DMaterial.h" +#include #include "SSystem/SComponent/c_counter.h" #include "SSystem/SComponent/c_math.h" -#include "f_op/f_op_kankyo.h" -#include "d/actor/d_a_player.h" -#include "d/d_meter2_info.h" -#include "dol2asm.h" -#include "m_Do/m_Do_graphic.h" #include "d/actor/d_a_kytag08.h" +#include "d/actor/d_a_player.h" #include "d/d_kankyo_rain.h" #include "d/d_kankyo_static.h" +#include "d/d_meter2_info.h" #include "d/d_msg_object.h" -#include "string.h" +#include "f_op/f_op_kankyo.h" +#include "m_Do/m_Do_graphic.h" +#include "m_Do/m_Do_lib.h" -struct sub_kankyo__class {}; +static void GxXFog_set(); + +struct sub_kankyo__class : public kankyo_class {}; // setSunpos calls these functions as inlines somehow // these need to be moved to MSL_C once an appropriate solution is found @@ -31,15 +27,17 @@ inline float cosf(float x) { } /* 8019C388-8019C3A4 196CC8 001C+00 2/2 0/0 0/0 .text dKy_WolfPowerup_AmbCol__FP11_GXColorS10 */ -static void dKy_WolfPowerup_AmbCol(GXColorS10* in_col_p) { +void dKy_WolfPowerup_AmbCol(GXColorS10* in_col_p) { + JUT_ASSERT(185, in_col_p != 0); + in_col_p->r = 40; in_col_p->g = 52; in_col_p->b = 49; } /* 8019C3A4-8019CB0C 196CE4 0768+00 2/2 0/0 0/0 .text dKy_sense_pat_get__Fv */ -static s32 dKy_sense_pat_get() { - s32 pat = 0; +int dKy_sense_pat_get() { + int pat = 0; if (dKy_Outdoor_check()) { pat = 1; } else { @@ -51,7 +49,7 @@ static s32 dKy_sense_pat_get() { pat = 9; // Room is Lake - if (dComIfGp_roomControl_getStayNo() == 0 && dComIfGs_isSaveSwitch(0x11) && + if (dComIfGp_roomControl_getStayNo() == 0 && dComIfGs_isSaveSwitch(17) && !dComIfGs_isSaveSwitch(0x75)) { pat = 2; @@ -217,41 +215,84 @@ static s32 dKy_sense_pat_get() { pat = 11; } } + return pat; } -/* ############################################################################################## */ /* 803BBDB8-803BBDC4 018ED8 000C+00 1/1 0/0 0/0 .data cNullVec__6Z2Calc */ -SECTION_DATA static u8 cNullVec__6Z2Calc[12] = { +static u8 cNullVec__6Z2Calc[12] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; /* 803BBDC4-803BBEAC 018EE4 00E8+00 1/1 0/0 0/0 .data lightStatusBase */ -SECTION_DATA static u8 lightStatusBase[232] = { - 0xC7, 0x0E, 0x20, 0x80, 0x46, 0xE3, 0x51, 0x66, 0x46, 0x88, 0x1C, 0x66, 0x43, 0xBC, 0x80, 0x00, - 0x45, 0xA2, 0xBB, 0x33, 0x44, 0x98, 0x8C, 0xCD, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x3F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBF, 0x80, 0x00, 0x00, - 0xBF, 0x80, 0x00, 0x00, 0x42, 0xB4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0xFA, 0x00, 0x00, - 0x3F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0xA0, 0x00, 0x00, 0xC3, 0xA0, 0x00, 0x00, - 0x44, 0x7A, 0x00, 0x00, 0x48, 0x1C, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x09, 0x56, 0xB0, 0x40, 0x2E, 0x7E, 0x95, - 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, +static LightStatus lightStatusBase = { + {-36384.5f, 29096.699f, 17422.199f}, + {377.0f, 5207.3999f, 1220.4f}, + {0xFF, 0xFF, 0xFF, 0xFF}, + 0, + 1.0f, + 0.0f, + 0.0f, + 1.0f, + 0.0f, + 0.0f, + {0.0f, -1.0f, -1.0f}, + 90.0f, + GX_SP_OFF, + 500.0f, + 1.0f, + GX_DA_OFF, + { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + }, + 320.0f, + -320.0f, + 1000.0f, + 160000.0f, + { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + }, + 0.536479f, + 2.726476f, + 0.0f, + 0.5f, }; /* 803BBEAC-803BBEBC 018FCC 0010+00 4/4 0/0 0/0 .data lightMaskData */ -SECTION_DATA static u16 lightMaskData[8] = { +static u16 lightMaskData[8] = { GX_LIGHT0, GX_LIGHT1, GX_LIGHT2, GX_LIGHT3, GX_LIGHT4, GX_LIGHT5, GX_LIGHT6, GX_LIGHT7, }; /* 8019CB0C-8019CCDC 19744C 01D0+00 3/2 0/0 0/0 .text dKy_WolfPowerup_BgAmbCol__FP11_GXColorS10 */ -static void dKy_WolfPowerup_BgAmbCol(GXColorS10* in_col_p) { +void dKy_WolfPowerup_BgAmbCol(GXColorS10* in_col_p) { + JUT_ASSERT(374, in_col_p != 0); + switch (dKy_sense_pat_get()) { case 1: in_col_p->r = 33; @@ -329,7 +370,10 @@ static void dKy_WolfPowerup_BgAmbCol(GXColorS10* in_col_p) { /* 8019CCDC-8019CE5C 19761C 0180+00 4/3 0/0 0/0 .text dKy_WolfPowerup_FogNearFar__FPfPf */ -static void dKy_WolfPowerup_FogNearFar(f32* near_p, f32* far_p) { +void dKy_WolfPowerup_FogNearFar(f32* near_p, f32* far_p) { + JUT_ASSERT(499, near_p != 0); + JUT_ASSERT(500, far_p != 0); + switch (dKy_sense_pat_get()) { case 1: *near_p = 750.0f; @@ -395,21 +439,20 @@ static void dKy_WolfPowerup_FogNearFar(f32* near_p, f32* far_p) { } /* 8019CE5C-8019CFE4 19779C 0188+00 1/1 0/0 0/0 .text dKy_pos2_get_angle__FP4cXyzP4cXyzPsPs */ -static void dKy_pos2_get_angle(cXyz* param_0, cXyz* param_1, s16* param_2, s16* param_3) { - cXyz sp28; - sp28 = *param_0 - *param_1; +void dKy_pos2_get_angle(cXyz* pos1_p, cXyz* pos2_p, s16* pitch_p, s16* yaw_p) { + cXyz vec; + vec = *pos1_p - *pos2_p; - *param_2 = cM_atan2s(-sp28.y, sp28.absXZ()); - *param_3 = cM_atan2s(sp28.x, sp28.z); + *pitch_p = cM_atan2s(-vec.y, vec.absXZ()); + *yaw_p = cM_atan2s(vec.x, vec.z); } - /* 8042CA54-8042DD64 059774 1310+00 116/118 128/128 649/649 .bss g_env_light */ dScnKy_env_light_c g_env_light; /* 8019CFE4-8019D1A0 197924 01BC+00 4/4 0/0 0/0 .text dKy_twi_wolflight_set__Fi */ -static void dKy_twi_wolflight_set(int i_lightIdx) { - dScnKy_env_light_c* env_light = dKy_getEnvlight(); +void dKy_twi_wolflight_set(int light_id) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); camera_class* camera_p = dComIfGp_getCamera(0); cXyz vectle; @@ -417,104 +460,104 @@ static void dKy_twi_wolflight_set(int i_lightIdx) { return; } - s16 spA; - s16 sp8; - dKy_pos2_get_angle(&camera_p->lookat.center, &camera_p->lookat.eye, &spA, &sp8); + s16 angle_x; + s16 angle_y; + dKy_pos2_get_angle(&camera_p->lookat.center, &camera_p->lookat.eye, &angle_x, &angle_y); dKyr_get_vectle_calc(&camera_p->lookat.center, &camera_p->lookat.eye, &vectle); - env_light->field_0x0c18[i_lightIdx].mPos.x = camera_p->lookat.eye.x + vectle.x * 300.0f; - env_light->field_0x0c18[i_lightIdx].mPos.y = camera_p->lookat.eye.y + vectle.y * 300.0f; - env_light->field_0x0c18[i_lightIdx].mPos.z = camera_p->lookat.eye.z + vectle.z * 300.0f; + kankyo->field_0x0c18[light_id].mPos.x = camera_p->lookat.eye.x + vectle.x * 300.0f; + kankyo->field_0x0c18[light_id].mPos.y = camera_p->lookat.eye.y + vectle.y * 300.0f; + kankyo->field_0x0c18[light_id].mPos.z = camera_p->lookat.eye.z + vectle.z * 300.0f; - switch (g_env_light.field_0x1309) { - case 0: - env_light->field_0x0c18[i_lightIdx].mPos.y += 1500.0f; + switch (g_env_light.light_size) { + case LIGHT_SIZE_S: + kankyo->field_0x0c18[light_id].mPos.y += 1500.0f; break; - case 1: - env_light->field_0x0c18[i_lightIdx].mPos.y += 500.0f; + case LIGHT_SIZE_M: + kankyo->field_0x0c18[light_id].mPos.y += 500.0f; break; - case 2: - env_light->field_0x0c18[i_lightIdx].mPos.y += 1000.0f; + case LIGHT_SIZE_L: + kankyo->field_0x0c18[light_id].mPos.y += 1000.0f; break; - case 3: - env_light->field_0x0c18[i_lightIdx].mPos.y += 1500.0f; + case LIGHT_SIZE_LL: + kankyo->field_0x0c18[light_id].mPos.y += 1500.0f; break; default: - env_light->field_0x0c18[i_lightIdx].mPos.y += 500.0f; + kankyo->field_0x0c18[light_id].mPos.y += 500.0f; break; } - spA += 6000; - env_light->field_0x0c18[i_lightIdx].mAngleX = cM_sht2d(-spA); - env_light->field_0x0c18[i_lightIdx].mAngleY = cM_sht2d(-sp8) + 90.0f; + angle_x += 6000; + kankyo->field_0x0c18[light_id].mAngleX = cM_sht2d(-angle_x); + kankyo->field_0x0c18[light_id].mAngleY = cM_sht2d(-angle_y) + 90.0f; } /* 8019D1A0-8019D2C4 197AE0 0124+00 3/3 0/0 0/0 .text dKy_lightdir_set__FffP3Vec */ -static void dKy_lightdir_set(f32 param_0, f32 param_1, Vec* param_2) { +void dKy_lightdir_set(f32 angle_x, f32 angle_y, Vec* out_dir_p) { MtxP view_mtx = j3dSys.getViewMtx(); - Mtx sp20; - Vec sp14; - cXyz sp8; + Mtx inv; + Vec calc_dir; + cXyz dir; - f32 deg0 = RAD_TO_DEG(param_0); - f32 deg1 = RAD_TO_DEG(param_1); - sp8.x = cM_fcos(deg0) * cM_fcos(deg1); - sp8.y = cM_fsin(deg0); - sp8.z = cM_fcos(deg0) * cM_fsin(deg1); + f32 x_deg = RAD_TO_DEG(angle_x); + f32 y_deg = RAD_TO_DEG(angle_y); + dir.x = cM_fcos(x_deg) * cM_fcos(y_deg); + dir.y = cM_fsin(x_deg); + dir.z = cM_fcos(x_deg) * cM_fsin(y_deg); - mDoMtx_inverseTranspose(view_mtx, sp20); - cMtx_multVec(sp20, &sp8, &sp14); + mDoMtx_inverseTranspose(view_mtx, inv); + cMtx_multVec(inv, &dir, &calc_dir); - param_2->x = sp14.x; - param_2->y = sp14.y; - param_2->z = sp14.z; + out_dir_p->x = calc_dir.x; + out_dir_p->y = calc_dir.y; + out_dir_p->z = calc_dir.z; } /* 8019D2C4-8019D44C 197C04 0188+00 3/2 0/0 0/0 .text dKy_GXInitLightSpot__FP12J3DLightInfofUc */ -static void dKy_GXInitLightSpot(J3DLightInfo* param_0, f32 param_1, u8 param_2) { - if (param_1 <= 0.0f || param_1 > 90.0f) { - param_2 = 0; +void dKy_GXInitLightSpot(J3DLightInfo* light_p, f32 cutoff, u8 spot_type) { + if (cutoff <= 0.0f || cutoff > 90.0f) { + spot_type = GX_SP_OFF; } f32 temp_f1; - f32 var_f4 = cosf((param_1 * M_PI) / 180.0f); + f32 var_f4 = cosf((cutoff * M_PI) / 180.0f); f32 x, y, z; - switch (param_2) { - case 1: + switch (spot_type) { + case GX_SP_FLAT: x = var_f4 * -1000.0f; y = 1000.0f; z = 0.0f; break; - case 2: + case GX_SP_COS: x = -var_f4 / (1.0f - var_f4); y = 1.0f / (1.0f - var_f4); z = 0.0f; break; - case 3: + case GX_SP_COS2: x = 0.0f; y = -var_f4 / (1.0f - var_f4); z = 1.0f / (1.0f - var_f4); break; - case 4: + case GX_SP_SHARP: temp_f1 = ((1.0f - var_f4) * (1.0f - var_f4)); x = (var_f4 * (var_f4 - 2.0f)) / temp_f1; y = 2.0f / temp_f1; z = -1.0f / temp_f1; break; - case 5: + case GX_SP_RING1: temp_f1 = ((1.0f - var_f4) * (1.0f - var_f4)); x = (var_f4 * -4.0f) / temp_f1; y = ((var_f4 + 1.0f) * 4.0f) / temp_f1; z = -4.0f / temp_f1; break; - case 6: + case GX_SP_RING2: temp_f1 = ((1.0f - var_f4) * (1.0f - var_f4)); x = 1.0f - (var_f4 * 2.0f * var_f4) / temp_f1; y = (var_f4 * 4.0f) / temp_f1; z = -2.0f / temp_f1; break; - case 0: + case GX_SP_OFF: default: x = 1.0f; y = 0.0f; @@ -522,260 +565,269 @@ static void dKy_GXInitLightSpot(J3DLightInfo* param_0, f32 param_1, u8 param_2) break; } - param_0->mCosAtten.x = x; - param_0->mCosAtten.y = y; - param_0->mCosAtten.z = z; + light_p->mCosAtten.x = x; + light_p->mCosAtten.y = y; + light_p->mCosAtten.z = z; } /* 8019D44C-8019D520 197D8C 00D4+00 2/2 0/0 0/0 .text * dKy_GXInitLightDistAttn__FP12J3DLightInfoffUc */ -static void dKy_GXInitLightDistAttn(J3DLightInfo* i_info, f32 param_1, f32 param_2, u8 param_3) { +void dKy_GXInitLightDistAttn(J3DLightInfo* light_p, f32 param_1, f32 param_2, u8 distattn_type) { f32 temp_f3; - f32 var_f0; - f32 var_f4; - f32 var_f5; + f32 z; + f32 x; + f32 y; if (param_1 < 0.0f) { - param_3 = 0; + distattn_type = GX_DA_OFF; } if (param_2 <= 0.0f || param_2 >= 1.0f) { - param_3 = 0; + distattn_type = GX_DA_OFF; } - switch (param_3) { /* irregular */ - case 1: - var_f4 = 1.0f; - var_f5 = (1.0f - param_2) / (param_2 * param_1); - var_f0 = 0.0f; + switch (distattn_type) { + case GX_DA_GENTLE: + x = 1.0f; + y = (1.0f - param_2) / (param_2 * param_1); + z = 0.0f; break; - case 2: - var_f4 = 1.0f; + case GX_DA_MEDIUM: + x = 1.0f; temp_f3 = (1.0f - param_2) * 0.5f; - var_f5 = temp_f3 / (param_2 * param_1); - var_f0 = temp_f3 / (param_1 * param_2 * param_1); + y = temp_f3 / (param_2 * param_1); + z = temp_f3 / (param_1 * param_2 * param_1); break; - case 3: - var_f4 = 1.0f; - var_f5 = 0.0f; - var_f0 = (1.0f - param_2) / (param_1 * (param_2 * param_1)); + case GX_DA_STEEP: + x = 1.0f; + y = 0.0f; + z = (1.0f - param_2) / (param_1 * (param_2 * param_1)); break; default: - case 0: - var_f4 = 1.0f; - var_f5 = 0.0f; - var_f0 = var_f5; + case GX_DA_OFF: + x = 1.0f; + y = 0.0f; + z = 0.0f; break; } - i_info->mDistAtten.x = var_f4; - i_info->mDistAtten.y = var_f5; - i_info->mDistAtten.z = var_f0; + light_p->mDistAtten.x = x; + light_p->mDistAtten.y = y; + light_p->mDistAtten.z = z; } /* 8019D520-8019D56C 197E60 004C+00 1/1 0/0 0/0 .text u8_data_ratio_set__FUcUcf */ -static s16 u8_data_ratio_set(u8 param_0, u8 param_1, f32 param_2) { - return param_0 + (int)(param_2 * (param_1 - param_0)); +static s16 u8_data_ratio_set(u8 start, u8 end, f32 ratio) { + return start + (int)(ratio * (end - start)); } /* 8019D56C-8019D5BC 197EAC 0050+00 1/1 0/0 0/0 .text s16_data_ratio_set__Fssf */ -static s16 s16_data_ratio_set(s16 param_0, s16 param_1, f32 param_2) { - return param_0 + (s16)(param_2 * (param_1 - param_0)); +static s16 s16_data_ratio_set(s16 start, s16 end, f32 ratio) { + return start + (s16)(ratio * (end - start)); } /* 8019D5BC-8019D61C 197EFC 0060+00 1/1 0/0 0/0 .text kankyo_color_ratio_calc_common__Fsf */ -static u8 kankyo_color_ratio_calc_common(s16 param_0, f32 param_1) { - s16 color = param_0 * param_1; +static u8 kankyo_color_ratio_calc_common(s16 color, f32 ratio) { + s16 calc = color * ratio; - if (color < 0) { - color = 0; - } else if (color > 255) { - color = 255; + if (calc < 0) { + calc = 0; + } else if (calc > 255) { + calc = 255; } - return color; + return calc; } /* 8019D61C-8019D68C 197F5C 0070+00 1/1 0/0 0/0 .text * kankyo_color_ratio_calc__FP8_GXColor11_GXColorS10f */ -static void kankyo_color_ratio_calc(GXColor* o_color, GXColorS10 param_1, f32 param_2) { - f32 ratio = param_2; - s16 g = param_1.g; - s16 b = param_1.b; +static void kankyo_color_ratio_calc(GXColor* out_col_p, GXColorS10 color, f32 ratio) { + GXColorS10 work_color; + work_color = color; - o_color->r = kankyo_color_ratio_calc_common(param_1.r, ratio); - o_color->g = kankyo_color_ratio_calc_common(g, ratio); - o_color->b = kankyo_color_ratio_calc_common(b, ratio); + out_col_p->r = kankyo_color_ratio_calc_common(work_color.r, ratio); + out_col_p->g = kankyo_color_ratio_calc_common(work_color.g, ratio); + out_col_p->b = kankyo_color_ratio_calc_common(work_color.b, ratio); } /* 8019D68C-8019D790 197FCC 0104+00 2/2 0/0 0/0 .text kankyo_color_ratio_set__FUcUcfUcUcfsf */ -// NONMATCHING one wrong reg -static s16 kankyo_color_ratio_set(u8 i_b0A, u8 i_b0B, f32 i_blendAB0, u8 i_b1A, u8 i_b1B, - f32 i_blendAB1, s16 i_add, f32 i_mul) { - s16 a = s16_data_ratio_set(i_b0A, i_b0B, i_blendAB0); - s16 b = s16_data_ratio_set(i_b1A, i_b1B, i_blendAB0); - s16 tmp = s16_data_ratio_set(a, b, i_blendAB1); - s16 rt = dKy_getEnvlight()->mColAllcolRatio * i_mul * (s16)(tmp + i_add); +static s16 kankyo_color_ratio_set(u8 color_a_start, u8 color_a_end, f32 color_ratio, + u8 color_b_start, u8 color_b_end, f32 blend_ratio, s16 add_color, + f32 scale) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); - if (rt < 0) { - rt = 0; + s16 a = s16_data_ratio_set(color_a_start, color_a_end, color_ratio); + s16 b = s16_data_ratio_set(color_b_start, color_b_end, color_ratio); + s16 blend_color = s16_data_ratio_set(a, b, blend_ratio); + blend_color += add_color; + + s16 calc_color = kankyo->now_allcol_ratio * scale * blend_color; + + if (calc_color < 0) { + calc_color = 0; } - if (rt > 0xFF) { - rt = 0xFF; + if (calc_color > 255) { + calc_color = 255; } - return rt; + return calc_color; } /* 8019D790-8019D7A0 1980D0 0010+00 1/1 0/0 0/0 .text fl_data_ratio_set__Ffff */ -static f32 fl_data_ratio_set(f32 param_0, f32 param_1, f32 param_2) { - return param_0 + param_2 * (param_1 - param_0); +static f32 fl_data_ratio_set(f32 start, f32 end, f32 ratio) { + return start + ratio * (end - start); } /* 8019D7A0-8019D878 1980E0 00D8+00 3/3 0/0 0/0 .text float_kankyo_color_ratio_set__Fffffffff */ -static f32 float_kankyo_color_ratio_set(f32 param_0, f32 param_1, f32 param_2, f32 param_3, - f32 param_4, f32 param_5, f32 param_6, f32 param_7) { - f32 temp_f1; - f32 temp_f31; +static f32 float_kankyo_color_ratio_set(f32 color_a_start, f32 color_a_end, f32 color_ratio, + f32 color_b_start, f32 color_b_end, f32 blend_ratio, + f32 param_6, f32 param_7) { + f32 a = fl_data_ratio_set(color_a_start, color_a_end, color_ratio); + f32 b = fl_data_ratio_set(color_b_start, color_b_end, color_ratio); + f32 calc_color = fl_data_ratio_set(a, b, blend_ratio); + calc_color += param_7 * (param_6 - calc_color); - temp_f31 = fl_data_ratio_set(param_0, param_1, param_2); - temp_f1 = fl_data_ratio_set(temp_f31, fl_data_ratio_set(param_3, param_4, param_2), param_5); - return temp_f1 + (param_7 * (param_6 - temp_f1)); + return calc_color; } /* 8019D878-8019D8AC 1981B8 0034+00 3/3 0/0 0/0 .text get_parcent__Ffff */ -static f32 get_parcent(f32 param_0, f32 param_1, f32 param_2) { - f32 temp_f1; - f32 temp_f2; - f32 temp_f4 = param_0 - param_1; +static f32 get_parcent(f32 max, f32 min, f32 value) { + f32 range = max - min; - if (0.0f != temp_f4) { - temp_f1 = 1.0f - (param_0 - param_2) / temp_f4; - if (!(temp_f1 >= 1.0f)) { - return temp_f1; + if (0.0f != range) { + f32 diff = max - value; + f32 parcent = 1.0f - (diff / range); + if (!(parcent >= 1.0f)) { + return parcent; } } + return 1.0f; } /* 8019D8AC-8019D8CC 1981EC 0020+00 0/0 1/1 1/1 .text dKy_get_parcent__Ffff */ -f32 dKy_get_parcent(f32 param_0, f32 param_1, f32 param_2) { - return get_parcent(param_0, param_1, param_2); +f32 dKy_get_parcent(f32 max, f32 min, f32 value) { + return get_parcent(max, min, value); } /* 8019D8CC-8019DD4C 19820C 0480+00 1/1 0/0 0/0 .text dKy_FiveSenses_fullthrottle_dark_static1__Fv */ static void dKy_FiveSenses_fullthrottle_dark_static1() { - dScnKy_env_light_c* env_light = dKy_getEnvlight(); - int temp_r30 = 0; + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + BOOL init_mode_change = FALSE; - cXyz sp18; - cXyz spC; + cXyz particle_pos; + cXyz particle_size; - sp18.x = 0.0f; - sp18.y = 0.0f; - sp18.z = 0.0f; - spC.x = 1.0f; - spC.y = 1.0f; - spC.z = 1.0f; + particle_pos.x = 0.0f; + particle_pos.y = 0.0f; + particle_pos.z = 0.0f; + + particle_size.x = 1.0f; + particle_size.y = 1.0f; + particle_size.z = 1.0f; if (daPy_py_c::checkNowWolfPowerUp()) { - env_light->field_0xf3d = 1; - temp_r30 = 1; + kankyo->now_senses_effect = 1; + init_mode_change = TRUE; - if (env_light->field_0xf40 <= 0.0f) { - dComIfGp_particle_set(0x1E3, &sp18, NULL, NULL, &spC); + if (kankyo->senses_effect_strength <= 0.0f) { + dComIfGp_particle_set(0x1E3, &particle_pos, NULL, NULL, &particle_size); } - cLib_addCalc(&env_light->field_0xf40, 1.0f, 0.5f, 0.1f, 0.01f); - } else if (env_light->field_0xf40 > 0.0f) { - if (env_light->field_0xf40 >= 1.0f) { - dComIfGp_particle_set(0x46A, &sp18, NULL, NULL, &spC); + cLib_addCalc(&kankyo->senses_effect_strength, 1.0f, 0.5f, 0.1f, 0.01f); + } else if (kankyo->senses_effect_strength > 0.0f) { + if (kankyo->senses_effect_strength >= 1.0f) { + dComIfGp_particle_set(0x46A, &particle_pos, NULL, NULL, &particle_size); } - cLib_addCalc(&env_light->field_0xf40, 0.0f, 0.5f, 0.1f, 0.01f); - temp_r30 = 1; + cLib_addCalc(&kankyo->senses_effect_strength, 0.0f, 0.5f, 0.1f, 0.01f); + init_mode_change = TRUE; } - switch (env_light->field_0xf3c) { + switch (kankyo->senses_mode) { case 0: - if (temp_r30 == 1) { - env_light->field_0xf44 = NULL; - env_light->field_0xf48 = NULL; - env_light->field_0xf4c = NULL; + if (init_mode_change != TRUE) { + break; + } - env_light->field_0xf44 = dComIfGp_particle_set(0x1F2, &sp18, NULL, NULL); - env_light->field_0xf48 = dComIfGp_particle_set(0x1F3, &sp18, NULL, NULL, &spC); - env_light->field_0xf4c = dComIfGp_particle_set(0x1F4, &sp18, NULL, NULL, &spC); - env_light->field_0xf3c += 1; - case 1: - if (temp_r30 == 1) { - if (env_light->field_0xf44 != NULL) { - env_light->field_0xf44->setGlobalTranslation(sp18.x, sp18.y, sp18.z); - env_light->field_0xf44->setGlobalAlpha(env_light->field_0xf40 * 255.0f); - } + kankyo->senses_ef_emitter0 = NULL; + kankyo->senses_ef_emitter1 = NULL; + kankyo->senses_ef_emitter2 = NULL; - if (env_light->field_0xf48 != NULL) { - env_light->field_0xf48->setGlobalTranslation(sp18.x, sp18.y, sp18.z); - env_light->field_0xf48->setGlobalAlpha(env_light->field_0xf40 * 255.0f); - } - - if (env_light->field_0xf4c != NULL) { - env_light->field_0xf4c->setGlobalTranslation(sp18.x, sp18.y, sp18.z); - - env_light->field_0xf4c->setGlobalEnvColor( - 255.0f * (1.0f - env_light->field_0xf40), - 255.0f * (1.0f - env_light->field_0xf40), - 255.0f * (1.0f - env_light->field_0xf40)); - } - } else { - env_light->field_0xf3c += 1; + kankyo->senses_ef_emitter0 = dComIfGp_particle_set(0x1F2, &particle_pos, NULL, NULL); + kankyo->senses_ef_emitter1 = dComIfGp_particle_set(0x1F3, &particle_pos, NULL, NULL, &particle_size); + kankyo->senses_ef_emitter2 = dComIfGp_particle_set(0x1F4, &particle_pos, NULL, NULL, &particle_size); + kankyo->senses_mode++; + case 1: + if (init_mode_change == TRUE) { + if (kankyo->senses_ef_emitter0 != NULL) { + kankyo->senses_ef_emitter0->setGlobalTranslation(particle_pos.x, particle_pos.y, + particle_pos.z); + kankyo->senses_ef_emitter0->setGlobalAlpha(kankyo->senses_effect_strength * 255.0f); } + + if (kankyo->senses_ef_emitter1 != NULL) { + kankyo->senses_ef_emitter1->setGlobalTranslation(particle_pos.x, particle_pos.y, + particle_pos.z); + kankyo->senses_ef_emitter1->setGlobalAlpha(kankyo->senses_effect_strength * 255.0f); + } + + if (kankyo->senses_ef_emitter2 != NULL) { + kankyo->senses_ef_emitter2->setGlobalTranslation(particle_pos.x, particle_pos.y, + particle_pos.z); + + kankyo->senses_ef_emitter2->setGlobalEnvColor( + 255.0f * (1.0f - kankyo->senses_effect_strength), + 255.0f * (1.0f - kankyo->senses_effect_strength), + 255.0f * (1.0f - kankyo->senses_effect_strength)); + } + } else { + kankyo->senses_mode++; } break; case 2: - if (env_light->field_0xf44 != NULL) { - env_light->field_0xf44->deleteAllParticle(); - env_light->field_0xf44->becomeInvalidEmitter(); - env_light->field_0xf44->quitImmortalEmitter(); - env_light->field_0xf44->setEmitterCallBackPtr(NULL); - env_light->field_0xf44 = NULL; + if (kankyo->senses_ef_emitter0 != NULL) { + kankyo->senses_ef_emitter0->deleteAllParticle(); + kankyo->senses_ef_emitter0->becomeInvalidEmitter(); + kankyo->senses_ef_emitter0->quitImmortalEmitter(); + kankyo->senses_ef_emitter0->setEmitterCallBackPtr(NULL); + kankyo->senses_ef_emitter0 = NULL; } - if (env_light->field_0xf48 != NULL) { - env_light->field_0xf48->deleteAllParticle(); - env_light->field_0xf48->becomeInvalidEmitter(); - env_light->field_0xf48->quitImmortalEmitter(); - env_light->field_0xf48->setEmitterCallBackPtr(NULL); - env_light->field_0xf48 = NULL; + if (kankyo->senses_ef_emitter1 != NULL) { + kankyo->senses_ef_emitter1->deleteAllParticle(); + kankyo->senses_ef_emitter1->becomeInvalidEmitter(); + kankyo->senses_ef_emitter1->quitImmortalEmitter(); + kankyo->senses_ef_emitter1->setEmitterCallBackPtr(NULL); + kankyo->senses_ef_emitter1 = NULL; } - if (env_light->field_0xf4c != NULL) { - env_light->field_0xf4c->deleteAllParticle(); - env_light->field_0xf4c->becomeInvalidEmitter(); - env_light->field_0xf4c->quitImmortalEmitter(); - env_light->field_0xf4c->setEmitterCallBackPtr(NULL); - env_light->field_0xf4c = NULL; + if (kankyo->senses_ef_emitter2 != NULL) { + kankyo->senses_ef_emitter2->deleteAllParticle(); + kankyo->senses_ef_emitter2->becomeInvalidEmitter(); + kankyo->senses_ef_emitter2->quitImmortalEmitter(); + kankyo->senses_ef_emitter2->setEmitterCallBackPtr(NULL); + kankyo->senses_ef_emitter2 = NULL; } - env_light->field_0xf3c = 0; + kankyo->senses_mode = 0; break; } } - /* 8019DD4C-8019DD6C 19868C 0020+00 0/0 1/1 0/0 .text dKy_FiveSenses_fullthrottle_dark__Fv */ void dKy_FiveSenses_fullthrottle_dark() { dKy_FiveSenses_fullthrottle_dark_static1(); } /* 8019DD6C-8019E13C 1986AC 03D0+00 3/3 0/0 0/0 .text dKy_light_influence_id__F4cXyzi */ -static int dKy_light_influence_id(cXyz param_0, int param_1) { - f32 var_f31 = 1000000.0f; +int dKy_light_influence_id(cXyz position, int param_1) { + f32 closest_plight_dist = 1000000.0f; - int var_r28 = -1; + int closest_plight_no = -1; int var_r27 = -1; int j; int var_r25 = -1; @@ -788,29 +840,29 @@ static int dKy_light_influence_id(cXyz param_0, int param_1) { for (i = 0; i <= param_1; i++) { for (j = 0; j < 100; j++) { - if (g_env_light.mPointLight[j] != NULL && (i == 0 || j != var_r28) && - g_env_light.mPointLight[j]->mPow > 0.01f) + if (g_env_light.pointlight[j] != NULL && (i == 0 || j != closest_plight_no) && + g_env_light.pointlight[j]->mPow > 0.01f) { - if (var_f31 > param_0.abs(g_env_light.mPointLight[j]->mPosition)) { - if (g_env_light.mPointLight[j]->mIndex & 0x8000) { - if (var_f31 > var_f30) { + if (closest_plight_dist > position.abs(g_env_light.pointlight[j]->mPosition)) { + if (g_env_light.pointlight[j]->mIndex & 0x8000) { + if (closest_plight_dist > var_f30) { if (i == 0) { - var_r28 = j; + closest_plight_no = j; } if (i != 0) { var_r27 = j; } - var_f31 = var_f30; + closest_plight_dist = var_f30; } } else { - var_f31 = param_0.abs(g_env_light.mPointLight[j]->mPosition); - if (var_f31 < g_env_light.mPointLight[j]->mPow) { + closest_plight_dist = position.abs(g_env_light.pointlight[j]->mPosition); + if (closest_plight_dist < g_env_light.pointlight[j]->mPow) { if (strcmp(dComIfGp_getStartStageName(), "D_MN05") == 0 && dComIfGp_roomControl_getStayNo() == 0) { - if (var_f31 < g_env_light.mPointLight[j]->mPow * 0.5f) { + if (closest_plight_dist < g_env_light.pointlight[j]->mPow * 0.5f) { var_r25 = 99; } } else { @@ -820,7 +872,7 @@ static int dKy_light_influence_id(cXyz param_0, int param_1) { if (var_r25 != -2) { if (i == 0) { - var_r28 = j; + closest_plight_no = j; } else { var_r27 = j; } @@ -828,20 +880,20 @@ static int dKy_light_influence_id(cXyz param_0, int param_1) { } } - if (g_env_light.mPointLight[j]->mIndex < 0 && var_r25 != 99) { + if (g_env_light.pointlight[j]->mIndex < 0 && var_r25 != 99) { if (i == 0) { - var_r28 = j; + closest_plight_no = j; } var_r25 = -2; } } } - var_f31 = 1000000.0f; + closest_plight_dist = 1000000.0f; } if (param_1 == 0) { - return var_r28; + return closest_plight_no; } else { return var_r27; } @@ -849,7 +901,7 @@ static int dKy_light_influence_id(cXyz param_0, int param_1) { /* 8019E13C-8019E404 198A7C 02C8+00 2/2 0/0 0/0 .text dKy_eflight_influence_id__F4cXyzi */ -static int dKy_eflight_influence_id(cXyz param_0, int param_1) { +int dKy_eflight_influence_id(cXyz position, int param_1) { f32 var_f31 = 1000000.0f; int var_r28 = -1; @@ -858,11 +910,11 @@ static int dKy_eflight_influence_id(cXyz param_0, int param_1) { for (i = 0; i <= param_1; i++) { for (j = 0; j < 5; j++) { - if (g_env_light.mEfPLight[j] != NULL && (i == 0 || j != var_r28)) { - if (var_f31 > param_0.abs(g_env_light.mEfPLight[j]->mPosition) && - g_env_light.mEfPLight[j]->mPow > 0.01f) + if (g_env_light.efplight[j] != NULL && (i == 0 || j != var_r28)) { + if (var_f31 > position.abs(g_env_light.efplight[j]->mPosition) && + g_env_light.efplight[j]->mPow > 0.01f) { - var_f31 = param_0.abs(g_env_light.mEfPLight[j]->mPosition); + var_f31 = position.abs(g_env_light.efplight[j]->mPosition); if (i == 0) { var_r28 = j; @@ -883,54 +935,54 @@ static int dKy_eflight_influence_id(cXyz param_0, int param_1) { } /* 8019E404-8019E430 198D44 002C+00 1/1 0/0 0/0 .text dKy_light_influence_col__Fi */ -static GXColorS10 dKy_light_influence_col(int param_0) { - dScnKy_env_light_c* env_light = &g_env_light; - return env_light->mPointLight[param_0 >= 0 ? param_0 : 0]->mColor; +GXColorS10 dKy_light_influence_col(int light_id) { + dScnKy_env_light_c* kankyo = &g_env_light; + return kankyo->pointlight[light_id >= 0 ? light_id : 0]->mColor; } /* 8019E430-8019E520 198D70 00F0+00 4/4 3/3 0/0 .text dKy_light_influence_col__FP8_GXColorf */ -GXColor dKy_light_influence_col(GXColor* i_color, f32 param_1) { - GXColor out_color; +GXColor dKy_light_influence_col(GXColor* in_col_p, f32 ratio) { + GXColor out_col; - f32 r = i_color->r * param_1; + f32 r = in_col_p->r * ratio; if (r <= 255.0f) { - out_color.r = r; + out_col.r = r; } else { - out_color.r = 255; + out_col.r = 255; } - f32 g = i_color->g * param_1; + f32 g = in_col_p->g * ratio; if (g <= 255.0f) { - out_color.g = g; + out_col.g = g; } else { - out_color.g = 255; + out_col.g = 255; } - f32 b = i_color->b * param_1; + f32 b = in_col_p->b * ratio; if (b <= 255.0f) { - out_color.b = b; + out_col.b = b; } else { - out_color.b = 255; + out_col.b = 255; } - return out_color; + return out_col; } /* 8019E520-8019E548 198E60 0028+00 1/1 0/0 0/0 .text dKy_light_influence_power__Fi */ -static f32 dKy_light_influence_power(int param_0) { - dScnKy_env_light_c* env_light = &g_env_light; - return env_light->mPointLight[param_0 >= 0 ? param_0 : 0]->mPow; +f32 dKy_light_influence_power(int light_id) { + dScnKy_env_light_c* kankyo = &g_env_light; + return kankyo->pointlight[light_id >= 0 ? light_id : 0]->mPow; } /* 8019E548-8019E570 198E88 0028+00 1/1 0/0 0/0 .text dKy_light_influence_yuragi__Fi */ -static f32 dKy_light_influence_yuragi(int param_0) { - dScnKy_env_light_c* env_light = &g_env_light; - return env_light->mPointLight[param_0 >= 0 ? param_0 : 0]->mFluctuation; +f32 dKy_light_influence_yuragi(int light_id) { + dScnKy_env_light_c* kankyo = &g_env_light; + return kankyo->pointlight[light_id >= 0 ? light_id : 0]->mFluctuation; } /* 8019E570-8019E694 198EB0 0124+00 1/1 0/0 0/0 .text dKy_light_influence_distance__F4cXyzi */ -static f32 dKy_light_influence_distance(cXyz param_0, int i_lightIdx) { - return param_0.abs(g_env_light.mPointLight[i_lightIdx >= 0 ? i_lightIdx : 0]->mPosition); +f32 dKy_light_influence_distance(cXyz position, int light_id) { + return position.abs(g_env_light.pointlight[light_id >= 0 ? light_id : 0]->mPosition); } /* 8019E694-8019E708 198FD4 0074+00 2/2 0/0 0/0 .text plight_init__Fv */ @@ -938,12 +990,12 @@ static void plight_init() { g_env_light.mLightInfluence[0].mPow = 99999.9f; for (int i = 0; i < 100; i++) { - g_env_light.mPointLight[i] = NULL; + g_env_light.pointlight[i] = NULL; } for (int i = 0; i < 5; i++) { - g_env_light.mEfPLight[i] = NULL; - g_env_light.field_0x72c[i] = NULL; + g_env_light.efplight[i] = NULL; + g_env_light.unk_0x72c[i] = NULL; } g_env_light.mPlayerPLightIdx = -1; @@ -953,28 +1005,28 @@ static void plight_init() { /* 8019E708-8019E734 199048 002C+00 1/1 0/0 0/0 .text darkmist_init__Fv */ static void darkmist_init() { for (int i = 0; i < 10; i++) { - g_env_light.mDalkmistInf[i] = NULL; + g_env_light.dalkmist_influence[i] = NULL; } } /* 8019E734-8019E854 199074 0120+00 1/1 0/0 0/0 .text plight_set__Fv */ static void plight_set() { - int idx = 0; + int plight_no = 0; stage_plight_info_class* plight_info = dComIfGp_getStagePlightInfo(); if (plight_info != NULL) { - g_env_light.stagPlightInfo = plight_info; + g_env_light.stage_plight_info = plight_info; for (int i = 0; i < dComIfGp_getStagePlightNumInfo(); i++) { - if (idx < 30) { - g_env_light.mLightInfluence[idx].mPosition = plight_info[i].m_position; - g_env_light.mLightInfluence[idx].mColor.r = plight_info[i].m_color.r; - g_env_light.mLightInfluence[idx].mColor.g = plight_info[i].m_color.g; - g_env_light.mLightInfluence[idx].mColor.b = plight_info[i].m_color.b; - g_env_light.mLightInfluence[idx].mPow = plight_info[i].m_radius * 200.0f; - g_env_light.mLightInfluence[idx].mFluctuation = plight_info[i].m_fluctuation; - dKy_plight_set(&g_env_light.mLightInfluence[idx]); - idx++; + if (plight_no < 30) { + g_env_light.mLightInfluence[plight_no].mPosition = plight_info[i].position; + g_env_light.mLightInfluence[plight_no].mColor.r = plight_info[i].color.r; + g_env_light.mLightInfluence[plight_no].mColor.g = plight_info[i].color.g; + g_env_light.mLightInfluence[plight_no].mColor.b = plight_info[i].color.b; + g_env_light.mLightInfluence[plight_no].mPow = plight_info[i].power * 200.0f; + g_env_light.mLightInfluence[plight_no].mFluctuation = plight_info[i].fluctuation; + dKy_plight_set(&g_env_light.mLightInfluence[plight_no]); + plight_no++; } else { #ifdef DEBUG // "\nToo many Point Lights set!!!" @@ -987,9 +1039,8 @@ static void plight_set() { /* 8019E854-8019E874 199194 0020+00 1/1 0/0 0/0 .text bgparts_activelight_init__Fv */ static void bgparts_activelight_init() { - int i = 0; - for (; i < 2; i++) { - g_env_light.mBGpartsActiveLight[0].mIndex = 0; + for (int i = 0; i < 2; i++) { + g_env_light.bgparts_active_light[0].mIndex = 0; } } @@ -1003,47 +1054,47 @@ static void dungeonlight_init() { static color_RGB_class test_color_tbl[] = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, }; - dScnKy_env_light_c* env_light = dKy_getEnvlight(); + + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); for (int i = 0; i < 8; i++) { - env_light->mDungeonLights[i].mPosition = cXyz(test_pos_tbl[i]); - env_light->mDungeonLights[i].mRefDistance = 1.0f; - env_light->mDungeonLights[i].field_0x14 = 0.99f; - env_light->mDungeonLights[i].mColor.r = test_color_tbl[i].r; - env_light->mDungeonLights[i].mColor.g = test_color_tbl[i].g; - env_light->mDungeonLights[i].mColor.b = test_color_tbl[i].b; - env_light->mDungeonLights[i].mColor.a = 255; + kankyo->dungeonlight[i].mPosition = cXyz(test_pos_tbl[i]); + kankyo->dungeonlight[i].mRefDistance = 1.0f; + kankyo->dungeonlight[i].field_0x14 = 0.99f; + kankyo->dungeonlight[i].mColor.r = test_color_tbl[i].r; + kankyo->dungeonlight[i].mColor.g = test_color_tbl[i].g; + kankyo->dungeonlight[i].mColor.b = test_color_tbl[i].b; + kankyo->dungeonlight[i].mColor.a = 255; - env_light->mDungeonLights[i].mInfluence.mPosition = env_light->mDungeonLights[i].mPosition; - env_light->mDungeonLights[i].mInfluence.mColor.r = env_light->mDungeonLights[i].mColor.r; - env_light->mDungeonLights[i].mInfluence.mColor.g = env_light->mDungeonLights[i].mColor.g; - env_light->mDungeonLights[i].mInfluence.mColor.b = env_light->mDungeonLights[i].mColor.b; - env_light->mDungeonLights[i].mInfluence.mPow = - env_light->mDungeonLights[i].mRefDistance * 100.0f; - env_light->mDungeonLights[i].mInfluence.mFluctuation = 0.0f; + kankyo->dungeonlight[i].mInfluence.mPosition = kankyo->dungeonlight[i].mPosition; + kankyo->dungeonlight[i].mInfluence.mColor.r = kankyo->dungeonlight[i].mColor.r; + kankyo->dungeonlight[i].mInfluence.mColor.g = kankyo->dungeonlight[i].mColor.g; + kankyo->dungeonlight[i].mInfluence.mColor.b = kankyo->dungeonlight[i].mColor.b; + kankyo->dungeonlight[i].mInfluence.mPow = kankyo->dungeonlight[i].mRefDistance * 100.0f; + kankyo->dungeonlight[i].mInfluence.mFluctuation = 0.0f; - env_light->mDungeonLights[i].mCutoffAngle = 90.0f; - env_light->mDungeonLights[i].mAngleX = -90.0f; - env_light->mDungeonLights[i].mAngleY = 0.0f; - env_light->mDungeonLights[i].mAngleAttenuation = 0; - env_light->mDungeonLights[i].mDistAttenuation = 2; + kankyo->dungeonlight[i].mCutoffAngle = 90.0f; + kankyo->dungeonlight[i].mAngleX = -90.0f; + kankyo->dungeonlight[i].mAngleY = 0.0f; + kankyo->dungeonlight[i].mAngleAttenuation = GX_SP_OFF; + kankyo->dungeonlight[i].mDistAttenuation = GX_DA_MEDIUM; - env_light->field_0x0c18[i].mPos = cXyz(test_pos_tbl[i]); - env_light->field_0x0c18[i].mColor.r = test_color_tbl[i].r; - env_light->field_0x0c18[i].mColor.g = test_color_tbl[i].g; - env_light->field_0x0c18[i].mColor.b = test_color_tbl[i].b; - env_light->field_0x0c18[i].mColor.a = 255; - env_light->field_0x0c18[i].mRefDistance = 0.001f; - env_light->field_0x0c18[i].field_0x14 = 0.99f; - env_light->field_0x0c18[i].field_0x26 = 0; - env_light->field_0x0c18[i].mCutoffAngle = 90.0f; - env_light->field_0x0c18[i].mAngleX = -90.0f; - env_light->field_0x0c18[i].mAngleY = 0.0f; - env_light->field_0x0c18[i].mAngleAttenuation = 0; - env_light->field_0x0c18[i].mDistAttenuation = 2; + kankyo->field_0x0c18[i].mPos = cXyz(test_pos_tbl[i]); + kankyo->field_0x0c18[i].mColor.r = test_color_tbl[i].r; + kankyo->field_0x0c18[i].mColor.g = test_color_tbl[i].g; + kankyo->field_0x0c18[i].mColor.b = test_color_tbl[i].b; + kankyo->field_0x0c18[i].mColor.a = 255; + kankyo->field_0x0c18[i].mRefDistance = 0.001f; + kankyo->field_0x0c18[i].field_0x14 = 0.99f; + kankyo->field_0x0c18[i].field_0x26 = 0; + kankyo->field_0x0c18[i].mCutoffAngle = 90.0f; + kankyo->field_0x0c18[i].mAngleX = -90.0f; + kankyo->field_0x0c18[i].mAngleY = 0.0f; + kankyo->field_0x0c18[i].mAngleAttenuation = GX_SP_OFF; + kankyo->field_0x0c18[i].mDistAttenuation = GX_DA_MEDIUM; if (i < 6) { - env_light->field_0x0d58[i] = env_light->field_0x0c18[i]; + kankyo->field_0x0d58[i] = kankyo->field_0x0c18[i]; } } } @@ -1051,96 +1102,98 @@ static void dungeonlight_init() { /* 8019EAA0-8019EBD0 1993E0 0130+00 1/1 0/0 0/0 .text undwater_init__Fv */ static void undwater_init() { J3DModelData* modelData2 = (J3DModelData*)dComIfG_getObjectRes("Always", 0x1D); - JUT_ASSERT(modelData2 != 0); + JUT_ASSERT(1867, modelData2 != 0); - g_env_light.mpUndwaterEfHeap = mDoExt_createSolidHeapFromGameToCurrent(0x600, 0x20); + g_env_light.undwater_ef_heap = mDoExt_createSolidHeapFromGameToCurrent(0x600, 0x20); - if (g_env_light.mpUndwaterEfHeap != NULL) { - g_env_light.mpUndwaterEfModel = mDoExt_J3DModel__create(modelData2, 0x80000, 0x11020202); + if (g_env_light.undwater_ef_heap != NULL) { + g_env_light.undwater_ef_model = mDoExt_J3DModel__create(modelData2, 0x80000, 0x11020202); - if (g_env_light.mpUndwaterEfModel != NULL) { - g_env_light.mpUndwaterBtk = new mDoExt_btkAnm(); + if (g_env_light.undwater_ef_model != NULL) { + g_env_light.undwater_btk = new mDoExt_btkAnm(); - if (g_env_light.mpUndwaterBtk != NULL) { - J3DAnmTextureSRTKey* pbtk = - (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Always", 0x3C); - g_env_light.mpUndwaterBtk->init(modelData2, pbtk, TRUE, J3DFrameCtrl::LOOP_REPEAT_e, - 1.0f, 0, -1); + if (g_env_light.undwater_btk != NULL) { + J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Always", 0x3C); + if (!g_env_light.undwater_btk->init(modelData2, pbtk, TRUE, + J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 0, -1)) + { + JUT_ASSERT(1898, 0); + } } else { - JUT_ASSERT(0); + JUT_ASSERT(1902, 0); } } mDoExt_restoreCurrentHeap(); - mDoExt_adjustSolidHeap(g_env_light.mpUndwaterEfHeap); + mDoExt_adjustSolidHeap(g_env_light.undwater_ef_heap); } else { - JUT_ASSERT(0); + JUT_ASSERT(1917, 0); } } /* 8019EBD0-8019EC98 199510 00C8+00 1/1 0/0 0/0 .text dKy_light_size_get__FPCc */ -static void dKy_light_size_get(char const* stage) { - dKydata_lightsizeInfo_c* lightTbl = dKyd_light_size_tbl_getp(); - dKydata_lightsizeInfo_c* lightTwTbl = dKyd_light_tw_size_tbl_getp(); +void dKy_light_size_get(char const* stageName) { + dKydata_lightsizeInfo_c* size_tbl = dKyd_light_size_tbl_getp(); + dKydata_lightsizeInfo_c* tw_size_tbl = dKyd_light_tw_size_tbl_getp(); if (!dKy_darkworld_check()) { for (int i = 0; i < 36; i++) { - if (!strcmp(stage, lightTbl->stageName)) { - g_env_light.field_0x1309 = lightTbl->size; + if (!strcmp(stageName, size_tbl->stageName)) { + g_env_light.light_size = size_tbl->size; return; } - lightTbl++; + size_tbl++; } } else { for (int i = 0; i < 9; i++) { - if (!strcmp(stage, lightTwTbl->stageName)) { - g_env_light.field_0x1309 = lightTwTbl->size; + if (!strcmp(stageName, tw_size_tbl->stageName)) { + g_env_light.light_size = tw_size_tbl->size; return; } - lightTwTbl++; + tw_size_tbl++; } } } /* 8019EC98-8019F264 1995D8 05CC+00 1/1 0/0 0/0 .text envcolor_init__Fv */ static void envcolor_init() { - stage_palette_info_class* palette = dComIfGp_getStagePaletteInfo(); - stage_pselect_info_class* pselect = dComIfGp_getStagePselectInfo(); - stage_envr_info_class* envr = dComIfGp_getStageEnvrInfo(); - stage_vrboxcol_info_class* vrbox = dComIfGp_getStageVrboxcolInfo(); + stage_palette_info_class* stage_palette_p = dComIfGp_getStagePaletteInfo(); + stage_pselect_info_class* stage_psel_p = dComIfGp_getStagePselectInfo(); + stage_envr_info_class* stage_envr_p = dComIfGp_getStageEnvrInfo(); + stage_vrboxcol_info_class* stage_vrboxcol_p = dComIfGp_getStageVrboxcolInfo(); dKy_actor_addcol_set(0, 0, 0, 0.0f); dKy_fog_startendz_set(0.0f, 0.0f, 0.0f); dKy_vrbox_addcol_set(0, 0, 0, 0.0f); g_env_light.field_0x1280 = 0; - g_env_light.mInitAnmTimer = 1; - g_env_light.mSchBit = 0; - g_env_light.mSchbitTimer = 0; + g_env_light.light_init_timer = 1; + g_env_light.schbit = 0; + g_env_light.schbit_timer = 0; - g_env_light.mVrboxInvisible = false; + g_env_light.hide_vrbox = false; g_env_light.mContrastFlag = 0; g_env_light.mFogAdjEnable = true; g_env_light.mFogAdjTableType = 0; g_env_light.mFogAdjCenter = 0x140; dKyd_xfog_table_set(0); - g_env_light.mColAllcolRatio = 1.0f; - g_env_light.mColActColRatio = 1.0f; - g_env_light.mColBgColRatio = 1.0f; - g_env_light.mColFogColRatio = 1.0f; - g_env_light.mColVrboxSoraColRatio = 1.0f; - g_env_light.mColVrboxKumocolRatio = 1.0f; + g_env_light.now_allcol_ratio = 1.0f; + g_env_light.now_actcol_ratio = 1.0f; + g_env_light.now_bgcol_ratio = 1.0f; + g_env_light.now_fogcol_ratio = 1.0f; + g_env_light.now_vrboxsoracol_ratio = 1.0f; + g_env_light.now_vrboxkumocol_ratio = 1.0f; g_env_light.field_0x1210 = 1.0f; - g_env_light.mAllcolRatio = 1.0f; - g_env_light.mActcolRatio = 1.0f; - g_env_light.mBgcolRatio = 1.0f; - g_env_light.mFogcolRatio = 1.0f; - g_env_light.mVrboxSoracolRatio = 1.0f; - g_env_light.mVrboxKumocolRatio = 1.0f; + g_env_light.allcol_ratio = 1.0f; + g_env_light.actcol_ratio = 1.0f; + g_env_light.bgcol_ratio = 1.0f; + g_env_light.fogcol_ratio = 1.0f; + g_env_light.vrboxsoracol_ratio = 1.0f; + g_env_light.vrboxkumocol_ratio = 1.0f; g_env_light.field_0x122c = 1.0f; - g_env_light.mItemGetCol_chg = 0; + g_env_light.Itemgetcol_chg = 0; g_env_light.field_0x1240 = 0.0f; g_env_light.field_0x1230 = 0.0f; g_env_light.field_0x1234 = 0.0f; @@ -1149,12 +1202,12 @@ static void envcolor_init() { g_env_light.field_0x1238 = 0.0f; g_env_light.field_0x123c = 0.0f; g_env_light.field_0x12d6 = 0; - g_env_light.mShadowMode = 0; - g_env_light.mCameraInWater = 0; + g_env_light.shadow_mode = 0; + g_env_light.camera_water_in_status = 0; g_env_light.field_0x1258 = 0.0f; g_env_light.mActorLightEffect = 100; - g_env_light.mPaletteTerrainLightEffect = 1.0f; + g_env_light.bg_light_influence = 1.0f; g_env_light.field_0x1064.x = 0.0f; g_env_light.field_0x1064.y = -1.0f; g_env_light.field_0x1064.z = -1.0f; @@ -1164,27 +1217,27 @@ static void envcolor_init() { g_env_light.mDemoAttentionPoint = 0.11f; } - g_env_light.field_0x1308 = 0; + g_env_light.light_mask_type = 0; g_env_light.field_0x130b = 0; - g_env_light.field_0x1309 = 1; + g_env_light.light_size = LIGHT_SIZE_M; dKy_light_size_get(dComIfGp_getStartStageName()); - g_env_light.mGrassLightEffectRate = 1.0f; + g_env_light.grass_light_inf_rate = 1.0f; g_env_light.field_0x12fc = -1; g_env_light.field_0x1278 = 0.0f; g_env_light.field_0x1264 = -255.0f; - g_env_light.field_0x1268 = 999999.0f; - g_env_light.field_0x126c = 999999.0f; + g_env_light.field_0x1268 = 999999.9f; + g_env_light.field_0x126c = 999999.9f; g_env_light.field_0x127c = 200.0f; if (dStage_stagInfo_GetSTType(dComIfGp_getStage()->getStagInfo()) == ST_BOSS_ROOM) { - g_env_light.mpSchedule = dKyd_schejule_boss_getp(); + g_env_light.light_schedule = dKyd_schejule_boss_getp(); } else { - g_env_light.mpSchedule = dKyd_schejule_getp(); + g_env_light.light_schedule = dKyd_schejule_getp(); } - g_env_light.mEnvrIdxPrev = dComIfGp_roomControl_getStayNo(); - g_env_light.mEnvrIdxCurr = dComIfGp_roomControl_getStayNo(); - g_env_light.mColPatBlend = 1.0f; + g_env_light.PrevCol = dComIfGp_roomControl_getStayNo(); + g_env_light.UseCol = dComIfGp_roomControl_getStayNo(); + g_env_light.pat_ratio = 1.0f; g_env_light.field_0x12b0 = 0; g_env_light.mColpatWeather = 0; g_env_light.mVrkumoStrength = 0.0f; @@ -1207,50 +1260,49 @@ static void envcolor_init() { g_env_light.field_0x12cc = 0; } - g_env_light.mRainCountOrig = 0; + g_env_light.base_raincnt = 0; g_env_light.field_0x12a0 = 0; - g_env_light.mDiceWeatherMode = 0; - g_env_light.mDiceWeatherChangeTime = - dComIfGs_getTime() + (cM_rndF(g_Counter.mCounter0 & 0x1F) * 15.0f); - if (g_env_light.mDiceWeatherChangeTime >= 360.0f) { - g_env_light.mDiceWeatherChangeTime -= 360.0f; + g_env_light.dice_wether_mode = 0; + g_env_light.dice_wether_change_time = dComIfGs_getTime() + (cM_rndF(g_Counter.mCounter0 & 31) * 15.0f); + if (g_env_light.dice_wether_change_time >= 360.0f) { + g_env_light.dice_wether_change_time -= 360.0f; } - g_env_light.mDiceWeatherState = 0; - g_env_light.mDiceWeatherCurrPattern = 0; - g_env_light.mDiceWeatherCounter = 0; - g_env_light.mDiceWeatherTime = 0.0f; + g_env_light.dice_wether_state = 0; + g_env_light.dice_wether_pat = 0; + g_env_light.dice_wether_counter = 0; + g_env_light.dice_wether_time = 0.0f; - g_env_light.mColPatPrev = g_env_light.mColpatWeather; - g_env_light.mColPatCurr = g_env_light.mColpatWeather; + g_env_light.wether_pat0 = g_env_light.mColpatWeather; + g_env_light.wether_pat1 = g_env_light.mColpatWeather; g_env_light.mColpatPrevGather = 0xFF; g_env_light.mColpatCurrGather = 0xFF; g_env_light.mColPatBlendGather = -1.0f; g_env_light.mColPatMode = 0; g_env_light.mColPatModeGather = 0; - if (envr != NULL) { - g_env_light.mpDmEnvr = envr; + if (stage_envr_p != NULL) { + g_env_light.stage_envr_info = stage_envr_p; } else { - g_env_light.mpDmEnvr = (stage_envr_info_class*)dKyd_dmenvr_getp(); + g_env_light.stage_envr_info = (stage_envr_info_class*)dKyd_dmenvr_getp(); } - if (palette != NULL) { - g_env_light.mpDmPalet = palette; + if (stage_palette_p != NULL) { + g_env_light.stage_palette_info = stage_palette_p; } else { - g_env_light.mpDmPalet = (stage_palette_info_class*)dKyd_dmpalet_getp(); + g_env_light.stage_palette_info = (stage_palette_info_class*)dKyd_dmpalet_getp(); } - if (pselect != NULL) { - g_env_light.mpDmPselect = pselect; + if (stage_psel_p != NULL) { + g_env_light.stage_pselect_info = stage_psel_p; } else { - g_env_light.mpDmPselect = (stage_pselect_info_class*)dKyd_dmpselect_getp(); + g_env_light.stage_pselect_info = (stage_pselect_info_class*)dKyd_dmpselect_getp(); } - if (vrbox != NULL) { - g_env_light.mpDmVrbox = vrbox; + if (stage_vrboxcol_p != NULL) { + g_env_light.stage_vrboxcol_info = stage_vrboxcol_p; } else { - g_env_light.mpDmVrbox = (stage_vrboxcol_info_class*)dKyd_dmvrbox_getp(); + g_env_light.stage_vrboxcol_info = (stage_vrboxcol_info_class*)dKyd_dmvrbox_getp(); } plight_init(); @@ -1258,53 +1310,54 @@ static void envcolor_init() { darkmist_init(); bgparts_activelight_init(); - g_env_light.field_0x11c8 = 1.0f; - g_env_light.field_0x11cc = 1.0f; - g_env_light.field_0x11d0 = 1.0f; + g_env_light.unk_0x11c8 = 1.0f; + g_env_light.unk_0x11cc = 1.0f; + g_env_light.unk_0x11d0 = 1.0f; g_env_light.field_0xf2c = 0; - g_env_light.mpUndwaterEfModel = NULL; + g_env_light.undwater_ef_model = NULL; g_env_light.field_0xf34 = 0.0f; - g_env_light.mpUndwaterEfHeap = NULL; + g_env_light.undwater_ef_heap = NULL; undwater_init(); dComIfGs_PolyDamageOff_Set(0); - g_env_light.field_0x98c = dComIfGp_roomControl_getStayNo(); - g_env_light.mIsBlure = 0; - g_env_light.field_0x12fb = 0; + + g_env_light.player_room_no = dComIfGp_roomControl_getStayNo(); + g_env_light.is_blure = 0; + g_env_light.using_time_control_tag = 0; g_env_light.field_0x1300 = -1; g_env_light.field_0x1302 = -1; g_env_light.mWaterSurfaceShineRate = 1.0f; - int timeH = dStage_stagInfo_GetTimeH(dComIfGp_getStage()->getStagInfo()); - if (timeH >= 0) { - dComIfGs_setTime(timeH * 15.0f); + int stage_time = dStage_stagInfo_GetTimeH(dComIfGp_getStage()->getStagInfo()); + if (stage_time >= 0) { + dComIfGs_setTime(stage_time * 15.0f); } - g_env_light.mTimeSpeed = 0.012f; + g_env_light.time_change_rate = 0.012f; - memset(&g_env_light.mMoyaSE, 0, 0x10); + memset(&g_env_light.moya_se, 0, 0x10); } /* 8019F264-8019F2E8 199BA4 0084+00 1/1 1/1 0/0 .text dKy_clear_game_init__Fv */ void dKy_clear_game_init() { dKy_actor_addcol_set(0, 0, 0, 0.0f); - g_env_light.mSunPos.x = 1.0f; - g_env_light.mSunPos.y = 0.0f; - g_env_light.mSunPos.z = 0.0f; + g_env_light.sun_pos.x = 1.0f; + g_env_light.sun_pos.y = 0.0f; + g_env_light.sun_pos.z = 0.0f; - g_env_light.mMoonPos.x = -1.0f; - g_env_light.mMoonPos.y = 0.0f; - g_env_light.mMoonPos.z = 0.0f; + g_env_light.moon_pos.x = -1.0f; + g_env_light.moon_pos.y = 0.0f; + g_env_light.moon_pos.z = 0.0f; - g_env_light.mNexttime = -1.0f; - g_env_light.mTime = -1.0f; - g_env_light.mDarkDaytime = 120.0f; + g_env_light.nexttime = -1.0f; + g_env_light.old_time = -1.0f; + g_env_light.dark_daytime = 120.0f; - g_env_light.mDarktimeWeek = 0; - g_env_light.mPondSeason = 0; + g_env_light.darktime_week = 0; + g_env_light.fishing_hole_season = 0; g_env_light.field_0x130a = 0; g_env_light.field_0x12cc = 0; - g_env_light.field_0x130c = 0; + g_env_light.staffroll_next_timer = 0; } /* 8019F2E8-8019F400 199C28 0118+00 1/1 0/0 0/0 .text __ct__18dScnKy_env_light_cFv */ @@ -1314,263 +1367,286 @@ dScnKy_env_light_c::dScnKy_env_light_c() { /* 8019F4FC-8019F780 199E3C 0284+00 1/1 0/0 0/0 .text setDaytime__18dScnKy_env_light_cFv */ -// NONMATCHING getTimePass size mismatch +// NONMATCHING - getTimePass doing s8 check instead of int check void dScnKy_env_light_c::setDaytime() { mDate = dComIfGs_getDate(); - mDaytime = dComIfGs_getTime(); + daytime = dComIfGs_getTime(); - if (field_0x12fb == 0) { + if (using_time_control_tag == 0) { if (!dKy_darkworld_check()) { if (dComIfGp_event_runCheck() == FALSE) { - msg_class* ac = dMsgObject_c::getActor(); - bool tmp = true; + msg_class* msg = dMsgObject_c::getActor(); + bool temp_r29 = msg == NULL || msg->mode < 2; - if (ac != NULL && ac->mode >= 2) { - tmp = false; - } - - if (dComIfGp_roomControl_getTimePass() && !field_0x130a && tmp) { - mDaytime += mTimeSpeed; + if (dComIfGp_roomControl_getTimePass() && !field_0x130a && temp_r29) { + daytime += time_change_rate; // Stage is Fishing Pond or Hena's Hut if (!strcmp(dComIfGp_getStartStageName(), "F_SP127") || !strcmp(dComIfGp_getStartStageName(), "R_SP127")) { - f32 current_time = mDaytime; + f32 current_time = daytime; if (current_time >= 300.0f || current_time <= 60.0f) { - mDaytime += mTimeSpeed; - mDaytime += mTimeSpeed; + daytime += time_change_rate; + daytime += time_change_rate; } else if (current_time >= 150.0f && current_time <= 195.0f) { - mDaytime = current_time + mTimeSpeed; + daytime = current_time + time_change_rate; } } - if ((u32)mDaytime >= 360.0f) { - mDaytime = 0.0f; + if ((u32)daytime >= 360.0f) { + daytime = 0.0f; mDate++; dKankyo_DayProc(); } } } } else { - mDarkDaytime += mTimeSpeed; - if ((u32)mDarkDaytime >= 360.0f) { - mDarktimeWeek++; - mDarkDaytime = 0.0f; + dark_daytime += time_change_rate; + if ((u32)dark_daytime >= 360.0f) { + darktime_week++; + dark_daytime = 0.0f; } - mDaytime = 0.0f; + daytime = 0.0f; } } - if (mDaytime >= 360.0f) { - mDaytime = 0.0f; + if (daytime >= 360.0f) { + daytime = 0.0f; } - dComIfGs_setTime(mDaytime); + dComIfGs_setTime(daytime); mDoAud_setHour(dKy_getdaytime_hour()); mDoAud_setMinute(dKy_getdaytime_minute()); mDoAud_setWeekday(dKy_get_dayofweek()); dComIfGs_setDate(mDate); - g_env_light.field_0x12fb = 0; + g_env_light.using_time_control_tag = 0; } /* 8019F788-8019FA08 19A0C8 0280+00 1/1 0/0 0/0 .text setSunpos__18dScnKy_env_light_cFv */ void dScnKy_env_light_c::setSunpos() { camera_class* camera_p = dComIfGp_getCamera(0); - cXyz sp8; + cXyz pos; if (camera_p != NULL && strcmp(dComIfGp_getStartStageName(), "F_SP200") != 0) { - f32 var_f3 = g_env_light.mDaytime; - f32 var_f31; - f32 var_f3_2; - f32 var_f30; + f32 sun_time = g_env_light.daytime; + f32 sun_angle; + f32 moon_time; + f32 moon_angle; - if (var_f3 >= 90.0f && var_f3 <= 270.0f) { - f32 percent = get_parcent(270.0f, 90.0f, var_f3); - var_f31 = (percent * 150.0f) + 105.0f; + if (sun_time >= 90.0f && sun_time <= 270.0f) { + f32 percent = get_parcent(270.0f, 90.0f, sun_time); + sun_angle = (percent * 150.0f) + 105.0f; } else { - if (var_f3 < 90.0f) { - var_f3 += 360.0f; + if (sun_time < 90.0f) { + sun_time += 360.0f; } - f32 percent = get_parcent(450.0f, 270.0f, var_f3); - var_f31 = (percent * 210.0f) + 255.0f; - if (var_f31 > 360.0f) { - var_f31 -= 360.0f; + f32 percent = get_parcent(450.0f, 270.0f, sun_time); + sun_angle = (percent * 210.0f) + 255.0f; + if (sun_angle > 360.0f) { + sun_angle -= 360.0f; } } - var_f3_2 = 180.0f + g_env_light.mDaytime; - if (var_f3_2 >= 360.0f) { - var_f3_2 -= 360.0f; + moon_time = 180.0f + g_env_light.daytime; + if (moon_time >= 360.0f) { + moon_time -= 360.0f; } - if (var_f3_2 >= 90.0f && var_f3_2 <= 270.0f) { - f32 percent = get_parcent(270.0f, 90.0f, var_f3_2); - var_f30 = (percent * 150.0f) + 105.0f; + if (moon_time >= 90.0f && moon_time <= 270.0f) { + f32 percent = get_parcent(270.0f, 90.0f, moon_time); + moon_angle = (percent * 150.0f) + 105.0f; } else { - if (var_f3_2 < 90.0f) { - var_f3_2 += 360.0f; + if (moon_time < 90.0f) { + moon_time += 360.0f; } - f32 percent = get_parcent(450.0f, 270.0f, var_f3_2); - var_f30 = (percent * 210.0f) + 255.0f; - if (var_f30 > 360.0f) { - var_f30 -= 360.0f; + f32 percent = get_parcent(450.0f, 270.0f, moon_time); + moon_angle = (percent * 210.0f) + 255.0f; + if (moon_angle > 360.0f) { + moon_angle -= 360.0f; } } - sp8.x = sinf(var_f31 * 0.01745329238474369f) * 80000.0f; - sp8.y = cosf(var_f31 * 0.01745329238474369f) * 80000.0f; - sp8.z = cosf(var_f31 * 0.01745329238474369f) * -48000.0f; + pos.x = sinf(DEG_TO_RAD(sun_angle)) * 80000.0f; + pos.y = cosf(DEG_TO_RAD(sun_angle)) * 80000.0f; + pos.z = cosf(DEG_TO_RAD(sun_angle)) * -48000.0f; - mSunPos.x = camera_p->lookat.eye.x + sp8.x; - mSunPos.y = camera_p->lookat.eye.y - sp8.y; - mSunPos.z = camera_p->lookat.eye.z + sp8.z; + sun_pos.x = camera_p->lookat.eye.x + pos.x; + sun_pos.y = camera_p->lookat.eye.y - pos.y; + sun_pos.z = camera_p->lookat.eye.z + pos.z; - sp8.x = sinf(var_f30 * 0.01745329238474369f) * 80000.0f; - sp8.y = cosf(var_f30 * 0.01745329238474369f) * 80000.0f; - sp8.z = cosf(var_f30 * 0.01745329238474369f) * -48000.0f; + pos.x = sinf(DEG_TO_RAD(moon_angle)) * 80000.0f; + pos.y = cosf(DEG_TO_RAD(moon_angle)) * 80000.0f; + pos.z = cosf(DEG_TO_RAD(moon_angle)) * -48000.0f; - mMoonPos.x = sp8.x; - mMoonPos.y = -sp8.y; - mMoonPos.z = sp8.z; + moon_pos.x = pos.x; + moon_pos.y = -pos.y; + moon_pos.z = pos.z; } } /* 8019FA08-8019FA10 19A348 0008+00 3/3 5/5 1/1 .text getDaytime__18dScnKy_env_light_cFv */ f32 dScnKy_env_light_c::getDaytime() { - return mDaytime; + return daytime; } /* 8019FA10-8019FA3C 19A350 002C+00 2/2 2/2 32/32 .text dKy_getdaytime_hour__Fv */ -s32 dKy_getdaytime_hour() { +int dKy_getdaytime_hour() { return dComIfGs_getTime() / 15.0f; } /* 8019FA3C-8019FAB8 19A37C 007C+00 1/1 1/1 26/26 .text dKy_getdaytime_minute__Fv */ -s32 dKy_getdaytime_minute() { - f32 tmp = ((s32)(dComIfGs_getTime() * 1000000.0f) % 15000000); +int dKy_getdaytime_minute() { + f32 tmp = ((int)(dComIfGs_getTime() * 1000000.0f) % 15000000); return tmp / 1000000.0f / 15.0f * 60.0f; } /* 8019FAB8-8019FAF4 19A3F8 003C+00 0/0 3/3 6/6 .text dKy_daynight_check__Fv */ -s32 dKy_daynight_check() { - s32 hour = dKy_getdaytime_hour(); - +BOOL dKy_daynight_check() { + int hour = dKy_getdaytime_hour(); if (hour >= 6 && hour < 19) { - return 0; // day time + return FALSE; // day time } else { - return 1; // night time + return TRUE; // night time } } /* 8019FAF4-8019FB30 19A434 003C+00 0/0 0/0 22/22 .text dKy_getDarktime_hour__Fv */ -s32 dKy_getDarktime_hour() { +int dKy_getDarktime_hour() { return g_env_light.getDarkDaytime() / 15.0f; } /* 8019FB30-8019FBBC 19A470 008C+00 0/0 0/0 19/19 .text dKy_getDarktime_minute__Fv */ -// NONMATCHING float literal load order -s32 dKy_getDarktime_minute() { - f32 tmp = ((s32)(g_env_light.getDarkDaytime() * 1000000.0f) % 15000000); - return tmp / 1000000.0f / 15.0f * 60.0f; +int dKy_getDarktime_minute() { + f32 time = g_env_light.getDarkDaytime(); + f32 temp_f30 = ((int)(time * 1000000.0f) % 15000000) / 1000000.0f; + return 60.0f * (temp_f30 / 15.0f); } /* 8019FBBC-8019FBCC 19A4FC 0010+00 0/0 0/0 8/8 .text dKy_getDarktime_week__Fv */ -s32 dKy_getDarktime_week() { - return g_env_light.mDarktimeWeek; +int dKy_getDarktime_week() { + return g_env_light.darktime_week; } /* 8019FBCC-8019FBD4 19A50C 0008+00 2/2 0/0 0/0 .text getDarkDaytime__18dScnKy_env_light_cFv */ f32 dScnKy_env_light_c::getDarkDaytime() { - return mDarkDaytime; + return dark_daytime; } /* 8019FBD4-801A0340 19A514 076C+00 5/3 0/0 0/0 .text * setLight_palno_get__18dScnKy_env_light_cFPUcPUcPUcPUcPUcPUcPUcPUcPfPiPiPfPUc */ -void dScnKy_env_light_c::setLight_palno_get(u8* i_envrSel0, u8* i_envrSel1, u8* i_pSelIdx0, - u8* i_pSelIdx1, u8* i_palIdx0A, u8* i_palIdx0B, - u8* i_palIdx1A, u8* i_palIdx1B, f32* i_blendPalAB, - int* i_pSelPalIdx0, int* i_pSelPalIdx1, - f32* i_blendPal01, u8* i_initTimer) { +/** + * Gets stage environment color palette information based on given IDs. + * This gets both previous and next palette information so that blending between + * palettes can occur. Both previous and next palette's also get a start and ending palette + * used to blend color based on time of day. + * + * @param prev_envr_id_p Index into stage ENVR info for previous palette + * @param next_envr_id_p Index into stage ENVR info for next (target) palette + * @param prev_pat_p Index of stage Pselect (Palette Select) to use for previous palette + * @param next_pat_p Index of stage Pselect (Palette Select) to use for next (target) palette + * @param prev_pal_start_id_p Start Palette ID for previous palette color + * @param prev_pal_end_id_p Ending Palette ID for previous palette color + * @param next_pal_start_id_p Start Palette ID for next (target) palette color + * @param next_pal_end_id_p Ending Palette ID for next (target) palette color + * @param color_ratio_p Ratio in-between start and ending palette to use + * @param start_pat_pal_id_p Index into stage Pselect for starting palette + * @param end_pat_pal_id_p Index into stage Pselect for ending palette + * @param pattern_ratio_p Ratio in-between previous pattern to the next + * @param init_timer_p + */ +void dScnKy_env_light_c::setLight_palno_get(u8* prev_envr_id_p, u8* next_envr_id_p, u8* prev_pat_p, + u8* next_pat_p, u8* prev_pal_start_id_p, + u8* prev_pal_end_id_p, u8* next_pal_start_id_p, + u8* next_pal_end_id_p, f32* color_ratio_p, + int* start_pat_pal_id_p, int* end_pat_pal_id_p, + f32* pattern_ratio_p, u8* init_timer_p) { stage_envr_info_class* envr_p; u8 psel_idx = 0; - if (*i_initTimer != 0) { - *i_initTimer += 1; + if (*init_timer_p != 0) { + *init_timer_p += 1; - if (*i_initTimer > 20) { - *i_initTimer = 0; + if (*init_timer_p > 20) { + *init_timer_p = 0; } if (g_env_light.mColPatMode == 0 && g_env_light.mColPatModeGather == 0) { - *i_blendPal01 = g_env_light.mColPatBlend; + *pattern_ratio_p = g_env_light.pat_ratio; - if (*i_blendPal01 >= 1.0f) { - *i_envrSel0 = *i_envrSel1; - *i_pSelIdx0 = *i_pSelIdx1; + // previous has reached next, so set previous to next + if (*pattern_ratio_p >= 1.0f) { + *prev_envr_id_p = *next_envr_id_p; + *prev_pat_p = *next_pat_p; } } } for (int i = 0; i < 11; i++) { - if (!(mDaytime >= mpSchedule[i].startTime && mDaytime <= mpSchedule[i].endTime)) { + // if time of day is not within light schedule range, then don't calculate light color + if (!(daytime >= light_schedule[i].startTime && daytime <= light_schedule[i].endTime)) { continue; } - *i_pSelPalIdx0 = mpSchedule[i].startTimeLight; - *i_pSelPalIdx1 = mpSchedule[i].endTimeLight; - *i_blendPalAB = get_parcent(mpSchedule[i].endTime, mpSchedule[i].startTime, mDaytime); + *start_pat_pal_id_p = light_schedule[i].startTimeLight; + *end_pat_pal_id_p = light_schedule[i].endTimeLight; + *color_ratio_p = get_parcent(light_schedule[i].endTime, light_schedule[i].startTime, daytime); - envr_p = &g_env_light.mpDmEnvr[*i_envrSel0]; - switch (*i_pSelIdx0) { + envr_p = &g_env_light.stage_envr_info[*prev_envr_id_p]; + switch (*prev_pat_p) { case 0: - psel_idx = envr_p->m_pselectID[0]; + psel_idx = envr_p->pselect_id[0]; break; case 1: - psel_idx = envr_p->m_pselectID[1]; + psel_idx = envr_p->pselect_id[1]; break; case 2: - psel_idx = envr_p->m_pselectID[2]; + psel_idx = envr_p->pselect_id[2]; break; case 3: - psel_idx = envr_p->m_pselectID[3]; + psel_idx = envr_p->pselect_id[3]; break; case 4: - psel_idx = envr_p->m_pselectID[4]; + psel_idx = envr_p->pselect_id[4]; break; case 5: - psel_idx = envr_p->m_pselectID[5]; + psel_idx = envr_p->pselect_id[5]; break; case 6: - psel_idx = envr_p->m_pselectID[6]; + psel_idx = envr_p->pselect_id[6]; break; case 7: - psel_idx = envr_p->m_pselectID[7]; + psel_idx = envr_p->pselect_id[7]; break; default: - if (*i_pSelIdx0 > 7 && *i_pSelIdx0 < 64) { - psel_idx = envr_p->m_pselectID[*i_pSelIdx0]; + if (*prev_pat_p > 7 && *prev_pat_p < 64) { + psel_idx = envr_p->pselect_id[*prev_pat_p]; } break; } - if (g_env_light.mCameraInWater != 0 && strcmp(dComIfGp_getStartStageName(), "D_MN08D") != 0 - && strcmp(dComIfGp_getStartStageName(), "D_MN01A") != 0) + // use a specific palette for underwater (except during morpheel and zant fight) + if (g_env_light.camera_water_in_status && + strcmp(dComIfGp_getStartStageName(), "D_MN08D") != 0 && + strcmp(dComIfGp_getStartStageName(), "D_MN01A") != 0) { - if (g_env_light.mColPatCurr == 0) { - psel_idx = envr_p->m_pselectID[8]; + if (g_env_light.wether_pat1 == 0) { + psel_idx = envr_p->pselect_id[8]; } else { - psel_idx = envr_p->m_pselectID[9]; + psel_idx = envr_p->pselect_id[9]; } - } else if (strcmp(dComIfGp_getStartStageName(), "R_SP127") == 0) { + } + // use a specific palette for rollgoal (camera eye gets set below 0.0) + else if (strcmp(dComIfGp_getStartStageName(), "R_SP127") == 0) + { camera_class* camera_p = dComIfGp_getCamera(0); if (camera_p != NULL && camera_p->lookat.eye.y < 0.0f) { - psel_idx = envr_p->m_pselectID[10]; + psel_idx = envr_p->pselect_id[10]; } } @@ -1578,78 +1654,78 @@ void dScnKy_env_light_c::setLight_palno_get(u8* i_envrSel0, u8* i_envrSel1, u8* psel_idx = 0; } - stage_pselect_info_class* pselect_p = &g_env_light.mpDmPselect[psel_idx]; - switch (*i_pSelPalIdx0) { + stage_pselect_info_class* pselect_p = &g_env_light.stage_pselect_info[psel_idx]; + switch (*start_pat_pal_id_p) { case 0: - *i_palIdx0A = pselect_p->mPalIdx[0]; + *prev_pal_start_id_p = pselect_p->palette_id[0]; break; case 1: - *i_palIdx0A = pselect_p->mPalIdx[1]; + *prev_pal_start_id_p = pselect_p->palette_id[1]; break; case 2: - *i_palIdx0A = pselect_p->mPalIdx[2]; + *prev_pal_start_id_p = pselect_p->palette_id[2]; break; case 3: - *i_palIdx0A = pselect_p->mPalIdx[3]; + *prev_pal_start_id_p = pselect_p->palette_id[3]; break; case 4: - *i_palIdx0A = pselect_p->mPalIdx[4]; + *prev_pal_start_id_p = pselect_p->palette_id[4]; break; case 5: - *i_palIdx0A = pselect_p->mPalIdx[5]; + *prev_pal_start_id_p = pselect_p->palette_id[5]; break; } - switch (*i_pSelPalIdx1) { + switch (*end_pat_pal_id_p) { case 0: - *i_palIdx0B = pselect_p->mPalIdx[0]; + *prev_pal_end_id_p = pselect_p->palette_id[0]; break; case 1: - *i_palIdx0B = pselect_p->mPalIdx[1]; + *prev_pal_end_id_p = pselect_p->palette_id[1]; break; case 2: - *i_palIdx0B = pselect_p->mPalIdx[2]; + *prev_pal_end_id_p = pselect_p->palette_id[2]; break; case 3: - *i_palIdx0B = pselect_p->mPalIdx[3]; + *prev_pal_end_id_p = pselect_p->palette_id[3]; break; case 4: - *i_palIdx0B = pselect_p->mPalIdx[4]; + *prev_pal_end_id_p = pselect_p->palette_id[4]; break; case 5: - *i_palIdx0B = pselect_p->mPalIdx[5]; + *prev_pal_end_id_p = pselect_p->palette_id[5]; break; } - envr_p = &g_env_light.mpDmEnvr[*i_envrSel1]; - switch (*i_pSelIdx1) { + envr_p = &g_env_light.stage_envr_info[*next_envr_id_p]; + switch (*next_pat_p) { case 0: - psel_idx = envr_p->m_pselectID[0]; + psel_idx = envr_p->pselect_id[0]; break; case 1: - psel_idx = envr_p->m_pselectID[1]; + psel_idx = envr_p->pselect_id[1]; break; case 2: - psel_idx = envr_p->m_pselectID[2]; + psel_idx = envr_p->pselect_id[2]; break; case 3: - psel_idx = envr_p->m_pselectID[3]; + psel_idx = envr_p->pselect_id[3]; break; case 4: - psel_idx = envr_p->m_pselectID[4]; + psel_idx = envr_p->pselect_id[4]; break; case 5: - psel_idx = envr_p->m_pselectID[5]; + psel_idx = envr_p->pselect_id[5]; break; case 6: - psel_idx = envr_p->m_pselectID[6]; + psel_idx = envr_p->pselect_id[6]; break; case 7: - psel_idx = envr_p->m_pselectID[7]; + psel_idx = envr_p->pselect_id[7]; break; default: - if (*i_pSelIdx1 > 7 && *i_pSelIdx1 < 64) { - psel_idx = envr_p->m_pselectID[*i_pSelIdx1]; + if (*next_pat_p > 7 && *next_pat_p < 64) { + psel_idx = envr_p->pselect_id[*next_pat_p]; } break; } @@ -1658,122 +1734,130 @@ void dScnKy_env_light_c::setLight_palno_get(u8* i_envrSel0, u8* i_envrSel1, u8* psel_idx = 0; } - pselect_p = &g_env_light.mpDmPselect[psel_idx]; - if (*i_envrSel0 != *i_envrSel1 || *i_pSelIdx0 != *i_pSelIdx1) { - if (pselect_p->mChangeRate < 0.033333335f) { - pselect_p->mChangeRate = 0.033333335f; + pselect_p = &g_env_light.stage_pselect_info[psel_idx]; + if (*prev_envr_id_p != *next_envr_id_p || *prev_pat_p != *next_pat_p) { + if (pselect_p->change_rate < (1.0f / 30)) { + pselect_p->change_rate = (1.0f / 30); } if (g_env_light.mColPatMode == 0) { - if (pselect_p->mChangeRate > 0.0f) { - *i_blendPal01 += 0.033333335f / pselect_p->mChangeRate; + if (pselect_p->change_rate > 0.0f) { + *pattern_ratio_p += (1.0f / 30) / pselect_p->change_rate; } - if (strcmp(dComIfGp_getStartStageName(), "F_SP121") == 0 - && *i_pSelIdx0 == *i_pSelIdx1) + // pattern change rate is faster in hyrule field + if (strcmp(dComIfGp_getStartStageName(), "F_SP121") == 0 && + *prev_pat_p == *next_pat_p) { - *i_blendPal01 += 0.06666667f; + *pattern_ratio_p += (1.0f / 15); } - if (*i_blendPal01 >= 1.0f) { - *i_envrSel0 = *i_envrSel1; - *i_pSelIdx0 = *i_pSelIdx1; - *i_blendPal01 = 1.0f; + if (*pattern_ratio_p >= 1.0f) { + *prev_envr_id_p = *next_envr_id_p; + *prev_pat_p = *next_pat_p; + *pattern_ratio_p = 1.0f; } } } - if (g_env_light.mCameraInWater != 0 && strcmp(dComIfGp_getStartStageName(), "D_MN08D") != 0 - && strcmp(dComIfGp_getStartStageName(), "D_MN01A") != 0) + // use a specific palette for underwater (except during morpheel and zant fight) + if (g_env_light.camera_water_in_status && + strcmp(dComIfGp_getStartStageName(), "D_MN08D") != 0 && + strcmp(dComIfGp_getStartStageName(), "D_MN01A") != 0) { - if (g_env_light.mColPatCurr == 0) { - pselect_p = &g_env_light.mpDmPselect[envr_p->m_pselectID[8]]; + if (g_env_light.wether_pat1 == 0) { + pselect_p = &g_env_light.stage_pselect_info[envr_p->pselect_id[8]]; } else { - pselect_p = &g_env_light.mpDmPselect[envr_p->m_pselectID[9]]; + pselect_p = &g_env_light.stage_pselect_info[envr_p->pselect_id[9]]; } - } else if (strcmp(dComIfGp_getStartStageName(), "R_SP127") == 0) { + } + // use a specific palette for rollgoal (camera eye gets set below 0.0) + else if (strcmp(dComIfGp_getStartStageName(), "R_SP127") == 0) + { camera_class* camera_p = dComIfGp_getCamera(0); if (camera_p != NULL && camera_p->lookat.eye.y < 0.0f) { - pselect_p = &g_env_light.mpDmPselect[envr_p->m_pselectID[10]]; + pselect_p = &g_env_light.stage_pselect_info[envr_p->pselect_id[10]]; } } - switch (*i_pSelPalIdx0) { + switch (*start_pat_pal_id_p) { case 0: - *i_palIdx1A = pselect_p->mPalIdx[0]; + *next_pal_start_id_p = pselect_p->palette_id[0]; break; case 1: - *i_palIdx1A = pselect_p->mPalIdx[1]; + *next_pal_start_id_p = pselect_p->palette_id[1]; break; case 2: - *i_palIdx1A = pselect_p->mPalIdx[2]; + *next_pal_start_id_p = pselect_p->palette_id[2]; break; case 3: - *i_palIdx1A = pselect_p->mPalIdx[3]; + *next_pal_start_id_p = pselect_p->palette_id[3]; break; case 4: - *i_palIdx1A = pselect_p->mPalIdx[4]; + *next_pal_start_id_p = pselect_p->palette_id[4]; break; case 5: - *i_palIdx1A = pselect_p->mPalIdx[5]; + *next_pal_start_id_p = pselect_p->palette_id[5]; break; } - switch (*i_pSelPalIdx1) { + switch (*end_pat_pal_id_p) { case 0: - *i_palIdx1B = pselect_p->mPalIdx[0]; + *next_pal_end_id_p = pselect_p->palette_id[0]; break; case 1: - *i_palIdx1B = pselect_p->mPalIdx[1]; + *next_pal_end_id_p = pselect_p->palette_id[1]; break; case 2: - *i_palIdx1B = pselect_p->mPalIdx[2]; + *next_pal_end_id_p = pselect_p->palette_id[2]; break; case 3: - *i_palIdx1B = pselect_p->mPalIdx[3]; + *next_pal_end_id_p = pselect_p->palette_id[3]; break; case 4: - *i_palIdx1B = pselect_p->mPalIdx[4]; + *next_pal_end_id_p = pselect_p->palette_id[4]; break; case 5: - *i_palIdx1B = pselect_p->mPalIdx[5]; + *next_pal_end_id_p = pselect_p->palette_id[5]; break; } - break; } - if (*i_palIdx0A > 250) { - *i_palIdx0A = 0; + if (*prev_pal_start_id_p > 250) { + *prev_pal_start_id_p = 0; } - if (*i_palIdx1A > 250) { - *i_palIdx1A = 0; + if (*next_pal_start_id_p > 250) { + *next_pal_start_id_p = 0; } - if (*i_palIdx0B > 250) { - *i_palIdx0B = 0; + if (*prev_pal_end_id_p > 250) { + *prev_pal_end_id_p = 0; } - if (*i_palIdx1B > 250) { - *i_palIdx1B = 0; + if (*next_pal_end_id_p > 250) { + *next_pal_end_id_p = 0; } } /* 801A0340-801A040C 19AC80 00CC+00 3/3 0/0 0/0 .text * dKy_calc_color_set__FP11_GXColorS10P15color_RGB_classP15color_RGB_classP15color_RGB_classP15color_RGB_classff11_GXColorS10f */ -static void dKy_calc_color_set(GXColorS10* o_calcColor, color_RGB_class* i_col0A, - color_RGB_class* i_col1A, color_RGB_class* i_col0B, - color_RGB_class* i_col1B, f32 i_blendAB0, f32 i_blendAB1, - GXColorS10 i_addCol, f32 i_mul) { - o_calcColor->r = kankyo_color_ratio_set(i_col0A->r, i_col0B->r, i_blendAB0, i_col1A->r, - i_col1B->r, i_blendAB1, i_addCol.r, i_mul); - o_calcColor->g = kankyo_color_ratio_set(i_col0A->g, i_col0B->g, i_blendAB0, i_col1A->g, - i_col1B->g, i_blendAB1, i_addCol.g, i_mul); - o_calcColor->b = kankyo_color_ratio_set(i_col0A->b, i_col0B->b, i_blendAB0, i_col1A->b, - i_col1B->b, i_blendAB1, i_addCol.b, i_mul); +void dKy_calc_color_set(GXColorS10* out_color_p, color_RGB_class* color_a_start_p, + color_RGB_class* color_b_start_p, color_RGB_class* color_a_end_p, + color_RGB_class* color_b_end_p, f32 color_ratio, f32 blend_ratio, + GXColorS10 add_col, f32 scale) { + out_color_p->r = + kankyo_color_ratio_set(color_a_start_p->r, color_a_end_p->r, color_ratio, + color_b_start_p->r, color_b_end_p->r, blend_ratio, add_col.r, scale); + out_color_p->g = + kankyo_color_ratio_set(color_a_start_p->g, color_a_end_p->g, color_ratio, + color_b_start_p->g, color_b_end_p->g, blend_ratio, add_col.g, scale); + out_color_p->b = + kankyo_color_ratio_set(color_a_start_p->b, color_a_end_p->b, color_ratio, + color_b_start_p->b, color_b_end_p->b, blend_ratio, add_col.b, scale); } inline bool checkZoraWearFlg() { @@ -1782,16 +1866,17 @@ inline bool checkZoraWearFlg() { /* 801A040C-801A133C 19AD4C 0F30+00 1/1 0/0 0/0 .text setLight__18dScnKy_env_light_cFv */ void dScnKy_env_light_c::setLight() { - u8* init_timer = &g_env_light.mInitAnmTimer; + u8* init_timer = &g_env_light.light_init_timer; camera_class* camera_p = dComIfGp_getCamera(0); - GXColorS10 addCol; - addCol.r = 0; - addCol.g = 0; - addCol.b = 0; - addCol.a = 0; + + GXColorS10 add_col; + add_col.r = 0; + add_col.g = 0; + add_col.b = 0; + add_col.a = 0; if (camera_p != NULL) { - if (g_env_light.mCameraInWater) { + if (g_env_light.camera_water_in_status) { dBgS_CamGndChk_Wtr camchk; cXyz chkpos; @@ -1809,157 +1894,162 @@ void dScnKy_env_light_c::setLight() { g_env_light.field_0x1258 = 0.0f; } - u8 pale0; - u8 pale2; - u8 pale1; - u8 pale3; - f32 blendAB; - int palIdx0; - int palIdx1; - setLight_palno_get(&g_env_light.mEnvrIdxPrev, &g_env_light.mEnvrIdxCurr, - &g_env_light.mColPatPrev, &g_env_light.mColPatCurr, &pale0, &pale1, - &pale2, &pale3, &blendAB, &palIdx0, &palIdx1, &g_env_light.mColPatBlend, - init_timer); + u8 prev_pal_start_id; + u8 next_pal_start_id; + u8 prev_pal_end_id; + u8 next_pal_end_id; + f32 color_ratio; + int start_pat_pal_id; + int end_pat_pal_id; + setLight_palno_get(&g_env_light.PrevCol, &g_env_light.UseCol, &g_env_light.wether_pat0, + &g_env_light.wether_pat1, &prev_pal_start_id, &prev_pal_end_id, + &next_pal_start_id, &next_pal_end_id, &color_ratio, &start_pat_pal_id, + &end_pat_pal_id, &g_env_light.pat_ratio, init_timer); - if (pale0 == 0xFF) { - mActorAmbience.r = 255; - mActorAmbience.g = 0; - mActorAmbience.b = 0; + if (prev_pal_start_id == 0xFF) { + actor_amb_col.r = 255; + actor_amb_col.g = 0; + actor_amb_col.b = 0; for (int i = 0; i < 4; i++) { - mTerrainAmbienceBG[i].r = 255; - mTerrainAmbienceBG[i].g = 0; - mTerrainAmbienceBG[i].b = 0; - mTerrainAmbienceBG[i].a = 0; + bg_amb_col[i].r = 255; + bg_amb_col[i].g = 0; + bg_amb_col[i].b = 0; + bg_amb_col[i].a = 0; } } else { - stage_palette_info_class* pale0_p = &g_env_light.mpDmPalet[pale0]; - stage_palette_info_class* pale1_p = &g_env_light.mpDmPalet[pale1]; - stage_palette_info_class* pale2_p = &g_env_light.mpDmPalet[pale2]; - stage_palette_info_class* pale3_p = &g_env_light.mpDmPalet[pale3]; + stage_palette_info_class* prev_pal_start_p = &g_env_light.stage_palette_info[prev_pal_start_id]; + stage_palette_info_class* prev_pal_end_p = &g_env_light.stage_palette_info[prev_pal_end_id]; + stage_palette_info_class* next_pal_start_p = &g_env_light.stage_palette_info[next_pal_start_id]; + stage_palette_info_class* next_pal_end_p = &g_env_light.stage_palette_info[next_pal_end_id]; - dKy_calc_color_set(&mActorAmbience, &pale0_p->mActorAmbColor, &pale2_p->mActorAmbColor, - &pale1_p->mActorAmbColor, &pale3_p->mActorAmbColor, blendAB, - g_env_light.mColPatBlend, addCol, - g_env_light.field_0x1210 * - (g_env_light.mColActColRatio * g_env_light.mColActColRatio)); + dKy_calc_color_set(&actor_amb_col, &prev_pal_start_p->actor_amb_col, + &next_pal_start_p->actor_amb_col, &prev_pal_end_p->actor_amb_col, + &next_pal_end_p->actor_amb_col, color_ratio, g_env_light.pat_ratio, + add_col, + g_env_light.field_0x1210 * (g_env_light.now_actcol_ratio * g_env_light.now_actcol_ratio)); for (int i = 0; i < 4; i++) { if (i != 3 || (strcmp(dComIfGp_getStartStageName(), "R_SP127") != 0 && strcmp(dComIfGp_getStartStageName(), "F_SP127") != 0)) { - dKy_calc_color_set(&mTerrainAmbienceBG[i], &pale0_p->mBgAmbColor[i], - &pale2_p->mBgAmbColor[i], &pale1_p->mBgAmbColor[i], - &pale3_p->mBgAmbColor[i], blendAB, g_env_light.mColPatBlend, - addCol, g_env_light.mColBgColRatio); + dKy_calc_color_set(&bg_amb_col[i], &prev_pal_start_p->bg_amb_col[i], + &next_pal_start_p->bg_amb_col[i], + &prev_pal_end_p->bg_amb_col[i], + &next_pal_end_p->bg_amb_col[i], color_ratio, + g_env_light.pat_ratio, add_col, g_env_light.now_bgcol_ratio); } } if (daPy_py_c::checkNowWolfPowerUp()) { - dKy_WolfPowerup_AmbCol(&mActorAmbience); - dKy_WolfPowerup_BgAmbCol(&mTerrainAmbienceBG[0]); + dKy_WolfPowerup_AmbCol(&actor_amb_col); + dKy_WolfPowerup_BgAmbCol(&bg_amb_col[0]); } - mTerrainAmbienceBG[1].a = (u8)kankyo_color_ratio_set( - pale0_p->mBgAmbColor1A, pale1_p->mBgAmbColor1A, blendAB, pale2_p->mBgAmbColor1A, - pale3_p->mBgAmbColor1A, g_env_light.mColPatBlend, 0, 1.0f); - mTerrainAmbienceBG[2].a = (u8)kankyo_color_ratio_set( - pale0_p->mBgAmbColor2A, pale1_p->mBgAmbColor2A, blendAB, pale2_p->mBgAmbColor2A, - pale3_p->mBgAmbColor2A, g_env_light.mColPatBlend, 0, 1.0f); - mTerrainAmbienceBG[3].a = (u8)kankyo_color_ratio_set( - pale0_p->mBgAmbColor3A, pale1_p->mBgAmbColor3A, blendAB, pale2_p->mBgAmbColor3A, - pale3_p->mBgAmbColor3A, g_env_light.mColPatBlend, 0, 1.0f); + bg_amb_col[1].a = (u8)kankyo_color_ratio_set( + prev_pal_start_p->BG1_amb_alpha, prev_pal_end_p->BG1_amb_alpha, color_ratio, + next_pal_start_p->BG1_amb_alpha, next_pal_end_p->BG1_amb_alpha, + g_env_light.pat_ratio, 0, 1.0f); + bg_amb_col[2].a = (u8)kankyo_color_ratio_set( + prev_pal_start_p->BG2_amb_alpha, prev_pal_end_p->BG2_amb_alpha, color_ratio, + next_pal_start_p->BG2_amb_alpha, next_pal_end_p->BG2_amb_alpha, + g_env_light.pat_ratio, 0, 1.0f); + bg_amb_col[3].a = (u8)kankyo_color_ratio_set( + prev_pal_start_p->BG3_amb_alpha, prev_pal_end_p->BG3_amb_alpha, color_ratio, + next_pal_start_p->BG3_amb_alpha, next_pal_end_p->BG3_amb_alpha, + g_env_light.pat_ratio, 0, 1.0f); - s16 tmp = kankyo_color_ratio_set( - pale0_p->mTerrainLightInfluence, pale1_p->mTerrainLightInfluence, blendAB, - pale2_p->mTerrainLightInfluence, pale3_p->mTerrainLightInfluence, - g_env_light.mColPatBlend, 0, 1.0f); - mPaletteTerrainLightEffect = tmp * 0.01f; - if (mPaletteTerrainLightEffect > 2.0f) { - mPaletteTerrainLightEffect = 1.0f; + s16 bg_light_inf = kankyo_color_ratio_set( + prev_pal_start_p->bg_light_influence, prev_pal_end_p->bg_light_influence, + color_ratio, next_pal_start_p->bg_light_influence, + next_pal_end_p->bg_light_influence, g_env_light.pat_ratio, 0, 1.0f); + bg_light_influence = bg_light_inf * 0.01f; + if (bg_light_influence > 2.0f) { + bg_light_influence = 1.0f; } mFogDensity = kankyo_color_ratio_set( - pale0_p->mCloudShadowDensity, pale1_p->mCloudShadowDensity, blendAB, - pale2_p->mCloudShadowDensity, pale3_p->mCloudShadowDensity, - g_env_light.mColPatBlend, 0, 1.0f); + prev_pal_start_p->cloud_shadow_density, prev_pal_end_p->cloud_shadow_density, + color_ratio, next_pal_start_p->cloud_shadow_density, + next_pal_end_p->cloud_shadow_density, g_env_light.pat_ratio, 0, 1.0f); if (daPy_py_c::checkNowWolfPowerUp()) { mFogDensity = -1; } for (int i = 0; i < 6; i++) { - dKy_calc_color_set(&field_0x1128[i], &pale0_p->mPlightColor[i], - &pale2_p->mPlightColor[i], &pale1_p->mPlightColor[i], - &pale3_p->mPlightColor[i], blendAB, g_env_light.mColPatBlend, - addCol, g_env_light.mColBgColRatio); + dKy_calc_color_set(&dungeonlight_col[i], &prev_pal_start_p->plight_col[i], + &next_pal_start_p->plight_col[i], &prev_pal_end_p->plight_col[i], + &next_pal_end_p->plight_col[i], color_ratio, + g_env_light.pat_ratio, add_col, g_env_light.now_bgcol_ratio); if (daPy_py_c::checkNowWolfPowerUp()) { - field_0x1128[i].r = 0; - field_0x1128[i].g = 0; - field_0x1128[i].b = 0; + dungeonlight_col[i].r = 0; + dungeonlight_col[i].g = 0; + dungeonlight_col[i].b = 0; } - g_env_light.mDungeonLights[i].mColor.r = field_0x1128[i].r; - g_env_light.mDungeonLights[i].mColor.g = field_0x1128[i].g; - g_env_light.mDungeonLights[i].mColor.b = field_0x1128[i].b; + g_env_light.dungeonlight[i].mColor.r = dungeonlight_col[i].r; + g_env_light.dungeonlight[i].mColor.g = dungeonlight_col[i].g; + g_env_light.dungeonlight[i].mColor.b = dungeonlight_col[i].b; } - dKy_calc_color_set(&mFogColor, &pale0_p->mFogColor, &pale2_p->mFogColor, - &pale1_p->mFogColor, &pale3_p->mFogColor, blendAB, - g_env_light.mColPatBlend, mFogAddCol, g_env_light.mColFogColRatio); + dKy_calc_color_set(&fog_col, &prev_pal_start_p->fog_col, &next_pal_start_p->fog_col, + &prev_pal_end_p->fog_col, &next_pal_end_p->fog_col, color_ratio, + g_env_light.pat_ratio, addcol_fog, g_env_light.now_fogcol_ratio); mFogNear = float_kankyo_color_ratio_set( - pale0_p->mFogStartZ, pale1_p->mFogStartZ, blendAB, pale2_p->mFogStartZ, - pale3_p->mFogStartZ, g_env_light.mColPatBlend, g_env_light.field_0x11ec, - g_env_light.field_0x11f4); + prev_pal_start_p->fog_start_z, prev_pal_end_p->fog_start_z, color_ratio, + next_pal_start_p->fog_start_z, next_pal_end_p->fog_start_z, g_env_light.pat_ratio, + g_env_light.field_0x11ec, g_env_light.field_0x11f4); mFogFar = float_kankyo_color_ratio_set( - pale0_p->mFogEndZ, pale1_p->mFogEndZ, blendAB, pale2_p->mFogEndZ, pale3_p->mFogEndZ, - g_env_light.mColPatBlend, g_env_light.field_0x11f0, g_env_light.field_0x11f4); + prev_pal_start_p->fog_end_z, prev_pal_end_p->fog_end_z, color_ratio, + next_pal_start_p->fog_end_z, next_pal_end_p->fog_end_z, g_env_light.pat_ratio, + g_env_light.field_0x11f0, g_env_light.field_0x11f4); if (daPy_py_c::checkNowWolfPowerUp()) { - mFogColor.r = 0; - mFogColor.g = 0; - mFogColor.b = 0; + fog_col.r = 0; + fog_col.g = 0; + fog_col.b = 0; dKy_WolfPowerup_FogNearFar(&mFogNear, &mFogFar); } - u8 bloomIdx0 = pale0_p->mBloomTblIdx; - u8 bloomIdx2 = pale2_p->mBloomTblIdx; - u8 bloomIdx1 = pale1_p->mBloomTblIdx; - u8 bloomIdx3 = pale3_p->mBloomTblIdx; + u8 prev_bloom_start_id = prev_pal_start_p->bloom_tbl_id; + u8 next_bloom_start_id = next_pal_start_p->bloom_tbl_id; + u8 prev_bloom_end_id = prev_pal_end_p->bloom_tbl_id; + u8 next_bloom_end_id = next_pal_end_p->bloom_tbl_id; if (daPy_py_c::checkNowWolfPowerUp()) { - bloomIdx3 = 3; - bloomIdx1 = 3; - bloomIdx2 = 3; - bloomIdx0 = 3; + next_bloom_end_id = 3; + prev_bloom_end_id = 3; + next_bloom_start_id = 3; + prev_bloom_start_id = 3; } f32 temp_f31; if (g_env_light.field_0x12fc >= 0) { - bloomIdx1 = g_env_light.field_0x12fc; - bloomIdx3 = g_env_light.field_0x12fc; - temp_f31 = blendAB; - blendAB = g_env_light.field_0x1278; + prev_bloom_end_id = g_env_light.field_0x12fc; + next_bloom_end_id = g_env_light.field_0x12fc; + temp_f31 = color_ratio; + color_ratio = g_env_light.field_0x1278; } - dkydata_bloomInfo_info_class* bloomInf0_p; - dkydata_bloomInfo_info_class* bloomInf1_p; - dkydata_bloomInfo_info_class* bloomInf2_p; - dkydata_bloomInfo_info_class* bloomInf3_p; + dKydata_BloomInfo_c* bloomInf0_p; + dKydata_BloomInfo_c* bloomInf1_p; + dKydata_BloomInfo_c* bloomInf2_p; + dKydata_BloomInfo_c* bloomInf3_p; - bloomInf0_p = dKyd_BloomInf_tbl_getp(bloomIdx0); - bloomInf2_p = dKyd_BloomInf_tbl_getp(bloomIdx2); - bloomInf1_p = dKyd_BloomInf_tbl_getp(bloomIdx1); - bloomInf3_p = dKyd_BloomInf_tbl_getp(bloomIdx3); + bloomInf0_p = dKyd_BloomInf_tbl_getp(prev_bloom_start_id); + bloomInf2_p = dKyd_BloomInf_tbl_getp(next_bloom_start_id); + bloomInf1_p = dKyd_BloomInf_tbl_getp(prev_bloom_end_id); + bloomInf3_p = dKyd_BloomInf_tbl_getp(next_bloom_end_id); - u8 temp_r14 = kankyo_color_ratio_set( - bloomInf0_p->mThreshold, bloomInf1_p->mThreshold, blendAB, bloomInf2_p->mThreshold, - bloomInf3_p->mThreshold, g_env_light.mColPatBlend, 0, 1.0f); - mDoGph_gInf_c::getBloom()->setPoint(temp_r14); - u8 blureSize = (u8)kankyo_color_ratio_set( - bloomInf0_p->mBlurAmount, bloomInf1_p->mBlurAmount, blendAB, - bloomInf2_p->mBlurAmount, bloomInf3_p->mBlurAmount, g_env_light.mColPatBlend, 0, - 1.0f); + u8 bloom_point = kankyo_color_ratio_set( + bloomInf0_p->mThreshold, bloomInf1_p->mThreshold, color_ratio, + bloomInf2_p->mThreshold, bloomInf3_p->mThreshold, g_env_light.pat_ratio, 0, 1.0f); + mDoGph_gInf_c::getBloom()->setPoint(bloom_point); + + u8 blure_size = (u8)kankyo_color_ratio_set( + bloomInf0_p->mBlurAmount, bloomInf1_p->mBlurAmount, color_ratio, + bloomInf2_p->mBlurAmount, bloomInf3_p->mBlurAmount, g_env_light.pat_ratio, 0, 1.0f); if (dKy_darkworld_check()) { static s16 S_fuwan_sin; @@ -1967,66 +2057,66 @@ void dScnKy_env_light_c::setLight() { f32 sin = cM_ssin(S_fuwan_sin); S_fuwan_sin += (s16)cM_rndF(2000.0f) + 500; - blureSize += (u8)(sin * (0.2f * blureSize)); + blure_size += (u8)(sin * (0.2f * blure_size)); } - mDoGph_gInf_c::getBloom()->setBlureSize(blureSize); + mDoGph_gInf_c::getBloom()->setBlureSize(blure_size); mDoGph_gInf_c::getBloom()->setBlureRatio(kankyo_color_ratio_set( - bloomInf0_p->mDensity, bloomInf1_p->mDensity, blendAB, bloomInf2_p->mDensity, - bloomInf3_p->mDensity, g_env_light.mColPatBlend, 0, 1.0f)); + bloomInf0_p->mDensity, bloomInf1_p->mDensity, color_ratio, bloomInf2_p->mDensity, + bloomInf3_p->mDensity, g_env_light.pat_ratio, 0, 1.0f)); - GXColor blendCol; - blendCol.r = kankyo_color_ratio_set(bloomInf0_p->mColorR, bloomInf1_p->mColorR, blendAB, - bloomInf2_p->mColorR, bloomInf3_p->mColorR, - g_env_light.mColPatBlend, 0, 1.0f); - blendCol.g = kankyo_color_ratio_set(bloomInf0_p->mColorG, bloomInf1_p->mColorG, blendAB, - bloomInf2_p->mColorG, bloomInf3_p->mColorG, - g_env_light.mColPatBlend, 0, 1.0f); - blendCol.b = kankyo_color_ratio_set(bloomInf0_p->mColorB, bloomInf1_p->mColorB, blendAB, - bloomInf2_p->mColorB, bloomInf3_p->mColorB, - g_env_light.mColPatBlend, 0, 1.0f); - blendCol.a = kankyo_color_ratio_set( - bloomInf0_p->mOrigDensity, bloomInf1_p->mOrigDensity, blendAB, - bloomInf2_p->mOrigDensity, bloomInf3_p->mOrigDensity, g_env_light.mColPatBlend, 0, - 1.0f); - mDoGph_gInf_c::getBloom()->setBlendColor(blendCol); + GXColor bloom_blend_col; + bloom_blend_col.r = kankyo_color_ratio_set( + bloomInf0_p->mColorR, bloomInf1_p->mColorR, color_ratio, bloomInf2_p->mColorR, + bloomInf3_p->mColorR, g_env_light.pat_ratio, 0, 1.0f); + bloom_blend_col.g = kankyo_color_ratio_set( + bloomInf0_p->mColorG, bloomInf1_p->mColorG, color_ratio, bloomInf2_p->mColorG, + bloomInf3_p->mColorG, g_env_light.pat_ratio, 0, 1.0f); + bloom_blend_col.b = kankyo_color_ratio_set( + bloomInf0_p->mColorB, bloomInf1_p->mColorB, color_ratio, bloomInf2_p->mColorB, + bloomInf3_p->mColorB, g_env_light.pat_ratio, 0, 1.0f); + bloom_blend_col.a = + kankyo_color_ratio_set(bloomInf0_p->mOrigDensity, bloomInf1_p->mOrigDensity, + color_ratio, bloomInf2_p->mOrigDensity, + bloomInf3_p->mOrigDensity, g_env_light.pat_ratio, 0, 1.0f); + mDoGph_gInf_c::getBloom()->setBlendColor(bloom_blend_col); if (g_env_light.field_0x12fc >= 0) { - blendAB = temp_f31; + color_ratio = temp_f31; } - GXColor monoCol; - monoCol.r = kankyo_color_ratio_set( - bloomInf0_p->mSaturateSubtractR, bloomInf1_p->mSaturateSubtractR, blendAB, + GXColor bloom_mono_col; + bloom_mono_col.r = kankyo_color_ratio_set( + bloomInf0_p->mSaturateSubtractR, bloomInf1_p->mSaturateSubtractR, color_ratio, bloomInf2_p->mSaturateSubtractR, bloomInf3_p->mSaturateSubtractR, - g_env_light.mColPatBlend, 0, 1.0f); - monoCol.g = kankyo_color_ratio_set( - bloomInf0_p->mSaturateSubtractG, bloomInf1_p->mSaturateSubtractG, blendAB, + g_env_light.pat_ratio, 0, 1.0f); + bloom_mono_col.g = kankyo_color_ratio_set( + bloomInf0_p->mSaturateSubtractG, bloomInf1_p->mSaturateSubtractG, color_ratio, bloomInf2_p->mSaturateSubtractG, bloomInf3_p->mSaturateSubtractG, - g_env_light.mColPatBlend, 0, 1.0f); - monoCol.b = kankyo_color_ratio_set( - bloomInf0_p->mSaturateSubtractB, bloomInf1_p->mSaturateSubtractB, blendAB, + g_env_light.pat_ratio, 0, 1.0f); + bloom_mono_col.b = kankyo_color_ratio_set( + bloomInf0_p->mSaturateSubtractB, bloomInf1_p->mSaturateSubtractB, color_ratio, bloomInf2_p->mSaturateSubtractB, bloomInf3_p->mSaturateSubtractB, - g_env_light.mColPatBlend, 0, 1.0f); - monoCol.a = kankyo_color_ratio_set( - bloomInf0_p->mSaturateSubtractA, bloomInf1_p->mSaturateSubtractA, blendAB, + g_env_light.pat_ratio, 0, 1.0f); + bloom_mono_col.a = kankyo_color_ratio_set( + bloomInf0_p->mSaturateSubtractA, bloomInf1_p->mSaturateSubtractA, color_ratio, bloomInf2_p->mSaturateSubtractA, bloomInf3_p->mSaturateSubtractA, - g_env_light.mColPatBlend, 0, 1.0f); - mDoGph_gInf_c::getBloom()->setMonoColor(monoCol); + g_env_light.pat_ratio, 0, 1.0f); + mDoGph_gInf_c::getBloom()->setMonoColor(bloom_mono_col); - if (temp_r14 >= 0xFF) { + if (bloom_point >= 0xFF) { mDoGph_gInf_c::getBloom()->setEnable(0); } else { u8 mode = 0; mDoGph_gInf_c::getBloom()->setEnable(1); - if (bloomIdx0 != 0 && bloomInf0_p->mType != 0) { + if (prev_bloom_start_id != 0 && bloomInf0_p->mType != 0) { mode = 1; - } else if (bloomIdx2 != 0 && bloomInf2_p->mType != 0) { + } else if (next_bloom_start_id != 0 && bloomInf2_p->mType != 0) { mode = 1; - } else if (bloomIdx1 != 0 && bloomInf1_p->mType != 0) { + } else if (prev_bloom_end_id != 0 && bloomInf1_p->mType != 0) { mode = 1; - } else if (bloomIdx3 != 0 && bloomInf3_p->mType != 0) { + } else if (next_bloom_end_id != 0 && bloomInf3_p->mType != 0) { mode = 1; } @@ -2042,14 +2132,14 @@ void dScnKy_env_light_c::setLight() { f32 var_f4; f32 var_f5; - if (palIdx0 < 6) { - var_f1 = now_shadow_alpha[palIdx0]; + if (start_pat_pal_id < 6) { + var_f1 = now_shadow_alpha[start_pat_pal_id]; } else { var_f1 = 0.25f; } - if (palIdx1 < 6) { - var_f2 = now_shadow_alpha[palIdx1]; + if (end_pat_pal_id < 6) { + var_f2 = now_shadow_alpha[end_pat_pal_id]; } else { var_f2 = 0.25f; } @@ -2057,13 +2147,13 @@ void dScnKy_env_light_c::setLight() { var_f4 = 0.25f; var_f5 = 0.25f; - if (pale0_p == pale2_p) { + if (prev_pal_start_p == next_pal_start_p) { var_f4 = var_f1; var_f5 = var_f2; } - var_f30 = float_kankyo_color_ratio_set(var_f1, var_f2, blendAB, var_f4, var_f5, - g_env_light.mColPatBlend, 0.0f, 0.0f); + var_f30 = float_kankyo_color_ratio_set(var_f1, var_f2, color_ratio, var_f4, var_f5, + g_env_light.pat_ratio, 0.0f, 0.0f); field_0x123c = 0.8f; if (mColpatWeather != 0) { @@ -2079,129 +2169,150 @@ void dScnKy_env_light_c::setLight() { field_0x123c = 0.55f; } - if (g_env_light.mInitAnmTimer != 0) { + if (g_env_light.light_init_timer != 0) { field_0x1238 = var_f30; } else { cLib_addCalc(&field_0x1238, var_f30, 0.05f, 0.005f, 0.000001f); } - stage_vrboxcol_info_class* vrbox0_p = &g_env_light.mpDmVrbox[pale0_p->mVirtIdx]; - stage_vrboxcol_info_class* vrbox1_p = &g_env_light.mpDmVrbox[pale1_p->mVirtIdx]; - stage_vrboxcol_info_class* vrbox2_p = &g_env_light.mpDmVrbox[pale2_p->mVirtIdx]; - stage_vrboxcol_info_class* vrbox3_p = &g_env_light.mpDmVrbox[pale3_p->mVirtIdx]; + stage_vrboxcol_info_class* prev_vrboxcol_start_p = &g_env_light.stage_vrboxcol_info[prev_pal_start_p->vrboxcol_id]; + stage_vrboxcol_info_class* prev_vrboxcol_end_p = &g_env_light.stage_vrboxcol_info[prev_pal_end_p->vrboxcol_id]; + stage_vrboxcol_info_class* next_vrboxcol_start_p = &g_env_light.stage_vrboxcol_info[next_pal_start_p->vrboxcol_id]; + stage_vrboxcol_info_class* next_vrboxcol_end_p = &g_env_light.stage_vrboxcol_info[next_pal_end_p->vrboxcol_id]; - mVrSkyCol.r = kankyo_color_ratio_set( - vrbox0_p->field_0x0.r, vrbox1_p->field_0x0.r, blendAB, vrbox2_p->field_0x0.r, - vrbox3_p->field_0x0.r, g_env_light.mColPatBlend, mVrboxAddcolSky0.r, - g_env_light.mColVrboxSoraColRatio * g_env_light.field_0x11c8); - mVrSkyCol.g = kankyo_color_ratio_set( - vrbox0_p->field_0x0.g, vrbox1_p->field_0x0.g, blendAB, vrbox2_p->field_0x0.g, - vrbox3_p->field_0x0.g, g_env_light.mColPatBlend, mVrboxAddcolSky0.g, - g_env_light.mColVrboxSoraColRatio * g_env_light.field_0x11cc); - mVrSkyCol.b = kankyo_color_ratio_set( - vrbox0_p->field_0x0.b, vrbox1_p->field_0x0.b, blendAB, vrbox2_p->field_0x0.b, - vrbox3_p->field_0x0.b, g_env_light.mColPatBlend, mVrboxAddcolSky0.b, - g_env_light.mColVrboxSoraColRatio * g_env_light.field_0x11d0); - mVrSkyCol.a = 255; + vrbox_sky_col.r = kankyo_color_ratio_set( + prev_vrboxcol_start_p->sky_col.r, prev_vrboxcol_end_p->sky_col.r, color_ratio, + next_vrboxcol_start_p->sky_col.r, next_vrboxcol_end_p->sky_col.r, + g_env_light.pat_ratio, vrbox_addcol_sky0.r, + g_env_light.now_vrboxsoracol_ratio * g_env_light.unk_0x11c8); + vrbox_sky_col.g = kankyo_color_ratio_set( + prev_vrboxcol_start_p->sky_col.g, prev_vrboxcol_end_p->sky_col.g, color_ratio, + next_vrboxcol_start_p->sky_col.g, next_vrboxcol_end_p->sky_col.g, + g_env_light.pat_ratio, vrbox_addcol_sky0.g, + g_env_light.now_vrboxsoracol_ratio * g_env_light.unk_0x11cc); + vrbox_sky_col.b = kankyo_color_ratio_set( + prev_vrboxcol_start_p->sky_col.b, prev_vrboxcol_end_p->sky_col.b, color_ratio, + next_vrboxcol_start_p->sky_col.b, next_vrboxcol_end_p->sky_col.b, + g_env_light.pat_ratio, vrbox_addcol_sky0.b, + g_env_light.now_vrboxsoracol_ratio * g_env_light.unk_0x11d0); + vrbox_sky_col.a = 255; - mVrkumoCol.r = kankyo_color_ratio_set( - vrbox0_p->field_0x3.r, vrbox1_p->field_0x3.r, blendAB, vrbox2_p->field_0x3.r, - vrbox3_p->field_0x3.r, g_env_light.mColPatBlend, mVrboxAddcolSky0.r, - g_env_light.mColVrboxKumocolRatio * g_env_light.field_0x11c8); - mVrkumoCol.g = kankyo_color_ratio_set( - vrbox0_p->field_0x3.g, vrbox1_p->field_0x3.g, blendAB, vrbox2_p->field_0x3.g, - vrbox3_p->field_0x3.g, g_env_light.mColPatBlend, mVrboxAddcolSky0.g, - g_env_light.mColVrboxKumocolRatio * g_env_light.field_0x11cc); - mVrkumoCol.b = kankyo_color_ratio_set( - vrbox0_p->field_0x3.b, vrbox1_p->field_0x3.b, blendAB, vrbox2_p->field_0x3.b, - vrbox3_p->field_0x3.b, g_env_light.mColPatBlend, mVrboxAddcolSky0.b, - g_env_light.mColVrboxKumocolRatio * g_env_light.field_0x11d0); - mVrkumoCol.a = kankyo_color_ratio_set( - vrbox0_p->field_0x9.a, vrbox1_p->field_0x9.a, blendAB, vrbox2_p->field_0x9.a, - vrbox3_p->field_0x9.a, g_env_light.mColPatBlend, 0, 1.0f); + vrbox_kumo_top_col.r = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kumo_top_col.r, prev_vrboxcol_end_p->kumo_top_col.r, + color_ratio, next_vrboxcol_start_p->kumo_top_col.r, + next_vrboxcol_end_p->kumo_top_col.r, g_env_light.pat_ratio, vrbox_addcol_sky0.r, + g_env_light.now_vrboxkumocol_ratio * g_env_light.unk_0x11c8); + vrbox_kumo_top_col.g = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kumo_top_col.g, prev_vrboxcol_end_p->kumo_top_col.g, + color_ratio, next_vrboxcol_start_p->kumo_top_col.g, + next_vrboxcol_end_p->kumo_top_col.g, g_env_light.pat_ratio, vrbox_addcol_sky0.g, + g_env_light.now_vrboxkumocol_ratio * g_env_light.unk_0x11cc); + vrbox_kumo_top_col.b = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kumo_top_col.b, prev_vrboxcol_end_p->kumo_top_col.b, + color_ratio, next_vrboxcol_start_p->kumo_top_col.b, + next_vrboxcol_end_p->kumo_top_col.b, g_env_light.pat_ratio, vrbox_addcol_sky0.b, + g_env_light.now_vrboxkumocol_ratio * g_env_light.unk_0x11d0); + vrbox_kumo_top_col.a = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kumo_shadow_col.a, prev_vrboxcol_end_p->kumo_shadow_col.a, + color_ratio, next_vrboxcol_start_p->kumo_shadow_col.a, + next_vrboxcol_end_p->kumo_shadow_col.a, g_env_light.pat_ratio, 0, 1.0f); - mVrShitaGumoCol.r = kankyo_color_ratio_set( - vrbox0_p->field_0x6.r, vrbox1_p->field_0x6.r, blendAB, vrbox2_p->field_0x6.r, - vrbox3_p->field_0x6.r, g_env_light.mColPatBlend, mVrboxAddcolSky0.r, - g_env_light.mColVrboxKumocolRatio * g_env_light.field_0x11c8); - mVrShitaGumoCol.g = kankyo_color_ratio_set( - vrbox0_p->field_0x6.g, vrbox1_p->field_0x6.g, blendAB, vrbox2_p->field_0x6.g, - vrbox3_p->field_0x6.g, g_env_light.mColPatBlend, mVrboxAddcolSky0.g, - g_env_light.mColVrboxKumocolRatio * g_env_light.field_0x11cc); - mVrShitaGumoCol.b = kankyo_color_ratio_set( - vrbox0_p->field_0x6.b, vrbox1_p->field_0x6.b, blendAB, vrbox2_p->field_0x6.b, - vrbox3_p->field_0x6.b, g_env_light.mColPatBlend, mVrboxAddcolSky0.b, - g_env_light.mColVrboxKumocolRatio * g_env_light.field_0x11d0); + vrbox_kumo_bottom_col.r = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kumo_bottom_col.r, prev_vrboxcol_end_p->kumo_bottom_col.r, + color_ratio, next_vrboxcol_start_p->kumo_bottom_col.r, + next_vrboxcol_end_p->kumo_bottom_col.r, g_env_light.pat_ratio, vrbox_addcol_sky0.r, + g_env_light.now_vrboxkumocol_ratio * g_env_light.unk_0x11c8); + vrbox_kumo_bottom_col.g = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kumo_bottom_col.g, prev_vrboxcol_end_p->kumo_bottom_col.g, + color_ratio, next_vrboxcol_start_p->kumo_bottom_col.g, + next_vrboxcol_end_p->kumo_bottom_col.g, g_env_light.pat_ratio, vrbox_addcol_sky0.g, + g_env_light.now_vrboxkumocol_ratio * g_env_light.unk_0x11cc); + vrbox_kumo_bottom_col.b = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kumo_bottom_col.b, prev_vrboxcol_end_p->kumo_bottom_col.b, + color_ratio, next_vrboxcol_start_p->kumo_bottom_col.b, + next_vrboxcol_end_p->kumo_bottom_col.b, g_env_light.pat_ratio, vrbox_addcol_sky0.b, + g_env_light.now_vrboxkumocol_ratio * g_env_light.unk_0x11d0); - mVrShitaUneiCol.r = kankyo_color_ratio_set( - vrbox0_p->field_0x9.r, vrbox1_p->field_0x9.r, blendAB, vrbox2_p->field_0x9.r, - vrbox3_p->field_0x9.r, g_env_light.mColPatBlend, mVrboxAddcolSky0.r, - g_env_light.mColVrboxKumocolRatio * g_env_light.field_0x11c8); - mVrShitaUneiCol.g = kankyo_color_ratio_set( - vrbox0_p->field_0x9.g, vrbox1_p->field_0x9.g, blendAB, vrbox2_p->field_0x9.g, - vrbox3_p->field_0x9.g, g_env_light.mColPatBlend, mVrboxAddcolSky0.g, - g_env_light.mColVrboxKumocolRatio * g_env_light.field_0x11cc); - mVrShitaUneiCol.b = kankyo_color_ratio_set( - vrbox0_p->field_0x9.b, vrbox1_p->field_0x9.b, blendAB, vrbox2_p->field_0x9.b, - vrbox3_p->field_0x9.b, g_env_light.mColPatBlend, mVrboxAddcolSky0.b, - g_env_light.mColVrboxKumocolRatio * g_env_light.field_0x11d0); + vrbox_kumo_shadow_col.r = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kumo_shadow_col.r, prev_vrboxcol_end_p->kumo_shadow_col.r, + color_ratio, next_vrboxcol_start_p->kumo_shadow_col.r, + next_vrboxcol_end_p->kumo_shadow_col.r, g_env_light.pat_ratio, vrbox_addcol_sky0.r, + g_env_light.now_vrboxkumocol_ratio * g_env_light.unk_0x11c8); + vrbox_kumo_shadow_col.g = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kumo_shadow_col.g, prev_vrboxcol_end_p->kumo_shadow_col.g, + color_ratio, next_vrboxcol_start_p->kumo_shadow_col.g, + next_vrboxcol_end_p->kumo_shadow_col.g, g_env_light.pat_ratio, vrbox_addcol_sky0.g, + g_env_light.now_vrboxkumocol_ratio * g_env_light.unk_0x11cc); + vrbox_kumo_shadow_col.b = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kumo_shadow_col.b, prev_vrboxcol_end_p->kumo_shadow_col.b, + color_ratio, next_vrboxcol_start_p->kumo_shadow_col.b, + next_vrboxcol_end_p->kumo_shadow_col.b, g_env_light.pat_ratio, vrbox_addcol_sky0.b, + g_env_light.now_vrboxkumocol_ratio * g_env_light.unk_0x11d0); - mVrKasumiCol.r = kankyo_color_ratio_set( - vrbox0_p->field_0xd.r, vrbox1_p->field_0xd.r, blendAB, vrbox2_p->field_0xd.r, - vrbox3_p->field_0xd.r, g_env_light.mColPatBlend, mVrboxAddcolKasumi.r, - g_env_light.mColVrboxSoraColRatio * g_env_light.field_0x11c8); - mVrKasumiCol.g = kankyo_color_ratio_set( - vrbox0_p->field_0xd.g, vrbox1_p->field_0xd.g, blendAB, vrbox2_p->field_0xd.g, - vrbox3_p->field_0xd.g, g_env_light.mColPatBlend, mVrboxAddcolKasumi.g, - g_env_light.mColVrboxSoraColRatio * g_env_light.field_0x11cc); - mVrKasumiCol.b = kankyo_color_ratio_set( - vrbox0_p->field_0xd.b, vrbox1_p->field_0xd.b, blendAB, vrbox2_p->field_0xd.b, - vrbox3_p->field_0xd.b, g_env_light.mColPatBlend, mVrboxAddcolKasumi.b, - g_env_light.mColVrboxSoraColRatio * g_env_light.field_0x11d0); - mVrKasumiCol.a = kankyo_color_ratio_set( - vrbox0_p->field_0xd.a, vrbox1_p->field_0xd.a, blendAB, vrbox2_p->field_0xd.a, - vrbox3_p->field_0xd.a, g_env_light.mColPatBlend, 0, 1.0f); + vrbox_kasumi_outer_col.r = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kasumi_outer_col.r, prev_vrboxcol_end_p->kasumi_outer_col.r, + color_ratio, next_vrboxcol_start_p->kasumi_outer_col.r, + next_vrboxcol_end_p->kasumi_outer_col.r, g_env_light.pat_ratio, + vrbox_addcol_kasumi.r, g_env_light.now_vrboxsoracol_ratio * g_env_light.unk_0x11c8); + vrbox_kasumi_outer_col.g = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kasumi_outer_col.g, prev_vrboxcol_end_p->kasumi_outer_col.g, + color_ratio, next_vrboxcol_start_p->kasumi_outer_col.g, + next_vrboxcol_end_p->kasumi_outer_col.g, g_env_light.pat_ratio, + vrbox_addcol_kasumi.g, g_env_light.now_vrboxsoracol_ratio * g_env_light.unk_0x11cc); + vrbox_kasumi_outer_col.b = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kasumi_outer_col.b, prev_vrboxcol_end_p->kasumi_outer_col.b, + color_ratio, next_vrboxcol_start_p->kasumi_outer_col.b, + next_vrboxcol_end_p->kasumi_outer_col.b, g_env_light.pat_ratio, + vrbox_addcol_kasumi.b, g_env_light.now_vrboxsoracol_ratio * g_env_light.unk_0x11d0); + vrbox_kasumi_outer_col.a = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kasumi_outer_col.a, prev_vrboxcol_end_p->kasumi_outer_col.a, + color_ratio, next_vrboxcol_start_p->kasumi_outer_col.a, + next_vrboxcol_end_p->kasumi_outer_col.a, g_env_light.pat_ratio, 0, 1.0f); - mVrOkuKasumiCol.r = kankyo_color_ratio_set( - vrbox0_p->field_0x11.r, vrbox1_p->field_0x11.r, blendAB, vrbox2_p->field_0x11.r, - vrbox3_p->field_0x11.r, g_env_light.mColPatBlend, mVrboxAddcolKasumi.r, - g_env_light.mColVrboxSoraColRatio * g_env_light.field_0x11c8); - mVrOkuKasumiCol.g = kankyo_color_ratio_set( - vrbox0_p->field_0x11.g, vrbox1_p->field_0x11.g, blendAB, vrbox2_p->field_0x11.g, - vrbox3_p->field_0x11.g, g_env_light.mColPatBlend, mVrboxAddcolKasumi.g, - g_env_light.mColVrboxSoraColRatio * g_env_light.field_0x11cc); - mVrOkuKasumiCol.b = kankyo_color_ratio_set( - vrbox0_p->field_0x11.b, vrbox1_p->field_0x11.b, blendAB, vrbox2_p->field_0x11.b, - vrbox3_p->field_0x11.b, g_env_light.mColPatBlend, mVrboxAddcolKasumi.b, - g_env_light.mColVrboxSoraColRatio * g_env_light.field_0x11d0); - mVrOkuKasumiCol.a = kankyo_color_ratio_set( - vrbox0_p->field_0x11.a, vrbox1_p->field_0x11.a, blendAB, vrbox2_p->field_0x11.a, - vrbox3_p->field_0x11.a, g_env_light.mColPatBlend, 0, 1.0f); + vrbox_kasumi_inner_col.r = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kasumi_inner_col.r, prev_vrboxcol_end_p->kasumi_inner_col.r, + color_ratio, next_vrboxcol_start_p->kasumi_inner_col.r, + next_vrboxcol_end_p->kasumi_inner_col.r, g_env_light.pat_ratio, + vrbox_addcol_kasumi.r, g_env_light.now_vrboxsoracol_ratio * g_env_light.unk_0x11c8); + vrbox_kasumi_inner_col.g = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kasumi_inner_col.g, prev_vrboxcol_end_p->kasumi_inner_col.g, + color_ratio, next_vrboxcol_start_p->kasumi_inner_col.g, + next_vrboxcol_end_p->kasumi_inner_col.g, g_env_light.pat_ratio, + vrbox_addcol_kasumi.g, g_env_light.now_vrboxsoracol_ratio * g_env_light.unk_0x11cc); + vrbox_kasumi_inner_col.b = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kasumi_inner_col.b, prev_vrboxcol_end_p->kasumi_inner_col.b, + color_ratio, next_vrboxcol_start_p->kasumi_inner_col.b, + next_vrboxcol_end_p->kasumi_inner_col.b, g_env_light.pat_ratio, + vrbox_addcol_kasumi.b, g_env_light.now_vrboxsoracol_ratio * g_env_light.unk_0x11d0); + vrbox_kasumi_inner_col.a = kankyo_color_ratio_set( + prev_vrboxcol_start_p->kasumi_inner_col.a, prev_vrboxcol_end_p->kasumi_inner_col.a, + color_ratio, next_vrboxcol_start_p->kasumi_inner_col.a, + next_vrboxcol_end_p->kasumi_inner_col.a, g_env_light.pat_ratio, 0, 1.0f); if (daPy_py_c::checkNowWolfPowerUp()) { - mVrSkyCol.r = 0; - mVrSkyCol.g = 0; - mVrSkyCol.b = 0; + vrbox_sky_col.r = 0; + vrbox_sky_col.g = 0; + vrbox_sky_col.b = 0; - mVrkumoCol.r = 0; - mVrkumoCol.g = 0; - mVrkumoCol.b = 0; + vrbox_kumo_top_col.r = 0; + vrbox_kumo_top_col.g = 0; + vrbox_kumo_top_col.b = 0; - mVrShitaGumoCol.r = 0; - mVrShitaGumoCol.g = 0; - mVrShitaGumoCol.b = 0; + vrbox_kumo_bottom_col.r = 0; + vrbox_kumo_bottom_col.g = 0; + vrbox_kumo_bottom_col.b = 0; - mVrShitaUneiCol.r = 0; - mVrShitaUneiCol.g = 0; - mVrShitaUneiCol.b = 0; + vrbox_kumo_shadow_col.r = 0; + vrbox_kumo_shadow_col.g = 0; + vrbox_kumo_shadow_col.b = 0; - mVrKasumiCol.r = 0; - mVrKasumiCol.g = 0; - mVrKasumiCol.b = 0; + vrbox_kasumi_outer_col.r = 0; + vrbox_kasumi_outer_col.g = 0; + vrbox_kasumi_outer_col.b = 0; - mVrOkuKasumiCol.r = 0; - mVrOkuKasumiCol.g = 0; - mVrOkuKasumiCol.b = 0; + vrbox_kasumi_inner_col.r = 0; + vrbox_kasumi_inner_col.g = 0; + vrbox_kasumi_inner_col.b = 0; } } } @@ -2209,261 +2320,267 @@ void dScnKy_env_light_c::setLight() { /* 801A133C-801A16C0 19BC7C 0384+00 2/2 0/0 0/0 .text * setLight_bg__18dScnKy_env_light_cFP12dKy_tevstr_cP11_GXColorS10P11_GXColorS10PfPf */ -void dScnKy_env_light_c::setLight_bg(dKy_tevstr_c* i_tevstr, GXColorS10* param_1, - GXColorS10* param_2, f32* i_fogStartZ, f32* i_fogEndZ) { - i_tevstr->mColpatPrev = g_env_light.mColPatPrev; - i_tevstr->mColpatCurr = g_env_light.mColPatCurr; +void dScnKy_env_light_c::setLight_bg(dKy_tevstr_c* tevstr_p, GXColorS10* bg_col_p, + GXColorS10* fog_col_p, f32* fog_near_p, f32* fog_far_p) { + tevstr_p->wether_pat0 = g_env_light.wether_pat0; + tevstr_p->wether_pat1 = g_env_light.wether_pat1; - if (i_tevstr->mColpatPrev != i_tevstr->mColpatCurr) { - i_tevstr->mColpatBlend = g_env_light.mColPatBlend; + if (tevstr_p->wether_pat0 != tevstr_p->wether_pat1) { + tevstr_p->pat_ratio = g_env_light.pat_ratio; } - u8 pale0; - u8 pale2; - u8 pale1; - u8 pale3; - f32 blendAB; - int palIdx0; - int palIdx1; + u8 prev_pal_start_id; + u8 next_pal_start_id; + u8 prev_pal_end_id; + u8 next_pal_end_id; + f32 color_ratio; + int start_pat_pal_id; + int end_pat_pal_id; int i; - setLight_palno_get(&i_tevstr->mEnvrIdxPrev, &i_tevstr->mEnvrIdxCurr, &i_tevstr->mColpatPrev, - &i_tevstr->mColpatCurr, &pale0, &pale1, &pale2, &pale3, &blendAB, &palIdx0, - &palIdx1, &i_tevstr->mColpatBlend, &i_tevstr->mInitTimer); + setLight_palno_get(&tevstr_p->PrevCol, &tevstr_p->UseCol, &tevstr_p->wether_pat0, + &tevstr_p->wether_pat1, &prev_pal_start_id, &prev_pal_end_id, + &next_pal_start_id, &next_pal_end_id, &color_ratio, &start_pat_pal_id, + &end_pat_pal_id, &tevstr_p->pat_ratio, &tevstr_p->mInitTimer); - if (pale0 == 0xFF) { + if (prev_pal_start_id == 0xFF) { for (int i = 0; i < 4; i++) { - param_1[i].r = 255; - param_1[i].g = 0; - param_1[i].b = 0; + bg_col_p[i].r = 255; + bg_col_p[i].g = 0; + bg_col_p[i].b = 0; } } else { - stage_palette_info_class* pale0_p = &g_env_light.mpDmPalet[pale0]; - stage_palette_info_class* pale1_p = &g_env_light.mpDmPalet[pale1]; - stage_palette_info_class* pale2_p = &g_env_light.mpDmPalet[pale2]; - stage_palette_info_class* pale3_p = &g_env_light.mpDmPalet[pale3]; + stage_palette_info_class* prev_pal_start_p = &g_env_light.stage_palette_info[prev_pal_start_id]; + stage_palette_info_class* prev_pal_end_p = &g_env_light.stage_palette_info[prev_pal_end_id]; + stage_palette_info_class* next_pal_start_p = &g_env_light.stage_palette_info[next_pal_start_id]; + stage_palette_info_class* next_pal_end_p = &g_env_light.stage_palette_info[next_pal_end_id]; for (int i = 0; i < 4; i++) { - dKy_calc_color_set(¶m_1[i], &pale0_p->mBgAmbColor[i], &pale2_p->mBgAmbColor[i], - &pale1_p->mBgAmbColor[i], &pale3_p->mBgAmbColor[i], blendAB, - i_tevstr->mColpatBlend, mBgAddColAmb, g_env_light.mColBgColRatio); + dKy_calc_color_set(&bg_col_p[i], &prev_pal_start_p->bg_amb_col[i], + &next_pal_start_p->bg_amb_col[i], &prev_pal_end_p->bg_amb_col[i], + &next_pal_end_p->bg_amb_col[i], color_ratio, tevstr_p->pat_ratio, + bg_addcol_amb, g_env_light.now_bgcol_ratio); } if (daPy_py_c::checkNowWolfEyeUp()) { - dKy_WolfPowerup_BgAmbCol(param_1); + dKy_WolfPowerup_BgAmbCol(bg_col_p); } - param_1[3].a = 255; - param_1[2].a = 255; - param_1[1].a = 255; - param_1[0].a = 255; + bg_col_p[3].a = 255; + bg_col_p[2].a = 255; + bg_col_p[1].a = 255; + bg_col_p[0].a = 255; - GXColorS10 sp50[6]; + GXColorS10 plight_colors[6]; for (i = 0; i < 6; i++) { - dKy_calc_color_set(&sp50[i], &pale0_p->mPlightColor[i], &pale2_p->mPlightColor[i], - &pale1_p->mPlightColor[i], &pale3_p->mPlightColor[i], blendAB, - i_tevstr->mColpatBlend, mBgAddColAmb, g_env_light.mColBgColRatio); + dKy_calc_color_set(&plight_colors[i], &prev_pal_start_p->plight_col[i], + &next_pal_start_p->plight_col[i], &prev_pal_end_p->plight_col[i], + &next_pal_end_p->plight_col[i], color_ratio, tevstr_p->pat_ratio, + bg_addcol_amb, g_env_light.now_bgcol_ratio); if (daPy_py_c::checkNowWolfEyeUp()) { - sp50[i].r = 0; - sp50[i].g = 0; - sp50[i].b = 0; + plight_colors[i].r = 0; + plight_colors[i].g = 0; + plight_colors[i].b = 0; } - J3DLightInfo& light_info = i_tevstr->mLights[i].getLightInfo(); + J3DLightInfo& light_info = tevstr_p->mLights[i].getLightInfo(); - GXColor sp28; - sp28.r = sp50[i].r; - sp28.g = sp50[i].g; - sp28.b = sp50[i].b; - sp28.a = sp50[i].a; - light_info.mColor = dKy_light_influence_col(&sp28, i_tevstr->field_0x374); + GXColor light_color; + light_color.r = plight_colors[i].r; + light_color.g = plight_colors[i].g; + light_color.b = plight_colors[i].b; + light_color.a = plight_colors[i].a; + light_info.mColor = dKy_light_influence_col(&light_color, tevstr_p->field_0x374); } - dKy_calc_color_set(param_2, &pale0_p->mFogColor, &pale2_p->mFogColor, &pale1_p->mFogColor, - &pale3_p->mFogColor, blendAB, i_tevstr->mColpatBlend, mFogAddCol, - g_env_light.mColFogColRatio); + dKy_calc_color_set(fog_col_p, &prev_pal_start_p->fog_col, &next_pal_start_p->fog_col, + &prev_pal_end_p->fog_col, &next_pal_end_p->fog_col, color_ratio, + tevstr_p->pat_ratio, addcol_fog, g_env_light.now_fogcol_ratio); - *i_fogStartZ = float_kankyo_color_ratio_set( - pale0_p->mFogStartZ, pale1_p->mFogStartZ, blendAB, pale2_p->mFogStartZ, - pale3_p->mFogStartZ, i_tevstr->mColpatBlend, g_env_light.field_0x11ec, - g_env_light.field_0x11f4); - *i_fogEndZ = float_kankyo_color_ratio_set( - pale0_p->mFogEndZ, pale1_p->mFogEndZ, blendAB, pale2_p->mFogEndZ, pale3_p->mFogEndZ, - i_tevstr->mColpatBlend, g_env_light.field_0x11f0, g_env_light.field_0x11f4); + *fog_near_p = float_kankyo_color_ratio_set( + prev_pal_start_p->fog_start_z, prev_pal_end_p->fog_start_z, color_ratio, + next_pal_start_p->fog_start_z, next_pal_end_p->fog_start_z, tevstr_p->pat_ratio, + g_env_light.field_0x11ec, g_env_light.field_0x11f4); + *fog_far_p = float_kankyo_color_ratio_set( + prev_pal_start_p->fog_end_z, prev_pal_end_p->fog_end_z, color_ratio, + next_pal_start_p->fog_end_z, next_pal_end_p->fog_end_z, tevstr_p->pat_ratio, + g_env_light.field_0x11f0, g_env_light.field_0x11f4); if (daPy_py_c::checkNowWolfEyeUp()) { - param_2->r = 0; - param_2->g = 0; - param_2->b = 0; - dKy_WolfPowerup_FogNearFar(i_fogStartZ, i_fogEndZ); + fog_col_p->r = 0; + fog_col_p->g = 0; + fog_col_p->b = 0; + dKy_WolfPowerup_FogNearFar(fog_near_p, fog_far_p); } } } /* 801A16C0-801A1D64 19C000 06A4+00 1/1 0/0 0/0 .text * setLight_actor__18dScnKy_env_light_cFP12dKy_tevstr_cP11_GXColorS10PfPf */ -// NONMATCHING regalloc -void dScnKy_env_light_c::setLight_actor(dKy_tevstr_c* i_tevstr, GXColorS10* i_fogColor, - f32* i_fogStartZ, f32* i_fogEndZ) { - u8 palIdx0A; - u8 palIdx1A; - u8 palIdx0B; - u8 palIdx1B; - f32 blendAB; - int palIdx0; - int palIdx1; +void dScnKy_env_light_c::setLight_actor(dKy_tevstr_c* tevstr_p, GXColorS10* fog_col_p, + f32* fog_near_p, f32* fog_far_p) { + u8 prev_pal_start_id; + u8 next_pal_start_id; + u8 prev_pal_end_id; + u8 next_pal_end_id; + f32 color_ratio; + int start_pat_pal_id; + int end_pat_pal_id; int i; - i_tevstr->mColpatPrev = g_env_light.mColPatPrev; - i_tevstr->mColpatCurr = g_env_light.mColPatCurr; - if (i_tevstr->mColpatPrev != i_tevstr->mColpatCurr) { - i_tevstr->mColpatBlend = g_env_light.mColPatBlend; - } else if (i_tevstr->mEnvrIdxPrev == i_tevstr->mEnvrIdxCurr) { - i_tevstr->mColpatBlend = 0.0f; + tevstr_p->wether_pat0 = g_env_light.wether_pat0; + tevstr_p->wether_pat1 = g_env_light.wether_pat1; + if (tevstr_p->wether_pat0 != tevstr_p->wether_pat1) { + tevstr_p->pat_ratio = g_env_light.pat_ratio; + } else if (tevstr_p->PrevCol == tevstr_p->UseCol) { + tevstr_p->pat_ratio = 0.0f; } - setLight_palno_get(&i_tevstr->mEnvrIdxPrev, &i_tevstr->mEnvrIdxCurr, &i_tevstr->mColpatPrev, - &i_tevstr->mColpatCurr, &palIdx0A, &palIdx0B, &palIdx1A, &palIdx1B, &blendAB, - &palIdx0, &palIdx1, &i_tevstr->mColpatBlend, &i_tevstr->mInitTimer); + setLight_palno_get(&tevstr_p->PrevCol, &tevstr_p->UseCol, &tevstr_p->wether_pat0, + &tevstr_p->wether_pat1, &prev_pal_start_id, &prev_pal_end_id, + &next_pal_start_id, &next_pal_end_id, &color_ratio, &start_pat_pal_id, + &end_pat_pal_id, &tevstr_p->pat_ratio, &tevstr_p->mInitTimer); - if (palIdx0A == 0xFF) { - for (int i = 0; i < 4; i++) { - i_tevstr->mColorC0.r = 255; - i_tevstr->mColorC0.g = 0; - i_tevstr->mColorC0.b = 0; + if (prev_pal_start_id == 0xFF) { + for (i = 0; i < 4; i++) { + tevstr_p->AmbCol.r = 255; + tevstr_p->AmbCol.g = 0; + tevstr_p->AmbCol.b = 0; } } else { - stage_palette_info_class* pale0_p = &g_env_light.mpDmPalet[palIdx0A]; - stage_palette_info_class* pale1_p = &g_env_light.mpDmPalet[palIdx0B]; - stage_palette_info_class* pale2_p = &g_env_light.mpDmPalet[palIdx1A]; - stage_palette_info_class* pale3_p = &g_env_light.mpDmPalet[palIdx1B]; + stage_palette_info_class* prev_pal_start_p = &g_env_light.stage_palette_info[prev_pal_start_id]; + stage_palette_info_class* prev_pal_end_p = &g_env_light.stage_palette_info[prev_pal_end_id]; + stage_palette_info_class* next_pal_start_p = &g_env_light.stage_palette_info[next_pal_start_id]; + stage_palette_info_class* next_pal_end_p = &g_env_light.stage_palette_info[next_pal_end_id]; - if (i_tevstr->field_0x37a == 10 || i_tevstr->field_0x37a == 9 || i_tevstr->field_0x378 != 0) - { - dKy_calc_color_set(&i_tevstr->mColorC0, &pale0_p->mActorAmbColor, - &pale2_p->mActorAmbColor, &pale1_p->mActorAmbColor, - &pale3_p->mActorAmbColor, blendAB, i_tevstr->mColpatBlend, - mActorAddColAmb, - i_tevstr->field_0x374 * - (g_env_light.mColActColRatio * g_env_light.mColActColRatio)); + if (tevstr_p->Type == 10 || tevstr_p->Type == 9 || tevstr_p->Material_id != 0) { + dKy_calc_color_set(&tevstr_p->AmbCol, &prev_pal_start_p->actor_amb_col, + &next_pal_start_p->actor_amb_col, &prev_pal_end_p->actor_amb_col, + &next_pal_end_p->actor_amb_col, color_ratio, tevstr_p->pat_ratio, + actor_addcol_amb, + tevstr_p->field_0x374 * + (g_env_light.now_actcol_ratio * g_env_light.now_actcol_ratio)); } else { - dKy_calc_color_set( - &i_tevstr->mColorC0, &pale0_p->mActorAmbColor, &pale2_p->mActorAmbColor, - &pale1_p->mActorAmbColor, &pale3_p->mActorAmbColor, blendAB, i_tevstr->mColpatBlend, - mActorAddColAmb, - i_tevstr->field_0x374 * (g_env_light.field_0x1210 * (g_env_light.mColActColRatio * - g_env_light.mColActColRatio))); + dKy_calc_color_set(&tevstr_p->AmbCol, &prev_pal_start_p->actor_amb_col, + &next_pal_start_p->actor_amb_col, &prev_pal_end_p->actor_amb_col, + &next_pal_end_p->actor_amb_col, color_ratio, tevstr_p->pat_ratio, + actor_addcol_amb, + tevstr_p->field_0x374 * + (g_env_light.field_0x1210 * (g_env_light.now_actcol_ratio * g_env_light.now_actcol_ratio))); } if (daPy_py_c::checkNowWolfPowerUp()) { - dKy_WolfPowerup_AmbCol(&i_tevstr->mColorC0); + dKy_WolfPowerup_AmbCol(&tevstr_p->AmbCol); } - GXColorS10 sp88[6]; + GXColorS10 plight_col[6]; for (i = 0; i < 6; i++) { - J3DLightInfo& light_info = i_tevstr->mLights[i].getLightInfo(); + J3DLightInfo* light_info = &tevstr_p->mLights[i].getLightInfo(); if (i == 0) { - if (i_tevstr->field_0x37a == 10 || i_tevstr->field_0x37a == 9 || - i_tevstr->field_0x378 != 0) - { - dKy_calc_color_set(&sp88[i], &pale0_p->mPlightColor[i], - &pale2_p->mPlightColor[i], &pale1_p->mPlightColor[i], - &pale3_p->mPlightColor[i], blendAB, i_tevstr->mColpatBlend, - mActorAddColAmb, 1.0f); + if (tevstr_p->Type == 10 || tevstr_p->Type == 9 || tevstr_p->Material_id != 0) { + dKy_calc_color_set(&plight_col[i], &prev_pal_start_p->plight_col[i], + &next_pal_start_p->plight_col[i], + &prev_pal_end_p->plight_col[i], + &next_pal_end_p->plight_col[i], color_ratio, + tevstr_p->pat_ratio, actor_addcol_amb, 1.0f); if (daPy_py_c::checkNowWolfPowerUp()) { - sp88[i].r = 0; - sp88[i].g = 0; - sp88[i].b = 0; + plight_col[i].r = 0; + plight_col[i].g = 0; + plight_col[i].b = 0; } - GXColor sp30; - sp30.r = sp88[i].r; - sp30.g = sp88[i].g; - sp30.b = sp88[i].b; - sp30.a = sp88[i].a; - light_info.mColor = dKy_light_influence_col(&sp30, i_tevstr->field_0x374); + light_info = &tevstr_p->mLights[i].getLightInfo(); + + GXColor light_col; + light_col.r = plight_col[i].r; + light_col.g = plight_col[i].g; + light_col.b = plight_col[i].b; + light_col.a = plight_col[i].a; + light_info->mColor = dKy_light_influence_col(&light_col, tevstr_p->field_0x374); } else { - dKy_calc_color_set(&sp88[i], &pale0_p->mPlightColor[i], - &pale2_p->mPlightColor[i], &pale1_p->mPlightColor[i], - &pale3_p->mPlightColor[i], blendAB, i_tevstr->mColpatBlend, - mActorAddColAmb, g_env_light.field_0x1210); + dKy_calc_color_set( + &plight_col[i], &prev_pal_start_p->plight_col[i], + &next_pal_start_p->plight_col[i], &prev_pal_end_p->plight_col[i], + &next_pal_end_p->plight_col[i], color_ratio, tevstr_p->pat_ratio, + actor_addcol_amb, g_env_light.field_0x1210); if (daPy_py_c::checkNowWolfPowerUp()) { - sp88[i].r = 0; - sp88[i].g = 0; - sp88[i].b = 0; + plight_col[i].r = 0; + plight_col[i].g = 0; + plight_col[i].b = 0; } - kankyo_color_ratio_calc(&light_info.mColor, sp88[i], - field_0x1210 * i_tevstr->field_0x374); + kankyo_color_ratio_calc(&light_info->mColor, plight_col[i], + field_0x1210 * tevstr_p->field_0x374); } - } else if (i_tevstr->field_0x37a == 10 || i_tevstr->field_0x37a == 9 || - i_tevstr->field_0x378 != 0) - { - dKy_calc_color_set(&sp88[i], &pale0_p->mPlightColor[i], &pale2_p->mPlightColor[i], - &pale1_p->mPlightColor[i], &pale3_p->mPlightColor[i], blendAB, - i_tevstr->mColpatBlend, mActorAddColAmb, - g_env_light.mColActColRatio * g_env_light.mColActColRatio); + } else if (tevstr_p->Type == 10 || tevstr_p->Type == 9 || tevstr_p->Material_id != 0) { + dKy_calc_color_set(&plight_col[i], &prev_pal_start_p->plight_col[i], + &next_pal_start_p->plight_col[i], &prev_pal_end_p->plight_col[i], + &next_pal_end_p->plight_col[i], color_ratio, tevstr_p->pat_ratio, + actor_addcol_amb, + g_env_light.now_actcol_ratio * g_env_light.now_actcol_ratio); if (daPy_py_c::checkNowWolfPowerUp()) { - sp88[i].r = 0; - sp88[i].g = 0; - sp88[i].b = 0; + plight_col[i].r = 0; + plight_col[i].g = 0; + plight_col[i].b = 0; } - GXColor sp30; - sp30.r = sp88[i].r; - sp30.g = sp88[i].g; - sp30.b = sp88[i].b; - sp30.a = sp88[i].a; - light_info.mColor = dKy_light_influence_col(&sp30, i_tevstr->field_0x374); + GXColor light_col; + light_col.r = plight_col[i].r; + light_col.g = plight_col[i].g; + light_col.b = plight_col[i].b; + light_col.a = plight_col[i].a; + light_info->mColor = dKy_light_influence_col(&light_col, tevstr_p->field_0x374); } else { - dKy_calc_color_set(&sp88[i], &pale0_p->mPlightColor[i], &pale2_p->mPlightColor[i], - &pale1_p->mPlightColor[i], &pale3_p->mPlightColor[i], blendAB, - i_tevstr->mColpatBlend, mActorAddColAmb, - g_env_light.field_0x1210 * - (g_env_light.mColActColRatio * g_env_light.mColActColRatio)); + dKy_calc_color_set(&plight_col[i], &prev_pal_start_p->plight_col[i], + &next_pal_start_p->plight_col[i], &prev_pal_end_p->plight_col[i], + &next_pal_end_p->plight_col[i], color_ratio, tevstr_p->pat_ratio, + actor_addcol_amb, + g_env_light.field_0x1210 * (g_env_light.now_actcol_ratio * + g_env_light.now_actcol_ratio)); if (daPy_py_c::checkNowWolfPowerUp()) { - sp88[i].r = 0; - sp88[i].g = 0; - sp88[i].b = 0; + plight_col[i].r = 0; + plight_col[i].g = 0; + plight_col[i].b = 0; } - kankyo_color_ratio_calc(&light_info.mColor, sp88[i], - field_0x1210 * i_tevstr->field_0x374); + kankyo_color_ratio_calc(&light_info->mColor, plight_col[i], + field_0x1210 * tevstr_p->field_0x374); } } - dKy_calc_color_set(i_fogColor, &pale0_p->mFogColor, &pale2_p->mFogColor, - &pale1_p->mFogColor, &pale3_p->mFogColor, blendAB, - i_tevstr->mColpatBlend, mFogAddCol, g_env_light.mColFogColRatio); - if ((i_tevstr->field_0x37a != 10 && i_tevstr->field_0x37a != 9) || - g_env_light.field_0x1210 == 1.0f) - { - *i_fogStartZ = float_kankyo_color_ratio_set( - pale0_p->mFogStartZ, pale1_p->mFogStartZ, blendAB, pale2_p->mFogStartZ, - pale3_p->mFogStartZ, i_tevstr->mColpatBlend, g_env_light.field_0x11ec, - g_env_light.field_0x11f4); - *i_fogEndZ = float_kankyo_color_ratio_set( - pale0_p->mFogEndZ, pale1_p->mFogEndZ, blendAB, pale2_p->mFogEndZ, pale3_p->mFogEndZ, - i_tevstr->mColpatBlend, g_env_light.field_0x11f0, g_env_light.field_0x11f4); + dKy_calc_color_set(fog_col_p, &prev_pal_start_p->fog_col, &next_pal_start_p->fog_col, + &prev_pal_end_p->fog_col, &next_pal_end_p->fog_col, color_ratio, + tevstr_p->pat_ratio, addcol_fog, g_env_light.now_fogcol_ratio); + if ((tevstr_p->Type != 10 && tevstr_p->Type != 9) || g_env_light.field_0x1210 == 1.0f) { + *fog_near_p = float_kankyo_color_ratio_set( + prev_pal_start_p->fog_start_z, prev_pal_end_p->fog_start_z, color_ratio, + next_pal_start_p->fog_start_z, next_pal_end_p->fog_start_z, tevstr_p->pat_ratio, + g_env_light.field_0x11ec, g_env_light.field_0x11f4); + *fog_far_p = float_kankyo_color_ratio_set( + prev_pal_start_p->fog_end_z, prev_pal_end_p->fog_end_z, color_ratio, + next_pal_start_p->fog_end_z, next_pal_end_p->fog_end_z, tevstr_p->pat_ratio, + g_env_light.field_0x11f0, g_env_light.field_0x11f4); } else { - *i_fogStartZ = float_kankyo_color_ratio_set( - pale0_p->mFogStartZ, pale1_p->mFogStartZ, blendAB, pale2_p->mFogStartZ, - pale3_p->mFogStartZ, i_tevstr->mColpatBlend, g_env_light.field_0x11ec, 0.0f); - *i_fogEndZ = float_kankyo_color_ratio_set( - pale0_p->mFogEndZ, pale1_p->mFogEndZ, blendAB, pale2_p->mFogEndZ, pale3_p->mFogEndZ, - i_tevstr->mColpatBlend, g_env_light.field_0x11f0, 0.0f); + *fog_near_p = float_kankyo_color_ratio_set( + prev_pal_start_p->fog_start_z, prev_pal_end_p->fog_start_z, color_ratio, + next_pal_start_p->fog_start_z, next_pal_end_p->fog_start_z, tevstr_p->pat_ratio, + g_env_light.field_0x11ec, 0.0f); + *fog_far_p = float_kankyo_color_ratio_set( + prev_pal_start_p->fog_end_z, prev_pal_end_p->fog_end_z, color_ratio, + next_pal_start_p->fog_end_z, next_pal_end_p->fog_end_z, tevstr_p->pat_ratio, + g_env_light.field_0x11f0, 0.0f); } if (daPy_py_c::checkNowWolfPowerUp()) { - i_fogColor->r = 0; - i_fogColor->g = 0; - i_fogColor->b = 0; - dKy_WolfPowerup_FogNearFar(i_fogStartZ, i_fogEndZ); + fog_col_p->r = 0; + fog_col_p->g = 0; + fog_col_p->b = 0; + dKy_WolfPowerup_FogNearFar(fog_near_p, fog_far_p); } } } @@ -2471,81 +2588,82 @@ void dScnKy_env_light_c::setLight_actor(dKy_tevstr_c* i_tevstr, GXColorS10* i_fo /* 801A1D64-801A1F58 19C6A4 01F4+00 1/1 0/0 0/0 .text * settingTevStruct_colget_actor__18dScnKy_env_light_cFP4cXyzP12dKy_tevstr_cP11_GXColorS10P11_GXColorS10PfPf */ -void dScnKy_env_light_c::settingTevStruct_colget_actor(cXyz* param_0, dKy_tevstr_c* i_tevstr, - GXColorS10* i_color, GXColorS10* i_fogColor, - f32* i_fogStartZ, f32* i_fogEndZ) { - if (i_tevstr->mEnvrIdxOverride != 0xFF) { - f32 target = i_tevstr->mEnvrIdxOverride / 100.0f; +void dScnKy_env_light_c::settingTevStruct_colget_actor(cXyz* unused, dKy_tevstr_c* tevstr_p, + GXColorS10* out_color_p, + GXColorS10* fog_col_p, f32* fog_near_p, + f32* fog_far_p) { + if (tevstr_p->YukaCol != 0xFF) { + f32 target = tevstr_p->YukaCol / 100.0f; if (g_env_light.mActorLightEffect == 100) { - cLib_addCalc(&i_tevstr->field_0x374, target, 0.25f, 0.05f, 0.000001f); + cLib_addCalc(&tevstr_p->field_0x374, target, 0.25f, 0.05f, 0.000001f); } - } else if (i_tevstr->mRoomNo >= 0) { - i_tevstr->mEnvrIdxCurr = i_tevstr->mRoomNo; + } else if (tevstr_p->room_no >= 0) { + tevstr_p->UseCol = tevstr_p->room_no; if (g_env_light.mActorLightEffect == 100) { - cLib_addCalc(&i_tevstr->field_0x374, 1.0f, 0.25f, 0.05f, 0.000001f); + cLib_addCalc(&tevstr_p->field_0x374, 1.0f, 0.25f, 0.05f, 0.000001f); } } else { - i_tevstr->mEnvrIdxCurr = 0; + tevstr_p->UseCol = 0; } - if ((i_tevstr->field_0x37a >= 1 && i_tevstr->field_0x37a <= 7) || - (i_tevstr->field_0x37a == 9 && dKy_darkworld_check())) + if ((tevstr_p->Type >= 1 && tevstr_p->Type <= 7) || + (tevstr_p->Type == 9 && dKy_darkworld_check())) { - if ((i_tevstr->field_0x37a != 2 && i_tevstr->field_0x37a != 3) || dKy_darkworld_check()) { - i_tevstr->field_0x374 = 0.0f; + if ((tevstr_p->Type != 2 && tevstr_p->Type != 3) || dKy_darkworld_check()) { + tevstr_p->field_0x374 = 0.0f; } } - if (i_tevstr->mEnvrIdxPrev != i_tevstr->mEnvrIdxCurr && - (i_tevstr->mColpatBlend >= 1.0f || i_tevstr->mColpatBlend <= 0.0f)) + if (tevstr_p->PrevCol != tevstr_p->UseCol && + (tevstr_p->pat_ratio >= 1.0f || tevstr_p->pat_ratio <= 0.0f)) { - i_tevstr->mColpatBlend = 0.0f; + tevstr_p->pat_ratio = 0.0f; } - if (i_tevstr->field_0x37a != 8) { - setLight_actor(i_tevstr, i_fogColor, i_fogStartZ, i_fogEndZ); - i_color->r = i_tevstr->mColorC0.r; - i_color->g = i_tevstr->mColorC0.g; - i_color->b = i_tevstr->mColorC0.b; - i_color->a = i_tevstr->mColorC0.a; + if (tevstr_p->Type != 8) { + setLight_actor(tevstr_p, fog_col_p, fog_near_p, fog_far_p); + out_color_p->r = tevstr_p->AmbCol.r; + out_color_p->g = tevstr_p->AmbCol.g; + out_color_p->b = tevstr_p->AmbCol.b; + out_color_p->a = tevstr_p->AmbCol.a; } else { - GXColorS10 sp8[4]; - setLight_bg(i_tevstr, sp8, i_fogColor, i_fogStartZ, i_fogEndZ); - i_color->r = sp8[0].r; - i_color->g = sp8[0].g; - i_color->b = sp8[0].b; - i_color->a = sp8[0].a; + GXColorS10 BG_col[4]; + setLight_bg(tevstr_p, BG_col, fog_col_p, fog_near_p, fog_far_p); + out_color_p->r = BG_col[0].r; + out_color_p->g = BG_col[0].g; + out_color_p->b = BG_col[0].b; + out_color_p->a = BG_col[0].a; } } /* 801A1F58-801A2090 19C898 0138+00 1/1 0/0 0/0 .text * settingTevStruct_colget_player__18dScnKy_env_light_cFP12dKy_tevstr_c */ -void dScnKy_env_light_c::settingTevStruct_colget_player(dKy_tevstr_c* i_tevstr) { - if (i_tevstr->mEnvrIdxOverride != 0xFF) { - f32 target = i_tevstr->mEnvrIdxOverride / 100.0f; +void dScnKy_env_light_c::settingTevStruct_colget_player(dKy_tevstr_c* tevstr_p) { + if (tevstr_p->YukaCol != 0xFF) { + f32 target = tevstr_p->YukaCol / 100.0f; if (g_env_light.mActorLightEffect == 100) { - cLib_addCalc(&i_tevstr->field_0x374, target, 0.25f, 0.05f, 0.000001f); + cLib_addCalc(&tevstr_p->field_0x374, target, 0.25f, 0.05f, 0.000001f); } - } else if (i_tevstr->mRoomNo >= 0) { - i_tevstr->mEnvrIdxCurr = i_tevstr->mRoomNo; + } else if (tevstr_p->room_no >= 0) { + tevstr_p->UseCol = tevstr_p->room_no; if (g_env_light.mActorLightEffect == 100) { - cLib_addCalc(&i_tevstr->field_0x374, 1.0f, 0.25f, 0.05f, 0.000001f); + cLib_addCalc(&tevstr_p->field_0x374, 1.0f, 0.25f, 0.05f, 0.000001f); } } - if (g_env_light.mEnvrIdxCurr != i_tevstr->mEnvrIdxCurr) { - if (i_tevstr->mEnvrIdxCurr == g_env_light.mEnvrIdxPrev) { - g_env_light.mEnvrIdxPrev = g_env_light.mEnvrIdxCurr; - g_env_light.mEnvrIdxCurr = i_tevstr->mEnvrIdxCurr; - g_env_light.mColPatBlend = 1.0f - g_env_light.mColPatBlend; + if (g_env_light.UseCol != tevstr_p->UseCol) { + if (tevstr_p->UseCol == g_env_light.PrevCol) { + g_env_light.PrevCol = g_env_light.UseCol; + g_env_light.UseCol = tevstr_p->UseCol; + g_env_light.pat_ratio = 1.0f - g_env_light.pat_ratio; - i_tevstr->mColpatBlend = 1.0f - g_env_light.mColPatBlend; - } else if (g_env_light.mColPatBlend >= 1.0f || g_env_light.mColPatBlend <= 0.0f) { - g_env_light.mEnvrIdxCurr = i_tevstr->mEnvrIdxCurr; - g_env_light.mColPatBlend = 0.0f; - i_tevstr->mColpatBlend = 0.0f; + tevstr_p->pat_ratio = 1.0f - g_env_light.pat_ratio; + } else if (g_env_light.pat_ratio >= 1.0f || g_env_light.pat_ratio <= 0.0f) { + g_env_light.UseCol = tevstr_p->UseCol; + g_env_light.pat_ratio = 0.0f; + tevstr_p->pat_ratio = 0.0f; } } } @@ -2571,37 +2689,400 @@ static void cLib_addCalcU8(u8* i_value, u8 i_target, s16 i_scale, s16 i_maxStep) *i_value = value; } -/* 803BC070-803BC080 019190 0010+00 0/1 0/0 0/0 .data flush_col$7304 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 flush_col[16] = { - 0x01, 0x00, 0x00, 0x00, 0x04, 0x43, 0x73, 0x58, 0x0A, 0x25, 0x3E, 0x2D, 0x14, 0x00, 0x00, 0x00, -}; -#pragma pop - -/* 803BC080-803BC090 0191A0 0010+00 0/1 0/0 0/0 .data flush_col2$7305 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 flush_col2[16] = { - 0x01, 0x00, 0x00, 0x00, 0x04, 0x6E, 0x5A, 0x00, 0x08, 0x4B, 0x22, 0x00, 0x0F, 0x00, 0x00, 0x00, -}; -#pragma pop - -/* 803BC090-803BC0A0 0191B0 0010+00 0/1 0/0 0/0 .data flush_col3$7306 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 flush_col3[16] = { - 0x01, 0x00, 0x00, 0x00, 0x04, 0x46, 0x4D, 0x43, 0x0F, 0x22, 0x1E, 0x00, 0x14, 0x00, 0x00, 0x00, -}; -#pragma pop - /* 801A2128-801A37C4 19CA68 169C+00 2/1 0/0 0/0 .text * settingTevStruct_plightcol_plus__18dScnKy_env_light_cFP4cXyzP12dKy_tevstr_c11_GXColorS1011_GXColorS10Uc */ -void dScnKy_env_light_c::settingTevStruct_plightcol_plus(cXyz* param_0, dKy_tevstr_c* param_1, - _GXColorS10 param_2, - _GXColorS10 param_3, u8 param_4) { - // NONMATCHING +void dScnKy_env_light_c::settingTevStruct_plightcol_plus(cXyz* pos_p, dKy_tevstr_c* tevstr_p, + GXColorS10 param_2, GXColorS10 param_3, + u8 init_timer) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + cXyz light_pos; + Vec spDC; + MtxP view_mtx = j3dSys.getViewMtx(); + f32 light_dist; + f32 light_power; + f32 light_yuragi; + int sp40 = 0; + int sp3C = 0; + int light_inf_id; + u8 sp9 = 0; + f32 sp34 = 1.0f; + daPy_py_c* player = daPy_getPlayerActorClass(); + + if (pos_p != NULL) { + J3DLightInfo* light_info = &tevstr_p->mLightObj.getLightInfo(); + light_info->mColor.a = 0xFF; + + light_inf_id = dKy_light_influence_id(*pos_p, 0); + BOOL sp44 = 0; + + if (tevstr_p->Type == 7 || tevstr_p->Type == 1 || + ((tevstr_p->Type == 2 || tevstr_p->Type == 6 || tevstr_p->Type == 3) && + dKy_darkworld_check()) || + tevstr_p->Type == 4 || tevstr_p->Type == 5) + { + light_inf_id = -2; + } else if (tevstr_p->Type == 9 && dKy_darkworld_check()) { + light_inf_id = -2; + } + + if (light_inf_id >= 0) { + light_dist = dKy_light_influence_distance(*pos_p, light_inf_id); + light_power = dKy_light_influence_power(light_inf_id); + + if (light_power < 0.001f) { + light_power = 0.001f; + } + + if (light_dist < 1000.0f + light_power) { + sp44 = 1; + } + } + + if (sp44 == 0) { + light_pos = kankyo->base_light.mPosition; + light_dist = kankyo->base_light.mPosition.abs(*pos_p); + light_power = kankyo->base_light.mPow; + light_yuragi = kankyo->base_light.mFluctuation; + + field_0x10f8.r = 0; + field_0x10f8.g = 0; + field_0x10f8.b = 0; + + if ((light_inf_id <= -2 || (light_inf_id == -1 && dKy_Outdoor_check() == TRUE) || + strcmp(dComIfGp_getStartStageName(), "D_MN09A") == 0)) + { + cXyz camfwd; + camera_class* camera = (camera_class*)dComIfGp_getCamera(0); + J3DLightInfo* light0_info = &tevstr_p->mLights[0].getLightInfo(); + sp9 = 1; + + dKyr_get_vectle_calc(&camera->lookat.center, &camera->lookat.eye, &camfwd); + light_pos = *pos_p + (camfwd * 500.0f); + light_pos.y += 40.0f; + + if (tevstr_p->Type >= 1 && tevstr_p->Type <= 9) { + dKyr_get_vectle_calc(&camera->lookat.center, &camera->lookat.eye, &camfwd); + light_pos = camera->lookat.eye + (camfwd * 180.0f); + } + + field_0x10f8.r = light0_info->mColor.r; + field_0x10f8.g = light0_info->mColor.g; + field_0x10f8.b = light0_info->mColor.b; + + light_yuragi = 0.0f; + light_power = 120.0f; + light_dist = 100.0f; + sp40 = 1; + sp3C = 1; + + if (strcmp(dComIfGp_getStartStageName(), "D_MN09A") == 0) { + if (dComIfG_play_c::getLayerNo(0) == 0) { + if (tevstr_p->Type == 0) { + field_0x10f8.r = 0x1E; + field_0x10f8.g = 0x37; + field_0x10f8.b = 0x6E; + + light_pos.y += -800.0f; + light_power = 250.0f; + } + } else if (dComIfG_play_c::getLayerNo(0) == 1 && tevstr_p->Type == 0) { + field_0x10f8.r = 0x3C; + field_0x10f8.g = 0x5F; + field_0x10f8.b = 0x64; + light_pos.y += -800.0f; + light_power = 150.0f; + } + } + + if (tevstr_p != NULL && tevstr_p->mLightInf.a != 0) { + field_0x10f8.r = tevstr_p->mLightInf.r * 4; + field_0x10f8.g = tevstr_p->mLightInf.g * 4; + field_0x10f8.b = tevstr_p->mLightInf.b * 4; + } + + switch (tevstr_p->Type) { + case 1: + field_0x10f8.r = 500; + field_0x10f8.g = 500; + field_0x10f8.b = 500; + light_dist = 90.0f; + light_power = 5000.0f; + break; + case 4: + field_0x10f8.r = 500; + field_0x10f8.g = 500; + field_0x10f8.b = 500; + light_dist = 90.0f; + light_power = 5000.0f; + break; + case 5: + field_0x10f8.r = 170; + field_0x10f8.g = 170; + field_0x10f8.b = 170; + light_dist = 90.0f; + light_power = 5000.0f; + break; + case 2: + if (dKy_darkworld_check()) { + field_0x10f8.r = 103; + field_0x10f8.g = 129; + field_0x10f8.b = 199; + light_dist = 90.0f; + light_power = 5000.0f; + } + break; + case 3: + if (dKy_darkworld_check()) { + field_0x10f8.r = 53; + field_0x10f8.g = 53; + field_0x10f8.b = 80; + light_dist = 90.0f; + light_power = 5000.0f; + } + break; + case 9: + if (dKy_darkworld_check()) { + field_0x10f8.r = 110; + field_0x10f8.g = 110; + field_0x10f8.b = 140; + light_dist = 90.0f; + light_power = 5000.0f; + } + break; + case 7: { + f32 sp34 = tevstr_p->TevColor.a / 255.0f; + field_0x10f8.r = 180; + field_0x10f8.g = 180; + field_0x10f8.b = 180; + light_dist = 90.0f; + light_pos.y += -120.0f; + + f32 sp24 = cM_ssin(g_Counter.mCounter0 * 325); + f32 sp20 = cM_scos(g_Counter.mCounter0 * 285); + cLib_addCalcU8(&light_info->mColor.a, fabsf(sp24 * 255.0f), 2, 255); + light_info->mColor.a *= sp34; + + light_pos.y += sp20 * 500.0f; + light_pos.y -= 80.0f; + light_power = 300.0f; + break; + } + case 6: + if (dKy_darkworld_check()) { + field_0x10f8.r = 255; + field_0x10f8.g = 255; + field_0x10f8.b = 255; + light_dist = 90.0f; + light_power = 5000.0f; + } + break; + } + } + } else { + light_pos = dKy_light_influence_pos(light_inf_id); + field_0x10f8 = dKy_light_influence_col(light_inf_id); + light_yuragi = dKy_light_influence_yuragi(light_inf_id); + } + + f32 var_f31; + if (light_power <= 0.0f && sp3C == 0) { + var_f31 = 1.0f; + } else { + var_f31 = light_dist / light_power; + } + + if (var_f31 > 1.0f) { + var_f31 = 1.0f; + } + + var_f31 = (1.0f - var_f31); + var_f31 *= g_env_light.now_actcol_ratio; + + if ((tevstr_p->Type != 10 && tevstr_p->Type != 9) || tevstr_p->Material_id != 0) { + field_0x10f0.r = field_0x10f8.r * (var_f31 * kankyo->field_0x1210); + field_0x10f0.g = field_0x10f8.g * (var_f31 * kankyo->field_0x1210); + field_0x10f0.b = field_0x10f8.b * (var_f31 * kankyo->field_0x1210); + } else { + field_0x10f0.r = field_0x10f8.r * var_f31; + field_0x10f0.g = field_0x10f8.g * var_f31; + field_0x10f0.b = field_0x10f8.b * var_f31; + } + + if (field_0x10f0.r > 0xFF) { + field_0x10f0.r = 0xFF; + } + + if (field_0x10f0.g > 0xFF) { + field_0x10f0.g = 0xFF; + } + + if (field_0x10f0.b > 0xFF) { + field_0x10f0.b = 0xFF; + } + + if (init_timer != 0 || var_f31 <= 0.0f || sp9 == 0) { + light_info->mColor.r = field_0x10f0.r; + light_info->mColor.g = field_0x10f0.g; + light_info->mColor.b = field_0x10f0.b; + } else { + cLib_addCalcU8(&light_info->mColor.r, field_0x10f0.r, 10, 0x80); + cLib_addCalcU8(&light_info->mColor.g, field_0x10f0.g, 10, 0x80); + cLib_addCalcU8(&light_info->mColor.b, field_0x10f0.b, 10, 0x80); + } + + field_0x10f0.r = param_2.r + (int)(light_info->mColor.r * (0.1f * var_f31)); + field_0x10f0.g = param_2.g + (int)(light_info->mColor.g * (0.1f * var_f31)); + field_0x10f0.b = param_2.b + (int)(light_info->mColor.b * (0.1f * var_f31)); + + if (field_0x10f0.r > 0xFF) { + field_0x10f0.r = 0xFF; + } + + if (field_0x10f0.g > 0xFF) { + field_0x10f0.g = 0xFF; + } + + if (field_0x10f0.b > 0xFF) { + field_0x10f0.b = 0xFF; + } + + if (init_timer != 0 || sp40 != 0 || tevstr_p->field_0x384 != 0) { + tevstr_p->field_0x32c = light_pos; + } else { + f32 sp18 = pos_p->abs(tevstr_p->field_0x32c); + f32 sp14 = sp18 / 10000.0f; + if (sp14 > 1.0f) { + sp14 = 1.0f; + } + sp14 *= sp14; + + sp18 = pos_p->abs(light_pos); + f32 var_f28 = sp18 / 5000.0f; + if (var_f28 > 1.0f) { + var_f28 = 1.0f; + } + + var_f28 = 1.0f - var_f28; + var_f28 *= var_f28 * var_f28; + f32 sp1C = 10.0f + (10000.0f * sp14) + (100.0f * var_f28); + cLib_addCalc(&tevstr_p->field_0x32c.x, light_pos.x, 0.5f, sp1C, 0.001f); + cLib_addCalc(&tevstr_p->field_0x32c.y, light_pos.y, 0.5f, sp1C, 0.001f); + cLib_addCalc(&tevstr_p->field_0x32c.z, light_pos.z, 0.5f, sp1C, 0.001f); + } + + cXyz spC4; + cXyz spB8; + spB8 = tevstr_p->field_0x32c; + cMtx_multVec(view_mtx, &spB8, &spDC); + + if (dKy_shadow_mode_check(4) == 0) { + if ((tevstr_p->Type == 9 || tevstr_p->Type == 10) && + (player->getSinkShapeOffset() < -20.0f || player->checkSinkDead() || dKy_camera_water_in_status_check() || !player->checkSwimUp())) + { + cLib_addCalc(&tevstr_p->mLightPosWorld.x, pos_p->x, 0.5f, 5000.0f, 0.1f); + cLib_addCalc(&tevstr_p->mLightPosWorld.y, 1000.0f + pos_p->y, 0.5f, 5000.0f, 0.1f); + cLib_addCalc(&tevstr_p->mLightPosWorld.z, pos_p->z, 0.5f, 5000.0f, 0.1f); + } else if ((kankyo->shadow_mode & 1) || (kankyo->shadow_mode & 2)) { + cLib_addCalc(&tevstr_p->mLightPosWorld.x, g_env_light.field_0x10a0.x, 0.5f, 5000.0f, + 0.1f); + cLib_addCalc(&tevstr_p->mLightPosWorld.y, g_env_light.field_0x10a0.y, 0.5f, 5000.0f, + 0.1f); + cLib_addCalc(&tevstr_p->mLightPosWorld.z, g_env_light.field_0x10a0.z, 0.5f, 5000.0f, + 0.1f); + } else if (sp9 != 0) { + if (init_timer != 0 || tevstr_p->field_0x384 != 0) { + tevstr_p->mLightPosWorld = kankyo->base_light.mPosition; + } else { + cLib_addCalc(&tevstr_p->mLightPosWorld.x, kankyo->base_light.mPosition.x, 0.25f, + 1000.0f, 0.0001f); + cLib_addCalc(&tevstr_p->mLightPosWorld.y, kankyo->base_light.mPosition.y, 0.25f, + 1000.0f, 0.0001f); + cLib_addCalc(&tevstr_p->mLightPosWorld.z, kankyo->base_light.mPosition.z, 0.25f, + 1000.0f, 0.0001f); + } + } else { + cXyz spAC; + u8 sp8 = 0; + spAC = tevstr_p->field_0x32c; + + for (int i = 0; i < 6; i++) { + if (kankyo->field_0x0c18[i].field_0x26 == 1) { + if (kankyo->field_0x0c18[i].mPos.abs(*pos_p) < spAC.abs(*pos_p) && + kankyo->field_0x0c18[i].mPos.abs(*pos_p) < 1000.0f) + { + spAC = kankyo->field_0x0c18[i].mPos; + sp8 = i + 1; + } + } + } + + if (sp8 == 0) { + if (init_timer != 0 || tevstr_p->field_0x384 != 0) { + tevstr_p->mLightPosWorld = tevstr_p->field_0x32c; + } else { + cLib_addCalc(&tevstr_p->mLightPosWorld.x, tevstr_p->field_0x32c.x, 0.25f, + 1000.0f, 0.0001f); + cLib_addCalc(&tevstr_p->mLightPosWorld.y, tevstr_p->field_0x32c.y, 0.25f, + 1000.0f, 0.0001f); + cLib_addCalc(&tevstr_p->mLightPosWorld.z, tevstr_p->field_0x32c.z, 0.25f, + 1000.0f, 0.0001f); + } + } else { + if (init_timer != 0 || tevstr_p->field_0x384 != 0) { + tevstr_p->mLightPosWorld = kankyo->field_0x0c18[sp8 - 1].mPos; + } else { + cLib_addCalc(&tevstr_p->mLightPosWorld.x, + kankyo->field_0x0c18[sp8 - 1].mPos.x, 0.25f, 1000.0f, 0.0001f); + cLib_addCalc(&tevstr_p->mLightPosWorld.y, + kankyo->field_0x0c18[sp8 - 1].mPos.y, 0.25f, 1000.0f, 0.0001f); + cLib_addCalc(&tevstr_p->mLightPosWorld.z, + kankyo->field_0x0c18[sp8 - 1].mPos.z, 0.25f, 1000.0f, 0.0001f); + } + + var_f31 = kankyo->field_0x0c18[sp8 - 1].mPos.abs(*pos_p) / 500.0f; + if (var_f31 > 1.0f) { + var_f31 = 1.0f; + } + var_f31 = 1.0f - var_f31; + } + } + + if ((tevstr_p->Type == 9 || tevstr_p->Type == 10) && + (player->checkSinkDead() || dComIfGp_checkPlayerStatus0(0, 0x02000308) || + dComIfGp_checkPlayerStatus1(0, 0x02000000) || player->checkMagneBootsOn())) + { + cLib_addCalc(&tevstr_p->field_0x344, 0.0f, 0.75f, 0.21f, 0.0001f); + } else if (tevstr_p->Type == 9 && player->getSinkShapeOffset() < -35.0f) { + cLib_addCalc(&tevstr_p->field_0x344, 0.0f, 0.1f, 0.001f, 0.00001f); + } else if (tevstr_p->Type == 10 && player->getSinkShapeOffset() < -100.0f) { + cLib_addCalc(&tevstr_p->field_0x344, 0.0f, 0.1f, 0.001f, 0.00001f); + } else if (init_timer != 0) { + tevstr_p->field_0x344 = kankyo->field_0x1238 + + (var_f31 * (kankyo->field_0x123c - kankyo->field_0x1238)); + } else { + cLib_addCalc(&tevstr_p->field_0x344, + kankyo->field_0x1238 + + (var_f31 * (kankyo->field_0x123c - kankyo->field_0x1238)), + 0.75f, 0.04f, 0.000001f); + } + + if (tevstr_p->field_0x344 > 1.0f) { + tevstr_p->field_0x344 = 1.0f; + } + } + + light_info->mLightPosition = spDC; + light_info->mLightDirection = g_env_light.field_0x1064; + + light_info->mCosAtten.x = 1.0f; + light_info->mCosAtten.y = 0.0f; + light_info->mCosAtten.z = 0.0f; + + light_info->mDistAtten.x = 1.0f; + light_info->mDistAtten.y = 0.0f; + light_info->mDistAtten.z = 0.0f; + } } /* 8042DD70-8042E07C 05AA90 030C+00 1/2 8/8 9/9 .bss g_mEnvSeMgr */ @@ -2612,50 +3093,52 @@ static LightStatus lightStatusData[8]; /* 801A37C4-801A441C 19E104 0C58+00 2/1 14/14 515/515 .text * settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c */ -// NONMATCHING regalloc -void dScnKy_env_light_c::settingTevStruct(int i_tevstrType, cXyz* param_1, dKy_tevstr_c* i_tevstr) { - dScnKy_env_light_c* env_light = dKy_getEnvlight(); - u8 var_r30 = i_tevstr->mInitTimer; +void dScnKy_env_light_c::settingTevStruct(int tevstrType, cXyz* pos_p, dKy_tevstr_c* tevstr_p) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + u8 init_timer = tevstr_p->mInitTimer; - GXColorS10 sp30; - GXColorS10 K0_color; + GXColorS10 amb_col; + GXColorS10 fog_tev_col; - f32 fog_z_start; - f32 fog_z_end; + f32 fog_near; + f32 fog_far; - cXyz spA4; - if (i_tevstr->mRoomNo < 0) { - i_tevstr->mRoomNo = dComIfGp_roomControl_getStayNo(); + cXyz pos; + if (tevstr_p->room_no < 0) { + tevstr_p->room_no = dComIfGp_roomControl_getStayNo(); } - if (param_1 != NULL) { - spA4 = *param_1; + if (pos_p != NULL) { + pos = *pos_p; } else { - spA4.set(0.0f, 0.0f, 0.0f); + pos.set(0.0f, 0.0f, 0.0f); } - if (i_tevstr != NULL && g_env_light.mActorLightEffect != 100) { - i_tevstr->field_0x374 = g_env_light.mActorLightEffect / 100.0f; + if (tevstr_p != NULL && g_env_light.mActorLightEffect != 100) { + tevstr_p->field_0x374 = g_env_light.mActorLightEffect / 100.0f; } - i_tevstr->field_0x37a = i_tevstrType; + tevstr_p->Type = tevstrType; - if (i_tevstr->mInitType != 123 && i_tevstr->mInitType != 124) { - dKy_tevstr_init(i_tevstr, dComIfGp_roomControl_getStayNo(), 0xFF); + if (tevstr_p->Material_use_fg != 123 && tevstr_p->Material_use_fg != 124) { + dKy_tevstr_init(tevstr_p, dComIfGp_roomControl_getStayNo(), 0xFF); + OS_REPORT_ERROR("\n\ntevstr init Non. Material_use_fg[%d] setroom=[%d]\n", + tevstr_p->Material_use_fg, dComIfGp_roomControl_getStayNo()); } - i_tevstr->mInitType = 124; - mActorAmbience.a = 255; + tevstr_p->Material_use_fg = 124; + actor_amb_col.a = 255; - if (i_tevstrType == 14) { - camera_class* temp_r30 = dComIfGp_getCamera(0); - cXyz sp98; - i_tevstr->mLightMode = 0; + if (tevstrType == 14) { + camera_class* camera_p = (camera_class*)dComIfGp_getCamera(0); + cXyz calc_pos; + tevstr_p->mLightMode = 0; - if (i_tevstr->mRoomNo >= 0x80) { - i_tevstr->mEnvrIdxCurr = 0; + // @bug room_no is a signed char, so this will always evaluate to false + if (tevstr_p->room_no >= 128) { + tevstr_p->UseCol = 0; } else { - i_tevstr->mEnvrIdxCurr = i_tevstr->mRoomNo; + tevstr_p->UseCol = tevstr_p->room_no; } if (!dKy_darkworld_check()) { @@ -2669,16 +3152,16 @@ void dScnKy_env_light_c::settingTevStruct(int i_tevstrType, cXyz* param_1, dKy_t field_0x10f0.b = 77; } - K0_color.r = 255; - K0_color.g = 255; - K0_color.b = 255; + fog_tev_col.r = 255; + fog_tev_col.g = 255; + fog_tev_col.b = 255; - fog_z_start = 30000.0f; - fog_z_end = 30000.0f; - dKyr_get_vectle_calc(&spA4, &temp_r30->lookat.eye, &sp98); + fog_near = 30000.0f; + fog_far = 30000.0f; + dKyr_get_vectle_calc(&pos, &camera_p->lookat.eye, &calc_pos); for (int i = 0; i < 6; i++) { - J3DLightInfo& light_info = i_tevstr->mLights[i].getLightInfo(); + J3DLightInfo& light_info = tevstr_p->mLights[i].getLightInfo(); if (i == 0) { if (!dKy_darkworld_check()) { @@ -2706,8 +3189,8 @@ void dScnKy_env_light_c::settingTevStruct(int i_tevstrType, cXyz* param_1, dKy_t light_info.mColor.b = 0; } - dKy_GXInitLightSpot(&light_info, 90.0f, 0); - dKy_GXInitLightDistAttn(&light_info, 100000.0f, 0.99999f, 3); + dKy_GXInitLightSpot(&light_info, 90.0f, GX_SP_OFF); + dKy_GXInitLightDistAttn(&light_info, 100000.0f, 0.99999f, GX_DA_STEEP); light_info.mLightPosition.x = 0.0f; light_info.mLightPosition.y = 0.0f; @@ -2734,15 +3217,15 @@ void dScnKy_env_light_c::settingTevStruct(int i_tevstrType, cXyz* param_1, dKy_t Vec sp8C; Vec sp80; - sp80.x = temp_r30->lookat.eye.x; - sp80.y = temp_r30->lookat.eye.y; - sp80.z = temp_r30->lookat.eye.z; + sp80.x = camera_p->lookat.eye.x; + sp80.y = camera_p->lookat.eye.y; + sp80.z = camera_p->lookat.eye.z; cMtx_multVec(view_mtx, &sp80, &sp8C); - J3DLightInfo& light_info = i_tevstr->mLightObj.getLightInfo(); + J3DLightInfo& light_info = tevstr_p->mLightObj.getLightInfo(); light_info.mLightPosition = sp8C; - i_tevstr->field_0x32c = sp80; - i_tevstr->mLightPosWorld = sp80; + tevstr_p->field_0x32c = sp80; + tevstr_p->mLightPosWorld = sp80; light_info.mLightDirection = g_env_light.field_0x1064; light_info.mColor.r = 0; @@ -2756,27 +3239,27 @@ void dScnKy_env_light_c::settingTevStruct(int i_tevstrType, cXyz* param_1, dKy_t light_info.mDistAtten.x = 1.0f; light_info.mDistAtten.y = 0.0f; light_info.mDistAtten.z = 0.0f; - } else if (i_tevstrType == 12 || i_tevstrType == 13) { - camera_class* temp_r30_2 = dComIfGp_getCamera(0); + } else if (tevstrType == 12 || tevstrType == 13) { + camera_class* camera_p = (camera_class*)dComIfGp_getCamera(0); - i_tevstr->mFogColor.r = 0; - i_tevstr->mFogColor.g = 0; - i_tevstr->mFogColor.b = 0; - i_tevstr->mFogColor.a = 0; + tevstr_p->TevColor.r = 0; + tevstr_p->TevColor.g = 0; + tevstr_p->TevColor.b = 0; + tevstr_p->TevColor.a = 0; - i_tevstr->field_0x360 = 0; - i_tevstr->field_0x361 = 0; - i_tevstr->field_0x362 = 0; - i_tevstr->field_0x363 = 0; - i_tevstr->mLightMode = 0; + tevstr_p->TevKColor.r = 0; + tevstr_p->TevKColor.g = 0; + tevstr_p->TevKColor.b = 0; + tevstr_p->TevKColor.a = 0; + tevstr_p->mLightMode = 0; - if (i_tevstr->mRoomNo >= 128) { - i_tevstr->mEnvrIdxCurr = 0; + if (tevstr_p->room_no >= 128) { + tevstr_p->UseCol = 0; } else { - i_tevstr->mEnvrIdxCurr = i_tevstr->mRoomNo; + tevstr_p->UseCol = tevstr_p->room_no; } - if (i_tevstrType == 12) { + if (tevstrType == 12) { field_0x10f0.r = 25; field_0x10f0.g = 20; field_0x10f0.b = 25; @@ -2788,18 +3271,18 @@ void dScnKy_env_light_c::settingTevStruct(int i_tevstrType, cXyz* param_1, dKy_t field_0x10f0.a = 0xFF; - K0_color.r = 255; - K0_color.g = 255; - K0_color.b = 255; + fog_tev_col.r = 255; + fog_tev_col.g = 255; + fog_tev_col.b = 255; - fog_z_start = 30000.0f; - fog_z_end = 30000.0f; + fog_near = 30000.0f; + fog_far = 30000.0f; for (int i = 0; i < 6; i++) { - J3DLightInfo& temp_r31 = i_tevstr->mLights[i].getLightInfo(); + J3DLightInfo& temp_r31 = tevstr_p->mLights[i].getLightInfo(); if (i == 0) { - if (i_tevstrType == 12) { + if (tevstrType == 12) { temp_r31.mLightPosition.x = -30000.0f; temp_r31.mLightPosition.y = 18800.0f; temp_r31.mLightPosition.z = 29000.0f; @@ -2815,7 +3298,7 @@ void dScnKy_env_light_c::settingTevStruct(int i_tevstrType, cXyz* param_1, dKy_t temp_r31.mColor.b = 100; } } else if (i == 1) { - if (i_tevstrType == 12) { + if (tevstrType == 12) { temp_r31.mLightPosition.x = 14400.0f; temp_r31.mLightPosition.y = 7500.0f; temp_r31.mLightPosition.z = 3900.0f; @@ -2849,17 +3332,17 @@ void dScnKy_env_light_c::settingTevStruct(int i_tevstrType, cXyz* param_1, dKy_t Vec sp74; Vec sp68; - sp68.x = temp_r30_2->lookat.eye.x; - sp68.y = temp_r30_2->lookat.eye.y; - sp68.z = temp_r30_2->lookat.eye.z; + sp68.x = camera_p->lookat.eye.x; + sp68.y = camera_p->lookat.eye.y; + sp68.z = camera_p->lookat.eye.z; - J3DLightInfo& light_info = i_tevstr->mLightObj.getLightInfo(); + J3DLightInfo& light_info = tevstr_p->mLightObj.getLightInfo(); cMtx_multVec(view_mtx, &sp68, &sp74); light_info.mLightPosition = sp74; - if (i_tevstrType == 13) { - i_tevstr->field_0x32c = sp68; - i_tevstr->mLightPosWorld = sp68; + if (tevstrType == 13) { + tevstr_p->field_0x32c = sp68; + tevstr_p->mLightPosWorld = sp68; } light_info.mLightDirection = g_env_light.field_0x1064; @@ -2875,24 +3358,24 @@ void dScnKy_env_light_c::settingTevStruct(int i_tevstrType, cXyz* param_1, dKy_t light_info.mDistAtten.x = 1.0f; light_info.mDistAtten.y = 0.0f; light_info.mDistAtten.z = 0.0f; - } else if (!(i_tevstrType & 0xF0)) { - i_tevstr->mLightMode = 1; + } else if (!(tevstrType & 0xF0)) { + tevstr_p->mLightMode = 1; - sp30 = mActorAmbience; - K0_color = mFogColor; + amb_col = actor_amb_col; + fog_tev_col = fog_col; - fog_z_start = mFogNear; - fog_z_end = mFogFar; + fog_near = mFogNear; + fog_far = mFogFar; - if (i_tevstrType == 0 || i_tevstrType == 0 || i_tevstrType == 8 || i_tevstrType == 7 || - i_tevstrType == 1 || i_tevstrType == 2 || i_tevstrType == 3 || i_tevstrType == 5 || - i_tevstrType == 4 || i_tevstrType == 11) + if (tevstrType == 0 || tevstrType == 0 || tevstrType == 8 || tevstrType == 7 || + tevstrType == 1 || tevstrType == 2 || tevstrType == 3 || tevstrType == 5 || + tevstrType == 4 || tevstrType == 11) { - settingTevStruct_colget_actor(param_1, i_tevstr, &sp30, &K0_color, &fog_z_start, - &fog_z_end); - } else if (i_tevstrType == 10 || i_tevstrType == 9) { - if (g_env_light.field_0x98c != (u8)dComIfGp_roomControl_getStayNo()) { - g_env_light.field_0x98c = dComIfGp_roomControl_getStayNo(); + settingTevStruct_colget_actor(pos_p, tevstr_p, &amb_col, &fog_tev_col, &fog_near, + &fog_far); + } else if (tevstrType == 10 || tevstrType == 9) { + if (g_env_light.player_room_no != (u8)dComIfGp_roomControl_getStayNo()) { + g_env_light.player_room_no = dComIfGp_roomControl_getStayNo(); mDoAud_setSceneName( dComIfGp_getStartStageName(), dComIfGp_roomControl_getStayNo(), dComIfG_play_c::getLayerNo_common(dComIfGp_getStartStageName(), @@ -2903,109 +3386,111 @@ void dScnKy_env_light_c::settingTevStruct(int i_tevstrType, cXyz* param_1, dKy_t mDoAud_load2ndDynamicWave(); } } - var_r30 = g_env_light.mInitAnmTimer; - settingTevStruct_colget_player(i_tevstr); - settingTevStruct_colget_actor(param_1, i_tevstr, &sp30, &K0_color, &fog_z_start, - &fog_z_end); + init_timer = g_env_light.light_init_timer; + settingTevStruct_colget_player(tevstr_p); + settingTevStruct_colget_actor(pos_p, tevstr_p, &amb_col, &fog_tev_col, &fog_near, + &fog_far); } - field_0x10f0.r = sp30.r; - field_0x10f0.g = sp30.g; - field_0x10f0.b = sp30.b; + field_0x10f0.r = amb_col.r; + field_0x10f0.g = amb_col.g; + field_0x10f0.b = amb_col.b; field_0x10f0.a = 255; - if (i_tevstrType != 11) { - settingTevStruct_plightcol_plus(param_1, i_tevstr, sp30, sp30, var_r30); + if (tevstrType != 11) { + settingTevStruct_plightcol_plus(pos_p, tevstr_p, amb_col, amb_col, init_timer); } - if (i_tevstrType == 10 || i_tevstrType == 9) { - g_env_light.mPLightNearPos = i_tevstr->mLightPosWorld; + if (tevstrType == 10 || tevstrType == 9) { + g_env_light.plight_near_pos = tevstr_p->mLightPosWorld; } } else { - i_tevstr->mLightMode = 0; - if (i_tevstr->field_0x37a != 20) { - i_tevstr->field_0x374 = g_env_light.mPaletteTerrainLightEffect; + tevstr_p->mLightMode = 0; + if (tevstr_p->Type != 20) { + tevstr_p->field_0x374 = g_env_light.bg_light_influence; } else { - switch (i_tevstr->mLightInf) { + switch (tevstr_p->mLightInf.r) { case 0: - i_tevstr->field_0x374 = 0.2f; + tevstr_p->field_0x374 = 0.2f; break; case 1: - i_tevstr->field_0x374 = 0.3f; + tevstr_p->field_0x374 = 0.3f; break; case 2: - i_tevstr->field_0x374 = 0.4f; + tevstr_p->field_0x374 = 0.4f; break; case 3: - i_tevstr->field_0x374 = 0.6f; + tevstr_p->field_0x374 = 0.6f; break; case 4: - i_tevstr->field_0x374 = 0.8f; + tevstr_p->field_0x374 = 0.8f; break; case 5: - i_tevstr->field_0x374 = 0.9f; + tevstr_p->field_0x374 = 0.9f; break; case 6: - i_tevstr->field_0x374 = 1.0f; + tevstr_p->field_0x374 = 1.0f; break; case 7: - i_tevstr->field_0x374 = 1.2f; + tevstr_p->field_0x374 = 1.2f; break; default: - i_tevstr->field_0x374 = 1.0f; + tevstr_p->field_0x374 = 1.0f; break; } } - if (i_tevstr->mRoomNo >= 128) { - i_tevstr->mEnvrIdxCurr = 0; + // @bug room_no is a signed char, so this will always evaluate to false + if (tevstr_p->room_no >= 128) { + tevstr_p->UseCol = 0; } else { - i_tevstr->mEnvrIdxCurr = i_tevstr->mRoomNo; + tevstr_p->UseCol = tevstr_p->room_no; } - GXColorS10 spB0[4]; - setLight_bg(i_tevstr, spB0, &K0_color, &fog_z_start, &fog_z_end); + GXColorS10 BG_col[4]; + setLight_bg(tevstr_p, BG_col, &fog_tev_col, &fog_near, &fog_far); - field_0x10f0 = spB0[i_tevstrType & 3]; + field_0x10f0 = BG_col[tevstrType & 3]; MtxP view_mtx = j3dSys.getViewMtx(); Vec sp5C; - cXyz sp58; + cXyz pos; bool var_r25_3 = 0; - sp58.z = 0.0f; - sp58.y = 0.0f; - sp58.x = 0.0f; + pos.z = 0.0f; + pos.y = 0.0f; + pos.x = 0.0f; - int temp_r3_2 = dKy_light_influence_id(sp58, 0); - if (temp_r3_2 >= 0 && g_env_light.mPointLight[temp_r3_2]->mIndex < 0) { + int light_inf_id = dKy_light_influence_id(pos, 0); + if (light_inf_id >= 0 && g_env_light.pointlight[light_inf_id]->mIndex < 0) { var_r25_3 = 1; } if (var_r25_3 == 1) { - sp58 = g_env_light.mPointLight[temp_r3_2]->mPosition; - J3DLightInfo& light_info = i_tevstr->mLightObj.getLightInfo(); + pos = g_env_light.pointlight[light_inf_id]->mPosition; + J3DLightInfo& light_info = tevstr_p->mLightObj.getLightInfo(); - cMtx_multVec(view_mtx, &sp58, &sp5C); + cMtx_multVec(view_mtx, &pos, &sp5C); light_info.mLightPosition = sp5C; - i_tevstr->field_0x32c = sp58; + tevstr_p->field_0x32c = pos; light_info.mLightDirection = g_env_light.field_0x1064; - light_info.mColor.a = g_env_light.mPointLight[temp_r3_2]->mColor.a; - light_info.mColor.r = g_env_light.mPointLight[temp_r3_2]->mColor.r; - light_info.mColor.g = g_env_light.mPointLight[temp_r3_2]->mColor.g; - light_info.mColor.b = g_env_light.mPointLight[temp_r3_2]->mColor.b; - dKy_GXInitLightSpot(&light_info, 90.0f, 0); - dKy_GXInitLightDistAttn(&light_info, g_env_light.mPointLight[temp_r3_2]->mPow * 0.001f, - 0.99999f, 3); + light_info.mColor.a = g_env_light.pointlight[light_inf_id]->mColor.a; + light_info.mColor.r = g_env_light.pointlight[light_inf_id]->mColor.r; + light_info.mColor.g = g_env_light.pointlight[light_inf_id]->mColor.g; + light_info.mColor.b = g_env_light.pointlight[light_inf_id]->mColor.b; + dKy_GXInitLightSpot(&light_info, 90.0f, GX_SP_OFF); + dKy_GXInitLightDistAttn(&light_info, + g_env_light.pointlight[light_inf_id]->mPow * 0.001f, 0.99999f, + GX_DA_STEEP); } else { MtxP view_mtx = j3dSys.getViewMtx(); - J3DLightInfo& light_info = i_tevstr->mLightObj.getLightInfo(); + J3DLightInfo& light_info = tevstr_p->mLightObj.getLightInfo(); Vec sp44; - cMtx_multVec(view_mtx, &lightStatusData[0].field_0x0, &sp44); + cMtx_multVec(view_mtx, &lightStatusData[0].position, &sp44); light_info.mLightPosition = sp44; - i_tevstr->field_0x32c = lightStatusData[0].field_0x0; + tevstr_p->field_0x32c = lightStatusData[0].position; light_info.mLightDirection = g_env_light.field_0x1064; light_info.mColor.r = 0; @@ -3021,41 +3506,238 @@ void dScnKy_env_light_c::settingTevStruct(int i_tevstrType, cXyz* param_1, dKy_t light_info.mDistAtten.z = 0.0f; } - i_tevstr->mLightPosWorld = env_light->mBaseLightInfluence.mPosition; + tevstr_p->mLightPosWorld = kankyo->base_light.mPosition; } field_0x10f0.a = 255; - i_tevstr->mColorC0 = field_0x10f0; - i_tevstr->mColorK0 = K0_color; - i_tevstr->mFogStartZ = fog_z_start; - i_tevstr->mFogEndZ = fog_z_end; + tevstr_p->AmbCol = field_0x10f0; + tevstr_p->FogCol = fog_tev_col; + tevstr_p->mFogStartZ = fog_near; + tevstr_p->mFogEndZ = fog_far; } /* 801A441C-801A4420 19ED5C 0004+00 0/0 0/0 2/2 .text * setLightTevColorType__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c */ -void dScnKy_env_light_c::setLightTevColorType(J3DModelData* param_0, dKy_tevstr_c* param_1) {} +void dScnKy_env_light_c::setLightTevColorType(J3DModelData*, dKy_tevstr_c*) {} /* 801A4420-801A4C08 19ED60 07E8+00 2/2 0/0 0/0 .text * setLightTevColorType_MAJI_sub__FP11J3DMaterialP12dKy_tevstr_ci */ -static void setLightTevColorType_MAJI_sub(J3DMaterial* param_0, dKy_tevstr_c* param_1, - int param_2) { - // NONMATCHING +// NONMATCHING - some minor issues with dKyd_maple_col_getp +static void setLightTevColorType_MAJI_sub(J3DMaterial* material_p, dKy_tevstr_c* tevstr_p, + int lightType) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + MtxP view_mtx = j3dSys.getViewMtx(); + camera_class* camera = (camera_class*)dComIfGp_getCamera(0); + + if (tevstr_p != NULL) { + J3DGXColor amb_col; + amb_col.r = tevstr_p->AmbCol.r; + amb_col.g = tevstr_p->AmbCol.g; + amb_col.b = tevstr_p->AmbCol.b; + amb_col.a = tevstr_p->AmbCol.a; + + if (((tevstr_p->Type >= 1 && tevstr_p->Type <= 7) || tevstr_p->Type == 5 || + tevstr_p->Type == 15 || (tevstr_p->Type == 9 && dKy_darkworld_check())) && + ((tevstr_p->Type != 2 && tevstr_p->Type != 3) || dKy_darkworld_check())) + { + amb_col.r = 0; + amb_col.g = 0; + amb_col.b = 0; + amb_col.a = 0; + + if (tevstr_p->Type == 7) { + amb_col.a = 4; + } + + if (tevstr_p->Type == 3) { + amb_col.r = 12; + amb_col.g = 12; + amb_col.b = 12; + } else if (tevstr_p->Type == 6) { + f32 var_r30 = fabsf(cM_ssin(g_Counter.mCounter0 * 662)); + amb_col.r = 255.0f - (185.0f * var_r30); + amb_col.g = 255.0f - (185.0f * var_r30); + amb_col.b = 255.0f - (185.0f * var_r30); + } else if (tevstr_p->Type == 2) { + amb_col.r = 0x12; + amb_col.g = 0x12; + amb_col.b = 0x12; + } else if (tevstr_p->Type == 4) { + amb_col.r = 0xFF; + amb_col.g = 0x33; + amb_col.b = 0xB; + } else if (tevstr_p->Type == 5) { + amb_col.r = 0xA; + amb_col.g = 0xA; + amb_col.b = 8; + } else if (tevstr_p->Type == 15) { + amb_col.r = 0x19; + amb_col.g = 0x1E; + amb_col.b = 0x23; + } + } + + material_p->setAmbColor(0, &amb_col); + + if (lightType != 0) { + material_p->setTevColor(0, (J3DGXColorS10*)&tevstr_p->TevColor); + material_p->setTevKColor(0, (J3DGXColor*)&tevstr_p->TevKColor); + } + + MtxP sp10 = j3dSys.getViewMtx(); + if (sp10 != NULL) { + Vec sp28; + J3DLightInfo* sp20 = &tevstr_p->mLightObj.getLightInfo(); + cMtx_multVec(sp10, &tevstr_p->field_0x32c, &sp28); + sp20->mLightPosition = sp28; + } + + material_p->setLight(0, &tevstr_p->mLightObj); + + if (view_mtx != NULL) { + if (lightType != 2) { + for (int i = 0; i < 6; i++) { + material_p->setLight(i + 2, &tevstr_p->mLights[i]); + } + } else if (g_env_light.fishing_hole_season >= 1 && g_env_light.fishing_hole_season <= 4) + { + color_RGB_class maple_color; + maple_color.r = dKyd_maple_col_getp()[g_env_light.fishing_hole_season + 7].r; + maple_color.g = dKyd_maple_col_getp()[g_env_light.fishing_hole_season + 7].g; + maple_color.b = dKyd_maple_col_getp()[g_env_light.fishing_hole_season + 7].b; + + amb_col.r = 0xA; + amb_col.g = 0xA; + amb_col.b = 0xA; + + f32 var_f31; + var_f31 = (amb_col.r * g_env_light.now_bgcol_ratio) / 10.0f; + var_f31 *= var_f31; + if (var_f31 > 1.0f) { + var_f31 = 1.0f; + } + amb_col.r = g_env_light.now_bgcol_ratio * (maple_color.r * var_f31); + + var_f31 = (amb_col.g * g_env_light.now_bgcol_ratio) / 10.0f; + var_f31 *= var_f31; + if (var_f31 > 1.0f) { + var_f31 = 1.0f; + } + amb_col.g = g_env_light.now_bgcol_ratio * (maple_color.g * var_f31); + + var_f31 = (amb_col.b * g_env_light.now_bgcol_ratio) / 10.0f; + var_f31 *= var_f31; + if (var_f31 > 1.0f) { + var_f31 = 1.0f; + } + amb_col.b = g_env_light.now_bgcol_ratio * (maple_color.b * var_f31); + + material_p->setAmbColor(0, &amb_col); + + for (int i = 0; i < 6; i++) { + if (i <= 1) { + J3DLightInfo* var_r28; + if (i == 0) { + kankyo->global_maple_col_change[i].light_obj = tevstr_p->mLights[i]; + + J3DLightInfo* sp8 = + &kankyo->global_maple_col_change[1].light_obj.getLightInfo(); + var_r28 = &kankyo->global_maple_col_change[i].light_obj.getLightInfo(); + sp8->mColor = var_r28->mColor; + } else { + var_r28 = &kankyo->global_maple_col_change[i].light_obj.getLightInfo(); + } + + color_RGB_class maple_color; + maple_color.r = + dKyd_maple_col_getp()[(g_env_light.fishing_hole_season + (i * 4))].r; + maple_color.g = + dKyd_maple_col_getp()[(g_env_light.fishing_hole_season + (i * 4))].g; + maple_color.b = + dKyd_maple_col_getp()[(g_env_light.fishing_hole_season + (i * 4))].b; + + var_f31 = var_r28->mColor.r / 95.0f; + var_f31 *= var_f31; + if (var_f31 > 1.0f) { + var_f31 = 1.0f; + } + var_r28->mColor.r = maple_color.r; + var_r28->mColor.r *= var_f31; + + var_f31 = var_r28->mColor.g / 95.0f; + var_f31 *= var_f31; + if (var_f31 > 1.0f) { + var_f31 = 1.0f; + } + var_r28->mColor.g = maple_color.g; + var_r28->mColor.g *= var_f31; + + var_f31 = var_r28->mColor.b / 95.0f; + var_f31 *= var_f31; + if (var_f31 > 1.0f) { + var_f31 = 1.0f; + } + var_r28->mColor.b = maple_color.b; + var_r28->mColor.b *= var_f31; + + material_p->setLight(i + 2, &kankyo->global_maple_col_change[i].light_obj); + } else { + material_p->setLight(i + 2, &tevstr_p->mLights[i]); + } + } + } + } + + if (material_p->getFog() != NULL) { + J3DFogInfo* fog_info = material_p->getFog()->getFogInfo(); + if (fog_info->mType != 0) { + fog_info->mStartZ = tevstr_p->mFogStartZ; + fog_info->mEndZ = tevstr_p->mFogEndZ; + + if (dComIfGd_getView() != NULL) { + fog_info->mNearZ = dComIfGd_getView()->near; + fog_info->mFarZ = dComIfGd_getView()->far; + } + + if (fog_info->mType == 7) { + fog_info->mType = 2; + fog_info->mColor.r = 0; + fog_info->mColor.g = 0; + fog_info->mColor.b = 0; + } else if (fog_info->mType == 6) { + fog_info->mColor.r = 0xFF; + fog_info->mColor.g = 0xFF; + fog_info->mColor.b = 0xFF; + } else { + fog_info->mColor.r = tevstr_p->FogCol.r; + fog_info->mColor.g = tevstr_p->FogCol.g; + fog_info->mColor.b = tevstr_p->FogCol.b; + } + + fog_info->mAdjEnable = g_env_light.mFogAdjEnable; + if (fog_info->mAdjEnable == 1) { + fog_info->mCenter = g_env_light.mFogAdjCenter; + memcpy(&fog_info->mFogAdjTable, &g_env_light.mXFogTbl, sizeof(GXFogAdjTable)); + } + } + } + } } /* 801A4C10-801A4DA0 19F550 0190+00 1/1 0/0 0/0 .text * dKy_cloudshadow_scroll__FP12J3DModelDataP12dKy_tevstr_ci */ -static void dKy_cloudshadow_scroll(J3DModelData* i_modelData, dKy_tevstr_c* i_tevstr, int param_2) { - JUTNameTab* mat_nametbl = i_modelData->getMaterialName(); +void dKy_cloudshadow_scroll(J3DModelData* modelData_p, dKy_tevstr_c* tevstr_p, int param_2) { + JUTNameTab* mat_nametbl = modelData_p->getMaterialName(); - for (int i = i_modelData->getMaterialNum() - 1; i >= 0; i--) { - J3DMaterial* mat_p = i_modelData->getMaterialNodePointer(i); + for (int i = modelData_p->getMaterialNum() - 1; i >= 0; i--) { + J3DMaterial* mat_p = modelData_p->getMaterialNodePointer(i); - int tmp = param_2; - if (i_tevstr->field_0x378 != 0 && i_tevstr->field_0x378 == i) { - tmp = 2; + int lightType = param_2; + if (tevstr_p->Material_id != 0 && tevstr_p->Material_id == i) { + lightType = 2; } - setLightTevColorType_MAJI_sub(mat_p, i_tevstr, tmp); + setLightTevColorType_MAJI_sub(mat_p, tevstr_p, lightType); const char* mat_name = mat_nametbl->getName(i); if ((mat_name[3] == 'M' && mat_name[4] == 'A' && mat_name[5] == '0' && @@ -3086,30 +3768,33 @@ static void dKy_cloudshadow_scroll(J3DModelData* i_modelData, dKy_tevstr_c* i_te /* 801A4DA0-801A4E90 19F6E0 00F0+00 0/0 18/18 536/536 .text * setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c */ -void dScnKy_env_light_c::setLightTevColorType_MAJI(J3DModelData* i_modelData, - dKy_tevstr_c* i_tevstr) { - if (i_tevstr->mInitType != 124) { - if (i_tevstr->mInitType != 123) { - dKy_tevstr_init(i_tevstr, dComIfGp_roomControl_getStayNo(), 0xFF); +void dScnKy_env_light_c::setLightTevColorType_MAJI(J3DModelData* modelData_p, + dKy_tevstr_c* tevstr_p) { + if (tevstr_p->Material_use_fg != 124) { + OS_REPORT_ERROR("\ncoltype tevstr init Non. Material_use_fg[%d]\n", + tevstr_p->Material_use_fg); + if (tevstr_p->Material_use_fg != 123) { + dKy_tevstr_init(tevstr_p, dComIfGp_roomControl_getStayNo(), 0xFF); } - settingTevStruct(11, NULL, i_tevstr); + settingTevStruct(11, NULL, tevstr_p); } - dKy_setLight_nowroom_actor(i_tevstr); + dKy_setLight_nowroom_actor(tevstr_p); - int tmp; - if (i_tevstr->field_0x37a > 10 && i_tevstr->field_0x37a != 12 && i_tevstr->field_0x37a != 13) { - tmp = 0; + int lightType; + if (tevstr_p->Type > 10 && tevstr_p->Type != 12 && tevstr_p->Type != 13) { + lightType = 0; } else { - tmp = 1; + lightType = 1; } - if (i_tevstr->field_0x37a & 0x20) { - dKy_cloudshadow_scroll(i_modelData, i_tevstr, tmp); + if (tevstr_p->Type & 0x20) { + dKy_cloudshadow_scroll(modelData_p, tevstr_p, lightType); } else { - for (int i = i_modelData->getMaterialNum() - 1; i >= 0; i--) { - setLightTevColorType_MAJI_sub(i_modelData->getMaterialNodePointer(i), i_tevstr, tmp); + for (int i = modelData_p->getMaterialNum() - 1; i >= 0; i--) { + setLightTevColorType_MAJI_sub(modelData_p->getMaterialNodePointer(i), tevstr_p, + lightType); } } } @@ -3126,9 +3811,9 @@ void dScnKy_env_light_c::CalcTevColor() { /* 801A4F24-801A4F64 19F864 0040+00 1/1 0/0 0/0 .text Sndpos__18dScnKy_env_light_cFv */ void dScnKy_env_light_c::Sndpos() { - if (mSound.field_0x10 != 0) { - mSound.field_0x10--; - if (mSound.field_0x10 == 0) { + if (sound_influence.timer != 0) { + sound_influence.timer--; + if (sound_influence.timer == 0) { dKy_Sound_init(); } } @@ -3137,7 +3822,95 @@ void dScnKy_env_light_c::Sndpos() { /* 801A4F64-801A516C 19F8A4 0208+00 1/1 0/0 0/0 .text Eflight_flush_proc__18dScnKy_env_light_cFv */ void dScnKy_env_light_c::Eflight_flush_proc() { - // NONMATCHING + struct flush_info { + u8 start_frame; + u8 r; + u8 g; + u8 b; + }; + + f32 power; + f32 fluctuation; + flush_info* info; + + if (eflight.mLightType == 0) { + static flush_info flush_col[] = { + {1, 0x00, 0x00, 0x00}, + {4, 0x43, 0x73, 0x58}, + {10, 0x25, 0x3E, 0x2D}, + {20, 0x00, 0x00, 0x00}, + }; + + info = flush_col; + fluctuation = 100.0f; + power = 120.0f; + } else if (eflight.mLightType == 1) { + static flush_info flush_col2[] = { + {1, 0x00, 0x00, 0x00}, + {4, 0x6E, 0x5A, 0x00}, + {8, 0x4B, 0x22, 0x00}, + {15, 0x00, 0x00, 0x00}, + }; + + info = flush_col2; + fluctuation = 0.0f; + power = 120.0f; + } else { + static flush_info flush_col3[] = { + {1, 0x00, 0x00, 0x00}, + {4, 0x46, 0x4D, 0x43}, + {15, 0x22, 0x1E, 0x00}, + {20, 0x00, 0x00, 0x00}, + }; + + info = flush_col3; + fluctuation = 100.0f; + power = 80.0f; + } + + switch (eflight.mState) { + case 0: + break; + case 1: + eflight.mFrame = 0; + eflight.field_0x8.mColor.r = info[0].r; + eflight.field_0x8.mColor.g = info[0].g; + eflight.field_0x8.mColor.b = info[0].b; + eflight.field_0x8.mPow = power; + eflight.field_0x8.mFluctuation = fluctuation; + + dKy_efplight_set(&eflight.field_0x8); + eflight.mState++; + break; + case 2: + for (int i = 0; i < 3; i++) { + if (eflight.mFrame >= info[i].start_frame && eflight.mFrame <= info[i + 1].start_frame) + { + f32 ratio = 1.0f - (f32)(info[i + 1].start_frame - eflight.mFrame) / + (f32)(info[i + 1].start_frame - info[i].start_frame); + + eflight.field_0x8.mColor.r = u8_data_ratio_set(info[i].r, info[i + 1].r, ratio); + eflight.field_0x8.mColor.g = u8_data_ratio_set(info[i].g, info[i + 1].g, ratio); + eflight.field_0x8.mColor.b = u8_data_ratio_set(info[i].b, info[i + 1].b, ratio); + break; + } + } + + if (eflight.mFrame > info[3].start_frame) { + eflight.mState++; + } + + eflight.mFrame++; + break; + case 3: + dKy_efplight_cut(&eflight.field_0x8); + eflight.mState = 0; + break; + case 4: + dKy_efplight_cut(&eflight.field_0x8); + eflight.mState = 1; + break; + } } /* 80450700-80450704 000180 0002+02 2/2 0/0 0/0 .sdata lightMask */ @@ -3148,12 +3921,33 @@ static LightStatus* lightStatusPt = lightStatusData; /* 801A516C-801A5288 19FAAC 011C+00 1/1 0/0 0/0 .text SetBaseLight__18dScnKy_env_light_cFv */ void dScnKy_env_light_c::SetBaseLight() { - // NONMATCHING + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + camera_class* camera = (camera_class*)dComIfGp_getCamera(0); + + if (dKy_SunMoon_Light_Check() == TRUE) { + f32 daytime = g_env_light.getDaytime(); + if (daytime > 67.5f && daytime < 292.5f) { + base_light.mPosition = kankyo->sun_light_pos; + } else if (camera != NULL) { + base_light.mPosition = camera->lookat.eye + kankyo->moon_pos; + } else { + base_light.mPosition = kankyo->moon_pos; + } + } else { + base_light.mPosition = lightStatusPt[2].position; + } + + base_light.mColor.r = 0xFF; + base_light.mColor.g = 0xFF; + base_light.mColor.b = 0xFF; + base_light.mColor.a = 0xFF; + base_light.mPow = 0.0f; + base_light.mFluctuation = 0.0f; } /* 801A5288-801A56DC 19FBC8 0454+00 1/1 0/0 0/0 .text exeKankyo__18dScnKy_env_light_cFv */ -// NONMATCHING one instruction swap +// NONMATCHING - single regswap void dScnKy_env_light_c::exeKankyo() { for (int i = 0; i < 6; i++) { field_0x0c18[i].field_0x26 = 0; @@ -3177,7 +3971,7 @@ void dScnKy_env_light_c::exeKankyo() { if (g_env_light.mColPatMode != 0) { if (g_env_light.mColpatPrevGather != 0xFF) { - g_env_light.mColPatPrev = g_env_light.mColpatPrevGather; + g_env_light.wether_pat0 = g_env_light.mColpatPrevGather; if (g_env_light.mColPatModeGather == 0) { g_env_light.mColpatPrevGather = 0xFF; @@ -3185,7 +3979,7 @@ void dScnKy_env_light_c::exeKankyo() { } if (g_env_light.mColpatCurrGather != 0xFF) { - g_env_light.mColPatCurr = g_env_light.mColpatCurrGather; + g_env_light.wether_pat1 = g_env_light.mColpatCurrGather; if (g_env_light.mColPatModeGather == 0) { g_env_light.mColpatCurrGather = 0xFF; @@ -3193,55 +3987,55 @@ void dScnKy_env_light_c::exeKankyo() { } if (g_env_light.mColPatBlendGather >= 0.0f) { - g_env_light.mColPatBlend = g_env_light.mColPatBlendGather; + g_env_light.pat_ratio = g_env_light.mColPatBlendGather; if (g_env_light.mColPatModeGather == 0) { g_env_light.mColPatBlendGather = -1.0f; } } - } else if (g_env_light.mColPatPrev == g_env_light.mColPatCurr) { + } else if (g_env_light.wether_pat0 == g_env_light.wether_pat1) { if (g_env_light.mColpatPrevGather != 0xFF) { - g_env_light.mColPatPrev = g_env_light.mColpatPrevGather; + g_env_light.wether_pat0 = g_env_light.mColpatPrevGather; g_env_light.mColpatPrevGather = 0xFF; } if (g_env_light.mColpatCurrGather != 0xFF) { - g_env_light.mColPatCurr = g_env_light.mColpatCurrGather; + g_env_light.wether_pat1 = g_env_light.mColpatCurrGather; g_env_light.mColpatCurrGather = 0xFF; - g_env_light.mColpatWeather = g_env_light.mColPatCurr; + g_env_light.mColpatWeather = g_env_light.wether_pat1; } if (g_env_light.mColPatBlendGather >= 0.0f) { - g_env_light.mColPatBlend = g_env_light.mColPatBlendGather; + g_env_light.pat_ratio = g_env_light.mColPatBlendGather; g_env_light.mColPatBlendGather = -1.0f; } } g_env_light.field_0x1210 = g_env_light.field_0x122c; - cLib_addCalc(&g_env_light.mColAllcolRatio, g_env_light.mAllcolRatio, 0.5f, 0.25f, 0.01f); - cLib_addCalc(&g_env_light.mColActColRatio, g_env_light.mActcolRatio, 0.5f, 0.25f, 0.01f); - cLib_addCalc(&g_env_light.mColBgColRatio, g_env_light.mBgcolRatio * g_env_light.field_0x1210, + cLib_addCalc(&g_env_light.now_allcol_ratio, g_env_light.allcol_ratio, 0.5f, 0.25f, 0.01f); + cLib_addCalc(&g_env_light.now_actcol_ratio, g_env_light.actcol_ratio, 0.5f, 0.25f, 0.01f); + cLib_addCalc(&g_env_light.now_bgcol_ratio, g_env_light.bgcol_ratio * g_env_light.field_0x1210, 0.5f, 0.25f, 0.01f); - cLib_addCalc(&g_env_light.mColFogColRatio, g_env_light.mFogcolRatio * g_env_light.field_0x1210, + cLib_addCalc(&g_env_light.now_fogcol_ratio, g_env_light.fogcol_ratio * g_env_light.field_0x1210, 0.5f, 0.25f, 0.01f); - cLib_addCalc(&g_env_light.mColVrboxSoraColRatio, - g_env_light.mVrboxSoracolRatio * g_env_light.field_0x1210, 0.5f, 0.25f, 0.01f); - cLib_addCalc(&g_env_light.mColVrboxKumocolRatio, - g_env_light.mVrboxKumocolRatio * g_env_light.field_0x1210, 0.5f, 0.25f, 0.01f); + cLib_addCalc(&g_env_light.now_vrboxsoracol_ratio, + g_env_light.vrboxsoracol_ratio * g_env_light.field_0x1210, 0.5f, 0.25f, 0.01f); + cLib_addCalc(&g_env_light.now_vrboxkumocol_ratio, + g_env_light.vrboxkumocol_ratio * g_env_light.field_0x1210, 0.5f, 0.25f, 0.01f); - g_env_light.mAllcolRatio = 1.0f; - g_env_light.mActcolRatio = 1.0f; - g_env_light.mBgcolRatio = 1.0f; - g_env_light.mFogcolRatio = 1.0f; - g_env_light.mVrboxSoracolRatio = 1.0f; - g_env_light.mVrboxKumocolRatio = 1.0f; + g_env_light.allcol_ratio = 1.0f; + g_env_light.actcol_ratio = 1.0f; + g_env_light.bgcol_ratio = 1.0f; + g_env_light.fogcol_ratio = 1.0f; + g_env_light.vrboxsoracol_ratio = 1.0f; + g_env_light.vrboxkumocol_ratio = 1.0f; g_env_light.field_0x122c = 1.0f; g_env_light.field_0x126c = g_env_light.field_0x1268; g_env_light.field_0x1268 = 999999.9f; for (int i = 50; i < 100; i++) { - g_env_light.mPointLight[i] = NULL; + g_env_light.pointlight[i] = NULL; } g_env_light.field_0x130b = 0; @@ -3265,8 +4059,7 @@ void dScnKy_env_light_c::exeKankyo() { } if (strcmp(dComIfGp_getStartStageName(), "R_SP127") == 0) { - if ((dCam_getBody()->Mode() == 4 || dCam_getBody()->Mode() == 7) && - dComIfGp_event_runCheck()) + if ((dCam_getBody()->Mode() == 4 || dCam_getBody()->Mode() == 7) && dComIfGp_event_runCheck()) { cLib_addCalc(&g_env_light.mDemoAttentionPoint, 0.0f, 0.5f, 0.1f, 1E-05f); } else { @@ -3281,42 +4074,63 @@ void dScnKy_env_light_c::drawKankyo() { setSunpos(); SetBaseLight(); setLight(); - dKy_setLight_nowroom(g_env_light.mEnvrIdxPrev); + dKy_setLight_nowroom(g_env_light.PrevCol); } -/* 8042E7BC-8042E7C8 05B4DC 000C+00 0/1 0/0 0/0 .bss @7485 */ -#pragma push -#pragma force_active on -static u8 lit_7485[12]; -#pragma pop - -/* 8042E7C8-8042E7D4 05B4E8 000C+00 0/1 0/0 0/0 .bss S_old_cameye$7484 */ -#pragma push -#pragma force_active on -static u8 S_old_cameye[12]; -#pragma pop - -/* 8042E7D4-8042E7E0 05B4F4 000C+00 0/1 0/0 0/0 .bss @7489 */ -#pragma push -#pragma force_active on -static u8 lit_7489[12]; -#pragma pop - -/* 8042E7E0-8042E7F0 05B500 000C+04 0/1 0/0 0/0 .bss S_old_camctr$7488 */ -#pragma push -#pragma force_active on -static u8 S_old_camctr[12 + 4 /* padding */]; -#pragma pop - -/* 80453DA0-80453DA4 0023A0 0004+00 1/1 0/0 0/0 .sdata2 @7608 */ -SECTION_SDATA2 static f32 lit_7608 = 0.005239999853074551f; - -/* 80453DA4-80453DA8 0023A4 0004+00 2/2 0/0 0/0 .sdata2 @7609 */ -SECTION_SDATA2 static f32 lit_7609 = 35.0f; - /* 801A572C-801A5B6C 1A006C 0440+00 0/0 1/1 0/0 .text dKy_undwater_filter_draw__Fv */ void dKy_undwater_filter_draw() { - // NONMATCHING + camera_class* camera = (camera_class*)dComIfGp_getCamera(0); + cXyz size; + + static cXyz S_old_cameye(0.0f, 0.0f, 0.0f); + static cXyz S_old_camctr(0.0f, 0.0f, 0.0f); + + if (dKy_camera_water_in_status_check()) { + f32 dist_to_old = camera->lookat.eye.abs(S_old_cameye); + if (dist_to_old > 100.0f) { + dist_to_old = 100.0f; + } + + if (g_env_light.field_0x1258 > 1.0f - (dist_to_old / 100.0f)) { + cLib_addCalc(&g_env_light.field_0x1258, 1.0f - (dist_to_old / 100.0f), 0.5f, 0.05f, + 0.0001f); + } + + dist_to_old = camera->lookat.center.abs(S_old_camctr); + if (dist_to_old > 100.0f) { + dist_to_old = 100.0f; + } + + if (g_env_light.field_0x1258 > 1.0f - (dist_to_old / 100.0f)) { + cLib_addCalc(&g_env_light.field_0x1258, 1.0f - (dist_to_old / 100.0f), 0.5f, 0.05f, + 0.0001f); + } + + S_old_cameye = camera->lookat.eye; + S_old_camctr = camera->lookat.center; + + mDoMtx_stack_c::transS(0.0f, 0.0f, 0.0f); + + size.x = 0.00524f; + size.y = 0.00524f; + size.z = 0.00524f; + + if (g_env_light.undwater_ef_model != NULL) { + J3DGXColor sp8; + g_env_light.undwater_ef_model->setBaseScale(size); + g_env_light.undwater_ef_model->setBaseTRMtx(mDoMtx_stack_c::get()); + + if (g_env_light.undwater_btk != NULL) { + g_env_light.undwater_btk->setPlaySpeed(2.0f + (35.0f * (1.0f - g_env_light.field_0x1258))); + g_env_light.undwater_btk->entry(g_env_light.undwater_ef_model->getModelData()); + g_env_light.undwater_btk->play(); + + dComIfGd_setXluList2DScreen(); + mDoExt_modelUpdateDL(g_env_light.undwater_ef_model); + dComIfGd_setList(); + } + } + } } /* 801A5B6C-801A5B98 1A04AC 002C+00 1/0 0/0 0/0 .text dKy_Draw__FP17sub_kankyo__class */ @@ -3346,8 +4160,8 @@ static int dKy_Delete(sub_kankyo__class* i_this) { plight_init(); mDoAud_mEnvse_resetScene(); - if (g_env_light.mpUndwaterEfHeap != NULL) { - mDoExt_destroySolidHeap(g_env_light.mpUndwaterEfHeap); + if (g_env_light.undwater_ef_heap != NULL) { + mDoExt_destroySolidHeap(g_env_light.undwater_ef_heap); } return 1; @@ -3355,10 +4169,11 @@ static int dKy_Delete(sub_kankyo__class* i_this) { /* 801A5C1C-801A5E54 1A055C 0238+00 1/0 0/0 0/0 .text dKy_Create__FPv */ static int dKy_Create(void* i_this) { - BOOL setNextTime = false; - stage_envr_info_class* envr = dComIfGp_getStageEnvrInfo(); - if (envr != NULL && dComIfGp_getStartStageRoomNo() != -1) { - if (envr[dComIfGp_getStartStageRoomNo()].m_pselectID[0x40] != 0) { + BOOL next_time_set = false; + + stage_envr_info_class* stage_envr_p = dComIfGp_getStageEnvrInfo(); + if (stage_envr_p != NULL && dComIfGp_getStartStageRoomNo() != -1) { + if (stage_envr_p[dComIfGp_getStartStageRoomNo()].pselect_id[64] != 0) { mDoGph_gInf_c::getBloom()->create(); } } @@ -3366,12 +4181,12 @@ static int dKy_Create(void* i_this) { envcolor_init(); g_env_light.field_0x12b0 = 0; g_env_light.field_0x1254 = 1.0f; - g_env_light.mPLightNearPos.x = 0.0f; - g_env_light.mPLightNearPos.y = 0.0f; - g_env_light.mPLightNearPos.z = 0.0f; - g_env_light.field_0xf3c = 0; - g_env_light.field_0xf40 = 0.0f; - g_env_light.field_0xf3d = 0; + g_env_light.plight_near_pos.x = 0.0f; + g_env_light.plight_near_pos.y = 0.0f; + g_env_light.plight_near_pos.z = 0.0f; + g_env_light.senses_mode = 0; + g_env_light.senses_effect_strength = 0.0f; + g_env_light.now_senses_effect = 0; dKy_setLight_init(); dKy_Sound_init(); @@ -3379,63 +4194,64 @@ static int dKy_Create(void* i_this) { dungeonlight_init(); dKy_setLight_nowroom(dComIfGp_roomControl_getStayNo()); - g_env_light.mResPolEfftbl = (dKy_pol_efftbl_struct*)dComIfG_getStageRes("pol_efftbl.dat"); - g_env_light.mResPolEffcol = (dKy_pol_effcol_struct*)dComIfG_getStageRes("pol_effcol.dat"); - g_env_light.mResPolEfftbl2 = (dKy_pol_efftbl_struct*)dComIfG_getStageRes("pol_efftbl2.dat"); - g_env_light.mResPolEffcol2 = (dKy_pol_effcol_struct*)dComIfG_getStageRes("pol_effcol2.dat"); - g_env_light.mResPolSound = (dKy_pol_sound_struct*)dComIfG_getStageRes("pol_sound.dat"); - g_env_light.mResPolArg = (dKy_pol_arg_struct*)dComIfG_getStageRes("pol_arg.dat"); - g_env_light.mResColorDataTbl = (dKy_color_data_struct*)dComIfG_getStageRes("colordata_tbl.dat"); + g_env_light.pol_efftbl = (dKy_pol_efftbl_struct*)dComIfG_getStageRes("pol_efftbl.dat"); + g_env_light.pol_effcol = (dKy_pol_effcol_struct*)dComIfG_getStageRes("pol_effcol.dat"); + g_env_light.pol_efftbl2 = (dKy_pol_efftbl_struct*)dComIfG_getStageRes("pol_efftbl2.dat"); + g_env_light.pol_effcol2 = (dKy_pol_effcol_struct*)dComIfG_getStageRes("pol_effcol2.dat"); + g_env_light.pol_sound = (dKy_pol_sound_struct*)dComIfG_getStageRes("pol_sound.dat"); + g_env_light.pol_arg = (dKy_pol_arg_struct*)dComIfG_getStageRes("pol_arg.dat"); + g_env_light.colordata_tbl = (dKy_color_data_struct*)dComIfG_getStageRes("colordata_tbl.dat"); - if (g_env_light.mNexttime != -1.0f) { - setNextTime = true; - dComIfGs_setTime(g_env_light.mNexttime); + if (g_env_light.nexttime != -1.0f) { + next_time_set = true; + dComIfGs_setTime(g_env_light.nexttime); } if (dKy_darkworld_check()) { - if (g_env_light.mTime == -1.0f) { - g_env_light.mTime = dComIfGs_getTime(); + if (g_env_light.old_time == -1.0f) { + g_env_light.old_time = dComIfGs_getTime(); } - } else if (g_env_light.mTime != -1.0f) { - if (!setNextTime) { - dComIfGs_setTime(g_env_light.mTime); + } else if (g_env_light.old_time != -1.0f) { + if (!next_time_set) { + dComIfGs_setTime(g_env_light.old_time); } - g_env_light.mTime = -1.0f; + g_env_light.old_time = -1.0f; } - g_env_light.mNexttime = -1.0f; + g_env_light.nexttime = -1.0f; return cPhs_COMPLEATE_e; } - /* 801A5E54-801A60BC 1A0794 0268+00 1/1 1/1 0/0 .text dKy_setLight_init__Fv */ void dKy_setLight_init() { - // NONMATCHING + for (int i = 0; i < 8; i++) { + lightStatusData[i] = lightStatusBase; + } } /* 801A60BC-801A60E0 1A09FC 0024+00 0/0 1/1 0/0 .text dKy_setLight__Fv */ void dKy_setLight() { - g_env_light.mSunPos2 = g_env_light.mSunPos; + g_env_light.sun_light_pos = g_env_light.sun_pos; } /* 801A60E0-801A61F4 1A0A20 0114+00 2/2 0/0 0/0 .text dKy_GlobalLight_set__Fv */ -static void dKy_GlobalLight_set() { +void dKy_GlobalLight_set() { MtxP view_mtx = j3dSys.getViewMtx(); for (int i = 0; i < 8; i++) { LightStatus* light_status = &lightStatusData[i]; Vec light_pos; - cMtx_multVec(view_mtx, &light_status->field_0x0, &light_pos); + cMtx_multVec(view_mtx, &light_status->position, &light_pos); GXLightObj light_obj; GXInitLightPos(&light_obj, light_pos.x, light_pos.y, light_pos.z); GXInitLightDir(&light_obj, light_status->mLightDir.x, light_status->mLightDir.y, light_status->mLightDir.z); - GXInitLightColor(&light_obj, light_status->field_0x18); + GXInitLightColor(&light_obj, light_status->color); if (light_status->mRefDist <= 0.0f) { - light_status->mRefDist = 1.0E-6f; + light_status->mRefDist = 0.000001f; } GXInitLightDistAttn(&light_obj, light_status->mRefDist, light_status->mRefBrightness, @@ -3445,61 +4261,479 @@ static void dKy_GlobalLight_set() { } } - inline u8 dLVI_getSWLight(stage_pure_lightvec_info_class* i_info) { - return i_info->field_0x1e & 0x80; + return i_info->flags & 0x80; } /* 801A61F4-801A6278 1A0B34 0084+00 3/3 0/0 0/0 .text * dKy_lightswitch_check__FP30stage_pure_lightvec_info_classc */ -static bool dKy_lightswitch_check(stage_pure_lightvec_info_class* param_0, char i_roomNo) { - bool var_r31 = 1; - if (param_0->field_0x1f != 0xFF) { - if (!dLVI_getSWLight(param_0)) { - if (dComIfGs_isSwitch(param_0->field_0x1f, i_roomNo)) { - var_r31 = 0; +BOOL dKy_lightswitch_check(stage_pure_lightvec_info_class* stage_light_info_p, char room_no) { + BOOL is_switch = TRUE; + + if (stage_light_info_p->switch_no != 0xFF) { + if (!dLVI_getSWLight(stage_light_info_p)) { + if (dComIfGs_isSwitch(stage_light_info_p->switch_no, room_no)) { + is_switch = FALSE; } - } else if (!dComIfGs_isSwitch(param_0->field_0x1f, i_roomNo)) { - var_r31 = 0; + } else if (!dComIfGs_isSwitch(stage_light_info_p->switch_no, room_no)) { + is_switch = FALSE; } } - return var_r31; + return is_switch; } /* 801A6278-801A6C20 1A0BB8 09A8+00 2/2 0/0 0/0 .text dKy_setLight_nowroom_common__Fcf */ -static void dKy_setLight_nowroom_common(char param_0, f32 param_1) { - // NONMATCHING +// NONMATCHING - some issues with lightStatusPt loads +void dKy_setLight_nowroom_common(char room_no, f32 light_ratio) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + camera_class* camera = (camera_class*)dComIfGp_getCamera(0); + fopAc_ac_c* player = (fopAc_ac_c*)dComIfGp_getPlayer(0); + MtxP view_mtx = j3dSys.getViewMtx(); + dKy_tevstr_c* room_tevstr = dComIfGp_roomControl_getTevStr(room_no); + + if (dComIfGp_roomControl_getStatusRoomDt(room_no) != NULL) { + stage_pure_lightvec_info_class* room_light_info = dComIfGp_roomControl_getStatusRoomDt(room_no)->mRoomDt.getLightVecInfo(); + int room_light_info_num = dComIfGp_roomControl_getStatusRoomDt(room_no)->mRoomDt.getLightVecInfoNum(); + if (room_light_info_num > 6) { + room_light_info_num = 6; + } + + lightMask = 0; + + for (int i = 0; i < room_light_info_num; i++) { + if (room_light_info != NULL) { + lightMask |= lightMaskData[i + 2]; + } + room_light_info++; + } + + room_light_info = dComIfGp_roomControl_getStatusRoomDt(room_no)->mRoomDt.getLightVecInfo(); + if (dKy_SunMoon_Light_Check() == TRUE && room_light_info == NULL) { + lightMask |= lightMaskData[2]; + lightMask |= lightMaskData[3]; + room_light_info_num = 2; + } + + if (g_env_light.bgparts_active_light[0].mIndex != 0) { + lightMask |= 1; + } + + if (g_env_light.bgparts_active_light[1].mIndex != 0) { + lightMask |= 2; + } + + if (camera != 0) { + int eflight_id = dKy_eflight_influence_id(camera->lookat.eye, 0); + if (eflight_id >= 0) { + dKy_bgparts_activelight_set(g_env_light.efplight[eflight_id], 1); + if (dKy_Indoor_check() == TRUE) { + g_env_light.field_0x10a0 = g_env_light.efplight[eflight_id]->mPosition; + dKy_shadow_mode_set(1); + } + } else { + dKy_bgparts_activelight_cut(1); + if (dKy_shadow_mode_check(1)) { + dKy_shadow_mode_reset(1); + } + } + } + + for (int i = 0; i < 2; i++) { + if (g_env_light.bgparts_active_light[i].mIndex != 0 && + 0.0f != g_env_light.bgparts_active_light[i].mPow && + (i != 1 || dMeter2Info_getWindowStatus() != 3)) + { + lightStatusPt[i].position = g_env_light.bgparts_active_light[i].mPosition; + + if (i == 0) { + lightStatusPt[i].mRefDist = g_env_light.bgparts_active_light[i].mPow * 0.01f; + } else { + lightStatusPt[i].mRefDist = g_env_light.bgparts_active_light[i].mPow * 0.01f; + } + + lightStatusPt[i].mRefBrightness = 0.99999f; + lightStatusPt[i].field_0x1c = 1; + lightStatusPt[i].mDistFn = GX_DA_STEEP; + lightStatusPt[i].mSpotFn = GX_SP_OFF; + lightStatusPt[i].color.r = g_env_light.bgparts_active_light[i].mColor.r; + lightStatusPt[i].color.g = g_env_light.bgparts_active_light[i].mColor.g; + lightStatusPt[i].color.b = g_env_light.bgparts_active_light[i].mColor.b; + } else { + lightStatusPt[i].color.r = 0; + lightStatusPt[i].color.g = 0; + lightStatusPt[i].color.b = 0; + } + } + + for (int i = 0; i < 6; i++) { + if (room_light_info != 0) { + if (i < room_light_info_num) { + lightStatusPt[i + 2].position.x = room_light_info[i].position.x; + lightStatusPt[i + 2].position.y = room_light_info[i].position.y; + lightStatusPt[i + 2].position.z = room_light_info[i].position.z; + + if (dKy_lightswitch_check(&room_light_info[i], room_no) == TRUE) { + lightStatusPt[i + 2].mRefDist = room_light_info[i].radius; + } else { + lightStatusPt[i + 2].mRefDist = 0.000001f; + } + + lightStatusPt[i + 2].mRefBrightness = 0.99999f; + lightStatusPt[i + 2].field_0x1c = 0; + lightStatusPt[i + 2].mSpotFn = (GXSpotFn)room_light_info[i].spot_type; + lightStatusPt[i + 2].mDistFn = (GXDistAttnFn)room_light_info[i].dist_atten_type; + lightStatusPt[i + 2].mCutoff = room_light_info[i].spotCutoff; + dKy_lightdir_set(room_light_info[i].directionX, room_light_info[i].directionY, + &lightStatusPt[i + 2].mLightDir); + } else { + lightStatusPt[i + 2].mRefDist = 0.0f; + lightStatusPt[i + 2].mRefBrightness = 0.99999f; + lightStatusPt[i + 2].field_0x1c = 0; + lightStatusPt[i + 2].mDistFn = GX_DA_OFF; + lightStatusPt[i + 2].mSpotFn = GX_SP_OFF; + lightStatusPt[i + 2].mCutoff = 90.0f; + } + } + + if (dKy_SunMoon_Light_Check() == TRUE && i <= 1) { + lightMask |= lightMaskData[2]; + lightMask |= lightMaskData[3]; + + if (i == 0) { + lightStatusPt[i + 2].position = kankyo->sun_pos; + } else if (camera != 0) { + lightStatusPt[i + 2].position = camera->lookat.eye + kankyo->moon_pos; + } else { + lightStatusPt[i + 2].position = kankyo->moon_pos; + } + + lightStatusPt[i + 2].mRefDist = 10000.0f; + lightStatusPt[i + 2].mRefBrightness = 0.99999f; + lightStatusPt[i + 2].field_0x1c = 1; + lightStatusPt[i + 2].mDistFn = GX_DA_STEEP; + lightStatusPt[i + 2].mSpotFn = GX_SP_OFF; + } + + if (lightMask & lightMaskData[i + 2]) { + if (room_tevstr == NULL) { + JUT_ASSERT(12633, 0); + } + + J3DLightInfo* room_light = &room_tevstr->mLights[i].getLightInfo(); + if (room_light != NULL) { + lightStatusPt[i + 2].color = + dKy_light_influence_col(&room_light->mColor, light_ratio); + } else { + lightStatusPt[i + 2].color = + dKy_light_influence_col(&g_env_light.dungeonlight[i].mColor, light_ratio); + } + + if (room_no == dComIfGp_roomControl_getStayNo() && room_light_info != NULL && + i < room_light_info_num) + { + g_env_light.dungeonlight[i].mPosition = lightStatusPt[i + 2].position; + g_env_light.dungeonlight[i].mRefDistance = lightStatusPt[i + 2].mRefDist; + g_env_light.dungeonlight[i].mCutoffAngle = lightStatusPt[i + 2].mCutoff; + g_env_light.dungeonlight[i].mAngleAttenuation = lightStatusPt[i + 2].mSpotFn; + g_env_light.dungeonlight[i].mDistAttenuation = lightStatusPt[i + 2].mDistFn; + g_env_light.dungeonlight[i].mAngleX = room_light_info[i].directionX; + g_env_light.dungeonlight[i].mAngleY = room_light_info[i].directionY; + } + } else { + lightStatusPt[i + 2].color.r = 0; + lightStatusPt[i + 2].color.g = 0; + lightStatusPt[i + 2].color.b = 0; + } + } + + for (int i = 0; i < 6; i++) { + if (kankyo->field_0x0c18[i].field_0x26 == 1) { + for (int j = 0; j < 6; j++) { + if (!(lightMask & lightMaskData[j + 2])) { + lightMask |= lightMaskData[j + 2]; + + if (kankyo->field_0x0c18[i].mColor.a == 254 || + kankyo->field_0x0c18[i].mColor.a == 253) + { + dKy_twi_wolflight_set(i); + } + + if (room_tevstr->Type < 16) { + lightStatusPt[j + 2].position.x = kankyo->field_0x0c18[i].mPos.x; + lightStatusPt[j + 2].position.y = kankyo->field_0x0c18[i].mPos.y; + lightStatusPt[j + 2].position.z = kankyo->field_0x0c18[i].mPos.z; + } else { + lightStatusPt[j + 2].position.x = kankyo->field_0x0c18[i].mPos.x; + if (i == 0) { + lightStatusPt[j + 2].position.y = + kankyo->field_0x0c18[i].mPos.y + g_env_light.field_0x127c; + } else { + lightStatusPt[j + 2].position.y = + 200.0f + kankyo->field_0x0c18[i].mPos.y; + } + lightStatusPt[j + 2].position.z = kankyo->field_0x0c18[i].mPos.z; + } + + lightStatusPt[j + 2].color = dKy_light_influence_col(&kankyo->field_0x0c18[i].mColor, light_ratio); + lightStatusPt[j + 2].mRefDist = kankyo->field_0x0c18[i].mRefDistance; + lightStatusPt[j + 2].mRefBrightness = 0.99999f; + lightStatusPt[j + 2].field_0x1c = 1; + lightStatusPt[j + 2].mSpotFn = (GXSpotFn)kankyo->field_0x0c18[i].mAngleAttenuation; + lightStatusPt[j + 2].mDistFn = (GXDistAttnFn)kankyo->field_0x0c18[i].mDistAttenuation; + lightStatusPt[j + 2].mCutoff = kankyo->field_0x0c18[i].mCutoffAngle; + + dKy_lightdir_set(kankyo->field_0x0c18[i].mAngleX, + kankyo->field_0x0c18[i].mAngleY, + &lightStatusPt[j + 2].mLightDir); + break; + } + } + } + } + + dKy_GlobalLight_set(); + } } /* 801A6C20-801A6C58 1A1560 0038+00 2/2 1/1 0/0 .text dKy_setLight_nowroom__Fc */ -void dKy_setLight_nowroom(char param_0) { +void dKy_setLight_nowroom(char room_no) { if (dComIfGp_getCamera(0) != NULL) { - dKy_setLight_nowroom_common(param_0, 1.0f); + dKy_setLight_nowroom_common(room_no, 1.0f); } } /* 801A6C58-801A6D4C 1A1598 00F4+00 0/0 1/1 2/2 .text dKy_setLight_nowroom_grass__Fcf */ -void dKy_setLight_nowroom_grass(char param_0, f32 param_1) { - // NONMATCHING +// NONMATCHING - weird branching +void dKy_setLight_nowroom_grass(char room_no, f32 light_ratio) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + camera_class* camera = (camera_class*)dComIfGp_getCamera(0); + fopAc_ac_c* player = (fopAc_ac_c*)dComIfGp_getPlayer(0); + MtxP view_mtx = j3dSys.getViewMtx(); + + if (dComIfGp_roomControl_getStatusRoomDt(room_no) != NULL) { + dStage_FileList_dt_c* filelist = dComIfGp_roomControl_getStatusRoomDt(room_no)->mRoomDt.getFileListInfo(); + if (filelist == NULL) { + return; + } + + int grass_light = dStage_FileList_dt_GRASSLIGHT(filelist); + + f32 grass_light_ratio; + if (grass_light >= 0xFF) { + grass_light_ratio = 1.0f; + } else { + grass_light_ratio = grass_light / 100.0f; + } + + if (light_ratio == 0.0f) { + dKy_setLight_nowroom_common(room_no, grass_light_ratio); + } else { + dKy_setLight_nowroom_common(room_no, light_ratio); + } + } } -/* ############################################################################################## */ -/* 80394C6C-80394C6C 0212CC 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80394E70 = "D_MN"; -#pragma pop - /* 801A6D4C-801A6E9C 1A168C 0150+00 1/1 1/1 0/0 .text dKy_move_room_ratio__FP12dKy_tevstr_cPSc */ -f32 dKy_move_room_ratio(dKy_tevstr_c* param_0, s8* param_1) { - // NONMATCHING +f32 dKy_move_room_ratio(dKy_tevstr_c* tevstr_p, s8* room_no_p) { + f32 ratio = 1.0f; + + if (memcmp(dComIfGp_getStartStageName(), "D_MN", 4) == 0 && g_env_light.mColPatMode == 0 && + g_env_light.mColPatModeGather == 0 && tevstr_p->pat_ratio > 0.0f && + tevstr_p->pat_ratio < 1.0f) + { + if (tevstr_p->pat_ratio < 0.5f) { + if (tevstr_p->YukaCol == 0xFF) { + *room_no_p = tevstr_p->PrevCol; + ratio = fabsf(2.0f * (0.5f - tevstr_p->pat_ratio)); + } else { + *room_no_p = tevstr_p->room_no; + ratio = fabsf(2.0f * (tevstr_p->pat_ratio - 0.5f)); + } + } else { + *room_no_p = tevstr_p->room_no; + ratio = fabsf(2.0f * (tevstr_p->pat_ratio - 0.5f)); + } + + if (ratio <= 0.0f) { + ratio = 0.000001f; + } + } + + return ratio; } /* 801A6E9C-801A75C0 1A17DC 0724+00 1/1 1/1 0/0 .text dKy_setLight_nowroom_actor__FP12dKy_tevstr_c */ -void dKy_setLight_nowroom_actor(dKy_tevstr_c* param_0) { - // NONMATCHING +void dKy_setLight_nowroom_actor(dKy_tevstr_c* tevstr_p) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + Vec light_pos; + Vec sp3C; + camera_class* camera = (camera_class*)dComIfGp_getCamera(0); + fopAc_ac_c* player = dComIfGp_getPlayer(0); + MtxP view_mtx = j3dSys.getViewMtx(); + + s8 room_no = tevstr_p->room_no; + f32 light_ratio = 1.0f; + + if (tevstr_p->Type == 9 || tevstr_p->Type == 10) { + light_ratio = dKy_move_room_ratio(tevstr_p, &room_no); + } + + if (tevstr_p->Type == 14 || tevstr_p->Type == 12 || tevstr_p->Type == 13) { + return; + } + + if (dComIfGp_roomControl_getStatusRoomDt(room_no) != NULL) { + J3DLightInfo* light; + stage_pure_lightvec_info_class* room_lights = dComIfGp_roomControl_getStatusRoomDt(room_no)->mRoomDt.getLightVecInfo(); + int room_light_num = dComIfGp_roomControl_getStatusRoomDt(room_no)->mRoomDt.getLightVecInfoNum(); + if (room_light_num > 6) { + room_light_num = 6; + } + + lightMask = 0; + + for (int i = 0; i < room_light_num; i++) { + if (room_lights != NULL) { + lightMask |= lightMaskData[i + 2]; + } + room_lights++; + } + + room_lights = dComIfGp_roomControl_getStatusRoomDt(room_no)->mRoomDt.getLightVecInfo(); + + for (int i = 0; i < 6; i++) { + light = &tevstr_p->mLights[i].getLightInfo(); + if (view_mtx != NULL) { + if (room_lights != 0 && i < room_light_num) { + sp3C.x = room_lights[i].position.x; + sp3C.y = room_lights[i].position.y; + sp3C.z = room_lights[i].position.z; + + dKy_GXInitLightSpot(light, room_lights[i].spotCutoff, room_lights[i].spot_type); + + f32 var_f29; + if (dKy_lightswitch_check(&room_lights[i], room_no) == TRUE) { + var_f29 = light_ratio * room_lights[i].radius; + } else { + var_f29 = 0.000001f; + } + + dKy_GXInitLightDistAttn(light, var_f29, 0.99999f, + room_lights[i].dist_atten_type); + dKy_lightdir_set(room_lights[i].directionX, room_lights[i].directionY, + &light->mLightDirection); + light->mLightDirection.x = -light->mLightDirection.x; + light->mLightDirection.y = -light->mLightDirection.y; + light->mLightDirection.z = -light->mLightDirection.z; + } + + if (dKy_SunMoon_Light_Check() == TRUE && i <= 1) { + lightMask |= lightMaskData[2]; + lightMask |= lightMaskData[3]; + + if (i == 0) { + sp3C.x = kankyo->sun_pos.x; + sp3C.y = kankyo->sun_pos.y; + sp3C.z = kankyo->sun_pos.z; + } else if (camera != NULL) { + sp3C.x = camera->lookat.eye.x + kankyo->moon_pos.x; + sp3C.y = camera->lookat.eye.y + kankyo->moon_pos.y; + sp3C.z = camera->lookat.eye.z + kankyo->moon_pos.z; + } else { + sp3C.x = kankyo->moon_pos.x; + sp3C.y = kankyo->moon_pos.y; + sp3C.z = kankyo->moon_pos.z; + } + + dKy_GXInitLightSpot(light, 90.0f, GX_SP_OFF); + dKy_GXInitLightDistAttn(light, 10000.0f, 0.99999f, GX_DA_STEEP); + } + + cMtx_multVec(view_mtx, &sp3C, &light_pos); + light->mLightPosition = light_pos; + + if (1.0f != light_ratio) { + light->mColor.r *= light_ratio; + light->mColor.g *= light_ratio; + light->mColor.b *= light_ratio; + } + } + + if (!(lightMask & lightMaskData[i + 2])) { + light->mColor.r = 0; + light->mColor.g = 0; + light->mColor.b = 0; + } + + light = &tevstr_p->mLightObj.getLightInfo(); + if (1.0f != light_ratio) { + light->mColor.r *= light_ratio; + light->mColor.g *= light_ratio; + light->mColor.b *= light_ratio; + } + } + + for (int i = 0; i < 6; i++) { + if (kankyo->field_0x0c18[i].field_0x26 == 1 && view_mtx != NULL) { + for (int j = 0; j < 6; j++) { + if (!(lightMask & lightMaskData[j + 2])) { + lightMask |= lightMaskData[j + 2]; + + light = &tevstr_p->mLights[j].getLightInfo(); + if (kankyo->field_0x0c18[i].mColor.a == 254 || + kankyo->field_0x0c18[i].mColor.a == 253) + { + dKy_twi_wolflight_set(i); + } + + light->mColor = dKy_light_influence_col(&kankyo->field_0x0c18[i].mColor, + tevstr_p->field_0x374); + + if (tevstr_p->Type < 16) { + sp3C.x = kankyo->field_0x0c18[i].mPos.x; + sp3C.y = kankyo->field_0x0c18[i].mPos.y; + sp3C.z = kankyo->field_0x0c18[i].mPos.z; + + if (kankyo->field_0x0c18[i].mColor.a == 253) { + light->mColor.r = light->mColor.r * 0.65f; + light->mColor.g = light->mColor.g * 0.65f; + light->mColor.b = light->mColor.b * 0.65f; + } + } else { + sp3C.x = kankyo->field_0x0c18[i].mPos.x; + if (i == 0) { + sp3C.y = kankyo->field_0x0c18[i].mPos.y + g_env_light.field_0x127c; + } else { + sp3C.y = 200.0f + kankyo->field_0x0c18[i].mPos.y; + } + sp3C.z = kankyo->field_0x0c18[i].mPos.z; + } + + dKy_GXInitLightSpot(light, kankyo->field_0x0c18[i].mCutoffAngle, + kankyo->field_0x0c18[i].mAngleAttenuation); + f32 var_f30 = kankyo->field_0x0c18[i].mRefDistance * light_ratio; + if (var_f30 <= 0.0f) { + var_f30 = 0.000001f; + } + + dKy_GXInitLightDistAttn(light, var_f30, 0.99999f, + kankyo->field_0x0c18[i].mDistAttenuation); + cMtx_multVec(view_mtx, &sp3C, &light_pos); + light->mLightPosition = light_pos; + + dKy_lightdir_set(kankyo->field_0x0c18[i].mAngleX, + kankyo->field_0x0c18[i].mAngleY, &light->mLightDirection); + light->mLightDirection.x = -light->mLightDirection.x; + light->mLightDirection.y = -light->mLightDirection.y; + light->mLightDirection.z = -light->mLightDirection.z; + break; + } + } + } + } + } } /* 801A75C0-801A75E0 1A1F00 0020+00 0/0 6/6 7/7 .text dKy_setLight_again__Fv */ @@ -3508,16 +4742,16 @@ void dKy_setLight_again() { } /* 801A75E0-801A76D8 1A1F20 00F8+00 0/0 3/3 5/5 .text dKy_Global_amb_set__FP12dKy_tevstr_c */ -void dKy_Global_amb_set(dKy_tevstr_c* i_tevstr) { +void dKy_Global_amb_set(dKy_tevstr_c* tevstr_p) { GXColor color; - color.r = i_tevstr->mColorC0.r; - color.g = i_tevstr->mColorC0.g; - color.b = i_tevstr->mColorC0.b; - color.a = i_tevstr->mColorC0.a; + color.r = tevstr_p->AmbCol.r; + color.g = tevstr_p->AmbCol.g; + color.b = tevstr_p->AmbCol.b; + color.a = tevstr_p->AmbCol.a; - if (i_tevstr->field_0x37a == 2 || i_tevstr->field_0x37a == 3) { + if (tevstr_p->Type == 2 || tevstr_p->Type == 3) { if (dKy_darkworld_check()) { - if (i_tevstr->field_0x37a == 2) { + if (tevstr_p->Type == 2) { color.r = 18; color.g = 18; color.b = 18; @@ -3529,8 +4763,8 @@ void dKy_Global_amb_set(dKy_tevstr_c* i_tevstr) { color.a = 0; } } - } else if ((i_tevstr->field_0x37a >= 1 && i_tevstr->field_0x37a <= 7) || - (i_tevstr->field_0x37a == 9 && dKy_darkworld_check())) + } else if ((tevstr_p->Type >= 1 && tevstr_p->Type <= 7) || + (tevstr_p->Type == 9 && dKy_darkworld_check())) { color.r = 0; color.g = 0; @@ -3542,44 +4776,44 @@ void dKy_Global_amb_set(dKy_tevstr_c* i_tevstr) { } /* 801A76D8-801A7714 1A2018 003C+00 1/1 0/0 0/0 .text dKy_light_influence_pos__Fi */ -static cXyz dKy_light_influence_pos(int param_0) { - if (param_0 < 0) { - param_0 = 0; +cXyz dKy_light_influence_pos(int light_id) { + if (light_id < 0) { + light_id = 0; } - dScnKy_env_light_c* env_light = &g_env_light; - return env_light->mPointLight[param_0]->mPosition; + dScnKy_env_light_c* kankyo = &g_env_light; + return kankyo->pointlight[light_id]->mPosition; } /* 801A7714-801A7738 1A2054 0024+00 0/0 1/1 0/0 .text dKy_plight_near_pos__Fv */ cXyz dKy_plight_near_pos() { - return g_env_light.mPLightNearPos; + return g_env_light.plight_near_pos; } /* 801A7738-801A7790 1A2078 0058+00 0/0 0/0 1/1 .text * dKy_mock_light_every_set__FP15LIGHT_INFLUENCE */ -void dKy_mock_light_every_set(LIGHT_INFLUENCE* param_0) { +void dKy_mock_light_every_set(LIGHT_INFLUENCE* light_inf_p) { for (int i = 50; i < 100; i++) { - if (g_env_light.mPointLight[i] == NULL) { - g_env_light.mPointLight[i] = param_0; - g_env_light.mPointLight[i]->mIndex = i + 1; + if (g_env_light.pointlight[i] == NULL) { + g_env_light.pointlight[i] = light_inf_p; + g_env_light.pointlight[i]->mIndex = i + 1; break; } } } /* 801A7790-801A7814 1A20D0 0084+00 1/1 1/1 18/18 .text dKy_plight_set__FP15LIGHT_INFLUENCE */ -void dKy_plight_set(LIGHT_INFLUENCE* param_0) { +void dKy_plight_set(LIGHT_INFLUENCE* light_inf_p) { for (int i = 0; i < 100; i++) { - if (g_env_light.mPointLight[i] == param_0) { + if (g_env_light.pointlight[i] == light_inf_p) { return; } } for (int i = 0; i < 50; i++) { - if (g_env_light.mPointLight[i] == NULL) { - g_env_light.mPointLight[i] = param_0; - g_env_light.mPointLight[i]->mIndex = i + 1; + if (g_env_light.pointlight[i] == NULL) { + g_env_light.pointlight[i] = light_inf_p; + g_env_light.pointlight[i]->mIndex = i + 1; break; } } @@ -3587,11 +4821,11 @@ void dKy_plight_set(LIGHT_INFLUENCE* param_0) { /* 801A7814-801A7868 1A2154 0054+00 0/0 0/0 4/4 .text dKy_dalkmist_inf_set__FP18DALKMIST_INFLUENCE */ -void dKy_dalkmist_inf_set(DALKMIST_INFLUENCE* param_0) { +void dKy_dalkmist_inf_set(DALKMIST_INFLUENCE* dalkmist_inf_p) { for (int i = 0; i < 10; i++) { - if (g_env_light.mDalkmistInf[i] == NULL) { - g_env_light.mDalkmistInf[i] = param_0; - g_env_light.mDalkmistInf[i]->mIndex = i; + if (g_env_light.dalkmist_influence[i] == NULL) { + g_env_light.dalkmist_influence[i] = dalkmist_inf_p; + g_env_light.dalkmist_influence[i]->mIndex = i; break; } } @@ -3599,23 +4833,23 @@ void dKy_dalkmist_inf_set(DALKMIST_INFLUENCE* param_0) { /* 801A7868-801A789C 1A21A8 0034+00 0/0 0/0 4/4 .text dKy_dalkmist_inf_cut__FP18DALKMIST_INFLUENCE */ -void dKy_dalkmist_inf_cut(DALKMIST_INFLUENCE* param_0) { - if (param_0 != NULL) { - if (param_0->mIndex < 10) { - g_env_light.mDalkmistInf[param_0->mIndex] = NULL; +void dKy_dalkmist_inf_cut(DALKMIST_INFLUENCE* dalkmist_inf_p) { + if (dalkmist_inf_p != NULL) { + if (dalkmist_inf_p->mIndex < 10) { + g_env_light.dalkmist_influence[dalkmist_inf_p->mIndex] = NULL; } } } /* 801A789C-801A792C 1A21DC 0090+00 0/0 0/0 1/1 .text dKy_plight_priority_set__FP15LIGHT_INFLUENCE */ -void dKy_plight_priority_set(LIGHT_INFLUENCE* param_0) { +void dKy_plight_priority_set(LIGHT_INFLUENCE* light_inf_p) { int i = 0; for (; i < 50; i++) { - if (g_env_light.mPointLight[i] == NULL) { - g_env_light.mPointLight[i] = param_0; - g_env_light.mPointLight[i]->mIndex = -(i + 1); + if (g_env_light.pointlight[i] == NULL) { + g_env_light.pointlight[i] = light_inf_p; + g_env_light.pointlight[i]->mIndex = -(i + 1); break; } } @@ -3626,45 +4860,45 @@ void dKy_plight_priority_set(LIGHT_INFLUENCE* param_0) { } /* 801A792C-801A797C 1A226C 0050+00 0/0 1/1 32/32 .text dKy_plight_cut__FP15LIGHT_INFLUENCE */ -void dKy_plight_cut(LIGHT_INFLUENCE* param_0) { - if (param_0 != NULL) { - if (param_0->mIndex != 0) { - if (param_0->mIndex < 0) { - param_0->mIndex *= -1; +void dKy_plight_cut(LIGHT_INFLUENCE* light_inf_p) { + if (light_inf_p != NULL) { + if (light_inf_p->mIndex != 0) { + if (light_inf_p->mIndex < 0) { + light_inf_p->mIndex *= -1; } - int idx = (param_0->mIndex & 0xFFF) - 1; + int idx = (light_inf_p->mIndex & 0xFFF) - 1; if (idx < 50) { - g_env_light.mPointLight[idx] = NULL; + g_env_light.pointlight[idx] = NULL; } } } } /* 801A797C-801A7A00 1A22BC 0084+00 1/1 1/1 3/3 .text dKy_efplight_set__FP15LIGHT_INFLUENCE */ -void dKy_efplight_set(LIGHT_INFLUENCE* param_0) { +void dKy_efplight_set(LIGHT_INFLUENCE* light_inf_p) { for (int i = 0; i < 5; i++) { - if (g_env_light.mEfPLight[i] == param_0) { + if (g_env_light.efplight[i] == light_inf_p) { return; } } for (int i = 0; i < 5; i++) { - if (g_env_light.mEfPLight[i] == NULL) { - g_env_light.mEfPLight[i] = param_0; - g_env_light.mEfPLight[i]->mIndex = i + 1; + if (g_env_light.efplight[i] == NULL) { + g_env_light.efplight[i] = light_inf_p; + g_env_light.efplight[i]->mIndex = i + 1; break; } } } /* 801A7A00-801A7A40 1A2340 0040+00 1/1 1/1 3/3 .text dKy_efplight_cut__FP15LIGHT_INFLUENCE */ -void dKy_efplight_cut(LIGHT_INFLUENCE* param_0) { - if (param_0 != NULL) { - if (param_0->mIndex != 0) { - int idx = param_0->mIndex - 1; +void dKy_efplight_cut(LIGHT_INFLUENCE* light_inf_p) { + if (light_inf_p != NULL) { + if (light_inf_p->mIndex != 0) { + int idx = light_inf_p->mIndex - 1; if (idx >= 0 && idx < 5) { - g_env_light.mEfPLight[idx] = NULL; + g_env_light.efplight[idx] = NULL; } } } @@ -3672,97 +4906,89 @@ void dKy_efplight_cut(LIGHT_INFLUENCE* param_0) { /* 801A7A40-801A7AAC 1A2380 006C+00 1/1 0/0 0/0 .text * dKy_bgparts_activelight_set__FP15LIGHT_INFLUENCEi */ -static void dKy_bgparts_activelight_set(LIGHT_INFLUENCE* influence_p, int param_1) { - if (influence_p != NULL) { - memcpy(&g_env_light.mBGpartsActiveLight[param_1], influence_p, sizeof(LIGHT_INFLUENCE)); - g_env_light.mBGpartsActiveLight[param_1].mIndex = param_1 + 1; +void dKy_bgparts_activelight_set(LIGHT_INFLUENCE* light_inf_p, int bgpart_id) { + if (light_inf_p != NULL) { + memcpy(&g_env_light.bgparts_active_light[bgpart_id], light_inf_p, sizeof(LIGHT_INFLUENCE)); + g_env_light.bgparts_active_light[bgpart_id].mIndex = bgpart_id + 1; } } /* 801A7AAC-801A7AC8 1A23EC 001C+00 1/1 0/0 0/0 .text dKy_bgparts_activelight_cut__Fi */ -static void dKy_bgparts_activelight_cut(int param_0) { - g_env_light.mBGpartsActiveLight[param_0].mIndex = 0; +void dKy_bgparts_activelight_cut(int bgpart_id) { + g_env_light.bgparts_active_light[bgpart_id].mIndex = 0; } /* 801A7AC8-801A7B68 1A2408 00A0+00 1/1 1/1 1/1 .text dKy_actor_addcol_amb_set__Fsssf */ -void dKy_actor_addcol_amb_set(s16 r, s16 g, s16 b, f32 factor) { - g_env_light.mActorAddColAmb.r = r * factor; - g_env_light.mActorAddColAmb.g = g * factor; - g_env_light.mActorAddColAmb.b = b * factor; +void dKy_actor_addcol_amb_set(s16 r, s16 g, s16 b, f32 ratio) { + g_env_light.actor_addcol_amb.r = r * ratio; + g_env_light.actor_addcol_amb.g = g * ratio; + g_env_light.actor_addcol_amb.b = b * ratio; } - /* 801A7B68-801A7C08 1A24A8 00A0+00 1/1 1/1 1/1 .text dKy_bg_addcol_amb_set__Fsssf */ -void dKy_bg_addcol_amb_set(s16 r, s16 g, s16 b, f32 factor) { - g_env_light.mBgAddColAmb.r = r * factor; - g_env_light.mBgAddColAmb.g = g * factor; - g_env_light.mBgAddColAmb.b = b * factor; +void dKy_bg_addcol_amb_set(s16 r, s16 g, s16 b, f32 ratio) { + g_env_light.bg_addcol_amb.r = r * ratio; + g_env_light.bg_addcol_amb.g = g * ratio; + g_env_light.bg_addcol_amb.b = b * ratio; } - /* 801A7C08-801A7CA8 1A2548 00A0+00 1/1 1/1 0/0 .text dKy_bg1_addcol_amb_set__Fsssf */ -void dKy_bg1_addcol_amb_set(s16 r, s16 g, s16 b, f32 factor) { - g_env_light.mBg1AddColAmb.r = r * factor; - g_env_light.mBg1AddColAmb.g = g * factor; - g_env_light.mBg1AddColAmb.b = b * factor; +void dKy_bg1_addcol_amb_set(s16 r, s16 g, s16 b, f32 ratio) { + g_env_light.bg1_addcol_amb.r = r * ratio; + g_env_light.bg1_addcol_amb.g = g * ratio; + g_env_light.bg1_addcol_amb.b = b * ratio; } - /* 801A7CA8-801A7D48 1A25E8 00A0+00 1/1 0/0 0/0 .text dKy_bg2_addcol_amb_set__Fsssf */ -static void dKy_bg2_addcol_amb_set(s16 r, s16 g, s16 b, f32 factor) { - g_env_light.mBg2AddColAmb.r = r * factor; - g_env_light.mBg2AddColAmb.g = g * factor; - g_env_light.mBg2AddColAmb.b = b * factor; +void dKy_bg2_addcol_amb_set(s16 r, s16 g, s16 b, f32 ratio) { + g_env_light.bg2_addcol_amb.r = r * ratio; + g_env_light.bg2_addcol_amb.g = g * ratio; + g_env_light.bg2_addcol_amb.b = b * ratio; } - /* 801A7D48-801A7DE8 1A2688 00A0+00 1/1 0/0 0/0 .text dKy_bg3_addcol_amb_set__Fsssf */ -static void dKy_bg3_addcol_amb_set(s16 r, s16 g, s16 b, f32 factor) { - g_env_light.mBg3AddColAmb.r = r * factor; - g_env_light.mBg3AddColAmb.g = g * factor; - g_env_light.mBg3AddColAmb.b = b * factor; +void dKy_bg3_addcol_amb_set(s16 r, s16 g, s16 b, f32 ratio) { + g_env_light.bg3_addcol_amb.r = r * ratio; + g_env_light.bg3_addcol_amb.g = g * ratio; + g_env_light.bg3_addcol_amb.b = b * ratio; } - /* 801A7DE8-801A7E88 1A2728 00A0+00 1/1 1/1 0/0 .text dKy_addcol_fog_set__Fsssf */ -void dKy_addcol_fog_set(s16 r, s16 g, s16 b, f32 factor) { - g_env_light.mFogAddCol.r = r * factor; - g_env_light.mFogAddCol.g = g * factor; - g_env_light.mFogAddCol.b = b * factor; +void dKy_addcol_fog_set(s16 r, s16 g, s16 b, f32 ratio) { + g_env_light.addcol_fog.r = r * ratio; + g_env_light.addcol_fog.g = g * ratio; + g_env_light.addcol_fog.b = b * ratio; } - /* 801A7E88-801A7F20 1A27C8 0098+00 2/2 0/0 2/2 .text dKy_actor_addcol_set__Fsssf */ -void dKy_actor_addcol_set(s16 r, s16 g, s16 b, f32 factor) { - dKy_actor_addcol_amb_set(r, g, b, factor); - dKy_bg_addcol_amb_set(r, g, b, factor); - dKy_bg1_addcol_amb_set(r, g, b, factor); - dKy_bg2_addcol_amb_set(r, g, b, factor); - dKy_bg3_addcol_amb_set(r, g, b, factor); +void dKy_actor_addcol_set(s16 r, s16 g, s16 b, f32 ratio) { + dKy_actor_addcol_amb_set(r, g, b, ratio); + dKy_bg_addcol_amb_set(r, g, b, ratio); + dKy_bg1_addcol_amb_set(r, g, b, ratio); + dKy_bg2_addcol_amb_set(r, g, b, ratio); + dKy_bg3_addcol_amb_set(r, g, b, ratio); } /* 801A7F20-801A7FC0 1A2860 00A0+00 1/1 1/1 0/0 .text dKy_vrbox_addcol_sky0_set__Fsssf */ -void dKy_vrbox_addcol_sky0_set(s16 r, s16 g, s16 b, f32 factor) { - g_env_light.mVrboxAddcolSky0.r = r * factor; - g_env_light.mVrboxAddcolSky0.g = g * factor; - g_env_light.mVrboxAddcolSky0.b = b * factor; +void dKy_vrbox_addcol_sky0_set(s16 r, s16 g, s16 b, f32 ratio) { + g_env_light.vrbox_addcol_sky0.r = r * ratio; + g_env_light.vrbox_addcol_sky0.g = g * ratio; + g_env_light.vrbox_addcol_sky0.b = b * ratio; } - /* 801A7FC0-801A8060 1A2900 00A0+00 1/1 1/1 0/0 .text dKy_vrbox_addcol_kasumi_set__Fsssf */ -void dKy_vrbox_addcol_kasumi_set(s16 r, s16 g, s16 b, f32 factor) { - g_env_light.mVrboxAddcolKasumi.r = r * factor; - g_env_light.mVrboxAddcolKasumi.g = g * factor; - g_env_light.mVrboxAddcolKasumi.b = b * factor; +void dKy_vrbox_addcol_kasumi_set(s16 r, s16 g, s16 b, f32 ratio) { + g_env_light.vrbox_addcol_kasumi.r = r * ratio; + g_env_light.vrbox_addcol_kasumi.g = g * ratio; + g_env_light.vrbox_addcol_kasumi.b = b * ratio; } - /* 801A8060-801A80D0 1A29A0 0070+00 1/1 0/0 0/0 .text dKy_vrbox_addcol_set__Fsssf */ -static void dKy_vrbox_addcol_set(s16 param_0, s16 param_1, s16 param_2, f32 param_3) { - dKy_vrbox_addcol_sky0_set(param_0, param_1, param_2, param_3); - dKy_vrbox_addcol_kasumi_set(param_0, param_1, param_2, param_3); - dKy_addcol_fog_set(param_0, param_1, param_2, param_3); +void dKy_vrbox_addcol_set(s16 r, s16 g, s16 b, f32 ratio) { + dKy_vrbox_addcol_sky0_set(r, g, b, ratio); + dKy_vrbox_addcol_kasumi_set(r, g, b, ratio); + dKy_addcol_fog_set(r, g, b, ratio); } /* 801A80D0-801A8168 1A2A10 0098+00 1/1 0/0 2/2 .text dKy_fog_startendz_set__Ffff */ @@ -3772,7 +4998,7 @@ void dKy_fog_startendz_set(f32 param_0, f32 param_1, f32 ratio) { ratio = 0.0f; } - if (ratio < 9.999999747378752e-05f) { + if (ratio < 0.0000000000001f) { ratio = 0.0f; } @@ -3781,69 +5007,93 @@ void dKy_fog_startendz_set(f32 param_0, f32 param_1, f32 ratio) { g_env_light.field_0x11f4 = ratio; } - /* 801A8168-801A8190 1A2AA8 0028+00 0/0 1/1 0/0 .text dKy_Itemgetcol_chg_on__Fv */ void dKy_Itemgetcol_chg_on() { - if (g_env_light.mItemGetCol_chg != 0 && g_env_light.mItemGetCol_chg != 6) { - return; + if (g_env_light.Itemgetcol_chg == 0 || g_env_light.Itemgetcol_chg == 6) { + g_env_light.Itemgetcol_chg = 1; } - - g_env_light.mItemGetCol_chg = 1; } /* 801A8190-801A81C0 1A2AD0 0030+00 2/2 0/0 0/0 .text dKy_Sound_init__Fv */ -static void dKy_Sound_init() { - g_env_light.mSound.field_0x0.x = 999999.9f; - g_env_light.mSound.field_0x0.y = 999999.9f; - g_env_light.mSound.field_0x0.z = 999999.9f; - g_env_light.mSound.field_0xc = 0; - g_env_light.mSound.field_0x14 = -1; - g_env_light.mSound.field_0x10 = 0; +void dKy_Sound_init() { + g_env_light.sound_influence.position.x = 999999.9f; + g_env_light.sound_influence.position.y = 999999.9f; + g_env_light.sound_influence.position.z = 999999.9f; + g_env_light.sound_influence.field_0xc = 0; + g_env_light.sound_influence.actor_id = fpcM_ERROR_PROCESS_ID_e; + g_env_light.sound_influence.timer = 0; } /* 801A81C0-801A8474 1A2B00 02B4+00 0/0 5/5 27/27 .text dKy_Sound_set__F4cXyziUii */ -void dKy_Sound_set(cXyz i_pos, int param_1, fpc_ProcID i_actorID, int param_3) { - // NONMATCHING +void dKy_Sound_set(cXyz pos, int param_1, fpc_ProcID actor_id, int timer) { + camera_class* camera_p = (camera_class*)dComIfGp_getCamera(0); + BOOL set_sound = FALSE; + f32 dist_pos_to_eye = pos.abs(camera_p->lookat.eye); + f32 dist_sndpos_to_eye = g_env_light.sound_influence.position.abs(camera_p->lookat.eye); + + if (dist_pos_to_eye < dist_sndpos_to_eye) { + if (dist_sndpos_to_eye < 1500.0f) { + set_sound = TRUE; + } else if (g_env_light.sound_influence.field_0xc < param_1) { + set_sound = TRUE; + } + } + + if (set_sound) { + g_env_light.sound_influence.position = pos; + g_env_light.sound_influence.field_0xc = param_1; + g_env_light.sound_influence.actor_id = actor_id; + g_env_light.sound_influence.timer = timer; + } } /* 801A8474-801A8484 1A2DB4 0010+00 0/0 1/1 8/8 .text dKy_Sound_get__Fv */ SND_INFLUENCE* dKy_Sound_get() { - return &g_env_light.mSound; + return &g_env_light.sound_influence; } /* 801A8484-801A8538 1A2DC4 00B4+00 0/0 2/2 0/0 .text dKy_SordFlush_set__F4cXyzi */ -void dKy_SordFlush_set(cXyz param_0, int param_1) { +void dKy_SordFlush_set(cXyz light_pos, int light_type) { dScnKy_env_light_c* light = dKy_getEnvlight(); if (!dKy_darkworld_check() && (light->mThunderEff.mState >= 10 || light->mThunderEff.mFlashTimer <= 0.0f)) { - if (g_env_light.mSwordLight.mState == 0) { - g_env_light.mSwordLight.mState = 1; - g_env_light.mSwordLight.mLightType = param_1; - g_env_light.mSwordLight.field_0x8.mPosition = param_0; - } else if (g_env_light.mSwordLight.mState == 2) { - g_env_light.mSwordLight.mState = 4; + if (g_env_light.eflight.mState == 0) { + g_env_light.eflight.mState = 1; + g_env_light.eflight.mLightType = light_type; + g_env_light.eflight.field_0x8.mPosition = light_pos; + } else if (g_env_light.eflight.mState == 2) { + g_env_light.eflight.mState = 4; } } } - -/* ############################################################################################## */ -/* 80453DA8-80453DAC 0023A8 0004+00 3/3 0/0 0/0 .sdata2 @8647 */ -SECTION_SDATA2 static f32 lit_8647 = 160000.0f; - /* 801A8538-801A85E8 1A2E78 00B0+00 1/1 0/0 0/0 .text GxFogSet_Sub__FP8_GXColor */ -static void GxFogSet_Sub(_GXColor* param_0) { - // NONMATCHING +static void GxFogSet_Sub(GXColor* fog_col_p) { + f32 near_z = 1.0f; + f32 far_z = 160000.0f; + GXColor color; + color = *fog_col_p; + + if (dComIfGd_getView() != NULL) { + if (dComIfGd_getView()->near >= 0.0f && dComIfGd_getView()->far >= 0.0f) { + if (dComIfGd_getView()->near < dComIfGd_getView()->far) { + near_z = dComIfGd_getView()->near; + far_z = dComIfGd_getView()->far; + } + } + } + + GXSetFog(GX_FOG_PERSP_LIN, g_env_light.mFogNear, g_env_light.mFogFar, near_z, far_z, color); } /* 801A85E8-801A862C 1A2F28 0044+00 1/1 0/0 0/0 .text GxFog_set__Fv */ static void GxFog_set() { GXColor color; - color.r = g_env_light.mFogColor.r; - color.g = g_env_light.mFogColor.g; - color.b = g_env_light.mFogColor.b; + color.r = g_env_light.fog_col.r; + color.g = g_env_light.fog_col.g; + color.b = g_env_light.fog_col.b; GxFogSet_Sub(&color); } @@ -3855,35 +5105,68 @@ void dKy_GxFog_set() { } /* 801A8650-801A86F8 1A2F90 00A8+00 0/0 3/3 6/6 .text dKy_GxFog_tevstr_set__FP12dKy_tevstr_c */ -void dKy_GxFog_tevstr_set(dKy_tevstr_c* param_0) { - // NONMATCHING +void dKy_GxFog_tevstr_set(dKy_tevstr_c* tevstr_p) { + f32 near_z = 1.0f; + f32 far_z = 160000.0f; + + GXColor color; + color.r = tevstr_p->FogCol.r; + color.g = tevstr_p->FogCol.g; + color.b = tevstr_p->FogCol.b; + + if (dComIfGd_getView() != NULL) { + if (dComIfGd_getView()->near >= 0.0f && dComIfGd_getView()->far >= 0.0f) { + if (dComIfGd_getView()->near < dComIfGd_getView()->far) { + near_z = dComIfGd_getView()->near; + far_z = dComIfGd_getView()->far; + } + } + } + + GXSetFog(GX_FOG_PERSP_LIN, tevstr_p->mFogStartZ, tevstr_p->mFogEndZ, near_z, far_z, color); + GxXFog_set(); } /* 801A86F8-801A87A0 1A3038 00A8+00 0/0 0/0 1/1 .text dKy_GfFog_tevstr_set__FP12dKy_tevstr_c */ -void dKy_GfFog_tevstr_set(dKy_tevstr_c* param_0) { - // NONMATCHING +void dKy_GfFog_tevstr_set(dKy_tevstr_c* tevstr_p) { + f32 near_z = 1.0f; + f32 far_z = 160000.0f; + + GXColor color; + color.r = tevstr_p->FogCol.r; + color.g = tevstr_p->FogCol.g; + color.b = tevstr_p->FogCol.b; + + if (dComIfGd_getView() != NULL) { + if (dComIfGd_getView()->near >= 0.0f && dComIfGd_getView()->far >= 0.0f) { + if (dComIfGd_getView()->near < dComIfGd_getView()->far) { + near_z = dComIfGd_getView()->near; + far_z = dComIfGd_getView()->far; + } + } + } + + GFSetFog(GX_FOG_PERSP_LIN, tevstr_p->mFogStartZ, tevstr_p->mFogEndZ, near_z, far_z, color); + GxXFog_set(); } /* 801A87A0-801A87E4 1A30E0 0044+00 3/3 0/0 0/0 .text GxXFog_set__Fv */ static void GxXFog_set() { dKyd_xfog_table_set(g_env_light.mFogAdjTableType); - GXSetFogRangeAdj((GXBool)g_env_light.mFogAdjEnable, g_env_light.mFogAdjCenter, - &g_env_light.mXFogTbl); + GXSetFogRangeAdj(g_env_light.mFogAdjEnable, g_env_light.mFogAdjCenter, &g_env_light.mXFogTbl); } /* 801A87E4-801A880C 1A3124 0028+00 0/0 0/0 52/52 .text dKy_change_colpat__FUc */ void dKy_change_colpat(u8 colpat) { g_env_light.mColpatCurrGather = colpat; - if (g_env_light.mColPatCurr == colpat) { - return; + if (g_env_light.wether_pat1 != colpat) { + g_env_light.mColPatBlendGather = 0.0f; } - - g_env_light.mColPatBlendGather = 0.0f; } /* 801A880C-801A8854 1A314C 0048+00 0/0 0/0 25/25 .text dKy_custom_colset__FUcUcf */ void dKy_custom_colset(u8 prevGather, u8 curGather, f32 blend) { - if (g_env_light.mInitAnmTimer != 1) { + if (g_env_light.light_init_timer != 1) { if (blend < 1.0f) { g_env_light.mColpatPrevGather = prevGather; } else { @@ -3898,60 +5181,60 @@ void dKy_custom_colset(u8 prevGather, u8 curGather, f32 blend) { /* 801A8854-801A88EC 1A3194 0098+00 0/0 0/0 2/2 .text dKy_setLight_mine__FP12dKy_tevstr_c */ -void dKy_setLight_mine(dKy_tevstr_c* p_tevstr) { +void dKy_setLight_mine(dKy_tevstr_c* tevstr_p) { GXLightObj light; - GXInitLightPos(&light, p_tevstr->mLightObj.mInfo.mLightPosition.x, - p_tevstr->mLightObj.mInfo.mLightPosition.y, - p_tevstr->mLightObj.mInfo.mLightPosition.z); - GXInitLightDir(&light, p_tevstr->mLightObj.mInfo.mLightDirection.x, - p_tevstr->mLightObj.mInfo.mLightDirection.y, - p_tevstr->mLightObj.mInfo.mLightDirection.z); - GXInitLightColor(&light, p_tevstr->mLightObj.mInfo.mColor); - GXInitLightAttn(&light, p_tevstr->mLightObj.mInfo.mCosAtten.x, - p_tevstr->mLightObj.mInfo.mCosAtten.y, p_tevstr->mLightObj.mInfo.mCosAtten.z, - p_tevstr->mLightObj.mInfo.mDistAtten.x, p_tevstr->mLightObj.mInfo.mDistAtten.y, - p_tevstr->mLightObj.mInfo.mDistAtten.z); + GXInitLightPos(&light, tevstr_p->mLightObj.mInfo.mLightPosition.x, + tevstr_p->mLightObj.mInfo.mLightPosition.y, + tevstr_p->mLightObj.mInfo.mLightPosition.z); + GXInitLightDir(&light, tevstr_p->mLightObj.mInfo.mLightDirection.x, + tevstr_p->mLightObj.mInfo.mLightDirection.y, + tevstr_p->mLightObj.mInfo.mLightDirection.z); + GXInitLightColor(&light, tevstr_p->mLightObj.mInfo.mColor); + GXInitLightAttn(&light, tevstr_p->mLightObj.mInfo.mCosAtten.x, + tevstr_p->mLightObj.mInfo.mCosAtten.y, tevstr_p->mLightObj.mInfo.mCosAtten.z, + tevstr_p->mLightObj.mInfo.mDistAtten.x, tevstr_p->mLightObj.mInfo.mDistAtten.y, + tevstr_p->mLightObj.mInfo.mDistAtten.z); GXLoadLightObjImm(&light, (GXLightID)*lightMaskData); } /* 801A88EC-801A8A34 1A322C 0148+00 2/2 5/5 11/11 .text dKy_tevstr_init__FP12dKy_tevstr_cScUc */ -void dKy_tevstr_init(dKy_tevstr_c* p_tevstr, s8 roomNo, u8 param_2) { - memset(p_tevstr, 0, sizeof(dKy_tevstr_c)); +void dKy_tevstr_init(dKy_tevstr_c* tevstr_p, s8 room_no, u8 floorCol) { + memset(tevstr_p, 0, sizeof(dKy_tevstr_c)); - if (roomNo == -1) { - p_tevstr->mRoomNo = dComIfGp_roomControl_getStayNo(); + if (room_no == -1) { + tevstr_p->room_no = dComIfGp_roomControl_getStayNo(); } else { - p_tevstr->mRoomNo = roomNo; + tevstr_p->room_no = room_no; } - p_tevstr->mEnvrIdxCurr = p_tevstr->mRoomNo; - p_tevstr->mEnvrIdxPrev = p_tevstr->mRoomNo; - p_tevstr->mEnvrIdxOverride = param_2; - p_tevstr->mInitTimer = 1; - p_tevstr->mInitType = 0x7B; - p_tevstr->mColorC0.a = 0; - p_tevstr->mColorK0.a = 255; - p_tevstr->field_0x378 = 0; - p_tevstr->field_0x374 = 1.0f; - p_tevstr->field_0x384 = 0; + tevstr_p->UseCol = tevstr_p->room_no; + tevstr_p->PrevCol = tevstr_p->room_no; + tevstr_p->YukaCol = floorCol; + tevstr_p->mInitTimer = 1; + tevstr_p->Material_use_fg = 0x7B; + tevstr_p->AmbCol.a = 0; + tevstr_p->FogCol.a = 255; + tevstr_p->Material_id = 0; + tevstr_p->field_0x374 = 1.0f; + tevstr_p->field_0x384 = 0; - p_tevstr->mLightObj.mInfo.mColor.g = 0; - p_tevstr->mLightObj.mInfo.mColor.b = 0; - p_tevstr->mLightObj.mInfo.mColor.a = 255; - p_tevstr->mLightObj.mInfo.mCosAtten.x = 1.0f; - p_tevstr->mLightObj.mInfo.mCosAtten.y = 0.0f; - p_tevstr->mLightObj.mInfo.mCosAtten.z = 0.0f; - p_tevstr->mLightObj.mInfo.mDistAtten.x = 1.0f; - p_tevstr->mLightObj.mInfo.mDistAtten.y = 0.0f; - p_tevstr->mLightObj.mInfo.mDistAtten.z = 0.0f; + tevstr_p->mLightObj.mInfo.mColor.g = 0; + tevstr_p->mLightObj.mInfo.mColor.b = 0; + tevstr_p->mLightObj.mInfo.mColor.a = 255; + tevstr_p->mLightObj.mInfo.mCosAtten.x = 1.0f; + tevstr_p->mLightObj.mInfo.mCosAtten.y = 0.0f; + tevstr_p->mLightObj.mInfo.mCosAtten.z = 0.0f; + tevstr_p->mLightObj.mInfo.mDistAtten.x = 1.0f; + tevstr_p->mLightObj.mInfo.mDistAtten.y = 0.0f; + tevstr_p->mLightObj.mInfo.mDistAtten.z = 0.0f; for (int i = 0; i < 6; i++) { - J3DLightObj* tev_light_p = &p_tevstr->mLights[i]; + J3DLightObj* tev_light_p = &tevstr_p->mLights[i]; LightStatus* light_data_p = &lightStatusData[i]; - tev_light_p->mInfo.mLightPosition = light_data_p->field_0x0; - tev_light_p->mInfo.mColor = light_data_p->field_0x18; + tev_light_p->mInfo.mLightPosition = light_data_p->position; + tev_light_p->mInfo.mColor = light_data_p->color; tev_light_p->mInfo.mCosAtten.x = 1.0f; tev_light_p->mInfo.mCosAtten.y = 0.0f; tev_light_p->mInfo.mCosAtten.z = 0.0f; @@ -3961,30 +5244,29 @@ void dKy_tevstr_init(dKy_tevstr_c* p_tevstr, s8 roomNo, u8 param_2) { } } - /* 801A8A34-801A8A44 1A3374 0010+00 0/0 1/1 0/0 .text dKy_rain_check__Fv */ int dKy_rain_check() { - return g_env_light.mRainCount; + return g_env_light.raincnt; } /* 801A8A44-801A8A54 1A3384 0010+00 0/0 0/0 5/5 .text dKy_set_allcol_ratio__Ff */ void dKy_set_allcol_ratio(f32 ratio) { - g_env_light.mAllcolRatio = ratio; + g_env_light.allcol_ratio = ratio; } /* 801A8A54-801A8A64 1A3394 0010+00 0/0 1/1 1/1 .text dKy_set_actcol_ratio__Ff */ void dKy_set_actcol_ratio(f32 ratio) { - g_env_light.mActcolRatio = ratio; + g_env_light.actcol_ratio = ratio; } /* 801A8A64-801A8A74 1A33A4 0010+00 0/0 1/1 1/1 .text dKy_set_bgcol_ratio__Ff */ void dKy_set_bgcol_ratio(f32 ratio) { - g_env_light.mBgcolRatio = ratio; + g_env_light.bgcol_ratio = ratio; } /* 801A8A74-801A8A84 1A33B4 0010+00 0/0 1/1 1/1 .text dKy_set_fogcol_ratio__Ff */ void dKy_set_fogcol_ratio(f32 ratio) { - g_env_light.mFogcolRatio = ratio; + g_env_light.fogcol_ratio = ratio; } /* 801A8A84-801A8AB8 1A33C4 0034+00 0/0 1/1 0/0 .text dKy_set_vrboxcol_ratio__Ff */ @@ -3994,31 +5276,30 @@ void dKy_set_vrboxcol_ratio(f32 ratio) { } /* 801A8AB8-801A8AC8 1A33F8 0010+00 1/1 0/0 0/0 .text dKy_set_vrboxsoracol_ratio__Ff */ -static void dKy_set_vrboxsoracol_ratio(f32 ratio) { - g_env_light.mVrboxSoracolRatio = ratio; +void dKy_set_vrboxsoracol_ratio(f32 ratio) { + g_env_light.vrboxsoracol_ratio = ratio; } /* 801A8AC8-801A8AD8 1A3408 0010+00 1/1 0/0 0/0 .text dKy_set_vrboxkumocol_ratio__Ff */ -static void dKy_set_vrboxkumocol_ratio(f32 ratio) { - g_env_light.mVrboxKumocolRatio = ratio; +void dKy_set_vrboxkumocol_ratio(f32 ratio) { + g_env_light.vrboxkumocol_ratio = ratio; } /* 801A8AD8-801A8B38 1A3418 0060+00 0/0 1/1 0/0 .text dKy_itudemo_se__Fv */ void dKy_itudemo_se() { - if (g_env_light.mMoyaSE != 0) { - mDoAud_seStart(g_env_light.mMoyaSE, NULL, 0, 0); + if (g_env_light.moya_se != 0) { + mDoAud_seStart(g_env_light.moya_se, NULL, 0, 0); } } - /* 801A8B38-801A8B58 1A3478 0020+00 1/1 2/2 11/11 .text dKy_get_dayofweek__Fv */ -s32 dKy_get_dayofweek() { +int dKy_get_dayofweek() { return dComIfGs_getDate() % 7; } /* 801A8B58-801A8B68 1A3498 0010+00 0/0 3/3 0/0 .text dKy_set_nexttime__Ff */ -void dKy_set_nexttime(f32 nextTime) { - g_env_light.mNexttime = nextTime; +void dKy_set_nexttime(f32 nexttime) { + g_env_light.nexttime = nexttime; } /* 801A8B68-801A8BC8 1A34A8 0060+00 0/0 1/1 0/0 .text dKy_instant_timechg__Ff */ @@ -4035,280 +5316,851 @@ void dKy_instant_timechg(f32 time) { void dKy_instant_rainchg() { dKyw_rain_set(250); g_env_light.mColpatWeather = 1; - g_env_light.mColPatPrev = 1; - g_env_light.mColPatCurr = 1; + g_env_light.wether_pat0 = 1; + g_env_light.wether_pat1 = 1; } /* 801A8C04-801A8E20 1A3544 021C+00 3/3 0/0 0/0 .text NewAmbColGet__FP11_GXColorS10 */ -static GXColor NewAmbColGet(_GXColorS10* param_0) { - // NONMATCHING +static GXColor NewAmbColGet(GXColorS10* in_col_p) { + GXColorS10 sp18, sp10; + sp18 = *in_col_p; + + sp10.r = sp18.r * 4; + sp10.g = sp18.g * 4; + sp10.b = sp18.b * 4; + + if (sp10.r > 0xFF) { + f32 temp_f31 = 255.0f / sp10.r; + sp10.r *= temp_f31; + sp10.g *= temp_f31; + sp10.b *= temp_f31; + } + + if (sp10.g > 0xFF) { + f32 temp_f31_2 = 255.0f / sp10.g; + sp10.r *= temp_f31_2; + sp10.g *= temp_f31_2; + sp10.b *= temp_f31_2; + } + + if (sp10.b > 0xFF) { + f32 temp_f31_3 = 255.0f / sp10.b; + sp10.r *= temp_f31_3; + sp10.g *= temp_f31_3; + sp10.b *= temp_f31_3; + } + + GXColor amb_col; + amb_col.r = sp10.r; + amb_col.g = sp10.g; + amb_col.b = sp10.b; + amb_col.a = 0xFF; + + return amb_col; } -/* ############################################################################################## */ -/* 80394C60-80394C6C 0212C0 000C+00 1/1 0/0 0/0 .rodata @9035 */ -SECTION_RODATA static u8 const lit_9035[12] = { - 0x4C, 0xBE, 0xBC, 0x20, 0x4C, 0xBE, 0xBC, 0x20, 0x4C, 0xBE, 0xBC, 0x20, +/* 803BC0A0-803BC0B4 -00001 0014+00 1/0 0/0 0/0 .data l_dKy_Method */ +static leafdraw_method_class l_dKy_Method = { + (process_method_func)dKy_Create, (process_method_func)dKy_Delete, + (process_method_func)dKy_Execute, (process_method_func)dKy_IsDelete, + (process_method_func)dKy_Draw, }; -COMPILER_STRIP_GATE(0x80394C60, &lit_9035); -/* 80453DAC-80453DB0 0023AC 0004+00 1/1 0/0 0/0 .sdata2 @8975 */ -SECTION_SDATA2 static f32 lit_8975 = 50.0f; +/* 803BC0B4-803BC0DC -00001 0028+00 0/0 0/0 1/0 .data g_profile_KANKYO */ +extern kankyo_process_profile_definition g_profile_KANKYO = { + fpcLy_CURRENT_e, + 1, + fpcPi_CURRENT_e, + PROC_KANKYO, + &g_fpcLf_Method.base, + sizeof(sub_kankyo__class), + 0, + 0, + &g_fopKy_Method, + 2, + &l_dKy_Method, +}; -/* 80453DB0-80453DB4 0023B0 0004+00 2/2 0/0 0/0 .sdata2 @9254 */ -SECTION_SDATA2 static f32 lit_9254 = 285.0f; - -/* 80453DB4-80453DB8 0023B4 0004+00 1/1 0/0 0/0 .sdata2 @9255 */ -SECTION_SDATA2 static f32 lit_9255 = 17.0f; - -/* 80453DB8-80453DBC 0023B8 0004+00 1/1 0/0 0/0 .sdata2 @9256 */ -SECTION_SDATA2 static f32 lit_9256 = 20.0f; - -/* 80453DBC-80453DC0 0023BC 0004+00 1/1 0/0 0/0 .sdata2 @9257 */ -SECTION_SDATA2 static f32 lit_9257 = 190.0f; - -/* 80453DC0-80453DC4 0023C0 0004+00 1/1 0/0 0/0 .sdata2 @9258 */ -SECTION_SDATA2 static f32 lit_9258 = 100000000.0f; - -/* 80453DC4-80453DC8 0023C4 0004+00 1/1 0/0 0/0 .sdata2 @9259 */ -SECTION_SDATA2 static f32 lit_9259 = 5.0f; +// fixes float literal order +static f32 dummy() { + return 50.0f; +} /* 801A8E20-801A9BE4 1A3760 0DC4+00 2/2 0/0 0/0 .text * dKy_ParticleColor_get_base__FP4cXyzP12dKy_tevstr_cP8_GXColorP8_GXColorP8_GXColorP8_GXColorf */ -static void dKy_ParticleColor_get_base(cXyz* param_0, dKy_tevstr_c* param_1, _GXColor* param_2, - _GXColor* param_3, _GXColor* param_4, _GXColor* param_5, - f32 param_6) { - // NONMATCHING +void dKy_ParticleColor_get_base(cXyz* param_0, dKy_tevstr_c* param_1, GXColor* param_2, + GXColor* param_3, GXColor* param_4, GXColor* param_5, f32 param_6) { + GXColor sp70[3]; + cXyz sp64; + f32 sp58[] = {100000000.0f, 100000000.0f, 100000000.0f}; + int i; + u8 spD = 0; + s8 room_no; + + GXColorS10 sp48; + J3DLightInfo* sp44; + GXColor sp40; + int sp3C; + s32 sp38; + stage_pure_lightvec_info_class* stage_light_info_p; + int sp30; + + for (i = 0; i < 6; i++) { + if (param_1 != NULL) { + sp44 = ¶m_1->mLights[i].getLightInfo(); + sp40 = sp44->mColor; + } else { + sp38 = dComIfGp_roomControl_getStayNo(); + if (dKy_SunMoon_Light_Check() == TRUE && i <= 1) { + sp40 = g_env_light.dungeonlight[i].mColor; + } else if (dComIfGp_roomControl_getStatusRoomDt(sp38) != NULL) { + stage_light_info_p = + dComIfGp_roomControl_getStatusRoomDt(sp38)->mRoomDt.getLightVecInfo(); + sp30 = dComIfGp_roomControl_getStatusRoomDt(sp38)->mRoomDt.getLightVecInfoNum(); + if (i < sp30) { + sp40 = g_env_light.dungeonlight[i].mColor; + } else { + sp40.r = 0; + sp40.g = 0; + sp40.b = 0; + } + } + } + + f32 var_f31; + if (dKy_SunMoon_Light_Check() == TRUE && i <= 1) { + if (g_env_light.daytime >= 90.0f && g_env_light.daytime <= 285.0f) { + if (i == 0) { + var_f31 = 1.0f; + } else { + var_f31 = 2.0f; + } + } else if (i == 0) { + var_f31 = 2.0f; + } else { + var_f31 = 1.0f; + } + + if (strcmp(dComIfGp_getStartStageName(), "F_SP114") == 0) { + if (sp40.r < 15.0f) { + sp40.r = 15; + } + + if (sp40.g < 17.0f) { + sp40.g = 17; + } + + if (sp40.b < 20.0f) { + sp40.b = 20; + } + } + } else if (sp40.r != 0 || sp40.g != 0 || sp40.b != 0) { + stage_pure_lightvec_info_class* stage_light_info_p; + if (param_1 != NULL && param_1->room_no >= 0) { + stage_light_info_p = dComIfGp_roomControl_getStatusRoomDt(param_1->room_no) + ->mRoomDt.getLightVecInfo(); + sp3C = dComIfGp_roomControl_getStatusRoomDt(param_1->room_no) + ->mRoomDt.getLightVecInfoNum(); + } else { + s32 room_no = dComIfGp_roomControl_getStayNo(); // fakematch, fixes instruction order + stage_light_info_p = dComIfGp_roomControl_getStatusRoomDt(room_no)->mRoomDt.getLightVecInfo(); + room_no = dComIfGp_roomControl_getStayNo(); // fakematch, fixes instruction order + sp3C = dComIfGp_roomControl_getStatusRoomDt(room_no)->mRoomDt.getLightVecInfoNum(); + } + + f32 var_f27; + f32 var_f26; + if (stage_light_info_p != 0) { + if (i < sp3C) { + sp64.x = stage_light_info_p[i].position.x; + sp64.y = stage_light_info_p[i].position.y; + sp64.z = stage_light_info_p[i].position.z; + + if (param_1 != NULL && param_1->room_no >= 0) { + room_no = param_1->room_no; + } else { + room_no = dComIfGp_roomControl_getStayNo(); + } + + if (dKy_lightswitch_check(&stage_light_info_p[i], room_no) == TRUE) { + var_f27 = 190.0f * stage_light_info_p[i].radius; + } else { + var_f27 = 0.0f; + } + } else { + sp64.x = lightStatusPt[i + 2].position.x; + sp64.y = lightStatusPt[i + 2].position.y; + sp64.z = lightStatusPt[i + 2].position.z; + var_f27 = 190.0f * lightStatusPt[i + 2].mRefDist; + } + } else { + sp64.x = 100000000.0f; + sp64.y = 100000000.0f; + sp64.z = 100000000.0f; + var_f27 = 0.0f; + } + + var_f31 = param_0->abs(sp64); + if (var_f31 <= 0.0f) { + var_f31 = 0.0000000000001f; + } + + if (var_f27 > 0.0f) { + var_f26 = var_f27 / var_f31; + } else { + var_f26 = 0.0f; + } + + if (var_f26 < 1.0f) { + sp40.r *= var_f26; + sp40.g *= var_f26; + sp40.b *= var_f26; + } else { + var_f31 = 5.0f; + } + } + + if (sp58[0] > var_f31) { + sp58[2] = sp58[1]; + sp58[1] = sp58[0]; + sp58[0] = var_f31; + sp70[2] = sp70[1]; + sp70[1] = sp70[0]; + sp70[0] = sp40; + } else if (sp58[1] > var_f31) { + sp58[2] = sp58[1]; + sp58[1] = var_f31; + sp70[2] = sp70[1]; + sp70[1] = sp40; + } else if (sp58[2] > var_f31) { + sp58[2] = var_f31; + sp70[2] = sp40; + } + } + + sp48.r = 0; + sp48.g = 0; + sp48.b = 0; + + for (int i = 0; i < 3; i++) { + if (sp58[i] < 100000000.0f) { + spD++; + } + } + + static f32 parcent_tabel[][3] = { + {0.0f, 0.0f, 0.0f}, + {1.0f, 0.0f, 0.0f}, + {0.7f, 0.3f, 0.0f}, + {0.6f, 0.3f, 0.1f}, + }; + + if (sp58[0] < 100000000.0f) { + f32 temp_f28 = parcent_tabel[spD][0]; + sp48.r = sp70[0].r * temp_f28; + sp48.g = sp70[0].g * temp_f28; + sp48.b = sp70[0].b * temp_f28; + } + + for (int i = 1; i < 3; i++) { + if (sp58[i] < 100000000.0f) { + f32 temp_f28 = parcent_tabel[spD][i]; + sp48.r += (s16)(sp70[i].r * temp_f28); + sp48.g += (s16)(sp70[i].g * temp_f28); + sp48.b += (s16)(sp70[i].b * temp_f28); + } + } + + *param_3 = NewAmbColGet(&sp48); + + sp48.r = (0.8f * param_2->r) + (1.2f * param_3->r); + sp48.g = (0.8f * param_2->g) + (1.2f * param_3->g); + sp48.b = (0.8f * param_2->b) + (1.2f * param_3->b); + + if (sp48.r > 0xFF) { + f32 temp_f30 = 255.0f / sp48.r; + sp48.r *= temp_f30; + sp48.g *= temp_f30; + sp48.b *= temp_f30; + } + + if (sp48.g > 0xFF) { + f32 temp_f30 = 255.0f / sp48.g; + sp48.r *= temp_f30; + sp48.g *= temp_f30; + sp48.b *= temp_f30; + } + + if (sp48.b > 0xFF) { + f32 temp_f30 = 255.0f / sp48.b; + sp48.r *= temp_f30; + sp48.g *= temp_f30; + sp48.b *= temp_f30; + } + + GXColorS10 sp50; + sp50.r = sp48.r & 0xFF; + sp50.g = sp48.g & 0xFF; + sp50.b = sp48.b & 0xFF; + + f32 sp20 = param_4->r / 255.0f; + f32 sp1C = param_4->g / 255.0f; + f32 sp18 = param_4->b / 255.0f; + + param_2->r = (sp20 * (sp50.r * (1.0f - param_6))) + (param_4->r * param_6); + param_2->g = (sp1C * (sp50.g * (1.0f - param_6))) + (param_4->g * param_6); + param_2->b = (sp18 * (sp50.b * (1.0f - param_6))) + (param_4->b * param_6); + + sp20 = (param_5->r / 255.0f); + sp1C = (param_5->g / 255.0f); + sp18 = (param_5->b / 255.0f); + + param_3->r = (sp20 * (sp50.r * (1.0f - param_6))) + (param_5->r * param_6); + param_3->g = (sp1C * (sp50.g * (1.0f - param_6))) + (param_5->g * param_6); + param_3->b = (sp18 * (sp50.b * (1.0f - param_6))) + (param_5->b * param_6); } /* 801A9BE4-801A9CBC 1A4524 00D8+00 0/0 3/3 0/0 .text * dKy_ParticleColor_get_actor__FP4cXyzP12dKy_tevstr_cP8_GXColorP8_GXColorP8_GXColorP8_GXColorf */ -void dKy_ParticleColor_get_actor(cXyz* param_0, dKy_tevstr_c* param_1, _GXColor* param_2, - _GXColor* param_3, _GXColor* param_4, _GXColor* param_5, +void dKy_ParticleColor_get_actor(cXyz* param_0, dKy_tevstr_c* tevstr_p, GXColor* param_2, + GXColor* param_3, GXColor* param_4, GXColor* param_5, f32 param_6) { - if (param_1 != NULL) { - *param_2 = NewAmbColGet(¶m_1->mColorC0); + if (tevstr_p != NULL) { + *param_2 = NewAmbColGet(&tevstr_p->AmbCol); } else { - *param_2 = NewAmbColGet(&g_env_light.mActorAmbience); + *param_2 = NewAmbColGet(&g_env_light.actor_amb_col); } - dKy_ParticleColor_get_base(param_0, param_1, param_2, param_3, param_4, param_5, param_6); + dKy_ParticleColor_get_base(param_0, tevstr_p, param_2, param_3, param_4, param_5, param_6); } /* 801A9CBC-801A9D60 1A45FC 00A4+00 0/0 6/6 0/0 .text * dKy_ParticleColor_get_bg__FP4cXyzP12dKy_tevstr_cP8_GXColorP8_GXColorP8_GXColorP8_GXColorf */ -void dKy_ParticleColor_get_bg(cXyz* param_0, dKy_tevstr_c* param_1, _GXColor* param_2, - _GXColor* param_3, _GXColor* param_4, _GXColor* param_5, - f32 param_6) { - *param_2 = NewAmbColGet(&g_env_light.mTerrainAmbienceBG[0]); - dKy_ParticleColor_get_base(param_0, param_1, param_2, param_3, param_4, param_5, param_6); +void dKy_ParticleColor_get_bg(cXyz* param_0, dKy_tevstr_c* tevstr_p, GXColor* param_2, + GXColor* param_3, GXColor* param_4, GXColor* param_5, f32 param_6) { + *param_2 = NewAmbColGet(&g_env_light.bg_amb_col[0]); + dKy_ParticleColor_get_base(param_0, tevstr_p, param_2, param_3, param_4, param_5, param_6); } -/* ############################################################################################## */ -/* 80394C6C-80394C6C 0212CC 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80394EB5 = "F_SP118"; -#pragma pop - /* 801A9D60-801AA664 1A46A0 0904+00 1/1 0/0 17/17 .text dKy_BossLight_set__FP4cXyzP8_GXColorfUc */ -void dKy_BossLight_set(cXyz* param_0, _GXColor* param_1, f32 param_2, u8 param_3) { - // NONMATCHING +int dKy_BossLight_set(cXyz* pos_p, GXColor* color_p, f32 ref_dist, u8 param_3) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + camera_class* camera = (camera_class*)dComIfGp_getCamera(0); + int sp10 = 0; + f32 var_f31 = 0.0f; + u8 spA = 0xFF; + int stage_light_info_num = 0; + int i; + + if (strcmp(dComIfGp_getStartStageName(), "F_SP118") != 0) { + u8 room_no = dComIfGp_roomControl_getStayNo(); + if (dComIfGp_roomControl_getStatusRoomDt(room_no) == NULL) { + return 0; + } + + stage_light_info_num = dComIfGp_roomControl_getStatusRoomDt(room_no)->mRoomDt.getLightVecInfoNum(); + if (stage_light_info_num < 0 || stage_light_info_num > 6) { + stage_light_info_num = 6; + } + } + + BOSS_LIGHT* boss_light_p; + if (param_3 == 0) { + boss_light_p = kankyo->field_0x0c18; + } else { + boss_light_p = kankyo->field_0x0d58; + } + + for (i = 1; i < 6 - stage_light_info_num; i++) { + if (boss_light_p[i].field_0x26 == 1 && pos_p->x == boss_light_p[i].mPos.x && + pos_p->y == boss_light_p[i].mPos.y && pos_p->z == boss_light_p[i].mPos.z) + { + return 0; + } + } + + for (i = 1; i < 6 - stage_light_info_num; i++) { + if (boss_light_p[i].field_0x26 == 0) { + boss_light_p[i].mPos = *pos_p; + boss_light_p[i].mColor.r = color_p->r; + boss_light_p[i].mColor.g = color_p->g; + boss_light_p[i].mColor.b = color_p->b; + boss_light_p[i].mColor.a = 0xFF; + boss_light_p[i].mRefDistance = ref_dist; + boss_light_p[i].field_0x14 = 0.99f; + boss_light_p[i].mCutoffAngle = 90.0f; + boss_light_p[i].mAngleX = 0.0f; + boss_light_p[i].mAngleY = 0.0f; + boss_light_p[i].mAngleAttenuation = GX_SP_OFF; + boss_light_p[i].mDistAttenuation = GX_DA_STEEP; + boss_light_p[i].field_0x26 = 1; + sp10 = 1; + break; + } + } + + for (i = 1; i < 6 - stage_light_info_num; i++) { + if (boss_light_p[i].field_0x26 != 0) { + cXyz sp1C(boss_light_p[i].mPos); + + if (strcmp(dComIfGp_getStartStageName(), "D_SB03") == 0) { + sp1C.x = camera->lookat.eye.x; + sp1C.z = camera->lookat.eye.z; + + if (sp1C.abs(camera->lookat.eye) > 2000.0f) { + var_f31 = 99999.9f; + spA = i; + break; + } else { + if (boss_light_p[i].mPos.abs(camera->lookat.eye) > var_f31) { + var_f31 = boss_light_p[i].mPos.abs(camera->lookat.eye); + spA = i; + } + } + } else { + if (boss_light_p[i].mPos.abs(camera->lookat.eye) > var_f31) { + var_f31 = boss_light_p[i].mPos.abs(camera->lookat.eye); + spA = i; + } + } + } + } + + if (sp10 == 0 && spA != 0xFF) { + i = spA; + if (i < 6 && pos_p->abs(camera->lookat.eye) < var_f31) { + boss_light_p[i].mPos = *pos_p; + boss_light_p[i].mColor.r = color_p->r; + boss_light_p[i].mColor.g = color_p->g; + boss_light_p[i].mColor.b = color_p->b; + boss_light_p[i].mColor.a = 0xFF; + boss_light_p[i].mRefDistance = ref_dist; + boss_light_p[i].field_0x14 = 0.99f; + boss_light_p[i].mCutoffAngle = 90.0f; + boss_light_p[i].mAngleX = 0.0f; + boss_light_p[i].mAngleY = 0.0f; + boss_light_p[i].mAngleAttenuation = GX_SP_OFF; + boss_light_p[i].mDistAttenuation = GX_DA_STEEP; + boss_light_p[i].field_0x26 = 1; + sp10 = 1; + } + } + + return sp10; } /* 801AA664-801AAC5C 1A4FA4 05F8+00 0/0 0/0 3/3 .text * dKy_BossSpotLight_set__FP4cXyzfffP8_GXColorfUcUc */ -void dKy_BossSpotLight_set(cXyz* param_0, f32 param_1, f32 param_2, f32 param_3, - _GXColor* param_4, f32 param_5, u8 param_6, u8 param_7) { - // NONMATCHING +int dKy_BossSpotLight_set(cXyz* pos_p, f32 angle_x, f32 angle_y, f32 cutoff, GXColor* color_p, + f32 ref_dist, u8 spot_type, u8 distattn_type) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + camera_class* camera = (camera_class*)dComIfGp_getCamera(0); + int spC = 0; + f32 var_f31 = 0.0f; + u8 sp8 = 0xFF; + int i; + + for (i = 1; i < 6; i++) { + if (kankyo->field_0x0c18[i].field_0x26 == 0) { + kankyo->field_0x0c18[i].mPos = *pos_p; + kankyo->field_0x0c18[i].mColor.r = color_p->r; + kankyo->field_0x0c18[i].mColor.g = color_p->g; + kankyo->field_0x0c18[i].mColor.b = color_p->b; + kankyo->field_0x0c18[i].mColor.a = 0xFF; + kankyo->field_0x0c18[i].mRefDistance = ref_dist; + kankyo->field_0x0c18[i].field_0x14 = 0.99f; + kankyo->field_0x0c18[i].mCutoffAngle = cutoff; + kankyo->field_0x0c18[i].mAngleX = angle_x; + kankyo->field_0x0c18[i].mAngleY = angle_y + 90.0f; + kankyo->field_0x0c18[i].mAngleAttenuation = spot_type; + kankyo->field_0x0c18[i].mDistAttenuation = distattn_type; + kankyo->field_0x0c18[i].field_0x26 = 1; + spC = 1; + break; + } + } + + if (spC == 0) { + for (i = 1; i < 6; i++) { + if (kankyo->field_0x0c18[i].field_0x26 != 0 && + kankyo->field_0x0c18[i].mPos.abs(camera->lookat.eye) > var_f31) + { + var_f31 = kankyo->field_0x0c18[i].mPos.abs(camera->lookat.eye); + sp8 = i; + } + } + + if (sp8 != 0xFF) { + i = sp8; + if (i < 6 && pos_p->abs(camera->lookat.eye) < + kankyo->field_0x0c18[i].mPos.abs(camera->lookat.eye)) + { + kankyo->field_0x0c18[i].mPos = *pos_p; + kankyo->field_0x0c18[i].mColor.r = color_p->r; + kankyo->field_0x0c18[i].mColor.g = color_p->g; + kankyo->field_0x0c18[i].mColor.b = color_p->b; + kankyo->field_0x0c18[i].mColor.a = 0xFF; + kankyo->field_0x0c18[i].mRefDistance = ref_dist; + kankyo->field_0x0c18[i].field_0x14 = 0.99f; + kankyo->field_0x0c18[i].mCutoffAngle = cutoff; + kankyo->field_0x0c18[i].mAngleX = angle_x; + kankyo->field_0x0c18[i].mAngleY = angle_y + 90.0f; + kankyo->field_0x0c18[i].mAngleAttenuation = spot_type; + kankyo->field_0x0c18[i].mDistAttenuation = distattn_type; + kankyo->field_0x0c18[i].field_0x26 = 1; + spC = 1; + } + } + } + + return spC; } -/* ############################################################################################## */ -/* 80453DC8-80453DCC 0023C8 0004+00 1/1 0/0 0/0 .sdata2 @9676 */ -SECTION_SDATA2 static f32 lit_9676 = 350.0f; - -/* 80453DCC-80453DD0 0023CC 0004+00 2/2 0/0 0/0 .sdata2 @9677 */ -SECTION_SDATA2 static f32 lit_9677 = 1.5f; - /* 801AAC5C-801AAD50 1A559C 00F4+00 0/0 1/1 0/0 .text * dKy_WolfEyeLight_set__FP4cXyzfffP8_GXColorfUcUc */ -int dKy_WolfEyeLight_set(cXyz* param_0, f32 param_1, f32 param_2, f32 param_3, GXColor* param_4, - f32 param_5, u8 param_6, u8 param_7) { - dScnKy_env_light_c* light = dKy_getEnvlight(); +int dKy_WolfEyeLight_set(cXyz* pos_p, f32 angle_x, f32 angle_y, f32 cutoff, GXColor* color_p, + f32 ref_dist, u8 spot_type, u8 distattn_type) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); - light->field_0x0c18[0].mPos = *param_0; + kankyo->field_0x0c18[0].mPos = *pos_p; - light->field_0x0c18[0].mColor.r = param_4->r; - light->field_0x0c18[0].mColor.g = param_4->g; - light->field_0x0c18[0].mColor.b = param_4->b; - light->field_0x0c18[0].mColor.a = 255; + kankyo->field_0x0c18[0].mColor.r = color_p->r; + kankyo->field_0x0c18[0].mColor.g = color_p->g; + kankyo->field_0x0c18[0].mColor.b = color_p->b; + kankyo->field_0x0c18[0].mColor.a = 255; - light->field_0x0c18[0].mRefDistance = param_5; - light->field_0x0c18[0].field_0x14 = 0.99f; - light->field_0x0c18[0].mCutoffAngle = param_3; - light->field_0x0c18[0].mAngleX = param_1; - light->field_0x0c18[0].mAngleY = param_2 + 90.0f; - light->field_0x0c18[0].mAngleAttenuation = param_6; - light->field_0x0c18[0].mDistAttenuation = param_7; + kankyo->field_0x0c18[0].mRefDistance = ref_dist; + kankyo->field_0x0c18[0].field_0x14 = 0.99f; + kankyo->field_0x0c18[0].mCutoffAngle = cutoff; + kankyo->field_0x0c18[0].mAngleX = angle_x; + kankyo->field_0x0c18[0].mAngleY = angle_y + 90.0f; + kankyo->field_0x0c18[0].mAngleAttenuation = spot_type; + kankyo->field_0x0c18[0].mDistAttenuation = distattn_type; - f32 fvar0; - f32 fvar1; - f32 fvar2; - switch (light->field_0x1309) { - case 0: - fvar0 = 50.0f; - fvar1 = 1.0f; - fvar2 = 0.9f; + f32 var_f31; + f32 var_f30; + f32 var_f29; + switch (kankyo->light_size) { + case LIGHT_SIZE_S: + var_f31 = 50.0f; + var_f30 = 1.0f; + var_f29 = 0.9f; break; - case 1: - fvar0 = 200.0f; - fvar1 = 1.0f; - fvar2 = fvar1; + case LIGHT_SIZE_M: + var_f31 = 200.0f; + var_f30 = 1.0f; + var_f29 = 1.0f; break; - case 2: - fvar0 = 350.0f; - fvar1 = 1.5f; - fvar2 = fvar1; + case LIGHT_SIZE_L: + var_f31 = 350.0f; + var_f30 = 1.5f; + var_f29 = 1.5f; break; - case 3: + case LIGHT_SIZE_LL: default: - fvar0 = 1500.0f; - fvar1 = 4.0f; - fvar2 = 1.5f; + var_f31 = 1500.0f; + var_f30 = 4.0f; + var_f29 = 1.5f; } - light->field_0x127c = fvar0; - light->field_0x0c18[0].mRefDistance *= fvar1; - light->field_0x0c18[0].mCutoffAngle *= fvar2; - light->field_0x0c18[0].field_0x26 = 1; + kankyo->field_0x127c = var_f31; + kankyo->field_0x0c18[0].mRefDistance *= var_f30; + kankyo->field_0x0c18[0].mCutoffAngle *= var_f29; + kankyo->field_0x0c18[0].field_0x26 = 1; return 1; } - -/* ############################################################################################## */ -/* 80453DD0-80453DD4 0023D0 0004+00 3/3 0/0 0/0 .sdata2 @9722 */ -SECTION_SDATA2 static f32 lit_9722 = 600.0f; - -/* 80453DD4-80453DD8 0023D4 0004+00 1/1 0/0 0/0 .sdata2 @9723 */ -SECTION_SDATA2 static f32 lit_9723 = 1.0625f; - -/* 80453DD8-80453DDC 0023D8 0004+00 1/1 0/0 0/0 .sdata2 @9724 */ -SECTION_SDATA2 static f32 lit_9724 = 17.0f / 10.0f; - -/* 80453DDC-80453DE0 0023DC 0004+00 1/1 0/0 0/0 .sdata2 @9725 */ -SECTION_SDATA2 static f32 lit_9725 = 70.0f; - -/* 80453DE0-80453DE4 0023E0 0004+00 1/1 0/0 0/0 .sdata2 @9726 */ -SECTION_SDATA2 static f32 lit_9726 = 2.5500001907348633f; - -/* 80453DE4-80453DE8 0023E4 0004+00 1/1 0/0 0/0 .sdata2 @9727 */ -SECTION_SDATA2 static f32 lit_9727 = 17.0f / 5.0f; - -/* 80453DE8-80453DEC 0023E8 0004+00 1/1 0/0 0/0 .sdata2 @9728 */ -SECTION_SDATA2 static f32 lit_9728 = 65.0f; - /* 801AAD50-801AB01C 1A5690 02CC+00 1/1 0/0 0/0 .text dKy_twilight_camelight_set__Fv */ -static void dKy_twilight_camelight_set() { - // NONMATCHING +void dKy_twilight_camelight_set() { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + fopAc_ac_c* player_p = dComIfGp_getPlayer(0); + camera_class* camera_p = (camera_class*)dComIfGp_getCamera(0); + u8 sp8 = 0; + + if (strcmp(dComIfGp_getStartStageName(), "R_SP107") != 0 || + dComIfGp_roomControl_getStayNo() != 3 || dComIfGp_getStartStageLayer() != 12) + { + if (!dKy_darkworld_check() || memcmp(dComIfGp_getStartStageName(), "D_MN08", 6) == 0) { + return; + } + + if (!daPy_py_c::checkNowWolfPowerUp()) { + for (int i = 0; i < 6; i++) { + if (kankyo->field_0x0c18[i].field_0x26 != 1) { + dKy_twi_wolflight_set(i); + kankyo->field_0x0c18[i].field_0x14 = 0.99f; + kankyo->field_0x0c18[i].mColor.a = 254; + + f32 var_f31 = 0.0f; + if (player_p != NULL) { + f32 var_f30 = camera_p->lookat.eye.y - player_p->current.pos.y; + if (var_f30 < 0.0f) { + var_f30 = 0.0f; + } + if (var_f30 > 600.0f) { + var_f30 = 600.0f; + } + var_f31 = var_f30 / 450.0f; + } + + switch (g_env_light.light_size) { + case LIGHT_SIZE_S: + kankyo->field_0x0c18[i].mColor.r = 0x19; + kankyo->field_0x0c18[i].mColor.g = 0x5A; + kankyo->field_0x0c18[i].mColor.b = 0xB7; + cLib_addCalc(&kankyo->field_0x0c18[i].mRefDistance, + 1.0625f + (0.75f * var_f31), 0.2f, 10.0f, 0.0001f); + kankyo->field_0x0c18[i].mCutoffAngle = 90.0f; + break; + case LIGHT_SIZE_M: + kankyo->field_0x0c18[i].mColor.r = 0x48; + kankyo->field_0x0c18[i].mColor.g = 0x87; + kankyo->field_0x0c18[i].mColor.b = 0xCE; + cLib_addCalc(&kankyo->field_0x0c18[i].mRefDistance, + 1.7f + (0.75f * var_f31), 0.2f, 10.0f, 0.0001f); + kankyo->field_0x0c18[i].mCutoffAngle = 70.0f; + break; + case LIGHT_SIZE_L: + kankyo->field_0x0c18[i].mColor.r = 0x48; + kankyo->field_0x0c18[i].mColor.g = 0x87; + kankyo->field_0x0c18[i].mColor.b = 0xCE; + cLib_addCalc(&kankyo->field_0x0c18[i].mRefDistance, + 2.5500002f + (0.75f * var_f31), 0.2f, 10.0f, 0.0001f); + kankyo->field_0x0c18[i].mCutoffAngle = 70.0f; + break; + case LIGHT_SIZE_LL: + kankyo->field_0x0c18[i].mColor.r = 0x50; + kankyo->field_0x0c18[i].mColor.g = 0x87; + kankyo->field_0x0c18[i].mColor.b = 0xCE; + cLib_addCalc(&kankyo->field_0x0c18[i].mRefDistance, + 3.4f + (0.75f * var_f31), 0.2f, 10.0f, 0.0001f); + kankyo->field_0x0c18[i].mCutoffAngle = 65.0f; + break; + } + + kankyo->field_0x0c18[i].mAngleAttenuation = GX_SP_COS; + kankyo->field_0x0c18[i].mDistAttenuation = GX_DA_STEEP; + kankyo->field_0x0c18[i].field_0x26 = 1; + break; + } + } + } + } } -/* ############################################################################################## */ -/* 80394C6C-80394C6C 0212CC 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80394EBD = "F_SP109"; -SECTION_DEAD static char const* const stringBase_80394EC5 = "F_SP122"; -#pragma pop - -/* 80453DEC-80453DF0 0023EC 0004+00 1/1 0/0 0/0 .sdata2 @9779 */ -SECTION_SDATA2 static f32 lit_9779 = 7.225000381469727f; - -/* 80453DF0-80453DF4 0023F0 0004+00 1/1 0/0 0/0 .sdata2 @9780 */ -SECTION_SDATA2 static f32 lit_9780 = 28.0f; - -/* 80453DF4-80453DF8 0023F4 0004+00 1/1 0/0 0/0 .sdata2 @9781 */ -SECTION_SDATA2 static f32 lit_9781 = 1.25f; - /* 801AB01C-801AB270 1A595C 0254+00 1/1 0/0 0/0 .text dKy_WaterIn_Light_set__Fv */ -static void dKy_WaterIn_Light_set() { - // NONMATCHING +// NONMATCHING - some weirdness with temp stores +void dKy_WaterIn_Light_set() { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + fopAc_ac_c* player_p = dComIfGp_getPlayer(0); + camera_class* camera = (camera_class*)dComIfGp_getCamera(0); + + int sp10 = 0; + int spC = 0; + + int sp8 = 1; + if (strcmp(dComIfGp_getStartStageName(), "F_SP109") == 0 || + strcmp(dComIfGp_getStartStageName(), "F_SP115") == 0 || + strcmp(dComIfGp_getStartStageName(), "F_SP122") == 0) + { + sp8 = 3; + } + + for (int i = 0; i < 6; i++) { + if (kankyo->field_0x0c18[i].field_0x26 != 1) { + dKy_twi_wolflight_set(i); + kankyo->field_0x0c18[i].mColor.r = 0x8A; + kankyo->field_0x0c18[i].mColor.g = 0xC0; + kankyo->field_0x0c18[i].mColor.b = 0xBC; + kankyo->field_0x0c18[i].mColor.a = 0xFD; + + f32 var_f26 = 0.0f; + if (player_p != NULL) { + f32 var_f31 = camera->lookat.eye.y - player_p->current.pos.y; + if (var_f31 < 0.0f) { + var_f31 = 0.0f; + } + if (var_f31 > 600.0f) { + var_f31 = 600.0f; + } + var_f26 = var_f31 / 450.0f; + } + + kankyo->field_0x0c18[i].mRefDistance = 7.2250004f + (0.75f * var_f26); + kankyo->field_0x0c18[i].mCutoffAngle = 28.0f; + kankyo->field_0x0c18[i].mAngleAttenuation = 2; + kankyo->field_0x0c18[i].mDistAttenuation = 3; + + f32* var_r30 = &kankyo->field_0x0c18[i].mRefDistance; + f32* var_r29 = &kankyo->field_0x0c18[i].mCutoffAngle; + + if (strcmp(dComIfGp_getStartStageName(), "D_MN01A") == 0) { + dBgS_CamGndChk_Wtr sp28; + cXyz sp1C; + sp8 = 1; + *var_r29 = 60.0f; + + sp1C = camera->lookat.eye; + sp1C.y += 100000.0f; + sp28.SetPos(&sp1C); + + f32 var_f30 = (dComIfG_Bgsp().GroundCross(&sp28) - camera->lookat.eye.y) / 3000.0f; + if (var_f30 < 0.0f) { + var_f30 = 0.0f; + } + if (var_f30 > 1.0f) { + var_f30 = 1.0f; + } + *var_r30 *= var_f30; + } + + f32 var_f29, var_f28, var_f27; + switch (sp8) { + case 0: + case 1: + var_f29 = 200.0f; + var_f28 = 1.0f; + var_f27 = 1.0f; + break; + case 2: + case 3: + case 4: + default: + var_f29 = 200.0f; + var_f28 = 2.0f; + var_f27 = 1.25f; + break; + } + + kankyo->field_0x127c = var_f29; + *var_r30 *= var_f28; + *var_r29 *= var_f27; + kankyo->field_0x0c18[i].field_0x26 = 1; + sp10 = 1; + } + break; + } } /* 801AB270-801AB280 1A5BB0 0010+00 0/0 2/2 0/0 .text dKy_camera_water_in_status_set__FUc */ void dKy_camera_water_in_status_set(u8 status) { - g_env_light.mCameraInWater = status; + g_env_light.camera_water_in_status = status; } /* 801AB280-801AB290 1A5BC0 0010+00 3/3 1/1 5/5 .text dKy_camera_water_in_status_check__Fv */ BOOL dKy_camera_water_in_status_check() { - return g_env_light.mCameraInWater; + return g_env_light.camera_water_in_status; } -/* ############################################################################################## */ -/* 80394C6C-80394C6C 0212CC 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80394ECD = "D_MN05A"; -#pragma pop - /* 801AB290-801AB3A8 1A5BD0 0118+00 0/0 5/5 0/0 .text dKy_pol_efftype_get__FPC13cBgS_PolyInfo */ -u8 dKy_pol_efftype_get(cBgS_PolyInfo const* param_0) { - // NONMATCHING +u8 dKy_pol_efftype_get(const cBgS_PolyInfo* polyinfo_p) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) { + return 0xFF; + } + + int z0 = dComIfG_Bgsp().GetPolyAtt0(*polyinfo_p); + if (strcmp(dComIfGp_getStartStageName(), "F_SP127") == 0 && + g_env_light.fishing_hole_season == 4) + { + if (z0 == 4) { + z0 = 13; + } + } else if (strcmp(dComIfGp_getStartStageName(), "D_MN05A") == 0 && + dComIfGs_isStageBossEnemy() && z0 == 11) + { + z0 = 7; + } + + u8 efftype; + int z1 = dComIfG_Bgsp().GetPolyAtt1(*polyinfo_p); + if (kankyo->pol_efftbl != 0) { + efftype = kankyo->pol_efftbl[z0].data[z1]; + } else { + efftype = 0xFF; + } + + return efftype; } /* 801AB3A8-801AB4C0 1A5CE8 0118+00 0/0 2/2 0/0 .text dKy_pol_efftype2_get__FPC13cBgS_PolyInfo */ -u8 dKy_pol_efftype2_get(cBgS_PolyInfo const* param_0) { - // NONMATCHING +u8 dKy_pol_efftype2_get(const cBgS_PolyInfo* polyinfo_p) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) { + return 0xFF; + } + + int z0 = dComIfG_Bgsp().GetPolyAtt0(*polyinfo_p); + if (strcmp(dComIfGp_getStartStageName(), "F_SP127") == 0 && + g_env_light.fishing_hole_season == 4) + { + if (z0 == 4) { + z0 = 13; + } + } else if (strcmp(dComIfGp_getStartStageName(), "D_MN05A") == 0 && + dComIfGs_isStageBossEnemy() && z0 == 11) + { + z0 = 7; + } + + u8 efftype; + int z1 = dComIfG_Bgsp().GetPolyAtt1(*polyinfo_p); + if (kankyo->pol_efftbl2 != 0) { + efftype = kankyo->pol_efftbl2[z0].data[z1]; + } else { + efftype = 0xFF; + } + + return efftype; } /* 801AB4C0-801AB59C 1A5E00 00DC+00 0/0 9/9 21/21 .text dKy_pol_sound_get__FPC13cBgS_PolyInfo */ -u8 dKy_pol_sound_get(cBgS_PolyInfo const* p_poly) { - dScnKy_env_light_c* envLight = dKy_getEnvlight(); - - if (p_poly == NULL || &dComIfG_Bgsp() == NULL) { +u8 dKy_pol_sound_get(const cBgS_PolyInfo* polyinfo_p) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) { return 0; } - int att0 = dComIfG_Bgsp().GetPolyAtt0(*p_poly); - if (!strcmp(dComIfGp_getStartStageName(), "F_SP127") && g_env_light.mPondSeason == 4 && - att0 == 4) + int z0 = dComIfG_Bgsp().GetPolyAtt0(*polyinfo_p); + if (!strcmp(dComIfGp_getStartStageName(), "F_SP127") && g_env_light.fishing_hole_season == 4 && + z0 == 4) { - att0 = 13; + z0 = 13; } - int att1 = dComIfG_Bgsp().GetPolyAtt1(*p_poly); - u8 uvar3; - if (envLight->mResPolSound != NULL) { - uvar3 = envLight->mResPolSound[att0].data[att1]; + u8 sound; + int z1 = dComIfG_Bgsp().GetPolyAtt1(*polyinfo_p); + if (kankyo->pol_sound != NULL) { + sound = kankyo->pol_sound[z0].data[z1]; } else { - uvar3 = 0; + sound = 0; } - if (uvar3 == 0xFF) { - uvar3 = 0; + if (sound == 0xFF) { + sound = 0; } - return uvar3; + return sound; } /* 801AB59C-801AB668 1A5EDC 00CC+00 0/0 5/5 0/0 .text dKy_pol_argument_get__FPC13cBgS_PolyInfo */ -u8 dKy_pol_argument_get(cBgS_PolyInfo const* p_poly) { - dScnKy_env_light_c* envLight = &g_env_light; - - if (p_poly == NULL || &dComIfG_Bgsp() == NULL) { +u8 dKy_pol_argument_get(const cBgS_PolyInfo* polyinfo_p) { + dScnKy_env_light_c* kankyo = &g_env_light; + if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) { return 0; } - int att0 = dComIfG_Bgsp().GetPolyAtt0(*p_poly); - if (!strcmp(dComIfGp_getStartStageName(), "F_SP127") && g_env_light.mPondSeason == 4 && - att0 == 4) + int z0 = dComIfG_Bgsp().GetPolyAtt0(*polyinfo_p); + if (!strcmp(dComIfGp_getStartStageName(), "F_SP127") && g_env_light.fishing_hole_season == 4 && + z0 == 4) { - att0 = 13; + z0 = 13; } - int att1 = dComIfG_Bgsp().GetPolyAtt1(*p_poly); - if (envLight->mResPolArg != NULL) { - return envLight->mResPolArg[att0].data[att1]; + int z1 = dComIfG_Bgsp().GetPolyAtt1(*polyinfo_p); + if (kankyo->pol_arg != NULL) { + return kankyo->pol_arg[z0].data[z1]; } return 0; @@ -4316,89 +6168,324 @@ u8 dKy_pol_argument_get(cBgS_PolyInfo const* p_poly) { /* 801AB668-801AB7D0 1A5FA8 0168+00 0/0 1/1 2/2 .text * dKy_pol_eff_prim_get__FPC13cBgS_PolyInfoP8_GXColor */ -u8 dKy_pol_eff_prim_get(cBgS_PolyInfo const* param_0, _GXColor* param_1) { - // NONMATCHING -} - -/* u8 dKy_pol_eff_prim_get(cBgS_PolyInfo const* p_poly, GXColor* p_color) { - dScnKy_env_light_c* envLight = &g_env_light; - - if (p_poly == NULL || p_color == NULL || &dComIfG_Bgsp() == NULL) { +u8 dKy_pol_eff_prim_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p) { + dScnKy_env_light_c* kankyo = &g_env_light; + if (polyinfo_p == NULL || out_color_p == NULL || &dComIfG_Bgsp() == NULL) { return 0xFF; } - int att0 = dComIfG_Bgsp().GetPolyAtt0(*p_poly); - if (!strcmp(dComIfGp_getStartStageName(), "F_SP127") && g_env_light.mPondSeason == 4 && att0 == -4) { att0 = 13; } else if (!strcmp(dComIfGp_getStartStageName(), "D_MN05A") && -dComIfGs_isStageBossEnemy() && att0 == 11) { att0 = 7; - } - - int att1 = dComIfG_Bgsp().GetPolyAtt1(*p_poly); - if (envLight->mResPolEffcol == NULL || ) { - u32 index = envLight->mResPolEffcol[att0].data[att1]; - - if (index >= 100) { - return 0xFF; + int z0 = dComIfG_Bgsp().GetPolyAtt0(*polyinfo_p); + if (strcmp(dComIfGp_getStartStageName(), "F_SP127") == 0 && + g_env_light.fishing_hole_season == 4) + { + if (z0 == 4) { + z0 = 13; } - - p_color->r = envLight->mResColorDataTbl[index].data[0]; - p_color->g = envLight->mResColorDataTbl[index].data[1]; - p_color->b = envLight->mResColorDataTbl[index].data[2]; + } else if (strcmp(dComIfGp_getStartStageName(), "D_MN05A") == 0 && + dComIfGs_isStageBossEnemy() && z0 == 11) + { + z0 = 7; } -} */ + + int z1 = dComIfG_Bgsp().GetPolyAtt1(*polyinfo_p); + u8 eff_id; + if (kankyo->pol_effcol != NULL) { + eff_id = kankyo->pol_effcol[z0].data[z1]; + } else { + return 0xFF; + } + + if (eff_id >= 100) { + return 0xFF; + } + + out_color_p->r = kankyo->colordata_tbl[eff_id].data[0]; + out_color_p->g = kankyo->colordata_tbl[eff_id].data[1]; + out_color_p->b = kankyo->colordata_tbl[eff_id].data[2]; + return eff_id; +} /* 801AB7D0-801AB93C 1A6110 016C+00 0/0 1/1 2/2 .text * dKy_pol_eff_env_get__FPC13cBgS_PolyInfoP8_GXColor */ -void dKy_pol_eff_env_get(cBgS_PolyInfo const* param_0, _GXColor* param_1) { - // NONMATCHING +u8 dKy_pol_eff_env_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p) { + dScnKy_env_light_c* kankyo = &g_env_light; + if (polyinfo_p == NULL || out_color_p == NULL || &dComIfG_Bgsp() == NULL) { + return 0xFF; + } + + int z0 = dComIfG_Bgsp().GetPolyAtt0(*polyinfo_p); + if (strcmp(dComIfGp_getStartStageName(), "F_SP127") == 0 && + g_env_light.fishing_hole_season == 4) + { + if (z0 == 4) { + z0 = 13; + } + } else if (strcmp(dComIfGp_getStartStageName(), "D_MN05A") == 0 && + dComIfGs_isStageBossEnemy() && z0 == 11) + { + z0 = 7; + } + + int z1 = dComIfG_Bgsp().GetPolyAtt1(*polyinfo_p); + u8 eff_id; + if (kankyo->pol_effcol != NULL) { + eff_id = kankyo->pol_effcol[z0].data[z1]; + } else { + return 0xFF; + } + + if (eff_id >= 100) { + return 0xFF; + } + + out_color_p->r = kankyo->colordata_tbl[eff_id].data[3]; + out_color_p->g = kankyo->colordata_tbl[eff_id].data[4]; + out_color_p->b = kankyo->colordata_tbl[eff_id].data[5]; + return eff_id; } /* 801AB93C-801ABAA4 1A627C 0168+00 0/0 1/1 2/2 .text * dKy_pol_eff2_prim_get__FPC13cBgS_PolyInfoP8_GXColor */ -void dKy_pol_eff2_prim_get(cBgS_PolyInfo const* param_0, _GXColor* param_1) { - // NONMATCHING +u8 dKy_pol_eff2_prim_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p) { + dScnKy_env_light_c* kankyo = &g_env_light; + if (polyinfo_p == NULL || out_color_p == NULL || &dComIfG_Bgsp() == NULL) { + return 0xFF; + } + + int z0 = dComIfG_Bgsp().GetPolyAtt0(*polyinfo_p); + if (strcmp(dComIfGp_getStartStageName(), "F_SP127") == 0 && + g_env_light.fishing_hole_season == 4) + { + if (z0 == 4) { + z0 = 13; + } + } else if (strcmp(dComIfGp_getStartStageName(), "D_MN05A") == 0 && + dComIfGs_isStageBossEnemy() && z0 == 11) + { + z0 = 7; + } + + int z1 = dComIfG_Bgsp().GetPolyAtt1(*polyinfo_p); + u8 eff_id; + if (kankyo->pol_effcol2 != NULL) { + eff_id = kankyo->pol_effcol2[z0].data[z1]; + } else { + return 0xFF; + } + + if (eff_id >= 100) { + return 0xFF; + } + + out_color_p->r = kankyo->colordata_tbl[eff_id].data[0]; + out_color_p->g = kankyo->colordata_tbl[eff_id].data[1]; + out_color_p->b = kankyo->colordata_tbl[eff_id].data[2]; + return eff_id; } /* 801ABAA4-801ABC10 1A63E4 016C+00 0/0 1/1 2/2 .text * dKy_pol_eff2_env_get__FPC13cBgS_PolyInfoP8_GXColor */ -void dKy_pol_eff2_env_get(cBgS_PolyInfo const* param_0, _GXColor* param_1) { - // NONMATCHING +u8 dKy_pol_eff2_env_get(const cBgS_PolyInfo* polyinfo_p, GXColor* out_color_p) { + dScnKy_env_light_c* kankyo = &g_env_light; + if (polyinfo_p == NULL || out_color_p == NULL || &dComIfG_Bgsp() == NULL) { + return 0xFF; + } + + int z0 = dComIfG_Bgsp().GetPolyAtt0(*polyinfo_p); + if (strcmp(dComIfGp_getStartStageName(), "F_SP127") == 0 && + g_env_light.fishing_hole_season == 4) + { + if (z0 == 4) { + z0 = 13; + } + } else if (strcmp(dComIfGp_getStartStageName(), "D_MN05A") == 0 && + dComIfGs_isStageBossEnemy() && z0 == 11) + { + z0 = 7; + } + + int z1 = dComIfG_Bgsp().GetPolyAtt1(*polyinfo_p); + u8 eff_id; + if (kankyo->pol_effcol2 != NULL) { + eff_id = kankyo->pol_effcol2[z0].data[z1]; + } else { + return 0xFF; + } + + if (eff_id >= 100) { + return 0xFF; + } + + out_color_p->r = kankyo->colordata_tbl[eff_id].data[3]; + out_color_p->g = kankyo->colordata_tbl[eff_id].data[4]; + out_color_p->b = kankyo->colordata_tbl[eff_id].data[5]; + return eff_id; } /* 801ABC10-801ABD4C 1A6550 013C+00 0/0 1/1 2/2 .text dKy_pol_eff_alpha_get__FPC13cBgS_PolyInfo */ -u8 dKy_pol_eff_alpha_get(cBgS_PolyInfo const* param_0) { - // NONMATCHING +u8 dKy_pol_eff_alpha_get(const cBgS_PolyInfo* polyinfo_p) { + dScnKy_env_light_c* kankyo = &g_env_light; + if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) { + return 0xFF; + } + + int z0 = dComIfG_Bgsp().GetPolyAtt0(*polyinfo_p); + if (strcmp(dComIfGp_getStartStageName(), "F_SP127") == 0 && + g_env_light.fishing_hole_season == 4) + { + if (z0 == 4) { + z0 = 13; + } + } else if (strcmp(dComIfGp_getStartStageName(), "D_MN05A") == 0 && + dComIfGs_isStageBossEnemy() && z0 == 11) + { + z0 = 7; + } + + int z1 = dComIfG_Bgsp().GetPolyAtt1(*polyinfo_p); + u8 eff_id; + if (kankyo->pol_effcol != NULL) { + eff_id = kankyo->pol_effcol[z0].data[z1]; + } else { + return 0xFF; + } + + if (eff_id >= 100) { + return 0xFF; + } + + eff_id = kankyo->colordata_tbl[eff_id].data[6]; + return eff_id; } /* 801ABD4C-801ABEA8 1A668C 015C+00 0/0 1/1 2/2 .text dKy_pol_eff_ratio_get__FPC13cBgS_PolyInfo */ -f32 dKy_pol_eff_ratio_get(cBgS_PolyInfo const* param_0) { - // NONMATCHING +f32 dKy_pol_eff_ratio_get(const cBgS_PolyInfo* polyinfo_p) { + dScnKy_env_light_c* kankyo = &g_env_light; + f32 ratio = 0.0f; + + if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) { + return 0.0f; + } + + int z0 = dComIfG_Bgsp().GetPolyAtt0(*polyinfo_p); + if (strcmp(dComIfGp_getStartStageName(), "F_SP127") == 0 && + g_env_light.fishing_hole_season == 4) + { + if (z0 == 4) { + z0 = 13; + } + } else if (strcmp(dComIfGp_getStartStageName(), "D_MN05A") == 0 && + dComIfGs_isStageBossEnemy() && z0 == 11) + { + z0 = 7; + } + + int z1 = dComIfG_Bgsp().GetPolyAtt1(*polyinfo_p); + u8 eff_id; + if (kankyo->pol_effcol != NULL) { + eff_id = kankyo->pol_effcol[z0].data[z1]; + } else { + return ratio; + } + + if (eff_id >= 100) { + return ratio; + } + + ratio = (f32)kankyo->colordata_tbl[eff_id].data[7]; + ratio = 0.01f * ratio; + return ratio; } /* 801ABEA8-801ABFE4 1A67E8 013C+00 0/0 1/1 2/2 .text dKy_pol_eff2_alpha_get__FPC13cBgS_PolyInfo */ -u8 dKy_pol_eff2_alpha_get(cBgS_PolyInfo const* param_0) { - // NONMATCHING +u8 dKy_pol_eff2_alpha_get(const cBgS_PolyInfo* polyinfo_p) { + dScnKy_env_light_c* kankyo = &g_env_light; + if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) { + return 0xFF; + } + + int z0 = dComIfG_Bgsp().GetPolyAtt0(*polyinfo_p); + if (strcmp(dComIfGp_getStartStageName(), "F_SP127") == 0 && + g_env_light.fishing_hole_season == 4) + { + if (z0 == 4) { + z0 = 13; + } + } else if (strcmp(dComIfGp_getStartStageName(), "D_MN05A") == 0 && + dComIfGs_isStageBossEnemy() && z0 == 11) + { + z0 = 7; + } + + int z1 = dComIfG_Bgsp().GetPolyAtt1(*polyinfo_p); + u8 var_r30; + if (kankyo->pol_effcol2 != NULL) { + var_r30 = kankyo->pol_effcol2[z0].data[z1]; + } else { + return 0xFF; + } + + if (var_r30 >= 100) { + return 0xFF; + } + + var_r30 = kankyo->colordata_tbl[var_r30].data[6]; + return var_r30; } /* 801ABFE4-801AC140 1A6924 015C+00 0/0 1/1 2/2 .text dKy_pol_eff2_ratio_get__FPC13cBgS_PolyInfo */ -f32 dKy_pol_eff2_ratio_get(cBgS_PolyInfo const* param_0) { - // NONMATCHING +f32 dKy_pol_eff2_ratio_get(const cBgS_PolyInfo* polyinfo_p) { + dScnKy_env_light_c* kankyo = &g_env_light; + f32 ratio = 0.0f; + + if (polyinfo_p == NULL || &dComIfG_Bgsp() == NULL) { + return 0.0f; + } + + int z0 = dComIfG_Bgsp().GetPolyAtt0(*polyinfo_p); + if (strcmp(dComIfGp_getStartStageName(), "F_SP127") == 0 && + g_env_light.fishing_hole_season == 4) + { + if (z0 == 4) { + z0 = 13; + } + } else if (strcmp(dComIfGp_getStartStageName(), "D_MN05A") == 0 && + dComIfGs_isStageBossEnemy() && z0 == 11) + { + z0 = 7; + } + + int z1 = dComIfG_Bgsp().GetPolyAtt1(*polyinfo_p); + u8 eff_id; + if (kankyo->pol_effcol2 != NULL) { + eff_id = kankyo->pol_effcol2[z0].data[z1]; + } else { + return ratio; + } + + if (eff_id >= 100) { + return ratio; + } + + ratio = (f32)kankyo->colordata_tbl[eff_id].data[7]; + ratio = 0.01f * ratio; + return ratio; } /* 801AC140-801AC168 1A6A80 0028+00 0/0 2/2 0/0 .text dKy_TeachWind_existence_chk__Fv */ BOOL dKy_TeachWind_existence_chk() { - if (g_env_light.mTeachWindExist == 0xFF) { + if (g_env_light.TeachWind_existence == 0xFF) { return -1; } - return g_env_light.mTeachWindExist ? TRUE : FALSE; + return g_env_light.TeachWind_existence ? TRUE : FALSE; } /* 801AC168-801AC228 1A6AA8 00C0+00 4/4 0/0 2/2 .text dKy_SunMoon_Light_Check__Fv */ -bool dKy_SunMoon_Light_Check() { - bool check = false; +BOOL dKy_SunMoon_Light_Check() { + BOOL check = false; if (g_env_light.mSunInitialized && !dKy_darkworld_check()) { // stage is not City in the Sky, Hyrule Castle, or Hidden Skill area if (memcmp(dComIfGp_getStartStageName(), "D_MN07", 6) && @@ -4413,15 +6500,15 @@ bool dKy_SunMoon_Light_Check() { } /* 801AC228-801AC28C 1A6B68 0064+00 3/3 0/0 0/0 .text dKy_Outdoor_check__Fv */ -static int dKy_Outdoor_check() { +BOOL dKy_Outdoor_check() { BOOL outdoors = false; - u32 type = ST_FIELD; + u32 stage_type = ST_FIELD; if (dComIfGp_getStage() != NULL) { - type = dStage_stagInfo_GetSTType(dComIfGp_getStage()->getStagInfo()); + stage_type = dStage_stagInfo_GetSTType(dComIfGp_getStage()->getStagInfo()); } - if (type == ST_FIELD) { + if (stage_type == ST_FIELD) { outdoors = true; } @@ -4429,7 +6516,7 @@ static int dKy_Outdoor_check() { } /* 801AC28C-801AC2E0 1A6BCC 0054+00 1/1 0/0 0/0 .text dKy_Indoor_check__Fv */ -static int dKy_Indoor_check() { +BOOL dKy_Indoor_check() { BOOL indoors = false; if (dStage_stagInfo_GetSTType(dComIfGp_getStage()->getStagInfo()) != ST_FIELD) { @@ -4444,23 +6531,46 @@ BOOL dKy_withwarp_capture_check() { return false; } -/* ############################################################################################## */ -/* 80453DF8-80453DFC 0023F8 0004+00 1/1 0/0 0/0 .sdata2 @10273 */ -SECTION_SDATA2 static f32 lit_10273 = 400.0f; - -/* 80453DFC-80453E00 0023FC 0004+00 1/1 0/0 0/0 .sdata2 @10274 */ -SECTION_SDATA2 static f32 lit_10274 = 608.0f; - /* 801AC2E8-801AC57C 1A6C28 0294+00 0/0 1/1 0/0 .text dKy_depth_dist_set__FPv */ -void dKy_depth_dist_set(void* param_0) { - // NONMATCHING +void dKy_depth_dist_set(void* process_p) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + camera_class* camera_p = (camera_class*)dComIfGp_getCamera(0); + cXyz sp30; + cXyz sp24; + + fopAc_ac_c* actor_p = (fopAc_ac_c*)process_p; + sp24 = actor_p->eyePos; + + if (dComIfGp_event_runCheck() && actor_p->tevStr.Type <= 10) { + if (fabsf(sp24.y - camera_p->lookat.eye.y) < 400.0f) { + sp24.y = camera_p->lookat.eye.y; + } + + f32 var_f31 = sp24.abs(camera_p->lookat.eye); + if (var_f31 < 2000.0f && var_f31 < kankyo->field_0x1268) { + mDoLib_project(&actor_p->eyePos, &sp30); + + if ((sp30.x >= 0.0f && sp30.x < 608.0f) && (sp30.y >= 0.0f && sp30.y < 600.0f)) { + cXyz sp18; + cXyz spC; + dKyr_get_vectle_calc(&camera_p->lookat.eye, &camera_p->lookat.center, &sp18); + dKyr_get_vectle_calc(&camera_p->lookat.eye, &actor_p->eyePos, &spC); + + s16 temp_r27 = cM_atan2s(sp18.x, sp18.z); + s16 temp_r26 = cM_atan2s(spC.x, spC.z); + + if ((s16)fabsf((f32)temp_r26 - (f32)temp_r27) > 0) { + kankyo->field_0x1268 = var_f31; + } + } + } + } } /* 801AC57C-801AC5BC 1A6EBC 0040+00 13/13 21/21 134/134 .text dKy_darkworld_check__Fv */ bool dKy_darkworld_check() { bool check = false; - - if (dComIfGp_world_dark_get() == 1) { + if (dComIfGp_world_dark_get() == TRUE) { check = true; } @@ -4480,12 +6590,12 @@ bool dKy_darkworld_check() { * darkworld table. */ /* 801AC5BC-801AC70C 1A6EFC 0150+00 3/3 0/0 0/0 .text dKy_F_SP121Check__FPCciPUci */ -static int dKy_F_SP121Check(char const* stageName, int roomNo, u8* out_darkLv, int tblIndex) { +int dKy_F_SP121Check(char const* stageName, int roomNo, u8* out_darkLv, int tblIndex) { dKydata_darkworldInfo_c* darkworldTbl = dKyd_darkworld_tbl_getp(); int result = 0; if (out_darkLv != NULL) { - *out_darkLv = UNCLEARABLE; + *out_darkLv = KY_DARKLV_UNCLEARABLE; } // Stage is Hyrule Field @@ -4498,7 +6608,7 @@ static int dKy_F_SP121Check(char const* stageName, int roomNo, u8* out_darkLv, i // - Outside Hidden Village (7) if (roomNo == 0 || (2 <= roomNo && roomNo <= 5) || roomNo == 7) { if (out_darkLv != NULL) { - *out_darkLv = ELDIN; + *out_darkLv = KY_DARKLV_ELDIN; } result = 1; } @@ -4512,7 +6622,7 @@ static int dKy_F_SP121Check(char const* stageName, int roomNo, u8* out_darkLv, i else if (roomNo >= 9 && roomNo <= 14) { if (out_darkLv != NULL) { - *out_darkLv = LANAYRU; + *out_darkLv = KY_DARKLV_LANAYRU; } result = 1; } @@ -4535,7 +6645,7 @@ static int dKy_F_SP121Check(char const* stageName, int roomNo, u8* out_darkLv, i // Prevent twilight if stage depends on Faron Twilight cleared status (Faron Woods, Coro's // Lantern Shop, Faron Woods Cave) but haven't finished Ordon Day 2. - if (darkworldTbl[tblIndex].darkLv == FARON && !dComIfGs_isEventBit(0x4510)) { + if (darkworldTbl[tblIndex].darkLv == KY_DARKLV_FARON && !dComIfGs_isEventBit(0x4510)) { result = -1; } @@ -4560,7 +6670,7 @@ u8 dKy_darkworld_stage_check(char const* stageName, int roomNo) { for (int i = 0; i < 34; i++) { if (!strcmp(stageName, darkworldTbl[i].stageName)) { - if (darkworldTbl[i].darkLv != ALWAYS_DARK) { + if (darkworldTbl[i].darkLv != KY_DARKLV_ALWAYS) { int fsp121CheckResult = dKy_F_SP121Check(stageName, roomNo, darkLv, i); if (fsp121CheckResult >= 0) { if (fsp121CheckResult == 0) { @@ -4572,7 +6682,7 @@ u8 dKy_darkworld_stage_check(char const* stageName, int roomNo) { break; } } else { - // ALWAYS_DARK is used to force twilight (likely for testing). This will + // KY_DARKLV_ALWAYS is used to force twilight (likely for testing). This will // never normally run since it is not present in l_darkworld_tbl. result = TRUE; break; @@ -4632,220 +6742,132 @@ void dKy_darkworld_Area_set(char const* stageName, int roomNo) { } } -/* ############################################################################################## */ -/* 80453E00-80453E04 002400 0004+00 1/1 0/0 0/0 .sdata2 @10483 */ -SECTION_SDATA2 static f32 lit_10483 = 36.0f; - -/* 80453E04-80453E08 002404 0004+00 1/1 0/0 0/0 .sdata2 @10484 */ -SECTION_SDATA2 static f32 lit_10484 = 29.0f; - -/* 80453E08-80453E0C 002408 0004+00 1/1 0/0 0/0 .sdata2 @10485 */ -SECTION_SDATA2 static f32 lit_10485 = 1550.0f; - -/* 80453E0C-80453E10 00240C 0004+00 1/1 0/0 0/0 .sdata2 @10486 */ -SECTION_SDATA2 static f32 lit_10486 = 140.0f; - /* 801AC918-801ACCDC 1A7258 03C4+00 1/1 0/0 0/0 .text dKy_murky_set__FP11J3DMaterial */ -#ifdef NONMATCHING -static void dKy_murky_set(J3DMaterial* material_p) { - dKankyo_sunlenz_Packet* sunlenzPkt_p = g_env_light.mpSunLenzPacket; - dKankyo_sun_Packet* sunPkt_p = g_env_light.mpSunPacket; +void dKy_murky_set(J3DMaterial* material_p) { + dKankyo_sunlenz_Packet* lenz_packet = g_env_light.mpSunLenzPacket; + dKankyo_sun_Packet* sun_packet = g_env_light.mpSunPacket; + camera_class* camera_p = (camera_class*)dComIfGp_getCamera(0); + cXyz sp18; + J3DGXColorS10 tev_col; + J3DGXColor tev_kcol; - camera_class* camera_p = dComIfGp_getCamera(0); - J3DGXColorS10 sp54; - J3DGXColor sp58; + JUT_ASSERT(0x43DB, material_p != 0); - sp54.r = g_env_light.mTerrainAmbienceBG1.r; - sp54.g = g_env_light.mTerrainAmbienceBG1.g; - sp54.b = g_env_light.mTerrainAmbienceBG1.b; - sp54.a = g_env_light.mTerrainAmbienceBG2.a; + tev_col.r = g_env_light.bg_amb_col[1].r; + tev_col.g = g_env_light.bg_amb_col[1].g; + tev_col.b = g_env_light.bg_amb_col[1].b; + tev_col.a = g_env_light.bg_amb_col[2].a; + tev_kcol.a = g_env_light.bg_amb_col[1].a; - sp58.a = g_env_light.mTerrainAmbienceBG1.a; + f32 var_f29 = 1.0f; if (g_env_light.field_0x1300 != -1) { - sp58.a = g_env_light.field_0x1300 * 1.0f; + tev_kcol.a = g_env_light.field_0x1300 * var_f29; } if (g_env_light.field_0x1302 != -1) { - sp54.a = (u8)(g_env_light.field_0x1302 * 1.0f); + tev_col.a = (u8)(g_env_light.field_0x1302 * var_f29); } - if (sunlenzPkt_p != NULL && sunPkt_p->field_0x5c > 1E-06f) { - sp54.a *= 1.0f - sunPkt_p->field_0x5c * - (1.0f - sunlenzPkt_p->field_0x98 * sunlenzPkt_p->field_0x98 * - sunlenzPkt_p->field_0x98); + if (lenz_packet != NULL && sun_packet->mVisibility > 0.000001f) { + tev_col.a = (u8)(tev_col.a * + (1.0f - (sun_packet->mVisibility * + (1.0f - (lenz_packet->mDistFalloff * lenz_packet->mDistFalloff * lenz_packet->mDistFalloff))))); } // Diababa room handling if (strcmp(dComIfGp_getStartStageName(), "D_MN05A") == 0) { + dScnKy_env_light_c* var_r26 = dKy_getEnvlight(); + dKankyo_mud_Packet* var_r27 = var_r26->mpMudPacket; + f32 var_f31; - if (g_env_light.mpMudPacket != NULL) { - var_f31 = 1.0f - g_env_light.mpMudPacket->field_0x1c3c; + if (var_r27 != NULL) { + var_f31 = 1.0f - var_r27->field_0x1c3c; } - sp54.r = 20; - sp54.g = 6; - sp54.b = 15; + tev_col.r = 20; + tev_col.g = 6; + tev_col.b = 15; - sp54.r = (var_f31 * -0.0f) + 20; - sp54.g = (var_f31 * 36.0f) + 6; - sp54.b = (var_f31 * 29.0f) + 15; + tev_col.r = (u8)(tev_col.r + (s16)(-(f32)tev_col.r * var_f31)); + tev_col.g = (u8)(tev_col.g + (s16)((36.0f - tev_col.g) * var_f31)); + tev_col.b = (u8)(tev_col.b + (s16)((29.0f - tev_col.b) * var_f31)); - f32 var_f0; if (camera_p != NULL && camera_p->lookat.eye.z < 1800.0f) { + f32 var_f30; if (camera_p->lookat.eye.z < 1550.0f) { - var_f0 = 1.0f; + var_f30 = 1.0f; } else { - var_f0 = 1.0f - ((camera_p->lookat.eye.z - 1550.0f) / 250.0f); + var_f30 = 1.0f - ((camera_p->lookat.eye.z - 1550.0f) / 250.0f); } - sp54.a = 255.0f * var_f0; + tev_col.a = (u8)(255.0f * var_f30); } else { - sp54.a = 0; + tev_col.a = 0; } - sp54.a += -sp54.a * var_f31; - sp58.a = (var_f31 * 140.0f) + 255; + tev_col.a = (u8)(tev_col.a + (s16)(-(f32)tev_col.a * var_f31)); + + tev_kcol.a = 0xFF; + tev_kcol.a = (u8)(tev_kcol.a + (s16)((140.0f - tev_kcol.a) * var_f31)); } - sp58.r = 0; - sp58.g = 0; - sp58.b = 0; + tev_kcol.r = 0; + tev_kcol.g = 0; + tev_kcol.b = 0; - material_p->setTevColor(1, &sp54); - material_p->setTevKColor(3, &sp58); + material_p->setTevColor(1, &tev_col); + material_p->setTevKColor(3, &tev_kcol); } -#else -static void dKy_murky_set(J3DMaterial* param_0) { - // NONMATCHING -} -#endif /* 801ACCDC-801ACCF4 1A761C 0018+00 2/2 1/1 0/0 .text dKy_shadow_mode_set__FUc */ void dKy_shadow_mode_set(u8 mode) { - g_env_light.mShadowMode |= mode; + g_env_light.shadow_mode |= mode; } /* 801ACCF4-801ACD0C 1A7634 0018+00 2/2 1/1 0/0 .text dKy_shadow_mode_reset__FUc */ void dKy_shadow_mode_reset(u8 mode) { - g_env_light.mShadowMode &= ~mode; + g_env_light.shadow_mode &= ~mode; } /* 801ACD0C-801ACD24 1A764C 0018+00 3/3 0/0 1/1 .text dKy_shadow_mode_check__FUc */ u8 dKy_shadow_mode_check(u8 mode) { - return g_env_light.mShadowMode & mode; + return g_env_light.shadow_mode & mode; } -/* ############################################################################################## */ -/* 80394C6C-80394C6C 0212CC 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80394EDD = "MA06"; -SECTION_DEAD static char const* const stringBase_80394EE2 = "MA03"; -SECTION_DEAD static char const* const stringBase_80394EE7 = "MA09"; -SECTION_DEAD static char const* const stringBase_80394EEC = "MA17"; -SECTION_DEAD static char const* const stringBase_80394EF1 = "MA19"; -SECTION_DEAD static char const* const stringBase_80394EF6 = "MA07"; -SECTION_DEAD static char const* const stringBase_80394EFB = "MA10"; -SECTION_DEAD static char const* const stringBase_80394F00 = "MA02"; -SECTION_DEAD static char const* const stringBase_80394F05 = "MA00"; -SECTION_DEAD static char const* const stringBase_80394F0A = "MA01"; -SECTION_DEAD static char const* const stringBase_80394F0F = "MA04"; -SECTION_DEAD static char const* const stringBase_80394F14 = "MA16"; -SECTION_DEAD static char const* const stringBase_80394F19 = "MA11"; -SECTION_DEAD static char const* const stringBase_80394F1E = "MA20"; -SECTION_DEAD static char const* const stringBase_80394F23 = "MA13"; -SECTION_DEAD static char const* const stringBase_80394F28 = "MA14"; -SECTION_DEAD static char const* const stringBase_80394F2D = "Rainbow"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_80394F35 = "\0\0"; -#pragma pop - /* 80450708-8045070C 000188 0004+00 1/1 0/0 0/0 .sdata l_zmodeUpEnable */ -SECTION_SDATA static J3DZModeInfo l_zmodeUpEnable = {1, 3, 1}; +static J3DZModeInfo l_zmodeUpEnable = {1, 3, 1}; /* 8045070C-80450710 00018C 0004+00 1/1 0/0 0/0 .sdata l_zmodeUpDisable */ -SECTION_SDATA static J3DZModeInfo l_zmodeUpDisable = {1, 3, 0}; +static J3DZModeInfo l_zmodeUpDisable = {1, 3, 0}; /* 80450710-80450718 000190 0008+00 1/1 0/0 0/0 .sdata l_alphaCompInfoOPA */ -SECTION_SDATA static J3DAlphaCompInfo l_alphaCompInfoOPA = { +static J3DAlphaCompInfo l_alphaCompInfoOPA = { 0x07, 0x00, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00, }; /* 80450718-80450720 000198 0008+00 1/1 0/0 0/0 .sdata l_alphaCompInfo */ -SECTION_SDATA static J3DAlphaCompInfo l_alphaCompInfo = { +static J3DAlphaCompInfo l_alphaCompInfo = { 0x04, 0x80, 0x00, 0x03, 0xFF, 0x00, 0x00, 0x00, }; -/* 80453E10-80453E14 002410 0004+00 1/1 0/0 0/0 .sdata2 @10916 */ -SECTION_SDATA2 static f32 lit_10916 = 245.0f; - -/* 80453E14-80453E18 002414 0004+00 1/1 0/0 0/0 .sdata2 @10917 */ -SECTION_SDATA2 static f32 lit_10917 = 45.0f; - -/* 80453E18-80453E1C 002418 0004+00 1/1 0/0 0/0 .sdata2 @10918 */ -SECTION_SDATA2 static f32 lit_10918 = -1.0f / 100.0f; - -/* 80453E1C-80453E20 00241C 0004+00 1/1 0/0 0/0 .sdata2 @10919 */ -SECTION_SDATA2 static f32 lit_10919 = 49.0f / 100.0f; - -/* 80453E20-80453E24 002420 0004+00 1/1 0/0 0/0 .sdata2 @10920 */ -SECTION_SDATA2 static f32 lit_10920 = -49.0f / 100.0f; - -/* 80453E24-80453E28 002424 0004+00 1/1 0/0 0/0 .sdata2 @10921 */ -SECTION_SDATA2 static f32 lit_10921 = 14.0f / 5.0f; - -/* 80453E28-80453E2C 002428 0004+00 1/1 0/0 0/0 .sdata2 @10922 */ -SECTION_SDATA2 static f32 lit_10922 = 170.0f; - -/* 80453E2C-80453E30 00242C 0004+00 1/1 0/0 0/0 .sdata2 @10923 */ -SECTION_SDATA2 static f32 lit_10923 = -14770.0f; - -/* 80453E30-80453E34 002430 0004+00 1/1 0/0 0/0 .sdata2 @10924 */ -SECTION_SDATA2 static f32 lit_10924 = -14570.0f; - -/* 80453E34-80453E38 002434 0004+00 1/1 0/0 0/0 .sdata2 @10925 */ -SECTION_SDATA2 static f32 lit_10925 = -5853.0f; - -/* 80453E38-80453E3C 002438 0004+00 1/1 0/0 0/0 .sdata2 @10926 */ -SECTION_SDATA2 static f32 lit_10926 = -879.0f; - -/* 80453E3C-80453E40 00243C 0004+00 1/1 0/0 0/0 .sdata2 @10927 */ -SECTION_SDATA2 static f32 lit_10927 = -1.0f / 5.0f; - -/* 80453E40-80453E44 002440 0004+00 1/1 0/0 0/0 .sdata2 @10928 */ -SECTION_SDATA2 static f32 lit_10928 = 4500.0f; - -/* 80453E44-80453E48 002444 0004+00 1/1 0/0 0/0 .sdata2 @10929 */ -SECTION_SDATA2 static f32 lit_10929 = 75.0f; - -/* 80453E48-80453E4C 002448 0004+00 1/1 0/0 0/0 .sdata2 @10930 */ -SECTION_SDATA2 static f32 lit_10930 = -81.0f / 100.0f; - -/* 80453E4C-80453E50 00244C 0004+00 1/1 0/0 0/0 .sdata2 @10931 */ -SECTION_SDATA2 static f32 lit_10931 = 0.5830000042915344f; - -/* 80453E50-80453E58 002450 0004+04 1/1 0/0 0/0 .sdata2 @10932 */ -SECTION_SDATA2 static f32 lit_10932[1 + 1 /* padding */] = { - 115.0f, - /* padding */ - 0.0f, -}; - /* 801ACD24-801ADBBC 1A7664 0E98+00 0/0 0/0 7/7 .text dKy_bg_MAxx_proc__FPv */ -// stack / couple instructions at the end -#ifdef NONMATCHING -void dKy_bg_MAxx_proc(void* param_0) { - dScnKy_env_light_c* env_light = dKy_getEnvlight(); - s8 cam_id = dComIfGp_getWindow(0)->getCameraID(); - camera_class* camera_p = dComIfGp_getCamera(cam_id); +// NONMATCHING - `setAlphaCompInfo` is incorrect, and instruction in the wrong order at the start +void dKy_bg_MAxx_proc(void* bg_model_p) { + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + J3DModel* model_p = (J3DModel*)bg_model_p; + dDlst_window_c* window = dComIfGp_getWindow(0); + camera_class* camera_p = (camera_class*)dComIfGp_getCamera(window->getCameraID()); fopAc_ac_c* player_p = dComIfGp_getPlayer(0); - if (param_0 != NULL && player_p != NULL) { - J3DModelData* modelData = static_cast(param_0)->getModelData(); + if (model_p != NULL && player_p != NULL) { + J3DModelData* modelData = model_p->getModelData(); for (u16 i = 0; i < modelData->getMaterialNum(); i++) { + J3DGXColor sp5C; + J3DMaterial* mat_p = modelData->getMaterialNodePointer(i); - const char* mat_name = modelData->getMaterialName()->getName(i); + JUTNameTab* mat_nametbl = modelData->getMaterialName(); + const char* mat_name = mat_nametbl->getName(i); if (mat_name[3] == 'M' && mat_name[4] == 'A') { if (memcmp(&mat_name[3], "MA06", 4) == 0) { @@ -4866,44 +6888,47 @@ void dKy_bg_MAxx_proc(void* param_0) { if (fog_info_p != NULL) { if (mat_name[5] == '0' && mat_name[6] == '9') { - fog_info_p->field_0x0 = 6; + fog_info_p->mType = 6; - J3DGXColor k_color; - k_color.r = 245.0f - g_env_light.mWaterSurfaceShineRate * 45.0f; - k_color.g = 245.0f - g_env_light.mWaterSurfaceShineRate * 45.0f; - k_color.b = 245.0f - g_env_light.mWaterSurfaceShineRate * 35.0f; - k_color.a = 255; - mat_p->setTevKColor(1, &k_color); + J3DGXColor sp44; + sp44.r = 245.0f - g_env_light.mWaterSurfaceShineRate * 45.0f; + sp44.g = 245.0f - g_env_light.mWaterSurfaceShineRate * 45.0f; + sp44.b = 245.0f - g_env_light.mWaterSurfaceShineRate * 35.0f; + sp44.a = 255; + mat_p->setTevKColor(1, &sp44); } else { - fog_info_p->field_0x0 = 7; + fog_info_p->mType = 7; - J3DGXColorS10 color; - J3DGXColor k_color; - color.r = g_env_light.mTerrainAmbienceBG2.r; - color.g = g_env_light.mTerrainAmbienceBG2.g; - color.b = g_env_light.mTerrainAmbienceBG2.b; - color.a = g_env_light.mTerrainAmbienceBG2.a; + J3DGXColorS10 spA0; + J3DGXColor sp40; + spA0.r = g_env_light.bg_amb_col[2].r; + spA0.g = g_env_light.bg_amb_col[2].g; + spA0.b = g_env_light.bg_amb_col[2].b; + spA0.a = g_env_light.bg_amb_col[2].a; - k_color.a = g_env_light.mTerrainAmbienceBG1.a; - k_color.r = 0; - k_color.g = 0; - k_color.b = 0; + sp40.a = g_env_light.bg_amb_col[1].a; + sp40.r = 0; + sp40.g = 0; + sp40.b = 0; - mat_p->setTevColor(1, &color); - mat_p->setTevKColor(3, &k_color); + mat_p->setTevColor(1, &spA0); + mat_p->setTevKColor(3, &sp40); } } } } if (memcmp(&mat_name[3], "MA07", 4) == 0) { - J3DGXColorS10 color; - color.r = (u8)(g_env_light.mThunderEff.field_0x8 * 100.0f); - color.g = (u8)(g_env_light.mThunderEff.field_0x8 * 100.0f); - color.b = (u8)(g_env_light.mThunderEff.field_0x8 * 100.0f); - color.a = 255; + J3DGXColorS10 sp98; + dScnKy_env_light_c* kankyo = dKy_getEnvlight(); + EF_THUNDER* thunder_ef = &kankyo->mThunderEff; - mat_p->setTevColor(0, &color); + sp98.r = (u8)(thunder_ef->mFlashTimer * 100.0f); + sp98.g = (u8)(thunder_ef->mFlashTimer * 100.0f); + sp98.b = (u8)(thunder_ef->mFlashTimer * 100.0f); + sp98.a = 255; + + mat_p->setTevColor(0, &sp98); } if (memcmp(&mat_name[3], "MA10", 4) == 0 || memcmp(&mat_name[3], "MA02", 4) == 0) { @@ -4913,17 +6938,19 @@ void dKy_bg_MAxx_proc(void* param_0) { J3DTexMtxInfo* tex_mtx_inf = &mat_p->getTexGenBlock()->getTexMtx(0)->getTexMtxInfo(); if (tex_mtx_inf != NULL) { - dKyw_get_wind_vec(); + cXyz* sp34 = dKyw_get_wind_vec(); + cXyz sp108; - Mtx sp170; + Mtx sp1D8; if (mat_name[6] == '2') { - C_MTXLightPerspective(sp170, dComIfGd_getView()->fovy, + C_MTXLightPerspective(sp1D8, dComIfGd_getView()->fovy, camera_p->aspect, 1.0f, 1.0f, -0.01f, 0.0f); } else { - C_MTXLightPerspective(sp170, dComIfGd_getView()->fovy, + C_MTXLightPerspective(sp1D8, dComIfGd_getView()->fovy, camera_p->aspect, 0.49f, -0.49f, 0.5f, 0.5f); } - tex_mtx_inf->setEffectMtx(sp170); + + tex_mtx_inf->setEffectMtx(sp1D8); modelData->simpleCalcMaterial(0, (MtxP)j3dDefaultMtx); } } @@ -4932,73 +6959,72 @@ void dKy_bg_MAxx_proc(void* param_0) { if (memcmp(&mat_name[3], "MA00", 4) == 0 || memcmp(&mat_name[3], "MA01", 4) == 0 || memcmp(&mat_name[3], "MA04", 4) == 0 || memcmp(&mat_name[3], "MA16", 4) == 0) { - J3DGXColor k_color; - k_color.r = g_env_light.mFogDensity; - k_color.g = 0; - k_color.b = 0; + sp5C.r = g_env_light.mFogDensity; + sp5C.g = 0; + sp5C.b = 0; if (mat_name[6] == '1') { J3DPEBlock* peblock_p = mat_p->getPEBlock(); mat_p->change(); if (dKy_camera_water_in_status_check()) { - k_color.a = 255; + sp5C.a = 255; peblock_p->getAlphaComp()->setAlphaCompInfo(l_alphaCompInfo); peblock_p->getZMode()->setZModeInfo(l_zmodeUpEnable); } else { - k_color.a = 0; + sp5C.a = 0; peblock_p->getAlphaComp()->setAlphaCompInfo(l_alphaCompInfoOPA); peblock_p->getZMode()->setZModeInfo(l_zmodeUpDisable); } } else { - k_color.a = 0; + sp5C.a = 0; } - mat_p->setTevKColor(1, &k_color); + mat_p->setTevKColor(1, &sp5C); } if (memcmp(&mat_name[3], "MA11", 4) == 0) { + J3DGXColorS10 sp90; if (dKy_darkworld_check()) { dComIfGd_setListDarkBG(); - J3DGXColorS10 color; - color.r = 170; - color.g = 160; - color.b = 255; - color.a = 255; - mat_p->setTevColor(1, &color); + sp90.r = 170; + sp90.g = 160; + sp90.b = 255; + sp90.a = 255; + mat_p->setTevColor(1, &sp90); - color.r = 50; - color.g = 20; - color.b = 90; - color.a = 255; - mat_p->setTevColor(2, &color); + sp90.r = 50; + sp90.g = 20; + sp90.b = 90; + sp90.a = 255; + mat_p->setTevColor(2, &sp90); } else { - cXyz spA4; - cXyz sp98; - J3DGXColorS10 color; - color.r = 120; - color.g = 90; - color.b = 180; - color.a = 255; + cXyz spFC; + cXyz spF0; + + sp90.r = 120; + sp90.g = 90; + sp90.b = 180; + sp90.a = 255; if (dComIfG_play_c::getLayerNo(0) == 1) { - color.a = 0; + sp90.a = 0; } - mat_p->setTevColor(1, &color); + mat_p->setTevColor(1, &sp90); - color.r = 40; - color.g = 30; - color.b = 65; - color.a = 255; - mat_p->setTevColor(2, &color); + sp90.r = 40; + sp90.g = 30; + sp90.b = 65; + sp90.a = 255; + mat_p->setTevColor(2, &sp90); - if (env_light->field_0x1060 != NULL) { - sp98 = env_light->field_0x1060->mAvoidPos; - f32 var_f29 = env_light->field_0x1060->mSize.x * - env_light->field_0x1060->mSizeScale; - if (var_f29 < 0.1f) { - var_f29 = 0.1f; + if (kankyo->fog_avoid_tag != NULL) { + spF0 = kankyo->fog_avoid_tag->mAvoidPos; + f32 var_f28 = + kankyo->fog_avoid_tag->mSize.x * kankyo->fog_avoid_tag->mSizeScale; + if (var_f28 < 0.1f) { + var_f28 = 0.1f; } if (mat_p->getTexGenBlock()->getTexMtx(0) != NULL) { @@ -5006,282 +7032,160 @@ void dKy_bg_MAxx_proc(void* param_0) { &mat_p->getTexGenBlock()->getTexMtx(0)->getTexMtxInfo(); if (tex_mtx_inf != NULL) { - Mtx sp140; - Mtx sp110; - C_MTXLightPerspective(sp140, var_f29 * 2.8f, 1.0f, 0.5f, 0.5f, + Mtx sp1A8; + Mtx sp178; + C_MTXLightPerspective(sp1A8, var_f28 * 2.8f, 1.0f, 0.5f, 0.5f, 0.0f, 0.0f); - spA4.x = sp98.x; - spA4.y = 100.0f; - spA4.z = sp98.z; + spFC.x = spF0.x; + spFC.y = 100.0f; + spFC.z = spF0.z; - cXyz sp8C(sp98.x, -1000.0f, sp98.z); - mDoMtx_lookAt(sp110, &sp8C, &spA4, 0); - cMtx_concat(sp140, sp110, sp110); - tex_mtx_inf->setEffectMtx(sp110); + cXyz spE4(spF0.x, -1000.0f, spF0.z); + mDoMtx_lookAt(sp178, &spE4, &spFC, 0); + cMtx_concat(sp1A8, sp178, sp178); + tex_mtx_inf->setEffectMtx(sp178); } } } } } else if (memcmp(&mat_name[3], "MA20", 4) == 0) { - cXyz sp80; + cXyz spD8; + cXyz spCC; if (mat_p->getFog() != NULL) { J3DFogInfo* fog_inf = mat_p->getFog()->getFogInfo(); if (fog_inf != NULL) { - fog_inf->field_0x0 = 7; + fog_inf->mType = 7; } - J3DGXColorS10 sp3C; - sp3C.r = g_env_light.mTerrainAmbienceBG3.r; - sp3C.g = g_env_light.mTerrainAmbienceBG3.g; - sp3C.b = g_env_light.mTerrainAmbienceBG3.b; - sp3C.a = 255; + J3DGXColorS10 sp88; + sp88.r = g_env_light.bg_amb_col[3].r; + sp88.g = g_env_light.bg_amb_col[3].g; + sp88.b = g_env_light.bg_amb_col[3].b; + sp88.a = 255; - mat_p->setTevColor(1, &sp3C); + mat_p->setTevColor(1, &sp88); if (mat_p->getTexGenBlock()->getTexMtx(2) != NULL) { J3DTexMtxInfo* tex_mtx_inf = &mat_p->getTexGenBlock()->getTexMtx(2)->getTexMtxInfo(); if (tex_mtx_inf != NULL) { - Mtx spE0; - Mtx spB0; - C_MTXLightPerspective(spE0, 170.0f, 1.0f, 1.5f, 1.5f, 0.0f, 0.0f); - sp80.x = player_p->current.pos.x; - sp80.y = -14770.0f; - sp80.z = player_p->current.pos.z; + Mtx sp148; + Mtx sp118; + C_MTXLightPerspective(sp148, 170.0f, 1.0f, 1.5f, 1.5f, 0.0f, 0.0f); + spD8.x = player_p->current.pos.x; + spD8.y = -14770.0f; + spD8.z = player_p->current.pos.z; - cXyz sp74(player_p->current.pos.x, -14570.0f, + cXyz spC0(player_p->current.pos.x, -14570.0f, player_p->current.pos.z); - mDoMtx_lookAt(spB0, &sp74, &sp80, 0); - cMtx_concat(spE0, spB0, spB0); - tex_mtx_inf->setEffectMtx(spB0); + mDoMtx_lookAt(sp118, &spC0, &spD8, 0); + cMtx_concat(sp148, sp118, sp118); + tex_mtx_inf->setEffectMtx(sp118); } } } } else if (memcmp(&mat_name[3], "MA13", 4) == 0) { - J3DGXColorS10 color; - color.r = g_env_light.mTerrainAmbienceBG3.r; - color.g = g_env_light.mTerrainAmbienceBG3.g; - color.b = g_env_light.mTerrainAmbienceBG3.b; - color.a = g_env_light.mTerrainAmbienceBG3.a; - mat_p->setTevColor(1, &color); + J3DGXColorS10 sp80; + sp80.r = g_env_light.bg_amb_col[3].r; + sp80.g = g_env_light.bg_amb_col[3].g; + sp80.b = g_env_light.bg_amb_col[3].b; + sp80.a = g_env_light.bg_amb_col[3].a; + mat_p->setTevColor(1, &sp80); } else if (memcmp(&mat_name[3], "MA14", 4) == 0) { - J3DGXColorS10 color; - J3DGXColor k_color; - color.r = g_env_light.mFogColor.r; - color.g = g_env_light.mFogColor.g; - color.b = g_env_light.mFogColor.b; - color.a = g_env_light.mFogColor.a; - mat_p->setTevColor(1, &color); + J3DGXColorS10 sp78; + J3DGXColor sp1C; + sp78.r = g_env_light.fog_col.r; + sp78.g = g_env_light.fog_col.g; + sp78.b = g_env_light.fog_col.b; + sp78.a = g_env_light.fog_col.a; + mat_p->setTevColor(1, &sp78); - k_color.r = 0; - k_color.g = 0; - k_color.b = 0; - k_color.a = g_env_light.mTerrainAmbienceBG3.a; - mat_p->setTevKColor(3, &k_color); + sp1C.r = sp1C.g = sp1C.b = 0; + sp1C.a = g_env_light.bg_amb_col[3].a; + mat_p->setTevKColor(3, &sp1C); } else if (memcmp(&mat_name[3], "MA16", 4) == 0) { - J3DGXColorS10 color; - J3DGXColor k_color; - color.r = g_env_light.mTerrainAmbienceBG1.r; - color.g = g_env_light.mTerrainAmbienceBG1.g; - color.b = g_env_light.mTerrainAmbienceBG1.b; - color.a = g_env_light.mTerrainAmbienceBG1.a; - mat_p->setTevColor(1, &color); + J3DGXColorS10 sp70; + J3DGXColor sp18; + sp70.r = g_env_light.bg_amb_col[1].r; + sp70.g = g_env_light.bg_amb_col[1].g; + sp70.b = g_env_light.bg_amb_col[1].b; + sp70.a = g_env_light.bg_amb_col[1].a; + mat_p->setTevColor(1, &sp70); - k_color.r = 0; - k_color.g = 0; - k_color.b = 0; - k_color.a = g_env_light.mTerrainAmbienceBG3.a; - mat_p->setTevKColor(3, &k_color); + sp18.r = sp18.g = sp18.b = 0; + sp18.a = g_env_light.bg_amb_col[3].a; + mat_p->setTevKColor(3, &sp18); } } if (memcmp(&mat_name[3], "Rainbow", 7) == 0) { - f32 temp_f31 = g_env_light.getDaytime(); - cXyz sp68; - camera_class* temp_r16_2 = dComIfGp_getCamera(0); - J3DGXColor color; + f32 temp_f29; + f32 temp_f31; - cXyz sp5C; - sp5C.x = -5853.0f; - sp5C.y = temp_r16_2->lookat.eye.y; - sp5C.z = -879.0f; + f32 time = g_env_light.getDaytime(); + cXyz spB4; + camera_class* camera_p = dComIfGp_getCamera(0); + J3DGXColor sp10; - f32 var_f1 = sp5C.abs(temp_r16_2->lookat.eye); - f32 var_f29_2 = -0.2f + (var_f1 / 4500.0f); - if (var_f29_2 > 1.0f) { - var_f29_2 = 1.0f; - } else if (var_f29_2 < 0.0f) { - var_f29_2 = 0.0f; + cXyz spA8; + spA8.x = -5853.0f; + spA8.y = camera_p->lookat.eye.y; + spA8.z = -879.0f; + + temp_f31 = spA8.abs(camera_p->lookat.eye); + temp_f31 = -0.2f + (temp_f31 / 4500.0f); + if (temp_f31 > 1.0f) { + temp_f31 = 1.0f; + } else if (temp_f31 < 0.0f) { + temp_f31 = 0.0f; } - color.b = 255; - color.g = 255; - color.r = 255; - color.a = 255; + sp10.b = sp10.g = sp10.r = 255; + sp10.a = 255; - f32 var_f30 = 0.0f; - if (temp_f31 >= 270.0f) { - if (temp_f31 < 285.0f) { - var_f30 = (285.0f - temp_f31) / 15.0f; + temp_f29 = 0.0f; + if (time >= 270.0f) { + if (time < 285.0f) { + temp_f29 = (285.0f - time) / 15.0f; } - } else if (temp_f31 < 75.0f) { - if (temp_f31 >= 60.0f) { - var_f30 = 1.0f - ((75.0f - temp_f31) / 15.0f); + } else if (time < 75.0f) { + if (time >= 60.0f) { + temp_f29 = 1.0f - ((75.0f - time) / 15.0f); } } else { - var_f30 = 1.0f; + temp_f29 = 1.0f; } if (g_env_light.mColpatWeather != 0) { - var_f30 = 0.0f; + temp_f29 = 0.0f; } - color.b = 255; - color.g = 255; - color.r = 255; + sp10.b = 255; + sp10.g = 255; + sp10.r = 255; - sp5C = temp_r16_2->lookat.center; - sp5C.y = temp_r16_2->lookat.eye.y; - dKyr_get_vectle_calc(&temp_r16_2->lookat.eye, &sp5C, &sp68); + f32 temp_f25 = 1.0f; - f32 temp_f1_2 = cM3d_VectorProduct2d(0.0f, 0.0f, -0.81f, 0.583f, sp68.x, sp68.z); - f32 var_f0; - if (temp_f1_2 < 0.2f) { - color.a = 0; + spA8 = camera_p->lookat.center; + spA8.y = camera_p->lookat.eye.y; + dKyr_get_vectle_calc(&camera_p->lookat.eye, &spA8, &spB4); + + f32 temp_f27 = cM3d_VectorProduct2d(0.0f, 0.0f, -0.81f, 0.583f, spB4.x, spB4.z); + f32 temp_f26; + if (temp_f27 < 0.2f) { + sp10.a = 0; } else { - if (temp_f1_2 > 0.6f) { - var_f0 = 1.0f; + if (temp_f27 > 0.6f) { + temp_f26 = 1.0f; } else { - var_f0 = (temp_f1_2 - 0.2f) / 0.4f; + temp_f26 = (temp_f27 - 0.2f) / 0.4f; } - color.a = 1.0f * (var_f29_2 * (115.0f * var_f0 * var_f30)); + sp10.a = temp_f25 * (temp_f31 * (115.0f * temp_f26 * temp_f29)); } - mat_p->setTevKColor(3, &color); + mat_p->setTevKColor(3, &sp10); } } } } -#else -void dKy_bg_MAxx_proc(void* param_0) { - // NONMATCHING -} -#endif - -/* 803BC0A0-803BC0B4 -00001 0014+00 1/0 0/0 0/0 .data l_dKy_Method */ -SECTION_DATA static void* l_dKy_Method[5] = { - (void*)dKy_Create, - (void*)dKy_Delete, - (void*)dKy_Execute, - (void*)dKy_IsDelete, - (void*)dKy_Draw, -}; - -/* 803BC0B4-803BC0DC -00001 0028+00 0/0 0/0 1/0 .data g_profile_KANKYO */ -SECTION_DATA extern void* g_profile_KANKYO[10] = { - (void*)0xFFFFFFFD, (void*)0x0001FFFD, (void*)0x00130000, (void*)&g_fpcLf_Method, - (void*)0x000000F8, (void*)NULL, (void*)NULL, (void*)&g_fopKy_Method, - (void*)0x00020000, (void*)&l_dKy_Method, -}; - -/* 803BC0DC-803BC13C 0191FC 0030+30 1/1 0/0 0/0 .data parcent_tabel$9036 */ -SECTION_DATA static u8 parcent_tabel[48 + 48 /* padding */] = { - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x3F, - 0x80, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x3F, - 0x33, - 0x33, - 0x33, - 0x3E, - 0x99, - 0x99, - 0x9A, - 0x00, - 0x00, - 0x00, - 0x00, - 0x3F, - 0x19, - 0x99, - 0x9A, - 0x3E, - 0x99, - 0x99, - 0x9A, - 0x3D, - 0xCC, - 0xCC, - 0xCD, - /* padding */ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, -}; diff --git a/src/d/d_kankyo_data.cpp b/src/d/d_kankyo_data.cpp index a645b3f5e3..06795f6f07 100644 --- a/src/d/d_kankyo_data.cpp +++ b/src/d/d_kankyo_data.cpp @@ -25,7 +25,7 @@ struct dKyd_l_vr_box_data_struct { // /* 803A8E98-803A9198 005FB8 0300+00 1/1 0/0 0/0 .data l_kydata_BloomInf_tbl */ -static dkydata_bloomInfo_info_class l_kydata_BloomInf_tbl[BLOOMINFO_MAX] = { +static dKydata_BloomInfo_c l_kydata_BloomInf_tbl[BLOOMINFO_MAX] = { {BLOOM_SOFT, 0xFF, 0x40, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00}, {BLOOM_CLEAR, 0x28, 0x46, 0x87, 0xCF, 0xB1, 0x38, 0xD2, 0xFF, 0xFF, 0xFF, 0x60}, // Twilight {BLOOM_CLEAR, 0x2D, 0x46, 0x73, 0xCF, 0xB1, 0x38, 0xD2, 0xFF, 0xFF, 0xFF, @@ -120,40 +120,40 @@ static dkydata_bloomInfo_info_class l_kydata_BloomInf_tbl[BLOOMINFO_MAX] = { /* 803A9198-803A92A8 -00001 0110+00 1/1 0/0 0/0 .data l_darkworld_tbl */ static dKydata_darkworldInfo_c l_darkworld_tbl[34] = { - {"R_SP30", UNCLEARABLE}, // UNUSED - Unknown Room - {"T_SP05", TEST}, // UNUSED - E3 2005 Warp Test (Old) - {"T_SP05A", TEST}, // UNUSED - Ito Warp Test - {"T_WARP2", TEST}, // UNUSED - Unknown Test - {"T_IMAI", TEST}, // UNUSED - Imai Shape Check (Level 2) - {"T_IMAI0", TEST}, // UNUSED - Imai Shape Check (Level 3) - {"T_TOMI", TEST}, // UNUSED - Tominaga Test 1 - {"T_TOMI", TEST}, // UNUSED - Same as above - {"T_TOMI", TEST}, // UNUSED - Same as above - {"T_SASA1", TEST}, // UNUSED - Sasaki Test 1 - {"F_SP105", FARON}, // UNUSED - L1 Forest Field - {"F_SP05", TEST}, // UNUSED - Statue Forest - {"R_SP107", LANAYRU}, // Castle Sewers/Rooftops/Tower - {"F_SP108", FARON}, // Faron Woods - {"R_SP108", FARON}, // Coro's Lantern Shop - {"TEST11", TEST}, // UNUSED - Local Map C - {"F_SP109", ELDIN}, // Kakariko Village - {"F_SP110", ELDIN}, // Death Mountain - {"R_SP109", ELDIN}, // Kakariko Interiors - {"F_SP111", ELDIN}, // Kakariko Graveyard - {"F_SP112", LANAYRU}, // Zora's River - {"F_SP113", LANAYRU}, // Zora's Domain - {"F_SP115", LANAYRU}, // Lake Hylia - {"F_SP116", LANAYRU}, // Hyrule Castle Town - {"F_SP122", LANAYRU}, // Castle Town Gates - {"F_SP121", ELDIN}, // Hyrule Field - {"F_SP126", LANAYRU}, // Upper Zora's River - {"R_SP209", ELDIN}, // Sanctuary Basement - {"R_SP116", LANAYRU}, // Hyrule Castle Town Interiors - {"D_MN08", UNCLEARABLE}, // Palace of Twilight - {"D_MN08B", UNCLEARABLE}, // Palace of Twilight Miniboss A - {"D_MN08C", UNCLEARABLE}, // Palace of Twilight Miniboss B - {"D_MN08A", UNCLEARABLE}, // Palace of Twilight Throne Room - {"D_SB10", FARON}, // Faron Woods Cave + {"R_SP30", KY_DARKLV_UNCLEARABLE}, // UNUSED - Unknown Room + {"T_SP05", KY_DARKLV_TEST}, // UNUSED - E3 2005 Warp Test (Old) + {"T_SP05A", KY_DARKLV_TEST}, // UNUSED - Ito Warp Test + {"T_WARP2", KY_DARKLV_TEST}, // UNUSED - Unknown Test + {"T_IMAI", KY_DARKLV_TEST}, // UNUSED - Imai Shape Check (Level 2) + {"T_IMAI0", KY_DARKLV_TEST}, // UNUSED - Imai Shape Check (Level 3) + {"T_TOMI", KY_DARKLV_TEST}, // UNUSED - Tominaga Test 1 + {"T_TOMI", KY_DARKLV_TEST}, // UNUSED - Same as above + {"T_TOMI", KY_DARKLV_TEST}, // UNUSED - Same as above + {"T_SASA1", KY_DARKLV_TEST}, // UNUSED - Sasaki Test 1 + {"F_SP105", KY_DARKLV_FARON}, // UNUSED - L1 Forest Field + {"F_SP05", KY_DARKLV_TEST}, // UNUSED - Statue Forest + {"R_SP107", KY_DARKLV_LANAYRU}, // Castle Sewers/Rooftops/Tower + {"F_SP108", KY_DARKLV_FARON}, // Faron Woods + {"R_SP108", KY_DARKLV_FARON}, // Coro's Lantern Shop + {"TEST11", KY_DARKLV_TEST}, // UNUSED - Local Map C + {"F_SP109", KY_DARKLV_ELDIN}, // Kakariko Village + {"F_SP110", KY_DARKLV_ELDIN}, // Death Mountain + {"R_SP109", KY_DARKLV_ELDIN}, // Kakariko Interiors + {"F_SP111", KY_DARKLV_ELDIN}, // Kakariko Graveyard + {"F_SP112", KY_DARKLV_LANAYRU}, // Zora's River + {"F_SP113", KY_DARKLV_LANAYRU}, // Zora's Domain + {"F_SP115", KY_DARKLV_LANAYRU}, // Lake Hylia + {"F_SP116", KY_DARKLV_LANAYRU}, // Hyrule Castle Town + {"F_SP122", KY_DARKLV_LANAYRU}, // Castle Town Gates + {"F_SP121", KY_DARKLV_ELDIN}, // Hyrule Field + {"F_SP126", KY_DARKLV_LANAYRU}, // Upper Zora's River + {"R_SP209", KY_DARKLV_ELDIN}, // Sanctuary Basement + {"R_SP116", KY_DARKLV_LANAYRU}, // Hyrule Castle Town Interiors + {"D_MN08", KY_DARKLV_UNCLEARABLE}, // Palace of Twilight + {"D_MN08B", KY_DARKLV_UNCLEARABLE}, // Palace of Twilight Miniboss A + {"D_MN08C", KY_DARKLV_UNCLEARABLE}, // Palace of Twilight Miniboss B + {"D_MN08A", KY_DARKLV_UNCLEARABLE}, // Palace of Twilight Throne Room + {"D_SB10", KY_DARKLV_FARON}, // Faron Woods Cave }; /* 803A92A8-803A93C8 -00001 0120+00 1/1 0/0 0/0 .data l_light_size_tbl */ @@ -211,22 +211,22 @@ static dKydata_lightsizeInfo_c l_light_size_tbl_tw[9] = { // Maple color. Used in Fishing Hole. Values are RGB. TODO: struct here? /* 803A9410-803A9434 006530 0024+00 1/1 0/0 0/0 .data l_maple_col */ -static u8 l_maple_col[36] = { +static color_RGB_class l_maple_col[] = { // leaf color blend major - 0x56, 0x4B, 0x39, // spring - 0x37, 0x28, 0x1E, // summer - 0x6E, 0x32, 0x0F, // fall - 0x64, 0x64, 0x80, // winter + {0x56, 0x4B, 0x39}, // spring + {0x37, 0x28, 0x1E}, // summer + {0x6E, 0x32, 0x0F}, // fall + {0x64, 0x64, 0x80}, // winter // leaf color blend minor - 0x52, 0x41, 0x66, // spring - 0x19, 0x0F, 0x00, // summer - 0x46, 0x00, 0x0F, // fall - 0x64, 0x64, 0x80, // winter + {0x52, 0x41, 0x66}, // spring + {0x19, 0x0F, 0x00}, // summer + {0x46, 0x00, 0x0F}, // fall + {0x64, 0x64, 0x80}, // winter // leaf color base - 0x65, 0x5E, 0x69, // spring - 0x0E, 0x23, 0x0B, // summer - 0x28, 0x14, 0x05, // fall - 0x5A, 0x5A, 0x6E, // winter + {0x65, 0x5E, 0x69}, // spring + {0x0E, 0x23, 0x0B}, // summer + {0x28, 0x14, 0x05}, // fall + {0x5A, 0x5A, 0x6E}, // winter }; /* 803A9434-803A94B8 006554 0084+00 1/1 0/0 0/0 .data l_time_attribute */ @@ -817,7 +817,7 @@ void dKyd_xfog_table_set(u8 tblIdx) { } /* 80056A64-80056A70 0513A4 000C+00 0/0 1/1 0/0 .text dKyd_maple_col_getp__Fv */ -void* dKyd_maple_col_getp() { +color_RGB_class* dKyd_maple_col_getp() { return l_maple_col; } @@ -837,8 +837,8 @@ dKydata_lightsizeInfo_c* dKyd_light_tw_size_tbl_getp() { } /* 80056A94-80056AA8 0513D4 0014+00 0/0 1/1 0/0 .text dKyd_BloomInf_tbl_getp__Fi */ -dkydata_bloomInfo_info_class* dKyd_BloomInf_tbl_getp(int tblIdx) { +dKydata_BloomInfo_c* dKyd_BloomInf_tbl_getp(int tblIdx) { return &l_kydata_BloomInf_tbl[tblIdx]; } -/* 8037A1C0-8037A1C0 006820 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ \ No newline at end of file +/* 8037A1C0-8037A1C0 006820 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ diff --git a/src/d/d_kankyo_rain.cpp b/src/d/d_kankyo_rain.cpp index 46b7f520ad..5dea9cd4bb 100644 --- a/src/d/d_kankyo_rain.cpp +++ b/src/d/d_kankyo_rain.cpp @@ -150,7 +150,7 @@ void dKyr_lenzflare_move() { /* 8005BED8-8005BF08 056818 0030+00 1/1 0/0 0/0 .text dKyr_moon_arrival_check__Fv */ static BOOL dKyr_moon_arrival_check() { BOOL rv = FALSE; - if (g_env_light.mDaytime > 285.0f || g_env_light.mDaytime < 67.5f) { + if (g_env_light.daytime > 285.0f || g_env_light.daytime < 67.5f) { rv = TRUE; } return rv; @@ -175,11 +175,11 @@ void dKyr_sun_move() { u32 stage_type = dStage_stagInfo_GetSTType(dComIfGp_getStage()->getStagInfo()); - if (g_env_light.mBaseLightInfluence.mColor.r == 0 && stage_type != ST_ROOM) { - dKyr_get_vectle_calc(&camera_p2->lookat.eye, &g_env_light.mBaseLightInfluence.mPosition, + if (g_env_light.base_light.mColor.r == 0 && stage_type != ST_ROOM) { + dKyr_get_vectle_calc(&camera_p2->lookat.eye, &g_env_light.base_light.mPosition, &lightDir); } else { - dKyr_get_vectle_calc(&camera_p2->lookat.eye, &g_env_light.mSunPos2, &lightDir); + dKyr_get_vectle_calc(&camera_p2->lookat.eye, &g_env_light.sun_light_pos, &lightDir); } sun_packet->mPos[0].x = camera_p2->lookat.eye.x + 8000.0f * lightDir.x; @@ -209,7 +209,7 @@ void dKyr_sun_move() { sun_packet->field_0x29 = 0; - if (g_env_light.mDaytime > 77.5f && g_env_light.mDaytime < 285.0f && dKy_rain_check() < 20 && + if (g_env_light.daytime > 77.5f && g_env_light.daytime < 285.0f && dKy_rain_check() < 20 && strcmp(dComIfGp_getStartStageName(), "F_SP200") != 0 && strcmp(dComIfGp_getStartStageName(), "D_MN09B") != 0) { @@ -334,7 +334,7 @@ void dKyr_sun_move() { } } - if (g_env_light.mDaytime < 255.0f && g_env_light.mColpatWeather == 0) { + if (g_env_light.daytime < 255.0f && g_env_light.mColpatWeather == 0) { cLib_addCalc(&sun_packet->field_0x6c, 1.0f, 0.1f, 0.01f, 0.0001f); } else { cLib_addCalc(&sun_packet->field_0x6c, 0.0f, 0.5f, 0.1f, 0.001f); @@ -351,12 +351,12 @@ void dKyr_sun_move() { {255, 78, 0, 255}, }; - if (g_env_light.mDaytime < 180.0f) { + if (g_env_light.daytime < 180.0f) { f32 parcent; - if (g_env_light.mDaytime < 90.0f) { + if (g_env_light.daytime < 90.0f) { parcent = 0.0f; - } else if (g_env_light.mDaytime < 105.0f) { - parcent = dKy_get_parcent(105.0f, 90.0f, g_env_light.mDaytime); + } else if (g_env_light.daytime < 105.0f) { + parcent = dKy_get_parcent(105.0f, 90.0f, g_env_light.daytime); } else { parcent = 1.0f; } @@ -376,10 +376,10 @@ void dKyr_sun_move() { (f32)sun_color2[0].b + parcent * ((f32)sun_color2[1].b - (f32)sun_color2[0].b); } else { f32 parcent; - if (g_env_light.mDaytime < 247.5f) { + if (g_env_light.daytime < 247.5f) { parcent = 1.0f; - } else if (g_env_light.mDaytime < 270.0f) { - parcent = 1.0f - dKy_get_parcent(270.0f, 247.5f, g_env_light.mDaytime); + } else if (g_env_light.daytime < 270.0f) { + parcent = 1.0f - dKy_get_parcent(270.0f, 247.5f, g_env_light.daytime); } else { parcent = 0.0f; } @@ -413,11 +413,11 @@ void dKyr_sun_move() { cLib_addCalc(&sun_packet->mMoonAlpha, 0.0f, 0.2f, 0.01f, 0.001f); } - if (g_env_light.mCameraInWater == 0 && g_env_light.mDaytime > 255.0f && + if (g_env_light.camera_water_in_status == 0 && g_env_light.daytime > 255.0f && sun_packet->mSunAlpha >= 0.2f) { cXyz sp24; - dKyr_get_vectle_calc(&camera_p2->lookat.eye, &g_env_light.mSunPos2, &lightDir); + dKyr_get_vectle_calc(&camera_p2->lookat.eye, &g_env_light.sun_light_pos, &lightDir); sp24.x = camera_p2->lookat.eye.x + 30160.0f * lightDir.x; sp24.y = camera_p2->lookat.eye.y + 30160.0f * lightDir.y; sp24.z = camera_p2->lookat.eye.z + 30160.0f * lightDir.z; @@ -447,7 +447,7 @@ void dKyr_rain_init() { for (int i = 0; i < 250; i++) { g_env_light.mpRainPacket->mRainEff[i].mStatus = 0; } - g_env_light.mpRainPacket->mRainCount = 0; + g_env_light.mpRainPacket->raincnt = 0; } /* 8005CDA8-8005CDD0 0576E8 0028+00 1/1 0/0 0/0 .text rain_bg_chk__FP19dKankyo_rain_Packeti */ @@ -557,11 +557,11 @@ void dKyr_rain_move() { spA4.y = -2.5f; spA4.z = 0.0f; - if (rain_packet->mRainCount <= g_env_light.mRainCount) { - rain_packet->mRainCount = g_env_light.mRainCount; + if (rain_packet->raincnt <= g_env_light.raincnt) { + rain_packet->raincnt = g_env_light.raincnt; } - if (rain_packet->mRainCount != 0) { + if (rain_packet->raincnt != 0) { dKyr_get_vectle_calc(&camera->lookat.center, &rain_packet->mCamCenterPos, &spB0); f32 var_f1 = rain_packet->mCamEyePos.abs(camera->lookat.eye); @@ -674,7 +674,7 @@ void dKyr_rain_move() { } f32 temp_f30 = 1.0f; - for (int i = rain_packet->mRainCount - 1; i >= 0; i--) { + for (int i = rain_packet->raincnt - 1; i >= 0; i--) { rain_packet->mRainEff[i].mBasePos.y = spE0.y; RAIN_EFF* effect = &rain_packet->mRainEff[i]; @@ -767,9 +767,9 @@ void dKyr_rain_move() { spBC.y = effect->mBasePos.y + effect->mPosition.y; spBC.z = effect->mBasePos.z + effect->mPosition.z; - if (i > g_env_light.mRainCount - 1) { - if (i == rain_packet->mRainCount - 1) { - rain_packet->mRainCount--; + if (i > g_env_light.raincnt - 1) { + if (i == rain_packet->raincnt - 1) { + rain_packet->raincnt--; } } @@ -969,7 +969,7 @@ void dKyr_housi_move() { if (g_env_light.field_0xea9 == 1) { var_f31 = 0.0f; - if (g_env_light.mCameraInWater) { + if (g_env_light.camera_water_in_status) { dBgS_CamGndChk_Wtr sp90; cXyz sp48; @@ -1052,7 +1052,7 @@ void dKyr_housi_move() { effect->mPosition.y -= var_f23 * 0.6f; if (g_env_light.field_0xea9 == 2) { - if (g_env_light.mPondSeason == 3) { + if (g_env_light.fishing_hole_season == 3) { effect->mPosition.y -= var_f23 * 3.0f; } else { effect->mPosition.y -= var_f23 * 1.5f; @@ -1183,7 +1183,7 @@ void dKyr_housi_move() { effect->mPosition.y = 3200.0f - effect->mBasePos.y; } - if (g_env_light.mPondSeason == 1) { + if (g_env_light.fishing_hole_season == 1) { if (sp6C.x > 600.0f || sp6C.z > 1600.0f) { effect->mStatus = 1; } else { @@ -1791,7 +1791,7 @@ void cloud_shadow_move() { } else if (g_env_light.mMoyaMode == 4) { alpha_max = 0.38f * dKyw_get_wind_pow(); } else if (g_env_light.mMoyaMode == 50) { - alpha_max = 0.25f * (envlight->field_0xf40 * envlight->field_0xf40 * envlight->field_0xf40); + alpha_max = 0.25f * (envlight->senses_effect_strength * envlight->senses_effect_strength * envlight->senses_effect_strength); packet->mCloudEff[i].mAlpha = alpha_max * alpha_target; } else if (g_env_light.mMoyaMode == 5) { alpha_max = 0.09f; @@ -2058,8 +2058,8 @@ static void dKyr_draw_rev_moon(Mtx drawMtx, u8** tex) { cXyz pos[4]; u16 date = dComIfGs_getDate(); - cXyz sp60 = camera->lookat.eye + g_env_light.mMoonPos; - sp60.y = camera->lookat.eye.y - g_env_light.mMoonPos.y; + cXyz sp60 = camera->lookat.eye + g_env_light.moon_pos; + sp60.y = camera->lookat.eye.y - g_env_light.moon_pos.y; cXyz moon_pos; moon_pos.x = sp60.x - camera->lookat.eye.x; @@ -2117,9 +2117,9 @@ static void dKyr_draw_rev_moon(Mtx drawMtx, u8** tex) { } GXColor color_reg0; - color_reg0.r = g_env_light.mFogColor.r; - color_reg0.g = g_env_light.mFogColor.g; - color_reg0.b = g_env_light.mFogColor.b; + color_reg0.r = g_env_light.fog_col.r; + color_reg0.g = g_env_light.fog_col.g; + color_reg0.b = g_env_light.fog_col.b; color_reg0.a = 0xFF; GXColor color_reg1; @@ -2368,8 +2368,8 @@ void dKyr_drawSun(Mtx drawMtx, cXyz* ppos, GXColor& unused, u8** tex) { sunpos.z = ppos->z; u32 stage_type = dStage_stagInfo_GetSTType(dComIfGp_getStage()->getStagInfo()); - if (g_env_light.mBaseLightInfluence.mColor.r == 0 && stage_type != ST_ROOM) { - if (g_env_light.mDaytime > 285.0f || g_env_light.mDaytime < 105.0f) { + if (g_env_light.base_light.mColor.r == 0 && stage_type != ST_ROOM) { + if (g_env_light.daytime > 285.0f || g_env_light.daytime < 105.0f) { draw_moon = false; } @@ -2378,10 +2378,10 @@ void dKyr_drawSun(Mtx drawMtx, cXyz* ppos, GXColor& unused, u8** tex) { spB4.z = ppos->z; } else { if (strcmp(dComIfGp_getStartStageName(), "F_SP200") == 0 && dComIfG_play_c::getLayerNo(0) == 0) { - spB4 = envlight->mMoonPos; + spB4 = envlight->moon_pos; moon_pos = spB4; } else { - spB4 = camera->lookat.eye + envlight->mMoonPos; + spB4 = camera->lookat.eye + envlight->moon_pos; moon_pos.x = spB4.x - camera->lookat.eye.x; moon_pos.y = spB4.y - camera->lookat.eye.y; moon_pos.z = spB4.z - camera->lookat.eye.z; @@ -2460,9 +2460,9 @@ void dKyr_drawSun(Mtx drawMtx, cXyz* ppos, GXColor& unused, u8** tex) { } GXColor color_reg0; - color_reg0.r = g_env_light.mFogColor.r; - color_reg0.g = g_env_light.mFogColor.g; - color_reg0.b = g_env_light.mFogColor.b; + color_reg0.r = g_env_light.fog_col.r; + color_reg0.g = g_env_light.fog_col.g; + color_reg0.b = g_env_light.fog_col.b; color_reg0.a = 0xFF; GXColor color_reg1; @@ -3124,12 +3124,12 @@ void dKyr_drawRain(Mtx drawMtx, u8** tex) { cXyz sp3C; cXyz sp30; - if (g_env_light.mSnowCount == 0 && !g_env_light.mCameraInWater) { + if (g_env_light.mSnowCount == 0 && !g_env_light.camera_water_in_status) { sp30.x = 0.0f; sp30.y = -2.0f; sp30.z = 0.0f; - if (rain_packet->mRainCount != 0) { + if (rain_packet->raincnt != 0) { GXColor color_reg0; color_reg0.r = 0xFF; color_reg0.g = 0xFF; @@ -3166,7 +3166,7 @@ void dKyr_drawRain(Mtx drawMtx, u8** tex) { GXLoadPosMtxImm(drawMtx, GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); - for (int i = 0; i < rain_packet->mRainCount; i++) { + for (int i = 0; i < rain_packet->raincnt; i++) { f32 temp_f30 = -1.0f; if (!(rain_packet->mRainEff[i].mAlpha <= 0.0f)) { @@ -3263,7 +3263,7 @@ void dKyr_drawSibuki(Mtx drawMtx, u8** tex) { cXyz eyevect; cXyz sp38; - if (g_env_light.mSnowCount == 0 && g_env_light.mCameraInWater == 0 && dComIfGd_getView() != NULL) { + if (g_env_light.mSnowCount == 0 && g_env_light.camera_water_in_status == 0 && dComIfGd_getView() != NULL) { Mtx camMtx; MTXInverse(dComIfGd_getView()->viewMtxNoTrans, camMtx); } else { @@ -3340,7 +3340,7 @@ void dKyr_drawSibuki(Mtx drawMtx, u8** tex) { scale = 0.2f; } - for (int i = 0; i < g_env_light.mRainCount >> 1; i++) { + for (int i = 0; i < g_env_light.raincnt >> 1; i++) { cXyz pos[4]; f32 size = scale * (15.0f + cM_rndF(10.0f)); cXyz sp20; @@ -3415,7 +3415,7 @@ void dKyr_drawHousi(Mtx drawMtx, u8** tex) { if (g_env_light.field_0xea9 == 1) { var_f25 = 140.0f; - } else if (g_env_light.mCameraInWater != 0) { + } else if (g_env_light.camera_water_in_status != 0) { return; } @@ -3452,13 +3452,13 @@ void dKyr_drawHousi(Mtx drawMtx, u8** tex) { color_reg1.g = 0x50; color_reg1.b = 0x50; } else if (g_env_light.field_0xea9 == 2 && - (g_env_light.mPondSeason == 1 || g_env_light.mPondSeason == 3)) + (g_env_light.fishing_hole_season == 1 || g_env_light.fishing_hole_season == 3)) { GXColor sp1C = {0x32, 0x32, 0x32, 0xFF}; GXColor sp18 = {0xFF, 0xD7, 0xF0, 0xFF}; camera_class* cam_p = dComIfGp_getCamera(0); - if (g_env_light.mPondSeason == 3) { + if (g_env_light.fishing_hole_season == 3) { sp1C.r = 0x78; sp1C.g = 0x0A; sp1C.b = 0x14; @@ -3630,7 +3630,7 @@ void dKyr_drawHousi(Mtx drawMtx, u8** tex) { } f32 var_f2; - if (g_env_light.mPondSeason == 3) { + if (g_env_light.fishing_hole_season == 3) { var_f2 = 15.0f; if (housi_packet->mHousiEff[j].mStatus == 1) { @@ -3665,7 +3665,7 @@ void dKyr_drawHousi(Mtx drawMtx, u8** tex) { mDoMtx_stack_c::ZrotM(housi_packet->mHousiEff[j].field_0x38); } else { if (housi_packet->mHousiEff[j].mStatus == 2) { - if (g_env_light.mPondSeason == 3) { + if (g_env_light.fishing_hole_season == 3) { housi_packet->mHousiEff[j].field_0x38 += var_f24 * 30.0f; } else { housi_packet->mHousiEff[j].field_0x38 += @@ -3793,7 +3793,7 @@ void dKyr_drawSnow(Mtx drawMtx, u8** tex) { sp54 = snow_packet->field_0x6d88; } - if (!g_env_light.mCameraInWater) { + if (!g_env_light.camera_water_in_status) { dKy_ParticleColor_get_bg(&camera->lookat.eye, NULL, &sp64, &sp60, &sp5C, &sp58, 0.0f); color_reg0.r = 178.5f + (0.3f * sp60.r); color_reg0.g = 178.5f + (0.3f * sp60.g); @@ -4113,9 +4113,9 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) { } if (strcmp(dComIfGp_getStartStageName(), "F_SP200") == 0 && dComIfG_play_c::getLayerNo(0) == 0) { - moon_pos = envlight->mMoonPos; + moon_pos = envlight->moon_pos; } else { - moon_pos = camera->lookat.eye + envlight->mMoonPos; + moon_pos = camera->lookat.eye + envlight->moon_pos; if (sp38) { moon_pos.x = 3900.0f + camera->lookat.eye.x; moon_pos.y = 8052.0f + camera->lookat.eye.y; @@ -4615,7 +4615,7 @@ void drawVrkumo(Mtx drawMtx, GXColor& color, u8** tex) { unused = 1.0f - (0.09f * (camera->lookat.eye.y - sp70)); } - if (g_env_light.mDaytime > 105.0f && g_env_light.mDaytime < 240.0f && !dComIfGp_event_runCheck() && sun_packet != NULL && sun_packet->mSunAlpha > 0.0f) { + if (g_env_light.daytime > 105.0f && g_env_light.daytime < 240.0f && !dComIfGp_event_runCheck() && sun_packet != NULL && sun_packet->mSunAlpha > 0.0f) { mDoLib_project(&sun_packet->mPos[0], &proj); if (proj.x > 0.0f && proj.x < 608.0f && proj.y > spC4 && proj.y < (458.0f - spC4)) { pass = 0; @@ -4631,9 +4631,9 @@ void drawVrkumo(Mtx drawMtx, GXColor& color, u8** tex) { } for (j = 0; j < 3; j++) { - color.r = g_env_light.mVrShitaGumoCol.r; - color.g = g_env_light.mVrShitaGumoCol.g; - color.b = g_env_light.mVrShitaGumoCol.b; + color.r = g_env_light.vrbox_kumo_bottom_col.r; + color.g = g_env_light.vrbox_kumo_bottom_col.g; + color.b = g_env_light.vrbox_kumo_bottom_col.b; GXColor color_reg1; color_reg1.r = 0; @@ -4736,9 +4736,9 @@ void drawVrkumo(Mtx drawMtx, GXColor& color, u8** tex) { } else { f32 sp4C = 1.0f - vrkumo_packet->mVrkumoEff[k].mDistFalloff; - color.r = (f32)g_env_light.mVrkumoCol.r + (sp4C * ((f32)g_env_light.mVrShitaGumoCol.r - (f32)g_env_light.mVrkumoCol.r)); - color.g = (f32)g_env_light.mVrkumoCol.g + (sp4C * ((f32)g_env_light.mVrShitaGumoCol.g - (f32)g_env_light.mVrkumoCol.g)); - color.b = (f32)g_env_light.mVrkumoCol.b + (sp4C * ((f32)g_env_light.mVrShitaGumoCol.b - (f32)g_env_light.mVrkumoCol.b)); + color.r = (f32)g_env_light.vrbox_kumo_top_col.r + (sp4C * ((f32)g_env_light.vrbox_kumo_bottom_col.r - (f32)g_env_light.vrbox_kumo_top_col.r)); + color.g = (f32)g_env_light.vrbox_kumo_top_col.g + (sp4C * ((f32)g_env_light.vrbox_kumo_bottom_col.g - (f32)g_env_light.vrbox_kumo_top_col.g)); + color.b = (f32)g_env_light.vrbox_kumo_top_col.b + (sp4C * ((f32)g_env_light.vrbox_kumo_bottom_col.b - (f32)g_env_light.vrbox_kumo_top_col.b)); color.a = 255.0f * vrkumo_packet->mVrkumoEff[k].mAlpha; if (j == 1) { @@ -5308,7 +5308,7 @@ void dKyr_odour_draw(Mtx drawMtx, u8** tex) { return; } - if (envlight->field_0xf40 <= 0.0f || envlight->field_0xf3d != 1) { + if (envlight->senses_effect_strength <= 0.0f || envlight->now_senses_effect != 1) { return; } @@ -5449,7 +5449,7 @@ void dKyr_odour_draw(Mtx drawMtx, u8** tex) { var_f31 = 1.0f; } - f32 temp_f29 = var_f31 * (effect->field_0x28 * (effect->field_0x24 * (envlight->field_0xf40 * envlight->field_0xf40 * envlight->field_0xf40))); + f32 temp_f29 = var_f31 * (effect->field_0x28 * (effect->field_0x24 * (envlight->senses_effect_strength * envlight->senses_effect_strength * envlight->senses_effect_strength))); if (effect->mStatus != 0) { if (!(temp_f29 <= 0.000001f)) { @@ -5557,7 +5557,7 @@ void dKyr_mud_move() { } if (g_env_light.field_0x1048 != 0) { - if (strcmp(dComIfGp_getStartStageName(), "D_MN05A") == 0 && g_env_light.mColPatCurr == 6) { + if (strcmp(dComIfGp_getStartStageName(), "D_MN05A") == 0 && g_env_light.wether_pat1 == 6) { dComIfGs_PolyDamageOff_Set(1); cLib_addCalc(&mud_packet->field_0x1c3c, 0.0f, 0.1f, 0.001f, 0.000001f); } else { @@ -5690,7 +5690,7 @@ void dKyr_mud_draw(Mtx drawMtx, u8** tex) { GXColor color_reg1; camera_class* sp34 = (camera_class*)dComIfGp_getCamera(0); - s16 spC = g_env_light.mTerrainAmbienceBG[1].a; + s16 spC = g_env_light.bg_amb_col[1].a; dKankyo_sunlenz_Packet* lenz_packet = g_env_light.mpSunLenzPacket; if (mud_packet->mEffectNum != 0) { @@ -5701,9 +5701,9 @@ void dKyr_mud_draw(Mtx drawMtx, u8** tex) { spC = g_env_light.field_0x1300; } - sp50.r = 1.3f * g_env_light.mTerrainAmbienceBG[1].r; - sp50.g = 1.3f * g_env_light.mTerrainAmbienceBG[1].g; - sp50.b = 1.3f * g_env_light.mTerrainAmbienceBG[1].b; + sp50.r = 1.3f * g_env_light.bg_amb_col[1].r; + sp50.g = 1.3f * g_env_light.bg_amb_col[1].g; + sp50.b = 1.3f * g_env_light.bg_amb_col[1].b; if (sp50.r >= 0xFF) { sp50.r = 0xFF; @@ -5728,9 +5728,9 @@ void dKyr_mud_draw(Mtx drawMtx, u8** tex) { var_f31 = (u8)(var_f31 * (1.0f - (sun_packet->mVisibility * (1.0f - (lenz_packet->mDistFalloff * lenz_packet->mDistFalloff * lenz_packet->mDistFalloff))))); } - color_reg1.r = 0.5f * g_env_light.mTerrainAmbienceBG[1].r; - color_reg1.g = 0.5f * g_env_light.mTerrainAmbienceBG[1].g; - color_reg1.b = 0.5f * g_env_light.mTerrainAmbienceBG[1].b; + color_reg1.r = 0.5f * g_env_light.bg_amb_col[1].r; + color_reg1.g = 0.5f * g_env_light.bg_amb_col[1].g; + color_reg1.b = 0.5f * g_env_light.bg_amb_col[1].b; color_reg1.a = 0xFF; if (strcmp(dComIfGp_getStartStageName(), "D_MN05A") == 0) { @@ -5765,7 +5765,7 @@ void dKyr_mud_draw(Mtx drawMtx, u8** tex) { return; } - if (g_env_light.mCameraInWater == 0) { + if (g_env_light.camera_water_in_status == 0) { for (int i = 0; i < 1; i++) { GXTexObj texobj; dKyr_set_btitex(&texobj, (ResTIMG*)tex[0]); @@ -5784,7 +5784,7 @@ void dKyr_mud_draw(Mtx drawMtx, u8** tex) { GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET); GXSetAlphaCompare(GX_GREATER, 0, GX_AOP_OR, GX_GREATER, 0); - if (g_env_light.mCameraInWater != 0) { + if (g_env_light.camera_water_in_status != 0) { GXSetZMode(GX_DISABLE, GX_LEQUAL, GX_ENABLE); } else { GXSetZMode(GX_ENABLE, GX_LEQUAL, GX_DISABLE); diff --git a/src/d/d_kankyo_wether.cpp b/src/d/d_kankyo_wether.cpp index 5e196dd573..49c15c27ab 100644 --- a/src/d/d_kankyo_wether.cpp +++ b/src/d/d_kankyo_wether.cpp @@ -300,7 +300,7 @@ void dKyw_wether_init() { g_env_light.mThunderEff.mStatus = 0; g_env_light.mThunderEff.mMode = 0; g_env_light.mRainInitialized = false; - g_env_light.mRainCount = 0; + g_env_light.raincnt = 0; g_env_light.mSnowInitialized = false; g_env_light.field_0xe92 = 0; g_env_light.mSnowCount = 0; @@ -326,7 +326,7 @@ void dKyw_wether_init() { g_env_light.mEvilInitialized = 0; g_env_light.field_0x1054 = 0; g_env_light.field_0x1051 = 0; - g_env_light.field_0xe60 = 0.0f; + g_env_light.unk_0xe60 = 0.0f; dKyw_wind_init(); dKyw_pntwind_init(); @@ -487,7 +487,7 @@ void dKyw_wether_move() { /* 80058318-80058894 052C58 057C+00 1/1 0/0 0/0 .text wether_move_sun__Fv */ static void wether_move_sun() { s32 sunVisible = false; - if (dComIfGp_checkStatus(1) && !g_env_light.mVrboxInvisible) { + if (dComIfGp_checkStatus(1) && !g_env_light.hide_vrbox) { roomRead_class* room = dComIfGp_getStageRoom(); if (room != NULL && room->field_0x0 > dComIfGp_roomControl_getStayNo()) { sunVisible = dStage_roomRead_dt_c_GetVrboxswitch( @@ -542,7 +542,7 @@ static void wether_move_sun() { g_env_light.mpSunPacket->field_0x64 = 0.0f; g_env_light.mpSunPacket->mMoonAlpha = 0.0f; - if (g_env_light.mDaytime < 255.0f) { + if (g_env_light.daytime < 255.0f) { g_env_light.mpSunPacket->field_0x6c = 1.0f; } else { g_env_light.mpSunPacket->field_0x6c = 0.0f; @@ -590,7 +590,7 @@ static void wether_move_sun() { static void wether_move_rain() { switch (g_env_light.mRainInitialized) { case FALSE: - if (g_env_light.mRainCount > 3) { + if (g_env_light.raincnt > 3) { g_env_light.mpRainPacket = new (32) dKankyo_rain_Packet(); if (g_env_light.mpRainPacket != NULL) { @@ -598,7 +598,7 @@ static void wether_move_rain() { dKyr_rain_move(); g_env_light.mRainInitialized = 1; - if (g_env_light.mRainCount != 250) { + if (g_env_light.raincnt != 250) { mDoAud_seStart(JA_SE_ATM_RAIN_START, NULL, 0, 0); } } @@ -611,7 +611,7 @@ static void wether_move_rain() { if (g_env_light.mSnowCount == 0 && cam != NULL) { // Stage is not Fishing Pond if (strcmp(dComIfGp_getStartStageName(), "R_SP127") || cam->lookat.eye.y > 0.0f) { - if (g_env_light.mRainCount < 125.0f) { + if (g_env_light.raincnt < 125.0f) { mDoAud_rainPlay(FALSE); } else { mDoAud_rainPlay(TRUE); @@ -619,7 +619,7 @@ static void wether_move_rain() { } } - if (g_env_light.mRainCount <= 3) { + if (g_env_light.raincnt <= 3) { g_env_light.mRainInitialized = 0; mDoAud_seStart(JA_SE_ATM_RAIN_END, NULL, 0, 0); delete g_env_light.mpRainPacket; @@ -657,7 +657,7 @@ static void wether_move_star() { return; } else { // Stage is Hero Shade arena - if ((dComIfGp_checkStatus(1) && !g_env_light.mVrboxInvisible) || + if ((dComIfGp_checkStatus(1) && !g_env_light.hide_vrbox) || !strcmp(dComIfGp_getStartStageName(), "F_SP200")) { roomRead_class* room = dComIfGp_getStageRoom(); @@ -690,7 +690,7 @@ static void wether_move_star() { density = 0.0f; } - if (g_env_light.mColPatCurr != 0 && g_env_light.mColPatBlend > 0.5f) { + if (g_env_light.wether_pat1 != 0 && g_env_light.pat_ratio > 0.5f) { density = 0.0f; } @@ -758,7 +758,7 @@ static void wether_move_housi() { (!strcmp(dComIfGp_getStartStageName(), "F_SP115") && dComIfGp_roomControl_getStayNo() == 1 && dComIfGp_getStartStageLayer() == 9)) { - if (g_env_light.mInitAnmTimer != 0) { + if (g_env_light.light_init_timer != 0) { g_env_light.field_0xea9 = 0; g_env_light.mHousiCount = 200; @@ -790,7 +790,7 @@ static void wether_move_housi() { g_env_light.mpHousiPacket->mpResTex = (u8*)dComIfG_getObjectRes("Always", 0x5E); } else { if (g_env_light.field_0xea9 == 2) { - if (g_env_light.mPondSeason == 3) { + if (g_env_light.fishing_hole_season == 3) { g_env_light.mpHousiPacket->mpResTex = (u8*)dComIfG_getStageRes("momiji64s3tc.bti"); } else { @@ -914,7 +914,7 @@ static void wether_move_vrkumo() { BOOL var_r31 = false; static cXyz r09o(-180000.0f, 750.0f, -200000.0f); - if (dComIfGp_checkStatus(1) && !g_env_light.mVrboxInvisible) { + if (dComIfGp_checkStatus(1) && !g_env_light.hide_vrbox) { g_env_light.mVrkumoCount = 6; if (memcmp(dComIfGp_getStartStageName(), "D_MN07", 6) == 0 || @@ -926,15 +926,15 @@ static void wether_move_vrkumo() { } else if (strcmp(dComIfGp_getStartStageName(), "F_SP104") == 0 && dComIfG_play_c::getLayerNo(0) >= 3) { - if (g_env_light.mColPatCurr >= 4) { + if (g_env_light.wether_pat1 >= 4) { cLib_addCalc(&g_env_light.mVrkumoStrength, 1.0f, 0.1f, 0.003f, 0.0000001f); } else { cLib_addCalc(&g_env_light.mVrkumoStrength, 0.0f, 0.08f, 0.002f, 0.00000001f); } - } else if ((g_env_light.mColPatCurr == 1 && g_env_light.mColPatBlend > 0.0f) || - (g_env_light.mColPatPrev == 1 && g_env_light.mColPatBlend < 1.0f) || - (g_env_light.mColPatCurr == 2 && g_env_light.mColPatBlend > 0.0f) || - (g_env_light.mColPatPrev == 2 && g_env_light.mColPatBlend < 1.0f)) + } else if ((g_env_light.wether_pat1 == 1 && g_env_light.pat_ratio > 0.0f) || + (g_env_light.wether_pat0 == 1 && g_env_light.pat_ratio < 1.0f) || + (g_env_light.wether_pat1 == 2 && g_env_light.pat_ratio > 0.0f) || + (g_env_light.wether_pat0 == 2 && g_env_light.pat_ratio < 1.0f)) { cLib_addCalc(&g_env_light.mVrkumoStrength, 1.0f, 0.1f, 0.003f, 0.0000001f); } else { @@ -1000,10 +1000,10 @@ static void wether_move_vrkumo() { dKyw_get_wind_vec(); cXyz sp8; - f32 wind_vec_x = g_env_light.mWind.vec.x; - f32 wind_vec_y = g_env_light.mWind.vec.y; - f32 wind_vec_z = g_env_light.mWind.vec.z; - f32 var_f31 = g_env_light.mWind.pow; + f32 wind_vec_x = g_env_light.global_wind_influence.vec.x; + f32 wind_vec_y = g_env_light.global_wind_influence.vec.y; + f32 wind_vec_z = g_env_light.global_wind_influence.vec.z; + f32 var_f31 = g_env_light.global_wind_influence.pow; if (strcmp(dComIfGp_getStartStageName(), "R_SP127") == 0) { var_f31 = 0.3f; @@ -1097,7 +1097,7 @@ static void wether_move_evil() { /* 8005A0B8-8005A154 0549F8 009C+00 0/0 1/1 0/0 .text dKyw_wether_move_draw__Fv */ void dKyw_wether_move_draw() { - g_env_light.mMoyaSE = 0; + g_env_light.moya_se = 0; if (strcmp(dComIfGp_getStartStageName(), "Name")) { wether_move_sun(); @@ -1182,16 +1182,16 @@ void dKyw_wether_proc() { if (!strcmp(dComIfGp_getStartStageName(), "F_SP108") || !strcmp(dComIfGp_getStartStageName(), "F_SP127") || (!strcmp(dComIfGp_getStartStageName(), "F_SP121") && - g_env_light.mDiceWeatherTime != 0.0f)) + g_env_light.dice_wether_time != 0.0f)) { if (!dKy_darkworld_check()) { // Stage is Hyrule Field if (!strcmp(dComIfGp_getStartStageName(), "F_SP121") || - !(g_env_light.mDaytime >= 75.0f) || !(g_env_light.mDaytime <= 120.0f)) + !(g_env_light.daytime >= 75.0f) || !(g_env_light.daytime <= 120.0f)) { // Stage is Hyrule Field if (!strcmp(dComIfGp_getStartStageName(), "F_SP121") && - g_env_light.mDiceWeatherMode >= 1 && g_env_light.mDiceWeatherMode < 6) + g_env_light.dice_wether_mode >= 1 && g_env_light.dice_wether_mode < 6) { dKy_get_dayofweek(); lbl1: @@ -1212,9 +1212,9 @@ lbl1: // Stage is Fishing Pond if (!strcmp(dComIfGp_getStartStageName(), "F_SP127") && - (g_env_light.mPondSeason == 1 || g_env_light.mPondSeason == 3)) + (g_env_light.fishing_hole_season == 1 || g_env_light.fishing_hole_season == 3)) { - if (g_env_light.mPondSeason == 1) { + if (g_env_light.fishing_hole_season == 1) { g_env_light.mHousiCount = 35; } else { g_env_light.mHousiCount = 30; @@ -1226,17 +1226,17 @@ lbl1: /* 8005A57C-8005A5C0 054EBC 0044+00 1/1 0/0 0/0 .text dKyw_wind_init__Fv */ static void dKyw_wind_init() { - g_env_light.mWind.vec.x = -1.0f; - g_env_light.mWind.vec.y = 0.0f; - g_env_light.mWind.vec.z = 0.0f; - g_env_light.mWind.pow = 0.0f; - g_env_light.field_0xe6c = 0; - g_env_light.field_0xe64 = 0; - g_env_light.field_0xe66 = 0; - g_env_light.mWind.vec_override = 0; + g_env_light.global_wind_influence.vec.x = -1.0f; + g_env_light.global_wind_influence.vec.y = 0.0f; + g_env_light.global_wind_influence.vec.z = 0.0f; + g_env_light.global_wind_influence.pow = 0.0f; + g_env_light.unk_0xe6c = 0; + g_env_light.unk_0xe64 = 0; + g_env_light.unk_0xe66 = 0; + g_env_light.global_wind_influence.vec_override = NULL; g_env_light.custom_windpower = 0.0f; - g_env_light.mEvtWindSet = 0; - g_env_light.mTeachWindExist = 0; + g_env_light.evt_wind_go = 0; + g_env_light.TeachWind_existence = 0; } /* 8005A5C0-8005AAE0 054F00 0520+00 0/0 2/2 0/0 .text dKyw_wind_set__Fv */ @@ -1248,8 +1248,8 @@ void dKyw_wind_set() { cXyz wind_vec; f32 strength; - if (g_env_light.mWind.vec_override != NULL) { - wind_vec = *g_env_light.mWind.vec_override; + if (g_env_light.global_wind_influence.vec_override != NULL) { + wind_vec = *g_env_light.global_wind_influence.vec_override; strength = g_env_light.custom_windpower; cM_atan2s(wind_vec.x, wind_vec.z); @@ -1305,9 +1305,9 @@ void dKyw_wind_set() { break; } - if (g_env_light.mEvtWindSet != 0 && g_env_light.mEvtWindSet != 0xFF) { - var_r30 = g_env_light.mEvtWindAngleX; - var_r29 = g_env_light.mEvtWindAngleY; + if (g_env_light.evt_wind_go != 0 && g_env_light.evt_wind_go != 0xFF) { + var_r30 = g_env_light.evt_wind_angle_x; + var_r29 = g_env_light.evt_wind_angle_y; } wind_vec.x = cM_scos(var_r30) * cM_ssin(var_r29); @@ -1348,7 +1348,7 @@ void dKyw_wind_set() { } } - if (g_env_light.mEvtWindSet != 0) { + if (g_env_light.evt_wind_go != 0) { strength = g_env_light.custom_windpower; } @@ -1371,30 +1371,30 @@ void dKyw_wind_set() { mDoAud_mEnvse_startStrongWindSe(reverb); } - if (g_env_light.mInitAnmTimer != 0) { - g_env_light.mWind.vec = wind_vec; - g_env_light.mWind.pow = strength; + if (g_env_light.light_init_timer != 0) { + g_env_light.global_wind_influence.vec = wind_vec; + g_env_light.global_wind_influence.pow = strength; } else { - cLib_addCalc(&g_env_light.mWind.vec.x, wind_vec.x, 0.05f, 2.0f, 0.001f); - cLib_addCalc(&g_env_light.mWind.vec.y, wind_vec.y, 0.05f, 2.0f, 0.001f); - cLib_addCalc(&g_env_light.mWind.vec.z, wind_vec.z, 0.05f, 2.0f, 0.001f); - cLib_addCalc(&g_env_light.mWind.pow, strength, 0.05f, 1.0f, 0.005f); + cLib_addCalc(&g_env_light.global_wind_influence.vec.x, wind_vec.x, 0.05f, 2.0f, 0.001f); + cLib_addCalc(&g_env_light.global_wind_influence.vec.y, wind_vec.y, 0.05f, 2.0f, 0.001f); + cLib_addCalc(&g_env_light.global_wind_influence.vec.z, wind_vec.z, 0.05f, 2.0f, 0.001f); + cLib_addCalc(&g_env_light.global_wind_influence.pow, strength, 0.05f, 1.0f, 0.005f); } } /* 8005AAE0-8005AAF0 055420 0010+00 1/1 6/6 7/7 .text dKyw_get_wind_vec__Fv */ cXyz* dKyw_get_wind_vec() { - return &g_env_light.mWind.vec; + return &g_env_light.global_wind_influence.vec; } /* 8005AAF0-8005AB00 055430 0010+00 1/1 6/6 8/8 .text dKyw_get_wind_pow__Fv */ f32 dKyw_get_wind_pow() { - return g_env_light.mWind.pow; + return g_env_light.global_wind_influence.pow; } /* 8005AB00-8005AB64 055440 0064+00 0/0 8/8 3/3 .text dKyw_get_wind_vecpow__Fv */ cXyz dKyw_get_wind_vecpow() { - cXyz vec = g_env_light.mWind.vec * g_env_light.mWind.pow; + cXyz vec = g_env_light.global_wind_influence.vec * g_env_light.global_wind_influence.pow; return vec; } @@ -1404,13 +1404,13 @@ void dKyw_plight_collision_set(cXyz* param_0, s16 param_1, s16 param_2, f32 para dScnKy_env_light_c* env_light = dKy_getEnvlight(); for (int i = 0; i < 5; i++) { - if (!env_light->mWindInfluenceEntity[i].mInUse) { - env_light->mWindInfluenceEntity[i].mInUse = true; - env_light->mWindInfluenceEntity[i].mMinRadius = param_4; - env_light->mWindInfluenceEntity[i].mSpeed = param_6; - env_light->mWindInfluenceEntity[i].mStrengthMaxVel = param_7; + if (!env_light->wind_inf_entity[i].mInUse) { + env_light->wind_inf_entity[i].mInUse = true; + env_light->wind_inf_entity[i].mMinRadius = param_4; + env_light->wind_inf_entity[i].mSpeed = param_6; + env_light->wind_inf_entity[i].mStrengthMaxVel = param_7; - WIND_INFLUENCE* wind_inf = &env_light->mWindInfluenceEntity[i].mInfluence; + WIND_INFLUENCE* wind_inf = &env_light->wind_inf_entity[i].mInfluence; wind_inf->position = *param_0; wind_inf->mDirection.x = cM_scos(param_1) * cM_ssin(param_2); wind_inf->mDirection.y = cM_ssin(param_1); @@ -1431,28 +1431,28 @@ static void squal_proc() { WIND_INFLUENCE* influence; for (int i = 0; i < 5; i++) { - influence = &env_light->mWindInfluenceEntity[i].mInfluence; - switch (env_light->mWindInfluenceEntity[i].mInUse) { + influence = &env_light->wind_inf_entity[i].mInfluence; + switch (env_light->wind_inf_entity[i].mInUse) { case 0: break; case 1: influence->position.x += - influence->mDirection.x * env_light->mWindInfluenceEntity[i].mSpeed; + influence->mDirection.x * env_light->wind_inf_entity[i].mSpeed; influence->position.y += - influence->mDirection.y * env_light->mWindInfluenceEntity[i].mSpeed; + influence->mDirection.y * env_light->wind_inf_entity[i].mSpeed; influence->position.z += - influence->mDirection.z * env_light->mWindInfluenceEntity[i].mSpeed; + influence->mDirection.z * env_light->wind_inf_entity[i].mSpeed; cLib_addCalc(&influence->mStrength, 0.0f, 0.2f, - env_light->mWindInfluenceEntity[i].mStrengthMaxVel, 0.001f); + env_light->wind_inf_entity[i].mStrengthMaxVel, 0.001f); f32 speed = 1.0f - influence->mStrength; - f32 target = env_light->mWindInfluenceEntity[i].mMinRadius; + f32 target = env_light->wind_inf_entity[i].mMinRadius; cLib_addCalc(&influence->mRadius, target, speed, speed * target * 0.05f, 0.01f); if (influence->mStrength < 0.01f) { dKyw_pntwind_cut(influence); - env_light->mWindInfluenceEntity[i].mInUse = false; + env_light->wind_inf_entity[i].mInUse = false; } break; } @@ -1462,11 +1462,11 @@ static void squal_proc() { /* 8005AD44-8005AD98 055684 0054+00 1/1 0/0 0/0 .text dKyw_pntwind_init__Fv */ static void dKyw_pntwind_init() { for (int i = 0; i < 30; i++) { - g_env_light.mPntWind[i] = NULL; + g_env_light.pntwind[i] = NULL; } for (int i = 0; i < 5; i++) { - g_env_light.mWindInfluenceEntity[i].mInUse = 0; + g_env_light.wind_inf_entity[i].mInUse = 0; } } @@ -1474,9 +1474,9 @@ static void dKyw_pntwind_init() { static void pntwind_set(WIND_INFLUENCE* i_pntwind) { int i = 0; for (; i < 30; i++) { - if (g_env_light.mPntWind[i] == NULL) { - g_env_light.mPntWind[i] = i_pntwind; - g_env_light.mPntWind[i]->field_0x24 = i; + if (g_env_light.pntwind[i] == NULL) { + g_env_light.pntwind[i] = i_pntwind; + g_env_light.pntwind[i]->field_0x24 = i; break; } } @@ -1503,7 +1503,7 @@ static void dKyw_pntlight_set(WIND_INFLUENCE* i_pntwind) { /* 8005AE58-8005AE90 055798 0038+00 1/1 0/0 5/5 .text dKyw_pntwind_cut__FP14WIND_INFLUENCE */ void dKyw_pntwind_cut(WIND_INFLUENCE* i_pntwind) { if (i_pntwind != NULL && i_pntwind->field_0x24 >= 0 && i_pntwind->field_0x24 < 30) { - g_env_light.mPntWind[i_pntwind->field_0x24] = NULL; + g_env_light.pntwind[i_pntwind->field_0x24] = NULL; } } @@ -1516,9 +1516,9 @@ static void pntwind_get_info(cXyz* param_0, cXyz* i_dir, f32* i_power, u8 param_ *i_power = 0.0f; WIND_INFLUENCE* influence; - s32 influence_count = ARRAY_SIZE(g_env_light.mPntWind); + s32 influence_count = ARRAY_SIZE(g_env_light.pntwind); for (int i = 0; i < influence_count; i++) { - influence = g_env_light.mPntWind[i]; + influence = g_env_light.pntwind[i]; if (influence != NULL && influence->field_0x29 == param_3) { f32 dist = param_0->abs(influence->position); @@ -1600,7 +1600,7 @@ void dKyw_get_AllWind_vec(cXyz* i_position, cXyz* i_direction, f32* i_power) { cXyz sp30; cXyz sp24; - sp30 = env_light->mWind.vec * (env_light->mWind.pow * (1.0f - *i_power)); + sp30 = env_light->global_wind_influence.vec * (env_light->global_wind_influence.pow * (1.0f - *i_power)); sp24 = *i_direction * (*i_power * 5.0f); sp54 = sp30 + sp24; *i_power = sp54.abs(); @@ -1611,9 +1611,9 @@ void dKyw_get_AllWind_vec(cXyz* i_position, cXyz* i_direction, f32* i_power) { i_direction->y = sp54.y; i_direction->z = sp54.z; } else { - i_direction->x = env_light->mWind.vec.x; - i_direction->y = env_light->mWind.vec.y; - i_direction->z = env_light->mWind.vec.z; + i_direction->x = env_light->global_wind_influence.vec.x; + i_direction->y = env_light->global_wind_influence.vec.y; + i_direction->z = env_light->global_wind_influence.vec.z; } } @@ -1626,7 +1626,7 @@ cXyz dKyw_get_AllWind_vecpow(cXyz* param_0) { cXyz sp30; dKyw_pntwind_get_info(param_0, &sp30, &sp8); - sp18 = g_env_light.mWind.vec * (g_env_light.mWind.pow * (1.0f - sp8)); + sp18 = g_env_light.global_wind_influence.vec * (g_env_light.global_wind_influence.pow * (1.0f - sp8)); sp24 = sp30 * (5.0f * sp8); spC = sp18 + sp24; @@ -1640,18 +1640,18 @@ void dKyw_custom_windpower(f32 pow) { /* 8005B61C-8005B638 055F5C 001C+00 0/0 0/0 6/6 .text dKyw_evt_wind_set__Fss */ void dKyw_evt_wind_set(s16 angleX, s16 angleY) { - g_env_light.mEvtWindSet = 1; - g_env_light.mEvtWindAngleX = angleX; - g_env_light.mEvtWindAngleY = angleY; + g_env_light.evt_wind_go = 1; + g_env_light.evt_wind_angle_x = angleX; + g_env_light.evt_wind_angle_y = angleY; } /* 8005B638-8005B64C 055F78 0014+00 0/0 0/0 3/3 .text dKyw_evt_wind_set_go__Fv */ void dKyw_evt_wind_set_go() { - g_env_light.mEvtWindSet = 1; + g_env_light.evt_wind_go = 1; } /* 8005B64C-8005B660 055F8C 0014+00 0/0 1/1 5/5 .text dKyw_rain_set__Fi */ void dKyw_rain_set(int count) { - g_env_light.mRainCount = count; - g_env_light.mRainCountOrig = count; + g_env_light.raincnt = count; + g_env_light.base_raincnt = count; } diff --git a/src/d/d_kyeff.cpp b/src/d/d_kyeff.cpp index af2c32d834..dd052dd769 100644 --- a/src/d/d_kyeff.cpp +++ b/src/d/d_kyeff.cpp @@ -57,9 +57,9 @@ static int dKyeff_Create(kankyo_class* i_this) { dKyw_wether_init(); if (!strcmp(dComIfGp_getStartStageName(), "Name")) { OSTicksToCalendarTime(OSGetTime(), &time); - g_env_light.mWind.vec.set(1.0f, 0.0f, 0.0f); - g_env_light.mWind.pow = 0.7f; - g_env_light.mDaytime = time.hours * 15.0f; + g_env_light.global_wind_influence.vec.set(1.0f, 0.0f, 0.0f); + g_env_light.global_wind_influence.pow = 0.7f; + g_env_light.daytime = time.hours * 15.0f; } return cPhs_COMPLEATE_e; diff --git a/src/d/d_model.cpp b/src/d/d_model.cpp index 7bfa51d501..34e1c77589 100644 --- a/src/d/d_model.cpp +++ b/src/d/d_model.cpp @@ -31,8 +31,8 @@ void dMdl_c::draw() { mpModelData->getMaterialNodePointer(mMaterialId)->loadSharedDL(); shape->loadPreDrawSetting(); - GXColor amb_color = {mpTevstr->mColorC0.r, mpTevstr->mColorC0.g, mpTevstr->mColorC0.b, - mpTevstr->mColorC0.a}; + GXColor amb_color = {mpTevstr->AmbCol.r, mpTevstr->AmbCol.g, mpTevstr->AmbCol.b, + mpTevstr->AmbCol.a}; GXSetChanAmbColor(GX_COLOR0A0, amb_color); GXSetChanMatColor(GX_COLOR0A0, g_whiteColor); dKy_setLight_nowroom_actor(mpTevstr); @@ -145,4 +145,4 @@ dMdl_c* dMdl_mng_c::entry(J3DModelData* i_modelData, u16 i_materialId, int i_roo dMdl_c::dMdl_c() { mpModelData = NULL; mMaterialId = 0; -} \ No newline at end of file +} diff --git a/src/d/d_particle.cpp b/src/d/d_particle.cpp index 821967ce3f..42215fea24 100644 --- a/src/d/d_particle.cpp +++ b/src/d/d_particle.cpp @@ -226,16 +226,16 @@ static void initiateLighting8(_GXColor& param_0, s16 param_1) { color0.b = b = (param_1 >> 9) & 0x3e; if (daPy_py_c::checkNowWolfPowerUp()) { f32 fVar2; - f32 fVar1 = (g_env_light.mTerrainAmbienceBG[0].r / 255.0f); + f32 fVar1 = (g_env_light.bg_amb_col[0].r / 255.0f); fVar2 = r + 0x10; color0.r = fVar2 * (4.0f * (fVar1)); - fVar2 = (g_env_light.mTerrainAmbienceBG[0].g / 255.0f); + fVar2 = (g_env_light.bg_amb_col[0].g / 255.0f); fVar1 = g + 0x10; color0.g = fVar1 * (4.0f * (fVar2)); fVar1 = b + 0x10; - fVar2 = (g_env_light.mTerrainAmbienceBG[0].b / 255.0f); + fVar2 = (g_env_light.bg_amb_col[0].b / 255.0f); color0.b = fVar1 * (4.0f * (fVar2)); } @@ -287,10 +287,10 @@ static void drawSecond_light8(JPABaseEmitter* param_0) { GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET); GXSetNumChans(1); GXColor local_14; - local_14.r = g_env_light.mTerrainAmbienceBG[0].r; - local_14.g = g_env_light.mTerrainAmbienceBG[0].g; - local_14.b = g_env_light.mTerrainAmbienceBG[0].b; - local_14.a = g_env_light.mTerrainAmbienceBG[0].a; + local_14.r = g_env_light.bg_amb_col[0].r; + local_14.g = g_env_light.bg_amb_col[0].g; + local_14.b = g_env_light.bg_amb_col[0].b; + local_14.a = g_env_light.bg_amb_col[0].a; initiateLighting8(local_14, sVar3); GXSetNumTexGens(1); GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 0x3c, false, 0x7d); @@ -315,15 +315,15 @@ static void drawSecond_b_light8(JPABaseEmitter* param_0) { GXSetNumChans(1); GXColor local_18; if (param_0->getUserWork() == 0) { - local_18.r = envLight->mActorAmbience.r; - local_18.g = envLight->mActorAmbience.g; - local_18.b = envLight->mActorAmbience.b; - local_18.a = envLight->mActorAmbience.a; + local_18.r = envLight->actor_amb_col.r; + local_18.g = envLight->actor_amb_col.g; + local_18.b = envLight->actor_amb_col.b; + local_18.a = envLight->actor_amb_col.a; } else { - local_18.r = envLight->mTerrainAmbienceBG[0].r; - local_18.g = envLight->mTerrainAmbienceBG[0].g; - local_18.b = envLight->mTerrainAmbienceBG[0].b; - local_18.a = envLight->mTerrainAmbienceBG[0].a; + local_18.r = envLight->bg_amb_col[0].r; + local_18.g = envLight->bg_amb_col[0].g; + local_18.b = envLight->bg_amb_col[0].b; + local_18.a = envLight->bg_amb_col[0].a; } initiate_b_Lighting8(local_18); GXSetNumTevStages(2); @@ -528,27 +528,27 @@ bool dPa_modelEcallBack::model_c::set(J3DModelData* param_0, dKy_tevstr_c const& typedef struct Arr{ int field_0x0[2]; }; - *(Arr*)&field_0x8.mColorC0 = *(Arr*)¶m_1.mColorC0; - *(Arr*)&field_0x8.mColorK0 = *(Arr*)¶m_1.mColorK0; - *(Arr*)&field_0x8.mFogColor = *(Arr*)¶m_1.mFogColor; - *(int*)&field_0x8.field_0x360 = *(int*)¶m_1.field_0x360; + *(Arr*)&field_0x8.AmbCol = *(Arr*)¶m_1.AmbCol; + *(Arr*)&field_0x8.FogCol = *(Arr*)¶m_1.FogCol; + *(Arr*)&field_0x8.TevColor = *(Arr*)¶m_1.TevColor; + *(int*)&field_0x8.TevKColor = *(int*)¶m_1.TevKColor; *(int*)&field_0x8.mLightInf = *(int*)¶m_1.mLightInf; field_0x8.mFogStartZ = param_1.mFogStartZ; field_0x8.mFogEndZ = param_1.mFogEndZ; - field_0x8.mColpatBlend = param_1.mColpatBlend; + field_0x8.pat_ratio = param_1.pat_ratio; field_0x8.field_0x374 = param_1.field_0x374; - field_0x8.field_0x378 = param_1.field_0x378; - field_0x8.field_0x37a = param_1.field_0x37a; + field_0x8.Material_id = param_1.Material_id; + field_0x8.Type = param_1.Type; field_0x8.mInitTimer = param_1.mInitTimer; - field_0x8.mEnvrIdxCurr = param_1.mEnvrIdxCurr; - field_0x8.mEnvrIdxPrev = param_1.mEnvrIdxPrev; - field_0x8.mColpatCurr = param_1.mColpatCurr; - field_0x8.mColpatPrev = param_1.mColpatPrev; - field_0x8.mRoomNo = param_1.mRoomNo; - field_0x8.mEnvrIdxOverride = param_1.mEnvrIdxOverride; + field_0x8.UseCol = param_1.UseCol; + field_0x8.PrevCol = param_1.PrevCol; + field_0x8.wether_pat1 = param_1.wether_pat1; + field_0x8.wether_pat0 = param_1.wether_pat0; + field_0x8.room_no = param_1.room_no; + field_0x8.YukaCol = param_1.YukaCol; field_0x8.mLightMode = param_1.mLightMode; - field_0x8.mInitType = param_1.mInitType; + field_0x8.Material_use_fg = param_1.Material_use_fg; field_0x8.field_0x384 = param_1.field_0x384; field_0x8.field_0x385 = param_1.field_0x385; mRotAxis = rotAxis; @@ -838,7 +838,7 @@ u32 dPa_simpleEcallBack::set(cXyz const* param_1, dKy_tevstr_c const* param_2, u _GXColor const& param_4, _GXColor const& param_5, int param_6, f32 param_7) { f32 dVar7 = param_7; - if (param_2 != NULL && param_2->mInitType != 124) { + if (param_2 != NULL && param_2->Material_use_fg != 124) { OS_REPORT("\x1b[43;30mSimple Particle tevstr nonset !!\n"); return 0; } @@ -895,8 +895,8 @@ u32 dPa_simpleEcallBack::set(cXyz const* param_1, dKy_tevstr_c const* param_2, u } dKy_ParticleColor_get_bg((cXyz*)param_1, (dKy_tevstr_c*)param_2, &local_6c, &local_70, &local_74, &local_78, dVar7); - dVar7 = g_env_light.mPaletteTerrainLightEffect + - (1.0f - g_env_light.mPaletteTerrainLightEffect) * dVar7; + dVar7 = g_env_light.bg_light_influence + + (1.0f - g_env_light.bg_light_influence) * dVar7; OS_REPORT("\nwork__ratio=[%f]", dVar7); local_6c = dKy_light_influence_col(&local_6c, dVar7); local_70 = dKy_light_influence_col(&local_70, dVar7); @@ -1505,7 +1505,7 @@ JPABaseEmitter* dPa_control_c::set(u8 param_0, u16 param_1, cXyz const* param_2, } u32 local_ac = local_a8->getResUserWork(param_1); - if (param_3 != NULL && param_3->mInitType != 0x7c) { + if (param_3 != NULL && param_3->Material_use_fg != 0x7c) { return NULL; } @@ -1591,7 +1591,7 @@ JPABaseEmitter* dPa_control_c::set(u8 param_0, u16 param_1, cXyz const* param_2, } dKy_ParticleColor_get_bg((cXyz*)param_2, (dKy_tevstr_c*)param_3, &local_c0, &local_c4, &local_c8, &local_cc, param_12); - param_12 = g_env_light.mPaletteTerrainLightEffect + (1.0f - g_env_light.mPaletteTerrainLightEffect) * param_12; + param_12 = g_env_light.bg_light_influence + (1.0f - g_env_light.bg_light_influence) * param_12; local_c0 = dKy_light_influence_col(&local_c0, param_12); local_c4 = dKy_light_influence_col(&local_c4, param_12); this_00->setGlobalEnvColor(local_c0.r, local_c0.g, local_c0.b); @@ -1734,7 +1734,7 @@ static void dPa_kankyocolor_set(f32 param_0, JPABaseEmitter* param_1, } dKy_ParticleColor_get_bg((cXyz*)param_4, (dKy_tevstr_c*)param_2, &local_70, &local_74, &local_78, &local_7c, fVar1); - fVar1 = g_env_light.mPaletteTerrainLightEffect + (1.0f - g_env_light.mPaletteTerrainLightEffect) * fVar1; + fVar1 = g_env_light.bg_light_influence + (1.0f - g_env_light.bg_light_influence) * fVar1; local_70 = dKy_light_influence_col(&local_70, fVar1); //_GXColor::operator_ = (&local_70, (_GXColor*)&local_80); local_74 = dKy_light_influence_col(&local_74, fVar1); @@ -1966,8 +1966,8 @@ void dPa_wbPcallBack_c::execute(JPABaseEmitter* param_0, JPABaseParticle* param_ /* 8004DCA0-8004DD0C 0485E0 006C+00 1/0 0/0 0/0 .text * execute__19dPa_fsenthPcallBackFP14JPABaseEmitterP15JPABaseParticle */ void dPa_fsenthPcallBack::execute(JPABaseEmitter* param_0, JPABaseParticle* param_1) { - if (g_env_light.field_0xf3d == 1 && g_env_light.field_0xf40 > 0.0f) { - param_0->setGlobalAlpha(255.0f * g_env_light.field_0xf40); + if (g_env_light.now_senses_effect == 1 && g_env_light.senses_effect_strength > 0.0f) { + param_0->setGlobalAlpha(255.0f * g_env_light.senses_effect_strength); param_0->playDrawParticle(); } else { param_0->setGlobalAlpha(0); diff --git a/src/d/d_resorce.cpp b/src/d/d_resorce.cpp index 03a6b9515d..338fee8ceb 100644 --- a/src/d/d_resorce.cpp +++ b/src/d/d_resorce.cpp @@ -262,7 +262,7 @@ J3DModelData* dRes_info_c::loaderBasicBmd(u32 i_tag, void* i_data) { for (i = 0; i < modelData->getMaterialNum(); i++) { material = modelData->getMaterialNodePointer(i); lightMask = material->getColorChan(0)->getLightMask(); - switch (g_env_light.field_0x1308) { + switch (g_env_light.light_mask_type) { case 1: lightMask &= 0x4; break; diff --git a/src/d/d_s_play.cpp b/src/d/d_s_play.cpp index 6c2da292c1..c306e214ac 100644 --- a/src/d/d_s_play.cpp +++ b/src/d/d_s_play.cpp @@ -503,15 +503,15 @@ static int phase_1(dScnPly_c* i_this) { if (!strcmp(dComIfGp_getStartStageName(), "F_SP127") && dComIfGp_getStartStageRoomNo() == 0 && dComIfGp_getStartStagePoint() == 2) { - g_env_light.mPondSeason++; + g_env_light.fishing_hole_season++; - if (g_env_light.mPondSeason > 4) { - g_env_light.mPondSeason = 1; + if (g_env_light.fishing_hole_season > 4) { + g_env_light.fishing_hole_season = 1; } } dComIfGs_BossLife_public_Set(0xFF); - g_env_light.field_0x1308 = 0; + g_env_light.light_mask_type = 0; JUTReportConsole_f("Start StageName:RoomNo [%s:%d]\n", dComIfGp_getStartStageName(), dComIfGp_getStartStageRoomNo()); diff --git a/src/dolphin/gf/GFPixel.cpp b/src/dolphin/gf/GFPixel.cpp index 6dcb079c01..375cd190c5 100644 --- a/src/dolphin/gf/GFPixel.cpp +++ b/src/dolphin/gf/GFPixel.cpp @@ -2,8 +2,8 @@ #include "dolphin/gx.h" /* 802CDE9C-802CE004 2C87DC 0168+00 0/0 1/1 0/0 .text GFSetFog__F10_GXFogTypeffff8_GXColor */ -void GFSetFog(_GXFogType param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4, - _GXColor param_5) { +void GFSetFog(GXFogType param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4, + GXColor param_5) { s32 r30; s32 r30shift2; u32 stack_c_u32; @@ -46,14 +46,14 @@ void GFSetFog(_GXFogType param_0, f32 param_1, f32 param_2, f32 param_3, f32 par /* 802CE004-802CE0A4 2C8944 00A0+00 0/0 1/1 0/0 .text * GFSetBlendModeEtc__F12_GXBlendMode14_GXBlendFactor14_GXBlendFactor10_GXLogicOpUcUcUc */ -void GFSetBlendModeEtc(_GXBlendMode param_0, _GXBlendFactor param_1, _GXBlendFactor param_2, - _GXLogicOp param_3, u8 param_4, u8 param_5, u8 param_6) { +void GFSetBlendModeEtc(GXBlendMode param_0, GXBlendFactor param_1, GXBlendFactor param_2, + GXLogicOp param_3, u8 param_4, u8 param_5, u8 param_6) { GFWriteBPCmd(((param_0 == 1) || (param_0 == 3)) | (param_0 == 2) << 1 | param_6 << 2 | param_4 << 3 | param_5 << 4 | param_2 << 5 | param_1 << 8 | (param_0 == 3) << 11 | param_3 << 12 | 0x41000000); } /* 802CE0A4-802CE0D0 2C89E4 002C+00 0/0 1/1 0/0 .text GFSetZMode__FUc10_GXCompareUc */ -void GFSetZMode(u8 param_0, _GXCompare param_1, u8 param_2) { +void GFSetZMode(u8 param_0, GXCompare param_1, u8 param_2) { GFWriteBPCmd(param_0 | param_1 << 1 | param_2 << 4 | 0x40000000); -} \ No newline at end of file +} diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp index 4fca4f0cbc..8830ea57e3 100644 --- a/src/f_op/f_op_actor_mng.cpp +++ b/src/f_op/f_op_actor_mng.cpp @@ -1674,8 +1674,8 @@ void fopAcM_cancelCarryNow(fopAc_ac_c* i_actor) { BOOL fopAcM_otoCheck(fopAc_ac_c const* i_actor, f32 param_1) { SND_INFLUENCE* sound = dKy_Sound_get(); - if (sound->field_0x14 != -1 && fopAcM_GetID(i_actor) != sound->field_0x14) { - cXyz tmp = sound->field_0x0 - i_actor->current.pos; + if (sound->actor_id != fpcM_ERROR_PROCESS_ID_e && fopAcM_GetID(i_actor) != sound->actor_id) { + cXyz tmp = sound->position - i_actor->current.pos; if (tmp.abs() < param_1) { return sound->field_0xc; diff --git a/src/m_Do/m_Do_graphic.cpp b/src/m_Do/m_Do_graphic.cpp index c345b8298d..5bff7ace1a 100644 --- a/src/m_Do/m_Do_graphic.cpp +++ b/src/m_Do/m_Do_graphic.cpp @@ -836,7 +836,7 @@ static void retry_captue_frame(view_class* param_0, view_port_class* param_1, in /* 8000A290-8000A504 004BD0 0274+00 1/1 0/0 0/0 .text motionBlure__FP10view_class */ static void motionBlure(view_class* param_0) { - if (g_env_light.mIsBlure) { + if (g_env_light.is_blure) { GXLoadTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), GX_TEXMAP0); GXColor local_60; local_60.a = mDoGph_gInf_c::getBlureRate(); @@ -872,9 +872,9 @@ static void motionBlure(view_class* param_0) { GXSetProjection(param_0->projMtx, GX_PERSPECTIVE); } if (mDoGph_gInf_c::isBlure()) { - g_env_light.mIsBlure = 1; + g_env_light.is_blure = 1; } else { - g_env_light.mIsBlure = 0; + g_env_light.is_blure = 0; } } @@ -995,7 +995,7 @@ int mDoGph_Painter() { GXInvalidateTexAll(); GXSetClipMode(GX_CLIP_ENABLE); - if (g_env_light.mIsBlure == 0) { + if (g_env_light.is_blure == 0) { dComIfGd_drawOpaListInvisible(); dComIfGd_drawXluListInvisible(); } @@ -1020,7 +1020,7 @@ int mDoGph_Painter() { retry_captue_frame(camera_p, view_port, dComIfGp_getCameraZoomForcus(camera_id)); GXSetClipMode(GX_CLIP_ENABLE); - if (g_env_light.mIsBlure == 1) { + if (g_env_light.is_blure == 1) { dComIfGd_drawOpaListInvisible(); dComIfGd_drawXluListInvisible(); } @@ -1052,7 +1052,7 @@ int mDoGph_Painter() { GXSetProjection(camera_p->projMtx, GX_PERSPECTIVE); j3dSys.reinitGX(); - if ((g_env_light.mCameraInWater || !strcmp(dComIfGp_getStartStageName(), "D_MN08"))) + if ((g_env_light.camera_water_in_status || !strcmp(dComIfGp_getStartStageName(), "D_MN08"))) { u8 enable = mDoGph_gInf_c::getBloom()->getEnable(); GXColor color = *mDoGph_gInf_c::getBloom()->getMonoColor();