Implement & link ef_coin

This commit is contained in:
Cuyler36
2024-03-12 04:29:39 -04:00
parent 264ea7b406
commit f2e3877c25
4 changed files with 348 additions and 132 deletions
+131 -124
View File
@@ -181,10 +181,6 @@ config/rel.yml:
obj_e_koinobori_b_pal:
addrs: [0x806C5920, 0x806C5940]
type: pal16
# ac_mural
obj_mural_v:
addrs: [0x80904600, 0x80904640]
type: vtx
# ac_lotus
aLOT_obj_01_lotus_pal:
addrs: [0x806C59E0, 0x806C5A00]
@@ -213,6 +209,133 @@ config/rel.yml:
obj_09_lotus_pal:
addrs: [0x806C5AE0, 0x806C5B00]
type: pal16
# ef_coin.o
ef_coin_gold_pal:
addrs: [0x806D20E0, 0x806D2100]
type: pal16
ef_coin_silver_pal:
addrs: [0x806D2100, 0x806D2120]
type: pal16
# f_furniture.o
int_nog_kamakura_off_pal:
addrs: [0x806D79C0, 0x806D79E0]
type: pal16
int_nog_kamakura_on_pal:
addrs: [0x806D79E0, 0x806D7A00]
type: pal16
int_nog_kouban_on_pal:
addrs: [0x806D7B80, 0x806D7BA0]
type: pal16
int_nog_kouban_off_pal:
addrs: [0x806D7BA0, 0x806D7BC0]
type: pal16
int_nog_museum_off_pal:
addrs: [0x806D7D80, 0x806D7DA0]
type: pal16
int_nog_museum_on_pal:
addrs: [0x806D7DA0, 0x806D7DC0]
type: pal16
int_nog_station1_a_pal:
addrs: [0x806D8200, 0x806D8220]
type: pal16
int_nog_station1_b_pal:
addrs: [0x806D8220, 0x806D8240]
type: pal16
int_nog_station1_c_pal:
addrs: [0x806D8240, 0x806D8260]
type: pal16
int_nog_station1_d_pal:
addrs: [0x806D8260, 0x806D8280]
type: pal16
int_nog_station1_e_pal:
addrs: [0x806D8280, 0x806D82A0]
type: pal16
int_nog_station2_a_pal:
addrs: [0x806D82A0, 0x806D82C0]
type: pal16
int_nog_station2_b_pal:
addrs: [0x806D82C0, 0x806D82E0]
type: pal16
int_nog_station2_c_pal:
addrs: [0x806D82E0, 0x806D8300]
type: pal16
int_nog_station2_d_pal:
addrs: [0x806D8300, 0x806D8320]
type: pal16
int_nog_station2_e_pal:
addrs: [0x806D8320, 0x806D8340]
type: pal16
int_nog_station3_a_pal:
addrs: [0x806D8340, 0x806D8360]
type: pal16
int_nog_station3_b_pal:
addrs: [0x806D8360, 0x806D8380]
type: pal16
int_nog_station3_c_pal:
addrs: [0x806D8380, 0x806D83A0]
type: pal16
int_nog_station3_d_pal:
addrs: [0x806D83A0, 0x806D83C0]
type: pal16
int_nog_station3_e_pal:
addrs: [0x806D83C0, 0x806D83E0]
type: pal16
int_nog_shop1_on_pal:
addrs: [0x806D8560, 0x806D8580]
type: pal16
int_nog_shop1_off_pal:
addrs: [0x806D8580, 0x806D85A0]
type: pal16
int_nog_uranai_off_pal:
addrs: [0x806D8900, 0x806D8920]
type: pal16
int_nog_uranai_on_pal:
addrs: [0x806D8920, 0x806D8940]
type: pal16
int_nog_yamishop_off_pal:
addrs: [0x806D89A0, 0x806D89C0]
type: pal16
int_nog_yamishop_on_pal:
addrs: [0x806D89C0, 0x806D89E0]
type: pal16
int_nog_yubin_on_pal:
addrs: [0x806D8A40, 0x806D8A60]
type: pal16
int_nog_yubin_off_pal:
addrs: [0x806D8A60, 0x806D8A80]
type: pal16
int_tak_tailor_on_pal:
addrs: [0x806DE200, 0x806DE220]
type: pal16
int_tak_tailor_off_pal:
addrs: [0x806DE220, 0x806DE240]
type: pal16
radio_pal:
addrs: [0x806DE600, 0x806DE620]
type: pal16
int_yaz_fish_trophy_pal:
addrs: [0x806DF4C0, 0x806DF4E0]
type: pal16
int_tak_tent_on_pal:
addrs: [0x806DFB40, 0x806DFB60]
type: pal16
int_tak_tent_off_pal:
addrs: [0x806DFB60, 0x806DFB80]
type: pal16
int_yaz_fish_trophy2_pal:
addrs: [0x806DFC40, 0x806DFC60]
type: pal16
int_nog_flower_a_pal:
addrs: [0x806E0080, 0x806E00A0]
type: pal16
int_nog_flower_b_pal:
addrs: [0x806E00A0, 0x806E00C0]
type: pal16
int_nog_flower_c_pal:
addrs: [0x806E00C0, 0x806E00E0]
type: pal16
# dataobj.obj item names
itemName_paper:
addrs: [0x808BF660, 0x808C0660]
itemName_money:
@@ -249,6 +372,10 @@ config/rel.yml:
addrs: [0x808C3910, 0x808C7910]
ftrName2_table:
addrs: [0x808C7910, 0x808C8830]
# ac_mural.o
obj_mural_v:
addrs: [0x80904600, 0x80904640]
type: vtx
mFM_beach_pal_0:
addrs: [0x80C59CA8, 0x80C59CC8]
type: pal16
@@ -434,123 +561,3 @@ config/rel.yml:
type: pal16
# ac_koinobori
int_nog_kamakura_off_pal:
addrs: [0x806D79C0, 0x806D79E0]
type: pal16
int_nog_kamakura_on_pal:
addrs: [0x806D79E0, 0x806D7A00]
type: pal16
int_nog_kouban_on_pal:
addrs: [0x806D7B80,0x806D7BA0]
type: pal16
int_nog_kouban_off_pal:
addrs: [0x806D7BA0,0x806D7BC0]
type: pal16
int_nog_museum_off_pal:
addrs: [0x806D7D80,0x806D7DA0]
type: pal16
int_nog_museum_on_pal:
addrs: [0x806D7DA0,0x806D7DC0]
type: pal16
int_nog_station1_a_pal:
addrs: [0x806D8200,0x806D8220]
type: pal16
int_nog_station1_b_pal:
addrs: [0x806D8220,0x806D8240]
type: pal16
int_nog_station1_c_pal:
addrs: [0x806D8240,0x806D8260]
type: pal16
int_nog_station1_d_pal:
addrs: [0x806D8260,0x806D8280]
type: pal16
int_nog_station1_e_pal:
addrs: [0x806D8280,0x806D82A0]
type: pal16
int_nog_station2_a_pal:
addrs: [0x806D82A0,0x806D82C0]
type: pal16
int_nog_station2_b_pal:
addrs: [0x806D82C0,0x806D82E0]
type: pal16
int_nog_station2_c_pal:
addrs: [0x806D82E0,0x806D8300]
type: pal16
int_nog_station2_d_pal:
addrs: [0x806D8300,0x806D8320]
type: pal16
int_nog_station2_e_pal:
addrs: [0x806D8320,0x806D8340]
type: pal16
int_nog_station3_a_pal:
addrs: [0x806D8340,0x806D8360]
type: pal16
int_nog_station3_b_pal:
addrs: [0x806D8360,0x806D8380]
type: pal16
int_nog_station3_c_pal:
addrs: [0x806D8380,0x806D83A0]
type: pal16
int_nog_station3_d_pal:
addrs: [0x806D83A0,0x806D83C0]
type: pal16
int_nog_station3_e_pal:
addrs: [0x806D83C0,0x806D83E0]
type: pal16
int_nog_shop1_on_pal:
addrs: [0x806D8560,0x806D8580]
type: pal16
int_nog_shop1_off_pal:
addrs: [0x806D8580,0x806D85A0]
type: pal16
int_nog_uranai_off_pal:
addrs: [0x806D8900,0x806D8920]
type: pal16
int_nog_uranai_on_pal:
addrs: [0x806D8920,0x806D8940]
type: pal16
int_nog_yamishop_off_pal:
addrs: [0x806D89A0,0x806D89C0]
type: pal16
int_nog_yamishop_on_pal:
addrs: [0x806D89C0,0x806D89E0]
type: pal16
int_nog_yubin_on_pal:
addrs: [0x806D8A40,0x806D8A60]
type: pal16
int_nog_yubin_off_pal:
addrs: [0x806D8A60,0x806D8A80]
type: pal16
int_tak_tailor_on_pal:
addrs: [0x806DE200, 0x806DE220]
type: pal16
int_tak_tailor_off_pal:
addrs: [0x806DE220, 0x806DE240]
type: pal16
radio_pal:
addrs: [0x806DE600, 0x806DE620]
type: pal16
int_yaz_fish_trophy_pal:
addrs: [0x806DF4C0,0x806DF4E0]
type: pal16
int_tak_tent_on_pal:
addrs: [0x806DFB40, 0x806DFB60]
type: pal16
int_tak_tent_off_pal:
addrs: [0x806DFB60, 0x806DFB80]
type: pal16
int_yaz_fish_trophy2_pal:
addrs: [0x806DFC40,0x806DFC60]
type: pal16
int_nog_flower_a_pal:
addrs: [0x806E0080,0x806E00A0]
type: pal16
int_nog_flower_b_pal:
addrs: [0x806E00A0,0x806E00C0]
type: pal16
int_nog_flower_c_pal:
addrs: [0x806E00C0,0x806E00E0]
type: pal16
#f_furniture
# dataobj.obj item names
+4
View File
@@ -891,6 +891,10 @@ ac_weather_leaf.c:
.text: [0x8060420C, 0x806048B8]
.rodata: [0x8064BBE8, 0x8064BC40]
.data: [0x806D1E28, 0x806D1E48]
ef_coin.c:
.text: [0x80608060, 0x806087EC]
.rodata: [0x8064BE48, 0x8064BEA0]
.data: [0x806D20C0, 0x806D2128]
ef_flash.c:
.text: [0x8060B7B4, 0x8060BCB0]
.rodata: [0x8064C078, 0x8064C0B0]
+158 -4
View File
@@ -1,5 +1,9 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
#include "m_rcp.h"
#include "sys_matrix.h"
static void eCoin_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eCoin_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eCoin_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +22,167 @@ eEC_PROFILE_c iam_ef_coin = {
};
static void eCoin_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_COIN, pos, NULL, game, NULL, item_name, prio, arg0, arg1);
}
static f32 eCoin_GetFountainHeight(void) {
int bx;
int bz;
if (mFI_BlockKind2BkNum(&bx, &bz, mRF_BLOCKKIND_SHRINE)) {
return 40.0f + mFI_BkNum2BaseHeight(bx, bz);
} else {
return 150.0f;
}
}
static void eCoin_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
s16 rng = RANDOM(10) & 1;
f32 dir;
s16 angle;
if (rng == 1) {
dir = RANDOM_F(768.0f);
} else {
dir = -fqrand() * 1024.0f;
}
angle = (int)dir + DEG2SHORT_ANGLE(192.65625f);
effect->position.x += 9.0f;
effect->position.y += 11.0f;
effect->position.z -= 15.0f;
effect->timer = 100;
effect->effect_specific[0] = FALSE;
effect->effect_specific[1] = RANDOM_F(65535);
effect->effect_specific[2] = RANDOM_F(65535);
effect->effect_specific[3] = RANDOM_F(65535);
effect->effect_specific[4] = 0;
effect->velocity.x = sin_s(angle) * 0.77f;
effect->velocity.y = 5.5f;
effect->velocity.z = cos_s(angle) * 0.77f;
effect->acceleration.x = 0.0f;
effect->acceleration.y = -0.2f;
effect->acceleration.z = 0.0f;
effect->offset.x = 14.0f + eCoin_GetFountainHeight() - 3.0f;
effect->offset.y = effect->offset.x - 4.5f;
sAdo_OngenTrgStart(0x466, &effect->position);
effect->effect_specific[5] = RANDOM(100) & 1; // 0 = gold coin, 1 = silver coin
}
static void eCoin_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
xyz_t_add(&effect->velocity, &effect->acceleration, &effect->velocity);
xyz_t_add(&effect->position, &effect->velocity, &effect->position);
if (effect->effect_specific[0] == FALSE) {
eEC_CLIP->set_continious_env_proc(effect, 100, 100);
effect->effect_specific[1] += DEG2SHORT_ANGLE(21.093750f);
effect->effect_specific[2] += DEG2SHORT_ANGLE(18.281250f);
effect->effect_specific[3] += DEG2SHORT_ANGLE(19.687500f);
if (effect->position.y <= effect->offset.x) {
xyz_t pos = effect->position;
pos.y = effect->offset.x;
effect->position.y = effect->offset.x;
sAdo_OngenTrgStart(0x467, &effect->position);
effect->effect_specific[0] = TRUE;
eEC_CLIP->effect_make_proc(eEC_EFFECT_TURI_MIZU, pos, effect->prio, 0, game, (u16)effect->item_name, 0, 0);
effect->effect_specific[1] = 0;
effect->effect_specific[2] = 0;
effect->effect_specific[3] = 0;
effect->acceleration.x = 0.0f;
effect->acceleration.y = 0.0f;
effect->acceleration.z = 0.0f;
effect->velocity.x = 0.0f;
effect->velocity.y = -0.14f;
effect->velocity.z = 0.0f;
effect->timer = 300;
}
} else if (effect->position.y <= effect->offset.y) {
effect->position.y = effect->offset.y;
effect->velocity.x = 0.0f;
effect->velocity.y = 0.0f;
effect->velocity.z = 0.0f;
effect->effect_specific[1] = 0;
effect->effect_specific[2] = 0;
effect->effect_specific[3] = 0;
} else {
effect->effect_specific[4] += DEG2SHORT_ANGLE(7.031250f);
effect->effect_specific[1] = sin_s(effect->effect_specific[4]) * 2048.0f;
effect->effect_specific[3] = cos_s(effect->effect_specific[4]) * 2048.0f;
effect->effect_specific[2] = 0;
}
}
static u16 ef_coin_gold_pal[16] ATTRIBUTE_ALIGN(32) = {
#include "assets/ef_coin_gold_pal.inc"
};
static u16 ef_coin_silver_pal[16] ATTRIBUTE_ALIGN(32) = {
#include "assets/ef_coin_silver_pal.inc"
};
static u16* eCoin_pal_table[2] = { ef_coin_gold_pal, ef_coin_silver_pal };
extern Gfx ef_coin_model[];
extern Gfx ef_coin_modelT[];
static void eCoin_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
GAME_PLAY* play = (GAME_PLAY*)game;
if (effect->effect_specific[0] == FALSE) {
_texture_z_light_fog_prim(game->graph);
Setpos_HiliteReflect_init(&effect->position, play);
OPEN_DISP(game->graph);
Matrix_translate(effect->position.x, effect->position.y, effect->position.z, 0);
Matrix_RotateX(effect->effect_specific[1], 1);
Matrix_RotateY(effect->effect_specific[2], 1);
Matrix_RotateZ(effect->effect_specific[3], 1);
Matrix_scale(0.01f, 0.01f, 0.01f, 1);
gSPSegment(NEXT_POLY_OPA_DISP, G_MWO_SEGMENT_8, eCoin_pal_table[effect->effect_specific[5] & 1]);
gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(NEXT_POLY_OPA_DISP, ef_coin_model);
CLOSE_DISP(game->graph);
} else {
u8 alpha = (int)eEC_CLIP->calc_adjust_proc(300 - effect->timer, 0, 300, 180.0f, 0.0f);
_texture_z_light_fog_prim_xlu(game->graph);
Setpos_HiliteReflect_xlu_init(&effect->position, play);
OPEN_DISP(game->graph);
Matrix_translate(effect->position.x, effect->position.y, effect->position.z, 0);
Matrix_RotateX(effect->effect_specific[1], 1);
Matrix_RotateY(effect->effect_specific[2], 1);
Matrix_RotateZ(effect->effect_specific[3], 1);
Matrix_scale(0.01f, 0.01f, 0.01f, 1);
gDPSetPrimColor(NEXT_POLY_XLU_DISP, 0, 128, 255, 255, 255, alpha);
gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_8, eCoin_pal_table[effect->effect_specific[5] & 1]);
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(NEXT_POLY_XLU_DISP, ef_coin_modelT);
CLOSE_DISP(game->graph);
}
}
+55 -4
View File
@@ -1,5 +1,9 @@
#include "ef_effect_control.h"
#include "m_common_data.h"
#include "sys_matrix.h"
#include "m_rcp.h"
static void eTL_init(xyz_t pos, int prio, s16 angle, GAME* game, u16 item_name, s16 arg0, s16 arg1);
static void eTL_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg);
static void eTL_mv(eEC_Effect_c* effect, GAME* game);
@@ -18,17 +22,64 @@ eEC_PROFILE_c iam_ef_tent_lamp = {
};
static void eTL_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_TENT_LAMP, pos, NULL, game, NULL, item_name, prio, arg0, arg1);
}
static s16 eTL_GetNiceSwitchStat() {
if (Common_Get(time.now_sec) >= (5 * mTM_SECONDS_IN_HOUR) &&
Common_Get(time.now_sec) < (18 * mTM_SECONDS_IN_HOUR)) {
return FALSE;
}
return TRUE;
}
static void eTL_ct(eEC_Effect_c* effect, GAME* game, void* ct_arg) {
// TODO
GAME_PLAY* play = (GAME_PLAY*)game;
effect->timer = 100;
if (eTL_GetNiceSwitchStat() == TRUE) {
mEnv_RequestChangeLightON(play, mRmTp_LIGHT_SWITCH_HOUSE0_BASEMENT, FALSE);
effect->offset.x = 1.0f;
} else {
mEnv_RequestChangeLightOFF(play, mRmTp_LIGHT_SWITCH_HOUSE0_BASEMENT, 0.5f);
effect->offset.x = 0.0f;
}
}
static void eTL_mv(eEC_Effect_c* effect, GAME* game) {
// TODO
GAME_PLAY* play = (GAME_PLAY*)game;
f32 target;
int nice_switch_state = eTL_GetNiceSwitchStat();
(*eEC_CLIP->set_continious_env_proc)(effect, 100, 100);
if (nice_switch_state == TRUE) {
mEnv_RequestChangeLightON(play, mRmTp_LIGHT_SWITCH_HOUSE0_BASEMENT, FALSE);
target = 1.0f;
} else {
mEnv_RequestChangeLightOFF(play, mRmTp_LIGHT_SWITCH_HOUSE0_BASEMENT, 0.01f);
target = 0.0f;
}
add_calc(&effect->offset.x, target, 0.015f, 0.1f, 0.001f);
}
extern Gfx obj_tent_lamp_model[];
static void eTL_dw(eEC_Effect_c* effect, GAME* game) {
// TODO
int l = (int)(255.0f + effect->offset.x * -255.0f);
_texture_z_light_fog_prim(game->graph);
OPEN_DISP(game->graph);
Matrix_translate(0.0f, 0.0f, 0.0f, 0);
Matrix_scale(0.05f, 0.05f, 0.05f, 1);
gDPSetPrimColor(NEXT_POLY_OPA_DISP, 0, l, 255, 255, 255, 255);
gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(NEXT_POLY_OPA_DISP, obj_tent_lamp_model);
CLOSE_DISP(game->graph);
}