Finish & link ac_my_room

This commit is contained in:
Cuyler36
2024-04-14 15:34:40 -04:00
parent cee5936d37
commit 39fe30e0d7
20 changed files with 2472 additions and 466 deletions
+72 -8
View File
@@ -17,6 +17,7 @@
#include "m_debug.h"
#include "m_mark_room.h"
#include "sys_matrix.h"
#include "m_rcp.h"
enum {
aMR_ICON_LEAF,
@@ -110,6 +111,27 @@ enum {
aMR_MSG_STATE_NUM
};
static void My_Room_Actor_ct(ACTOR*, GAME*);
static void My_Room_Actor_dt(ACTOR*, GAME*);
static void My_Room_Actor_move(ACTOR*, GAME*);
static void My_Room_Actor_draw(ACTOR*, GAME*);
// clang-format off
ACTOR_PROFILE My_Room_Profile = {
mAc_PROFILE_MY_ROOM,
ACTOR_PART_BG,
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
ETC_MY_ROOM,
ACTOR_OBJ_BANK_KEEP,
sizeof(MY_ROOM_ACTOR),
&My_Room_Actor_ct,
&My_Room_Actor_dt,
&My_Room_Actor_move,
&My_Room_Actor_draw,
NULL
};
// clang-format on
#include "../src/ac_furniture_data.c_inc"
#include "../src/ac_my_room_data.c_inc"
@@ -146,10 +168,48 @@ static int aMR_SetFurniture2FG(FTR_ACTOR* ftr_actor, xyz_t pos, int on_flag);
static int aMR_FtrIdx2ChangeFtrSwitch(ACTOR* actorx, int ftr_id);
static aFTR_PROFILE* aMR_GetFurnitureProfile(u16 ftr_no);
static mActor_name_t* aMR_GetLayerTopFg(s16 layer);
#include "../src/ac_my_room_msg_ctrl.c_inc"
#include "../src/ac_my_room_goki.c_inc"
#include "../src/ac_my_room_melody.c_inc"
static void aMR_TidyItemInFurniture(FTR_ACTOR* ftr_actor);
static int aMR_GetItemCountInFurniture(FTR_ACTOR* ftr_actor);
static int aMR_ItemPutInFurniture(FTR_ACTOR* ftr_actor, mActor_name_t item);
static void aMR_AllMDSwitchOff(void);
static void aMR_OneMDSwitchOn_TheOtherSwitchOff(FTR_ACTOR* ftr_actor);
static void aMR_ReserveBgm(ACTOR* actorx, int bgm_no, FTR_ACTOR* ftr_actor, s16 timer);
static void aMR_SetMDFtrDemoData(MY_ROOM_ACTOR* my_room, FTR_ACTOR* ftr_actor, aMR_contact_info_c* contact_info);
static int aMR_CheckHikidashi(FTR_ACTOR* ftr_actor, PLAYER_ACTOR* player, aMR_contact_info_c* contact_info);
static int aMR_JudgeDemoStart(MY_ROOM_ACTOR* my_room, aMR_contact_info_c* contact_info, GAME* game,
PLAYER_ACTOR* player);
static void aMR_PlacePushFurniture(MY_ROOM_ACTOR* my_room, aMR_contact_info_c* contact_info, f32* point,
PLAYER_ACTOR* player, GAME* game);
static void aMR_PlacePullFurniture(MY_ROOM_ACTOR* my_room, aMR_contact_info_c* contact_info, PLAYER_ACTOR* player,
GAME* game);
static void aMR_PlaceKurukuruFurniture(MY_ROOM_ACTOR* my_room, aMR_contact_info_c* contact_info, PLAYER_ACTOR* player,
GAME* game);
static void aMR_SitDownFurniture(MY_ROOM_ACTOR* my_room, aMR_contact_info_c* contact_info, PLAYER_ACTOR* player,
GAME* game);
static void aMR_JudgeGoToBed(MY_ROOM_ACTOR* my_room, aMR_contact_info_c* contact_info, PLAYER_ACTOR* player,
GAME* game);
static void aMR_SetMelodyData(u8* melody_data);
static void aMR_GokiInfoCt(ACTOR* actorx, GAME* game);
static void aMR_GokiInfoDt(void);
static void aMR_CheckFtrAndGoki(ACTOR* actorx, FTR_ACTOR* ftr_actor, GAME* game);
static void aMR_MakeGokiburi(xyz_t* pos, GAME* game, s16 arg);
static void aMR_RequestPlayerBikkuri(ACTOR* actorx, GAME* game);
static void aMR_GetFtrShape4Position(xyz_t* p0, xyz_t* p1, xyz_t* p2, xyz_t* p3, FTR_ACTOR* ftr_actor);
static u8 aMR_JudgeStickFull(int direct, GAME* game);
static int aMR_JudgeFurnitureMove(u8 type, int ut);
static int aMR_RequestItemToFitFurniture(ACTOR* actorx, FTR_ACTOR* ftr_actor);
static void aMR_SetPullMoveAnime(FTR_ACTOR* ftr_actor, GAME* game, MY_ROOM_ACTOR* my_room,
aMR_contact_info_c* contact_info);
static int aMR_PullDirect2PushDirect(int pull_direct);
static void aMR_SetPushMoveAnime(FTR_ACTOR* ftr_actor, GAME* game, MY_ROOM_ACTOR* my_room,
aMR_contact_info_c* contact_info);
static void aMR_MoveShapeCenter(FTR_ACTOR* ftr_actor);
static void aMR_RotateY(f32* xz, f32 amount);
static int aMR_3DStickNuetral(void);
static void aMR_SetNicePos(xyz_t* nice_pos, xyz_t player_pos, f32* col_start_xz, f32* col_end_xz,
aMR_contact_info_c* contact_info, int type);
static int aMR_GetPlayerDirect(const f32* normal_xz);
static int aMR_Get3dDirectStatus(int direct);
static aFTR_PROFILE* aMR_GetFurnitureProfile(u16 ftr_no) {
if (ftr_no < FTR_NUM) {
@@ -237,7 +297,7 @@ static int aMR_ItemNo2IconNo(mActor_name_t item_no) {
return aMR_ICON_LEAF;
}
static Gfx* aMR_IconNo2Gfx1(int icon_no) {
extern Gfx* aMR_IconNo2Gfx1(int icon_no) {
aMR_icon_display_data_c* icon;
if (icon_no < 0) {
@@ -249,7 +309,7 @@ static Gfx* aMR_IconNo2Gfx1(int icon_no) {
return aMR_icon_display_data[icon_no].mat_gfx;
}
static Gfx* aMR_IconNo2Gfx2(int icon_no) {
extern Gfx* aMR_IconNo2Gfx2(int icon_no) {
if (icon_no < 0) {
icon_no = 0;
} else if (icon_no >= aMR_ICON_NUM) {
@@ -1402,6 +1462,8 @@ static int aMR_GetSceneFurnitureMax(void) {
return 3;
}
#include "../src/ac_my_room_msg_ctrl.c_inc"
static void aMR_SecureFurnitureRam(ACTOR* actorx) {
l_aMR_work.ftr_actor_list = (FTR_ACTOR*)zelda_malloc(l_aMR_work.list_size * sizeof(FTR_ACTOR));
l_aMR_work.used_list = (u8*)zelda_malloc(l_aMR_work.list_size * sizeof(u8));
@@ -1719,8 +1781,6 @@ static void aMR_SetMDIslandNPC(void) {
}
}
static void aMR_GokiInfoCt(ACTOR* actorx, GAME* game);
static void My_Room_Actor_ct(ACTOR* actorx, GAME* game) {
MY_ROOM_ACTOR* my_room = (MY_ROOM_ACTOR*)actorx;
GAME_PLAY* play = (GAME_PLAY*)game;
@@ -1878,6 +1938,8 @@ static int aMR_PickupFtrLayer(void) {
return mCoBG_LAYER0;
}
#include "../src/ac_my_room_goki.c_inc"
static void aMR_LeafStartPos(xyz_t* pos) {
static xyz_t leaf_start0 = { 0.0f, 0.0f, 0.0f };
@@ -1958,7 +2020,9 @@ static void My_Room_Actor_dt(ACTOR* actorx, GAME* game) {
}
}
#include "../src/ac_my_room_melody.c_inc"
#include "../src/ac_my_room_move.c_inc"
#include "../src/ac_my_room_draw.c_inc"
static void aMR_RedmaFtrBank(void) {
int i;
File diff suppressed because it is too large Load Diff
+160 -22
View File
@@ -22,32 +22,170 @@ typedef struct {
xyz_t offset;
} aMR_type_target_c;
static aMR_type_target_c type_target_table[] = {
{ 2, { 0.0f, 0.0f, -40.0f } }, { 2, { 0.0f, 0.0f, -40.0f } }, { 2, { 0.0f, 0.0f, -40.0f } },
{ 0, { 0.0f, 0.0f, 0.0f } }, { 0, { 0.0f, 0.0f, 0.0f } }, { 0, { 0.0f, 0.0f, 0.0f } },
{ 0, { 0.0f, 0.0f, 0.0f } }, { 2, { 0.0f, 0.0f, -40.0f } }, { 1, { 0.0f, 0.0f, 0.0f } },
{ 3, { -40.0f, 0.0f, 0.0f } }, { 3, { -40.0f, 0.0f, 0.0f } }, { 3, { -40.0f, 0.0f, 0.0f } },
{ 3, { -40.0f, 0.0f, 0.0f } }, { 1, { 0.0f, 0.0f, 0.0f } }, { 1, { 0.0f, 0.0f, 0.0f } },
{ 1, { 0.0f, 0.0f, 0.0f } }, { 2, { 0.0f, 0.0f, 0.0f } }, { 2, { 0.0f, 0.0f, 0.0f } },
{ 2, { 0.0f, 0.0f, 0.0f } }, { 0, { 0.0f, 0.0f, 40.0f } }, { 0, { 0.0f, 0.0f, 40.0f } },
{ 0, { 0.0f, 0.0f, 40.0f } }, { 0, { 0.0f, 0.0f, 40.0f } }, { 2, { 0.0f, 0.0f, 0.0f } },
{ 1, { 40.0f, 0.0f, 0.0f } }, { 3, { 0.0f, 0.0f, 0.0f } }, { 3, { 0.0f, 0.0f, 0.0f } },
{ 3, { 0.0f, 0.0f, 0.0f } }, { 3, { 0.0f, 0.0f, 0.0f } }, { 1, { 40.0f, 0.0f, 0.0f } },
{ 1, { 40.0f, 0.0f, 0.0f } }, { 1, { 40.0f, 0.0f, 0.0f } },
static aMR_type_target_c type_target_table[4][4][2] = {
{
{
{ aFTR_SHAPE_TYPEB_270, { 0.0f, 0.0f, -40.0f } },
{ aFTR_SHAPE_TYPEB_270, { 0.0f, 0.0f, -40.0f } },
},
{
{ aFTR_SHAPE_TYPEB_270, { 0.0f, 0.0f, -40.0f } },
{ aFTR_SHAPE_TYPEB_90, { 0.0f, 0.0f, 0.0f } },
},
{
{ aFTR_SHAPE_TYPEB_90, { 0.0f, 0.0f, 0.0f } },
{ aFTR_SHAPE_TYPEB_90, { 0.0f, 0.0f, 0.0f } },
},
{
{ aFTR_SHAPE_TYPEB_90, { 0.0f, 0.0f, 0.0f } },
{ aFTR_SHAPE_TYPEB_270, { 0.0f, 0.0f, -40.0f } },
},
},
{
{
{ aFTR_SHAPE_TYPEB_180, { 0.0f, 0.0f, 0.0f } },
{ aFTR_SHAPE_TYPEB_0, { -40.0f, 0.0f, 0.0f } },
},
{
{ aFTR_SHAPE_TYPEB_0, { -40.0f, 0.0f, 0.0f } },
{ aFTR_SHAPE_TYPEB_0, { -40.0f, 0.0f, 0.0f } },
},
{
{ aFTR_SHAPE_TYPEB_0, { -40.0f, 0.0f, 0.0f } },
{ aFTR_SHAPE_TYPEB_180, { 0.0f, 0.0f, 0.0f } },
},
{
{ aFTR_SHAPE_TYPEB_180, { 0.0f, 0.0f, 0.0f } },
{ aFTR_SHAPE_TYPEB_180, { 0.0f, 0.0f, 0.0f } },
},
},
{
{
{ aFTR_SHAPE_TYPEB_270, { 0.0f, 0.0f, 0.0f } },
{ aFTR_SHAPE_TYPEB_270, { 0.0f, 0.0f, 0.0f } },
},
{
{ aFTR_SHAPE_TYPEB_270, { 0.0f, 0.0f, 0.0f } },
{ aFTR_SHAPE_TYPEB_90, { 0.0f, 0.0f, 40.0f } },
},
{
{ aFTR_SHAPE_TYPEB_90, { 0.0f, 0.0f, 40.0f } },
{ aFTR_SHAPE_TYPEB_90, { 0.0f, 0.0f, 40.0f } },
},
{
{ aFTR_SHAPE_TYPEB_90, { 0.0f, 0.0f, 40.0f } },
{ aFTR_SHAPE_TYPEB_270, { 0.0f, 0.0f, 0.0f } },
},
},
{
{
{ aFTR_SHAPE_TYPEB_180, { 40.0f, 0.0f, 0.0f } },
{ aFTR_SHAPE_TYPEB_0, { 0.0f, 0.0f, 0.0f } },
},
{
{ aFTR_SHAPE_TYPEB_0, { 0.0f, 0.0f, 0.0f } },
{ aFTR_SHAPE_TYPEB_0, { 0.0f, 0.0f, 0.0f } },
},
{
{ aFTR_SHAPE_TYPEB_0, { 0.0f, 0.0f, 0.0f } },
{ aFTR_SHAPE_TYPEB_180, { 40.0f, 0.0f, 0.0f } },
},
{
{ aFTR_SHAPE_TYPEB_180, { 40.0f, 0.0f, 0.0f } },
{ aFTR_SHAPE_TYPEB_180, { 40.0f, 0.0f, 0.0f } },
},
},
};
static s16 rotate_forbid_table[][2] = {
{ -1, 0 }, { -1, -1 }, { 0, 0 }, { 1, 0 }, { -1, 1 }, { 0, 0 }, { -1, 0 }, { 1, 0 },
{ 0, 1 }, { -1, 0 }, { -1, 0 }, { 0, -1 }, { 1, 0 }, { 0, 1 }, { 0, 1 }, { -1, 0 },
{ 0, -1 }, { 0, 1 }, { 0, 0 }, { -1, 1 }, { 0, -1 }, { 0, 0 }, { 1, 1 }, { 0, 1 },
typedef struct rotate_forbid_data_s {
s_xyz left[2];
s_xyz right[2];
} aMR_rotate_forbid_data_c;
static aMR_rotate_forbid_data_c rotate_forbid_table[4] = {
{
{
{ -1, 0, -1 },
{ -1, 0, 0 },
},
{
{ 1, 0, -1 },
{ 1, 0, 0 },
},
},
{
{
{ -1, 0, 1 },
{ 0, 0, 1 },
},
{
{ -1, 0, -1 },
{ 0, 0, -1 },
},
},
{
{
{ 1, 0, 0 },
{ 1, 0, 1 },
},
{
{ -1, 0, 0 },
{ -1, 0, 1 },
},
},
{
{
{ 0, 0, -1 },
{ 1, 0, -1 },
},
{
{ 0, 0, 1 },
{ 1, 0, 1 },
},
},
};
static s16 rotate_forbid_friction_table[][2] = {
{ 0x0000, 0x0000 }, { 0x0001, 0x0001 }, { 0x0000, 0x0000 }, { 0x0000, 0x0000 }, { 0x0001, 0xffff },
{ 0x0000, 0x0000 }, { 0x0001, 0x0000 }, { 0x0000, 0x0000 }, { 0x0000, 0xffff }, { 0x0001, 0x0000 },
{ 0x0000, 0x0000 }, { 0x0000, 0x0001 }, { 0x0000, 0x0000 }, { 0xffff, 0xffff }, { 0x0000, 0x0000 },
{ 0x0000, 0x0000 }, { 0xffff, 0x0001 }, { 0x0000, 0x0000 }, { 0xffff, 0x0000 }, { 0x0000, 0x0000 },
{ 0x0000, 0x0001 }, { 0xffff, 0x0000 }, { 0x0000, 0x0000 }, { 0x0000, 0xffff },
static aMR_rotate_forbid_data_c rotate_forbid_friction_table[4] = {
{
{
{ 0, 0, 1 },
{ 1, 0, 0 },
},
{
{ 0, 0, 1 },
{ -1, 0, 0 },
},
},
{
{
{ 1, 0, 0 },
{ 0, 0, -1 },
},
{
{ 1, 0, 0 },
{ 0, 0, 1 },
},
},
{
{
{ 0, 0, -1 },
{ -1, 0, 0 },
},
{
{ 0, 0, -1 },
{ 1, 0, 0 },
},
},
{
{
{ -1, 0, 0 },
{ 0, 0, 1 },
},
{
{ -1, 0, 0 },
{ 0, 0, -1 },
},
},
};
typedef struct {
+378
View File
@@ -0,0 +1,378 @@
static void aMR_SetKankyoMapping(FTR_ACTOR* ftr_actor, GAME_PLAY* play) {
aFTR_PROFILE* profile = aMR_GetFurnitureProfile(ftr_actor->name);
switch (profile->kankyo_map) {
case aFTR_KANKYO_MAP_OPA:
Setpos_HiliteReflect_init(&ftr_actor->position, play);
break;
case aFTR_KANKYO_MAP_XLU:
Setpos_HiliteReflect_xlu_init(&ftr_actor->position, play);
break;
}
}
static void aMR_LoadPallet(aFTR_PROFILE* profile, GAME* game) {
if (profile->palette != NULL) {
if (profile->opaque0 != NULL || profile->opaque1 != NULL || profile->rig != NULL) {
OPEN_DISP(game->graph);
gDPPipeSync(NEXT_POLY_OPA_DISP);
gDPLoadTLUT_pal16(NEXT_POLY_OPA_DISP, 15, profile->palette);
CLOSE_DISP(game->graph);
}
if (profile->translucent0 != NULL || profile->translucent1 != NULL || profile->rig != NULL) {
OPEN_DISP(game->graph);
gDPPipeSync(NEXT_POLY_XLU_DISP);
gDPLoadTLUT_pal16(NEXT_POLY_XLU_DISP, 15, profile->palette);
CLOSE_DISP(game->graph);
}
}
}
static void aMR_LoadTexture(aFTR_PROFILE* profile, GAME* game) {
if (profile->texture != NULL) {
if (profile->opaque0 != NULL || profile->opaque1 != NULL || profile->rig != NULL) {
OPEN_DISP(game->graph);
gDPPipeSync(NEXT_POLY_OPA_DISP);
gDPLoadTextureBlockS(NEXT_POLY_OPA_DISP, profile->texture, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0,
G_TX_MIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP, 7, 7, G_TX_NOLOD, G_TX_NOLOD);
CLOSE_DISP(game->graph);
}
if (profile->translucent0 != NULL || profile->translucent1 != NULL || profile->rig != NULL) {
OPEN_DISP(game->graph);
gDPPipeSync(NEXT_POLY_XLU_DISP);
gDPLoadTextureBlockS(NEXT_POLY_XLU_DISP, profile->texture, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0,
G_TX_MIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP, 7, 7, G_TX_NOLOD, G_TX_NOLOD);
CLOSE_DISP(game->graph);
}
}
}
static void aMR_SetLoopTextureAnime(FTR_ACTOR* ftr_actor, aFTR_PROFILE* profile, GAME* game) {
aFTR_tex_anim_c* tex_anime = profile->tex_anim;
if (tex_anime != NULL) {
u8* tex_p = tex_anime->animation[ftr_actor->tex_animation.frame];
OPEN_DISP(game->graph);
gSPSegment(NEXT_POLY_OPA_DISP, G_MWO_SEGMENT_8, tex_p);
gSPSegment(NEXT_POLY_XLU_DISP, G_MWO_SEGMENT_8, tex_p);
CLOSE_DISP(game->graph);
}
}
static void aMR_DrawRegistModel(aFTR_PROFILE* profile, GAME* game) {
OPEN_DISP(game->graph);
if (profile->opaque0 != NULL || profile->opaque1 != NULL) {
gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
if (profile->opaque0 != NULL) {
gSPDisplayList(NEXT_POLY_OPA_DISP, profile->opaque0);
}
if (profile->opaque1 != NULL) {
gSPDisplayList(NEXT_POLY_OPA_DISP, profile->opaque1);
}
if (profile->translucent0 != NULL || profile->translucent1 != NULL) {
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
if (profile->translucent0 != NULL) {
gSPDisplayList(NEXT_POLY_XLU_DISP, profile->translucent0);
}
if (profile->translucent1 != NULL) {
gSPDisplayList(NEXT_POLY_XLU_DISP, profile->translucent1);
}
CLOSE_DISP(game->graph);
}
static void aMR_DrawSkelShape(FTR_ACTOR* ftr_actor, aFTR_PROFILE* profile, GAME* game) {
if (profile->rig != NULL) {
cKF_SkeletonInfo_R_c* keyframe = &ftr_actor->keyframe;
int mtx_idx = game->frame_counter & 1;
Mtx* mtx = ftr_actor->skeleton_mtx[mtx_idx];
OPEN_DISP(game->graph);
gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
CLOSE_DISP(game->graph);
cKF_Si3_draw_R_SV(game, keyframe, mtx, NULL, NULL, NULL);
}
}
static void aMR_DrawUniqueShape(FTR_ACTOR* ftr_actor, ACTOR* actorx, aFTR_PROFILE* profile, GAME* game) {
if (profile->vtable != NULL && profile->vtable->draw_proc != NULL) {
u8* bank = aMR_FtrNo2BankAddress(ftr_actor->name);
OPEN_DISP(game->graph);
gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(NEXT_POLY_XLU_DISP, _Matrix_to_Mtx_new(game->graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
CLOSE_DISP(game->graph);
profile->vtable->draw_proc(ftr_actor, actorx, game, bank);
}
}
static void aMR_DrawItemOnMovingFurniture(ACTOR* actorx, FTR_ACTOR* ftr_actor, GAME* game) {
MY_ROOM_ACTOR* my_room = (MY_ROOM_ACTOR*)actorx;
aMR_parent_ftr_c* parent_ftr = &my_room->parent_ftr;
if (parent_ftr->ftrID == ftr_actor->id) {
int i;
OPEN_DISP(game->graph);
gDPSetTexEdgeAlpha(NEXT_POLY_OPA_DISP, 144);
gDPSetTexEdgeAlpha(NEXT_POLY_XLU_DISP, 144);
for (i = 0; i < aMR_FIT_FTR_MAX; i++) {
if (parent_ftr->fit_ftr_table[i].exist_flag == TRUE) {
mActor_name_t item_no = parent_ftr->fit_ftr_table[i].item_no;
xyz_t* pos = &parent_ftr->fit_ftr_table[i].ut_pos;
if (Common_Get(clip).shop_goods_clip != NULL &&
Common_Get(clip).shop_goods_clip->single_draw_proc != NULL) {
Common_Get(clip).shop_goods_clip->single_draw_proc(game, item_no, pos, 0.01f,
parent_ftr->fit_ftr_table[i].angle_y +
(ftr_actor->s_angle_y - parent_ftr->angle_y),
mCoBG_LAYER1);
}
}
}
CLOSE_DISP(game->graph);
}
}
static int aMR_GetFitNo(ACTOR* actorx, FTR_ACTOR* ftr_actor) {
MY_ROOM_ACTOR* my_room = (MY_ROOM_ACTOR*)actorx;
aMR_parent_ftr_c* parent_ftr = &my_room->parent_ftr;
int i;
for (i = 0; i < aMR_FIT_FTR_MAX; i++) {
if (parent_ftr->fit_ftr_table[i].ftr_ID == ftr_actor->id) {
return i;
}
}
return -1;
}
static void aMR_FurnitureLightSet(FTR_ACTOR* ftr_actor, GAME_PLAY* play) {
LightsN* lights;
xyz_t center;
aMR_GetFtrShapeCenter(&center, ftr_actor);
lights = Global_light_read(&play->global_light, play->game.graph);
LightsN_list_check(lights, play->global_light.list, &center);
LightsN_disp(lights, play->game.graph);
}
static void aMR_DrawOneFurniture(FTR_ACTOR* ftr_actor, ACTOR* actorx, GAME* game, int fit_flag) {
xyz_t ftr_scale = ftr_actor->scale;
GAME_PLAY* play = (GAME_PLAY*)game;
MY_ROOM_ACTOR* my_room = (MY_ROOM_ACTOR*)actorx;
aFTR_PROFILE* profile;
profile = aMR_GetFurnitureProfile(ftr_actor->name);
if (profile != NULL) {
f32 scale = profile->scale;
_texture_z_light_fog_prim_xlu(game->graph);
_texture_z_light_fog_prim(game->graph);
aMR_FurnitureLightSet(ftr_actor, play);
aMR_LoadTexture(profile, game);
aMR_LoadPallet(profile, game);
aMR_SetKankyoMapping(ftr_actor, play);
if (fit_flag == TRUE) {
aMR_parent_ftr_c* parent_ftr = &my_room->parent_ftr;
FTR_ACTOR* fit_ftr_p = &l_aMR_work.ftr_actor_list[parent_ftr->ftrID];
int fit_no = aMR_GetFitNo(actorx, ftr_actor);
s16 angle = fit_ftr_p->s_angle_y - parent_ftr->angle_y;
aMR_fit_ftr_c* fit_ftr_info_p = &parent_ftr->fit_ftr_table[fit_no & 3];
xyz_t* pos = &fit_ftr_info_p->pos;
Matrix_translate(fit_ftr_p->position.x, fit_ftr_p->position.y, fit_ftr_p->position.z, 0);
Matrix_RotateY(angle, 1);
Matrix_translate(fit_ftr_p->base_position.x, fit_ftr_p->base_position.y, fit_ftr_p->base_position.z, 1);
if (ftr_actor->name == 0x9A) { /* lower alarm clock ftr's height */
Matrix_translate(pos->x, pos->y - 4.0f, pos->z, 1);
} else {
Matrix_translate(pos->x, pos->y, pos->z, 1);
}
Matrix_RotateY(ftr_actor->s_angle_y, 1);
Matrix_translate(ftr_actor->base_position.x, ftr_actor->base_position.y, ftr_actor->base_position.z, 1);
if (ftr_actor->state == aFTR_STATE_BIRTH && ftr_actor->shape_type <= aFTR_SHAPE_TYPEB_0) {
Matrix_translate(mFI_UT_WORLDSIZE_HALF_X_F, 0.0f, 0.0f, 1);
}
Matrix_scale(ftr_scale.x, ftr_scale.y, ftr_scale.z, 1);
if (ftr_actor->state == aFTR_STATE_BIRTH && ftr_actor->shape_type <= aFTR_SHAPE_TYPEB_0) {
Matrix_translate(-mFI_UT_WORLDSIZE_HALF_X_F, 0.0f, 0.0f, 1);
}
Matrix_scale(scale, scale, scale, 1);
} else {
if (ftr_actor->name == 0x9A) { /* lower alarm clock ftr's height */
Matrix_translate(ftr_actor->position.x, ftr_actor->position.y - 4.0f, ftr_actor->position.z, 0);
} else {
Matrix_translate(ftr_actor->position.x, ftr_actor->position.y, ftr_actor->position.z, 0);
}
Matrix_RotateY(ftr_actor->s_angle_y, 1);
if (Save_Get(scene_no) == SCENE_MUSEUM_ROOM_FOSSIL &&
aFTR_CHECK_INTERACTION(profile->interaction_type, aFTR_INTERACTION_TYPE_FOSSIL) &&
profile->shape <= aFTR_SHAPE_TYPEB_0) {
Matrix_translate(ftr_actor->base_position.x + 2.5f, ftr_actor->base_position.y,
ftr_actor->base_position.z, 1);
} else {
Matrix_translate(ftr_actor->base_position.x, ftr_actor->base_position.y, ftr_actor->base_position.z, 1);
}
if (ftr_actor->state == aFTR_STATE_BIRTH && ftr_actor->shape_type <= aFTR_SHAPE_TYPEB_0) {
Matrix_translate(mFI_UT_WORLDSIZE_HALF_X_F, 0.0f, 0.0f, 1);
}
Matrix_scale(ftr_scale.x, ftr_scale.y, ftr_scale.z, 1);
if (ftr_actor->state == aFTR_STATE_BIRTH && ftr_actor->shape_type <= aFTR_SHAPE_TYPEB_0) {
Matrix_translate(-mFI_UT_WORLDSIZE_HALF_X_F, 0.0f, 0.0f, 1);
}
Matrix_scale(scale, scale, scale, 1);
}
aMR_SetLoopTextureAnime(ftr_actor, profile, game);
aMR_DrawRegistModel(profile, game);
aMR_DrawSkelShape(ftr_actor, profile, game);
aMR_DrawUniqueShape(ftr_actor, actorx, profile, game);
aMR_DrawItemOnMovingFurniture(actorx, ftr_actor, game);
}
}
static void aMR_DrawFurniture(MY_ROOM_ACTOR* my_room, GAME_PLAY* play, int ftr_flag, u16 ftr_no) {
ACTOR* actorx = (ACTOR*)my_room;
GAME* game = (GAME*)play;
int i;
int z;
OPEN_DISP(game->graph);
gDPSetTexEdgeAlpha(NEXT_POLY_OPA_DISP, 127);
gDPSetTexEdgeAlpha(NEXT_POLY_XLU_DISP, 127);
CLOSE_DISP(game->graph);
for (z = UT_Z_NUM - 1; z >= 0; z--) {
FTR_ACTOR* ftr_actor = l_aMR_work.ftr_actor_list;
u8* used = l_aMR_work.used_list;
for (i = 0; i < l_aMR_work.list_size; i++) {
if (*used == TRUE && mFI_POS2UT(ftr_actor->position.z) == z) {
if ((ftr_flag == FALSE && ftr_actor->name != ftr_no) ||
(ftr_flag == TRUE && ftr_actor->name == ftr_no)) {
int alpha_edge;
int fit_flag = (ftr_actor->layer == mCoBG_LAYER0 || my_room->parent_ftr.ftrID == -1 ||
(my_room->parent_ftr.ftrID != -1 &&
my_room->parent_ftr.fit_ftr_table[0].ftr_ID != ftr_actor->id &&
my_room->parent_ftr.fit_ftr_table[1].ftr_ID != ftr_actor->id &&
my_room->parent_ftr.fit_ftr_table[2].ftr_ID != ftr_actor->id &&
my_room->parent_ftr.fit_ftr_table[3].ftr_ID != ftr_actor->id)) == FALSE;
alpha_edge = aMR_GetAlphaEdge(ftr_actor->name);
OPEN_DISP(game->graph);
gDPSetTexEdgeAlpha(NEXT_POLY_OPA_DISP, alpha_edge);
gDPSetTexEdgeAlpha(NEXT_POLY_XLU_DISP, alpha_edge);
CLOSE_DISP(game->graph);
if (aMR_DrawDolphinMode(ftr_actor->name)) {
OPEN_DISP(game->graph);
gDPSetTextureAdjustMode(NEXT_POLY_OPA_DISP, G_TA_DOLPHIN);
gDPSetTextureAdjustMode(NEXT_POLY_XLU_DISP, G_TA_DOLPHIN);
CLOSE_DISP(game->graph);
}
aMR_DrawOneFurniture(ftr_actor, actorx, game, fit_flag);
if (aMR_DrawDolphinMode(ftr_actor->name)) {
OPEN_DISP(game->graph);
gDPSetTextureAdjustMode(NEXT_POLY_OPA_DISP, G_TA_N64);
gDPSetTextureAdjustMode(NEXT_POLY_XLU_DISP, G_TA_N64);
CLOSE_DISP(game->graph);
}
}
}
ftr_actor++;
used++;
}
}
OPEN_DISP(game->graph);
gDPSetTexEdgeAlpha(NEXT_POLY_OPA_DISP, 144);
gDPSetTexEdgeAlpha(NEXT_POLY_XLU_DISP, 144);
CLOSE_DISP(game->graph);
}
static void aMR_DrawLeaf(MY_ROOM_ACTOR* my_room, GAME_PLAY* play) {
GAME* game = (GAME*)play;
if (my_room->leaf_info.exist_flag) {
f32 scale = my_room->leaf_info.scale;
OPEN_DISP(game->graph);
_texture_z_light_fog_prim(game->graph);
Matrix_translate(my_room->leaf_info.pos.x, my_room->leaf_info.pos.y, my_room->leaf_info.pos.z, 0);
Matrix_scale(scale, scale, scale, 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, aMR_IconNo2Gfx1(my_room->pickup_info.icon));
gSPDisplayList(NEXT_POLY_OPA_DISP, aMR_IconNo2Gfx2(my_room->pickup_info.icon));
CLOSE_DISP(game->graph);
my_room->leaf_info.exist_flag = FALSE;
}
}
static void My_Room_Actor_draw(ACTOR* actorx, GAME* game) {
MY_ROOM_ACTOR* my_room = (MY_ROOM_ACTOR*)actorx;
GAME_PLAY* play = (GAME_PLAY*)game;
aMR_DrawFurniture(my_room, play, FALSE, 0x41C); /* lighthouse model */
aMR_DrawFurniture(my_room, play, TRUE, 0x41C); /* lighthouse model */
aMR_DrawLeaf(my_room, play);
}
+22 -20
View File
@@ -5,16 +5,16 @@ typedef struct process_info_s {
s16 unit_ofs[4];
} aMR_process_info_c;
static aMR_process_info_c aMR_process_typeB90 = { 2, { 0, -UT_X_NUM, 0, 0 } };
static aMR_process_info_c aMR_process_typeB180 = { 2, { 0, -1, 0, 0 } };
static aMR_process_info_c aMR_process_typeB270 = { 2, { 0, UT_X_NUM, 0, 0 } };
static aMR_process_info_c aMR_process_typeB0 = { 2, { 0, 1, 0, 0 } };
static aMR_process_info_c aMR_process_typeA = { 1, { 0, 0, 0, 0 } };
static aMR_process_info_c aMR_process_typeC = { 4, { 0, 1, UT_X_NUM, UT_X_NUM + 1 } };
static aMR_process_info_c aMR_poccess_typeB90 = { 2, { 0, -UT_X_NUM, 0, 0 } };
static aMR_process_info_c aMR_poccess_typeB180 = { 2, { 0, -1, 0, 0 } };
static aMR_process_info_c aMR_poccess_typeB270 = { 2, { 0, UT_X_NUM, 0, 0 } };
static aMR_process_info_c aMR_poccess_typeB0 = { 2, { 0, 1, 0, 0 } };
static aMR_process_info_c aMR_poccess_typeA = { 1, { 0, 0, 0, 0 } };
static aMR_process_info_c aMR_poccess_typeC = { 4, { 0, 1, UT_X_NUM, UT_X_NUM + 1 } };
static aMR_process_info_c* aMR_process_table[aFTR_SHAPE_TYPE_NUM] = {
&aMR_process_typeB90, &aMR_process_typeB180, &aMR_process_typeB270,
&aMR_process_typeB0, &aMR_process_typeA, &aMR_process_typeC,
static aMR_process_info_c* aMR_poccess_table[aFTR_SHAPE_TYPE_NUM] = {
&aMR_poccess_typeB90, &aMR_poccess_typeB180, &aMR_poccess_typeB270,
&aMR_poccess_typeB0, &aMR_poccess_typeA, &aMR_poccess_typeC,
};
static int aMR_GetFurniturePoccessUnitNo(int* ut_info, int ut_x, int ut_z, u8 type) {
@@ -22,7 +22,7 @@ static int aMR_GetFurniturePoccessUnitNo(int* ut_info, int ut_x, int ut_z, u8 ty
int ut = ut_x + ut_z * UT_X_NUM;
if (type < aFTR_SHAPE_TYPE_NUM) {
aMR_process_info_c* process_info = aMR_process_table[type];
aMR_process_info_c* process_info = aMR_poccess_table[type];
int count = process_info->unit_count;
int i;
@@ -360,19 +360,19 @@ static void aMR_SetCleanUpFtrSE(xyz_t pos) {
}
static int aMR_GetPlayerDirect(const f32* normal_xz) {
if (normal_xz[0] > (F_PI / 4.0f)) {
if (normal_xz[0] > F_SQRT2_DIV2) {
return aMR_DIRECT_LEFT;
}
if (normal_xz[0] < -(F_PI / 4.0f)) {
if (normal_xz[0] < -F_SQRT2_DIV2) {
return aMR_DIRECT_RIGHT;
}
if (normal_xz[1] > (F_PI / 4.0f)) {
if (normal_xz[1] > F_SQRT2_DIV2) {
return aMR_DIRECT_UP;
}
if (normal_xz[1] < -(F_PI / 4.0f)) {
if (normal_xz[1] < -F_SQRT2_DIV2) {
return aMR_DIRECT_DOWN;
}
@@ -397,19 +397,19 @@ static void aMR_MoveShapeCenter(FTR_ACTOR* ftr_actor) {
}
static int aMR_Norm2DirectName(f32* normal_xz) {
if (normal_xz[0] > (F_PI / 4.0f)) {
if (normal_xz[0] > F_SQRT2_DIV2) {
return aMR_DIRECT_RIGHT;
}
if (normal_xz[0] <= -(F_PI / 4.0f)) {
if (normal_xz[0] <= -F_SQRT2_DIV2) {
return aMR_DIRECT_LEFT;
}
if (normal_xz[1] > (F_PI / 4.0f)) {
if (normal_xz[1] > F_SQRT2_DIV2) {
return aMR_DIRECT_DOWN;
}
if (normal_xz[1] <= -(F_PI / 4.0f)) {
if (normal_xz[1] <= -F_SQRT2_DIV2) {
return aMR_DIRECT_UP;
}
@@ -1332,6 +1332,8 @@ static void aMR_MngFtrContactAction(ACTOR* actorx, GAME* game) {
}
}
#include "../src/ac_my_room_action.c_inc"
static f32 aMR_GetDistXZ(const xyz_t* pos0, const xyz_t* pos1) {
f32 diff_x = pos0->x - pos1->x;
f32 diff_z = pos0->z - pos1->z;
@@ -1472,14 +1474,14 @@ static int aMR_CheckPlaceSituation(int ut, int target_ut, u16 ftr_no, u16 angle_
aFTR_PROFILE* profile = aMR_GetFurnitureProfile(ftr_no);
if (profile != NULL) {
u32 shape = profile->shape;
u8 shape = profile->shape;
if (shape == aFTR_SHAPE_TYPEB_0) {
static u8 rotate_angle_types[] = {
aFTR_SHAPE_TYPEB_0,
aFTR_SHAPE_TYPEB_90,
aFTR_SHAPE_TYPEB_180,
aFTR_SHAPE_TYPEB_270,
aFTR_SHAPE_TYPEB_0,
};
shape = rotate_angle_types[angle_idx & 3];
-1
View File
@@ -147,7 +147,6 @@ static void aMR_SetEmulatorStartMessage(ACTOR* actorx, int internal_rom) {
mMsg_Unset_LockContinue(mMsg_Get_base_window_p());
mMsg_Set_ForceNext(mMsg_Get_base_window_p());
break;
case FAMICOM_RESULT_NOFILE:
default:
mMsg_Set_continue_msg_num(mMsg_Get_base_window_p(), 0x3071);
mMsg_Unset_LockContinue(mMsg_Get_base_window_p());
+1 -1
View File
@@ -171,7 +171,7 @@ extern void sAdo_SetVoiceMode(u8 mode) {
Na_SetVoiceMode(mode);
}
extern void sAdo_FloorTrgStart(u16 id, const xyz_t* pos) {
extern void sAdo_FloorTrgStart(u8 id, const xyz_t* pos) {
u16 scalc;
f32 fcalc;
+15 -22
View File
@@ -608,18 +608,18 @@ extern void Actor_get_overlay_area(ACTOR_DLFTBL* dlftbl, int unused, size_t allo
}
}
static int Actor_data_bank_regist_check_npc(int* bank_id, ACTOR_PROFILE* profile, ACTOR_DLFTBL* dlftbl, GAME* game,
static int Actor_data_bank_regist_check_npc(int* bank_id, ACTOR_PROFILE* profile, ACTOR_DLFTBL* dlftbl, GAME_PLAY* play,
mActor_name_t name_id) {
return TRUE;
}
static int Actor_data_bank_regist_check(int* bank_id, ACTOR_PROFILE* profile, ACTOR_DLFTBL* dlftbl, GAME* game,
static int Actor_data_bank_regist_check(int* bank_id, ACTOR_PROFILE* profile, ACTOR_DLFTBL* dlftbl, GAME_PLAY* play,
mActor_name_t name_id) {
int res = TRUE;
if (*bank_id == -1) {
if (profile->part == ACTOR_PART_NPC) {
res = Actor_data_bank_regist_check_npc(bank_id, profile, dlftbl, game, name_id);
res = Actor_data_bank_regist_check_npc(bank_id, profile, dlftbl, play, name_id);
} else {
// in DnM, this was another func call
res = TRUE;
@@ -687,31 +687,32 @@ extern void Actor_init_actor_class(ACTOR* actor, ACTOR_PROFILE* profile, ACTOR_D
actor->npc_id = name_id;
}
#ifndef MUST_MATCH
/* @nonmatching */
typedef struct overlay_struct {
const char* actor_name;
} mAc_overlay_info_c;
extern ACTOR* Actor_info_make_actor(Actor_info* actor_info, GAME* game, s16 profile_no, f32 x, f32 y, f32 z, s16 rot_x,
s16 rot_y, s16 rot_z, s8 block_x, s8 block_z, s16 move_actor_list_idx,
mActor_name_t name_id, s16 arg, s8 npc_info_idx, int data_bank_idx) {
const char* test = "";
GAME_PLAY* play = (GAME_PLAY*)game;
GAME_PLAY* play;
ACTOR* actor;
ACTOR_PROFILE* profile;
ACTOR_DLFTBL* dlftbl;
mAc_overlay_info_c overlay_info; /* Required to be a struct, stubbed in GC */
test = ""; // removing this line helps a bit...
dlftbl = &actor_dlftbls[profile_no];
play = (GAME_PLAY*)game;
dlftbl = actor_dlftbls + profile_no;
overlay_info.actor_name = "";
if (actor_info->total_num > mAc_MAX_ACTORS) {
return NULL;
}
profile = dlftbl->profile;
if (Actor_data_bank_regist_check(&data_bank_idx, profile, dlftbl, game, name_id) == FALSE) {
if (Actor_data_bank_regist_check(&data_bank_idx, profile, dlftbl, play, name_id) == FALSE) {
return NULL;
}
if (Actor_malloc_actor_class(&actor, profile, dlftbl, test, name_id) == FALSE) {
if (Actor_malloc_actor_class(&actor, profile, dlftbl, overlay_info.actor_name, name_id) == FALSE) {
return NULL;
}
@@ -720,18 +721,10 @@ extern ACTOR* Actor_info_make_actor(Actor_info* actor_info, GAME* game, s16 prof
move_actor_list_idx, name_id, arg);
Actor_info_part_new(actor_info, actor, profile->part);
mNpc_SetNpcinfo(actor, npc_info_idx);
Actor_ct(actor, (GAME*)play);
Actor_ct(actor, game);
return actor;
}
#else
extern asm ACTOR* Actor_info_make_actor(Actor_info* actor_info, GAME* game, s16 profile_no, f32 x, f32 y, f32 z,
s16 rot_x, s16 rot_y, s16 rot_z, s8 block_x, s8 block_z,
s16 move_actor_list_idx, mActor_name_t name_id, s16 arg, s8 npc_info_idx,
int data_bank_idx) {
#include "asm/80375830.s"
}
#endif
extern ACTOR* Actor_info_make_child_actor(Actor_info* actor_info, ACTOR* parent_actor, GAME* game, s16 profile, f32 x,
f32 y, f32 z, s16 rot_x, s16 rot_y, s16 rot_z, s16 move_actor_list_idx,