Skip to content

Commit

Permalink
fix actor spawner
Browse files Browse the repository at this point in the history
  • Loading branch information
TakaRikka committed Sep 16, 2024
1 parent 82c82fb commit f7d3969
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 4 deletions.
3 changes: 3 additions & 0 deletions external/libtp_c/include/f_op/f_op_actor_mng.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ LIBTP_DEFINE_FUNC(fopAcM_seenActorAngleY__FPC10fopAc_ac_cPC10fopAc_ac_c, fopAcM_
LIBTP_DEFINE_FUNC(gndCheck__11fopAcM_gc_cFPC4cXyz, fopAcM_gc_c__gndCheck_cXyz_const___,
bool, fopAcM_gc_c__gndCheck, (const cXyz*))

LIBTP_DEFINE_FUNC(fopAcM_CreateAppend__Fv, fopAcM_CreateAppend_void_,
fopAcM_prm_class*, fopAcM_CreateAppend, (void))

#define tp_fopAcM_gc_c__mGroundY_addr 0x80450cd0
#define tp_fopAcM_gc_c__mGroundY (*(f32*)(tp_fopAcM_gc_c__mGroundY_addr))

Expand Down
31 changes: 31 additions & 0 deletions external/libtp_c/include/f_pc/f_pc_create_req.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

#ifndef F_PC_CREATE_REQ_H_
#define F_PC_CREATE_REQ_H_

#include "../SSystem/SComponent/c_phase.h"
#include "f_pc_create_tag.h"
#include "f_pc_method.h"
#include "f_pc_method_tag.h"

typedef struct base_process_class base_process_class;
typedef struct layer_class layer_class;

typedef struct create_request_method_class {
cPhs__Handler mpHandler;
process_method_func mpCancel;
process_method_func mpDelete;
} create_request_method_class;

typedef struct create_request {
create_tag mBase;
s8 mbIsCreating;
s8 mbIsCancelling;
process_method_tag_class mMtdTg;
create_request_method_class* mpCtRqMtd;
void* mpUnk1;
s32 mBsPcId;
struct base_process_class* mpRes;
layer_class* mpLayer;
} create_request; // Size: 0x48

#endif
14 changes: 14 additions & 0 deletions external/libtp_c/include/f_pc/f_pc_create_tag.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

#ifndef F_PC_CREATE_TAG_H_
#define F_PC_CREATE_TAG_H_

#include "../SSystem/SComponent/c_list.h"
#include "../SSystem/SComponent/c_tag.h"

typedef struct create_tag {
create_tag_class mBase;
} create_tag;

extern "C" node_list_class g_fpcCtTg_Queue;

#endif
3 changes: 3 additions & 0 deletions external/libtp_c/include/f_pc/f_pc_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ typedef struct layer_class {
} counts;
} layer_class;

LIBTP_DEFINE_FUNC(fpcLy_CurrentLayer__Fv, fpcLy_CurrentLayer_void_,
layer_class*, fpcLy_CurrentLayer, (void))

#endif
22 changes: 22 additions & 0 deletions external/libtp_c/include/f_pc/f_pc_stdcreate_req.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef F_PC_STDCREATE_H_
#define F_PC_STDCREATE_H_

#include "f_pc_create_req.h"

typedef struct layer_class layer_class;

typedef int (*stdCreateFunc)(void*, void*);

typedef struct standard_create_request_class {
/* 0x00 */ create_request mBase;
/* 0x48 */ request_of_phase_process_class unk_0x48;
/* 0x50 */ s16 mLoadID;
/* 0x54 */ void* unk_0x54;
/* 0x58 */ stdCreateFunc unk_0x58;
/* 0x5C */ void* unk_0x5C;
} standard_create_request_class;

LIBTP_DEFINE_FUNC(fpcSCtRq_Request__FP11layer_classsPFPvPv_iPvPv, fpcSCtRq_Request_layer_class____short__int_____void____void_____void____void___,
int, fpcSCtRq_Request, (layer_class*, s16, stdCreateFunc, void*, void*))

#endif
18 changes: 14 additions & 4 deletions modules/menus/menu_actor_spawn/src/actor_spawn_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "settings.h"
#include "libtp_c/include/d/com/d_com_inf_game.h"
#include "libtp_c/include/f_op/f_op_actor_mng.h"
#include "libtp_c/include/f_pc/f_pc_stdcreate_req.h"
#include "libtp_c/include/m_Do/m_Do_printf.h"
#include "gz_flags.h"
#include "pos_settings.h"
Expand Down Expand Up @@ -57,10 +58,19 @@ KEEP_FUNC ActorSpawnMenu::ActorSpawnMenu(ActorSpawnData& data)

ActorSpawnMenu::~ActorSpawnMenu() {}

void actorFastCreateAtLink(short id, uint32_t parameters, int8_t subtype) {
fopAcM_create(id, parameters, &dComIfGp_getPlayer()->current.pos,
dComIfGp_getPlayer()->current.roomNo, &dComIfGp_getPlayer()->current.angle,
nullptr, subtype);
void actorFastCreateAtLink(s16 id, u32 parameters, s8 subtype) {
fopAcM_prm_class* appen = fopAcM_CreateAppend();
if (appen != NULL) {
appen->mParameter = parameters;
appen->mPos = dComIfGp_getPlayer()->current.pos;
appen->mAngle = dComIfGp_getPlayer()->current.angle;
appen->mEnemyNo = 0xFFFF;
appen->mSubtype = subtype;
appen->mRoomNo = dComIfGp_getPlayer()->current.roomNo;

layer_class* curLayer = fpcLy_CurrentLayer();
fpcSCtRq_Request(curLayer, id, nullptr, nullptr, appen);
}
}

void ActorSpawnMenu::loadActorName(s16& i_procName) {
Expand Down

0 comments on commit f7d3969

Please sign in to comment.