label TTC actors

This commit is contained in:
Banjo Kazooie
2023-01-31 13:47:47 -06:00
parent 0be5904e28
commit e05358d82f
36 changed files with 208 additions and 179 deletions

View File

@@ -6,7 +6,7 @@ extern void func_8028E668(f32 [3], f32, f32, f32);
extern void func_8028F9DC(s32);
extern void func_803272D0(f32 arg0[3], f32 arg1, s32 arg2, int (*arg3)(Actor *));
void func_80388FBC(Actor *this);
void chLeaky_update(Actor *this);
/* .data */
ActorAnimationInfo D_8038C700[] = {
@@ -18,13 +18,13 @@ ActorAnimationInfo D_8038C700[] = {
ActorInfo D_8038C718 = {
MARKER_33_LEAKY, ACTOR_1E_LEAKY, ASSET_51A_MODEL_LEAKY,
0x1, D_8038C700,
func_80388FBC, func_80326224, func_80325888,
chLeaky_update, func_80326224, func_80325888,
0, 0, 0.0f, 0
};
/* .code */
bool TTC_func_80388F70(Actor *this){
return this->modelCacheIndex == 0x56;
return this->modelCacheIndex == ACTOR_56_SHRAPNEL;
}
void func_80388F88(void){
@@ -32,7 +32,7 @@ void func_80388F88(void){
func_803272D0(D_8038C73C, 2000.0f, 2, TTC_func_80388F70);
}
void func_80388FBC(Actor *this) {
void chLeaky_update(Actor *this) {
void *temp_v0_2;
func_8028E668(this->position, 100.0f, -20.0f, 100.0f);
@@ -80,7 +80,7 @@ void func_80388FBC(Actor *this) {
}
}
void func_80389288(ActorMarker *caller, enum asset_e text_id, s32 arg2){
void __chLeaky_startCutscene(ActorMarker *caller, enum asset_e text_id, s32 arg2){
Actor *this = marker_getActor(caller);
Struct73s *temp_v0;
func_80328A84(this, 2);
@@ -98,7 +98,7 @@ void func_80389288(ActorMarker *caller, enum asset_e text_id, s32 arg2){
func_803228D8();
}
bool func_80389364(ActorMarker *marker){
bool chLeaky_eggCollision(ActorMarker *marker){
Actor *this = marker_getActor(marker);
if(levelSpecificFlags_get(2))
@@ -111,6 +111,6 @@ bool func_80389364(ActorMarker *marker){
levelSpecificFlags_set(2, TRUE);
levelSpecificFlags_set(5, TRUE);
func_80311480(0xa28, 0x2a, this->position, this->marker, func_80389288, NULL);
func_80311480(ASSET_A28_TEXT_LEAKY_DONE, 0x2a, this->position, this->marker, __chLeaky_startCutscene, NULL);
return TRUE;
}

View File

@@ -790,12 +790,12 @@ f32 func_80257CF8(f32 a, f32 b, f32 c, f32 d, f32 e)
return func_80257C60(a, b, c, d, e, func_80257658);
}
f32 func_80257D30(f32 a, f32 b, f32 c, f32 d, f32 e)
f32 ml_mapRange_f(f32 val, f32 in_min, f32 in_max, f32 out_min, f32 out_max)
{
if (a < 0)
return ml_map_f(a, -b, -c, -d, -e);
if (val < 0)
return ml_map_f(val, -in_min, -in_max, -out_min, -out_max);
else
return ml_map_f(a, b, c, d, e);
return ml_map_f(val, in_min, in_max, out_min, out_max);
}
void func_80257DB0(f32 arg0[3], f32 arg1[3], f32 arg2[3])

View File

@@ -103,7 +103,7 @@ s32 *__baMarker_8028B750(void){
void __baMarker_8028B7F4(void){
yaw_setIdeal(func_8029B41C());
func_802991A8(1);
yaw_setUpdateState(1);
func_8029957C(3);
func_802978DC(2);
func_80297970(0.0f);

View File

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "core2/yaw.h"
void func_80293D48(f32,f32);
@@ -77,7 +78,7 @@ int bsant_inSet(s32 move_indx){
void bsant_idle_init(void){
func_8029E554();
func_8028A010(ASSET_5E_ANIM_BSANT_IDLE, 1.2f);
func_8029C7F4(1,1,1,2);
func_8029C7F4(1,YAW_STATE_1_DEFAULT,1,2);
func_80297970(0.0f);
pitch_setAngVel(1000.0f, 12.0f);
roll_setAngularVelocity(1000.0f, 12.0f);
@@ -113,7 +114,7 @@ void bsant_idle_end(void){
void bsant_walk_init(void){
func_8029E554();
func_8028A010(ASSET_5F_ANIM_BSANT_WALK, 0.8f);
func_8029C7F4(2,1,1,2);
func_8029C7F4(2,YAW_STATE_1_DEFAULT,1,2);
func_80289EC8(D_80364960, D_80364964, D_80364968, D_8036496C);
func_802900B4();
}
@@ -159,7 +160,7 @@ void bsant_jump_init(void){
animctrl_setSubRange(aCtrl, 0.0f, 0.4423f);
animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE);
func_802875AC(aCtrl, "bsant.c", 0x17c);
func_8029C7F4(1,1,3,6);
func_8029C7F4(1,YAW_STATE_1_DEFAULT,3,6);
if(func_8029B2E8() != 0.0f)
yaw_setIdeal(func_8029B33C());
func_8029797C(yaw_getIdeal());
@@ -237,7 +238,7 @@ void bsant_fall_init(void){
func_8028774C(aCtrl, 0.4423f);
animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED);
func_802875AC(aCtrl, "bsant.c", 0x208);
func_8029C7F4(1,1,3,6);
func_8029C7F4(1,YAW_STATE_1_DEFAULT,3,6);
D_8037D294 = 0;
}
@@ -301,7 +302,7 @@ static void __bsant_recoil_init(int take_damage){
func_80297970(200.0f);
func_8029797C(sp38);
func_802979AC(sp38, func_80297A64());
func_8029C7F4(1,1,2,3);
func_8029C7F4(1,YAW_STATE_1_DEFAULT,2,3);
player_setYVelocity(510.0f);
gravity_set(-1200.0f);
baMarker_collisionOff();
@@ -388,7 +389,7 @@ void bsant_die_init(void){
func_80297970(D_8037D290);
func_8029797C(sp38);
func_802979AC(sp38, func_80297A64());
func_8029C7F4(1,1,2,3);
func_8029C7F4(1,YAW_STATE_1_DEFAULT,2,3);
player_setYVelocity(510.0f);
gravity_set(-1200.0f);
pitch_setAngVel(1000.0f, 12.0f);
@@ -448,7 +449,7 @@ void bsant_die_end(void){
void func_8029F398(void){
func_8029E554();
func_8028A010(ASSET_5E_ANIM_BSANT_IDLE, 2.0f);
func_8029C7F4(1,1,3,2);
func_8029C7F4(1,YAW_STATE_1_DEFAULT,3,2);
func_80297970(0.0f);
func_8029C674();
func_802B3A50();

View File

@@ -10,7 +10,7 @@ u8 D_8037D2E1;
void bseggass_init(void){
func_8028A274(ASSET_2B_ANIM_BSEGGASS, 1.0f);
func_8029C7F4(1,3,1,3);
func_80299234(350.0f, 14.0f);
yaw_setVelocityBounded(350.0f, 14.0f);
func_80297970(0.0f);
func_8029E058(1);
D_8037D2E0 = (D_8037D2E1 = 1);

View File

@@ -2,7 +2,7 @@
#include "functions.h"
#include "variables.h"
void func_80299234(f32, f32);
void yaw_setVelocityBounded(f32, f32);
void func_802875AC(AnimCtrl *, char*, s32);
/* .bss */
@@ -13,7 +13,7 @@ u8 D_8037D2F1;
void bsegghead_init(void){
func_8028A274(ASSET_2A_ANIM_BSEGGHEAD, 1.0f);
func_8029C7F4(1,3,1,3);
func_80299234(350.0f, 14.0f);
yaw_setVelocityBounded(350.0f, 14.0f);
func_80297970(0.0f);
func_8029E070(1);
D_8037D2F0 = (D_8037D2F1 = 1);

View File

@@ -73,12 +73,12 @@ void bsbflip_update(void){
case 0://L802A2FD4
if(animctrl_isAt(aCtrl, 0.1837f)){
if(func_8029B2E8() != 0.0f){
func_802991A8(2);
yaw_setUpdateState(2);
func_8029957C(3);
if(func_8029B2E8){ //!!! BUG !!!
yaw_setIdeal(func_8029B33C());
}
func_80299254(1.0f);
yaw_rotateTimed(1.0f);
func_802978DC(6);
func_8029797C(yaw_getIdeal());
func_80297970(200.0f);

View File

@@ -48,8 +48,8 @@ void func_802A3404(void){
void func_802A3430(void){
baModel_setYDisplacement(60.0f);
func_802991A8(3);
func_80299234(500.0f, 2.0f);
yaw_setUpdateState(3);
yaw_setVelocityBounded(500.0f, 2.0f);
roll_setAngularVelocity(500.0f, 2.0f);
func_802A33D8();
func_80293D48(60.0f, 45.0f);
@@ -65,7 +65,7 @@ void func_802A34C8(void){
func_8029E070(0);
baModel_setYDisplacement(0.0f);
func_8029CB84();
func_802991A8(1);
yaw_setUpdateState(1);
func_80291548();
func_80293D74();
func_80294378(1);
@@ -80,12 +80,12 @@ void func_802A354C(void){
sp2C = func_8029B2D0();
if(button_held(BUTTON_R)){
func_80299234(500.0f, 30.0f);
yaw_setVelocityBounded(500.0f, 30.0f);
yaw_range = 6.0f;
roll_range = 85.0f;
}
else{
func_80299234(500.0f, 2.0f);
yaw_setVelocityBounded(500.0f, 2.0f);
yaw_range = 3.0f;
roll_range = 75.0f;
}

View File

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "core2/yaw.h"
void baModel_80292048(s32, f32, f32, f32);
void func_802875AC(AnimCtrl *, char *, s32);
@@ -37,8 +38,8 @@ void bsbpeck_init(void){
func_80293240(2);
func_8028A274(ASSET_1A_ANIM_BSBPECK, 0.2f);
func_8029C7F4(1,3,1,6);
func_80299234(1200.0f, 10.0f);
func_8029C7F4(1,YAW_STATE_3_BOUNDED, 1, 6);
yaw_setVelocityBounded(1200.0f, 10.0f);
func_8029E070(1);
gravity_set(D_80364A60);
player_setYVelocity(D_80364A64);

View File

@@ -37,11 +37,11 @@ void func_802A71D8(void) {
if (button_held(BUTTON_R)) {
roll_range = 45.0f;
yaw_range = 4.3f;
func_80299234(250.0f, 20.0f);
yaw_setVelocityBounded(250.0f, 20.0f);
} else {
roll_range = 35.0f;
yaw_range = ml_interpolate_f(sp38, 3.1f, 2.4f);
func_80299234(90.0f, ml_interpolate_f(sp38, 3.8f, 2.2f));
yaw_setVelocityBounded(90.0f, ml_interpolate_f(sp38, 3.8f, 2.2f));
}
roll_setIdeal(ml_map_f(sp30, -1.0f, 1.0f, -roll_range, roll_range));
yaw_setIdeal(mlNormalizeAngle(yaw_getIdeal() + ml_map_f(sp30, -1.0f, 1.0f, yaw_range, -yaw_range)));
@@ -332,7 +332,7 @@ void func_802A7DAC(void) {
ability_use(ABILITY_3_CAMERA_CONTROL);
func_8028A180(0x3C, 1.0f);
func_802A7140();
func_80299234(500.0f, 5.0f);
yaw_setVelocityBounded(500.0f, 5.0f);
func_80297930(0);
func_802A744C();
pitch_setAngVel(200.0f, 2.5f);

View File

@@ -351,7 +351,7 @@ void bsbtrot_jump_init(void){
func_802875AC(aCtrl, "bsbtrot.c", 0x272);
func_802A8A40();
func_80289F10(1);
func_802991A8(1);
yaw_setUpdateState(1);
func_8029957C(3);
func_802978DC(6);
if(func_8029B2E8() != 0.0f)

View File

@@ -11,7 +11,7 @@ void func_80297970(f32);
void baModel_setYDisplacement(f32);
void func_80297BF8(f32);
void func_802BFE50(f32, f32, f32);
void func_80299234(f32, f32);
void yaw_setVelocityBounded(f32, f32);
f32 func_8029B2D0(void);
f32 func_8029B2DC(void);
f32 func_80297A64(void);
@@ -108,7 +108,7 @@ void func_802A07F8(void){
if(bsBeeFly_inSet(bs_getPrevState()))
return;
baModel_setYDisplacement(65.0f);
func_802991A8(3);
yaw_setUpdateState(3);
roll_setAngularVelocity(500.0f, 2.0f);
func_802A0724();
gravity_set(-300.0f);
@@ -125,12 +125,12 @@ void _bsBeeFly_updateYaw(void){
stickX = func_8029B2D0();
func_802BFE50(2.0f, 2000.0f, 350.0f);
if(button_held(BUTTON_R)){
func_80299234(500.0f, 30.0f);
yaw_setVelocityBounded(500.0f, 30.0f);
sp34 = 6.0f;
sp30 = 85.0f;
}
else{
func_80299234(500.0f, 2.0f);
yaw_setVelocityBounded(500.0f, 2.0f);
sp34 = 3.0f;
sp30 = 65.0f;
}

View File

@@ -18,7 +18,7 @@ void func_802AB5C0(void){
f2 = 0.0f;
}
else{
f2 = func_80257D30(sp28, 0.03f, 1.0f, 100.0f, 300.0f);
f2 = ml_mapRange_f(sp28, 0.03f, 1.0f, 100.0f, 300.0f);
}
sp2C[0] = 0.0f;
sp2C[1] = f2;
@@ -28,8 +28,8 @@ void func_802AB5C0(void){
void func_802AB654(void){
func_8029957C(6);
func_802991A8(3);
func_80299234(500.0f, 15.0f);
yaw_setUpdateState(3);
yaw_setVelocityBounded(500.0f, 15.0f);
func_8029B324(0, 0.03f);
func_8029B324(1, 1.0f);
func_802978DC(0xA);

View File

@@ -57,8 +57,8 @@ void bscrouch_init(void){
func_8028774C(aCtrl, sp24);
func_802875AC(aCtrl, "bscrouch.c", 0xa0);
func_80289F10(1);
func_802991A8(3);
func_80299234(350.0f, 14.0f);
yaw_setUpdateState(3);
yaw_setVelocityBounded(350.0f, 14.0f);
func_8029957C(7);
func_8029932C(8.0f);
func_802978DC(3);

View File

@@ -44,7 +44,7 @@ void bsdie_init(void){
func_8029797C(sp38);
func_802979AC(sp38, func_80297A64());
func_80289F10(1);
func_802991A8(1);
yaw_setUpdateState(1);
func_8029957C(2);
func_802978DC(3);
player_setYVelocity(510.0f);

View File

@@ -261,7 +261,7 @@ void func_802B1928(void) {
animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_ONCE);
func_802875AC(anim_ctrl, "bsjump.c", 0x201);
func_80289F10(1);
func_802991A8(1);
yaw_setUpdateState(1);
func_8029957C(3);
func_802978DC(3);
func_8029797C(yaw_getIdeal());
@@ -342,7 +342,7 @@ void func_802B1BF4(void) {
func_802875AC(anim_ctrl, "bsjump.c", 0x298);
yaw_setIdeal(func_8029B41C());
func_80289F10(1);
func_802991A8(1);
yaw_setUpdateState(1);
func_8029957C(3);
func_802978DC(6);
func_80297970(0.0f);

View File

@@ -4,7 +4,7 @@
#include "bsint.h"
extern f32 func_8029B2E8(void);
void func_80299234(f32, f32);
void yaw_setVelocityBounded(f32, f32);
void func_802875AC(AnimCtrl *, char*, s32);
@@ -189,14 +189,14 @@ void bsstand_update(void) {
anim_ctrl = _player_getAnimCtrlPtr();
if ((func_8029B300() == 0) && (func_8029B2E8() > 0.0f)) {
D_8037D544 = 1;
func_802991A8(3);
func_80299234(200.0f, 14.0f);
yaw_setUpdateState(3);
yaw_setVelocityBounded(200.0f, 14.0f);
} else {
if (D_8037D544 != 0) {
yaw_setIdeal(yaw_get());
}
D_8037D544 = 0;
func_802991A8(1);
yaw_setUpdateState(1);
}
next_state = func_802B488C(0);
sp18 = D_80364D20[D_8037D540];

View File

@@ -12,14 +12,14 @@ f32 D_80364D44 = 300.0f;
f32 D_80364D48 = 1.2f;
f32 D_80364D4C = 0.7f;
s16 D_80364D50[10] = {
0x57,
0x57,
0x57,
ASSET_57_ANIM_BSSWIM_IDLE,
ASSET_57_ANIM_BSSWIM_IDLE,
ASSET_57_ANIM_BSSWIM_IDLE,
0x58,
0x57,
ASSET_57_ANIM_BSSWIM_IDLE,
0x58,
0x57,
0x57,
ASSET_57_ANIM_BSSWIM_IDLE,
ASSET_57_ANIM_BSSWIM_IDLE,
0x58,
0x58
};
@@ -137,7 +137,7 @@ void func_802B5774(void) {
func_802875AC(anim_ctrl, "bsswim.c", 0xFD);
}
func_8029C7F4(1, 3, 3, 2);
func_80299234(500.0f, 5.0f);
yaw_setVelocityBounded(500.0f, 5.0f);
func_80297970(0.0f);
func_802B563C();
D_8037D550 = 0;
@@ -207,8 +207,8 @@ void func_802B5B18(void) {
func_80289F10(2);
func_80289EA8(0.3f, 1.5f);
func_80289EC8(D_80364D40, D_80364D44, D_80364D48, D_80364D4C);
func_802991A8(3);
func_80299234(500.0f, 5.0f);
yaw_setUpdateState(3);
yaw_setVelocityBounded(500.0f, 5.0f);
func_8029957C(1);
func_802978DC(2);
}
@@ -279,7 +279,7 @@ void func_802B5E30(void) {
void func_802B5E8C(void) {
func_8028A010(0x57, 1.2f);
func_8029C7F4(1, 3, 3, 2);
func_80299234(500.0f, 5.0f);
yaw_setVelocityBounded(500.0f, 5.0f);
func_80297970(0.0f);
func_802B563C();
func_802B5E30();

View File

@@ -22,7 +22,7 @@ void bstalk_init(void){
func_80257F18(plyr_pos, target_pos, &yaw);
yaw_setIdeal(yaw);
func_80289F10(1);
func_802991A8(1);
yaw_setUpdateState(1);
func_8029957C(3);
func_802978DC(2);
func_80297970(0.0f);

View File

@@ -18,7 +18,7 @@ void bsthrow_init(void){
func_802875AC(aCtrl, "bsthrow.c", 0x2e);
func_80289F10(1);
func_802991A8(1);
yaw_setUpdateState(1);
func_8029957C(3);
func_802978DC(3);
func_80297970(0.0f);

View File

@@ -18,7 +18,7 @@ void bsturn_init(void){
animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE);
func_802875AC(aCtrl, "bsturn.c", 0x37);
func_80289F10(1);
func_802991A8(1);
yaw_setUpdateState(1);
func_8029957C(2);
func_802978DC(3);
_get_velocity(&sp28);

View File

@@ -22,7 +22,7 @@ void bstwirl_init(void){
animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE);
func_802875AC(aCtrl, "bstwirl.c", 0x46);
func_80289F10(1);
func_802991A8(1);
yaw_setUpdateState(1);
func_8029957C(3);
func_8029797C(yaw_getIdeal());
func_802979AC(yaw_getIdeal(), func_80297A64());

View File

@@ -2,7 +2,7 @@
#include "functions.h"
#include "variables.h"
extern f32 func_80257D30(f32, f32, f32, f32, f32);
extern f32 ml_mapRange_f(f32, f32, f32, f32, f32);
extern void func_8025901C(f32, f32 *, f32 *, f32);
extern f32 func_8029B2D0(void);
@@ -14,7 +14,7 @@ f32 D_8037C6B4;
/* .code */
void func_802992F0(void){
func_802990B4();
yaw_init();
D_8037C6B4 = 0.0f;
D_8037C6B0 = 0;
func_8029957C(1);
@@ -26,9 +26,9 @@ void func_8029932C(f32 arg0){
void func_80299338(void){
f32 stickX = func_8029B2D0();
f32 sp20;
sp20 =(0.03 < (f64)mlAbsF(stickX)) ? func_80257D30(stickX, 0.0f, 1.0f, 1.0f, 6.0f) : 0.0f;
yaw_setIdeal(yaw_getIdeal() + sp20);
f32 d_yaw_deg;
d_yaw_deg =(0.03 < (f64)mlAbsF(stickX)) ? ml_mapRange_f(stickX, 0.0f, 1.0f, 1.0f, 6.0f) : 0.0f;
yaw_setIdeal(yaw_getIdeal() + d_yaw_deg);
}
void func_802993C8(void){

View File

@@ -1,6 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "core2/yaw.h"
f32 func_8024DDD8(f32[3], f32);
extern void func_8024E71C(s32, f32*);
@@ -761,9 +762,9 @@ enum bs_e func_8029C780(void){
return BS_5_JUMP;
}
void func_8029C7F4(s32 arg0, s32 arg1, s32 arg2, s32 arg3){
void func_8029C7F4(s32 arg0, enum yaw_state_e yaw_state, s32 arg2, s32 arg3){
func_80289F10(arg0);
func_802991A8(arg1);
yaw_setUpdateState(yaw_state);
func_8029957C(arg2);
func_802978DC(arg3);
}

View File

@@ -707,7 +707,7 @@ void func_802BDB30(f32 arg0, f32 *arg1, f32 *arg2, f32 arg3, f32 arg4, f32 arg5)
sp30 = time_getDelta();
sp38 = mlDiffDegF(arg0, *arg1);
if (mlAbsF(sp38) < arg5) {
*arg2 = func_80257D30(sp38, 0.0f, arg5, 10.0f, arg4);
*arg2 = ml_mapRange_f(sp38, 0.0f, arg5, 10.0f, arg4);
} else {
phi_f0 = arg3 * sp30;
if (sp38 < 0.0f) {

View File

@@ -83,7 +83,7 @@ s32 func_803531C8(u8 projectile_indx, s32 arg1){
break;
case MARKER_33_LEAKY: //L80353350
if(func_802458A8(sp40, other_marker, 0x32) && func_80389364(other_marker)){
if(func_802458A8(sp40, other_marker, 0x32) && chLeaky_eggCollision(other_marker)){
func_8033E984();
}
break;

View File

@@ -34,7 +34,7 @@ s32 func_802FFDE0(s32 arg0){
s32 func_802FFE04(void){
s32 v1;
v1 = (5 < itemPrint_getValue(ITEM_14_HEALTH)) ? 5 : itemPrint_getValue(ITEM_14_HEALTH);
v1 = MIN(5 , itemPrint_getValue(ITEM_14_HEALTH));
return (5 - v1)*4;
}

View File

@@ -3,68 +3,68 @@
#include "variables.h"
/* .bss */
f32 D_8037C540; //pitch degrees
f32 D_8037C544; //idealPitch degrees
f32 D_8037C548; //pitchAngularVelocityLimit
f32 D_8037C54C; //PitchAngularVelocity
static f32 pitch_degree;
static f32 idealPitch_degree;
static f32 pitchVelocityLimit_degreePerSec;
static f32 pitchVelocity_degreePerSec;
/* .code */
static void __pitch_update(f32 limit, f32 angVel){
f32 diff;
f32 val;
f32 tick = time_getDelta();
f32 dt = time_getDelta();
f32 max;
max = limit*tick;
diff = D_8037C544 - D_8037C540;
max = limit*dt;
diff = idealPitch_degree - pitch_degree;
if(180.0f < mlAbsF(diff)){
diff += (diff < 0.0f)? 360.0: -360.0;
}
val = diff * angVel * tick;
val = diff * angVel * dt;
val = (val < 0) ? ml_clamp_f(val, -max, -0.1f) : ml_clamp_f(val, 0.1f, max);
D_8037C540 =( mlAbsF(val) <= mlAbsF(diff)) ? D_8037C540 + val : D_8037C544;
pitch_degree =( mlAbsF(val) <= mlAbsF(diff)) ? pitch_degree + val : idealPitch_degree;
if(D_8037C540 < 360.0){
if(D_8037C540 < 0.0)
D_8037C540 += 360.0;
if(pitch_degree < 360.0){
if(pitch_degree < 0.0)
pitch_degree += 360.0;
}
else
D_8037C540 -= 360.0;
pitch_degree -= 360.0;
}
void pitch_reset(void){
D_8037C540 = 0.0f;
D_8037C544 = 0.0f;
pitch_degree = 0.0f;
idealPitch_degree = 0.0f;
pitch_setAngVel(500.0f, 0.8f);
}
void pitch_update(void){
__pitch_update(D_8037C548, D_8037C54C);
__pitch_update(pitchVelocityLimit_degreePerSec, pitchVelocity_degreePerSec);
}
void pitch_setIdeal(f32 ideal_pitch_deg){
D_8037C544 = mlNormalizeAngle(ideal_pitch_deg);
idealPitch_degree = mlNormalizeAngle(ideal_pitch_deg);
}
void pitch_set(f32 pitch_deg){
D_8037C540 = mlNormalizeAngle(pitch_deg);
pitch_degree = mlNormalizeAngle(pitch_deg);
}
void pitch_applyIdeal(void){
D_8037C540 = D_8037C544;
pitch_degree = idealPitch_degree;
}
f32 pitch_get(void){
return D_8037C540;
return pitch_degree;
}
f32 pitch_getIdeal(void){
return D_8037C544;
return idealPitch_degree;
}
void pitch_setAngVel(f32 limit, f32 angVel){
D_8037C548 = limit;
D_8037C54C = angVel;
pitchVelocityLimit_degreePerSec = limit;
pitchVelocity_degreePerSec = angVel;
}

View File

@@ -1,136 +1,137 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
#include "core2/yaw.h"
void func_80299248(f32);
void func_802991A8(s32);
f32 D_8037C690; //yaw
f32 D_8037C694; //yaw_ideal
s32 D_8037C698; //yaw_update_type
f32 yaw_deg; //yaw
f32 yawIdeal_deg; //yaw_ideal
s32 yawUpdateState; //yaw_update_type
f32 D_8037C69C; //yaw_update2_angular_velocity
f32 D_8037C6A0; //yaw_update3_angular_velocity_limit
f32 D_8037C6A4; //yaw_update3_angular_velocity_percentage
void func_80298D70(f32 arg0) {
f32 sp24;
void __yaw_update_limitless(f32 arg0) {
f32 dYaw_deg;
f32 sp20;
arg0 *= time_getDelta();
sp24 = D_8037C694 - D_8037C690;
if (mlAbsF(sp24) > 180.0f) {
sp24 += (sp24 < 0.0f) ? 360.0 : -360.0;
dYaw_deg = yawIdeal_deg - yaw_deg;
if (mlAbsF(dYaw_deg) > 180.0f) {
dYaw_deg += (dYaw_deg < 0.0f) ? 360.0 : -360.0;
}
sp20 = (mlAbsF(sp24) > 180.0f) ? arg0 : ((sp24 < 0.0f)? -arg0: arg0);
sp20 = (mlAbsF(dYaw_deg) > 180.0f) ? arg0 : ((dYaw_deg < 0.0f)? -arg0: arg0);
if(mlAbsF(sp20) <= mlAbsF(sp24))
D_8037C690 += sp20;
if(mlAbsF(sp20) <= mlAbsF(dYaw_deg))
yaw_deg += sp20;
else
D_8037C690 = D_8037C694;
yaw_deg = yawIdeal_deg;
if (D_8037C690 < 360.0) {
if (D_8037C690 < 0.0) {
D_8037C690 = (f32) (D_8037C690 + 360.0);
if (yaw_deg < 360.0) {
if (yaw_deg < 0.0) {
yaw_deg = (f32) (yaw_deg + 360.0);
}
} else {
D_8037C690 = (f32) (D_8037C690 - 360.0);
yaw_deg = (f32) (yaw_deg - 360.0);
}
}
static void func_80298F14(f32 limit, f32 step_percent){
f32 diff;
f32 val;
f32 tick = time_getDelta();
f32 max;
static void __yaw_update_limited(f32 limit_degPerSec, f32 step_percent){
f32 dyaw_deg;
f32 val_deg;
f32 dt_s = time_getDelta();
f32 max_deg;
max = limit*tick;
diff = D_8037C694 - D_8037C690;
if(180.0f < mlAbsF(diff)){
diff += (diff < 0.0f)? 360.0: -360.0;
max_deg = limit_degPerSec*dt_s;
dyaw_deg = yawIdeal_deg - yaw_deg;
if(180.0f < mlAbsF(dyaw_deg)){
dyaw_deg += (dyaw_deg < 0.0f)? 360.0: -360.0;
}
val = diff * step_percent * tick;
val = (val < 0) ? ml_clamp_f(val, -max, -0.1f) : ml_clamp_f(val, 0.1f, max);
val_deg = dyaw_deg * step_percent * dt_s;
val_deg = (val_deg < 0) ? ml_clamp_f(val_deg, -max_deg, -0.1f) : ml_clamp_f(val_deg, 0.1f, max_deg);
D_8037C690 =( mlAbsF(val) <= mlAbsF(diff)) ? D_8037C690 + val : D_8037C694;
yaw_deg =( mlAbsF(val_deg) <= mlAbsF(dyaw_deg)) ? yaw_deg + val_deg : yawIdeal_deg;
if(D_8037C690 < 360.0){
if(D_8037C690 < 0.0)
D_8037C690 += 360.0;
if(yaw_deg < 360.0){
if(yaw_deg < 0.0)
yaw_deg += 360.0;
}
else
D_8037C690 -= 360.0;
yaw_deg -= 360.0;
}
void func_802990B4(void){
D_8037C690 = 0.0f;
D_8037C694 = 0.0f;
func_80299234(700.0f, 7.5f);
func_80299248(360.0f);
D_8037C698 = 0;
func_802991A8(1);
void yaw_init(void){
yaw_deg = 0.0f;
yawIdeal_deg = 0.0f;
yaw_setVelocityBounded(700.0f, 7.5f);
yaw_setVelocityUnbounded(360.0f);
yawUpdateState = 0;
yaw_setUpdateState(YAW_STATE_1_DEFAULT);
}
void yaw_update(void){
switch(D_8037C698){
case 0:
switch(yawUpdateState){
case YAW_STATE_0_NONE:
break;
case 1:
func_80298F14(700.0f, 7.5f);
case YAW_STATE_1_DEFAULT:
__yaw_update_limited(700.0f, 7.5f);
break;
case 2:
func_80298D70(D_8037C69C);
case YAW_STATE_2_UNBOUNDED:
__yaw_update_limitless(D_8037C69C);
break;
case 3:
func_80298F14(D_8037C6A0, D_8037C6A4);
case YAW_STATE_3_BOUNDED:
__yaw_update_limited(D_8037C6A0, D_8037C6A4);
break;
}
}
void func_802991A8(s32 arg0){
D_8037C698 = arg0;
void yaw_setUpdateState(s32 arg0){
yawUpdateState = arg0;
}
void yaw_setIdeal(f32 arg0){
D_8037C694 = mlNormalizeAngle(arg0);
yawIdeal_deg = mlNormalizeAngle(arg0);
}
void yaw_set(f32 arg0){
D_8037C690 = mlNormalizeAngle(arg0);
yaw_deg = mlNormalizeAngle(arg0);
}
void yaw_applyIdeal(void){
D_8037C690 = D_8037C694;
yaw_deg = yawIdeal_deg;
}
s32 func_80299210(void){
return D_8037C698;
s32 yaw_getUpdateState(void){
return yawUpdateState;
}
f32 yaw_get(void){
return D_8037C690;
return yaw_deg;
}
f32 yaw_getIdeal(void){
return D_8037C694;
return yawIdeal_deg;
}
void func_80299234(f32 arg0, f32 arg1){
void yaw_setVelocityBounded(f32 arg0, f32 arg1){
D_8037C6A0 = arg0;
D_8037C6A4 = arg1;
}
void func_80299248(f32 arg0){
void yaw_setVelocityUnbounded(f32 arg0){
D_8037C69C = arg0;
}
void func_80299254(f32 arg0){
f32 diff = D_8037C694 - D_8037C690;
if(180.0f < mlAbsF(diff)){
diff += (diff < 0.0f)? 360.0: -360.0;
void yaw_rotateTimed(f32 time_sec){
f32 dyaw_deg = yawIdeal_deg - yaw_deg;
if(180.0f < mlAbsF(dyaw_deg)){
dyaw_deg += (dyaw_deg < 0.0f)? 360.0: -360.0;
}
D_8037C69C = mlAbsF(diff/arg0);
D_8037C69C = mlAbsF(dyaw_deg/time_sec);
}