Implement & link ac_tama.c

This commit is contained in:
Cuyler36
2023-11-02 10:42:05 -04:00
parent c551a6d115
commit ac38c6d0a3
6 changed files with 102 additions and 0 deletions
+4
View File
@@ -511,6 +511,10 @@ ac_radio.c:
.text: [0x805B887C,0x805B8C7C]
.rodata: [0x8064AB58,0x8064AB68]
.data: [0x806C6558,0x806C65A0]
ac_tama.c:
.text: [0x805BDDF4, 0x805BE06C]
.rodata: [0x8064AC78, 0x8064AC80]
.data: [0x806C7110, 0x806C7140]
ac_structure.c:
.text: [0x805BCA00, 0x805BD06C]
.rodata: [0x8064AC30, 0x8064AC38]
+5
View File
@@ -3,11 +3,16 @@
#include "types.h"
#include "m_actor.h"
#include "ac_structure.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct tama_actor_s {
STRUCTURE_ACTOR structure_class;
} TAMA_ACTOR;
extern ACTOR_PROFILE Tama_Profile;
#ifdef __cplusplus
+1
View File
@@ -1649,6 +1649,7 @@ extern mActor_name_t bg_item_fg_sub_dig2take_conv(mActor_name_t item);
#define DUMMY_HANIWA2 (DUMMY_HANIWA1 + 1)
#define DUMMY_HANIWA3 (DUMMY_HANIWA2 + 1)
#define DUMMY_RADIO 0xF109
#define DUMMY_TAMA 0xF110
#define DUMMY_DOUZOU 0xF11D
#define RSV_DOOR 0xFE1B
+39
View File
@@ -0,0 +1,39 @@
#include "ac_tama.h"
#include "m_name_table.h"
#include "m_player_lib.h"
#include "m_field_info.h"
#include "m_demo.h"
#include "m_common_data.h"
#include "m_rcp.h"
#include "sys_matrix.h"
static void aTAM_actor_ct(ACTOR* actorx, GAME* game);
static void aTAM_actor_init(ACTOR* actorx, GAME* game);
static void aTAM_actor_draw(ACTOR* actorx, GAME* game);
ACTOR_PROFILE Tama_Profile = {
mAc_PROFILE_TAMA,
ACTOR_PART_ITEM,
ACTOR_STATE_TA_SET,
SPORTSFAIR_BALLS_RED,
ACTOR_OBJ_BANK_KEEP,
sizeof(TAMA_ACTOR),
&aTAM_actor_ct,
mActor_NONE_PROC1,
&aTAM_actor_init,
&aTAM_actor_draw,
NULL
};
static void aTAM_actor_ct(ACTOR* actorx, GAME* game) {
TAMA_ACTOR* tama = (TAMA_ACTOR*)actorx;
tama->structure_class.action = actorx->npc_id - SPORTSFAIR_BALLS_RED;
tama->structure_class.structure_type = aSTR_TYPE_SPORTSFAIR_A + tama->structure_class.action;
tama->structure_class.structure_pal = aSTR_PAL_KAGO_R + tama->structure_class.action;
}
#include "../rel/ac_tama_move.c_inc"
#include "../rel/ac_tama_draw.c_inc"
+27
View File
@@ -0,0 +1,27 @@
extern Gfx kago_r_ball_DL_model[];
extern Gfx kago_w_ball_DL_model[];
static void aTAM_actor_draw(ACTOR* actorx, GAME* game) {
static Gfx* model[2] = { kago_r_ball_DL_model, kago_w_ball_DL_model };
TAMA_ACTOR* tama = (TAMA_ACTOR*)actorx;
GRAPH* graph = game->graph;
u16* pal = (*Common_Get(clip).structure_clip->get_pal_segment_proc)(tama->structure_class.structure_pal);
Gfx* gfx;
Mtx* mtx;
OPEN_DISP(graph);
_texture_z_light_fog_prim(graph);
gfx = NOW_POLY_OPA_DISP;
gSPSegment(gfx++, G_MWO_SEGMENT_8, pal);
Matrix_translate(0.0f, 0.0f, 4000.0f, 1);
mtx = _Matrix_to_Mtx_new(graph);
if (mtx != NULL) {
gSPMatrix(gfx++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfx++, model[tama->structure_class.action]);
SET_POLY_OPA_DISP(gfx); // isn't this a bug? shouldn't this go outside of the if block?
}
CLOSE_DISP(graph);
}
+26
View File
@@ -0,0 +1,26 @@
static void aTAM_actor_move(ACTOR* actorx, GAME* game) {
GAME_PLAY* play = (GAME_PLAY*)game;
PLAYER_ACTOR* player = get_player_actor_withoutCheck(play);
int bx;
int bz;
int player_bx;
int player_bz;
mFI_Wpos2BlockNum(&bx, &bz, actorx->world.position);
mFI_Wpos2BlockNum(&player_bx, &player_bz, player->actor_class.world.position);
if (
mDemo_Check(mDemo_TYPE_SCROLL, &player->actor_class) == FALSE &&
mDemo_Check(mDemo_TYPE_SCROLL2, &player->actor_class) == FALSE &&
mDemo_Check(mDemo_TYPE_SCROLL3, &player->actor_class) == FALSE &&
(bx != player_bx || bz != player_bz)
) {
Actor_delete(actorx);
}
}
static void aTAM_actor_init(ACTOR* actorx, GAME* game) {
mFI_SetFG_common(DUMMY_TAMA, actorx->home.position, FALSE);
aTAM_actor_move(actorx, game);
actorx->mv_proc = &aTAM_actor_move;
}