mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-26 15:24:34 -04:00
link ef_lamp_light
This commit is contained in:
@@ -385,6 +385,10 @@ ac_train_window.c:
|
||||
.text: [0x804AC510, 0x804AD428]
|
||||
.rodata: [0x80645FA8, 0x80645FF8]
|
||||
.data: [0x8068F600, 0x8068F830]
|
||||
ef_lamp_light.c:
|
||||
.text: [0x804CEC5C, 0x804CEF2C]
|
||||
.rodata: [0x806463C8, 0x806463D8]
|
||||
.data: [0x8069BFD0, 0x8069C028]
|
||||
m_huusui_room_ovl.c:
|
||||
.text: [0x804D1BBC, 0x804D2164]
|
||||
.rodata: [0x80646558, 0x806465C8]
|
||||
|
||||
@@ -10,6 +10,13 @@ extern "C" {
|
||||
|
||||
extern ACTOR_PROFILE Lamp_Light_Profile;
|
||||
|
||||
typedef struct ef_lamp_light_s{
|
||||
ACTOR actor_class;
|
||||
int switch_type;
|
||||
Lights lights;
|
||||
LightNode* node_p;
|
||||
}LAMPLIGHT_ACTOR;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
+4
-1
@@ -38,9 +38,12 @@ typedef struct nature_s {
|
||||
void* arg;
|
||||
} Nature;
|
||||
|
||||
|
||||
typedef struct kankyo_s {
|
||||
/* 0x00 */ Lights sun_light;
|
||||
/* 0x0E */ u8 pad[0x9A - 0x0E];
|
||||
/* 0x0E */ u8 pad[0x1C - 0x0E];
|
||||
/* 0x1C */ Lights* lights_p;
|
||||
/* 0x20 */ u8 pad3[0x9A - 0x20];
|
||||
/* 0x9A */ u8 ambientColor[3];
|
||||
/* 0x9E */ u8 pad2[0xC0 - 0x9E];
|
||||
/* 0xC0 */ f32 unkC0;
|
||||
|
||||
+2
-2
@@ -74,8 +74,8 @@ extern void LightsN_disp(LightsN* lights, GRAPH* graph);
|
||||
extern void LightsN_list_check(LightsN* lights, LightNode* node, xyz_t* pos);
|
||||
extern void Global_light_ct(Global_light* glight);
|
||||
extern LightsN* Global_light_read(Global_light* glight, GRAPH* graph);
|
||||
extern void Global_light_list_new(GAME_PLAY*, Global_light* glight, Lights* light);
|
||||
extern void Global_light_list_delete(Global_light* glight, LightNode* light);
|
||||
extern void* Global_light_list_new(GAME_PLAY*, Global_light* glight, Lights* light);
|
||||
extern void* Global_light_list_delete(Global_light* glight, LightNode* light);
|
||||
extern void Light_list_point_draw(GAME_PLAY* play);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -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_3,
|
||||
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.lights_p = &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.lights_p = 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;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -312,7 +312,7 @@ static void Global_light_list_ct(Global_light* glight){
|
||||
glight->list = NULL;
|
||||
}
|
||||
|
||||
extern void Global_light_list_new(GAME_PLAY* play, Global_light* glight, Lights* light){
|
||||
extern void* Global_light_list_new(GAME_PLAY* play, Global_light* glight, Lights* light){
|
||||
|
||||
LightNode* clight;
|
||||
|
||||
@@ -331,7 +331,7 @@ extern void Global_light_list_new(GAME_PLAY* play, Global_light* glight, Lights*
|
||||
}
|
||||
}
|
||||
|
||||
extern void Global_light_list_delete(Global_light* glight, LightNode* light){
|
||||
extern void* Global_light_list_delete(Global_light* glight, LightNode* light){
|
||||
|
||||
if(light != NULL){
|
||||
if(light->prev != NULL){
|
||||
|
||||
Reference in New Issue
Block a user