mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
Merge branch 'master' into m_all_grow_ovl
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
executor.c:
|
||||
.text: [0x803702A8, 0x803703F8]
|
||||
.data: [0x8064D500, 0x8064D580]
|
||||
.bss: [0x8125A7C0, 0x8125A7C8]
|
||||
sys_vimgr.c:
|
||||
.text: [0x803703F8, 0x80370418]
|
||||
c_keyframe.c:
|
||||
@@ -159,6 +163,9 @@ m_time.c:
|
||||
m_skin_matrix.c:
|
||||
.text: [0x803f1528, 0x803f1bb4]
|
||||
.rodata: [0x80643310, 0x80643318]
|
||||
m_snowman.c:
|
||||
.text: [0x803F1BB4, 0x803F1F94]
|
||||
.rodata: [0x80643318, 0x80643330]
|
||||
m_view.c:
|
||||
.text: [0x803F3E58, 0x803F4E08]
|
||||
.rodata: [0x806433D8, 0x80643408]
|
||||
@@ -263,6 +270,10 @@ ac_set_ovl_insect.c:
|
||||
.rodata: [0x80644E00, 0x80644E28]
|
||||
.data: [0x8068CDE8, 0x8068E3C0]
|
||||
.bss: [0x812FD048, 0x812FD270]
|
||||
ac_t_pistol.c:
|
||||
.text: [0x804A95F4, 0x804A9858]
|
||||
.rodata: [0x80645EF8, 0x80645F00]
|
||||
.data: [0x8068EE98, 0x8068EEF8]
|
||||
ac_train_door.c:
|
||||
.text: [0x804AC2D8, 0x804AC510]
|
||||
.rodata: [0x80645F98, 0x80645FA8]
|
||||
|
||||
@@ -3,11 +3,27 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "m_actor.h"
|
||||
#include "libultra/ultratypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*PISTOL_PROC)(ACTOR*);
|
||||
|
||||
typedef struct t_pistol_s{
|
||||
ACTOR actor_class;
|
||||
int unk174;
|
||||
MtxF matrix_work;
|
||||
int enable;
|
||||
int unk1BC;
|
||||
int process_id;
|
||||
u8 pad2[0x8];
|
||||
PISTOL_PROC proc;
|
||||
int current_id;
|
||||
}PISTOL_ACTOR;
|
||||
|
||||
|
||||
extern ACTOR_PROFILE T_Pistol_Profile;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef EXECUTOR_H
|
||||
#define EXECUTOR_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
void _prolog();
|
||||
void _epilog();
|
||||
void _unresolved();
|
||||
|
||||
#endif
|
||||
@@ -33,8 +33,10 @@ typedef void (*mActor_proc)(ACTOR*, GAME*);
|
||||
#define ACTOR_OBJ_BANK_NONE 0
|
||||
#define ACTOR_OBJ_BANK_3 3 /* TODO: rename, also likely an enum */
|
||||
#define ACTOR_OBJ_BANK_7 7
|
||||
#define ACTOR_OBJ_BANK_10 10
|
||||
#define ACTOR_OBJ_BANK_11 11
|
||||
#define ACTOR_OBJ_BANK_12 12
|
||||
#define ACTOR_OBJ_BANK_16 16
|
||||
#define ACTOR_OBJ_BANK_41 41
|
||||
|
||||
enum actor_part {
|
||||
|
||||
@@ -190,7 +190,8 @@ typedef struct common_data_s {
|
||||
/* 0x0266A4 */ int scene_from_title_demo; /* next scene to be loaded when title demo finishes */
|
||||
/* 0x0266A8 */ mNPS_schedule_c npc_schedule[SCHEDULE_NUM];
|
||||
/* 0x0267A8 */ mNpc_walk_c npc_walk;
|
||||
/* 0x026838 */ u8 _26838[0x2852C - 0x26838];
|
||||
/* 0x026838 */ u8 _26838[0x28528 - 0x26838];
|
||||
/* 0x028528 */ int snowman_msg_id;
|
||||
/* 0x02852C */ s16 money_power;
|
||||
/* 0x02852E */ s16 goods_power;
|
||||
/* 0x028530 */ Door_data_c door_data; /* misc door data */
|
||||
|
||||
@@ -182,6 +182,7 @@ extern mActor_name_t bg_item_fg_sub_tree_grow(mActor_name_t tree, int past_days,
|
||||
#define MUSIC_BOARD0 0x000E
|
||||
#define MUSIC_BOARD1 0x000F
|
||||
|
||||
|
||||
#define BURIED_PITFALL0 0x002A
|
||||
|
||||
#define SHINE_SPOT 0x005C
|
||||
@@ -1189,6 +1190,15 @@ extern mActor_name_t bg_item_fg_sub_tree_grow(mActor_name_t tree, int past_days,
|
||||
#define ACTOR_PROP_HANIWA1 (ACTOR_PROP_HANIWA0 + 1)
|
||||
#define ACTOR_PROP_HANIWA2 (ACTOR_PROP_HANIWA1 + 1)
|
||||
#define ACTOR_PROP_HANIWA3 (ACTOR_PROP_HANIWA2 + 1)
|
||||
#define SNOWMAN0 (ACTOR_PROP_HANIWA3 + 1)
|
||||
#define SNOWMAN1 (SNOWMAN0 + 1)
|
||||
#define SNOWMAN2 (SNOWMAN1 + 1)
|
||||
#define SNOWMAN3 (SNOWMAN2 + 1)
|
||||
#define SNOWMAN4 (SNOWMAN3 + 1)
|
||||
#define SNOWMAN5 (SNOWMAN4 + 1)
|
||||
#define SNOWMAN6 (SNOWMAN5 + 1)
|
||||
#define SNOWMAN7 (SNOWMAN6 + 1)
|
||||
#define SNOWMAN8 (SNOWMAN7 + 1)
|
||||
#define TRAIN_DOOR 0xA011
|
||||
|
||||
#define SP_NPC_START 0xD000
|
||||
|
||||
+16
-2
@@ -2,6 +2,8 @@
|
||||
#define M_SNOWMAN_H
|
||||
|
||||
#include "types.h"
|
||||
#include "m_lib.h"
|
||||
#include "m_actor_type.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -22,8 +24,20 @@ typedef struct snowman_save_data_s {
|
||||
/* 0x00 */ mSN_snowman_data_c snowmen_data[mSN_SAVE_COUNT];
|
||||
} mSN_snowman_save_c;
|
||||
|
||||
extern int mSN_MeltSnowman(mActor_name_t* item, int past_days);
|
||||
extern int mSN_ClearSnowman(mActor_name_t* item);
|
||||
/* sizeof(mSN_snowman_info_c) == 0xC */
|
||||
typedef struct snowman_info_s{
|
||||
/* 0x00 */ int scale;
|
||||
/* 0x04 */ xyz_t pos;
|
||||
}mSN_snowman_info_c;
|
||||
|
||||
extern int mSN_check_life(mActor_name_t* ac, int idx);
|
||||
extern int mSN_ClearSnowmanData(mActor_name_t* ac, int idx);
|
||||
extern int mSN_ClearSnowman(mActor_name_t* ac);
|
||||
extern int mSN_MeltSnowman(mActor_name_t* ac, int days);
|
||||
extern int mSN_get_free_space();
|
||||
extern void mSN_regist_snowman_society(mSN_snowman_info_c* info);
|
||||
extern void mSN_decide_msg();
|
||||
extern void mSN_snowman_init();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ extern int ScreenHeight;
|
||||
extern OSThread graphThread;
|
||||
extern u8 SegmentBaseAddress[0x40];
|
||||
|
||||
void foresta_main();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
#include "ac_t_pistol.h"
|
||||
|
||||
#include "m_name_table.h"
|
||||
#include "sys_matrix.h"
|
||||
#include "m_lib.h"
|
||||
#include "m_rcp.h"
|
||||
|
||||
static void aTPT_actor_ct(ACTOR* actor, GAME* game);
|
||||
static void aTPT_actor_move(ACTOR* actor, GAME* game);
|
||||
static void aTPT_actor_draw(ACTOR* actor, GAME* game);
|
||||
|
||||
ACTOR_PROFILE T_Pistol_Profile = {
|
||||
mAc_PROFILE_T_PISTOL,
|
||||
ACTOR_PART_BG,
|
||||
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
|
||||
EMPTY_NO,
|
||||
ACTOR_OBJ_BANK_16,
|
||||
sizeof(PISTOL_ACTOR),
|
||||
&aTPT_actor_ct,
|
||||
NONE_ACTOR_PROC,
|
||||
&aTPT_actor_move,
|
||||
&aTPT_actor_draw,
|
||||
NULL
|
||||
};
|
||||
|
||||
static void aTPT_setupAction(ACTOR* actor, int idx);
|
||||
|
||||
extern Gfx tol_kenjyu_1T_model[];
|
||||
|
||||
static void aTPT_actor_ct(ACTOR* actor, GAME* game){
|
||||
aTPT_setupAction(actor, 1);
|
||||
}
|
||||
|
||||
static void aTPT_calc_scale(ACTOR* actor, int idx){
|
||||
|
||||
static f32 aim[] = {1.0f, 0.0f};
|
||||
f32 pistol_scale = actor->scale.x;
|
||||
|
||||
chase_f(&pistol_scale, aim[idx],0.05f);
|
||||
|
||||
actor->scale.x = pistol_scale;
|
||||
actor->scale.y = pistol_scale;
|
||||
actor->scale.z = pistol_scale;
|
||||
|
||||
}
|
||||
|
||||
static void aTPT_takeout(ACTOR* actor){
|
||||
|
||||
aTPT_calc_scale(actor, 0);
|
||||
}
|
||||
|
||||
static void aTPT_putaway(ACTOR* actor){
|
||||
|
||||
aTPT_calc_scale(actor, 1);
|
||||
}
|
||||
|
||||
static void aTPT_destruct(ACTOR* actor){
|
||||
|
||||
Actor_delete(actor);
|
||||
}
|
||||
|
||||
static void aTPT_setupAction(ACTOR* actor, int idx){
|
||||
PISTOL_ACTOR* pistol = (PISTOL_ACTOR*)actor;
|
||||
|
||||
static PISTOL_PROC process[] = {(PISTOL_PROC)none_proc1, aTPT_takeout,aTPT_putaway,aTPT_destruct,
|
||||
(PISTOL_PROC)none_proc1,NULL};
|
||||
static f32 start_scale[] = {0.0f, 0.0f, 1.0f,1.0f,1.0f,0.0f,0.0f};
|
||||
f32 scale;
|
||||
|
||||
pistol->proc = process[idx];
|
||||
pistol->current_id = idx;
|
||||
pistol->process_id = idx;
|
||||
|
||||
scale = start_scale[idx];
|
||||
pistol->actor_class.scale.x = scale;
|
||||
pistol->actor_class.scale.y = scale;
|
||||
pistol->actor_class.scale.z = scale;
|
||||
|
||||
}
|
||||
|
||||
static void aTPT_actor_move(ACTOR* actor, GAME* game){
|
||||
PISTOL_ACTOR* pistol = (PISTOL_ACTOR*)actor;
|
||||
|
||||
int t = pistol->process_id;
|
||||
if(t!= pistol->current_id){
|
||||
aTPT_setupAction(actor, t);
|
||||
}
|
||||
pistol->proc(actor);
|
||||
}
|
||||
|
||||
static void aTPT_actor_draw(ACTOR* actor, GAME* game){
|
||||
PISTOL_ACTOR* pistol = (PISTOL_ACTOR*)actor;
|
||||
|
||||
GRAPH* graph = game->graph;
|
||||
Gfx* gfxp;
|
||||
|
||||
OPEN_DISP(graph);
|
||||
|
||||
if(pistol->enable == 1){
|
||||
Matrix_put(&pistol->matrix_work);
|
||||
Matrix_Position_Zero(&pistol->actor_class.world.position);
|
||||
pistol->enable = 0;
|
||||
}
|
||||
else{
|
||||
Matrix_translate(pistol->actor_class.world.position.x, pistol->actor_class.world.position.y,
|
||||
pistol->actor_class.world.position.z, FALSE);
|
||||
Matrix_scale(0.01f, 0.01f, 0.01f, TRUE);
|
||||
}
|
||||
|
||||
Matrix_scale(pistol->actor_class.scale.x, pistol->actor_class.scale.y, pistol->actor_class.scale.z, TRUE);
|
||||
_texture_z_light_fog_prim_npc(graph);
|
||||
|
||||
gfxp = NOW_POLY_OPA_DISP;
|
||||
gSPMatrix(gfxp++, _Matrix_to_Mtx_new(graph),G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfxp++, tol_kenjyu_1T_model);
|
||||
SET_POLY_OPA_DISP(gfxp);
|
||||
|
||||
CLOSE_DISP(graph);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ static void aTR0_actor_draw(ACTOR* actor, GAME* game);
|
||||
ACTOR_PROFILE Train0_Profile = {
|
||||
mAc_PROFILE_TRAIN0,
|
||||
ACTOR_PART_ITEM,
|
||||
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | 1 << 11 | ACTOR_STATE_NO_MOVE_WHILE_CULLED, //figure out flag 0x800
|
||||
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | ACTOR_STATE_TA_SET | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
|
||||
TRAIN0,
|
||||
ACTOR_OBJ_BANK_3,
|
||||
sizeof(TRAIN0_ACTOR),
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#include "executor.h"
|
||||
|
||||
#include "dolphin/os/__ppc_eabi_init.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "dolphin/os/OSContext.h"
|
||||
#include "terminal.h"
|
||||
#include "main.h"
|
||||
|
||||
BOOL construct_skip;
|
||||
|
||||
void _prolog() {
|
||||
voidfunctionptr *constructor;
|
||||
|
||||
/* call static initializers */
|
||||
if (!construct_skip) {
|
||||
for (constructor = _ctors; *constructor; constructor++) {
|
||||
(*constructor)();
|
||||
}
|
||||
}
|
||||
foresta_main();
|
||||
}
|
||||
|
||||
void _epilog() {
|
||||
voidfunctionptr *destructor;
|
||||
|
||||
/* call static destructors */
|
||||
for (destructor = _dtors; *destructor; destructor++) {
|
||||
(*destructor)();
|
||||
}
|
||||
}
|
||||
|
||||
void _unresolved() {
|
||||
u32 i;
|
||||
u32* p;
|
||||
|
||||
OSReport(VT_COL(RED, WHITE) "\nError: A called an unlinked function.\n");
|
||||
OSReport("Address: Back Chain LR Save\n");
|
||||
|
||||
for (i = 0, p = (u32*)OSGetStackPointer(); p && (u32)p != 0xffffffff && i++ < 16; p = (u32*)*p) {
|
||||
OSReport("0x%08x: 0x%08x 0x%08x\n", p, p[0], p[1]);
|
||||
}
|
||||
|
||||
OSReport("\n" VT_RST "\n");
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
#include "m_snowman.h"
|
||||
|
||||
#include "m_common_data.h"
|
||||
#include "libultra/libultra.h"
|
||||
#include "m_field_info.h"
|
||||
#include "m_police_box.h"
|
||||
#include "m_name_table.h"
|
||||
#include "m_time.h"
|
||||
|
||||
|
||||
extern int mSN_check_life(mActor_name_t* ac, int idx){
|
||||
int ret = 0;
|
||||
|
||||
if(Common_Get(time.season) == mTM_SEASON_WINTER){
|
||||
if((((*ac - SNOWMAN0) % 3) + idx) < mSN_SAVE_COUNT){
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern int mSN_ClearSnowmanData(mActor_name_t* ac, int idx){
|
||||
|
||||
bzero(Save_GetPointer(snowmen.snowmen_data[idx]), sizeof(mSN_snowman_data_c));
|
||||
*ac = 0;
|
||||
}
|
||||
|
||||
int mSN_ClearSnowman(u16* ac){
|
||||
int ret = 0;
|
||||
u32 snowId = *ac;
|
||||
|
||||
if((snowId >= SNOWMAN0) && (snowId <= SNOWMAN8)){
|
||||
mSN_ClearSnowmanData(ac, (int)(snowId - SNOWMAN0) / mSN_SAVE_COUNT);
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern int mSN_MeltSnowman(mActor_name_t* ac, int days){
|
||||
int ret;
|
||||
u32 snowId;
|
||||
int snowmelt;
|
||||
mSN_snowman_data_c* snowman;
|
||||
snowId = *ac;
|
||||
ret = 0;
|
||||
|
||||
if((snowId >= SNOWMAN0) && (snowId <= SNOWMAN8)){
|
||||
snowmelt = ((int)(snowId - SNOWMAN0) / mSN_SAVE_COUNT);
|
||||
if(days < 0){
|
||||
days = 1;
|
||||
Save_Set(snowman_year, 0);
|
||||
Save_Set(snowman_month, 0);
|
||||
Save_Set(snowman_day, 0);
|
||||
Save_Set(snowman_hour, 0);
|
||||
|
||||
}
|
||||
if(mSN_check_life(ac, days) == 0){
|
||||
mSN_ClearSnowmanData(ac, snowmelt);
|
||||
}
|
||||
else{
|
||||
snowman = Save_GetPointer(snowmen.snowmen_data[snowmelt]);
|
||||
*ac += days;
|
||||
for(; days != 0; days--){
|
||||
snowman->head_size = 0.8f * snowman->head_size;
|
||||
snowman->body_size = 0.8f * snowman->body_size;
|
||||
}
|
||||
}
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern int mSN_get_free_space(void){
|
||||
int ret = 0;
|
||||
int i;
|
||||
mSN_snowman_data_c* snowman = Save_GetPointer(snowmen.snowmen_data[0]);;
|
||||
|
||||
for(i = mSN_SAVE_COUNT; i != 0; i--){
|
||||
if(snowman->exists == 0){
|
||||
return ret;
|
||||
}
|
||||
snowman++;
|
||||
ret++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern void mSN_regist_snowman_society(mSN_snowman_info_c* info){
|
||||
|
||||
xyz_t spos = info->pos;
|
||||
mActor_name_t ac = *mFI_GetUnitFG(spos);
|
||||
int snowId = mSN_get_free_space();
|
||||
xyz_t npos;
|
||||
xyz_t ypos;
|
||||
if(snowId != -1){
|
||||
mem_copy((u8*)Save_GetPointer(snowmen.snowmen_data[snowId]), (u8*)info, 4);
|
||||
if(ac != 0){
|
||||
mPB_keep_item(ac);
|
||||
npos = info->pos;
|
||||
mFI_Wpos2DepositOFF(npos);
|
||||
}
|
||||
ypos = info->pos;
|
||||
mFI_SetFG_common((u16)(snowId * mSN_SAVE_COUNT + SNOWMAN0),info->pos,1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern void mSN_decide_msg(){
|
||||
|
||||
Common_Set(snowman_msg_id, fqrand() * 3.0f);
|
||||
}
|
||||
|
||||
extern void mSN_snowman_init(){
|
||||
|
||||
bzero(Save_GetPointer(snowmen), sizeof(mSN_snowman_save_c));
|
||||
mSN_decide_msg();
|
||||
}
|
||||
@@ -1,17 +1,13 @@
|
||||
#include "types.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "dolphin/PPCArch.h"
|
||||
|
||||
#include "dolphin/os/__ppc_eabi_init.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef void (*voidfunctionptr)(void); // pointer to function returning void
|
||||
__declspec(section ".ctors") extern voidfunctionptr _ctors[];
|
||||
__declspec(section ".dtors") extern voidfunctionptr _dtors[];
|
||||
|
||||
static void __init_cpp(void);
|
||||
|
||||
// clang-format off
|
||||
__declspec(section ".init") asm void __init_hardware(void) {
|
||||
nofralloc
|
||||
mfmsr r0
|
||||
@@ -24,7 +20,7 @@ __declspec(section ".init") asm void __init_hardware(void) {
|
||||
blr
|
||||
}
|
||||
|
||||
__declspec(section ".init") asm void __flush_cache(void) {
|
||||
__declspec(section ".init") asm void __flush_cache(void*, size_t) {
|
||||
nofralloc
|
||||
lis r5, 0xFFFFFFF1@h
|
||||
ori r5, r5, 0xFFFFFFF1@l
|
||||
@@ -41,7 +37,6 @@ loop:
|
||||
isync
|
||||
blr
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
|
||||
void __init_user(void) { __init_cpp(); }
|
||||
|
||||
Reference in New Issue
Block a user