Merge branch 'master' into m_all_grow_ovl

This commit is contained in:
Cuyler36
2023-08-22 06:32:51 -04:00
committed by GitHub
13 changed files with 356 additions and 11 deletions
+122
View File
@@ -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
View File
@@ -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),
+44
View File
@@ -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
View File
@@ -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();
}