Merge pull request #240 from Hexalotl/ac_lotus

Implement and Link ac_lotus
This commit is contained in:
Cuyler36
2024-01-31 15:39:50 -05:00
committed by GitHub
14 changed files with 400 additions and 57 deletions
+28 -1
View File
@@ -362,4 +362,31 @@ config/rel.yml:
obj_e_koinobori_b_pal:
addrs: [0x806C5920, 0x806C5940]
type: pal16
# ac_lotus
aLOT_obj_01_lotus_pal:
addrs: [0x806C59E0, 0x806C5A00]
type: pal16
obj_02_lotus_pal:
addrs: [0x806C5A00, 0x806C5A20]
type: pal16
obj_03_lotus_pal:
addrs: [0x806C5A20, 0x806C5A40]
type: pal16
obj_04_lotus_pal:
addrs: [0x806C5A40, 0x806C5A60]
type: pal16
obj_05_lotus_pal:
addrs: [0x806C5A60, 0x806C5A80]
type: pal16
obj_06_lotus_pal:
addrs: [0x806C5A80, 0x806C5AA0]
type: pal16
obj_07_lotus_pal:
addrs: [0x806C5AA0, 0x806C5AC0]
type: pal16
obj_08_lotus_pal:
addrs: [0x806C5AC0, 0x806C5AE0]
type: pal16
obj_09_lotus_pal:
addrs: [0x806C5AE0, 0x806C5B00]
type: pal16
+5
View File
@@ -434,6 +434,11 @@ ac_koinobori.c:
.text: [0x805B27B8, 0x805B2AE0]
.data: [0x806C58A0, 0x806C5940]
.rodata: [0x8064A978, 0x8064A990]
ac_lotus.c:
.text: [0x805B2AE0, 0x805B3010]
.rodata: [0x8064A990, 0x8064A9B0]
.data: [0x806C5940, 0x806C5B58]
.bss: [0x81327F48, 0x81327F68]
ac_rope.c:
.text: [0x804967A4, 0x80496AB8]
.rodata: [0x80644DB0,0x80644DB8]
+2 -13
View File
@@ -2,7 +2,7 @@
#define AC_KOINOBORI_H
#include "types.h"
#include "m_actor.h"
#include "ac_structure.h"
#include "c_keyframe.h"
#ifdef __cplusplus
@@ -11,20 +11,9 @@ extern "C" {
extern ACTOR_PROFILE Koinobori_Profile;
typedef void (*KOINOBORI_PROC)(ACTOR*, GAME*);
/* sizeof(KOINOBORI_ACTOR) == 0x2DC */
typedef struct actor_koinobori_s{
/* 0x000 */ ACTOR actor_class;
/* 0x174 */ int _174; // Unused
/* 0x178 */ cKF_SkeletonInfo_R_c keyframe;
/* 0x1E8 */ int _1E8; // Unused
/* 0x1EC */ s_xyz work[15];
/* 0x246 */ s_xyz morph[15];
/* 0x2A0 */ KOINOBORI_PROC action_proc;
/* 0x2A4 */ u8 _2A4[0x2B4 - 0x2A4]; // Unused
/* 0x2B4 */ int action;
/* 0x2B8 */ u8 _2B8[0x2DC - 0x2B8]; // Unused
STRUCTURE_ACTOR structure_class;
} KOINOBORI_ACTOR;
#ifdef __cplusplus
+8 -1
View File
@@ -2,13 +2,20 @@
#define AC_LOTUS_H
#include "types.h"
#include "m_actor.h"
#include "ac_structure.h"
#include "c_keyframe.h"
#ifdef __cplusplus
extern "C" {
#endif
extern ACTOR_PROFILE Lotus_Profile;
extern ClObjPipe_c pipeinfo;
/* sizeof(LOTUS_ACTOR) == 0x2DC */
typedef struct actor_lotus_s {
STRUCTURE_ACTOR structure_class;
} LOTUS_ACTOR;
#ifdef __cplusplus
}
+2 -8
View File
@@ -2,7 +2,7 @@
#define AC_MIKUJI_H
#include "types.h"
#include "m_actor.h"
#include "ac_structure.h"
#ifdef __cplusplus
extern "C" {
@@ -13,13 +13,7 @@ typedef struct actor_mikuji_s MIKUJI_ACTOR;
typedef void (*MIKUJI_PROC)(MIKUJI_ACTOR*, GAME_PLAY*);
struct actor_mikuji_s{
ACTOR actor_class;
u8 pad[0x2A0 - 0x174];
MIKUJI_PROC proc;
u8 pad2[0x2B4 - 0x2A4];
int current_action;
int next_action;
u8 pad3[0x2DC - 0x2BC];
STRUCTURE_ACTOR structure_class;
};
extern ACTOR_PROFILE Mikuji_Profile;
+22 -21
View File
@@ -189,33 +189,34 @@ typedef u16* (*aSTR_GET_PAL_SEGMENT_PROC)(s16);
typedef void (*aSTR_MOVE_PROC)(ACTOR*, GAME*);
// sizeof(actor_structure_s) == 0x2DC
struct actor_structure_s {
ACTOR actor_class;
int keyframe_state;
cKF_SkeletonInfo_R_c keyframe;
int keyframe_saved_keyframe;
s_xyz work_area[15];
s_xyz morph_area[15];
aSTR_MOVE_PROC action_proc;
int _2A4;
int structure_type; /* aSTR_TYPE_* */
int structure_pal; /* aSTR_PAL_* */
int request_type;
int action;
/* 0x000*/ ACTOR actor_class;
/* 0x174*/ int keyframe_state;
/* 0x178*/ cKF_SkeletonInfo_R_c keyframe;
/* 0x1E8*/ int keyframe_saved_keyframe;
/* 0x1EC*/ s_xyz work_area[15];
/* 0x246*/ s_xyz morph_area[15];
/* 0x2A0*/ aSTR_MOVE_PROC action_proc;
/* 0x2A4*/ int _2A4;
/* 0x2A8*/ int structure_type; /* aSTR_TYPE_* */
/* 0x2AC*/ int structure_pal; /* aSTR_PAL_* */
/* 0x2B0*/ int request_type;
/* 0x2B4*/ int action;
/* general purpose members with unique usage between structure actors */
int arg0;
int arg1;
int arg2;
int arg3;
/* 0x2B8*/ int arg0;
/* 0x2BC*/ int arg1;
/* 0x2C0*/ int arg2;
/* 0x2C4*/ int arg3;
/* general purpose float members with unique usage between structure actors*/
f32 arg0_f;
f32 arg1_f;
f32 arg2_f;
f32 arg3_f;
/* 0x2C8*/ f32 arg0_f;
/* 0x2CC*/ f32 arg1_f;
/* 0x2D0*/ f32 arg2_f;
/* 0x2D4*/ f32 arg3_f;
u32 season;
/* 0x2D8*/ u32 season;
};
typedef struct actor_overlay_info_s {
+1
View File
@@ -2700,6 +2700,7 @@ extern int mNT_check_unknown(mActor_name_t item_no);
#define DUMMY_MIKUJI 0xF10D
#define DUMMY_TAMA 0xF110
#define DUMMY_KOINOBORI 0xF114
#define DUMMY_LOTUS 0xF11B
#define DUMMY_DOUZOU 0xF11D
#define DUMMY_NAMEPLATE 0xF11F
#define DUMMY_BOAT 0xF128
+3 -3
View File
@@ -68,14 +68,14 @@ static void aKOI_actor_ct(ACTOR* actor, GAME* game) {
actor->cull_height = 830.0f;
actor->cull_radius = 480.0f;
cKF_SkeletonInfo_R_ct(&koinobori->keyframe, &cKF_bs_r_obj_e_koinobori, NULL, koinobori->work, koinobori->morph);
cKF_SkeletonInfo_R_ct(&koinobori->structure_class.keyframe, &cKF_bs_r_obj_e_koinobori, NULL, koinobori->structure_class.work_area, koinobori->structure_class.morph_area);
aKOI_setup_action(koinobori, aKOI_ACTION_WAIT);
cKF_SkeletonInfo_R_play(&koinobori->keyframe);
cKF_SkeletonInfo_R_play(&koinobori->structure_class.keyframe);
}
static void aKOI_actor_dt(ACTOR* actor, GAME* game) {
KOINOBORI_ACTOR* koinobori = (KOINOBORI_ACTOR*)actor;
cKF_SkeletonInfo_R_dt(&koinobori->keyframe);
cKF_SkeletonInfo_R_dt(&koinobori->structure_class.keyframe);
}
#include "../src/ac_koinobori_move.c_inc"
+1 -1
View File
@@ -17,7 +17,7 @@ static void aKOI_actor_draw(ACTOR* actor, GAME* game) {
koinobori = (KOINOBORI_ACTOR*)actor;
graph = game->graph;
keyframe = &koinobori->keyframe;
keyframe = &koinobori->structure_class.keyframe;
mtx = GRAPH_ALLOC_TYPE(graph, Mtx, keyframe->skeleton->num_shown_joints);
if (mtx != NULL) {
+6 -6
View File
@@ -2,11 +2,11 @@ static void aKOI_wait(ACTOR* actor, GAME* game) {
}
static void aKOI_setup_action(KOINOBORI_ACTOR* koinobori, int action) {
static KOINOBORI_PROC process[8] = { &aKOI_wait, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
static aSTR_MOVE_PROC process[8] = { &aKOI_wait, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
cKF_SkeletonInfo_R_init(&koinobori->keyframe, koinobori->keyframe.skeleton, &cKF_ba_r_obj_e_koinobori, 1.0f, 1.0f, 1.0f, 0.5f, 0.0f, TRUE, NULL);
koinobori->action_proc = process[action];
koinobori->action = action;
cKF_SkeletonInfo_R_init(&koinobori->structure_class.keyframe, koinobori->structure_class.keyframe.skeleton, &cKF_ba_r_obj_e_koinobori, 1.0f, 1.0f, 1.0f, 0.5f, 0.0f, TRUE, NULL);
koinobori->structure_class.action_proc = process[action];
koinobori->structure_class.action = action;
}
static void aKOI_actor_move(ACTOR* actor, GAME* game) {
@@ -14,8 +14,8 @@ static void aKOI_actor_move(ACTOR* actor, GAME* game) {
KOINOBORI_ACTOR* koinobori = (KOINOBORI_ACTOR*)actor;
GET_PLAYER_ACTOR(game_play);
cKF_SkeletonInfo_R_play(&koinobori->keyframe);
koinobori->action_proc(actor, game);
cKF_SkeletonInfo_R_play(&koinobori->structure_class.keyframe);
koinobori->structure_class.action_proc(actor, game);
sAdo_OngenPos((u32)actor, 0x35, &actor->world.position);
}
+116
View File
@@ -0,0 +1,116 @@
#include "ac_lotus.h"
#include "m_name_table.h"
#include "sys_matrix.h"
#include "m_lib.h"
#include "m_rcp.h"
#include "m_common_data.h"
#include "m_player_lib.h"
#ifdef MUST_MATCH
#ifndef __INTELLISENSE__
/* Force assetrip to detect these assets. They're used in a .c_inc file. */
FORCESTRIP static u16 __hack_pal0[] = {
#include "assets/aLOT_obj_01_lotus_pal.inc"
};
FORCESTRIP static u16 __hack_pal1[] = {
#include "assets/obj_02_lotus_pal.inc"
};
FORCESTRIP static u16 __hack_pal3[] = {
#include "assets/obj_03_lotus_pal.inc"
};
FORCESTRIP static u16 __hack_pal4[] = {
#include "assets/obj_04_lotus_pal.inc"
};
FORCESTRIP static u16 __hack_pal5[] = {
#include "assets/obj_05_lotus_pal.inc"
};
FORCESTRIP static u16 __hack_pal6[] = {
#include "assets/obj_06_lotus_pal.inc"
};
FORCESTRIP static u16 __hack_pal7[] = {
#include "assets/obj_07_lotus_pal.inc"
};
FORCESTRIP static u16 __hack_pal8[] = {
#include "assets/obj_08_lotus_pal.inc"
};
FORCESTRIP static u16 __hack_pal9[] = {
#include "assets/obj_09_lotus_pal.inc"
};
#endif
#endif
enum {
aLOT_ACTION_WAIT1,
aLOT_ACTION_WAIT2,
aLOT_ACTION_SHAKE,
};
static void aLOT_actor_ct(ACTOR* actor, GAME* game);
static void aLOT_actor_dt(ACTOR* actor, GAME* game);
static void aLOT_actor_init(ACTOR* actor, GAME* game);
static void aLOT_actor_draw(ACTOR* actor, GAME* game);
ACTOR_PROFILE Lotus_Profile = {
mAc_PROFILE_LOTUS,
ACTOR_PART_ITEM,
ACTOR_STATE_TA_SET,
LOTUS,
ACTOR_OBJ_BANK_KEEP,
sizeof(LOTUS_ACTOR),
&aLOT_actor_ct,
&aLOT_actor_dt,
&aLOT_actor_init,
&aLOT_actor_draw,
NULL
};
static StatusData_c lotus_StatusData = { 0, 0, 0, 0, 0x0A};
static ClObjPipeData_c lotus_CoInfoData = {
{0x3D, 0x20, ClObj_TYPE_PIPE}, // collision data
{1}, // element data
// Pipe specs
{
70, // radius
6, // height
0, // offset
{0, 0, 0}, // center
},
};
ClObjPipe_c pipeinfo;
extern cKF_Skeleton_R_c cKF_bs_r_obj_s_lotus;
static void aLOT_setup_action(LOTUS_ACTOR* lotus, int action);
static int aLOT_getPalNo();
static void aLOT_actor_ct(ACTOR* actor, GAME* game) {
LOTUS_ACTOR* lotus;
int pal_no;
f32 water_height;
lotus = (LOTUS_ACTOR*)actor;
water_height = mCoBG_GetWaterHeight_File(actor->world.position, __FILE__, 265);
cKF_SkeletonInfo_R_ct(&lotus->structure_class.keyframe, &cKF_bs_r_obj_s_lotus, NULL, lotus->structure_class.work_area, lotus->structure_class.morph_area);
ClObjPipe_ct(game, &pipeinfo);
ClObjPipe_set5(game, &pipeinfo,actor, &lotus_CoInfoData);
CollisionCheck_Status_set3(&actor->status_data, &lotus_StatusData);
actor->world.position.y = water_height;
pal_no = aLOT_getPalNo();
lotus->structure_class.arg0 = pal_no;
aLOT_setup_action(lotus, aLOT_ACTION_WAIT1);
cKF_SkeletonInfo_R_play(&lotus->structure_class.keyframe);
}
static void aLOT_actor_dt(ACTOR* actor, GAME* game) {
LOTUS_ACTOR* lotus = (LOTUS_ACTOR*)actor;
cKF_SkeletonInfo_R_dt(&lotus->structure_class.keyframe);
}
#include "../src/ac_lotus_move.c_inc"
#include "../src/ac_lotus_draw.c_inc"
+122
View File
@@ -0,0 +1,122 @@
u16 aLOT_obj_01_lotus_pal[] = {
#include "assets/aLOT_obj_01_lotus_pal.inc"
};
u16 obj_02_lotus_pal[] = {
#include "assets/obj_02_lotus_pal.inc"
};
u16 obj_03_lotus_pal[] = {
#include "assets/obj_03_lotus_pal.inc"
};
u16 obj_04_lotus_pal[] = {
#include "assets/obj_04_lotus_pal.inc"
};
u16 obj_05_lotus_pal[] = {
#include "assets/obj_05_lotus_pal.inc"
};
u16 obj_06_lotus_pal[] = {
#include "assets/obj_06_lotus_pal.inc"
};
u16 obj_07_lotus_pal[] = {
#include "assets/obj_07_lotus_pal.inc"
};
u16 obj_08_lotus_pal[] = {
#include "assets/obj_08_lotus_pal.inc"
};
u16 obj_09_lotus_pal[] = {
#include "assets/obj_09_lotus_pal.inc"
};
static int aLOT_actor_draw_before(GAME* game, cKF_SkeletonInfo_R_c* keyframe, int joint_idx, Gfx** joint_shape, u8* joint_flags, void* arg, s_xyz* joint_rot, xyz_t* joint_pos) {
static int on_off_tbl[12] = {
0, 0, 0, 0,
1, 1, 1, 0,
0, 0, 0, 0
};
BOOL draw;
int month;
int day;
Gfx* gfx;
GRAPH* graph;
lbRTC_time_c* rtc_time;
graph = game->graph;
rtc_time = Common_GetPointer(time.rtc_time);
month = rtc_time->month;
day = rtc_time->day;
draw = on_off_tbl[month - 1];
OPEN_DISP(graph);
gfx = NOW_POLY_OPA_DISP;
if (joint_idx == 0x12) {
switch(month) {
case lbRTC_MAY:
{
if (day < 26) {
draw = FALSE;
}
}
break;
case lbRTC_AUGUST:
{
if (day < 26) {
draw = TRUE;
}
}
break;
}
if (draw == FALSE) {
*joint_shape = NULL;
}
}
SET_POLY_OPA_DISP(gfx);
CLOSE_DISP(graph);
return TRUE;
}
static void aLOT_actor_draw(ACTOR* actor, GAME* game) {
static u16* paltbl[9] = {
aLOT_obj_01_lotus_pal, obj_02_lotus_pal, obj_03_lotus_pal,
obj_04_lotus_pal, obj_05_lotus_pal, obj_06_lotus_pal,
obj_07_lotus_pal, obj_08_lotus_pal, obj_09_lotus_pal
};
LOTUS_ACTOR* lotus;
GRAPH* graph;
cKF_SkeletonInfo_R_c* keyframe;
Mtx* mtx;
Gfx* gfx;
lotus = (LOTUS_ACTOR*)actor;
graph = game->graph;
keyframe = &lotus->structure_class.keyframe;
if (lotus->structure_class.arg0 >= 0) {
mtx = GRAPH_ALLOC_TYPE(graph, Mtx, keyframe->skeleton->num_shown_joints);
if (mtx != NULL) {
_texture_z_light_fog_prim_npc(graph);
OPEN_DISP(graph);
gfx = NOW_POLY_OPA_DISP;
gSPSegment(gfx++, G_MWO_SEGMENT_8, paltbl[lotus->structure_class.arg0]);
SET_POLY_OPA_DISP(gfx);
cKF_Si3_draw_R_SV(game, keyframe, mtx, aLOT_actor_draw_before, NULL, actor);
CLOSE_DISP(graph);
}
}
}
+81
View File
@@ -0,0 +1,81 @@
extern cKF_Animation_R_c cKF_ba_r_obj_s_lotus;
static int aLOT_getPalNo() {
static int flower_pal_idx_table[18] = {
8, 8, 8,
0, 1, 1,
1, 2, 2,
3, 4, 5,
6, 7, 8,
8, 8, 8
};
return flower_pal_idx_table[Common_Get(time).term_idx];
}
static void aLOT_wait(ACTOR* actor, GAME* game) {
LOTUS_ACTOR* lotus;
int comeback_status;
lotus = (LOTUS_ACTOR*)actor;
comeback_status = mPlib_Check_UKI_COMEBACK_STATUS();
if (comeback_status == FALSE
&& (pipeinfo.collision_obj.collision_flags0 & 2) != 0
&& pipeinfo.collision_obj.collided_actor != NULL
&& pipeinfo.collision_obj.collided_actor->id == mAc_PROFILE_UKI) {
lotus->structure_class.keyframe.frame_control.speed = 2.0f;
aLOT_setup_action(lotus, aLOT_ACTION_SHAKE);
}
else {
add_calc(&lotus->structure_class.keyframe.frame_control.speed, 0.5f, 0.1f, 0.03f, 0.0f);
}
}
static void aLOT_shake(ACTOR* actor, GAME* game) {
LOTUS_ACTOR* lotus;
int comeback_status;
lotus = (LOTUS_ACTOR*)actor;
comeback_status = mPlib_Check_UKI_COMEBACK_STATUS();
if (comeback_status == FALSE) {
add_calc(&lotus->structure_class.keyframe.frame_control.speed, 0.5f, 0.1f, 0.03f, 0.0f);
}
else {
aLOT_setup_action(lotus, aLOT_ACTION_WAIT2);
}
}
static void aLOT_setup_action(LOTUS_ACTOR* lotus, int action) {
static aSTR_MOVE_PROC process[3] = { aLOT_wait, aLOT_wait, aLOT_shake };
if (action == aLOT_ACTION_WAIT1) {
cKF_SkeletonInfo_R_init(&lotus->structure_class.keyframe, lotus->structure_class.keyframe.skeleton, &cKF_ba_r_obj_s_lotus, 1.0f, 129.0f, 1.0f, 0.5f, 0.0f, TRUE, NULL);
}
lotus->structure_class.action_proc = process[action];
lotus->structure_class.action = action;
}
static void aLOT_actor_move(ACTOR* actor, GAME* game) {
LOTUS_ACTOR* lotus;
GAME_PLAY* game_play;
lotus = (LOTUS_ACTOR*)actor;
game_play = (GAME_PLAY*)game;
cKF_SkeletonInfo_R_play(&lotus->structure_class.keyframe);
lotus->structure_class.action_proc(actor, game);
CollisionCheck_Uty_ActorWorldPosSetPipeC(actor, &pipeinfo);
CollisionCheck_setOC(game, &game_play->collision_check, &pipeinfo.collision_obj);
}
static void aLOT_actor_init(ACTOR* actor, GAME* game) {
mFI_SetFG_common(DUMMY_LOTUS, actor->home.position, FALSE);
aLOT_actor_move(actor, game);
actor->mv_proc = aLOT_actor_move;
}
+3 -3
View File
@@ -15,11 +15,11 @@ static void aMIK_set_bgOffset(MIKUJI_ACTOR* mikuji, int offs)
offset = height_table[offs];
for(i = 0; i < 2; i++){
pos.z = mikuji->actor_class.home.position.z + addZ[i];
pos.x = mikuji->actor_class.home.position.x + addX[0];
pos.z = mikuji->structure_class.actor_class.home.position.z + addZ[i];
pos.x = mikuji->structure_class.actor_class.home.position.x + addX[0];
mCoBG_SetPluss5PointOffset_file(pos, *offset, __FILE__, 97);
offset++;
pos.x = mikuji->actor_class.home.position.x + addX[1];
pos.x = mikuji->structure_class.actor_class.home.position.x + addX[1];
mCoBG_SetPluss5PointOffset_file(pos, *offset, __FILE__, 101);
offset++;
}