Link ac_npc_shop_master, implement & link ac_npc_mamedanuki

This commit is contained in:
Cuyler36
2024-12-28 06:05:31 -05:00
parent 721de07972
commit 59aee0fafa
12 changed files with 2052 additions and 189 deletions
+168
View File
@@ -0,0 +1,168 @@
#include "ac_npc_mamedanuki.h"
#include "m_shop.h"
#include "m_common_data.h"
#include "m_font.h"
#include "m_msg.h"
#include "m_private.h"
#include "m_string.h"
#include "m_actor_type.h"
#include "m_player_lib.h"
#include "m_mail_password_check.h"
#include "m_actor.h"
#include "m_actor_type.h"
#include "m_camera2.h"
#include "m_house.h"
#include "m_melody.h"
#include "m_scene.h"
#include "m_collision_bg.h"
#include "m_demo.h"
#include "m_player.h"
#include "m_bgm.h"
#include "ac_npc.h"
#include "ac_uki.h"
#include "ac_npc_anim_def.h"
#define aNSC_MAMEDANUKI
enum {
aNMD_SALE_TYPE_NORMAL,
aNMD_SALE_TYPE_FTR,
aNMD_SALE_TYPE_CLOTH,
aNMD_SALE_TYPE_CARPET,
aNMD_SALE_TYPE_NUM
};
void aNMD_actor_ct(ACTOR* mamedanuki, GAME* game);
void aNMD_actor_dt(ACTOR* actorx, GAME* game);
void aNMD_actor_move(ACTOR* actorx, GAME* game);
void aNMD_actor_draw(ACTOR* actorx, GAME* game);
void aNMD_actor_init(ACTOR* actorx, GAME* game);
void aNMD_actor_save(ACTOR* actorx, GAME* game);
// clang-format off
ACTOR_PROFILE Npc_Mamedanuki_Profile = {
mAc_PROFILE_NPC_MAMEDANUKI,
ACTOR_PART_NPC,
ACTOR_STATE_NONE,
SP_NPC_MAMEDANUKI0,
ACTOR_OBJ_BANK_KEEP,
sizeof(NPC_MAMEDANUKI_ACTOR),
&aNMD_actor_ct,
&aNMD_actor_dt,
&aNMD_actor_init,
mActor_NONE_PROC1,
&aNMD_actor_save,
};
// clang-format on
// TODO: are these declared in every file? DnM+ says they're static yet they seemingly must be defined after their usage...
static void aNSC_setupAction(NPC_SHOP_COMMON_ACTOR *mamedanuki, GAME_PLAY* play, int p3);
static int aNSC_check_buy_item_sub(u32 *p1, mActor_name_t itm_name);
static int aNSC_check_buy_paper(u32 *p1, mActor_name_t itm_name);
static void aNSC_init_proc(NPC_SHOP_COMMON_ACTOR *mamedanuki, GAME_PLAY * play, int p3);
static void aNSC_BGcheck(ACTOR* actorx);
static void aNSC_set_zone_data(NPC_SHOP_COMMON_ACTOR* mamedanuki, ACTOR* actor);
static void aNSC_set_player_angl(NPC_SHOP_COMMON_ACTOR* mamedanuki);
static void aNSC_talk_demo_proc(ACTOR* actorx);
static void aNSC_sell_camera(NPC_SHOP_COMMON_ACTOR* mamedanuki, GAME_PLAY* play);
static ACTOR* aNMD_actor_p[2];
static int aNMD_selectIdx = 0;
void aNMD_actor_ct(ACTOR* actorx, GAME* game) {
// clang-format off
static aNPC_ct_data_c ct_data = {
&aNMD_actor_move,
&aNMD_actor_draw,
0,
NULL,
NULL,
NULL,
1,
};
// clang-format on
static int start_act_idx[] = { 0, 1 }; // TODO: figure out how the hell to define this with enums
// clang-format off
static u8 special_sale_type[mSP_KIND_MAX] = {
aNMD_SALE_TYPE_FTR,
aNMD_SALE_TYPE_NORMAL,
aNMD_SALE_TYPE_CLOTH,
aNMD_SALE_TYPE_CARPET,
aNMD_SALE_TYPE_CARPET,
};
// clang-format on
NPC_MAMEDANUKI_ACTOR* mamedanuki = (NPC_MAMEDANUKI_ACTOR*)actorx;
int action;
CLIP(npc_clip)->ct_proc(actorx, game, &ct_data);
mamedanuki->npc_class.draw.main_animation.keyframe.morph_counter = 0.0f;
mamedanuki->sell_item = EMPTY_NO;
mamedanuki->npc_class.condition_info.hide_flg = FALSE;
mamedanuki->talk_start_tim = -1;
actorx->shape_info.draw_shadow = TRUE;
actorx->shape_info.rotation.y = DEG2SHORT_ANGLE2(180.0f);
actorx->world.angle.y = DEG2SHORT_ANGLE2(180.0f);
mamedanuki->npc_class.collision.pipe.attribute.pipe.radius = 20;
{
u8 sale_type = aNMD_SALE_TYPE_NORMAL;
if (Common_Get(tanuki_shop_status) == mSP_TANUKI_SHOP_STATUS_EVENT) {
int sale_kind = mSP_WhatSpecialSale();
if (sale_kind >= 0 && sale_kind <= mSP_KIND_WALLPAPER) {
sale_type = special_sale_type[sale_kind];
}
}
mamedanuki->sale_type = sale_type;
}
if (Common_Get(door_data).door_actor_name == RSV_NO) {
mamedanuki->npc_class.talk_info.melody_inst = 0;
action = 61;
} else {
action = start_act_idx[actorx->npc_id != SP_NPC_MAMEDANUKI0];
}
{
int idx;
if (actorx->npc_id == SP_NPC_MAMEDANUKI1) {
idx = 1;
} else {
idx = 0;
}
aNMD_actor_p[idx] = actorx;
aNSC_setupAction(mamedanuki, (GAME_PLAY*)game, action);
aNMD_selectIdx = 0;
}
}
void aNMD_actor_save(ACTOR* actorx, GAME* game) {
(CLIP(npc_clip)->save_proc)(actorx, game);
}
void aNMD_actor_dt(ACTOR* actorx, GAME* game) {
(CLIP(npc_clip)->dt_proc)(actorx, game);
}
void aNMD_actor_init(ACTOR* actorx, GAME* game) {
(CLIP(npc_clip)->init_proc)(actorx, game);
}
void aNMD_actor_draw(ACTOR* actorx, GAME* game) {
(CLIP(npc_clip)->draw_proc)(actorx, game);
}
static u8 aNMD_get_zone(NPC_MAMEDANUKI_ACTOR* mamedanuki, xyz_t wpos);
static u8 aNMD_get_next_zone(NPC_MAMEDANUKI_ACTOR* mamedanuki, u8 p1, u8 p2);
static void aNMD_search_player(NPC_MAMEDANUKI_ACTOR* mamedanuki, GAME_PLAY* play);
static void aNMD_search_player2(NPC_MAMEDANUKI_ACTOR* mamedanuki, GAME_PLAY* play);
#include "../src/actor/npc/ac_npc_mamedanuki_move.c_inc"
+71
View File
@@ -0,0 +1,71 @@
{ aNPC_ANIM_WAIT1, FALSE },
{ aNPC_ANIM_WALK1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WALK1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_TRANSFER1, TRUE },
{ aNPC_ANIM_TRANS_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, FALSE },
{ aNPC_ANIM_WALK1, FALSE },
{ aNPC_ANIM_WALK1, FALSE },
{ aNPC_ANIM_RUN1, FALSE },
{ aNPC_ANIM_RUN1, FALSE },
{ aNPC_ANIM_WALK1, FALSE },
{ aNPC_ANIM_WAIT1, FALSE },
{ aNPC_ANIM_WAIT1, FALSE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, FALSE },
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -30,10 +30,6 @@ void aNSM_actor_draw(ACTOR* actorx, GAME* game);
void aNSM_actor_init(ACTOR* actorx, GAME* game);
void aNSM_actor_save(ACTOR* actorx, GAME* game);
static void aNSM_talk_request(ACTOR* actorx, GAME* game);
static int aNSM_talk_init(ACTOR* actorx, GAME* game);
static int aNSM_talk_end_chk(ACTOR* actorx, GAME* game);
// clang-format off
ACTOR_PROFILE Npc_Shop_Master_Profile = {
mAc_PROFILE_NPC_SHOP_MASTER,
@@ -42,6 +38,11 @@ ACTOR_PROFILE Npc_Shop_Master_Profile = {
SP_NPC_SHOP_MASTER,
ACTOR_OBJ_BANK_KEEP,
sizeof(NPC_SHOP_MASTER_ACTOR),
&aNSM_actor_ct,
&aNSM_actor_dt,
&aNSM_actor_init,
mActor_NONE_PROC1,
&aNSM_actor_save,
};
// clang-format on
@@ -58,7 +59,7 @@ static void aNSC_sell_camera(NPC_SHOP_MASTER_ACTOR* shop_master, GAME_PLAY* play
void aNSM_actor_ct(ACTOR* actorx, GAME* game) {
static aNPC_ct_data_c ct_data = {
&aNSM_actor_move, &aNSM_actor_draw, 0, &aNSM_talk_request, &aNSM_talk_init, &aNSM_talk_end_chk, TRUE,
&aNSM_actor_move, &aNSM_actor_draw, 0, NULL, NULL, NULL, 1,
};
NPC_SHOP_MASTER_ACTOR* shop_master = (NPC_SHOP_MASTER_ACTOR*)actorx;
@@ -74,7 +75,7 @@ void aNSM_actor_ct(ACTOR* actorx, GAME* game) {
if (Common_Get(door_data).door_actor_name == RSV_NO) {
shop_master->npc_class.talk_info.melody_inst = 0;
action = aNSC_ACTION_WAIT;
action = 61;
} else {
action = 0;
}
@@ -99,4 +100,3 @@ void aNSM_actor_draw(ACTOR* actorx, GAME* game) {
}
#include "../src/actor/npc/ac_npc_shop_master_move.c_inc"
#include "../src/actor/npc/ac_npc_shop_common.c"
+70
View File
@@ -0,0 +1,70 @@
{ aNPC_ANIM_WAIT1, FALSE },
{ aNPC_ANIM_WALK1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WALK1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WALK1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WALK1, TRUE },
{ aNPC_ANIM_TRANSFER1, TRUE },
{ aNPC_ANIM_TRANS_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_TRANSFER1, TRUE },
{ aNPC_ANIM_TRANS_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, FALSE },
{ aNPC_ANIM_WALK1, FALSE },
{ aNPC_ANIM_WALK1, FALSE },
{ aNPC_ANIM_RUN1, FALSE },
{ aNPC_ANIM_RUN1, FALSE },
{ aNPC_ANIM_WALK1, FALSE },
{ aNPC_ANIM_WAIT1, FALSE },
{ aNPC_ANIM_WAIT1, TRUE },
{ aNPC_ANIM_WAIT1, FALSE }
+21 -5
View File
@@ -1,12 +1,12 @@
static u8 aNSM_get_zone(xyz_t* wpos) {
if (wpos->x < 120.0f) {
if (wpos->z < 180.0f) {
static u8 aNSM_get_zone(xyz_t wpos) {
if (wpos.x < 120.0f) {
if (wpos.z < 180.0f) {
return aNSM_ZONE_1;
} else {
return aNSM_ZONE_2;
}
}
if (wpos->z < 160.0f) {
if (wpos.z < 160.0f) {
return aNSM_ZONE_0;
} else {
return aNSM_ZONE_3;
@@ -31,7 +31,7 @@ static void aNSM_search_player(NPC_SHOP_MASTER_ACTOR* shop_master, GAME_PLAY* pl
if (player != NULL) {
s16 angle = actorx->shape_info.rotation.y - shop_master->player_angle;
if (ABS(angle) > DEG2SHORT_ANGLE(90.0f)) {
aNSC_setupAction(shop_master, play, aNSC_ACTION_TURN);
aNSC_setupAction(shop_master, play, 66);
} else {
chase_angle(&actorx->shape_info.rotation.y, shop_master->player_angle, DEG2SHORT_ANGLE(11.25f));
actorx->world.angle.y = actorx->shape_info.rotation.y;
@@ -66,6 +66,22 @@ static int aNSM_check_safe_zone(NPC_SHOP_MASTER_ACTOR* shop_master, PLAYER_ACTOR
return res;
}
#define aNSC_get_zone aNSM_get_zone
#define aNSC_get_next_zone aNSM_get_next_zone
#define aNSC_check_safe_zone aNSM_check_safe_zone
#define aNSC_search_player aNSM_search_player
#define aNSC_search_player2 aNSM_search_player2
#define aNSC_ANIME_FILE "../src/actor/npc/ac_npc_shop_master_anime.c"
#include "../src/actor/npc/ac_npc_shop_common.c"
#undef aNSC_get_zone
#undef aNSC_get_next_zone
#undef aNSC_check_safe_zone
#undef aNSC_search_player
#undef aNSC_search_player2
#undef aNSC_ANIME_FILE
void aNSM_actor_move(ACTOR* actorx, GAME* game) {
NPC_SHOP_MASTER_ACTOR* shop_master = (NPC_SHOP_MASTER_ACTOR*)actorx;
GAME_PLAY* play = (GAME_PLAY*)game;