Skip to content

Commit

Permalink
Implement & link ac_ghog
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuyler36 committed Dec 1, 2024
1 parent 2eb00c3 commit b732556
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 2 deletions.
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ def MatchingFor(*versions):
Object(Matching, "actor/ac_flag.c"),
Object(Matching, "actor/ac_fuusen.c"),
Object(Matching, "actor/ac_garagara.c"),
Object(NonMatching, "actor/ac_ghog.c"),
Object(Matching, "actor/ac_ghog.c"),
Object(Matching, "actor/ac_goza.c"),
Object(Matching, "actor/ac_groundhog_control.c"),
Object(Matching, "actor/ac_gyo_kage.c"),
Expand Down
4 changes: 3 additions & 1 deletion include/ac_ghog.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@

#include "types.h"
#include "m_actor.h"
#include "ac_structure.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef STRUCTURE_ACTOR GHOG_ACTOR;

extern ACTOR_PROFILE Ghog_Profile;

#ifdef __cplusplus
}
#endif

#endif

1 change: 1 addition & 0 deletions include/m_name_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -3291,6 +3291,7 @@ extern int mNT_check_unknown(mActor_name_t item_no);
#define DUMMY_FLAG 0xF122
#define DUMMY_COTTAGE_MY 0xF123
#define DUMMY_COTTAGE_NPC 0xF124
#define DUMMY_GHOG 0xF125
#define DUMMY_HTABLE 0xF126
#define DUMMY_TENT 0xF127
#define DUMMY_BOAT 0xF128
Expand Down
89 changes: 89 additions & 0 deletions src/actor/ac_ghog.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#include "ac_ghog.h"

#include "m_common_data.h"
#include "m_rcp.h"
#include "sys_matrix.h"

// clang-format off
static u8 aGhog_shadow_vtx_fix_flg_table[] = {
TRUE, FALSE, TRUE, FALSE,
FALSE, FALSE, TRUE, FALSE,
FALSE, TRUE,
};
// clang-format on

extern Vtx obj_e_ghog_shadow_v[];
extern Gfx obj_e_ghog_shadow_modelT[];

static bIT_ShadowData_c aGhog_shadow_data = {
ARRAY_COUNT(aGhog_shadow_vtx_fix_flg_table),
aGhog_shadow_vtx_fix_flg_table,
20.0f,
obj_e_ghog_shadow_v,
obj_e_ghog_shadow_modelT,
};

static void aGhog_actor_ct(ACTOR* actorx, GAME* game);
static void aGhog_actor_init(ACTOR* actorx, GAME* game);
static void aGhog_actor_draw(ACTOR* actorx, GAME* game);

// clang-format off
ACTOR_PROFILE Ghog_Profile = {
mAc_PROFILE_GHOG,
ACTOR_PART_ITEM,
ACTOR_STATE_TA_SET,
GHOG,
ACTOR_OBJ_BANK_KEEP,
sizeof(GHOG_ACTOR),
&aGhog_actor_ct,
mActor_NONE_PROC1,
&aGhog_actor_init,
&aGhog_actor_draw,
NULL,
};
// clang-format on

static void aGhog_set_bgOffset(ACTOR* actorx);

static void aGhog_actor_ct(ACTOR* actorx, GAME* game) {
aGhog_set_bgOffset(actorx);
}

static void aGhog_set_bgOffset(ACTOR* actorx) {
static const mCoBG_OffsetTable_c rewrite_data = { mCoBG_ATTRIBUTE_NONE, 2, 2, 2, 2, 2, 0 };
xyz_t pos = actorx->world.position;

pos.x += mFI_UT_WORLDSIZE_X_F;
mCoBG_SetPluss5PointOffset_file(actorx->world.position, rewrite_data, __FILE__, 163);
mCoBG_SetPluss5PointOffset_file(pos, rewrite_data, __FILE__, 164);
}

static void aGhog_actor_move(ACTOR* actorx, GAME* game) {
// nothing
}

static void aGhog_actor_init(ACTOR* actorx, GAME* game) {
mFI_SetFG_common(DUMMY_GHOG, actorx->home.position, FALSE);
aGhog_actor_move(actorx, game);
actorx->mv_proc = &aGhog_actor_move;
}

extern Gfx obj_e_ghog_model[];
extern Gfx obj_e_ghog_modelT[];

static void aGhog_actor_draw(ACTOR* actorx, GAME* game) {
GRAPH* graph = game->graph;

_texture_z_light_fog_prim_npc(graph);
_texture_z_light_fog_prim_shadow(graph);

OPEN_DISP(graph);

gSPMatrix(NEXT_POLY_OPA_DISP, _Matrix_to_Mtx_new(graph), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(NEXT_POLY_OPA_DISP, obj_e_ghog_modelT);
gSPDisplayList(NEXT_POLY_OPA_DISP, obj_e_ghog_model);

CLOSE_DISP(graph);

CLIP(bg_item_clip)->draw_shadow_proc(game, &aGhog_shadow_data, TRUE);
}

0 comments on commit b732556

Please sign in to comment.