mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-07-24 05:56:42 -04:00
Scaffold ef_effect_control structs
This commit is contained in:
+290
-307
@@ -18,21 +18,16 @@ static void Weather_Actor_dt(ACTOR* actor, GAME* game);
|
||||
static void Weather_Actor_move(ACTOR* actor, GAME* game);
|
||||
static void Weather_Actor_draw(ACTOR* actor, GAME* game);
|
||||
|
||||
|
||||
static void aWeather_SetNowProfile(WEATHER_ACTOR* weather, s16 id);
|
||||
|
||||
static aWeather_Profile_c* profile_tbl[] = {
|
||||
&iam_weather_fine,
|
||||
&iam_weather_rain,
|
||||
&iam_weather_snow,
|
||||
&iam_weather_sakura,
|
||||
&iam_weather_leaf,
|
||||
&iam_weather_fine, &iam_weather_rain, &iam_weather_snow, &iam_weather_sakura, &iam_weather_leaf,
|
||||
};
|
||||
|
||||
ACTOR_PROFILE Weather_Profile = {
|
||||
mAc_PROFILE_WEATHER,
|
||||
ACTOR_PART_CONTROL,
|
||||
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | ACTOR_STATE_NO_MOVE_WHILE_CULLED| ACTOR_STATE_NO_DRAW_WHILE_CULLED,
|
||||
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
|
||||
EMPTY_NO,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(WEATHER_ACTOR),
|
||||
@@ -43,17 +38,16 @@ ACTOR_PROFILE Weather_Profile = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
static void aWeather_SysLevCall_MoveEnd(WEATHER_ACTOR* weather){
|
||||
static void aWeather_SysLevCall_MoveEnd(WEATHER_ACTOR* weather) {
|
||||
|
||||
if(weather->basement_event == 1){
|
||||
if (weather->basement_event == 1) {
|
||||
weather->stop_sound_effect = 0;
|
||||
weather->start_sound_effect = 0;
|
||||
}
|
||||
else{
|
||||
if(weather->stop_sound_effect != 0){
|
||||
} else {
|
||||
if (weather->stop_sound_effect != 0) {
|
||||
sAdo_SysLevStop(weather->stop_sound_effect);
|
||||
}
|
||||
if(weather->start_sound_effect != 0){
|
||||
if (weather->start_sound_effect != 0) {
|
||||
sAdo_SysLevStart(weather->start_sound_effect);
|
||||
}
|
||||
weather->stop_sound_effect = 0;
|
||||
@@ -61,25 +55,24 @@ static void aWeather_SysLevCall_MoveEnd(WEATHER_ACTOR* weather){
|
||||
}
|
||||
}
|
||||
|
||||
static void aWeather_SysLevStart(u8 flag){
|
||||
static void aWeather_SysLevStart(u8 flag) {
|
||||
Common_Get(clip.weather_clip)->actor->start_sound_effect = flag;
|
||||
}
|
||||
}
|
||||
|
||||
static void aWeather_SysLevStop(u8 flag){
|
||||
static void aWeather_SysLevStop(u8 flag) {
|
||||
int stopFlag = flag;
|
||||
WEATHER_ACTOR* weather = Common_Get(clip.weather_clip)->actor;
|
||||
|
||||
if(weather->start_sound_effect == stopFlag){
|
||||
|
||||
if (weather->start_sound_effect == stopFlag) {
|
||||
weather->start_sound_effect = 0;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
weather->stop_sound_effect = stopFlag;
|
||||
}
|
||||
}
|
||||
|
||||
static void aWeather_weatherinfo_CommonSet(s16 type, s16 intensity){
|
||||
static void aWeather_weatherinfo_CommonSet(s16 type, s16 intensity) {
|
||||
|
||||
if(type >= mEnv_WEATHER_LEAVES){
|
||||
if (type >= mEnv_WEATHER_LEAVES) {
|
||||
type = 0;
|
||||
}
|
||||
|
||||
@@ -87,71 +80,72 @@ static void aWeather_weatherinfo_CommonSet(s16 type, s16 intensity){
|
||||
Common_Set(weather_intensity, intensity);
|
||||
}
|
||||
|
||||
static void aWeather_RequestChangeWeather(ACTOR* actor, s16 status, s16 level){
|
||||
static void aWeather_RequestChangeWeather(ACTOR* actor, s16 status, s16 level) {
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
if(mEnv_ReqeustChangeWeatherEnviroment(weather->current_status, status) != 0){
|
||||
if(status != weather->current_status){
|
||||
if (mEnv_ReqeustChangeWeatherEnviroment(weather->current_status, status) != 0) {
|
||||
if (status != weather->current_status) {
|
||||
weather->next_status = status;
|
||||
weather->next_level = level;
|
||||
weather->request_change = TRUE;
|
||||
weather->current_aim_level = 0;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
weather->current_aim_level = level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern void aWeather_RequestChangeWeatherToIsland(){
|
||||
aWeather_RequestChangeWeather(&Common_Get(clip.weather_clip)->actor->actor_class,Common_Get(island_weather),Common_Get(island_weather_intensity));
|
||||
extern void aWeather_RequestChangeWeatherToIsland() {
|
||||
aWeather_RequestChangeWeather(&Common_Get(clip.weather_clip)->actor->actor_class, Common_Get(island_weather),
|
||||
Common_Get(island_weather_intensity));
|
||||
}
|
||||
|
||||
extern void aWeather_RequestChangeWeatherFromIsland(){
|
||||
aWeather_RequestChangeWeather(&Common_Get(clip.weather_clip)->actor->actor_class, mEnv_SAVE_GET_WEATHER_TYPE(Save_Get(weather)) , mEnv_SAVE_GET_WEATHER_INTENSITY(Save_Get(weather)));
|
||||
extern void aWeather_RequestChangeWeatherFromIsland() {
|
||||
aWeather_RequestChangeWeather(&Common_Get(clip.weather_clip)->actor->actor_class,
|
||||
mEnv_SAVE_GET_WEATHER_TYPE(Save_Get(weather)),
|
||||
mEnv_SAVE_GET_WEATHER_INTENSITY(Save_Get(weather)));
|
||||
}
|
||||
|
||||
int aWeather_GetWeatherPrvNum(ACTOR* actor){
|
||||
int aWeather_GetWeatherPrvNum(ACTOR* actor) {
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
aWeather_Priv* priv = weather->priv;
|
||||
int i;
|
||||
int num = 0;
|
||||
|
||||
for(i = 100; i != 0; i--, priv++, num++){
|
||||
if(priv->use == 0){
|
||||
for (i = 100; i != 0; i--, priv++, num++) {
|
||||
if (priv->use == 0) {
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void aWeather_AbolishPrivate(ACTOR* actor, int num){
|
||||
void aWeather_AbolishPrivate(ACTOR* actor, int num) {
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
aWeather_Priv* priv = weather->priv;
|
||||
|
||||
if(priv != NULL){
|
||||
if (priv != NULL) {
|
||||
priv = &priv[num];
|
||||
if(priv->use != 0){
|
||||
if (priv->use != 0) {
|
||||
priv->use = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aWeather_Priv* aWeather_GetWeatherPrv(u8 status, s16 timer, xyz_t* pos, xyz_t* speed, ACTOR* actor, int id){
|
||||
aWeather_Priv* aWeather_GetWeatherPrv(u8 status, s16 timer, xyz_t* pos, xyz_t* speed, ACTOR* actor, int id) {
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
aWeather_Priv* priv = weather->priv;
|
||||
|
||||
if((id != -1) && (id < 100)){
|
||||
if(priv[id].use == 0){
|
||||
if ((id != -1) && (id < 100)) {
|
||||
if (priv[id].use == 0) {
|
||||
priv[id].use = 1;
|
||||
priv[id].status = status;
|
||||
priv[id].status = status;
|
||||
priv[id].timer = timer;
|
||||
priv[id].id = id;
|
||||
if(pos != NULL){
|
||||
priv[id].pos = *pos;
|
||||
if (pos != NULL) {
|
||||
priv[id].pos = *pos;
|
||||
}
|
||||
if(speed != NULL){
|
||||
if (speed != NULL) {
|
||||
priv[id].speed = *speed;
|
||||
}
|
||||
return &priv[id];
|
||||
@@ -161,47 +155,44 @@ aWeather_Priv* aWeather_GetWeatherPrv(u8 status, s16 timer, xyz_t* pos, xyz_t* s
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int aWeather_StopSysLevSE(){
|
||||
int aWeather_StopSysLevSE() {
|
||||
WEATHER_ACTOR* weather = Common_Get(clip.weather_clip)->actor;
|
||||
|
||||
|
||||
u8 current = weather->current_sound_effect;
|
||||
|
||||
if(weather->sound_flag == 0){
|
||||
if(((u8)(current - 7) <= 2U) || (u8)(current - 18) <= 1U ||
|
||||
current == 20){
|
||||
aWeather_SysLevStop(current);
|
||||
}
|
||||
|
||||
if (weather->sound_flag == 0) {
|
||||
if (((u8)(current - 7) <= 2U) || (u8)(current - 18) <= 1U || current == 20) {
|
||||
aWeather_SysLevStop(current);
|
||||
}
|
||||
weather->sound_flag = 1;
|
||||
return 1;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int aWeather_StartSysLevSE(){
|
||||
int aWeather_StartSysLevSE() {
|
||||
WEATHER_ACTOR* weather = Common_Get(clip.weather_clip)->actor;
|
||||
|
||||
|
||||
u8 current = weather->current_sound_effect;
|
||||
|
||||
if(weather->sound_flag == 1){
|
||||
if(mEnv_SAVE_GET_WEATHER_TYPE(Save_Get(weather)) == 1){
|
||||
switch(mEnv_SAVE_GET_WEATHER_INTENSITY(Save_Get(weather))){
|
||||
if (weather->sound_flag == 1) {
|
||||
if (mEnv_SAVE_GET_WEATHER_TYPE(Save_Get(weather)) == 1) {
|
||||
switch (mEnv_SAVE_GET_WEATHER_INTENSITY(Save_Get(weather))) {
|
||||
case 1:
|
||||
aWeather_SysLevStart(7);
|
||||
weather->current_sound_effect = 7;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
aWeather_SysLevStart(8);
|
||||
weather->current_sound_effect = 8;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
aWeather_SysLevStart(9);
|
||||
weather->current_sound_effect = 9;
|
||||
break;
|
||||
aWeather_SysLevStart(7);
|
||||
weather->current_sound_effect = 7;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
aWeather_SysLevStart(8);
|
||||
weather->current_sound_effect = 8;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
aWeather_SysLevStart(9);
|
||||
weather->current_sound_effect = 9;
|
||||
break;
|
||||
}
|
||||
}
|
||||
weather->sound_flag = 2;
|
||||
@@ -209,99 +200,99 @@ int aWeather_StartSysLevSE(){
|
||||
return 0;
|
||||
}
|
||||
|
||||
void aWeather_ChangeWeatherInstance(WEATHER_ACTOR* weather, s16 status, s16 level){
|
||||
void aWeather_ChangeWeatherInstance(WEATHER_ACTOR* weather, s16 status, s16 level) {
|
||||
|
||||
weather->next_status = status;
|
||||
weather->next_level = level;
|
||||
weather->next_level = level;
|
||||
weather->current_status = status;
|
||||
weather->current_level = 0;
|
||||
weather->current_level = 0;
|
||||
weather->request_change = TRUE;
|
||||
|
||||
if(!aWeather_CountWeatherPrivate(weather)){
|
||||
if (!aWeather_CountWeatherPrivate(weather)) {
|
||||
weather->current_status = weather->next_status;
|
||||
aWeather_SetNowProfile(weather, weather->current_status);
|
||||
aWeather_weatherinfo_CommonSet(weather->current_status, weather->next_level);
|
||||
weather->current_level = level;
|
||||
weather->current_level = level;
|
||||
weather->current_aim_level = weather->next_level;
|
||||
weather->request_change = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
int aWeather_IsLand_Event_Check(){
|
||||
int aWeather_IsLand_Event_Check() {
|
||||
|
||||
if(((mFI_CheckBeforeScenePerpetual() != 0) || (mFI_GetClimate() == 1)) &&
|
||||
(Common_Get(island_weather) != (s16)mEnv_SAVE_GET_WEATHER_TYPE(Save_Get(weather)))){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aWeather_Basement_Event_Check(WEATHER_ACTOR* weather){
|
||||
|
||||
if((weather->basement_event == 1) || (weather->basement_event == 2)){
|
||||
if (((mFI_CheckBeforeScenePerpetual() != 0) || (mFI_GetClimate() == 1)) &&
|
||||
(Common_Get(island_weather) != (s16)mEnv_SAVE_GET_WEATHER_TYPE(Save_Get(weather)))) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void aWeather_ChangeEnvSE(WEATHER_ACTOR* weather, GAME_PLAY* play, s16 status, s16 level){
|
||||
int aWeather_Basement_Event_Check(WEATHER_ACTOR* weather) {
|
||||
|
||||
if ((weather->basement_event == 1) || (weather->basement_event == 2)) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void aWeather_ChangeEnvSE(WEATHER_ACTOR* weather, GAME_PLAY* play, s16 status, s16 level) {
|
||||
u8 current = weather->current_sound_effect;
|
||||
|
||||
if(weather->sound_flag == 1 || weather->sound_flag == 2)
|
||||
|
||||
if (weather->sound_flag == 1 || weather->sound_flag == 2)
|
||||
return;
|
||||
|
||||
if(((u8)(current - 7) <= 2U) || (u8)(current - 18) <= 1U || current == 20){
|
||||
aWeather_SysLevStop(current);
|
||||
|
||||
if (((u8)(current - 7) <= 2U) || (u8)(current - 18) <= 1U || current == 20) {
|
||||
aWeather_SysLevStop(current);
|
||||
weather->current_sound_effect = -1000;
|
||||
}
|
||||
|
||||
|
||||
if (mEv_CheckTitleDemo() <= 0) {
|
||||
if (Save_Get(scene_no) == SCENE_START_DEMO || Save_Get(scene_no) == SCENE_START_DEMO2 || Save_Get(scene_no) == SCENE_START_DEMO3) {
|
||||
if (Save_Get(scene_no) == SCENE_START_DEMO || Save_Get(scene_no) == SCENE_START_DEMO2 ||
|
||||
Save_Get(scene_no) == SCENE_START_DEMO3) {
|
||||
return;
|
||||
}
|
||||
if((status == 1) && (weather->current_sound_effect == -1000)){
|
||||
if ((status == 1) && (weather->current_sound_effect == -1000)) {
|
||||
switch (level) {
|
||||
case 1:
|
||||
if (mPlib_check_player_open_umbrella(play) != 0) {
|
||||
aWeather_SysLevStart(0x12);
|
||||
weather->current_sound_effect = 0x12;
|
||||
return;
|
||||
}
|
||||
aWeather_SysLevStart(7);
|
||||
weather->current_sound_effect = 7;
|
||||
break;
|
||||
case 2:
|
||||
if (mPlib_check_player_open_umbrella(play) != 0) {
|
||||
aWeather_SysLevStart(0x13);
|
||||
weather->current_sound_effect = 0x13;
|
||||
return;
|
||||
}
|
||||
aWeather_SysLevStart(8);
|
||||
weather->current_sound_effect = 8;
|
||||
break;
|
||||
case 3:
|
||||
if (mPlib_check_player_open_umbrella(play) != 0) {
|
||||
aWeather_SysLevStart(0x14);
|
||||
weather->current_sound_effect = 0x14;
|
||||
return;
|
||||
}
|
||||
aWeather_SysLevStart(9);
|
||||
weather->current_sound_effect = 9;
|
||||
break;
|
||||
case 1:
|
||||
if (mPlib_check_player_open_umbrella(play) != 0) {
|
||||
aWeather_SysLevStart(0x12);
|
||||
weather->current_sound_effect = 0x12;
|
||||
return;
|
||||
}
|
||||
aWeather_SysLevStart(7);
|
||||
weather->current_sound_effect = 7;
|
||||
break;
|
||||
case 2:
|
||||
if (mPlib_check_player_open_umbrella(play) != 0) {
|
||||
aWeather_SysLevStart(0x13);
|
||||
weather->current_sound_effect = 0x13;
|
||||
return;
|
||||
}
|
||||
aWeather_SysLevStart(8);
|
||||
weather->current_sound_effect = 8;
|
||||
break;
|
||||
case 3:
|
||||
if (mPlib_check_player_open_umbrella(play) != 0) {
|
||||
aWeather_SysLevStart(0x14);
|
||||
weather->current_sound_effect = 0x14;
|
||||
return;
|
||||
}
|
||||
aWeather_SysLevStart(9);
|
||||
weather->current_sound_effect = 9;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void aWeather_EndEnvSE(ACTOR* actor){
|
||||
static void aWeather_EndEnvSE(ACTOR* actor) {
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
u8 current = weather->current_sound_effect;
|
||||
|
||||
if ((sAdo_GameframeEnd_Check() == 1) || ((sAdo_GameframeEnd_Check() == 2) &&
|
||||
((aWeather_IsLand_Event_Check() != 0) || (aWeather_Basement_Event_Check(weather) != 0)))) {
|
||||
if (((u8)(current - 7) <= 2) || ( (u8)(current - 0x12) <= 1) || (u8)(current == 0x14)) {
|
||||
|
||||
if ((sAdo_GameframeEnd_Check() == 1) ||
|
||||
((sAdo_GameframeEnd_Check() == 2) &&
|
||||
((aWeather_IsLand_Event_Check() != 0) || (aWeather_Basement_Event_Check(weather) != 0)))) {
|
||||
if (((u8)(current - 7) <= 2) || ((u8)(current - 0x12) <= 1) || (u8)(current == 0x14)) {
|
||||
aWeather_SysLevStop(current);
|
||||
weather->current_sound_effect = -1000;
|
||||
Common_Set(current_sound_effect, -1000);
|
||||
@@ -312,50 +303,48 @@ static void aWeather_EndEnvSE(ACTOR* actor){
|
||||
aWeather_SysLevCall_MoveEnd(weather);
|
||||
}
|
||||
|
||||
void aWeather_SetNowProfile(WEATHER_ACTOR* weather, s16 id){
|
||||
void aWeather_SetNowProfile(WEATHER_ACTOR* weather, s16 id) {
|
||||
|
||||
if(!mFI_GET_TYPE(mFI_GetFieldId())){
|
||||
if (!mFI_GET_TYPE(mFI_GetFieldId())) {
|
||||
weather->current_profile = profile_tbl[id];
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
weather->current_profile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void aWeather_SecureWeatherPrivateWork(WEATHER_ACTOR* weather){
|
||||
void aWeather_SecureWeatherPrivateWork(WEATHER_ACTOR* weather) {
|
||||
int i;
|
||||
|
||||
|
||||
weather->priv = zelda_malloc(sizeof(aWeather_Priv) * 100);
|
||||
|
||||
if(weather->priv != NULL){
|
||||
for(i = 0; i < 100; i++){
|
||||
if (weather->priv != NULL) {
|
||||
for (i = 0; i < 100; i++) {
|
||||
bzero(&weather->priv[i], sizeof(aWeather_Priv));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aWeather_SetClip(WEATHER_ACTOR* weather, int flag){
|
||||
static void aWeather_SetClip(WEATHER_ACTOR* weather, int flag) {
|
||||
aWeather_Clip_c* clip;
|
||||
if(flag != 0){
|
||||
if (flag != 0) {
|
||||
Common_Set(clip.weather_clip, NULL);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
clip = &weather->clip;
|
||||
|
||||
|
||||
clip->actor = weather;
|
||||
clip->change_weather = aWeather_RequestChangeWeather;
|
||||
clip->get_priv_num = aWeather_GetWeatherPrvNum;
|
||||
clip->remove_priv = aWeather_AbolishPrivate;
|
||||
clip->remove_priv = aWeather_AbolishPrivate;
|
||||
clip->get_priv = aWeather_GetWeatherPrv;
|
||||
clip->stop_sound = aWeather_StopSysLevSE;
|
||||
clip->start_sound = aWeather_StartSysLevSE;
|
||||
clip->change_weather_instance = aWeather_ChangeWeatherInstance;
|
||||
|
||||
Common_Set(clip.weather_clip, clip);
|
||||
Common_Set(clip.weather_clip, clip);
|
||||
}
|
||||
}
|
||||
|
||||
void aWeather_RenewWindInfo(WEATHER_ACTOR* weather){
|
||||
|
||||
void aWeather_RenewWindInfo(WEATHER_ACTOR* weather) {
|
||||
s_xyz pos = Common_Get(wind); // multiply by 1 means inline ?
|
||||
f32 speed = Common_Get(wind_speed) * 0.01f;
|
||||
f32 factor = 1.0f;
|
||||
@@ -365,49 +354,42 @@ void aWeather_RenewWindInfo(WEATHER_ACTOR* weather){
|
||||
weather->wind_info.z = pos.z * speed * factor;
|
||||
}
|
||||
|
||||
void aWeather_SnowInAdvance(WEATHER_ACTOR* weather, GAME_PLAY* play, int moves){
|
||||
void aWeather_SnowInAdvance(WEATHER_ACTOR* weather, GAME_PLAY* play, int moves) {
|
||||
|
||||
int i;
|
||||
|
||||
for(i = 0; i < moves; i++){
|
||||
Weather_Actor_move(&weather->actor_class, &play->game);
|
||||
for (i = 0; i < moves; i++) {
|
||||
Weather_Actor_move(&weather->actor_class, &play->game);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Weather_Actor_ct(ACTOR* actor, GAME* game){
|
||||
void Weather_Actor_ct(ACTOR* actor, GAME* game) {
|
||||
static s16 DemoWeatherTbl[5][2] = {
|
||||
3,1,
|
||||
1,2,
|
||||
0,0,
|
||||
0,0,
|
||||
2,1,
|
||||
3, 1, 1, 2, 0, 0, 0, 0, 2, 1,
|
||||
};
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
|
||||
int cur;
|
||||
xyz_t* pos = Camera2_getCenterPos_p();
|
||||
|
||||
aWeather_SetClip(weather, 0);
|
||||
|
||||
if(mEv_CheckTitleDemo() > 0){
|
||||
cur = mEv_CheckTitleDemo() -1;
|
||||
|
||||
if (mEv_CheckTitleDemo() > 0) {
|
||||
cur = mEv_CheckTitleDemo() - 1;
|
||||
|
||||
weather->current_status = DemoWeatherTbl[cur][0];
|
||||
weather->next_status = DemoWeatherTbl[cur][0];
|
||||
weather->current_level = DemoWeatherTbl[cur][1];
|
||||
weather->current_aim_level = DemoWeatherTbl[cur][1];
|
||||
}
|
||||
else if(mFI_GetClimate() == 1){
|
||||
} else if (mFI_GetClimate() == 1) {
|
||||
weather->current_status = Common_Get(island_weather);
|
||||
weather->next_status = Common_Get(island_weather);
|
||||
weather->current_level = Common_Get(island_weather_intensity);
|
||||
weather->current_aim_level = Common_Get(island_weather_intensity);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
weather->current_status = mEnv_SAVE_GET_WEATHER_TYPE(Save_Get(weather));
|
||||
weather->next_status = weather->current_status;
|
||||
weather->next_status = weather->current_status;
|
||||
weather->current_level = mEnv_SAVE_GET_WEATHER_INTENSITY(Save_Get(weather));
|
||||
weather->current_aim_level = Common_Get(weather_intensity);
|
||||
}
|
||||
@@ -416,7 +398,7 @@ void Weather_Actor_ct(ACTOR* actor, GAME* game){
|
||||
weather->priv = NULL;
|
||||
weather->request_change = FALSE;
|
||||
|
||||
weather->pos = *pos;
|
||||
weather->pos = *pos;
|
||||
|
||||
weather->timer = 0;
|
||||
weather->timer2 = 0;
|
||||
@@ -425,102 +407,106 @@ void Weather_Actor_ct(ACTOR* actor, GAME* game){
|
||||
|
||||
weather->sound_flag = 0;
|
||||
aWeather_RenewWindInfo(weather);
|
||||
|
||||
if(!mFI_GET_TYPE(mFI_GetFieldId())){
|
||||
|
||||
if (!mFI_GET_TYPE(mFI_GetFieldId())) {
|
||||
aWeather_SecureWeatherPrivateWork(weather);
|
||||
}
|
||||
|
||||
aWeather_SetNowProfile(weather, weather->current_status);
|
||||
|
||||
if((weather->current_status == 2) || (weather->current_status == 3)){
|
||||
if ((weather->current_status == 2) || (weather->current_status == 3)) {
|
||||
weather->pos.y -= 50.0f;
|
||||
aWeather_SnowInAdvance(weather, play, 0x28);
|
||||
aWeather_SnowInAdvance(weather, play, 0x28);
|
||||
weather->pos.y += 50.0f;
|
||||
}
|
||||
|
||||
weather->stop_sound_effect = 0;
|
||||
weather->start_sound_effect = 0;
|
||||
|
||||
if ((Save_Get(scene_no) == SCENE_MY_ROOM_BASEMENT_S) || ( (Save_Get(scene_no) - SCENE_MY_ROOM_BASEMENT_M) <= 1U) || (Save_Get(scene_no) == SCENE_MY_ROOM_BASEMENT_LL1)) {
|
||||
if ((Save_Get(scene_no) == SCENE_MY_ROOM_BASEMENT_S) || ((Save_Get(scene_no) - SCENE_MY_ROOM_BASEMENT_M) <= 1U) ||
|
||||
(Save_Get(scene_no) == SCENE_MY_ROOM_BASEMENT_LL1)) {
|
||||
weather->basement_event = 1;
|
||||
} else if (((Common_Get(last_scene_no) == SCENE_MY_ROOM_BASEMENT_S) || ((Common_Get(last_scene_no) - SCENE_MY_ROOM_BASEMENT_M) <= 1U) || (Common_Get(last_scene_no) == SCENE_MY_ROOM_BASEMENT_LL1)) && ( play->fb_wipe_type == 6)) {
|
||||
} else if (((Common_Get(last_scene_no) == SCENE_MY_ROOM_BASEMENT_S) ||
|
||||
((Common_Get(last_scene_no) - SCENE_MY_ROOM_BASEMENT_M) <= 1U) ||
|
||||
(Common_Get(last_scene_no) == SCENE_MY_ROOM_BASEMENT_LL1)) &&
|
||||
(play->fb_wipe_type == 6)) {
|
||||
weather->basement_event = 2;
|
||||
} else {
|
||||
weather->basement_event = 0;
|
||||
weather->basement_event = 0;
|
||||
}
|
||||
if ((play->fb_wipe_type == 6) && (aWeather_IsLand_Event_Check() == 0) && (aWeather_Basement_Event_Check(weather) == 0)) {
|
||||
if ((play->fb_wipe_type == 6) && (aWeather_IsLand_Event_Check() == 0) &&
|
||||
(aWeather_Basement_Event_Check(weather) == 0)) {
|
||||
weather->current_sound_effect = Common_Get(current_sound_effect);
|
||||
} else {
|
||||
weather->current_sound_effect = -1000;
|
||||
aWeather_ChangeEnvSE(weather, play, weather->current_status, weather->current_level);
|
||||
aWeather_SysLevCall_MoveEnd(weather);
|
||||
}
|
||||
else{
|
||||
weather->current_sound_effect = -1000;
|
||||
aWeather_ChangeEnvSE(weather, play, weather->current_status, weather->current_level);
|
||||
aWeather_SysLevCall_MoveEnd(weather);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Weather_Actor_dt(ACTOR* actor, GAME* game){
|
||||
static void Weather_Actor_dt(ACTOR* actor, GAME* game) {
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
|
||||
if(weather->priv != NULL){
|
||||
|
||||
if (weather->priv != NULL) {
|
||||
zelda_free(weather->priv);
|
||||
}
|
||||
|
||||
aWeather_SetClip(weather, 1);
|
||||
}
|
||||
|
||||
static void aWeather_DrawWeatherPrv(ACTOR* actor, GAME* game){
|
||||
static void aWeather_DrawWeatherPrv(ACTOR* actor, GAME* game) {
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
|
||||
aWeather_Priv* priv = weather->priv;
|
||||
aWeather_Profile_c* profile;
|
||||
int i;
|
||||
|
||||
|
||||
_texture_z_light_fog_prim_xlu(game->graph);
|
||||
|
||||
if((weather->current_profile != NULL) && (priv != NULL)){
|
||||
if(weather->current_profile->set != NULL){
|
||||
weather->current_profile->set(game);
|
||||
}
|
||||
if(weather->current_profile->draw != NULL){
|
||||
for(i = 0; i < 100; i++, priv++){
|
||||
if(priv->use != 0){
|
||||
if ((weather->current_profile != NULL) && (priv != NULL)) {
|
||||
if (weather->current_profile->set != NULL) {
|
||||
weather->current_profile->set(game);
|
||||
}
|
||||
if (weather->current_profile->draw != NULL) {
|
||||
for (i = 0; i < 100; i++, priv++) {
|
||||
if (priv->use != 0) {
|
||||
weather->current_profile->draw(priv, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Weather_Actor_draw(ACTOR* actor, GAME* game){
|
||||
aWeather_DrawWeatherPrv(actor,game);
|
||||
}
|
||||
}
|
||||
|
||||
void aWeather_MakeWeatherPrv(ACTOR* actor, GAME* game){
|
||||
static void Weather_Actor_draw(ACTOR* actor, GAME* game) {
|
||||
aWeather_DrawWeatherPrv(actor, game);
|
||||
}
|
||||
|
||||
void aWeather_MakeWeatherPrv(ACTOR* actor, GAME* game) {
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
|
||||
if(weather->current_level != 0){
|
||||
if(weather->current_profile != NULL){
|
||||
if(weather->current_profile->make != NULL){
|
||||
|
||||
if (weather->current_level != 0) {
|
||||
if (weather->current_profile != NULL) {
|
||||
if (weather->current_profile->make != NULL) {
|
||||
weather->current_profile->make(actor, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aWeather_MoveWeatherPrv(WEATHER_ACTOR* weather, GAME* game){
|
||||
static void aWeather_MoveWeatherPrv(WEATHER_ACTOR* weather, GAME* game) {
|
||||
aWeather_Priv* priv;
|
||||
int i;
|
||||
|
||||
priv = weather->priv;
|
||||
|
||||
if((weather->current_profile != NULL) && (priv != NULL) && (weather->current_profile->move != NULL)) {
|
||||
priv = weather->priv;
|
||||
|
||||
for(i = 0; i < 100; i++, priv++){
|
||||
if(priv->use != 0){
|
||||
if ((weather->current_profile != NULL) && (priv != NULL) && (weather->current_profile->move != NULL)) {
|
||||
|
||||
for (i = 0; i < 100; i++, priv++) {
|
||||
if (priv->use != 0) {
|
||||
weather->current_profile->move(priv, game);
|
||||
if(priv->timer != -100){
|
||||
if (priv->timer != -100) {
|
||||
priv->timer--;
|
||||
if(priv->timer <= 0){
|
||||
if (priv->timer <= 0) {
|
||||
aWeather_AbolishPrivate(&weather->actor_class, i);
|
||||
}
|
||||
}
|
||||
@@ -529,35 +515,34 @@ static void aWeather_MoveWeatherPrv(WEATHER_ACTOR* weather, GAME* game){
|
||||
}
|
||||
}
|
||||
|
||||
int aWeather_CountWeatherPrivate(WEATHER_ACTOR* weather){
|
||||
int aWeather_CountWeatherPrivate(WEATHER_ACTOR* weather) {
|
||||
int i;
|
||||
int count;
|
||||
aWeather_Priv* priv = weather->priv;
|
||||
|
||||
count = 0;
|
||||
|
||||
for(i = 0; i < 100; i++, priv++){
|
||||
|
||||
if(priv->use != 0){
|
||||
count++;
|
||||
for (i = 0; i < 100; i++, priv++) {
|
||||
|
||||
if (priv->use != 0) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static void aWeather_ChangeWeather(WEATHER_ACTOR* weather, GAME_PLAY* play){
|
||||
static void aWeather_ChangeWeather(WEATHER_ACTOR* weather, GAME_PLAY* play) {
|
||||
|
||||
if((weather->request_change == TRUE) && (weather->current_level == 0)){
|
||||
if(mFI_GET_TYPE(mFI_GetFieldId())){
|
||||
if ((weather->request_change == TRUE) && (weather->current_level == 0)) {
|
||||
if (mFI_GET_TYPE(mFI_GetFieldId())) {
|
||||
weather->current_status = weather->next_status;
|
||||
aWeather_weatherinfo_CommonSet(weather->current_status, weather->next_level);
|
||||
weather->current_level = 1;
|
||||
weather->current_aim_level = weather->next_level;
|
||||
aWeather_ChangeEnvSE(weather, play, weather->current_status, weather->current_level);
|
||||
weather->request_change = FALSE;
|
||||
}
|
||||
else if(aWeather_CountWeatherPrivate(weather) == 0){
|
||||
} else if (aWeather_CountWeatherPrivate(weather) == 0) {
|
||||
weather->current_status = weather->next_status;
|
||||
aWeather_SetNowProfile(weather, weather->current_status);
|
||||
aWeather_weatherinfo_CommonSet(weather->current_status, weather->next_level);
|
||||
@@ -569,87 +554,87 @@ static void aWeather_ChangeWeather(WEATHER_ACTOR* weather, GAME_PLAY* play){
|
||||
}
|
||||
}
|
||||
|
||||
void aWeather_CheckWeatherTimer(){
|
||||
void aWeather_CheckWeatherTimer() {
|
||||
s_xyz dir;
|
||||
|
||||
mEnv_DecideWindDirect(&dir, 0x3000, 0x3000);
|
||||
}
|
||||
|
||||
|
||||
void aWeather_RenewWeatherLevel(WEATHER_ACTOR* weather, GAME_PLAY* play){
|
||||
void aWeather_RenewWeatherLevel(WEATHER_ACTOR* weather, GAME_PLAY* play) {
|
||||
s16 level;
|
||||
|
||||
if(weather->current_level != weather->current_aim_level){
|
||||
|
||||
if (weather->current_level != weather->current_aim_level) {
|
||||
weather->counter++;
|
||||
if(weather->counter >= 180){
|
||||
if (weather->counter >= 180) {
|
||||
weather->counter = 0;
|
||||
level = weather->current_level;
|
||||
if (weather->current_aim_level < level)
|
||||
weather->current_level--;
|
||||
else
|
||||
level = weather->current_level;
|
||||
if (weather->current_aim_level < level)
|
||||
weather->current_level--;
|
||||
else
|
||||
weather->current_level++;
|
||||
aWeather_ChangeEnvSE(weather, play, weather->current_status, weather->current_level);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aWeather_ChangeWeatherTime0(WEATHER_ACTOR* weather){
|
||||
static void aWeather_ChangeWeatherTime0(WEATHER_ACTOR* weather) {
|
||||
s16 rndWeather, rndIntensity;
|
||||
s16 evWeather, evIntensity;
|
||||
s16 save_weather;
|
||||
|
||||
if ((mEv_CheckTitleDemo() <= 0)){
|
||||
if ((Save_Get(scene_no) == SCENE_START_DEMO) || (Save_Get(scene_no) == SCENE_START_DEMO2) || Save_Get(scene_no) == SCENE_START_DEMO3) {
|
||||
return;
|
||||
}
|
||||
if(!(mFI_CheckPlayerBlockInfo() & 0x400000) && (mTM_check_renew_time(0) != 0)){
|
||||
mEnv_RandomWeather(&rndWeather, &rndIntensity);
|
||||
mEv_GetEventWeather(&evWeather, &evIntensity);
|
||||
if(evWeather != -1){
|
||||
rndWeather = evWeather;
|
||||
rndIntensity = evIntensity;
|
||||
}
|
||||
if((mEv_CheckRealArbeit() == 1) && (rndWeather == 1)){
|
||||
rndWeather = 0;
|
||||
rndIntensity = 0;
|
||||
}
|
||||
mTM_off_renew_time(0);
|
||||
|
||||
save_weather = mEnv_SAVE_GET_WEATHER_TYPE(Save_Get(weather));
|
||||
if (rndWeather == 0 || rndWeather == 3) {
|
||||
if (save_weather == 2 || save_weather == 1) {
|
||||
mEnv_PreRainNowFine_Init();
|
||||
}
|
||||
}
|
||||
Save_Set(weather, rndIntensity | (rndWeather * 16));
|
||||
|
||||
if(((mEv_CheckTitleDemo() != -9) || ( weather->sound_flag != 1))
|
||||
&& (mFI_CheckInIsland() == 0)){
|
||||
aWeather_RequestChangeWeather(&weather->actor_class, rndWeather, rndIntensity);
|
||||
}
|
||||
Common_Set(weather_time, Common_Get(time.rtc_time));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aWeather_MakeKaminari(WEATHER_ACTOR* weather){
|
||||
lbRTC_time_c time = Common_Get(time.rtc_time);
|
||||
u8 month = time.month;
|
||||
s16 timer;
|
||||
|
||||
|
||||
if (( weather->basement_event != 1)) {
|
||||
if (( Save_Get(scene_no) == SCENE_START_DEMO) || (Save_Get(scene_no) == SCENE_START_DEMO2) || Save_Get(scene_no) == SCENE_START_DEMO3) {
|
||||
if ((mEv_CheckTitleDemo() <= 0)) {
|
||||
if ((Save_Get(scene_no) == SCENE_START_DEMO) || (Save_Get(scene_no) == SCENE_START_DEMO2) ||
|
||||
Save_Get(scene_no) == SCENE_START_DEMO3) {
|
||||
return;
|
||||
}
|
||||
if ((month >= lbRTC_JUNE) && (month <= lbRTC_AUGUST) && (weather->current_status == 1) && ( weather->current_level == 3)){
|
||||
timer = weather->lightning_timer % 1000;
|
||||
if (((timer == weather->lightning_timer2) || (timer == (weather->lightning_timer2 + 20))) &&
|
||||
(Common_Get(clip.effect_clip) != NULL) && ( (Save_Get(scene_no) - SCENE_MY_ROOM_BASEMENT_S) > 3U) &&
|
||||
( (Save_Get(scene_no) - SCENE_MUSEUM_ROOM_PAINTING) > 1U) && ( Save_Get(scene_no) != SCENE_MUSEUM_ROOM_FISH)) {
|
||||
f32 effect[] = { 12712.249f };
|
||||
Common_Get(clip.effect_clip)->regist_effect_light(effect, 2, 0x23, 0);
|
||||
if (!(mFI_CheckPlayerBlockInfo() & 0x400000) && (mTM_check_renew_time(0) != 0)) {
|
||||
mEnv_RandomWeather(&rndWeather, &rndIntensity);
|
||||
mEv_GetEventWeather(&evWeather, &evIntensity);
|
||||
if (evWeather != -1) {
|
||||
rndWeather = evWeather;
|
||||
rndIntensity = evIntensity;
|
||||
}
|
||||
if ((mEv_CheckRealArbeit() == 1) && (rndWeather == 1)) {
|
||||
rndWeather = 0;
|
||||
rndIntensity = 0;
|
||||
}
|
||||
mTM_off_renew_time(0);
|
||||
|
||||
save_weather = mEnv_SAVE_GET_WEATHER_TYPE(Save_Get(weather));
|
||||
if (rndWeather == 0 || rndWeather == 3) {
|
||||
if (save_weather == 2 || save_weather == 1) {
|
||||
mEnv_PreRainNowFine_Init();
|
||||
}
|
||||
}
|
||||
Save_Set(weather, rndIntensity | (rndWeather * 16));
|
||||
|
||||
if (((mEv_CheckTitleDemo() != -9) || (weather->sound_flag != 1)) && (mFI_CheckInIsland() == 0)) {
|
||||
aWeather_RequestChangeWeather(&weather->actor_class, rndWeather, rndIntensity);
|
||||
}
|
||||
Common_Set(weather_time, Common_Get(time.rtc_time));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aWeather_MakeKaminari(WEATHER_ACTOR* weather) {
|
||||
lbRTC_time_c time = Common_Get(time.rtc_time);
|
||||
u8 month = time.month;
|
||||
s16 timer;
|
||||
|
||||
if ((weather->basement_event != 1)) {
|
||||
if ((Save_Get(scene_no) == SCENE_START_DEMO) || (Save_Get(scene_no) == SCENE_START_DEMO2) ||
|
||||
Save_Get(scene_no) == SCENE_START_DEMO3) {
|
||||
return;
|
||||
}
|
||||
if ((month >= lbRTC_JUNE) && (month <= lbRTC_AUGUST) && (weather->current_status == 1) &&
|
||||
(weather->current_level == 3)) {
|
||||
timer = weather->lightning_timer % 1000;
|
||||
if (((timer == weather->lightning_timer2) || (timer == (weather->lightning_timer2 + 20))) &&
|
||||
(Common_Get(clip.effect_clip) != NULL) && ((Save_Get(scene_no) - SCENE_MY_ROOM_BASEMENT_S) > 3U) &&
|
||||
((Save_Get(scene_no) - SCENE_MUSEUM_ROOM_PAINTING) > 1U) &&
|
||||
(Save_Get(scene_no) != SCENE_MUSEUM_ROOM_FISH)) {
|
||||
rgba_t kaminari_color = { 70, 70, 160, 255 };
|
||||
Common_Get(clip.effect_clip)->regist_effect_light(kaminari_color, 2, 35, FALSE);
|
||||
}
|
||||
if (timer == (weather->lightning_timer2 + 65)) {
|
||||
sAdo_SysTrgStart(0x424);
|
||||
@@ -660,53 +645,51 @@ static void aWeather_MakeKaminari(WEATHER_ACTOR* weather){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void Weather_Actor_move(ACTOR* actor, GAME* game){
|
||||
static void Weather_Actor_move(ACTOR* actor, GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
|
||||
|
||||
xyz_t* pos;
|
||||
Camera2* camera;
|
||||
s16 angle;
|
||||
s16 umbrella;
|
||||
|
||||
pos = Camera2_getCenterPos_p();
|
||||
camera = &play->camera;
|
||||
|
||||
angle = search_position_angleY(&camera->lookat.center, &camera->lookat.eye);
|
||||
camera = &play->camera;
|
||||
|
||||
angle = search_position_angleY(&camera->lookat.center, &camera->lookat.eye);
|
||||
aWeather_MakeKaminari(weather);
|
||||
aWeather_CheckWeatherTimer(weather);
|
||||
aWeather_MakeWeatherPrv(actor, game);
|
||||
aWeather_RenewWeatherLevel(weather, play);
|
||||
aWeather_MoveWeatherPrv(weather,game);
|
||||
aWeather_RenewWeatherLevel(weather, play);
|
||||
aWeather_MoveWeatherPrv(weather, game);
|
||||
aWeather_ChangeWeather(weather, play);
|
||||
|
||||
|
||||
weather->pos = *pos;
|
||||
|
||||
aWeather_ChangeWeatherTime0(weather);
|
||||
aWeather_ChangeWeatherTime0(weather);
|
||||
|
||||
if(Common_Get(weather) == 1){
|
||||
if (Common_Get(weather) == 1) {
|
||||
umbrella = mPlib_check_player_open_umbrella(play);
|
||||
if(umbrella != weather->umbrella_flag){
|
||||
if (umbrella != weather->umbrella_flag) {
|
||||
aWeather_ChangeEnvSE(weather, play, weather->current_status, weather->current_level);
|
||||
}
|
||||
|
||||
weather->umbrella_flag = umbrella;
|
||||
weather->current_yAngle = angle;
|
||||
}
|
||||
|
||||
if(weather->sound_flag == 2){
|
||||
|
||||
if (weather->sound_flag == 2) {
|
||||
weather->sound_flag = 0;
|
||||
}
|
||||
|
||||
aWeather_EndEnvSE(actor);
|
||||
aWeather_EndEnvSE(actor);
|
||||
}
|
||||
|
||||
extern int aWeather_ChangingWeather() {
|
||||
|
||||
extern int aWeather_ChangingWeather(){
|
||||
|
||||
if(Common_Get(clip.weather_clip) != NULL){
|
||||
if(Common_Get(clip.weather_clip->actor) != NULL){
|
||||
if (Common_Get(clip.weather_clip) != NULL) {
|
||||
if (Common_Get(clip.weather_clip->actor) != NULL) {
|
||||
return Common_Get(clip.weather_clip->actor)->request_change == TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user