mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-06-27 08:53:25 -04:00
Merge pull request #305 from Cuyler36/ef_effect_control
This commit is contained in:
@@ -599,6 +599,11 @@ ac_train_window.c:
|
||||
.text: [0x804AC510, 0x804AD428]
|
||||
.rodata: [0x80645FA8, 0x80645FF8]
|
||||
.data: [0x8068F600, 0x8068F830]
|
||||
ef_effect_control.c:
|
||||
.text: [0x804CD474, 0x804CEC5C]
|
||||
.rodata: [0x80646368, 0x806463C8]
|
||||
.data: [0x8069BD10, 0x8069BFD0]
|
||||
.bss: [0x812FE708, 0x81300BD0]
|
||||
ef_lamp_light.c:
|
||||
.text: [0x804CEC5C, 0x804CEF2C]
|
||||
.rodata: [0x806463C8, 0x806463D8]
|
||||
|
||||
@@ -408,7 +408,7 @@ typedef struct effect_work_s {
|
||||
eEC_Effect_c effects[eEC_EFFECT_ACTIVE_MAX];
|
||||
u8 effect_active_flags[eEC_EFFECT_ACTIVE_MAX];
|
||||
Lights light_info;
|
||||
int _24A8;
|
||||
Light_list* light_list;
|
||||
} eEC_work_c;
|
||||
|
||||
struct effect_control_s {
|
||||
|
||||
+63
-63
@@ -22,107 +22,107 @@ extern "C" {
|
||||
|
||||
#define mEnv_WEATHER_TERM_NUM 20
|
||||
#define mEnv_WIND_TERM_NUM 4u
|
||||
#define mEnv_WIND_CHANGE_RATE (f32)(10*mTM_SECONDS_IN_MINUTE*60) // 60fps, 10 minutes
|
||||
#define mEnv_WIND_CHANGE_RATE (f32)(10 * mTM_SECONDS_IN_MINUTE * 60) // 60fps, 10 minutes
|
||||
|
||||
enum weather {
|
||||
mEnv_WEATHER_CLEAR,
|
||||
mEnv_WEATHER_RAIN,
|
||||
mEnv_WEATHER_SNOW,
|
||||
mEnv_WEATHER_SAKURA,
|
||||
mEnv_WEATHER_LEAVES,
|
||||
|
||||
mEnv_WEATHER_NUM
|
||||
mEnv_WEATHER_CLEAR,
|
||||
mEnv_WEATHER_RAIN,
|
||||
mEnv_WEATHER_SNOW,
|
||||
mEnv_WEATHER_SAKURA,
|
||||
mEnv_WEATHER_LEAVES,
|
||||
|
||||
mEnv_WEATHER_NUM
|
||||
};
|
||||
|
||||
enum weather_intensity {
|
||||
mEnv_WEATHER_INTENSITY_NONE,
|
||||
mEnv_WEATHER_INTENSITY_LIGHT,
|
||||
mEnv_WEATHER_INTENSITY_NORMAL,
|
||||
mEnv_WEATHER_INTENSITY_HEAVY,
|
||||
mEnv_WEATHER_INTENSITY_NONE,
|
||||
mEnv_WEATHER_INTENSITY_LIGHT,
|
||||
mEnv_WEATHER_INTENSITY_NORMAL,
|
||||
mEnv_WEATHER_INTENSITY_HEAVY,
|
||||
|
||||
mEnv_WEATHER_INTENSITY_NUM,
|
||||
mEnv_WEATHER_INTENSITY_NUM,
|
||||
};
|
||||
|
||||
enum {
|
||||
mEnv_LIGHT_TYPE_PLAYER,
|
||||
mEnv_LIGHT_TYPE_TENT,
|
||||
mEnv_LIGHT_TYPE_LIGHTHOUSE,
|
||||
mEnv_LIGHT_TYPE_PLAYER,
|
||||
mEnv_LIGHT_TYPE_TENT,
|
||||
mEnv_LIGHT_TYPE_LIGHTHOUSE,
|
||||
|
||||
mEnv_LIGHT_TYPE_NUM
|
||||
mEnv_LIGHT_TYPE_NUM
|
||||
};
|
||||
|
||||
enum {
|
||||
mEnv_SWITCH_STATUS_ON,
|
||||
mEnv_SWITCH_STATUS_OFF,
|
||||
mEnv_SWITCH_STATUS_TURNING_OFF,
|
||||
mEnv_SWITCH_STATUS_TURNING_ON,
|
||||
mEnv_SWITCH_STATUS_ON,
|
||||
mEnv_SWITCH_STATUS_OFF,
|
||||
mEnv_SWITCH_STATUS_TURNING_OFF,
|
||||
mEnv_SWITCH_STATUS_TURNING_ON,
|
||||
|
||||
mEnv_SWITCH_STATUS_NUM
|
||||
mEnv_SWITCH_STATUS_NUM
|
||||
};
|
||||
|
||||
enum {
|
||||
mEnv_WIND_STATE_STEADY,
|
||||
mEnv_WIND_STATE_FAST,
|
||||
mEnv_WIND_STATE_SLOW,
|
||||
mEnv_WIND_STATE_REDUCING,
|
||||
|
||||
mEnv_WIND_STATE_NUM
|
||||
mEnv_WIND_STATE_STEADY,
|
||||
mEnv_WIND_STATE_FAST,
|
||||
mEnv_WIND_STATE_SLOW,
|
||||
mEnv_WIND_STATE_REDUCING,
|
||||
|
||||
mEnv_WIND_STATE_NUM
|
||||
};
|
||||
|
||||
#define mEnv_SAVE_GET_WEATHER_TYPE(w) (((w) & 0xF0) >> 4)
|
||||
#define mEnv_SAVE_GET_WEATHER_INTENSITY(w) ((w) & 0xF)
|
||||
|
||||
typedef struct base_light_s {
|
||||
u8 ambient_color[3];
|
||||
s8 sun_dir[3];
|
||||
u8 sun_color[3];
|
||||
s8 moon_dir[3];
|
||||
u8 moon_color[3];
|
||||
u8 fog_color[3];
|
||||
s16 fog_near;
|
||||
s16 fog_far;
|
||||
u8 shadow_color[3];
|
||||
u8 room_color[3];
|
||||
u8 sun_color_window[3];
|
||||
u8 moon_color_window[3];
|
||||
u8 background_color[3];
|
||||
u8 ambient_color[3];
|
||||
s8 sun_dir[3];
|
||||
u8 sun_color[3];
|
||||
s8 moon_dir[3];
|
||||
u8 moon_color[3];
|
||||
u8 fog_color[3];
|
||||
s16 fog_near;
|
||||
s16 fog_far;
|
||||
u8 shadow_color[3];
|
||||
u8 room_color[3];
|
||||
u8 sun_color_window[3];
|
||||
u8 moon_color_window[3];
|
||||
u8 background_color[3];
|
||||
} BaseLight;
|
||||
|
||||
typedef struct add_light_info_s {
|
||||
s16 ambient_color[3];
|
||||
s16 diffuse_color[3];
|
||||
s16 fog_color[3];
|
||||
s16 fog_near;
|
||||
s16 fog_far;
|
||||
s16 ambient_color[3];
|
||||
s16 diffuse_color[3];
|
||||
s16 fog_color[3];
|
||||
s16 fog_near;
|
||||
s16 fog_far;
|
||||
} AddLightInfo;
|
||||
|
||||
typedef void (*NATURE_PROC)(ACTOR*);
|
||||
|
||||
typedef struct nature_s {
|
||||
NATURE_PROC proc;
|
||||
void* arg;
|
||||
NATURE_PROC proc;
|
||||
void* arg;
|
||||
} Nature;
|
||||
|
||||
typedef struct kankyo_s {
|
||||
/* 0x00 */ Lights sun_light;
|
||||
/* 0x0E */ Lights moon_light;
|
||||
/* 0x1C */ Lights* lamp_light;
|
||||
/* 0x20 */ Lights point_light;
|
||||
/* 0x30 */ int _30;
|
||||
/* 0x34 */ u8 _34[0x78 - 0x34];
|
||||
/* 0x78 */ AddLightInfo add_light_info; /* extra values added to specific light parameters */
|
||||
/* 0x90 */ int _90;
|
||||
/* 0x94 */ BaseLight base_light;
|
||||
/* 0xBA */ u8 _BA[0xC0 - 0xBA];
|
||||
/* 0xC0 */ f32 shadow_pos;
|
||||
/* 0xC4 */ u8 shadow_alpha;
|
||||
/* 0xC5 */ u8 countdown_timer;
|
||||
/* 0xC8 */ Nature nature;
|
||||
/* 0x00 */ Lights sun_light;
|
||||
/* 0x0E */ Lights moon_light;
|
||||
/* 0x1C */ Lights* lamp_light;
|
||||
/* 0x20 */ Lights point_light;
|
||||
/* 0x30 */ int _30;
|
||||
/* 0x34 */ u8 _34[0x78 - 0x34];
|
||||
/* 0x78 */ AddLightInfo add_light_info; /* extra values added to specific light parameters */
|
||||
/* 0x90 */ int _90;
|
||||
/* 0x94 */ BaseLight base_light;
|
||||
/* 0xBA */ u8 _BA[0xC0 - 0xBA];
|
||||
/* 0xC0 */ f32 shadow_pos;
|
||||
/* 0xC4 */ u8 shadow_alpha;
|
||||
/* 0xC5 */ u8 countdown_timer;
|
||||
/* 0xC8 */ Nature nature;
|
||||
} Kankyo;
|
||||
|
||||
extern void mEnv_regist_nature(Kankyo* kankyo, NATURE_PROC nature_proc, void* arg);
|
||||
extern int mEnv_unregist_nature(Kankyo* kankyo, NATURE_PROC nature_proc);
|
||||
extern void Global_kankyo_ct(GAME_PLAY* play, Kankyo* kankyo);
|
||||
extern void Global_kankyo_ct(GAME* game, Kankyo* kankyo);
|
||||
extern void mEnv_GetRoomPrimColor(u8* r, u8* g, u8* b, GAME_PLAY* play);
|
||||
extern void Global_kankyo_set_room_prim(GAME_PLAY* play);
|
||||
extern int mEnv_RequestChangeLightON(GAME_PLAY* play, int light_on_type, int play_sfx);
|
||||
|
||||
+4
-5
@@ -36,20 +36,19 @@ typedef struct lights_s {
|
||||
LightParams lights;
|
||||
} Lights;
|
||||
|
||||
|
||||
typedef struct light_list {
|
||||
/* 0x0 */ Lights* info;
|
||||
/* 0x4 */ struct light_list* prev;
|
||||
/* 0x8 */ struct light_list* next;
|
||||
} Light_list; // size = 0xC
|
||||
|
||||
typedef struct light_buf_s{
|
||||
typedef struct light_buf_s {
|
||||
int current;
|
||||
int idx;
|
||||
Light_list lights[32];
|
||||
} Light_buffer;
|
||||
|
||||
typedef struct lightsn_s{
|
||||
typedef struct lightsn_s {
|
||||
u8 diffuse_count;
|
||||
Ambient a;
|
||||
Light_new l[7];
|
||||
@@ -60,7 +59,7 @@ typedef struct global_light_s {
|
||||
/* 0x4 */ u8 ambientColor[3];
|
||||
/* 0x7 */ u8 fogColor[3];
|
||||
/* 0xA */ s16 fogNear;
|
||||
/* 0xC */ s16 fogFar;
|
||||
/* 0xC */ s16 fogFar;
|
||||
} Global_light; // size = 0x10
|
||||
|
||||
typedef void (*light_point_proc)(LightsN*, LightParams*, xyz_t*);
|
||||
@@ -73,7 +72,7 @@ extern void LightsN_disp(LightsN* lights, GRAPH* graph);
|
||||
extern void LightsN_list_check(LightsN* lights, Light_list* node, xyz_t* pos);
|
||||
extern void Global_light_ct(Global_light* glight);
|
||||
extern LightsN* Global_light_read(Global_light* glight, GRAPH* graph);
|
||||
extern Light_list* Global_light_list_new(GAME_PLAY*, Global_light* glight, Lights* light);
|
||||
extern Light_list* Global_light_list_new(GAME* game, Global_light* glight, Lights* light);
|
||||
extern void Global_light_list_delete(Global_light* glight, Light_list* light);
|
||||
extern void Light_list_point_draw(GAME_PLAY* play);
|
||||
|
||||
|
||||
+74
-74
@@ -27,52 +27,52 @@ typedef void (*PLAY_WIPE_PROC)(GAME_PLAY*);
|
||||
|
||||
/* sizeof(struct game_play_s) == 0x2600 */
|
||||
struct game_play_s {
|
||||
/* 0x0000 */ GAME game;
|
||||
// TODO: finish
|
||||
/* 0x00E0 */ s16 scene_id;
|
||||
/* 0x00E4 */ mFI_block_tbl_c block_table;
|
||||
/* 0x00F4 */ mFI_block_tbl_c last_block_table;
|
||||
/* 0x0104 */ u8 _0104[0x010C - 0x0104];
|
||||
/* 0x010C */ Scene_Word_u* current_scene_data;
|
||||
/* 0x0110 */ Object_Exchange_c object_exchange;
|
||||
/* 0x1A68 */ View view;
|
||||
/* 0x1B88 */ Camera2 camera;
|
||||
/* 0x1CC0 */ Kankyo kankyo;
|
||||
/* 0x1D90 */ Global_light global_light;
|
||||
/* 0x1DA0 */ pause_t pause;
|
||||
/* 0x1DA8 */ Actor_info actor_info;
|
||||
/* 0x1DEC */ Submenu submenu;
|
||||
/* 0x1FA4 */ s8 submenu_ground_idx;
|
||||
/* 0x1FA8 */ char* submenu_ground_tex[2];
|
||||
/* 0x1FB0 */ char* submenu_ground_pallet[2];
|
||||
/* 0x1FB8 */ PreRender prerender;
|
||||
/* 0x2000 */ Door_info_c door_info;
|
||||
/* 0x2008 */ int next_scene_no;
|
||||
/* 0x200C */ MtxF projection_matrix;
|
||||
/* 0x204C */ MtxF billboard_matrix;
|
||||
/* 0x208C */ Mtx* _208C;
|
||||
/* 0x2090 */ u32 game_frame;
|
||||
/* 0x2094 */ u8 _2094;
|
||||
/* 0x2095 */ u8 actor_data_num;
|
||||
/* 0x2096 */ u8 ctrl_actor_data_num;
|
||||
/* 0x2097 */ u8 obj_bank_data_num;
|
||||
/* 0x2098 */ Actor_data* player_data;
|
||||
/* 0x209C */ Actor_data* actor_data;
|
||||
/* 0x20A0 */ s16* ctrl_actor_data;
|
||||
/* 0x20A4 */ s16* obj_bank_data;
|
||||
/* 0x20A8 */ int _20A8;
|
||||
/* 0x20AC */ Event_c event;
|
||||
/* 0x20D0 */ u8 fb_fade_type;
|
||||
/* 0x20D1 */ u8 fb_wipe_type;
|
||||
/* 0x20D2 */ u8 fb_mode;
|
||||
/* 0x20D3 */ u8 fb_wipe_mode;
|
||||
/* 0x20D8 */ fbdemo_wipe fbdemo_wipe;
|
||||
/* 0x2318 */ fbdemo_fade color_fade;
|
||||
/* 0x2328 */ CollisionCheck_c collision_check;
|
||||
/* 0x23F8 */ DRAW_CHK_PROC draw_chk_proc; // only used by mikanbox actor
|
||||
/* 0x23FC */ rgba8888 fade_color_value;
|
||||
/* 0x2400 */ Scene_data_status_c* scene_data_status;
|
||||
/* 0x2404 */ u8 _2400[0x2600 - 0x2404];
|
||||
/* 0x0000 */ GAME game;
|
||||
// TODO: finish
|
||||
/* 0x00E0 */ s16 scene_id;
|
||||
/* 0x00E4 */ mFI_block_tbl_c block_table;
|
||||
/* 0x00F4 */ mFI_block_tbl_c last_block_table;
|
||||
/* 0x0104 */ u8 _0104[0x010C - 0x0104];
|
||||
/* 0x010C */ Scene_Word_u* current_scene_data;
|
||||
/* 0x0110 */ Object_Exchange_c object_exchange;
|
||||
/* 0x1A68 */ View view;
|
||||
/* 0x1B88 */ Camera2 camera;
|
||||
/* 0x1CC0 */ Kankyo kankyo;
|
||||
/* 0x1D90 */ Global_light global_light;
|
||||
/* 0x1DA0 */ pause_t pause;
|
||||
/* 0x1DA8 */ Actor_info actor_info;
|
||||
/* 0x1DEC */ Submenu submenu;
|
||||
/* 0x1FA4 */ s8 submenu_ground_idx;
|
||||
/* 0x1FA8 */ char* submenu_ground_tex[2];
|
||||
/* 0x1FB0 */ char* submenu_ground_pallet[2];
|
||||
/* 0x1FB8 */ PreRender prerender;
|
||||
/* 0x2000 */ Door_info_c door_info;
|
||||
/* 0x2008 */ int next_scene_no;
|
||||
/* 0x200C */ MtxF projection_matrix;
|
||||
/* 0x204C */ MtxF billboard_matrix;
|
||||
/* 0x208C */ Mtx* billboard_mtx_p;
|
||||
/* 0x2090 */ u32 game_frame;
|
||||
/* 0x2094 */ u8 _2094;
|
||||
/* 0x2095 */ u8 actor_data_num;
|
||||
/* 0x2096 */ u8 ctrl_actor_data_num;
|
||||
/* 0x2097 */ u8 obj_bank_data_num;
|
||||
/* 0x2098 */ Actor_data* player_data;
|
||||
/* 0x209C */ Actor_data* actor_data;
|
||||
/* 0x20A0 */ s16* ctrl_actor_data;
|
||||
/* 0x20A4 */ s16* obj_bank_data;
|
||||
/* 0x20A8 */ int _20A8;
|
||||
/* 0x20AC */ Event_c event;
|
||||
/* 0x20D0 */ u8 fb_fade_type;
|
||||
/* 0x20D1 */ u8 fb_wipe_type;
|
||||
/* 0x20D2 */ u8 fb_mode;
|
||||
/* 0x20D3 */ u8 fb_wipe_mode;
|
||||
/* 0x20D8 */ fbdemo_wipe fbdemo_wipe;
|
||||
/* 0x2318 */ fbdemo_fade color_fade;
|
||||
/* 0x2328 */ CollisionCheck_c collision_check;
|
||||
/* 0x23F8 */ DRAW_CHK_PROC draw_chk_proc; // only used by mikanbox actor
|
||||
/* 0x23FC */ rgba8888 fade_color_value;
|
||||
/* 0x2400 */ Scene_data_status_c* scene_data_status;
|
||||
/* 0x2404 */ u8 _2400[0x2600 - 0x2404];
|
||||
};
|
||||
|
||||
extern fbdemo_c fbdemo;
|
||||
@@ -80,35 +80,35 @@ extern fbdemo_c fbdemo;
|
||||
extern void Game_play_Reset_destiny();
|
||||
extern void event_title_flag_on();
|
||||
extern void event_title_flag_off();
|
||||
extern void Game_play_camera_proc(GAME_PLAY *);
|
||||
extern void Game_play_fbdemo_wipe_destroy(GAME_PLAY *);
|
||||
extern void Game_play_fbdemo_wipe_create_sub(GAME_PLAY *);
|
||||
extern void Game_play_fbdemo_wipe_create(GAME_PLAY *);
|
||||
extern void Game_play_fbdemo_wipe_init(GAME_PLAY *);
|
||||
extern void Game_play_fbdemo_fade_in_move_end(GAME_PLAY *);
|
||||
extern void Game_play_fbdemo_fade_out_start_emu_move_end(GAME_PLAY *);
|
||||
extern void Game_play_fbdemo_fade_out_game_end_move_end(GAME_PLAY *);
|
||||
extern void Game_play_change_scene_move_end(GAME_PLAY *);
|
||||
extern void Game_play_fbdemo_wipe_move(GAME_PLAY *);
|
||||
extern void Game_play_fbdemo_wipe_proc(GAME_PLAY *);
|
||||
extern Gfx* game_play_set_fog(GAME_PLAY *, Gfx *);
|
||||
extern void Game_play_fbdemo_proc(GAME_PLAY *);
|
||||
extern void play_cleanup(GAME *);
|
||||
extern void VR_Box_ct(GAME_PLAY *);
|
||||
extern void play_init(GAME *);
|
||||
extern void Game_play_move_fbdemo_not_move(GAME_PLAY *);
|
||||
extern void Game_play_move(GAME_PLAY *);
|
||||
extern void setupFog(GAME_PLAY *, GRAPH *);
|
||||
extern void setupViewer(GAME_PLAY *);
|
||||
extern void setupViewMatrix(GAME_PLAY *, GRAPH *, GRAPH *);
|
||||
extern void copy_efb_to_texture(Gfx **, void *);
|
||||
extern int makeBumpTexture(GAME_PLAY *, GRAPH *, GRAPH *);
|
||||
extern void draw_version(GRAPH *);
|
||||
extern void Game_play_draw(GAME *);
|
||||
extern void play_main(GAME *);
|
||||
extern void Gameplay_Scene_Init(GAME_PLAY *);
|
||||
extern void Game_play_camera_proc(GAME_PLAY*);
|
||||
extern void Game_play_fbdemo_wipe_destroy(GAME_PLAY*);
|
||||
extern void Game_play_fbdemo_wipe_create_sub(GAME_PLAY*);
|
||||
extern void Game_play_fbdemo_wipe_create(GAME_PLAY*);
|
||||
extern void Game_play_fbdemo_wipe_init(GAME_PLAY*);
|
||||
extern void Game_play_fbdemo_fade_in_move_end(GAME_PLAY*);
|
||||
extern void Game_play_fbdemo_fade_out_start_emu_move_end(GAME_PLAY*);
|
||||
extern void Game_play_fbdemo_fade_out_game_end_move_end(GAME_PLAY*);
|
||||
extern void Game_play_change_scene_move_end(GAME_PLAY*);
|
||||
extern void Game_play_fbdemo_wipe_move(GAME_PLAY*);
|
||||
extern void Game_play_fbdemo_wipe_proc(GAME_PLAY*);
|
||||
extern Gfx* game_play_set_fog(GAME_PLAY*, Gfx*);
|
||||
extern void Game_play_fbdemo_proc(GAME_PLAY*);
|
||||
extern void play_cleanup(GAME*);
|
||||
extern void VR_Box_ct(GAME_PLAY*);
|
||||
extern void play_init(GAME*);
|
||||
extern void Game_play_move_fbdemo_not_move(GAME_PLAY*);
|
||||
extern void Game_play_move(GAME_PLAY*);
|
||||
extern void setupFog(GAME_PLAY*, GRAPH*);
|
||||
extern void setupViewer(GAME_PLAY*);
|
||||
extern void setupViewMatrix(GAME_PLAY*, GRAPH*, GRAPH*);
|
||||
extern void copy_efb_to_texture(Gfx**, void*);
|
||||
extern int makeBumpTexture(GAME_PLAY*, GRAPH*, GRAPH*);
|
||||
extern void draw_version(GRAPH*);
|
||||
extern void Game_play_draw(GAME*);
|
||||
extern void play_main(GAME*);
|
||||
extern void Gameplay_Scene_Init(GAME_PLAY*);
|
||||
extern u8 mPl_SceneNo2SoundRoomType(int);
|
||||
extern void Gameplay_Scene_Read(GAME_PLAY *, s16);
|
||||
extern void Gameplay_Scene_Read(GAME_PLAY*, s16);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+58
-66
@@ -19,53 +19,48 @@ static void aWeatherSnow_set(GAME*);
|
||||
static void aWeatherSnow_draw(aWeather_Priv*, GAME*);
|
||||
|
||||
aWeather_Profile_c iam_weather_snow = {
|
||||
aWeatherSnow_make,
|
||||
aWeatherSnow_ct,
|
||||
aWeatherSnow_move,
|
||||
aWeatherSnow_set,
|
||||
aWeatherSnow_draw,
|
||||
aWeatherSnow_make, aWeatherSnow_ct, aWeatherSnow_move, aWeatherSnow_set, aWeatherSnow_draw,
|
||||
};
|
||||
|
||||
static int aWeatherSnow_DecideMakeSnowCount(ACTOR* actor, GAME* game){
|
||||
static int aWeatherSnow_DecideMakeSnowCount(ACTOR* actor, GAME* game) {
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
|
||||
if(weather->current_level == 1){
|
||||
if (weather->current_level == 1) {
|
||||
return (game->frame_counter & 7) == 0;
|
||||
}
|
||||
else if(weather->current_level == 2){
|
||||
} else if (weather->current_level == 2) {
|
||||
return (game->frame_counter & 3) == 0;
|
||||
}
|
||||
return (game->frame_counter & 1);
|
||||
return (game->frame_counter & 1);
|
||||
}
|
||||
|
||||
static void aWeatherSnow_make(ACTOR* actor, GAME* game){
|
||||
|
||||
static void aWeatherSnow_make(ACTOR* actor, GAME* game) {
|
||||
WEATHER_ACTOR* weather = (WEATHER_ACTOR*)actor;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
aWeather_Priv* priv;
|
||||
f32 x,z;
|
||||
aWeather_Priv* priv;
|
||||
f32 x, z;
|
||||
xyz_t pos = weather->pos;
|
||||
f32 y = 230.0f + pos.y;
|
||||
int count = Common_Get(clip.weather_clip)->get_priv_num(actor);
|
||||
xyz_t base = {0.0f, 0.0f, 0.0f};
|
||||
int count = Common_Get(clip.weather_clip)->get_priv_num(actor);
|
||||
xyz_t base = { 0.0f, 0.0f, 0.0f };
|
||||
xyz_t mod_pos;
|
||||
|
||||
if(aWeatherSnow_DecideMakeSnowCount(actor, game) != 0){
|
||||
if (aWeatherSnow_DecideMakeSnowCount(actor, game) != 0) {
|
||||
base.y = -0.5f + (RANDOM_F(-2.0f));
|
||||
if(count != -1){
|
||||
if (count != -1) {
|
||||
x = -100.0f + (RANDOM_F(200.0f));
|
||||
z = -200.0f + (RANDOM_F(380.0f));
|
||||
|
||||
|
||||
mod_pos = pos;
|
||||
|
||||
mod_pos.x += x;
|
||||
mod_pos.z += z;
|
||||
mod_pos.y = y;
|
||||
|
||||
|
||||
priv = Common_Get(clip.weather_clip)->get_priv(2, 280, &mod_pos, &base, actor, count);
|
||||
if(priv != NULL){
|
||||
if (priv != NULL) {
|
||||
aWeatherSnow_ct(priv, game);
|
||||
priv->work[0]= 0;
|
||||
priv->work[0] = 0;
|
||||
priv->work[1] = 156.5f + (RANDOM_F(260.5));
|
||||
priv->currentY = y;
|
||||
}
|
||||
@@ -73,33 +68,30 @@ static void aWeatherSnow_make(ACTOR* actor, GAME* game){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void aWeatherSnow_ct(aWeather_Priv*, GAME*){
|
||||
|
||||
static void aWeatherSnow_ct(aWeather_Priv*, GAME*) {
|
||||
}
|
||||
|
||||
|
||||
static int aWeatherSnow_CheckSnowBorder(aWeather_Priv* priv, GAME_PLAY* play){
|
||||
static int aWeatherSnow_CheckSnowBorder(aWeather_Priv* priv, GAME_PLAY* play) {
|
||||
WEATHER_ACTOR* weather = Common_Get(clip.weather_clip)->actor;
|
||||
int ret = 0;
|
||||
f32 wtemp, ptemp;
|
||||
if(weather != NULL){
|
||||
if (weather != NULL) {
|
||||
wtemp = weather->pos.x;
|
||||
ptemp =priv->pos.x;
|
||||
ptemp = priv->pos.x;
|
||||
|
||||
if(ptemp < (-100.0f + wtemp)){
|
||||
if (ptemp < (-100.0f + wtemp)) {
|
||||
ret |= 2;
|
||||
}
|
||||
if(ptemp > (100.0f + wtemp)){
|
||||
if (ptemp > (100.0f + wtemp)) {
|
||||
ret |= 8;
|
||||
}
|
||||
wtemp = weather->pos.z;
|
||||
ptemp =priv->pos.z;
|
||||
ptemp = priv->pos.z;
|
||||
|
||||
if(ptemp > (180.0f + wtemp)){
|
||||
if (ptemp > (180.0f + wtemp)) {
|
||||
ret |= 4;
|
||||
}
|
||||
if(ptemp < (-200.0f + wtemp)){
|
||||
if (ptemp < (-200.0f + wtemp)) {
|
||||
ret |= 1;
|
||||
}
|
||||
}
|
||||
@@ -107,44 +99,44 @@ static int aWeatherSnow_CheckSnowBorder(aWeather_Priv* priv, GAME_PLAY* play){
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void aWeatherSnow_CheckSnowScroll(aWeather_Priv* priv, GAME_PLAY* play){
|
||||
int border = aWeatherSnow_CheckSnowBorder(priv,play);
|
||||
static void aWeatherSnow_CheckSnowScroll(aWeather_Priv* priv, GAME_PLAY* play) {
|
||||
int border = aWeatherSnow_CheckSnowBorder(priv, play);
|
||||
PLAYER_ACTOR* player = get_player_actor_withoutCheck(play);
|
||||
|
||||
if(border != 0){
|
||||
if((border >> 1) & 1){
|
||||
if (border != 0) {
|
||||
if ((border >> 1) & 1) {
|
||||
priv->pos.x += 200.0f;
|
||||
}
|
||||
if((border >> 3) & 1){
|
||||
if ((border >> 3) & 1) {
|
||||
priv->pos.x -= 200.0f;
|
||||
}
|
||||
if((border >> 2) & 1){
|
||||
if ((border >> 2) & 1) {
|
||||
priv->pos.z -= 380.0f;
|
||||
}
|
||||
if(border & 1){
|
||||
if (border & 1) {
|
||||
priv->pos.z += 380.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if(Common_Get(clip.weather_clip) != NULL){
|
||||
if (Common_Get(clip.weather_clip) != NULL) {
|
||||
f32 y;
|
||||
WEATHER_ACTOR* weather = Common_Get(clip.weather_clip)->actor;
|
||||
|
||||
if(weather != NULL){
|
||||
if (weather != NULL) {
|
||||
y = 230.0f + weather->pos.y;
|
||||
if(priv->pos.y < (40.0f + player->actor_class.world.position.y)){
|
||||
if (priv->pos.y < (40.0f + player->actor_class.world.position.y)) {
|
||||
priv->pos.y = (y + (priv->pos.y - priv->currentY));
|
||||
priv->currentY = y;
|
||||
priv->currentY = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void aWeatherSnow_SetWind2Snow(aWeather_Priv* priv){
|
||||
static void aWeatherSnow_SetWind2Snow(aWeather_Priv* priv) {
|
||||
|
||||
if(Common_Get(clip.weather_clip) != NULL){
|
||||
if (Common_Get(clip.weather_clip) != NULL) {
|
||||
WEATHER_ACTOR* weather = Common_Get(clip.weather_clip)->actor;
|
||||
if(weather != NULL){
|
||||
if (weather != NULL) {
|
||||
priv->pos.x += weather->wind_info.x;
|
||||
priv->pos.y += weather->wind_info.y;
|
||||
priv->pos.z += weather->wind_info.z;
|
||||
@@ -152,16 +144,16 @@ static void aWeatherSnow_SetWind2Snow(aWeather_Priv* priv){
|
||||
}
|
||||
}
|
||||
|
||||
static void aWeatherSnow_move(aWeather_Priv* priv, GAME* game){
|
||||
GAME_PLAY* play = (GAME_PLAY*) game;
|
||||
static void aWeatherSnow_move(aWeather_Priv* priv, GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
xyz_t_add(&priv->pos,&priv->speed, &priv->pos);
|
||||
xyz_t_add(&priv->pos, &priv->speed, &priv->pos);
|
||||
priv->work[0] += priv->work[1];
|
||||
aWeatherSnow_SetWind2Snow(priv);
|
||||
aWeatherSnow_CheckSnowScroll(priv,play);
|
||||
aWeatherSnow_CheckSnowScroll(priv, play);
|
||||
}
|
||||
|
||||
static void aWeatherSnow_set(GAME* game){
|
||||
static void aWeatherSnow_set(GAME* game) {
|
||||
|
||||
_texture_z_light_fog_prim_xlu(game->graph);
|
||||
|
||||
@@ -169,12 +161,11 @@ static void aWeatherSnow_set(GAME* game){
|
||||
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_yuki01_setmode);
|
||||
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
void aWeatherSnow_draw(aWeather_Priv* priv, GAME* game){
|
||||
GAME_PLAY* play = (GAME_PLAY*) game;
|
||||
void aWeatherSnow_draw(aWeather_Priv* priv, GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
PLAYER_ACTOR* player = get_player_actor_withoutCheck(play);
|
||||
|
||||
xyz_t pos;
|
||||
@@ -189,33 +180,34 @@ void aWeatherSnow_draw(aWeather_Priv* priv, GAME* game){
|
||||
|
||||
Game_play_Projection_Trans(play, &pos, &screen_pos);
|
||||
|
||||
if((0.0f <= screen_pos.x) && (screen_pos.x < SCREEN_WIDTH_F) && (0.0f <= screen_pos.y) && (screen_pos.y < SCREEN_HEIGHT_F)){
|
||||
if ((0.0f <= screen_pos.x) && (screen_pos.x < SCREEN_WIDTH_F) && (0.0f <= screen_pos.y) &&
|
||||
(screen_pos.y < SCREEN_HEIGHT_F)) {
|
||||
|
||||
work = GRAPH_ALLOC_TYPE(game->graph, Mtx, 1);
|
||||
|
||||
min = pos.y - (40.0f + player->actor_class.world.position.y);
|
||||
|
||||
if(min < 0.0f){
|
||||
if (min < 0.0f) {
|
||||
min = 0.0f;
|
||||
}
|
||||
|
||||
scale = min / 20.0f;
|
||||
|
||||
if(scale > 1.0f){
|
||||
if (scale > 1.0f) {
|
||||
scale = 1.0f;
|
||||
}
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
suMtxMakeTS(work, 0.00195999979042f * scale, 0.00195999979042f * scale, 0.00195999979042f * scale, pos.x, pos.y, pos.z);
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
suMtxMakeTS(work, 0.00195999979042f * scale, 0.00195999979042f * scale, 0.00195999979042f * scale, pos.x, pos.y,
|
||||
pos.z);
|
||||
|
||||
gSPMatrix(NEXT_POLY_XLU_DISP, work, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
gSPMatrix(NEXT_POLY_XLU_DISP, play->_208C,G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
|
||||
|
||||
gSPMatrix(NEXT_POLY_XLU_DISP, play->billboard_mtx_p, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
|
||||
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_yuki01_00_model);
|
||||
|
||||
CLOSE_DISP( game->graph);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,444 @@
|
||||
#include "ef_effect_control.h"
|
||||
|
||||
#include "m_common_data.h"
|
||||
#include "sys_matrix.h"
|
||||
#include "m_rcp.h"
|
||||
#include "m_player_lib.h"
|
||||
#include "m_debug.h"
|
||||
|
||||
static eEC_PROFILE_c* profile_tbl[] = {
|
||||
&iam_ef_shock,
|
||||
&iam_ef_dust,
|
||||
&iam_ef_muka,
|
||||
&iam_ef_warau,
|
||||
&iam_ef_ha,
|
||||
&iam_ef_sibuki,
|
||||
&iam_ef_gimonhu,
|
||||
&iam_ef_kantanhu,
|
||||
&iam_ef_ase,
|
||||
&iam_ef_ase_ch,
|
||||
&iam_ef_kangaeru,
|
||||
&iam_ef_otikomi,
|
||||
&iam_ef_buruburu,
|
||||
&iam_ef_siawase_hikari,
|
||||
&iam_ef_siawase_hana,
|
||||
&iam_ef_siawase_hana_ch,
|
||||
&iam_ef_takurami,
|
||||
&iam_ef_takurami_kira,
|
||||
&iam_ef_kaze,
|
||||
&iam_ef_kaze_happa,
|
||||
&iam_ef_lovelove,
|
||||
&iam_ef_lovelove_heart,
|
||||
&iam_ef_pun,
|
||||
&iam_ef_pun_yuge,
|
||||
&iam_ef_pun_sekimen,
|
||||
&iam_ef_naku,
|
||||
&iam_ef_namida,
|
||||
&iam_ef_hirameki_den,
|
||||
&iam_ef_hirameki_hikari,
|
||||
&iam_ef_situren,
|
||||
&iam_ef_ase2,
|
||||
&iam_ef_dash_asimoto,
|
||||
&iam_ef_konpu,
|
||||
&iam_ef_lovelove2,
|
||||
&iam_ef_kpun,
|
||||
&iam_ef_kisha_kemuri,
|
||||
&iam_ef_neboke,
|
||||
&iam_ef_neboke_awa,
|
||||
&iam_ef_hanabi_yanagi,
|
||||
&iam_ef_hanabi_botan1,
|
||||
&iam_ef_hanabi_botan2,
|
||||
&iam_ef_hanabi_hoshi,
|
||||
&iam_ef_hanabi_set,
|
||||
&iam_ef_hanabi_switch,
|
||||
&iam_ef_footprint,
|
||||
&iam_ef_turn_footprint,
|
||||
&iam_ef_bubu,
|
||||
&iam_ef_turn_asimoto,
|
||||
&iam_ef_string,
|
||||
&iam_ef_yukihane,
|
||||
&iam_ef_anahikari,
|
||||
&iam_ef_bush_happa,
|
||||
&iam_ef_bush_yuki,
|
||||
&iam_ef_tumble,
|
||||
&iam_ef_tumble_bodyprint,
|
||||
&iam_ef_slip,
|
||||
&iam_ef_tumble_dust,
|
||||
&iam_ef_swing_net,
|
||||
&iam_ef_ami_mizu,
|
||||
&iam_ef_mizutama,
|
||||
&iam_ef_yukidama,
|
||||
&iam_ef_kikuzu,
|
||||
&iam_ef_swing_axe,
|
||||
&iam_ef_steam,
|
||||
&iam_ef_night15_moon,
|
||||
&iam_ef_night13_moon,
|
||||
&iam_ef_neboke_akubi,
|
||||
&iam_ef_slip_footprint,
|
||||
&iam_ef_walk_asimoto,
|
||||
&iam_ef_turi_hamon,
|
||||
&iam_ef_turi_mizu,
|
||||
&iam_ef_turi_hane0,
|
||||
&iam_ef_turi_hane1,
|
||||
&iam_ef_turi_suiteki,
|
||||
&iam_ef_ongen,
|
||||
&iam_ef_impact_star,
|
||||
&iam_ef_sandsplash,
|
||||
&iam_ef_young_tree,
|
||||
&iam_ef_swing_rod,
|
||||
&iam_ef_doyon,
|
||||
&iam_ef_kagu_happa,
|
||||
&iam_ef_hanabi_dummy,
|
||||
&iam_ef_dig_hole,
|
||||
&iam_ef_dig_scoop,
|
||||
&iam_ef_dig_mud,
|
||||
&iam_ef_kigae,
|
||||
&iam_ef_kigae_light,
|
||||
&iam_ef_tape,
|
||||
&iam_ef_clacker,
|
||||
&iam_ef_kamifubuki,
|
||||
&iam_ef_car_blight,
|
||||
&iam_ef_tamaire,
|
||||
&iam_ef_car_light,
|
||||
&iam_ef_reset_hole,
|
||||
&iam_ef_goki,
|
||||
&iam_ef_hanabira,
|
||||
&iam_ef_wait_asimoto,
|
||||
&iam_ef_otosiana,
|
||||
&iam_ef_ikigire,
|
||||
&iam_ef_yukidaruma,
|
||||
&iam_ef_kyousou_onpu,
|
||||
&iam_ef_douzou_light,
|
||||
&iam_ef_halloween_smoke,
|
||||
&iam_ef_halloween,
|
||||
&iam_ef_motiyuge,
|
||||
&iam_ef_taberu,
|
||||
&iam_ef_kasamizu,
|
||||
&iam_ef_kasamizutama,
|
||||
&iam_ef_hanatiri,
|
||||
&iam_ef_uranai,
|
||||
&iam_ef_suisou_awa,
|
||||
&iam_ef_break_axe,
|
||||
&iam_ef_yajirushi,
|
||||
&iam_ef_soba_yuge,
|
||||
&iam_ef_furo_yuge,
|
||||
&iam_ef_shooting,
|
||||
&iam_ef_shooting_set,
|
||||
&iam_ef_shooting_kira,
|
||||
&iam_ef_coin,
|
||||
&iam_ef_tent_lamp,
|
||||
&iam_ef_flash,
|
||||
&iam_ef_flashC,
|
||||
&iam_ef_killer,
|
||||
&iam_ef_make_hem,
|
||||
&iam_ef_make_hem_kira,
|
||||
&iam_ef_make_hem_light,
|
||||
};
|
||||
|
||||
static u8 eEC_effect_feature[] = {
|
||||
FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE,
|
||||
TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE,
|
||||
FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE,
|
||||
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
|
||||
TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
|
||||
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
|
||||
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE,
|
||||
FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE,
|
||||
};
|
||||
|
||||
static void eEC_actor_ct(ACTOR* actorx, GAME* game);
|
||||
static void eEC_actor_dt(ACTOR* actorx, GAME* game);
|
||||
static void eEC_actor_move(ACTOR* actorx, GAME* game);
|
||||
static void eEC_actor_draw(ACTOR* actorx, GAME* game);
|
||||
|
||||
ACTOR_PROFILE Effect_Control_Profile = {
|
||||
mAc_PROFILE_EFFECT_CONTROL,
|
||||
ACTOR_PART_CONTROL,
|
||||
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
|
||||
EMPTY_NO,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(EFFECT_CONTROL_ACTOR),
|
||||
&eEC_actor_ct,
|
||||
&eEC_actor_dt,
|
||||
&eEC_actor_move,
|
||||
&eEC_actor_draw,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static eEC_work_c eEC_ctrl_work;
|
||||
|
||||
#include "../src/ef_effect_lib.c"
|
||||
|
||||
static void eEC_Name2EffectMake(int effect_id, xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0,
|
||||
s16 arg1) {
|
||||
if (effect_id >= 0 && effect_id < eEC_EFFECT_NUM) {
|
||||
if (eEC_effect_feature[effect_id] == FALSE) {
|
||||
profile_tbl[effect_id]->init_proc(pos, prio, angle, game, item_name, arg0, arg1);
|
||||
} else if (eEC_effect_feature[effect_id] == TRUE) {
|
||||
int i;
|
||||
u8* active_flags = eEC_ctrl_work.effect_active_flags;
|
||||
eEC_Effect_c* effect = eEC_ctrl_work.effects;
|
||||
|
||||
/* Check if any of the spawned effects are an exact match to this one */
|
||||
for (i = 0; i < eEC_EFFECT_ACTIVE_MAX; i++, active_flags++, effect++) {
|
||||
if (*active_flags && effect->name == effect_id && effect->item_name == item_name) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* No exact matches, so create effect */
|
||||
profile_tbl[effect_id]->init_proc(pos, prio, angle, game, item_name, arg0, arg1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void eEC_Name2EffectKill(int effect_id, u16 item_name) {
|
||||
int i;
|
||||
u8* active_flags = eEC_ctrl_work.effect_active_flags;
|
||||
eEC_Effect_c* effect = eEC_ctrl_work.effects;
|
||||
|
||||
for (i = 0; i < eEC_EFFECT_ACTIVE_MAX; i++, active_flags++, effect++) {
|
||||
if (*active_flags && effect->name == effect_id && effect->item_name == item_name && effect->prog_idx != -1) {
|
||||
if (profile_tbl[effect_id]->n_frames == eEC_IMMEDIATE_DEATH) {
|
||||
*active_flags = 0;
|
||||
|
||||
if (profile_tbl[effect_id]->child_effect_id != eEC_NO_CHILD_ID) {
|
||||
eEC_Name2EffectKill(profile_tbl[effect_id]->child_effect_id, item_name);
|
||||
}
|
||||
} else if (profile_tbl[effect_id]->n_frames != eEC_IGNORE_DEATH) {
|
||||
effect->timer = profile_tbl[effect_id]->n_frames;
|
||||
effect->state = eEC_STATE_FINISHED;
|
||||
|
||||
if (profile_tbl[effect_id]->child_effect_id != eEC_NO_CHILD_ID) {
|
||||
eEC_Name2EffectKill(profile_tbl[effect_id]->child_effect_id, item_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void eEC_Name2EffectKillAll(u16 item_name) {
|
||||
int i;
|
||||
u8* active_flags = eEC_ctrl_work.effect_active_flags;
|
||||
eEC_Effect_c* effect = eEC_ctrl_work.effects;
|
||||
|
||||
for (i = 0; i < eEC_EFFECT_ACTIVE_MAX; i++, active_flags++, effect++) {
|
||||
if (*active_flags && effect->item_name == item_name && effect->prog_idx != -1) {
|
||||
if (profile_tbl[effect->name]->n_frames == eEC_IMMEDIATE_DEATH) {
|
||||
*active_flags = FALSE;
|
||||
} else if (eEC_ctrl_work.program_info[effect->prog_idx].end_frame != eEC_IGNORE_DEATH) {
|
||||
effect->timer = eEC_ctrl_work.program_info[effect->prog_idx].end_frame;
|
||||
effect->state = eEC_STATE_FINISHED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void eEC_InitEffectControlWork(void) {
|
||||
eEL_InitUnchar(eEC_ctrl_work.effect_active_flags, eEC_EFFECT_ACTIVE_MAX, 0);
|
||||
eEC_ctrl_work.active_effect_num = 0;
|
||||
}
|
||||
|
||||
static eEC_Effect_c* eEC_MakeEffect(s16 effect_id, xyz_t pos, xyz_t* ofs, GAME* game, void* ct_arg, u16 item_name,
|
||||
int prio, s16 arg0, s16 arg1);
|
||||
|
||||
static void eEC_EffectLib2Clip(ACTOR* actorx) {
|
||||
EFFECT_CONTROL_ACTOR* effect_ctrl = (EFFECT_CONTROL_ACTOR*)actorx;
|
||||
|
||||
effect_ctrl->clip.effect_make_proc = &eEC_Name2EffectMake;
|
||||
effect_ctrl->clip.effect_kill_proc = &eEC_Name2EffectKill;
|
||||
effect_ctrl->clip.effect_kill_all_proc = &eEC_Name2EffectKillAll;
|
||||
effect_ctrl->clip.vector_rotate_y_proc = &eEL_VectorRoteteY;
|
||||
effect_ctrl->clip.random_first_speed_proc = &eEL_RandomFirstSpeed;
|
||||
effect_ctrl->clip.set_continious_env_proc = &eEL_SetContiniousEnv;
|
||||
effect_ctrl->clip.calc_adjust_proc = &eEL_CalcAdjust;
|
||||
effect_ctrl->clip.auto_matrix_xlu_proc = &eEL_AutoMatrixXlu;
|
||||
effect_ctrl->clip.auto_matrix_xlu_offset_proc = &eEL_AutoMatrixXlu_Offset;
|
||||
effect_ctrl->clip._20 = NULL;
|
||||
effect_ctrl->clip._24 = NULL;
|
||||
effect_ctrl->clip.make_effect_proc = &eEC_MakeEffect;
|
||||
effect_ctrl->clip.morph_combine_proc = &eEC_MorphCombine;
|
||||
effect_ctrl->clip.regist_effect_light = &eEL_RegistEffectLight;
|
||||
effect_ctrl->clip.decide_light_power_proc = &eEL_DecideLightPower;
|
||||
effect_ctrl->clip.check_lookat_block_proc = &mEL_CheckLookAtBlock;
|
||||
effect_ctrl->clip.effect_light_status = &eEL_EffectLightStatus;
|
||||
effect_ctrl->clip.special_block_center_pos_proc = &eEL_SpecialBlockCenterPos;
|
||||
|
||||
eEC_CLIP = &effect_ctrl->clip;
|
||||
}
|
||||
|
||||
static void eEC_MakeEffectLight(GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
Light_diffuse_ct(&eEC_ctrl_work.light_info, 0, 127, 0, 0, 0, 0);
|
||||
eEC_ctrl_work.light_list = Global_light_list_new(game, &play->global_light, &eEC_ctrl_work.light_info);
|
||||
}
|
||||
|
||||
static void eEC_DeleteEffectLight(GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
Global_light_list_delete(&play->global_light, eEC_ctrl_work.light_list);
|
||||
}
|
||||
|
||||
int eMH_special_point_light_num = 0;
|
||||
|
||||
static void eEC_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
eEC_EffectLib2Clip(actorx);
|
||||
eEC_InitEffectControlWork();
|
||||
eEC_MakeEffectLight(game);
|
||||
eEL_InitEffectLight();
|
||||
|
||||
if (Save_Get(scene_no) == SCENE_TENT) {
|
||||
eEC_CLIP->effect_make_proc(eEC_EFFECT_TENT_LAMP, actorx->world.position, 3, 0, game, RSV_NO, 0, 0);
|
||||
}
|
||||
|
||||
eMH_special_point_light_num = -1;
|
||||
}
|
||||
|
||||
static void eEC_actor_dt(ACTOR* actorx, GAME* game) {
|
||||
eEC_CLIP = NULL;
|
||||
eEC_DeleteEffectLight(game);
|
||||
}
|
||||
|
||||
static void eEC_actor_draw(ACTOR* actorx, GAME* game) {
|
||||
int i;
|
||||
u8* active_flags = eEC_ctrl_work.effect_active_flags;
|
||||
eEC_Effect_c* effect = eEC_ctrl_work.effects;
|
||||
|
||||
_texture_z_light_fog_prim(game->graph);
|
||||
_texture_z_light_fog_prim_xlu(game->graph);
|
||||
|
||||
for (i = 0; i < eEC_EFFECT_ACTIVE_MAX; i++, active_flags++, effect++) {
|
||||
if (*active_flags) {
|
||||
profile_tbl[effect->name]->draw_proc(effect, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int eEC_DistDeath(eEC_Effect_c* effect, GAME* game, s16 prog_idx) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
int res = FALSE; // in range
|
||||
|
||||
if (prog_idx != -1) {
|
||||
f32 max_dist = profile_tbl[effect->name]->max_dist;
|
||||
|
||||
if (max_dist != eEC_IGNORE_DEATH_DIST) {
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
|
||||
|
||||
if (ABS(player->actor_class.world.position.x - effect->position.x) > max_dist ||
|
||||
ABS(player->actor_class.world.position.z - effect->position.z) > max_dist ||
|
||||
ABS(player->actor_class.world.position.y - effect->position.y) > max_dist) {
|
||||
res = TRUE; // out of range
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void eEC_AllEffectMove(GAME* game) {
|
||||
int i;
|
||||
u8* active_flags = eEC_ctrl_work.effect_active_flags;
|
||||
eEC_Effect_c* effect = eEC_ctrl_work.effects;
|
||||
|
||||
for (i = 0; i < eEC_EFFECT_ACTIVE_MAX; i++, active_flags++, effect++) {
|
||||
if (*active_flags) {
|
||||
s16 prog_idx = effect->prog_idx;
|
||||
|
||||
profile_tbl[effect->name]->move_proc(effect, game);
|
||||
effect->timer--;
|
||||
|
||||
if (effect->timer <= 0 || eEC_DistDeath(effect, game, prog_idx) == TRUE) {
|
||||
*active_flags = 0;
|
||||
effect->timer = 0;
|
||||
effect->_0A = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void eEC_actor_move(ACTOR* actorx, GAME* game) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
|
||||
|
||||
eEL_CalcEffectLight_Set(game);
|
||||
eEC_AllEffectMove(game);
|
||||
actorx->world.position = player->actor_class.world.position;
|
||||
}
|
||||
|
||||
static int eEC_GetEffectBuff(int prio) {
|
||||
int now_idx = eEC_ctrl_work.active_effect_num;
|
||||
u8* active_flags = eEC_ctrl_work.effect_active_flags;
|
||||
int i;
|
||||
|
||||
for (i = now_idx; i < eEC_EFFECT_ACTIVE_MAX; i++) {
|
||||
if (active_flags[i] == 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < now_idx - 1; i++) {
|
||||
if (active_flags[i] == 0) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = now_idx; i < eEC_EFFECT_ACTIVE_MAX; i++) {
|
||||
if (active_flags[i] < prio) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < now_idx - 1; i++) {
|
||||
if (active_flags[i] != 2) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void eEC_SetFirstOffset(eEC_Effect_c* effect, xyz_t* ofs) {
|
||||
static xyz_t default_offset = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
effect->offset = default_offset;
|
||||
if (ofs != NULL) {
|
||||
effect->offset = *ofs;
|
||||
}
|
||||
}
|
||||
|
||||
static eEC_Effect_c* eEC_MakeEffect(s16 effect_id, xyz_t pos, xyz_t* ofs, GAME* game, void* ct_arg, u16 item_name,
|
||||
int prio, s16 arg0, s16 arg1) {
|
||||
static xyz_t defaultX = { 0.0f, 0.0f, 0.0f };
|
||||
static xyz_t scale_default = { 0.01f, 0.01f, 0.01f };
|
||||
int* active_effect_num = &eEC_ctrl_work.active_effect_num;
|
||||
eEC_Effect_c* effect = NULL;
|
||||
eEC_Effect_c* effects = eEC_ctrl_work.effects;
|
||||
u8* active_flags = eEC_ctrl_work.effect_active_flags;
|
||||
int use_idx;
|
||||
|
||||
use_idx = eEC_GetEffectBuff(prio);
|
||||
if (use_idx != -1) {
|
||||
active_flags[use_idx] = prio;
|
||||
effects[use_idx].name = effect_id;
|
||||
effects[use_idx].position = pos;
|
||||
effects[use_idx].item_name = item_name;
|
||||
effects[use_idx].prio = prio;
|
||||
effects[use_idx].state = eEC_STATE_NORMAL;
|
||||
eEC_SetFirstOffset(&effects[use_idx], ofs);
|
||||
effects[use_idx].timer = 10;
|
||||
effects[use_idx].velocity = defaultX;
|
||||
effects[use_idx].acceleration = defaultX;
|
||||
effects[use_idx].scale = scale_default;
|
||||
effects[use_idx].arg0 = arg0;
|
||||
effects[use_idx].arg1 = arg1;
|
||||
|
||||
profile_tbl[effect_id]->ct_proc(&effects[use_idx], game, ct_arg);
|
||||
*active_effect_num = use_idx + 1;
|
||||
effect = &effects[use_idx];
|
||||
}
|
||||
|
||||
return effect;
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
static void eEL_InitUnchar(u8* unchar_p, int count, u8 val) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
*unchar_p++ = val;
|
||||
}
|
||||
}
|
||||
|
||||
static void eEL_VectorRoteteY(xyz_t* vec, f32 angle) {
|
||||
xyz_t src = *vec;
|
||||
f32 cos = cosf_table(angle);
|
||||
f32 sin = sinf_table(angle);
|
||||
|
||||
vec->x = src.x * cos + src.z * sin;
|
||||
vec->z = -src.x * sin + src.z * cos;
|
||||
}
|
||||
|
||||
static s16 eEL_RandomFirstSpeed(xyz_t* speed, f32 y, f32 max_z, f32 max_x) {
|
||||
xyz_t vec = { 0.0f, 1.0f, 0.0f };
|
||||
f32 angle = 0.0f;
|
||||
|
||||
vec.y = y;
|
||||
|
||||
if (max_z != 0.0f) {
|
||||
f32 rnd_z = RANDOM_F(max_z) - max_z * 0.5f;
|
||||
|
||||
angle = rnd_z;
|
||||
sMath_RotateZ(&vec, DEG2RAD(rnd_z));
|
||||
}
|
||||
|
||||
if (max_x != 0.0f) {
|
||||
f32 rnd_x = RANDOM_F(max_x) - max_x * 0.5f;
|
||||
sMath_RotateX(&vec, DEG2RAD(rnd_x));
|
||||
}
|
||||
|
||||
if (speed != NULL) {
|
||||
*speed = vec;
|
||||
}
|
||||
|
||||
return RAD2SHORT_ANGLE2(DEG2RAD(angle));
|
||||
}
|
||||
|
||||
static void eEL_SetContiniousEnv(eEC_Effect_c* effect, s16 unused, s16 timer) {
|
||||
if (effect->state == eEC_STATE_NORMAL) {
|
||||
if (effect->timer <= 1) {
|
||||
effect->state = eEC_STATE_CONTINUOUS;
|
||||
effect->timer = timer;
|
||||
}
|
||||
} else if (effect->state == eEC_STATE_CONTINUOUS) {
|
||||
if (effect->timer <= 1) {
|
||||
effect->state = eEC_STATE_CONTINUOUS;
|
||||
effect->timer = timer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static f32 eEL_CalcAdjust(s16 now, s16 start, s16 end, f32 start_val, f32 end_val) {
|
||||
|
||||
if (start == end) {
|
||||
return start_val;
|
||||
}
|
||||
|
||||
if (now <= start) {
|
||||
return start_val;
|
||||
}
|
||||
|
||||
if (now >= end) {
|
||||
return end_val;
|
||||
}
|
||||
|
||||
return start_val + (f32)(now - start) * ((end_val - start_val) / (f32)(end - start));
|
||||
}
|
||||
|
||||
static void eEL_AutoMatrixXlu(GAME* game, xyz_t* pos, xyz_t* scale) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
Mtx* mtx = (Mtx*)GRAPH_ALLOC_TYPE(game->graph, Mtx, 1);
|
||||
f32 adj_scale;
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
_texture_z_light_fog_prim_xlu(game->graph);
|
||||
adj_scale = 1.0f + ((f32)(int)GETREG(MYKREG, 27)) * 0.01f;
|
||||
suMtxMakeTS(mtx, scale->x * adj_scale, scale->y * adj_scale, scale->z * adj_scale, pos->x, pos->y, pos->z);
|
||||
|
||||
gSPMatrix(NEXT_POLY_XLU_DISP, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPMatrix(NEXT_POLY_XLU_DISP, play->billboard_mtx_p, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
static void eEL_AutoMatrixXlu_Offset(GAME* game, xyz_t* pos, xyz_t* scale, xyz_t* offset) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
f32 adj_scale;
|
||||
|
||||
OPEN_DISP(game->graph);
|
||||
|
||||
_texture_z_light_fog_prim_xlu(game->graph);
|
||||
Matrix_translate(pos->x, pos->y, pos->z, 0);
|
||||
Matrix_mult(&play->billboard_matrix, 1);
|
||||
Matrix_translate(offset->x + (f32)(int)GETREG(MYKREG, 24), offset->y + (f32)(int)GETREG(MYKREG, 25),
|
||||
offset->z + (f32)(int)GETREG(MYKREG, 26), 1);
|
||||
adj_scale = 1.0f + ((f32)(int)GETREG(MYKREG, 27)) * 0.01f;
|
||||
Matrix_scale(scale->x * adj_scale, scale->y * adj_scale, scale->z * adj_scale, 1);
|
||||
|
||||
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
CLOSE_DISP(game->graph);
|
||||
}
|
||||
|
||||
static void eEC_MorphCombine(u8* const result, eEC_morph_data_c* const morph_data, s16 now_timer) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 9; i++) {
|
||||
if (morph_data[i].morph_flag) {
|
||||
result[i] = eEL_CalcAdjust(now_timer, morph_data[i].start_frame << 1, morph_data[i].end_frame << 1,
|
||||
morph_data[i].start_val, morph_data[i].end_val);
|
||||
} else {
|
||||
result[i] = morph_data[i].start_val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int eEL_SpecialBlockCenterPos(xyz_t* pos, u32 block_kind) {
|
||||
int bx;
|
||||
int bz;
|
||||
|
||||
*pos = ZeroVec;
|
||||
|
||||
if (mFI_BlockKind2BkNum(&bx, &bz, block_kind) && mFI_BkNum2WposXZ(&pos->x, &pos->z, bx, bz)) {
|
||||
pos->x += mFI_BK_WORLDSIZE_X_F / 2;
|
||||
pos->z += mFI_BK_WORLDSIZE_Z_F / 2;
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static eEC_light_data_c eEL_light_data;
|
||||
static const eEC_light_data_c eEC_light_default = { 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0, 0, 0, 0 };
|
||||
|
||||
static int eEL_EffectLightStatus(rgba_t* color, int* shadow_flag) {
|
||||
color->r = eEC_ctrl_work.light_info.lights.diffuse.color[0];
|
||||
color->g = eEC_ctrl_work.light_info.lights.diffuse.color[1];
|
||||
color->b = eEC_ctrl_work.light_info.lights.diffuse.color[2];
|
||||
color->a = 0;
|
||||
|
||||
*shadow_flag = eEL_light_data.shadow_flag;
|
||||
return eEL_light_data.light_state;
|
||||
}
|
||||
|
||||
static void eEL_InitEffectLight(void) {
|
||||
eEL_light_data = eEC_light_default;
|
||||
eEL_light_data.n_frames = 10;
|
||||
}
|
||||
|
||||
static void eEL_CalcEffectLight_Set(GAME* game) {
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
|
||||
if (eEL_light_data.ctr > eEL_light_data.n_frames) {
|
||||
eEL_InitEffectLight();
|
||||
eEC_ctrl_work.light_info.lights.diffuse.color[0] = 0;
|
||||
eEC_ctrl_work.light_info.lights.diffuse.color[1] = 0;
|
||||
eEC_ctrl_work.light_info.lights.diffuse.color[2] = 0;
|
||||
eEL_light_data.light_state = eEC_LIGHT_COLOR_DISABLED;
|
||||
} else {
|
||||
if (eEL_light_data.ctr < eEL_light_data.max_frame) {
|
||||
r = (int)eEC_CLIP->calc_adjust_proc(eEL_light_data.ctr, 0, eEL_light_data.max_frame,
|
||||
eEL_light_data.start_color.r, eEL_light_data.target_color.r);
|
||||
g = (int)eEC_CLIP->calc_adjust_proc(eEL_light_data.ctr, 0, eEL_light_data.max_frame,
|
||||
eEL_light_data.start_color.g, eEL_light_data.target_color.g);
|
||||
b = (int)eEC_CLIP->calc_adjust_proc(eEL_light_data.ctr, 0, eEL_light_data.max_frame,
|
||||
eEL_light_data.start_color.b, eEL_light_data.target_color.b);
|
||||
|
||||
eEL_light_data.light_state = eEC_LIGHT_COLOR_INCREASING;
|
||||
} else {
|
||||
r = (int)eEC_CLIP->calc_adjust_proc(eEL_light_data.ctr, eEL_light_data.max_frame, eEL_light_data.n_frames,
|
||||
eEL_light_data.target_color.r, 0.0f);
|
||||
g = (int)eEC_CLIP->calc_adjust_proc(eEL_light_data.ctr, eEL_light_data.max_frame, eEL_light_data.n_frames,
|
||||
eEL_light_data.target_color.g, 0.0f);
|
||||
b = (int)eEC_CLIP->calc_adjust_proc(eEL_light_data.ctr, eEL_light_data.max_frame, eEL_light_data.n_frames,
|
||||
eEL_light_data.target_color.b, 0.0f);
|
||||
|
||||
if (eEL_light_data.ctr == eEL_light_data.max_frame) {
|
||||
eEL_light_data.light_state = eEC_LIGHT_COLOR_MAXIMUM;
|
||||
} else {
|
||||
eEL_light_data.light_state = eEC_LIGHT_COLOR_DECREASING;
|
||||
}
|
||||
}
|
||||
|
||||
eEC_ctrl_work.light_info.lights.diffuse.color[0] = r;
|
||||
eEC_ctrl_work.light_info.lights.diffuse.color[1] = g;
|
||||
eEC_ctrl_work.light_info.lights.diffuse.color[2] = b;
|
||||
eEL_light_data.ctr++;
|
||||
}
|
||||
}
|
||||
|
||||
static void eEL_RegistEffectLight(rgba_t color, s16 max_frames, s16 n_frames, int shadow_flag) {
|
||||
eEL_light_data.start_color.r = eEC_ctrl_work.light_info.lights.diffuse.color[0];
|
||||
eEL_light_data.start_color.g = eEC_ctrl_work.light_info.lights.diffuse.color[1];
|
||||
eEL_light_data.start_color.b = eEC_ctrl_work.light_info.lights.diffuse.color[2];
|
||||
|
||||
eEL_light_data.ctr = 0;
|
||||
eEL_light_data.target_color = color;
|
||||
eEL_light_data.max_frame = max_frames;
|
||||
eEL_light_data.n_frames = n_frames;
|
||||
eEL_light_data.shadow_flag = shadow_flag;
|
||||
}
|
||||
|
||||
static void eEL_DecideLightPower(rgba_t* result_color, rgba_t base_color, xyz_t pos, GAME* game, f32 max_power,
|
||||
f32 min_power, f32 max_dist) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
PLAYER_ACTOR* player = GET_PLAYER_ACTOR(play);
|
||||
|
||||
if (player != NULL) {
|
||||
xyz_t player_pos = player->actor_class.world.position;
|
||||
f32 dist = search_position_distance(&pos, &player_pos);
|
||||
f32 power;
|
||||
|
||||
if (dist > max_dist) {
|
||||
power = min_power;
|
||||
} else {
|
||||
power = (max_power - min_power) * (1.0f - dist / max_dist);
|
||||
power += min_power;
|
||||
}
|
||||
|
||||
result_color->r = (int)(base_color.r * power);
|
||||
result_color->g = (int)(base_color.g * power);
|
||||
result_color->b = (int)(base_color.b * power);
|
||||
result_color->a = 255;
|
||||
} else {
|
||||
*result_color = base_color;
|
||||
}
|
||||
}
|
||||
|
||||
static int mEL_CheckLookAtBlock(xyz_t pos) {
|
||||
xyz_t* lookat = Camera2_getCenterPos_p();
|
||||
int effect_bx;
|
||||
int effect_bz;
|
||||
int lookat_bx;
|
||||
int lookat_bz;
|
||||
|
||||
if (mFI_Wpos2BlockNum(&effect_bx, &effect_bz, pos) && mFI_Wpos2BlockNum(&lookat_bx, &lookat_bz, *lookat)) {
|
||||
if (effect_bx == lookat_bx && effect_bz == lookat_bz) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
+29
-28
@@ -4,10 +4,9 @@
|
||||
#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);
|
||||
|
||||
static void Ef_Lamp_Light_actor_ct(ACTOR* actor, GAME* game);
|
||||
static void Ef_Lamp_Light_actor_dt(ACTOR* actor, GAME* game);
|
||||
static void Ef_Lamp_Light_actor_move(ACTOR* actor, GAME* game);
|
||||
|
||||
ACTOR_PROFILE Lamp_Light_Profile = {
|
||||
mAc_PROFILE_LAMP_LIGHT,
|
||||
@@ -16,51 +15,53 @@ ACTOR_PROFILE Lamp_Light_Profile = {
|
||||
EMPTY_NO,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(LAMPLIGHT_ACTOR),
|
||||
(mActor_proc)Ef_Lamp_Light_actor_ct,
|
||||
(mActor_proc)Ef_Lamp_Light_actor_dt,
|
||||
Ef_Lamp_Light_actor_ct,
|
||||
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) {
|
||||
static void Ef_Lamp_Light_actor_ct(ACTOR* actor, GAME* game) {
|
||||
LAMPLIGHT_ACTOR* lamp = (LAMPLIGHT_ACTOR*)actor;
|
||||
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
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);
|
||||
Light_diffuse_ct(&lamp->lights, 0, 0x50, 0, 0, 0, 0);
|
||||
lamp->node_p = Global_light_list_new(game, &play->global_light, &lamp->lights);
|
||||
}
|
||||
|
||||
static void Ef_Lamp_Light_actor_dt(ACTOR* actor, GAME_PLAY* play) {
|
||||
static void Ef_Lamp_Light_actor_dt(ACTOR* actor, GAME* game) {
|
||||
LAMPLIGHT_ACTOR* lamp = (LAMPLIGHT_ACTOR*)actor;
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
play->kankyo.lamp_light = NULL;
|
||||
play->kankyo.lamp_light = NULL;
|
||||
Global_light_list_delete(&play->global_light, lamp->node_p);
|
||||
}
|
||||
|
||||
static int eLL_get_light_sw_other_room(){
|
||||
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)){
|
||||
// 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)){
|
||||
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(){
|
||||
static int eLL_get_light_sw_start_demo() {
|
||||
int ret = 1;
|
||||
|
||||
if(Common_Get(sunlight_flag) == 1){
|
||||
|
||||
if (Common_Get(sunlight_flag) == 1) {
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
@@ -100,18 +101,18 @@ static void eLL_ctrl_light_sw(LAMPLIGHT_ACTOR* lamp) {
|
||||
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 void Ef_Lamp_Light_actor_move(ACTOR* actor, GAME* game) {
|
||||
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};
|
||||
static s16* cmp_data[] = { cmp_data_off, cmp_data_on };
|
||||
|
||||
LAMPLIGHT_ACTOR* lamp = (LAMPLIGHT_ACTOR*)actor;
|
||||
|
||||
s16 val;
|
||||
u8* color;
|
||||
u8* color;
|
||||
s16* add;
|
||||
int type;
|
||||
s16* cmp;
|
||||
@@ -128,4 +129,4 @@ static void Ef_Lamp_Light_actor_move(ACTOR* actor, GAME_PLAY* play) {
|
||||
chase_s(&val, *cmp, (0.5f * *add));
|
||||
*color = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2129
-2212
File diff suppressed because it is too large
Load Diff
+101
-124
@@ -11,26 +11,25 @@ extern Gfx point_light_model[];
|
||||
|
||||
static void Light_point_color_set(Lights* lights, u8 r, u8 g, u8 b, s16 radius);
|
||||
static void Global_light_list_ct(Global_light* light);
|
||||
static void Global_light_ambient_set(Global_light* light, u8 r,u8 g,u8 b);
|
||||
static void Global_light_fog_set(Global_light* light ,u8 r,u8 g,u8 b,s16 near,s16 far);
|
||||
static void Global_light_ambient_set(Global_light* light, u8 r, u8 g, u8 b);
|
||||
static void Global_light_fog_set(Global_light* light, u8 r, u8 g, u8 b, s16 near, s16 far);
|
||||
static LightsN* new_LightsN(GRAPH*, u8 r, u8 g, u8 b);
|
||||
|
||||
|
||||
static void point_data_set(Lights* lights, s16 x, s16 y, s16 z,u8 r, u8 g, u8 b, s16 radius, int type ){
|
||||
static void point_data_set(Lights* lights, s16 x, s16 y, s16 z, u8 r, u8 g, u8 b, s16 radius, int type) {
|
||||
|
||||
lights->type = type;
|
||||
lights->lights.point.x = x;
|
||||
lights->lights.point.y = y;
|
||||
lights->lights.point.z = z;
|
||||
Light_point_color_set(lights,r,g,b,radius);
|
||||
lights->lights.point.y = y;
|
||||
lights->lights.point.z = z;
|
||||
Light_point_color_set(lights, r, g, b, radius);
|
||||
}
|
||||
|
||||
extern void Light_point_ct(Lights* lights, s16 x, s16 y, s16 z, u8 r, u8 g, u8 b, s16 radius){
|
||||
extern void Light_point_ct(Lights* lights, s16 x, s16 y, s16 z, u8 r, u8 g, u8 b, s16 radius) {
|
||||
|
||||
point_data_set(lights, x, y, z, r,g,b,radius,0);
|
||||
point_data_set(lights, x, y, z, r, g, b, radius, 0);
|
||||
}
|
||||
|
||||
static void Light_point_color_set(Lights* lights, u8 r, u8 g, u8 b, s16 radius){
|
||||
static void Light_point_color_set(Lights* lights, u8 r, u8 g, u8 b, s16 radius) {
|
||||
|
||||
lights->lights.point.color[0] = r;
|
||||
lights->lights.point.color[1] = g;
|
||||
@@ -38,7 +37,7 @@ static void Light_point_color_set(Lights* lights, u8 r, u8 g, u8 b, s16 radius){
|
||||
lights->lights.point.radius = radius;
|
||||
}
|
||||
|
||||
extern void Light_diffuse_ct(Lights* lights, s8 x, s8 y, s8 z, u8 r, u8 g, u8 b){
|
||||
extern void Light_diffuse_ct(Lights* lights, s8 x, s8 y, s8 z, u8 r, u8 g, u8 b) {
|
||||
|
||||
lights->type = 1;
|
||||
lights->lights.diffuse.x = x;
|
||||
@@ -47,22 +46,20 @@ extern void Light_diffuse_ct(Lights* lights, s8 x, s8 y, s8 z, u8 r, u8 g, u8 b)
|
||||
lights->lights.diffuse.color[0] = r;
|
||||
lights->lights.diffuse.color[1] = g;
|
||||
lights->lights.diffuse.color[2] = b;
|
||||
|
||||
}
|
||||
|
||||
extern void LightsN_disp_BG(LightsN* lights, GRAPH* graph){
|
||||
extern void LightsN_disp_BG(LightsN* lights, GRAPH* graph) {
|
||||
|
||||
Light_new* light;
|
||||
int i;
|
||||
|
||||
|
||||
OPEN_DISP(graph);
|
||||
|
||||
gSPNumLights(NOW_BG_OPA_DISP++, lights->diffuse_count);
|
||||
|
||||
|
||||
light = lights->l;
|
||||
|
||||
for(i = 0; i < lights->diffuse_count; i){
|
||||
for (i = 0; i < lights->diffuse_count; i) {
|
||||
i++;
|
||||
gSPLight(NOW_BG_OPA_DISP++, light, i);
|
||||
gSPLight(NOW_BG_XLU_DISP++, light, i);
|
||||
@@ -72,28 +69,27 @@ extern void LightsN_disp_BG(LightsN* lights, GRAPH* graph){
|
||||
i++;
|
||||
gSPLight(NOW_BG_OPA_DISP++, &lights->a.l, i);
|
||||
gSPLight(NOW_BG_XLU_DISP++, &lights->a.l, i);
|
||||
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
|
||||
extern void LightsN_disp(LightsN* lights, GRAPH* graph){
|
||||
extern void LightsN_disp(LightsN* lights, GRAPH* graph) {
|
||||
|
||||
Light_new* light;
|
||||
int i;
|
||||
Gfx* opa_gfx;
|
||||
Gfx* xlu_gfx;
|
||||
|
||||
|
||||
|
||||
OPEN_DISP(graph);
|
||||
opa_gfx = NOW_POLY_OPA_DISP;
|
||||
xlu_gfx = NOW_POLY_XLU_DISP;
|
||||
|
||||
gSPNumLights(opa_gfx++, lights->diffuse_count);
|
||||
gSPNumLights(xlu_gfx++, lights->diffuse_count);
|
||||
|
||||
|
||||
light = lights->l;
|
||||
|
||||
for(i = 0; i < lights->diffuse_count;){
|
||||
for (i = 0; i < lights->diffuse_count;) {
|
||||
i++;
|
||||
gSPLight(opa_gfx++, light, i);
|
||||
gSPLight(xlu_gfx++, light, i);
|
||||
@@ -109,155 +105,143 @@ extern void LightsN_disp(LightsN* lights, GRAPH* graph){
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
|
||||
static Light_new* LightsN_new_diffuse(LightsN* lights){
|
||||
|
||||
if(lights->diffuse_count >= 7){
|
||||
static Light_new* LightsN_new_diffuse(LightsN* lights) {
|
||||
|
||||
if (lights->diffuse_count >= 7) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &lights->l[lights->diffuse_count++];
|
||||
}
|
||||
|
||||
static void LightsN__point_proc(LightsN* lights, LightParams* lightInfo, xyz_t* point){
|
||||
static void LightsN__point_proc(LightsN* lights, LightParams* lightInfo, xyz_t* point) {
|
||||
f32 xdiff;
|
||||
f32 ydiff;
|
||||
f32 ydiff;
|
||||
f32 zdiff;
|
||||
f32 pointd;
|
||||
f32 rad;
|
||||
Light_new* light;
|
||||
|
||||
if((point != NULL) && (lightInfo->point.radius > 0)){
|
||||
|
||||
if ((point != NULL) && (lightInfo->point.radius > 0)) {
|
||||
xdiff = lightInfo->point.x - point->x;
|
||||
ydiff = lightInfo->point.y - point->y;
|
||||
zdiff = lightInfo->point.z - point->z;
|
||||
ydiff = lightInfo->point.y - point->y;
|
||||
zdiff = lightInfo->point.z - point->z;
|
||||
pointd = (xdiff * xdiff) + (ydiff * ydiff) + (zdiff * zdiff);
|
||||
|
||||
|
||||
rad = lightInfo->point.radius;
|
||||
|
||||
if(pointd < (rad * rad)){
|
||||
if (pointd < (rad * rad)) {
|
||||
light = LightsN_new_diffuse(lights);
|
||||
|
||||
if(light != NULL){
|
||||
|
||||
if (light != NULL) {
|
||||
pointd = sqrtf(pointd);
|
||||
rad = pointd / rad;
|
||||
rad = 1 - (rad* rad);
|
||||
|
||||
rad = 1 - (rad * rad);
|
||||
|
||||
light->l.col[0] = light->l.colc[0] = lightInfo->point.color[0] * rad;
|
||||
light->l.col[1] = light->l.colc[1] = lightInfo->point.color[1] * rad;
|
||||
light->l.col[2] = light->l.colc[2] = lightInfo->point.color[2] * rad;
|
||||
|
||||
|
||||
rad = (pointd < 1) ? 120.0f : 120.0f / pointd;
|
||||
|
||||
|
||||
light->l.dir[0] = xdiff * rad;
|
||||
light->l.dir[1] = ydiff * rad;
|
||||
light->l.dir[2] = zdiff * rad;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void LightsN__P_point_proc(LightsN* lights, LightParams* lightInfo, xyz_t* pos){
|
||||
static void LightsN__P_point_proc(LightsN* lights, LightParams* lightInfo, xyz_t* pos) {
|
||||
|
||||
f32 rad;
|
||||
xyz_t point;
|
||||
Light_new* light;
|
||||
f32 kq;
|
||||
f32 kq;
|
||||
|
||||
if(lightInfo->point.radius > 0){
|
||||
if (lightInfo->point.radius > 0) {
|
||||
light = LightsN_new_diffuse(lights);
|
||||
|
||||
if(light != NULL){
|
||||
if (light != NULL) {
|
||||
rad = lightInfo->point.radius;
|
||||
kq = 4500000.0f / (rad * rad);
|
||||
if(kq > 255.0f){
|
||||
if (kq > 255.0f) {
|
||||
kq = 255.0f;
|
||||
}
|
||||
else if(kq < 20.0f){
|
||||
} else if (kq < 20.0f) {
|
||||
kq = 20.0f;
|
||||
}
|
||||
light->l.col[0] = lightInfo->point.color[0];
|
||||
light->l.colc[0] = light->l.col[0];
|
||||
|
||||
|
||||
light->l.col[1] = lightInfo->point.color[1];
|
||||
light->l.colc[1] = light->l.col[1];
|
||||
|
||||
|
||||
light->l.col[2] = lightInfo->point.color[2];
|
||||
light->l.colc[2] = light->l.col[2];
|
||||
|
||||
|
||||
light->p.pos[0] = lightInfo->point.x;
|
||||
light->p.pos[1] = lightInfo->point.y;
|
||||
light->p.pos[2] = lightInfo->point.z;
|
||||
light->p.kc = 8;
|
||||
light->p.kl = -1;
|
||||
light->p.kq = kq;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void LightsN__diffuse_proc(LightsN* lights, LightParams* lightInfo){
|
||||
static void LightsN__diffuse_proc(LightsN* lights, LightParams* lightInfo) {
|
||||
|
||||
Light_new* light;
|
||||
|
||||
light = LightsN_new_diffuse(lights);
|
||||
|
||||
if(light != NULL){
|
||||
if (light != NULL) {
|
||||
light->l.col[0] = light->l.colc[0] = lightInfo->diffuse.color[0];
|
||||
light->l.col[1] = light->l.colc[1] = lightInfo->diffuse.color[1];
|
||||
light->l.col[2] = light->l.colc[2] = lightInfo->diffuse.color[2];
|
||||
light->l.dir[0] = lightInfo->diffuse.x;
|
||||
light->l.dir[1] = lightInfo->diffuse.y;
|
||||
light->l.dir[2] = lightInfo->diffuse.z;
|
||||
|
||||
light->l.dir[1] = lightInfo->diffuse.y;
|
||||
light->l.dir[2] = lightInfo->diffuse.z;
|
||||
}
|
||||
}
|
||||
|
||||
extern void LightsN_list_check(LightsN* lights, Light_list* node, xyz_t* pos){
|
||||
extern void LightsN_list_check(LightsN* lights, Light_list* node, xyz_t* pos) {
|
||||
|
||||
const static light_point_proc poslight_type_proc[] = {
|
||||
LightsN__point_proc,
|
||||
(light_point_proc)LightsN__diffuse_proc,
|
||||
LightsN__point_proc
|
||||
};
|
||||
const static light_point_proc poslight_type_proc[] = { LightsN__point_proc, (light_point_proc)LightsN__diffuse_proc,
|
||||
LightsN__point_proc };
|
||||
|
||||
const static light_P_point_proc light_type_proc[] = {
|
||||
LightsN__P_point_proc,
|
||||
(light_P_point_proc)LightsN__diffuse_proc,
|
||||
LightsN__P_point_proc
|
||||
};
|
||||
const static light_P_point_proc light_type_proc[] = { LightsN__P_point_proc,
|
||||
(light_P_point_proc)LightsN__diffuse_proc,
|
||||
LightsN__P_point_proc };
|
||||
|
||||
if(pos == NULL){
|
||||
while(node != NULL) {
|
||||
if (pos == NULL) {
|
||||
while (node != NULL) {
|
||||
light_type_proc[node->info->type](lights, &node->info->lights, pos);
|
||||
node = node->next;
|
||||
}
|
||||
}
|
||||
else{
|
||||
while(node != NULL) {
|
||||
} else {
|
||||
while (node != NULL) {
|
||||
poslight_type_proc[node->info->type](lights, &node->info->lights, pos);
|
||||
node = node->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Light_list* Light_list_buf_new(){
|
||||
static Light_list* Light_list_buf_new() {
|
||||
|
||||
Light_list* light;
|
||||
|
||||
if(light_list_buf.current >= 32){
|
||||
|
||||
if (light_list_buf.current >= 32) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
light = &light_list_buf.lights[light_list_buf.idx];
|
||||
|
||||
while(light->info != NULL){
|
||||
while (light->info != NULL) {
|
||||
light_list_buf.idx++;
|
||||
if(light_list_buf.idx < 32){
|
||||
if (light_list_buf.idx < 32) {
|
||||
light++;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
light_list_buf.idx = 0;
|
||||
light = &light_list_buf.lights[0];
|
||||
}
|
||||
@@ -267,62 +251,59 @@ static Light_list* Light_list_buf_new(){
|
||||
return light;
|
||||
}
|
||||
|
||||
static void Light_list_buf_delete(Light_list* light){
|
||||
if(light != NULL){
|
||||
static void Light_list_buf_delete(Light_list* light) {
|
||||
if (light != NULL) {
|
||||
light_list_buf.current--;
|
||||
light->info = NULL;
|
||||
light_list_buf.idx = (light - light_list_buf.lights) / (int)(sizeof(Light_list));
|
||||
}
|
||||
}
|
||||
|
||||
extern void Global_light_ct(Global_light* glight){
|
||||
extern void Global_light_ct(Global_light* glight) {
|
||||
|
||||
Global_light_list_ct(glight);
|
||||
Global_light_ambient_set(glight, 80,80,80);
|
||||
Global_light_fog_set(glight, 0,0,0, 996, 1600);
|
||||
Global_light_ambient_set(glight, 80, 80, 80);
|
||||
Global_light_fog_set(glight, 0, 0, 0, 996, 1600);
|
||||
bzero(&light_list_buf, sizeof(Light_buffer));
|
||||
}
|
||||
|
||||
static void Global_light_ambient_set(Global_light* glight, u8 r, u8 g, u8 b){
|
||||
static void Global_light_ambient_set(Global_light* glight, u8 r, u8 g, u8 b) {
|
||||
|
||||
glight->ambientColor[0] = r;
|
||||
glight->ambientColor[1] = g;
|
||||
glight->ambientColor[2] = b;
|
||||
|
||||
glight->ambientColor[2] = b;
|
||||
}
|
||||
|
||||
static void Global_light_fog_set(Global_light* glight, u8 r, u8 g, u8 b, s16 near, s16 far){
|
||||
static void Global_light_fog_set(Global_light* glight, u8 r, u8 g, u8 b, s16 near, s16 far) {
|
||||
|
||||
glight->fogColor[0] = r;
|
||||
glight->fogColor[1] = g;
|
||||
glight->fogColor[2] = b;
|
||||
glight->fogNear = near;
|
||||
glight->fogFar = far;
|
||||
|
||||
}
|
||||
|
||||
|
||||
extern LightsN* Global_light_read(Global_light* glight, GRAPH* graph){
|
||||
extern LightsN* Global_light_read(Global_light* glight, GRAPH* graph) {
|
||||
return new_LightsN(graph, glight->ambientColor[0], glight->ambientColor[1], glight->ambientColor[2]);
|
||||
}
|
||||
|
||||
static void Global_light_list_ct(Global_light* glight){
|
||||
static void Global_light_list_ct(Global_light* glight) {
|
||||
|
||||
glight->list = NULL;
|
||||
}
|
||||
|
||||
extern Light_list* Global_light_list_new(GAME_PLAY* play, Global_light* glight, Lights* light){
|
||||
extern Light_list* Global_light_list_new(GAME* game, Global_light* glight, Lights* light) {
|
||||
|
||||
Light_list* clight;
|
||||
|
||||
clight = Light_list_buf_new();
|
||||
|
||||
if(clight != NULL){
|
||||
if (clight != NULL) {
|
||||
clight->info = light;
|
||||
clight->prev = NULL;
|
||||
clight->next = glight->list;
|
||||
|
||||
if(glight->list != NULL){
|
||||
if (glight->list != NULL) {
|
||||
glight->list->prev = clight;
|
||||
}
|
||||
|
||||
@@ -332,75 +313,71 @@ extern Light_list* Global_light_list_new(GAME_PLAY* play, Global_light* glight,
|
||||
return clight;
|
||||
}
|
||||
|
||||
extern void Global_light_list_delete(Global_light* glight, Light_list* light){
|
||||
extern void Global_light_list_delete(Global_light* glight, Light_list* light) {
|
||||
|
||||
if(light != NULL){
|
||||
if(light->prev != NULL){
|
||||
if (light != NULL) {
|
||||
if (light->prev != NULL) {
|
||||
light->prev->next = light->next;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
glight->list = light->next;
|
||||
}
|
||||
|
||||
if(light->next != NULL){
|
||||
if (light->next != NULL) {
|
||||
light->next->prev = light->prev;
|
||||
}
|
||||
Light_list_buf_delete(light);
|
||||
}
|
||||
}
|
||||
|
||||
static LightsN* new_LightsN(GRAPH* graph, u8 r, u8 g, u8 b){
|
||||
static LightsN* new_LightsN(GRAPH* graph, u8 r, u8 g, u8 b) {
|
||||
|
||||
LightsN* light;
|
||||
|
||||
light = GRAPH_ALLOC(graph, sizeof(LightsN));
|
||||
|
||||
light->a.l.col[0] = light->a.l.colc[0] = r;
|
||||
light->a.l.col[1] = light->a.l.colc[1] = g;
|
||||
light->a.l.col[2] = light->a.l.colc[2] = b;
|
||||
light->a.l.col[1] = light->a.l.colc[1] = g;
|
||||
light->a.l.col[2] = light->a.l.colc[2] = b;
|
||||
|
||||
light->diffuse_count = 0;
|
||||
|
||||
return light;
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern void Light_list_point_draw(GAME_PLAY* play){
|
||||
extern void Light_list_point_draw(GAME_PLAY* play) {
|
||||
LightPoint* lightInfo;
|
||||
Light_list* light;
|
||||
GRAPH* g = play->game.graph;
|
||||
f32 rad;
|
||||
Gfx* dl;
|
||||
|
||||
light = play->global_light.list;
|
||||
|
||||
|
||||
light = play->global_light.list;
|
||||
|
||||
OPEN_DISP(g);
|
||||
dl = gfx_softsprite_prim_xlu(NOW_POLY_XLU_DISP);
|
||||
|
||||
gDPSetAlphaDither(dl++, G_AD_NOISE);
|
||||
gDPSetColorDither(dl++, G_CD_MAGICSQ);
|
||||
gSPDisplayList(dl++,point_light_init_model);
|
||||
|
||||
while(light != NULL) {
|
||||
if(light->info->type == 2){
|
||||
gDPSetAlphaDither(dl++, G_AD_NOISE);
|
||||
gDPSetColorDither(dl++, G_CD_MAGICSQ);
|
||||
gSPDisplayList(dl++, point_light_init_model);
|
||||
|
||||
while (light != NULL) {
|
||||
if (light->info->type == 2) {
|
||||
lightInfo = &light->info->lights.point;
|
||||
if(lightInfo->drawGlow){
|
||||
if (lightInfo->drawGlow) {
|
||||
rad = (lightInfo->radius * lightInfo->radius) * 2.60000001617e-06f;
|
||||
gDPSetPrimColor(dl++, 0, 0, lightInfo->color[0], lightInfo->color[1], lightInfo->color[2], 50);
|
||||
|
||||
Matrix_translate(lightInfo->x, lightInfo->y, lightInfo->z, 0);
|
||||
Matrix_scale(rad,rad,rad, 1);
|
||||
Matrix_scale(rad, rad, rad, 1);
|
||||
|
||||
gSPMatrix(dl++, _Matrix_to_Mtx_new(play->game.graph),G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPMatrix(dl++, _Matrix_to_Mtx_new(play->game.graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
gSPDisplayList(dl++,point_light_model);
|
||||
}
|
||||
gSPDisplayList(dl++, point_light_model);
|
||||
}
|
||||
}
|
||||
light = light->next;
|
||||
light = light->next;
|
||||
}
|
||||
|
||||
SET_POLY_XLU_DISP(dl);
|
||||
CLOSE_DISP(g);
|
||||
}
|
||||
}
|
||||
|
||||
+320
-359
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user