Link bg_winter_item

This commit is contained in:
Cuyler36
2024-03-16 16:44:49 -04:00
parent e56f3ae56f
commit 9748fa79c6
7 changed files with 2913 additions and 3 deletions
+5
View File
@@ -604,6 +604,11 @@ bg_item.c:
.rodata: [0x80646178, 0x80646218]
.data: [0x80692BE0, 0x80695B38]
.bss: [0x812FD938, 0x812FDDC8]
bg_winter_item.c:
.text: [0x804BE9FC, 0x804C5E30]
.rodata: [0x80646228, 0x806462C8]
.data: [0x80695D98, 0x80698D10]
.bss: [0x812FDDE8, 0x812FE278]
ef_effect_control.c:
.text: [0x804CD474, 0x804CEC5C]
.rodata: [0x80646368, 0x806463C8]
+1 -1
View File
@@ -75,7 +75,7 @@ typedef enum bank_id {
ACTOR_OBJ_BANK_34,
ACTOR_OBJ_BANK_35,
ACTOR_OBJ_BANK_36,
ACTOR_OBJ_BANK_37,
ACTOR_OBJ_BANK_BG_WINTER_ITEM,
ACTOR_OBJ_BANK_38,
ACTOR_OBJ_BANK_39,
ACTOR_OBJ_BANK_40,
-2
View File
@@ -1802,7 +1802,6 @@ static void bit_cmn_single_draw_BT_shadow(GAME* game, bg_item_common_info_c* com
}
Matrix_push();
// ISSUE
draw_part = draw_part_table_a[type_data->type].draw_part_p;
draw_pos.gfx_no = type_data->_00;
draw_pos.cull_flag = FALSE;
@@ -1982,7 +1981,6 @@ static void bit_cmn_single_draw_BT(GAME* game, bg_item_common_info_c* common_inf
Gfx* gfx;
Matrix_push();
// ISSUE
table_p = &draw_part_table_a[type_data->type];
draw_part = table_p->draw_part_p;
display_list_table = (Gfx**)draw_part->display_list_table_p;
+144
View File
@@ -0,0 +1,144 @@
#include "bg_item.h"
#include "bg_winter_item.h"
#include "m_common_data.h"
#include "m_name_table.h"
#include "m_malloc.h"
#include "libultra/libultra.h"
#include "m_player_lib.h"
#include "sys_matrix.h"
#include "m_skin_matrix.h"
#include "gfxalloc.h"
#include "m_rcp.h"
#include "m_event_map_npc.h"
#define bIT_CLIP (Common_Get(clip).bg_item_clip)
static void bWI_actor_ct(ACTOR* actorx, GAME* game);
static void bWI_actor_dt(ACTOR* actorx, GAME* game);
static void bWI_actor_move(ACTOR* actorx, GAME* game);
static void bWI_actor_draw(ACTOR* actorx, GAME* game);
ACTOR_PROFILE BgWinterItem_Profile = {
mAc_PROFILE_BGWINTERITEM,
ACTOR_PART_ITEM,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_BG_WINTER_ITEM,
sizeof(BG_ITEM_ACTOR),
&bWI_actor_ct,
&bWI_actor_dt,
&bWI_actor_move,
&bWI_actor_draw,
NULL,
};
static f32 pos_table[] = {
20.0f, 60.0f, 100.0f, 140.0f, 180.0f, 220.0f, 260.0f, 300.0f,
340.0f, 380.0f, 420.0f, 460.0f, 500.0f, 540.0f, 580.0f, 620.0f,
};
static f32 pos_table2[] = {
0.0f, 40.0f, 80.0f, 120.0f, 160.0f, 200.0f, 240.0f, 280.0f,
320.0f, 360.0f, 400.0f, 440.0f, 480.0f, 520.0f, 560.0f, 600.0f,
};
static void bg_item_common_draw_loop_type1(GRAPH* graph, Gfx** gfx_pp, bg_item_draw_list_c* draw_list,
bg_item_draw_pos_c* draw_pos, Gfx** display_list_table);
static void bg_item_common_s_draw_loop_type1(GRAPH* graph, Gfx** gfx_pp, bg_item_draw_list_c* draw_list,
int shadow_vtx_count, Vtx* shadow_vtx, bg_item_draw_pos_c* draw_pos,
Gfx** display_list_table);
static int bIT_actor_drop_entry(bg_item_drop_table_c* drop_info, mActor_name_t fg_item, xyz_t* pos, xyz_t* target_pos,
u16 flags, s16 layer);
static void bit_cmn_single_drawS_shadow(GAME* game, bg_item_common_info_c* common_info, mActor_name_t fg_no, xyz_t* pos,
s_xyz* angle, xyz_t* scale, u8 alpha, f32 shadow_pos, rgba_t* shadow_color);
static int bIT_actor_hole_effect_entry(bg_item_hole_c* hole, mActor_name_t fg_item, xyz_t* pos, u16 frames,
u16 wait_frames, s16 mode, s16 wait_type);
#include "../src/bg_winter_item_data.c_inc"
#include "../src/bg_item_clip.c_inc"
#include "../src/bg_item_common.c_inc"
extern u16 obj_g_hole_pal[];
extern u16 obj_b_hole_pal[];
static void bWI_actor_ct(ACTOR* actorx, GAME* game) {
BG_ITEM_ACTOR* bg_item = (BG_ITEM_ACTOR*)actorx;
bg_item_common_c* common;
bg_item_common_info_c* common_info;
int i;
int max;
int event_type;
PLAYER_ACTOR* player;
common = &bg_item->common;
common_info = &common->common_info;
bIT_clip_ct(actorx);
player = GET_PLAYER_ACTOR((GAME_PLAY*)game);
event_type = mEvMN_GetEventTypeMap();
if (player != NULL) {
mFI_GetItemTable(&bg_item->common.item_table, player->actor_class.world.position, __FILE__, 244);
mFI_BornItemON();
}
for (i = 0; i < common->item_table.count; i++) {
bIT_common_clear_treeatr(common->item_table.block_info_tbl[i].block_x,
common->item_table.block_info_tbl[i].block_z, &common->block_info_table.info_tbl[i]);
if (event_type == -1 || mEvMN_GetMapIdx(event_type) == -1) {
mFI_ClearHoleBlock(common->item_table.block_info_tbl[i].block_x,
common->item_table.block_info_tbl[i].block_z);
}
}
mFI_InitItemTable(&bg_item->common.item_table);
player = GET_PLAYER_ACTOR((GAME_PLAY*)game);
if (player != NULL) {
mFI_GetItemTable(&bg_item->common.item_table, player->actor_class.world.position, __FILE__, 278);
}
for (i = 0; i < bg_item->common.item_table.count; i++) {
bIT_common_clear_treeatr(common->item_table.block_info_tbl[i].block_x,
common->item_table.block_info_tbl[i].block_z, &common->block_info_table.info_tbl[i]);
}
for (i = 0; i < mFM_VISIBLE_BLOCK_NUM; i++) {
common->_139F4[i] = i;
}
common_info->_30 = 0x25;
common_info->draw_part_table_p = draw_part_table_a;
common_info->pal_p[bIT_PAL_FLOWER_A] = g_fdinfo->field_palette.flower0_pal;
common_info->pal_p[bIT_PAL_FLOWER_B] = g_fdinfo->field_palette.flower1_pal;
common_info->pal_p[bIT_PAL_FLOWER_C] = g_fdinfo->field_palette.flower2_pal;
common_info->pal_p[bIT_PAL_GRASS] = g_fdinfo->field_palette.grass_pal;
common_info->pal_p[bIT_PAL_TREE] = g_fdinfo->field_palette.cedar_tree_pal;
common_info->pal_p[bIT_PAL_PALM_TREE] = g_fdinfo->field_palette.palm_tree_pal;
common_info->pal_p[bIT_PAL_GOLD_TREE] = g_fdinfo->field_palette.golden_tree_pal;
common_info->pal_p[bIT_PAL_HOLE_G] = obj_g_hole_pal;
common_info->pal_p[bIT_PAL_HOLE_S] = obj_b_hole_pal;
common->bg_item_actorx_p = actorx;
for (i = 0; i < mFM_VISIBLE_BLOCK_NUM; i++) {
bg_item->common.draw_table[i].draw_data.val = bIT_DRAW_TYPE_MAX - 1;
bg_item->common.draw_table[i].draw_data.idx_p = bg_item->item_idx_info[i].idx;
}
common_info->pos_table_p = pos_table;
bg_item_common_chg_BGDataR(common);
bg_item_common_construct(game, common);
}
static void bWI_actor_dt(ACTOR* actorx, GAME* game) {
BG_ITEM_ACTOR* bg_item = (BG_ITEM_ACTOR*)actorx;
bg_item_common_destruct((GAME_PLAY*)game, actorx, &bg_item->common);
bIT_clip_dt();
}
#include "../src/bg_winter_item_move.c_inc"
#include "../src/bg_winter_item_draw.c_inc"
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
static void bWI_actor_draw(ACTOR* actorx, GAME* game) {
BG_ITEM_ACTOR* bg_item = (BG_ITEM_ACTOR*)actorx;
GAME_PLAY* play = (GAME_PLAY*)game;
bg_item_common_draw(play, &bg_item->common, draw_part_table_a);
}
+36
View File
@@ -0,0 +1,36 @@
static bg_item_type_data_c* type_data_table_p_a[bIT_TYPE_CAT_NUM] = {
typeData_table_bgWinterItem, typeData_table_bgWinterItem2, typeData_table_ftr,
typeData_table_item1, typeData_table_crack, typeData_table_dummy,
};
static int bg_winter_item_talking_display_limit_check(int idx) {
int res = FALSE;
if ((idx >= bIT_DRAW_TYPE_TREE2 && idx <= bIT_DRAW_TYPE_TREE4_BG) ||
(idx >= bIT_DRAW_TYPE_PALM002 && idx <= bIT_DRAW_TYPE_PALM004_CC) ||
(idx >= bIT_DRAW_TYPE_CEDAR002 && idx <= bIT_DRAW_TYPE_CEDAR004) ||
(idx >= bIT_DRAW_TYPE_GOLD_TREE002 && idx <= bIT_DRAW_TYPE_GOLD_TREE004) || idx == bIT_DRAW_TYPE_NOTICE ||
idx == bIT_DRAW_TYPE_MAPBOARD || idx == bIT_DRAW_TYPE_MELODY) {
res = TRUE;
}
return res;
}
static void bWI_actor_move(ACTOR* actorx, GAME* game) {
BG_ITEM_ACTOR* bg_item = (BG_ITEM_ACTOR*)actorx;
GAME_PLAY* play = (GAME_PLAY*)game;
bg_item_common_c* common = &bg_item->common;
bg_item_common_info_c* common_info = &common->common_info;
common_info->type_data_table_p = type_data_table_p_a;
common_info->pos_table_p = pos_table;
common->flags = 0;
if (Camera2_CheckCullingMode() != FALSE) {
common->flags |= 1;
}
common->talk_display_limit_check_proc = &bg_winter_item_talking_display_limit_check;
bg_item_common_move(play, actorx, common);
}