Merge branch 'master' into m_kankyo

This commit is contained in:
Cuyler36
2023-10-11 02:48:18 -04:00
committed by GitHub
45 changed files with 2134 additions and 41 deletions
+1 -2
View File
@@ -24,9 +24,8 @@ ACTOR_PROFILE Airplane_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
ETC_AIRPLANE,
ACTOR_OBJ_BANK_7,
ACTOR_OBJ_BANK_AIRPLANE,
sizeof(AIRPLANE_ACTOR),
&Airplane_Actor_ct,
&Airplane_Actor_dt,
&Airplane_Actor_move,
+1 -1
View File
@@ -58,7 +58,7 @@ ACTOR_PROFILE Animal_Logo_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_3,
ACTOR_OBJ_BANK_KEEP,
sizeof(ANIMAL_LOGO_ACTOR),
&aAL_actor_ct,
&aAL_actor_dt,
+1 -1
View File
@@ -12,7 +12,7 @@ ACTOR_PROFILE Aprilfool_Control_Profile = {
ACTOR_PART_CONTROL,
ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_3,
ACTOR_OBJ_BANK_KEEP,
sizeof(APRILFOOL_CONTROL_ACTOR),
&aAPC_actor_ct,
&aAPC_actor_dt,
+1 -1
View File
@@ -13,7 +13,7 @@ ACTOR_PROFILE BoxManager_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
ETC_BOXMANAGER,
ACTOR_OBJ_BANK_3,
ACTOR_OBJ_BANK_KEEP,
sizeof(BOXMANAGER_ACTOR),
&BoxManager_Actor_ct,
&BoxManager_Actor_dt,
+1 -1
View File
@@ -13,7 +13,7 @@ ACTOR_PROFILE BoxMove_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NONE,
EMPTY_NO,
ACTOR_OBJ_BANK_3,
ACTOR_OBJ_BANK_KEEP,
sizeof(BOXMOVE_ACTOR),
&BoxMove_Actor_ct,
&BoxMove_Actor_dt,
+1 -1
View File
@@ -11,7 +11,7 @@ ACTOR_PROFILE BoxTrick01_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
ETC_BOXTRICK,
ACTOR_OBJ_BANK_3,
ACTOR_OBJ_BANK_KEEP,
sizeof(BOXTRICK01_ACTOR),
&BoxTrick01_Actor_ct,
&BoxTrick01_Actor_dt,
+1 -1
View File
@@ -15,7 +15,7 @@ ACTOR_PROFILE Douzou_Profile = {
ACTOR_PART_ITEM,
ACTOR_STATE_TA_SET,
DOUZOU,
ACTOR_OBJ_BANK_3,
ACTOR_OBJ_BANK_KEEP,
sizeof(STRUCTURE_ACTOR),
&aDOU_actor_ct,
+1 -1
View File
@@ -13,7 +13,7 @@ ACTOR_PROFILE Groundhog_Control_Profile = {
ACTOR_PART_CONTROL,
ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_3,
ACTOR_OBJ_BANK_KEEP,
sizeof(GROUNDHOG_CONTROL_ACTOR),
&aGHC_actor_ct,
&aGHC_actor_dt,
+1 -1
View File
@@ -271,7 +271,7 @@ ACTOR_PROFILE Set_Manager_Profile = {
ACTOR_PART_CONTROL, /* control actor type */
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES,
EMPTY_NO,
ACTOR_OBJ_BANK_3,
ACTOR_OBJ_BANK_KEEP,
sizeof(SET_MANAGER),
aSetMgr_ct,
aSetMgr_dt,
+1 -1
View File
@@ -14,7 +14,7 @@ ACTOR_PROFILE Structure_Profile = {
ACTOR_PART_CONTROL,
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_3,
ACTOR_OBJ_BANK_KEEP,
sizeof(STRUCTURE_CONTROL_ACTOR),
&aSTR_actor_ct,
+1 -1
View File
@@ -16,7 +16,7 @@ ACTOR_PROFILE T_Anrium1_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
ACTOR_OBJ_BANK_TOOLS,
sizeof(ANRIUM1_ACTOR),
&aTA1_actor_ct,
NONE_ACTOR_PROC,
+1 -1
View File
@@ -16,7 +16,7 @@ ACTOR_PROFILE T_Bag1_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
ACTOR_OBJ_BANK_TOOLS,
sizeof(BAG1_ACTOR),
&aTBG1_actor_ct,
NONE_ACTOR_PROC,
+1 -1
View File
@@ -16,7 +16,7 @@ ACTOR_PROFILE T_Bag2_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
ACTOR_OBJ_BANK_TOOLS,
sizeof(BAG2_ACTOR),
&aTBG2_actor_ct,
NONE_ACTOR_PROC,
+1 -1
View File
@@ -16,7 +16,7 @@ ACTOR_PROFILE T_Biscus1_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
ACTOR_OBJ_BANK_TOOLS,
sizeof(BISCUS1_ACTOR),
&aTB1_actor_ct,
NONE_ACTOR_PROC,
+1 -1
View File
@@ -16,7 +16,7 @@ ACTOR_PROFILE T_Biscus2_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
ACTOR_OBJ_BANK_TOOLS,
sizeof(BISCUS2_ACTOR),
&aTB2_actor_ct,
NONE_ACTOR_PROC,
+1 -1
View File
@@ -16,7 +16,7 @@ ACTOR_PROFILE T_Biscus3_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
ACTOR_OBJ_BANK_TOOLS,
sizeof(BISCUS3_ACTOR),
&aTB3_actor_ct,
NONE_ACTOR_PROC,
+1 -1
View File
@@ -16,7 +16,7 @@ ACTOR_PROFILE T_Biscus4_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
ACTOR_OBJ_BANK_TOOLS,
sizeof(BISCUS4_ACTOR),
&aTB4_actor_ct,
NONE_ACTOR_PROC,
+1 -1
View File
@@ -16,7 +16,7 @@ ACTOR_PROFILE T_Cobra1_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
ACTOR_OBJ_BANK_TOOLS,
sizeof(COBRA1_ACTOR),
&aTCB1_actor_ct,
NONE_ACTOR_PROC,
+1 -1
View File
@@ -14,7 +14,7 @@ ACTOR_PROFILE T_Cracker_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
395, //Leftover from the object table, so this actor doesn't have an object bank
ACTOR_OBJ_BANK_CRACKER,
sizeof(CRACKER_ACTOR),
&aTCR_actor_ct,
NONE_ACTOR_PROC,
+1 -1
View File
@@ -14,7 +14,7 @@ ACTOR_PROFILE T_Hanabi_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_53,
ACTOR_OBJ_BANK_HANABI,
sizeof(HANABI_ACTOR),
&aTHB_actor_ct,
&aTHB_actor_dt,
+1 -1
View File
@@ -16,7 +16,7 @@ ACTOR_PROFILE T_Hasu1_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
ACTOR_OBJ_BANK_TOOLS,
sizeof(HASU1_ACTOR),
&aTHS1_actor_ct,
NONE_ACTOR_PROC,
+1 -1
View File
@@ -16,7 +16,7 @@ ACTOR_PROFILE T_Hat1_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
ACTOR_OBJ_BANK_TOOLS,
sizeof(HAT1_ACTOR),
&aTHT1_actor_ct,
NONE_ACTOR_PROC,
+1 -1
View File
@@ -16,7 +16,7 @@ ACTOR_PROFILE T_Hat2_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
ACTOR_OBJ_BANK_TOOLS,
sizeof(HAT2_ACTOR),
&aTHT2_actor_ct,
NONE_ACTOR_PROC,
+1 -1
View File
@@ -16,7 +16,7 @@ ACTOR_PROFILE T_Hat3_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
ACTOR_OBJ_BANK_TOOLS,
sizeof(HAT3_ACTOR),
&aTHT3_actor_ct,
NONE_ACTOR_PROC,
+1 -1
View File
@@ -14,7 +14,7 @@ ACTOR_PROFILE T_Pistol_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_16,
ACTOR_OBJ_BANK_TOOLS,
sizeof(PISTOL_ACTOR),
&aTPT_actor_ct,
NONE_ACTOR_PROC,
+1 -1
View File
@@ -16,7 +16,7 @@ ACTOR_PROFILE Tools_Profile = {
ACTOR_PART_CONTROL,
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_3,
ACTOR_OBJ_BANK_KEEP,
sizeof(ACTOR),
aTOL_actor_ct,
aTOL_actor_dt,
+1 -1
View File
@@ -17,7 +17,7 @@ ACTOR_PROFILE Train0_Profile = {
ACTOR_PART_ITEM,
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | ACTOR_STATE_TA_SET | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
TRAIN0,
ACTOR_OBJ_BANK_3,
ACTOR_OBJ_BANK_KEEP,
sizeof(TRAIN0_ACTOR),
&aTR0_actor_ct,
&aTR0_actor_dt,
+1 -1
View File
@@ -22,7 +22,7 @@ ACTOR_PROFILE Train1_Profile = {
ACTOR_PART_ITEM,
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | 1 << 11 | ACTOR_STATE_NO_MOVE_WHILE_CULLED, //figure out flag 0x800
TRAIN1,
ACTOR_OBJ_BANK_3,
ACTOR_OBJ_BANK_KEEP,
sizeof(TRAIN1_ACTOR),
&aTR1_actor_ct,
&aTR1_actor_dt,
+1 -1
View File
@@ -14,7 +14,7 @@ ACTOR_PROFILE TrainDoor_Profile = {
ACTOR_PART_BG,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
TRAIN_DOOR,
ACTOR_OBJ_BANK_11,
ACTOR_OBJ_BANK_TRAINDOOR,
sizeof(TRAINDOOR_ACTOR),
&aTRD_actor_ct,
&aTRD_actor_dt,
+1 -1
View File
@@ -181,7 +181,7 @@ ACTOR_PROFILE Train_Window_Profile = {
ACTOR_PART_ITEM,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
ETC_TRAIN_WINDOW,
ACTOR_OBJ_BANK_41,
ACTOR_OBJ_BANK_TRAINWINDOW,
sizeof(TRAIN_WINDOW_ACTOR),
&Train_Window_Actor_ct,
&Train_Window_Actor_dt,
+131
View File
@@ -0,0 +1,131 @@
#include "ef_lamp_light.h"
#include "m_field_info.h"
#include "m_lights.h"
#include "m_common_data.h"
#include "m_name_table.h"
static void Ef_Lamp_Light_actor_ct(ACTOR* actor, GAME_PLAY* game);
static void Ef_Lamp_Light_actor_dt(ACTOR* actor, GAME_PLAY* game);
static void Ef_Lamp_Light_actor_move(ACTOR* actor, GAME_PLAY* game);
ACTOR_PROFILE Lamp_Light_Profile = {
mAc_PROFILE_LAMP_LIGHT,
ACTOR_PART_EFFECT,
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_KEEP,
sizeof(LAMPLIGHT_ACTOR),
(mActor_proc)Ef_Lamp_Light_actor_ct,
(mActor_proc)Ef_Lamp_Light_actor_dt,
(mActor_proc)Ef_Lamp_Light_actor_move,
NONE_ACTOR_PROC,
NULL,
};
static void Ef_Lamp_Light_actor_ct(ACTOR* actor, GAME_PLAY* play) {
LAMPLIGHT_ACTOR* lamp = (LAMPLIGHT_ACTOR*)actor;
play->kankyo.lamp_light = &lamp->lights;
Light_diffuse_ct(&lamp->lights, 0, 0x50, 0, 0, 0, 0);
lamp->node_p = Global_light_list_new(play, &play->global_light, &lamp->lights);
}
static void Ef_Lamp_Light_actor_dt(ACTOR* actor, GAME_PLAY* play) {
LAMPLIGHT_ACTOR* lamp = (LAMPLIGHT_ACTOR*)actor;
play->kankyo.lamp_light = NULL;
Global_light_list_delete(&play->global_light, lamp->node_p);
}
static int eLL_get_light_sw_other_room(){
int ret = 0;
//Not before 6 p.m or past 6 a.m
if((Common_Get(time.now_sec) < 21600) || (Common_Get(time.now_sec) >= 64800)){
ret = 1;
}
return ret;
}
static int eLL_get_light_sw_player_room(){
//6 p.m to 11 p.m
if((Common_Get(time.now_sec) >= 64800 ) && (Common_Get(time.now_sec) < 82800)){
return 1;
}
return 0;
}
static int eLL_get_light_sw_start_demo(){
int ret = 1;
if(Common_Get(sunlight_flag) == 1){
ret = 0;
}
return ret;
}
static void eLL_ctrl_light_sw(LAMPLIGHT_ACTOR* lamp) {
int ret = 0;
switch (Common_Get(field_type)) {
case 2:
case 3:
switch (mFI_GetFieldId()) {
case mFI_FIELD_PLAYER0_ROOM:
case mFI_FIELD_PLAYER1_ROOM:
case mFI_FIELD_PLAYER2_ROOM:
case mFI_FIELD_PLAYER3_ROOM:
ret = eLL_get_light_sw_player_room(lamp);
break;
case mFI_FIELD_DEMO_STARTDEMO:
case mFI_FIELD_DEMO_STARTDEMO2:
ret = eLL_get_light_sw_start_demo();
break;
default:
ret = eLL_get_light_sw_other_room();
break;
}
break;
case 1:
ret = eLL_get_light_sw_player_room(lamp);
break;
}
lamp->switch_type = ret;
}
static void Ef_Lamp_Light_actor_move(ACTOR* actor, GAME_PLAY* play) {
static s16 add_data_off[] = {2, 2, 1, 0};
static s16 add_data_on[] = {16, 16, 8, 0};
static s16* add_data[] = { add_data_off, add_data_on};
static s16 cmp_data_off[] = { 0, 0, 0, 0 };
static s16 cmp_data_on[] = { 0xC8, 0xC8, 0x96, 0 };
static s16* cmp_data[] = { cmp_data_off, cmp_data_on};
LAMPLIGHT_ACTOR* lamp = (LAMPLIGHT_ACTOR*)actor;
s16 val;
u8* color;
s16* add;
int type;
s16* cmp;
int i;
eLL_ctrl_light_sw(lamp);
color = lamp->lights.lights.diffuse.color;
type = lamp->switch_type;
add = add_data[type];
cmp = cmp_data[type];
for (i = 0; i < 3; i++, add++, cmp++, color++) {
val = *color;
chase_s(&val, *cmp, (0.5f * *add));
*color = val;
}
}
+216
View File
@@ -0,0 +1,216 @@
#include "ef_room_sunshine.h"
#include "m_common_data.h"
#include "m_name_table.h"
#include "m_debug.h"
#include "m_collision_bg.h"
#include "sys_matrix.h"
void Ef_Room_Sunshine_actor_ct(ACTOR* actor, GAME* play);
void Ef_Room_SunshineL_actor_move(ACTOR* actor, GAME* play);
void Ef_Room_SunshineL_actor_draw(ACTOR* actor, GAME* play);
void Ef_Room_SunshineR_actor_move(ACTOR* actor, GAME* play);
void Ef_Room_SunshineR_actor_draw(ACTOR* actor, GAME* play);
extern Gfx light_floor01_mode[];
extern Vtx light_floorL01_vtx[];
extern Vtx light_floorR01_vtx[];
extern Gfx light_shine01_mode[];
extern Vtx light_shineL01_vtx[];
extern Vtx light_shineR01_vtx[];
ACTOR_PROFILE Room_Sunshine_Profile = {
mAc_PROFILE_ROOM_SUNSHINE,
ACTOR_PART_EFFECT,
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_ROOM_SUNSHINE,
sizeof(ROOMSUNSHINE_ACTOR),
Ef_Room_Sunshine_actor_ct,
NONE_ACTOR_PROC,
Ef_Room_SunshineR_actor_move,
Ef_Room_SunshineR_actor_draw,
NULL,
};
void Ef_Room_Sunshine_actor_ct(ACTOR* actor, GAME* game){
ROOMSUNSHINE_ACTOR* sunshine = (ROOMSUNSHINE_ACTOR*)actor;
xyz_t pos;
xyz_t pos2;
xyz_t pos3;
sunshine->unk_174 = 0;
if(sunshine->actor_class.actor_specific == 0){
sunshine->actor_class.mv_proc = Ef_Room_SunshineL_actor_move;
sunshine->actor_class.dw_proc = Ef_Room_SunshineL_actor_draw;
}
else{
sunshine->actor_class.world.position.x -= 1.0f;
}
pos = sunshine->actor_class.world.position;
sunshine->actor_class.world.position.y = mCoBG_GetBgY_OnlyCenter_FromWpos(0.0f, &pos);
sunshine->actor_class.scale.x = 1.0f;
sunshine->actor_class.scale.y = 1.0f;
sunshine->actor_class.scale.z = 1.0f;
switch(sunshine->actor_class.actor_specific){
case 2:
sunshine->actor_class.mv_proc = Ef_Room_SunshineL_actor_move;
sunshine->actor_class.dw_proc = Ef_Room_SunshineL_actor_draw;
sunshine->actor_class.world.position.x += 5.0f;
pos2 = sunshine->actor_class.world.position;
sunshine->actor_class.world.position.y = 1.0f + mCoBG_GetBgY_OnlyCenter_FromWpos(0.0f, &pos2);
sunshine->actor_class.world.position.x -= 6.0f;
break;
case 3:
sunshine->actor_class.world.position.x -= 5.0f;
pos3 = sunshine->actor_class.world.position;
sunshine->actor_class.world.position.y = 1.0f + mCoBG_GetBgY_OnlyCenter_FromWpos(0.0f, &pos3);
sunshine->actor_class.world.position.x += 6.0f;
break;
}
}
f32 calc_scale_Ef_Room_Sunshine(int flag, int sec){
if(flag == 0){
return 1.5f * sin_s((sec << 14) / 28800.0f);
}
else{
return 1.5f * sin_s((sec << 14) / 14400.0f);
}
}
int calc_alpha_Ef_Room_Sunshine(){
f32 ret;
int sec;
if(Common_Get(time.now_sec) < 14400){
ret = (120.0f + GETREG(TAKREG,30)) * ((14400 - Common_Get(time.now_sec)) / 14400.0f);
}
else if(Common_Get(time.now_sec) < 72000){
sec = (Common_Get(time.now_sec) - 43200) >= 0 ?
(Common_Get(time.now_sec) - 43200U) : -(Common_Get(time.now_sec) - 43200U);
ret = 255.0f * ((28800 - sec) / 28800.0f);
}
else{
ret = (120.0f + GETREG(TAKREG,30)) * ((14400 - (86400 - Common_Get(time.now_sec))) / 14400.0f);
}
if((Common_Get(weather) == 1) || (Common_Get(weather) == 2)){
ret *= 0.6f;
}
return (u8)ret;
}
void Ef_Room_SunshineL_actor_move(ACTOR* actor, GAME* game){
ROOMSUNSHINE_ACTOR* sunshine = (ROOMSUNSHINE_ACTOR*)actor;
if(Common_Get(time.now_sec) < 14400){
sunshine->actor_class.scale.x = calc_scale_Ef_Room_Sunshine(1, Common_Get(time.now_sec));
}
else if ((Common_Get(time.now_sec) >= 43200) && (Common_Get(time.now_sec) < 72000)){
sunshine->actor_class.scale.x = calc_scale_Ef_Room_Sunshine(0, Common_Get(time.now_sec) - 43200);
}
else{
sunshine->actor_class.scale.x = 0.0f;
}
}
void Ef_Room_SunshineR_actor_move(ACTOR* actor, GAME* game){
ROOMSUNSHINE_ACTOR* sunshine = (ROOMSUNSHINE_ACTOR*)actor;
if((Common_Get(time.now_sec) >= 14400) && (Common_Get(time.now_sec) < 43200)){
sunshine->actor_class.scale.x = calc_scale_Ef_Room_Sunshine(0, 43200 - Common_Get(time.now_sec));
}
else if (Common_Get(time.now_sec) >= 72000){
sunshine->actor_class.scale.x = calc_scale_Ef_Room_Sunshine(1, 86400 -Common_Get(time.now_sec));
}
else{
sunshine->actor_class.scale.x = 0.0f;
}
}
void setup_mode_Ef_Room_Sunshine(ACTOR* actor, GAME_PLAY* play){
ROOMSUNSHINE_ACTOR* sunshine = (ROOMSUNSHINE_ACTOR*)actor;
u8* color;
f32 alpha;
GRAPH* graph = play->game.graph;
OPEN_DISP(graph);
Matrix_translate(sunshine->actor_class.world.position.x, 0.1f +sunshine->actor_class.world.position.y,
sunshine->actor_class.world.position.z, 0);
Matrix_scale(sunshine->actor_class.scale.x, sunshine->actor_class.scale.y, sunshine->actor_class.scale.z,1);
gDPPipeSync(NEXT_POLY_XLU_DISP);
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(play->game.graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if((Common_Get(time.now_sec) >= 14400) && (Common_Get(time.now_sec) < 72000)){
color =play->kankyo.base_light.sun_color_window;
}
else{
color =play->kankyo.base_light.moon_color_window;
}
alpha = (u8)calc_alpha_Ef_Room_Sunshine() * mKK_windowlight_alpha_get();
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0,0, color[0], color[1], color[2], (int)(alpha));
CLOSE_DISP(graph);
}
void Ef_Room_SunshineL_actor_draw(ACTOR* actor, GAME* game){
GAME_PLAY* play = (GAME_PLAY*)game;
GRAPH* graph;
if((mKK_windowlight_alpha_get() < 9.99999974738e-05f) || (actor->scale.x == 0.0f)){
return;
}
graph = play->game.graph;
setup_mode_Ef_Room_Sunshine(actor, play);
OPEN_DISP(graph);
gSPDisplayList(NEXT_POLY_XLU_DISP, light_floor01_mode);
gSPDisplayList(NEXT_POLY_XLU_DISP, light_floorL01_vtx);
gSPDisplayList(NEXT_POLY_XLU_DISP, light_shine01_mode);
gSPDisplayList(NEXT_POLY_XLU_DISP, light_shineL01_vtx);
CLOSE_DISP(graph);
}
void Ef_Room_SunshineR_actor_draw(ACTOR* actor, GAME* game){
GAME_PLAY* play = (GAME_PLAY*)game;
GRAPH* graph;
if((mKK_windowlight_alpha_get() < 9.99999974738e-05f) || (actor->scale.x == 0.0f)){
return;
}
graph = play->game.graph;
setup_mode_Ef_Room_Sunshine(actor, play);
OPEN_DISP(graph);
gSPDisplayList(NEXT_POLY_XLU_DISP, light_floor01_mode);
gSPDisplayList(NEXT_POLY_XLU_DISP, light_floorR01_vtx);
gSPDisplayList(NEXT_POLY_XLU_DISP, light_shine01_mode);
gSPDisplayList(NEXT_POLY_XLU_DISP, light_shineR01_vtx);
CLOSE_DISP(graph);
}
+323
View File
@@ -0,0 +1,323 @@
#include "ef_room_sunshine_minsect.h"
#include "m_common_data.h"
#include "m_name_table.h"
#include "m_debug.h"
#include "m_collision_bg.h"
#include "sys_matrix.h"
void Ef_Room_Sunshine_Minsect_actor_ct(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_Minsect_actor_dt(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_MinsectL_actor_draw(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_MinsectL_actor_move(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_MinsectR_actor_draw(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_MinsectR_actor_move(ACTOR* actor, GAME* play);
extern Gfx rom_museum4_ue_model[];
extern Gfx rom_museum4_model[];
extern Gfx obj_museum4_shine_1T_model[];
extern Gfx obj_museum4_shine_2T_model[];
u8 draw_status;
ACTOR_PROFILE Room_Sunshine_Minsect_Profile = {
mAc_PROFILE_ROOM_SUNSHINE_MINSECT,
ACTOR_PART_ITEM,
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_EF_MINSECT,
sizeof(ROOMSUNSHINEMINSECT_ACTOR),
Ef_Room_Sunshine_Minsect_actor_ct,
NONE_ACTOR_PROC,
Ef_Room_Sunshine_MinsectR_actor_move,
Ef_Room_Sunshine_MinsectR_actor_draw,
NULL,
};
void Ef_Room_Sunshine_Minsect_actor_ct(ACTOR* actor, GAME* game){
ROOMSUNSHINEMINSECT_ACTOR* minsect = (ROOMSUNSHINEMINSECT_ACTOR*)actor;
xyz_t pos;
minsect->ef_sunshine_class.unk_174 = 0;
draw_status = 0;
if(minsect->ef_sunshine_class.actor_class.actor_specific == 0){
minsect->ef_sunshine_class.actor_class.mv_proc = Ef_Room_Sunshine_MinsectL_actor_move;
minsect->ef_sunshine_class.actor_class.dw_proc = Ef_Room_Sunshine_MinsectL_actor_draw;
}
else{
minsect->ef_sunshine_class.actor_class.world.position.x -= 1.0f;
}
pos = minsect->ef_sunshine_class.actor_class.world.position;
minsect->ef_sunshine_class.actor_class.world.position.y = mCoBG_GetBgY_OnlyCenter_FromWpos(0.0f, &pos);
minsect->ef_sunshine_class.actor_class.scale.x = 0.01f;
minsect->ef_sunshine_class.actor_class.scale.y = 0.01f;
minsect->ef_sunshine_class.actor_class.scale.z = 0.01f;
minsect->ef_sunshine_class.actor_class.cull_radius = 10000.0f;
switch(minsect->ef_sunshine_class.actor_class.actor_specific){
case 2:
minsect->ef_sunshine_class.actor_class.mv_proc = Ef_Room_Sunshine_MinsectL_actor_move;
minsect->ef_sunshine_class.actor_class.dw_proc = Ef_Room_Sunshine_MinsectL_actor_draw;
minsect->ef_sunshine_class.actor_class.world.position.x += 5.0f;
minsect->ef_sunshine_class.actor_class.world.position.x -= 6.0f;
break;
case 3:
minsect->ef_sunshine_class.actor_class.world.position.x -= 5.0f;
minsect->ef_sunshine_class.actor_class.world.position.x += 6.0f;
break;
}
}
f32 calc_scale_Ef_Room_Sunshine_Minsect(int flag, int sec){
if(flag == 0){
return 0.01f * (1.5f * sin_s((sec << 14) / 28800.0f));
}
else{
return 0.01f * (1.5f * sin_s((sec << 14) / 14400.0f));
}
}
int calc_alpha_Ef_Room_SunshineMinsect(){
f32 ret;
int sec;
if(Common_Get(time.now_sec) < 14400){
ret = 120.0f * ((14400 - Common_Get(time.now_sec)) / 14400.0f);
}
else if(Common_Get(time.now_sec) < 72000){
//any other number matches codegen, but 43200 breaks
sec = (Common_Get(time.now_sec) - 43200) >= 0 ?
(Common_Get(time.now_sec) - 43200U) : -(Common_Get(time.now_sec) - 43200U);
ret = 255.0f * ((28800 - sec) / 28800.0f);
}
else{
ret = 120.0f * ((14400 - (86400 - Common_Get(time.now_sec))) / 14400.0f);
}
if((Common_Get(weather) == 1) || (Common_Get(weather) == 2)){
ret *= 0.6f;
}
return (u8)ret;
}
void Ef_Room_Sunshine_MinsectL_actor_move(ACTOR* actor, GAME* game){
ROOMSUNSHINEMINSECT_ACTOR* minsect = (ROOMSUNSHINEMINSECT_ACTOR*)actor;
if(Common_Get(time.now_sec) < 14400){
minsect->ef_sunshine_class.actor_class.scale.x = calc_scale_Ef_Room_Sunshine_Minsect(1, Common_Get(time.now_sec));
}
else if ((Common_Get(time.now_sec) >= 43200) && (Common_Get(time.now_sec) < 72000)){
minsect->ef_sunshine_class.actor_class.scale.x = calc_scale_Ef_Room_Sunshine_Minsect(0, Common_Get(time.now_sec) - 43200);
}
else{
minsect->ef_sunshine_class.actor_class.scale.x = 0.0f;
}
minsect->ef_sunshine_class.actor_class.world.position.y = minsect->ef_sunshine_class.actor_class.home.position.y;
minsect->ef_sunshine_class.actor_class.world.position.y += 0.01f * GETREG(TAKREG,64);
}
void Ef_Room_Sunshine_MinsectR_actor_move(ACTOR* actor, GAME* game){
ROOMSUNSHINEMINSECT_ACTOR* minsect = (ROOMSUNSHINEMINSECT_ACTOR*)actor;
if((Common_Get(time.now_sec) >= 14400) && (Common_Get(time.now_sec) < 43200)){
minsect->ef_sunshine_class.actor_class.scale.x = -calc_scale_Ef_Room_Sunshine_Minsect(0, 43200 - Common_Get(time.now_sec));
}
else if (Common_Get(time.now_sec) >= 72000){
minsect->ef_sunshine_class.actor_class.scale.x = -calc_scale_Ef_Room_Sunshine_Minsect(1, 86400 -Common_Get(time.now_sec));
}
else{
minsect->ef_sunshine_class.actor_class.scale.x = 0.0f;
}
minsect->ef_sunshine_class.actor_class.world.position.y = minsect->ef_sunshine_class.actor_class.home.position.y;
minsect->ef_sunshine_class.actor_class.world.position.y += 0.01f * GETREG(TAKREG,64);
}
void setup_mode_Ef_Room_Sunshine_Minsect(ACTOR* actor, GAME_PLAY* play){
ROOMSUNSHINE_ACTOR* sunshine = (ROOMSUNSHINE_ACTOR*)actor;
u8* color;
int calc;
GRAPH* graph = play->game.graph;
OPEN_DISP(graph);
Matrix_translate(sunshine->actor_class.world.position.x, sunshine->actor_class.world.position.y,
sunshine->actor_class.world.position.z, 0);
Matrix_scale(sunshine->actor_class.scale.x, sunshine->actor_class.scale.y, sunshine->actor_class.scale.z,1);
gDPPipeSync(NEXT_POLY_XLU_DISP);
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(play->game.graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if((Common_Get(time.now_sec) >= 14400) && (Common_Get(time.now_sec) < 72000)){
color =play->kankyo.base_light.sun_color_window;
}
else{
color =play->kankyo.base_light.moon_color_window;
}
calc = ((u8)calc_alpha_Ef_Room_SunshineMinsect() * mKK_windowlight_alpha_get());
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, calc, color[0], color[1], color[2], 75);
CLOSE_DISP(graph);
}
void setup_mode_Ef_Room_Sunshine_Minsect_decal(ACTOR* actor, GAME_PLAY* play){
ROOMSUNSHINE_ACTOR* sunshine = (ROOMSUNSHINE_ACTOR*)actor;
u8* color;
int calc;
GRAPH* graph = play->game.graph;
OPEN_DISP(graph);
Matrix_translate(sunshine->actor_class.world.position.x, sunshine->actor_class.world.position.y,
sunshine->actor_class.world.position.z, 0);
Matrix_scale(sunshine->actor_class.scale.x, sunshine->actor_class.scale.y, sunshine->actor_class.scale.z,1);
gDPPipeSync(NEXT_POLY_OPA_DISP);
gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(play->game.graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if((Common_Get(time.now_sec) >= 14400) && (Common_Get(time.now_sec) < 72000)){
color =play->kankyo.base_light.sun_color_window;
}
else{
color =play->kankyo.base_light.moon_color_window;
}
calc = ((u8)calc_alpha_Ef_Room_SunshineMinsect() * mKK_windowlight_alpha_get());
gDPSetPrimColor(NEXT_POLY_OPA_DISP, 0, calc, color[0], color[1], color[2], 75);
CLOSE_DISP(graph);
}
void BG_draw_Minsect(ACTOR* actor, GAME_PLAY* play){
GRAPH* graph;
if(!(draw_status & 4)){
draw_status |= 4;
}
if((draw_status & 1) && (draw_status & 2)){
draw_status = 0;
}
graph = play->game.graph;
Matrix_scale(0.0625f, 0.0625f, 0.0625f, 0);
Global_kankyo_set_room_prim(play);
OPEN_DISP(graph);
gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(play->game.graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(NEXT_POLY_OPA_DISP, rom_museum4_ue_model);
CLOSE_DISP(graph);
}
void BG_draw_Minsect_niwa(ACTOR* actor, GAME_PLAY* play){
GRAPH* graph;
graph = play->game.graph;
Matrix_scale(0.0625f, 0.0625f, 0.0625f, 0);
Global_kankyo_set_room_prim(play);
OPEN_DISP(graph);
gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(play->game.graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(NEXT_POLY_OPA_DISP, rom_museum4_model);
CLOSE_DISP(graph);
}
void Ef_Room_Sunshine_MinsectL_actor_draw(ACTOR* actor, GAME* game){
GRAPH* graph;
_texture_z_light_fog_prim(game->graph);
_texture_z_light_fog_prim_shadow(game->graph);
_texture_z_light_fog_prim_xlu(game->graph);
draw_status |= 1;
if(mKK_windowlight_alpha_get() < 9.99999974738e-05f){
if ((draw_status & 1) && (draw_status & 2) && !(draw_status & 4)){
BG_draw_Minsect_niwa(actor,(GAME_PLAY*)game);
BG_draw_Minsect(actor,(GAME_PLAY*)game);
}
}
else if(0.0f == actor->scale.x){
if ((draw_status & 1) && (draw_status & 2) && !(draw_status & 4)){
BG_draw_Minsect_niwa(actor,(GAME_PLAY*)game);
BG_draw_Minsect(actor,(GAME_PLAY*)game);
}
}
else{
s16 reg;
graph = game->graph;
BG_draw_Minsect_niwa(actor,(GAME_PLAY*)game);
setup_mode_Ef_Room_Sunshine_Minsect(actor,(GAME_PLAY*)game);
OPEN_DISP(graph);
gSPDisplayList(NEXT_POLY_XLU_DISP, obj_museum4_shine_1T_model);
setup_mode_Ef_Room_Sunshine_Minsect_decal(actor,(GAME_PLAY*)game);
if(REGADDR(TAKREG, 0) == 0){
gSPDisplayList(NEXT_POLY_OPA_DISP, obj_museum4_shine_2T_model);
}
BG_draw_Minsect(actor,(GAME_PLAY*)game);
CLOSE_DISP(graph);
}
}
void Ef_Room_Sunshine_MinsectR_actor_draw(ACTOR* actor, GAME* game){
GRAPH* graph;
_texture_z_light_fog_prim(game->graph);
_texture_z_light_fog_prim_shadow(game->graph);
_texture_z_light_fog_prim_xlu(game->graph);
draw_status |= 2;
if(mKK_windowlight_alpha_get() < 9.99999974738e-05f){
if ((draw_status & 1) && (draw_status & 2) && !(draw_status & 4)){
BG_draw_Minsect_niwa(actor,(GAME_PLAY*)game);
BG_draw_Minsect(actor,(GAME_PLAY*)game);
}
}
else if(0.0f == actor->scale.x){
if ((draw_status & 1) && (draw_status & 2) && !(draw_status & 4)){
BG_draw_Minsect_niwa(actor,(GAME_PLAY*)game);
BG_draw_Minsect(actor,(GAME_PLAY*)game);
}
}
else{
graph = game->graph;
BG_draw_Minsect_niwa(actor,(GAME_PLAY*)game);
setup_mode_Ef_Room_Sunshine_Minsect(actor,(GAME_PLAY*)game);
OPEN_DISP(graph);
gSPDisplayList(NEXT_POLY_XLU_DISP, obj_museum4_shine_1T_model);
setup_mode_Ef_Room_Sunshine_Minsect_decal(actor,(GAME_PLAY*)game);
if(REGADDR(TAKREG, 0) == 0){
gSPDisplayList(NEXT_POLY_OPA_DISP, obj_museum4_shine_2T_model);
}
BG_draw_Minsect(actor,(GAME_PLAY*)game);
CLOSE_DISP(graph);
}
}
+209
View File
@@ -0,0 +1,209 @@
#include "ef_room_sunshine_museum.h"
#include "m_common_data.h"
#include "m_name_table.h"
#include "m_debug.h"
#include "m_collision_bg.h"
#include "sys_matrix.h"
void Ef_Room_Sunshine_Museum_actor_ct(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_Museum_actor_dt(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_MuseumL_actor_draw(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_MuseumL_actor_move(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_MuseumR_actor_draw(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_MuseumR_actor_move(ACTOR* actor, GAME* play);
extern Gfx obj_museum1_shine_model[];
extern Gfx obj_museum1_shine_modelT[];
ACTOR_PROFILE Room_Sunshine_Museum_Profile = {
mAc_PROFILE_ROOM_SUNSHINE_MUSEUM,
ACTOR_PART_EFFECT,
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_EF_MUSEUM,
sizeof(ROOMSUNSHINEMUSEUM_ACTOR),
Ef_Room_Sunshine_Museum_actor_ct,
NONE_ACTOR_PROC,
Ef_Room_Sunshine_MuseumR_actor_move,
Ef_Room_Sunshine_MuseumR_actor_draw,
NULL,
};
void Ef_Room_Sunshine_Museum_actor_ct(ACTOR* actor, GAME* game){
ROOMSUNSHINEMUSEUM_ACTOR* museum = (ROOMSUNSHINEMUSEUM_ACTOR*)actor;
xyz_t pos;
xyz_t pos2;
xyz_t pos3;
museum->ef_sunshine_class.unk_174 = 0;
if(museum->ef_sunshine_class.actor_class.actor_specific == 0){
museum->ef_sunshine_class.actor_class.mv_proc = Ef_Room_Sunshine_MuseumL_actor_move;
museum->ef_sunshine_class.actor_class.dw_proc = Ef_Room_Sunshine_MuseumL_actor_draw;
}
else{
museum->ef_sunshine_class.actor_class.world.position.x -= 1.0f;
}
pos = museum->ef_sunshine_class.actor_class.world.position;
museum->ef_sunshine_class.actor_class.world.position.y = mCoBG_GetBgY_OnlyCenter_FromWpos(0.0f, &pos);
museum->ef_sunshine_class.actor_class.scale.x = 0.01f;
museum->ef_sunshine_class.actor_class.scale.y = 0.01f;
museum->ef_sunshine_class.actor_class.scale.z = 0.01f;
switch(museum->ef_sunshine_class.actor_class.actor_specific){
case 2:
museum->ef_sunshine_class.actor_class.mv_proc = Ef_Room_Sunshine_MuseumL_actor_move;
museum->ef_sunshine_class.actor_class.dw_proc = Ef_Room_Sunshine_MuseumL_actor_draw;
museum->ef_sunshine_class.actor_class.world.position.x += 5.0f;
pos2 = museum->ef_sunshine_class.actor_class.world.position;
museum->ef_sunshine_class.actor_class.world.position.y = 1.0f + mCoBG_GetBgY_OnlyCenter_FromWpos(0.0f, &pos2) - 40.0f;
museum->ef_sunshine_class.actor_class.world.position.x -= 6.0f;
break;
case 3:
museum->ef_sunshine_class.actor_class.world.position.x -= 5.0f;
pos3 = museum->ef_sunshine_class.actor_class.world.position;
museum->ef_sunshine_class.actor_class.world.position.y = 1.0f + mCoBG_GetBgY_OnlyCenter_FromWpos(0.0f, &pos3) - 40.0f;
museum->ef_sunshine_class.actor_class.world.position.x += 6.0f;
break;
}
}
f32 calc_scale_Ef_Room_Sunshine_Museum(int flag, int sec){
if(flag == 0){
return 0.01f * (1.5f * sin_s((sec << 14) / 28800.0f));
}
else{
return 0.01f * (1.5f * sin_s((sec << 14) / 14400.0f));
}
}
int calc_alpha_Ef_Room_SunshineMuseum(){
f32 ret;
int sec;
if(Common_Get(time.now_sec) < 14400){
ret = 120.0f * ((14400 - Common_Get(time.now_sec)) / 14400.0f);
}
else if(Common_Get(time.now_sec) < 72000){
//any other number matches codegen, but 43200 breaks
sec = (Common_Get(time.now_sec) - 43200) >= 0 ?
(Common_Get(time.now_sec) - 43200U) : -(Common_Get(time.now_sec) - 43200U);
ret = 255.0f * ((28800 - sec) / 28800.0f);
}
else{
ret = 120.0f * ((14400 - (86400 - Common_Get(time.now_sec))) / 14400.0f);
}
if((Common_Get(weather) == 1) || (Common_Get(weather) == 2)){
ret *= 0.6f;
}
return (u8)ret;
}
void Ef_Room_Sunshine_MuseumL_actor_move(ACTOR* actor, GAME* game){
ROOMSUNSHINEMUSEUM_ACTOR* museum = (ROOMSUNSHINEMUSEUM_ACTOR*)actor;
if(Common_Get(time.now_sec) < 14400){
museum->ef_sunshine_class.actor_class.scale.x = calc_scale_Ef_Room_Sunshine_Museum(1, Common_Get(time.now_sec));
}
else if ((Common_Get(time.now_sec) >= 43200) && (Common_Get(time.now_sec) < 72000)){
museum->ef_sunshine_class.actor_class.scale.x = calc_scale_Ef_Room_Sunshine_Museum(0, Common_Get(time.now_sec) - 43200);
}
else{
museum->ef_sunshine_class.actor_class.scale.x = 0.0f;
}
}
void Ef_Room_Sunshine_MuseumR_actor_move(ACTOR* actor, GAME* game){
ROOMSUNSHINEMUSEUM_ACTOR* museum = (ROOMSUNSHINEMUSEUM_ACTOR*)actor;
if((Common_Get(time.now_sec) >= 14400) && (Common_Get(time.now_sec) < 43200)){
museum->ef_sunshine_class.actor_class.scale.x = -calc_scale_Ef_Room_Sunshine_Museum(0, 43200 - Common_Get(time.now_sec));
}
else if (Common_Get(time.now_sec) >= 72000){
museum->ef_sunshine_class.actor_class.scale.x = -calc_scale_Ef_Room_Sunshine_Museum(1, 86400 -Common_Get(time.now_sec));
}
else{
museum->ef_sunshine_class.actor_class.scale.x = 0.0f;
}
}
void setup_mode_Ef_Room_Sunshine_Museum(ACTOR* actor, GAME_PLAY* play){
ROOMSUNSHINE_ACTOR* sunshine = (ROOMSUNSHINE_ACTOR*)actor;
u8* color;
int calc;
GRAPH* graph = play->game.graph;
OPEN_DISP(graph);
Matrix_translate(sunshine->actor_class.world.position.x + GETREG(TAKREG,20), sunshine->actor_class.world.position.y + GETREG(TAKREG,21),
sunshine->actor_class.world.position.z + GETREG(TAKREG,22), 0);
Matrix_scale(sunshine->actor_class.scale.x, sunshine->actor_class.scale.y, sunshine->actor_class.scale.z,1);
gDPPipeSync(NEXT_POLY_XLU_DISP);
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(play->game.graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if((Common_Get(time.now_sec) >= 14400) && (Common_Get(time.now_sec) < 72000)){
color =play->kankyo.base_light.sun_color_window;
}
else{
color =play->kankyo.base_light.moon_color_window;
}
calc = ((u8)calc_alpha_Ef_Room_SunshineMuseum() * mKK_windowlight_alpha_get());
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, calc, color[0], color[1], color[2], 75);
CLOSE_DISP(graph);
}
void Ef_Room_Sunshine_MuseumL_actor_draw(ACTOR* actor, GAME* game){
GRAPH* graph;
GAME_PLAY* play = (GAME_PLAY*)game;
if(!(mKK_windowlight_alpha_get() < 9.99999974738e-05f) && (actor->scale.x != 0.0f)){
graph = play->game.graph;
setup_mode_Ef_Room_Sunshine_Museum(actor, play);
OPEN_DISP(graph);
gSPDisplayList(NEXT_POLY_XLU_DISP, obj_museum1_shine_model);
gSPDisplayList(NEXT_POLY_XLU_DISP, obj_museum1_shine_modelT);
CLOSE_DISP(graph);
}
}
void Ef_Room_Sunshine_MuseumR_actor_draw(ACTOR* actor, GAME* game){
GRAPH* graph;
GAME_PLAY* play = (GAME_PLAY*)game;
if(!(mKK_windowlight_alpha_get() < 9.99999974738e-05f) && (actor->scale.x != 0.0f)){
graph = play->game.graph;
setup_mode_Ef_Room_Sunshine_Museum(actor, play);
OPEN_DISP(graph);
gSPDisplayList(NEXT_POLY_XLU_DISP, obj_museum1_shine_model);
gSPDisplayList(NEXT_POLY_XLU_DISP, obj_museum1_shine_modelT);
CLOSE_DISP(graph);
}
}
+220
View File
@@ -0,0 +1,220 @@
#include "ef_room_sunshine_police.h"
#include "m_common_data.h"
#include "m_name_table.h"
#include "m_debug.h"
#include "m_collision_bg.h"
#include "sys_matrix.h"
void Ef_Room_Sunshine_Police_actor_ct(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_Police_actor_dt(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_PoliceL_actor_draw(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_PoliceL_actor_move(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_PoliceR_actor_draw(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_PoliceR_actor_move(ACTOR* actor, GAME* play);
extern Gfx obj_koban_shine_modelT[];
ACTOR_PROFILE Room_Sunshine_Police_Profile = {
mAc_PROFILE_ROOM_SUNSHINE_POLICE,
ACTOR_PART_EFFECT,
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_EF_POLICE,
sizeof(ROOMSUNSHINEPOLICE_ACTOR),
Ef_Room_Sunshine_Police_actor_ct,
NONE_ACTOR_PROC,
Ef_Room_Sunshine_PoliceR_actor_move,
Ef_Room_Sunshine_PoliceR_actor_draw,
NULL,
};
void Ef_Room_Sunshine_Police_actor_ct(ACTOR* actor, GAME* game){
ROOMSUNSHINEPOLICE_ACTOR* police = (ROOMSUNSHINEPOLICE_ACTOR*)actor;
xyz_t pos;
xyz_t pos2;
xyz_t pos3;
police->ef_sunshine_class.unk_174 = 0;
if(police->ef_sunshine_class.actor_class.actor_specific == 0){
police->ef_sunshine_class.actor_class.mv_proc = Ef_Room_Sunshine_PoliceL_actor_move;
police->ef_sunshine_class.actor_class.dw_proc = Ef_Room_Sunshine_PoliceL_actor_draw;
}
else{
police->ef_sunshine_class.actor_class.world.position.x -= 1.0f;
}
pos = police->ef_sunshine_class.actor_class.world.position;
police->ef_sunshine_class.actor_class.world.position.y = mCoBG_GetBgY_OnlyCenter_FromWpos(0.0f, &pos);
police->ef_sunshine_class.actor_class.scale.x = 0.01f;
police->ef_sunshine_class.actor_class.scale.y = 0.01f;
police->ef_sunshine_class.actor_class.scale.z = 0.01f;
switch(police->ef_sunshine_class.actor_class.actor_specific){
case 2:
police->ef_sunshine_class.actor_class.mv_proc = Ef_Room_Sunshine_PoliceL_actor_move;
police->ef_sunshine_class.actor_class.dw_proc = Ef_Room_Sunshine_PoliceL_actor_draw;
police->ef_sunshine_class.actor_class.world.position.x += 5.0f;
pos2 = police->ef_sunshine_class.actor_class.world.position;
police->ef_sunshine_class.actor_class.world.position.y = 1.0f + mCoBG_GetBgY_OnlyCenter_FromWpos(0.0f, &pos2) - 40.0f;
police->ef_sunshine_class.actor_class.world.position.x -= 6.0f;
break;
case 3:
police->ef_sunshine_class.actor_class.world.position.x -= 5.0f;
pos3 = police->ef_sunshine_class.actor_class.world.position;
police->ef_sunshine_class.actor_class.world.position.y = 1.0f + mCoBG_GetBgY_OnlyCenter_FromWpos(0.0f, &pos3) - 40.0f;
police->ef_sunshine_class.actor_class.world.position.x += 6.0f;
break;
}
}
f32 calc_scale_Ef_Room_Sunshine_Police(int flag, int sec){
if(flag == 0){
return 0.01f * (1.5f * sin_s((sec << 14) / 28800.0f));
}
else{
return 0.01f * (1.5f * sin_s((sec << 14) / 14400.0f));
}
}
int calc_alpha_Ef_Room_SunshinePolice(){
f32 ret;
int sec;
if(Common_Get(time.now_sec) < 14400){
ret = 120.0f * ((14400 - Common_Get(time.now_sec)) / 14400.0f);
}
else if(Common_Get(time.now_sec) < 72000){
sec = (Common_Get(time.now_sec) - 43200) >= 0 ?
(Common_Get(time.now_sec) - 43200U) : -(Common_Get(time.now_sec) - 43200U);
ret = 255.0f * ((28800 - sec) / 28800.0f);
}
else{
ret = 120.0f * ((14400 - (86400 - Common_Get(time.now_sec))) / 14400.0f);
}
if((Common_Get(weather) == 1) || (Common_Get(weather) == 2)){
ret *= 0.6f;
}
return (u8)ret;
}
void Ef_Room_Sunshine_PoliceL_actor_move(ACTOR* actor, GAME* game){
ROOMSUNSHINEPOLICE_ACTOR* police = (ROOMSUNSHINEPOLICE_ACTOR*)actor;
if(Common_Get(time.now_sec) < 14400){
police->ef_sunshine_class.actor_class.scale.x = calc_scale_Ef_Room_Sunshine_Police(1, Common_Get(time.now_sec));
}
else if ((Common_Get(time.now_sec) >= 43200) && (Common_Get(time.now_sec) < 72000)){
police->ef_sunshine_class.actor_class.scale.x = calc_scale_Ef_Room_Sunshine_Police(0, Common_Get(time.now_sec) - 43200);
}
else{
police->ef_sunshine_class.actor_class.scale.x = 0.0f;
}
}
void Ef_Room_Sunshine_PoliceR_actor_move(ACTOR* actor, GAME* game){
ROOMSUNSHINEPOLICE_ACTOR* police = (ROOMSUNSHINEPOLICE_ACTOR*)actor;
if((Common_Get(time.now_sec) >= 14400) && (Common_Get(time.now_sec) < 43200)){
police->ef_sunshine_class.actor_class.scale.x = -calc_scale_Ef_Room_Sunshine_Police(0, 43200 - Common_Get(time.now_sec));
}
else if (Common_Get(time.now_sec) >= 72000){
police->ef_sunshine_class.actor_class.scale.x = -calc_scale_Ef_Room_Sunshine_Police(1, 86400 -Common_Get(time.now_sec));
}
else{
police->ef_sunshine_class.actor_class.scale.x = 0.0f;
}
}
int cull_check_from_camera(ACTOR* actor, GAME_PLAY* play, int flag){
if(((play->camera.lookat.eye.x >= actor->world.position.x) && (flag == 1)) ||
(play->camera.lookat.eye.x <= actor->world.position.x) && (flag == 0)){
return 1;
}
return 0;
}
void setup_mode_Ef_Room_Sunshine_Police(ACTOR* actor, GAME_PLAY* play){
ROOMSUNSHINE_ACTOR* sunshine = (ROOMSUNSHINE_ACTOR*)actor;
u8* color;
int calc;
GRAPH* graph = play->game.graph;
OPEN_DISP(graph);
Matrix_translate(sunshine->actor_class.world.position.x, sunshine->actor_class.world.position.y,
sunshine->actor_class.world.position.z, 0);
Matrix_scale(sunshine->actor_class.scale.x, sunshine->actor_class.scale.y, sunshine->actor_class.scale.z,1);
gDPPipeSync(NEXT_POLY_XLU_DISP);
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(play->game.graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if((Common_Get(time.now_sec) >= 14400) && (Common_Get(time.now_sec) < 72000)){
color =play->kankyo.base_light.sun_color_window;
}
else{
color =play->kankyo.base_light.moon_color_window;
}
calc = ((u8)calc_alpha_Ef_Room_SunshinePolice() * mKK_windowlight_alpha_get());
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, calc, color[0], color[1], color[2], 255);
CLOSE_DISP(graph);
}
void Ef_Room_Sunshine_PoliceL_actor_draw(ACTOR* actor, GAME* game){
GRAPH* graph;
GAME_PLAY* play = (GAME_PLAY*)game;
if((mKK_windowlight_alpha_get() < 9.99999974738e-05f) || (actor->scale.x == 0.0f)){
return;
}
if(cull_check_from_camera(actor,play,0) == 0){
graph = play->game.graph;
setup_mode_Ef_Room_Sunshine_Police(actor, play);
OPEN_DISP(graph);
gSPDisplayList(NEXT_POLY_XLU_DISP, obj_koban_shine_modelT);
CLOSE_DISP(graph);
}
}
void Ef_Room_Sunshine_PoliceR_actor_draw(ACTOR* actor, GAME* game){
GRAPH* graph;
GAME_PLAY* play = (GAME_PLAY*)game;
if((mKK_windowlight_alpha_get() < 9.99999974738e-05f) || (actor->scale.x == 0.0f)){
return;
}
if(cull_check_from_camera(actor,play,1) == 0){
graph = play->game.graph;
setup_mode_Ef_Room_Sunshine_Police(actor, play);
OPEN_DISP(graph);
gSPDisplayList(NEXT_POLY_XLU_DISP, obj_koban_shine_modelT);
CLOSE_DISP(graph);
}
}
+208
View File
@@ -0,0 +1,208 @@
#include "ef_room_sunshine_posthouse.h"
#include "m_common_data.h"
#include "m_name_table.h"
#include "m_debug.h"
#include "m_collision_bg.h"
#include "sys_matrix.h"
void Ef_Room_Sunshine_Posthouse_actor_ct(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_Posthouse_actor_dt(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_PosthouseL_actor_draw(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_PosthouseL_actor_move(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_PosthouseR_actor_draw(ACTOR* actor, GAME* play);
void Ef_Room_Sunshine_PosthouseR_actor_move(ACTOR* actor, GAME* play);
extern Gfx obj_yubinkyoku_shine_modelT[];
ACTOR_PROFILE Room_Sunshine_Posthouse_Profile = {
mAc_PROFILE_ROOM_SUNSHINE_POSTHOUSE,
ACTOR_PART_EFFECT,
ACTOR_STATE_NO_MOVE_WHILE_CULLED | ACTOR_STATE_NO_DRAW_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_POSTHOUSE,
sizeof(ROOMSUNSHINEPOSTHOUSE_ACTOR),
Ef_Room_Sunshine_Posthouse_actor_ct,
NONE_ACTOR_PROC,
Ef_Room_Sunshine_PosthouseR_actor_move,
Ef_Room_Sunshine_PosthouseR_actor_draw,
NULL,
};
void Ef_Room_Sunshine_Posthouse_actor_ct(ACTOR* actor, GAME* game){
ROOMSUNSHINEPOSTHOUSE_ACTOR* posthouse = (ROOMSUNSHINEPOSTHOUSE_ACTOR*)actor;
xyz_t pos;
xyz_t pos2;
xyz_t pos3;
posthouse->ef_sunshine_class.unk_174 = 0;
if(posthouse->ef_sunshine_class.actor_class.actor_specific == 0){
posthouse->ef_sunshine_class.actor_class.mv_proc = Ef_Room_Sunshine_PosthouseL_actor_move;
posthouse->ef_sunshine_class.actor_class.dw_proc = Ef_Room_Sunshine_PosthouseL_actor_draw;
}
else{
posthouse->ef_sunshine_class.actor_class.world.position.x -= 1.0f;
}
pos = posthouse->ef_sunshine_class.actor_class.world.position;
posthouse->ef_sunshine_class.actor_class.world.position.y = mCoBG_GetBgY_OnlyCenter_FromWpos(0.0f, &pos);
posthouse->ef_sunshine_class.actor_class.scale.x = 0.05f;
posthouse->ef_sunshine_class.actor_class.scale.y = 0.05f;
posthouse->ef_sunshine_class.actor_class.scale.z = 0.05f;
switch(posthouse->ef_sunshine_class.actor_class.actor_specific){
case 2:
posthouse->ef_sunshine_class.actor_class.mv_proc = Ef_Room_Sunshine_PosthouseL_actor_move;
posthouse->ef_sunshine_class.actor_class.dw_proc = Ef_Room_Sunshine_PosthouseL_actor_draw;
posthouse->ef_sunshine_class.actor_class.world.position.x += 5.0f;
pos2 = posthouse->ef_sunshine_class.actor_class.world.position;
posthouse->ef_sunshine_class.actor_class.world.position.y = 1.0f + mCoBG_GetBgY_OnlyCenter_FromWpos(0.0f, &pos2);
posthouse->ef_sunshine_class.actor_class.world.position.x -= 6.0f;
break;
case 3:
posthouse->ef_sunshine_class.actor_class.world.position.x -= 5.0f;
pos3 = posthouse->ef_sunshine_class.actor_class.world.position;
posthouse->ef_sunshine_class.actor_class.world.position.y = 1.0f + mCoBG_GetBgY_OnlyCenter_FromWpos(0.0f, &pos3);
posthouse->ef_sunshine_class.actor_class.world.position.x += 6.0f;
break;
}
}
f32 calc_scale_Ef_Room_Sunshine_Posthouse(int flag, int sec){
if(flag == 0){
return 0.05f * (1.5f * sin_s((sec << 14) / 28800.0f));
}
else{
return 0.05f * (1.5f * sin_s((sec << 14) / 14400.0f));
}
}
int calc_alpha_Ef_Room_SunshinePosthouse(){
f32 ret;
int sec;
if(Common_Get(time.now_sec) < 14400){
ret = 120.0f * ((14400 - Common_Get(time.now_sec)) / 14400.0f);
}
else if(Common_Get(time.now_sec) < 72000){
//any other number matches codegen, but 43200 breaks
sec = (Common_Get(time.now_sec) - 43200) >= 0 ?
(Common_Get(time.now_sec) - 43200U) : -(Common_Get(time.now_sec) - 43200U);
ret = 255.0f * ((28800 - sec) / 28800.0f);
}
else{
ret = 120.0f * ((14400 - (86400 - Common_Get(time.now_sec))) / 14400.0f);
}
if((Common_Get(weather) == 1) || (Common_Get(weather) == 2)){
ret *= 0.6f;
}
return (u8)ret;
}
void Ef_Room_Sunshine_PosthouseL_actor_move(ACTOR* actor, GAME* game){
ROOMSUNSHINEPOSTHOUSE_ACTOR* posthouse = (ROOMSUNSHINEPOSTHOUSE_ACTOR*)actor;
if(Common_Get(time.now_sec) < 14400){
posthouse->ef_sunshine_class.actor_class.scale.x = calc_scale_Ef_Room_Sunshine_Posthouse(1, Common_Get(time.now_sec));
}
else if ((Common_Get(time.now_sec) >= 43200) && (Common_Get(time.now_sec) < 72000)){
posthouse->ef_sunshine_class.actor_class.scale.x = calc_scale_Ef_Room_Sunshine_Posthouse(0, Common_Get(time.now_sec) - 43200);
}
else{
posthouse->ef_sunshine_class.actor_class.scale.x = 0.0f;
}
}
void Ef_Room_Sunshine_PosthouseR_actor_move(ACTOR* actor, GAME* game){
ROOMSUNSHINEPOSTHOUSE_ACTOR* posthouse = (ROOMSUNSHINEPOSTHOUSE_ACTOR*)actor;
if((Common_Get(time.now_sec) >= 14400) && (Common_Get(time.now_sec) < 43200)){
posthouse->ef_sunshine_class.actor_class.scale.x = -calc_scale_Ef_Room_Sunshine_Posthouse(0, 43200 - Common_Get(time.now_sec));
}
else if (Common_Get(time.now_sec) >= 72000){
posthouse->ef_sunshine_class.actor_class.scale.x = -calc_scale_Ef_Room_Sunshine_Posthouse(1, 86400 -Common_Get(time.now_sec));
}
else{
posthouse->ef_sunshine_class.actor_class.scale.x = 0.0f;
}
}
void setup_mode_Ef_Room_Sunshine_Posthouse(ACTOR* actor, GAME_PLAY* play){
ROOMSUNSHINE_ACTOR* sunshine = (ROOMSUNSHINE_ACTOR*)actor;
u8* color;
int calc;
GRAPH* graph = play->game.graph;
OPEN_DISP(graph);
Matrix_translate(sunshine->actor_class.world.position.x, sunshine->actor_class.world.position.y,
sunshine->actor_class.world.position.z, 0);
Matrix_scale(sunshine->actor_class.scale.x, sunshine->actor_class.scale.y, sunshine->actor_class.scale.z,1);
gDPPipeSync(NEXT_POLY_XLU_DISP);
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(play->game.graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if((Common_Get(time.now_sec) >= 14400) && (Common_Get(time.now_sec) < 72000)){
color =play->kankyo.base_light.sun_color_window;
}
else{
color =play->kankyo.base_light.moon_color_window;
}
calc = ((u8)calc_alpha_Ef_Room_SunshinePosthouse() * mKK_windowlight_alpha_get());
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, calc, color[0], color[1], color[2], 255);
CLOSE_DISP(graph);
}
void Ef_Room_Sunshine_PosthouseL_actor_draw(ACTOR* actor, GAME* game){
GRAPH* graph;
GAME_PLAY* play = (GAME_PLAY*)game;
if((mKK_windowlight_alpha_get() < 9.99999974738e-05f) || (actor->scale.x == 0.0f)){
return;
}
graph = play->game.graph;
setup_mode_Ef_Room_Sunshine_Posthouse(actor, play);
OPEN_DISP(graph);
gSPDisplayList(NEXT_POLY_XLU_DISP, obj_yubinkyoku_shine_modelT);
CLOSE_DISP(graph);
}
void Ef_Room_Sunshine_PosthouseR_actor_draw(ACTOR* actor, GAME* game){
GRAPH* graph;
GAME_PLAY* play = (GAME_PLAY*)game;
if((mKK_windowlight_alpha_get() < 9.99999974738e-05f) || (actor->scale.x == 0.0f)){
return;
}
graph = play->game.graph;
setup_mode_Ef_Room_Sunshine_Posthouse(actor, play);
OPEN_DISP(graph);
gSPDisplayList(NEXT_POLY_XLU_DISP, obj_yubinkyoku_shine_modelT);
CLOSE_DISP(graph);
}