mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
decompile ef_young_tree.c
This commit is contained in:
+1
-1
@@ -1346,7 +1346,7 @@ config.libs = [
|
||||
Object(NonMatching, "effect/ef_walk_asimoto.c"),
|
||||
Object(NonMatching, "effect/ef_warau.c"),
|
||||
Object(NonMatching, "effect/ef_yajirushi.c"),
|
||||
Object(NonMatching, "effect/ef_young_tree.c"),
|
||||
Object(Matching, "effect/ef_young_tree.c"),
|
||||
Object(Matching, "effect/ef_yukidama.c"),
|
||||
Object(Matching, "effect/ef_yukidaruma.c"),
|
||||
Object(Matching, "effect/ef_yukihane.c"),
|
||||
|
||||
+11
-11
@@ -192,17 +192,17 @@ typedef struct field_display_list_info_s {
|
||||
} mFM_field_draw_info_c;
|
||||
|
||||
typedef struct field_pal_s {
|
||||
u16* earth_pal;
|
||||
u16* cliff_pal;
|
||||
u16* bush_pal;
|
||||
u16* flower0_pal;
|
||||
u16* flower1_pal;
|
||||
u16* flower2_pal;
|
||||
u16* grass_pal;
|
||||
u16* tree_pal;
|
||||
u16* cedar_tree_pal; // probably?
|
||||
u16* palm_tree_pal;
|
||||
u16* golden_tree_pal;
|
||||
/* 0x00 */ u16* earth_pal;
|
||||
/* 0x04 */ u16* cliff_pal;
|
||||
/* 0x08 */ u16* bush_pal;
|
||||
/* 0x0C */ u16* flower0_pal;
|
||||
/* 0x10 */ u16* flower1_pal;
|
||||
/* 0x14 */ u16* flower2_pal;
|
||||
/* 0x18 */ u16* grass_pal;
|
||||
/* 0x1C */ u16* tree_pal;
|
||||
/* 0x20 */ u16* cedar_tree_pal; // probably?
|
||||
/* 0x24 */ u16* palm_tree_pal;
|
||||
/* 0x28 */ u16* golden_tree_pal;
|
||||
} mFM_field_pal_c;
|
||||
|
||||
typedef struct field_bg_sound_source_s {
|
||||
|
||||
+162
-4
@@ -1,4 +1,8 @@
|
||||
#include "ef_effect_control.h"
|
||||
#include "m_common_data.h"
|
||||
#include "m_debug.h"
|
||||
#include "m_rcp.h"
|
||||
#include "sys_matrix.h"
|
||||
|
||||
static void eYoung_Tree_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
|
||||
static void eYoung_Tree_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
|
||||
@@ -18,17 +22,171 @@ eEC_PROFILE_c iam_ef_young_tree = {
|
||||
};
|
||||
|
||||
static void eYoung_Tree_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1) {
|
||||
// TODO
|
||||
eEC_CLIP->make_effect_proc(eEC_EFFECT_YOUNG_TREE, pos, NULL, game, NULL, item_name, prio, arg0, arg1);
|
||||
}
|
||||
|
||||
static void eYoung_Tree_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
|
||||
// TODO
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
Camera2* camera = &play->camera;
|
||||
|
||||
f32 dist = search_position_distance(&camera->lookat.eye, &camera->lookat.center);
|
||||
|
||||
effect->scale.x = 0.010299999f;
|
||||
effect->scale.y = 0.0095f;
|
||||
effect->scale.z = 0.0095f;
|
||||
|
||||
if (effect->arg0 == 2 || effect->arg0 == 1) {
|
||||
effect->velocity = ZeroVec;
|
||||
effect->velocity.y = 0.75f;
|
||||
effect->acceleration = ZeroVec;
|
||||
effect->acceleration.y = -0.05f;
|
||||
effect->timer = 40;
|
||||
} else if (effect->arg0 == 3) {
|
||||
effect->velocity = ZeroVec;
|
||||
effect->acceleration = ZeroVec;
|
||||
effect->timer = 14;
|
||||
} else {
|
||||
effect->velocity = ZeroVec;
|
||||
effect->acceleration = ZeroVec;
|
||||
effect->timer = 82;
|
||||
}
|
||||
effect->effect_specific[1] = 0;
|
||||
effect->effect_specific[2] = 0;
|
||||
|
||||
xyz_t_sub(&camera->lookat.eye, &camera->lookat.center, &effect->offset);
|
||||
xyz_t_mult_v(&effect->offset, 1.0f / dist);
|
||||
effect->effect_specific[0] = Common_Get(time.season);
|
||||
}
|
||||
|
||||
static void eYoung_Tree_mv(eEC_Effect_c* effect, GAME* game) {
|
||||
// TODO
|
||||
f32 fVar4;
|
||||
f32 dVar3;
|
||||
xyz_t effPos;
|
||||
xyz_t effPos2;
|
||||
s16 uVar2;
|
||||
|
||||
xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity);
|
||||
xyz_t_add(&effect->position, &effect->velocity, &effect->position);
|
||||
if (effect->arg0 == 1) {
|
||||
effect->effect_specific[1] = effect->effect_specific[1] + 384;
|
||||
} else if (effect->arg0 == 2) {
|
||||
effect->effect_specific[1] = effect->effect_specific[1] - 384;
|
||||
} else {
|
||||
dVar3 = eEC_CLIP->calc_adjust_proc(effect->timer, 0, 0x28, 0.0f, 2184.0f);
|
||||
fVar4 = sin_s(effect->effect_specific[2]);
|
||||
|
||||
effect->effect_specific[1] = dVar3 * fVar4;
|
||||
effect->effect_specific[2] = effect->effect_specific[2] + 0xC68;
|
||||
if ((effect->timer & 0x1F) == 0) {
|
||||
effPos = effect->position;
|
||||
if (Common_Get(time).term_idx == mTM_TERM_4) {
|
||||
uVar2 = 6;
|
||||
} else {
|
||||
uVar2 = 4;
|
||||
}
|
||||
|
||||
if (effect->arg1 == 1) {
|
||||
uVar2 |= 0x2000;
|
||||
} else if (effect->arg1 == 2) {
|
||||
uVar2 |= 0x4000;
|
||||
} else if (effect->arg1 == 3) {
|
||||
uVar2 |= 0x6000;
|
||||
}
|
||||
|
||||
effPos.x = effPos.x + fqrand2() * 30.0f;
|
||||
effPos.y = effPos.y + fqrand() * 30.0f;
|
||||
uVar2 |= 0x8000;
|
||||
|
||||
(*Common_Get(clip.effect_clip)->effect_make_proc)(
|
||||
0x33, effPos, 2, 0, game, 0xFFFF, 0, uVar2
|
||||
);
|
||||
|
||||
if (effect->effect_specific[0] == 3) {
|
||||
effPos2 = effect->position;
|
||||
effPos2.x = effPos2.x + fqrand2() * 30.0f;
|
||||
effPos2.y = effPos2.y + fqrand() * 30.0f;
|
||||
(*Common_Get(clip.effect_clip)->effect_make_proc)(
|
||||
0x34, effPos2, 2, 0, game, 0xFFFF, 0, 0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern Gfx ef_w_young_palm_modelT[];
|
||||
extern Gfx ef_s_young_palm_modelT[];
|
||||
extern Gfx ef_w_young_cedar_modelT[];
|
||||
extern Gfx ef_s_young_cedar_modelT[];
|
||||
extern Gfx ef_w_youngtree_00_modelT[];
|
||||
extern Gfx ef_f_youngtree_00_modelT[];
|
||||
extern Gfx ef_s_youngtree_00_modelT[];
|
||||
|
||||
static void eYoung_Tree_dw(eEC_Effect_c* effect, GAME* game) {
|
||||
// TODO
|
||||
GRAPH* graph;
|
||||
mFM_field_pal_c* field_pal = mFI_GetFieldPal();
|
||||
u16* cedar_pal = field_pal->cedar_tree_pal;
|
||||
u16* palm_pal = field_pal->palm_tree_pal;
|
||||
u16* golden_pal = field_pal->golden_tree_pal;
|
||||
s16 remain = 0x28 - effect->timer;
|
||||
u8 alpha;
|
||||
|
||||
if (effect->arg0 == 2 || effect->arg0 == 1) {
|
||||
alpha = (int)eEC_CLIP->calc_adjust_proc(remain, 0, 0x28, 255.0f, 0.0f);
|
||||
} else {
|
||||
alpha = (int)eEC_CLIP->calc_adjust_proc(effect->timer, 0, 8, 0.0f, 255.0f);
|
||||
}
|
||||
|
||||
graph = game->graph;
|
||||
_texture_z_light_fog_prim_xlu(graph);
|
||||
Matrix_translate(effect->position.x, effect->position.y + 3.0f, effect->position.z + 3.0f, 0);
|
||||
|
||||
if (effect->arg1 == 0 || effect->arg1 == 3) {
|
||||
Matrix_RotateVector(effect->effect_specific[1], &effect->offset, 1);
|
||||
} else if (effect->arg1 == 1) {
|
||||
Matrix_translate(0.0f, (f32)GETREG(TAKREG, 20) + 5.0f, 0.0f, 1);
|
||||
Matrix_RotateVector(effect->effect_specific[1], &effect->offset, 1);
|
||||
Matrix_translate(0.0f, -5.0f - (f32)GETREG(TAKREG, 20), 0.0f, 1);
|
||||
} else {
|
||||
Matrix_translate(0.0f, 15.0f, 0.0f, 1);
|
||||
Matrix_RotateVector(effect->effect_specific[1], &effect->offset, 1);
|
||||
Matrix_translate(0.0f, -15.0f, 0.0f, 1);
|
||||
}
|
||||
Matrix_scale(effect->scale.x, effect->scale.y, effect->scale.z, 1);
|
||||
|
||||
OPEN_DISP(graph);
|
||||
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
if (effect->arg1 == 0) {
|
||||
gSPSegment(NEXT_POLY_XLU_DISP, ANIME_1_TXT_SEG, cedar_pal);
|
||||
} else if (effect->arg1 == 3) {
|
||||
gSPSegment(NEXT_POLY_XLU_DISP, ANIME_1_TXT_SEG, golden_pal);
|
||||
} else {
|
||||
gSPSegment(NEXT_POLY_XLU_DISP, ANIME_1_TXT_SEG, palm_pal);
|
||||
}
|
||||
|
||||
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 255, 255, 255, 255, alpha);
|
||||
gDPSetTextureAdjustMode(NEXT_POLY_XLU_DISP, G_TA_DOLPHIN);
|
||||
|
||||
if (effect->arg1 == 1) {
|
||||
if (effect->effect_specific[0] == 3) {
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, &ef_w_young_palm_modelT);
|
||||
} else {
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, &ef_s_young_palm_modelT);
|
||||
}
|
||||
} else if (effect->arg1 == 2) {
|
||||
if (effect->effect_specific[0] == 3) {
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, &ef_w_young_cedar_modelT);
|
||||
} else{
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, &ef_s_young_cedar_modelT);
|
||||
}
|
||||
} else if (effect->effect_specific[0] == 3) {
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, &ef_w_youngtree_00_modelT);
|
||||
} else if (Common_Get(time).term_idx == mTM_TERM_4) {
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, &ef_f_youngtree_00_modelT);
|
||||
} else {
|
||||
gSPDisplayList(NEXT_POLY_XLU_DISP, &ef_s_youngtree_00_modelT);
|
||||
}
|
||||
|
||||
gDPSetTextureAdjustMode(NEXT_POLY_XLU_DISP, G_TA_N64);
|
||||
CLOSE_DISP(graph);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user