d_a_obj_tumble_weed mostly done (#88)

* mostly done

* Update d_t_tumble_weed.cpp

* remove cM::calcTimer

* just regswap on adjustSpeed

* Create inlines for angle between vectors

* name data symbols

---------

Co-authored-by: robojumper <robojumper@gmail.com>
This commit is contained in:
Elijah Thomas
2024-11-06 16:36:17 -05:00
committed by GitHub
parent f509c053e5
commit c235e32d95
34 changed files with 804 additions and 214 deletions
@@ -17,3 +17,6 @@ REL/global_destructor_chain.c:
REL/d/a/obj/d_a_obj_tumble_weed.cpp:
.text start:0x000000F0 end:0x00002278
.ctors start:0x00000000 end:0x00000004
.rodata start:0x00000000 end:0x000000AC
.data start:0x00000000 end:0x0000024C
.bss start:0x00000008 end:0x000000A0
@@ -4,42 +4,42 @@ _unresolved = .text:0x00000060; // type:function size:0x4 scope:global
__register_global_object = .text:0x00000070; // type:function size:0x1C scope:global
__destroy_global_chain = .text:0x00000090; // type:function size:0x54 scope:global
dAcOTumbleWeed_c_classInit__Fv = .text:0x000000F0; // type:function size:0x118
fn_475_210 = .text:0x00000210; // type:function size:0x58
__dt__15dShadowCircle_cFv = .text:0x00000210; // type:function size:0x58 scope:weak
__dt__29sFState_c<16dAcOTumbleWeed_c>Fv = .text:0x00000270; // type:function size:0x58
__dt__32sFStateFct_c<16dAcOTumbleWeed_c>Fv = .text:0x000002D0; // type:function size:0x6C
__dt__85sStateMgr_c<16dAcOTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000340; // type:function size:0xA0
__dt__55sFStateMgr_c<16dAcOTumbleWeed_c,20sStateMethodUsr_FI_c>Fv = .text:0x000003E0; // type:function size:0xA4
fn_475_490 = .text:0x00000490; // type:function size:0x80
fn_475_510 = .text:0x00000510; // type:function size:0x1D8
createHeap__16dAcOTumbleWeed_cFv = .text:0x00000490; // type:function size:0x80
actorCreate__16dAcOTumbleWeed_cFv = .text:0x00000510; // type:function size:0x1D8
changeState__85sStateMgr_c<16dAcOTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x000006F0; // type:function size:0x10
fn_475_700 = .text:0x00000700; // type:function size:0x8
fn_475_710 = .text:0x00000710; // type:function size:0x8
fn_475_720 = .text:0x00000720; // type:function size:0x314
actorPostCreate__16dAcOTumbleWeed_cFv = .text:0x00000700; // type:function size:0x8
doDelete__16dAcOTumbleWeed_cFv = .text:0x00000710; // type:function size:0x8
actorExecute__16dAcOTumbleWeed_cFv = .text:0x00000720; // type:function size:0x314
executeState__85sStateMgr_c<16dAcOTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000A40; // type:function size:0x10
fn_475_A50 = .text:0x00000A50; // type:function size:0x1C
fn_475_A70 = .text:0x00000A70; // type:function size:0xE4
calcTimer<Us>__4sLibFPUs_Us = .text:0x00000A50; // type:function size:0x1C
draw__16dAcOTumbleWeed_cFv = .text:0x00000A70; // type:function size:0xE4
initializeState_Wait__16dAcOTumbleWeed_cFv = .text:0x00000B60; // type:function size:0xC
executeState_Wait__16dAcOTumbleWeed_cFv = .text:0x00000B70; // type:function size:0xD4
finalizeState_Wait__16dAcOTumbleWeed_cFv = .text:0x00000C50; // type:function size:0x4
initializeState_Slope__16dAcOTumbleWeed_cFv = .text:0x00000C60; // type:function size:0x4
executeState_Slope__16dAcOTumbleWeed_cFv = .text:0x00000C70; // type:function size:0xA0
finalizeState_Slope__16dAcOTumbleWeed_cFv = .text:0x00000D10; // type:function size:0x4
fn_475_D20 = .text:0x00000D20; // type:function size:0x118
fn_475_E40 = .text:0x00000E40; // type:function size:0x1C
fn_475_E60 = .text:0x00000E60; // type:function size:0x11C
fn_475_F80 = .text:0x00000F80; // type:function size:0x6C
fn_475_FF0 = .text:0x00000FF0; // type:function size:0x58
fn_475_1050 = .text:0x00001050; // type:function size:0x6C
fn_475_10C0 = .text:0x000010C0; // type:function size:0x684
fn_475_1750 = .text:0x00001750; // type:function size:0x58
fn_475_17B0 = .text:0x000017B0; // type:function size:0x1A8
fn_475_1960 = .text:0x00001960; // type:function size:0x68
fn_475_19D0 = .text:0x000019D0; // type:function size:0xA0
fn_475_1A70 = .text:0x00001A70; // type:function size:0x88
fn_475_1B00 = .text:0x00001B00; // type:function size:0x4C
fn_475_1B50 = .text:0x00001B50; // type:function size:0xD0
fn_475_1C20 = .text:0x00001C20; // type:function size:0x1C
fn_475_1C40 = .text:0x00001C40; // type:function size:0xAC
checkBreak__16dAcOTumbleWeed_cFv = .text:0x00000D20; // type:function size:0x118
fn_475_E40__16dAcOTumbleWeed_cCFv = .text:0x00000E40; // type:function size:0x1C
checkSlope__16dAcOTumbleWeed_cFv = .text:0x00000E60; // type:function size:0x11C
checkCollect__16dAcOTumbleWeed_cFv = .text:0x00000F80; // type:function size:0x6C
checkInvalidGround__16dAcOTumbleWeed_cCFv = .text:0x00000FF0; // type:function size:0x58
doBreak__16dAcOTumbleWeed_cFv = .text:0x00001050; // type:function size:0x6C
calcMatrix__16dAcOTumbleWeed_cFv = .text:0x000010C0; // type:function size:0x684
adjustAngle__16dAcOTumbleWeed_cFv = .text:0x00001750; // type:function size:0x58
adjustSpeed__16dAcOTumbleWeed_cFv = .text:0x000017B0; // type:function size:0x1A8
tumbleBounceMaybe__16dAcOTumbleWeed_cFv = .text:0x00001960; // type:function size:0x68
adjustTimeScale__16dAcOTumbleWeed_cFv = .text:0x000019D0; // type:function size:0xA0
adjustTumble__16dAcOTumbleWeed_cFRC7mVec3_c = .text:0x00001A70; // type:function size:0x88
setWind__16dAcOTumbleWeed_cFRC7mVec3_c = .text:0x00001B00; // type:function size:0x4C
calcWind__16dAcOTumbleWeed_cFv = .text:0x00001B50; // type:function size:0xD0
calcTimer<Uc>__4sLibFPUc_Uc = .text:0x00001C20; // type:function size:0x1C
getPosition__16dAcOTumbleWeed_cCFv = .text:0x00001C40; // type:function size:0xAC
__dt__16dAcOTumbleWeed_cFv = .text:0x00001CF0; // type:function size:0x10C
getStateID__85sStateMgr_c<16dAcOTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00001E00; // type:function size:0x10
build__32sFStateFct_c<16dAcOTumbleWeed_c>FRC12sStateIDIf_c = .text:0x00001E10; // type:function size:0x60
@@ -69,19 +69,21 @@ lbl_475_rodata_5C = .rodata:0x0000005C; // type:object size:0x4 data:float
lbl_475_rodata_60 = .rodata:0x00000060; // type:object size:0x4 data:float
lbl_475_rodata_64 = .rodata:0x00000064; // type:object size:0x48 data:float
g_profile_OBJ_TUMBLE_WEED = .data:0x00000000; // type:object size:0x10 data:4byte
lbl_475_data_10 = .data:0x00000010; // type:object size:0x2C
lbl_475_data_3C = .data:0x0000003C; // type:object size:0x10
lbl_475_data_4C = .data:0x0000004C; // type:object size:0x24
lbl_475_data_70 = .data:0x00000070; // type:object size:0x80
lbl_475_data_F0 = .data:0x000000F0; // type:object size:0x30
lbl_475_data_120 = .data:0x00000120; // type:object size:0x30
lbl_475_data_150 = .data:0x00000150; // type:object size:0x18
lbl_475_data_168 = .data:0x00000168; // type:object size:0x18
lbl_475_data_180 = .data:0x00000180; // type:object size:0x98
lbl_475_data_218 = .data:0x00000218; // type:object size:0x34
__global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global
lbl_475_bss_8 = .bss:0x00000008; // type:object size:0x10 data:4byte
lbl_475_bss_18 = .bss:0x00000018; // type:object size:0x40 data:4byte
lbl_475_bss_58 = .bss:0x00000058; // type:object size:0x30 data:4byte
lbl_475_bss_88 = .bss:0x00000088; // type:object size:0x8 data:byte
lbl_475_bss_90 = .bss:0x00000090; // type:object size:0x10 data:float
sSphSrc__16dAcOTumbleWeed_c = .data:0x00000010; // type:object size:0x2C
lbl_475_data_3C = .data:0x0000003C; // type:object size:0x10 scope:local
lbl_475_data_4C = .data:0x0000004C; // type:object size:0x24 scope:local
__vt__16dAcOTumbleWeed_c = .data:0x00000070; // type:object size:0x80
__vt__55sFStateMgr_c<16dAcOTumbleWeed_c,20sStateMethodUsr_FI_c> = .data:0x000000F0; // type:object size:0x30
__vt__85sStateMgr_c<16dAcOTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x00000120; // type:object size:0x30
__vt__32sFStateFct_c<16dAcOTumbleWeed_c> = .data:0x00000150; // type:object size:0x14
__vt__29sFState_c<16dAcOTumbleWeed_c> = .data:0x00000168; // type:object size:0x18
__vt__15dShadowCircle_c = .data:0x00000180; // type:object size:0xC
lbl_475_data_18C = .data:0x0000018C; // type:object size:0x8C
__vt__31sFStateID_c<16dAcOTumbleWeed_c> = .data:0x00000218; // type:object size:0x34
__global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global data:4byte
lbl_475_bss_8 = .bss:0x00000008; // type:object size:0xC data:4byte
StateID_Wait__16dAcOTumbleWeed_c = .bss:0x00000018; // type:object size:0x30 data:4byte
lbl_475_bss_40 = .bss:0x00000048; // type:object size:0xC scope:local data:4byte
StateID_Slope__16dAcOTumbleWeed_c = .bss:0x00000058; // type:object size:0x30 data:4byte
@GUARD@draw__16dAcOTumbleWeed_cFv@shadowRot = .bss:0x00000088; // type:object size:0x1 scope:local data:byte
@LOCAL@draw__16dAcOTumbleWeed_cFv@shadowRot = .bss:0x00000090; // type:object size:0x10 scope:local data:float
+1 -1
View File
@@ -21,7 +21,7 @@ initializeState_Wait__10dTgGekoTagFv = .text:0x00000660; // type:function size:0
executeState_Wait__10dTgGekoTagFv = .text:0x00000670; // type:function size:0x4
finalizeState_Wait__10dTgGekoTagFv = .text:0x00000680; // type:function size:0x4
doExecute__10dTgGekoTagFv = .text:0x00000690; // type:function size:0x1A8
calcTimer<Us>__2cMFPUs_Us = .text:0x00000840; // type:function size:0x1C
calcTimer<Us>__4sLibFPUs_Us = .text:0x00000840; // type:function size:0x1C
__dt__10dTgGekoTagFv = .text:0x00000860; // type:function size:0xE0
getStateID__79sStateMgr_c<10dTgGekoTag,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000940; // type:function size:0x10
build__26sFStateFct_c<10dTgGekoTag>FRC12sStateIDIf_c = .text:0x00000950; // type:function size:0x60
+1 -1
View File
@@ -17,7 +17,7 @@ executeState__80sStateMgr_c<11dTgTouchTag,20sStateMethodUsr_FI_c,12sFStateFct_c,
draw__11dTgTouchTagFv = .text:0x00000590; // type:function size:0x8
initializeState_Wait__11dTgTouchTagFv = .text:0x000005A0; // type:function size:0xC
executeState_Wait__11dTgTouchTagFv = .text:0x000005B0; // type:function size:0x138
calcTimer<Us>__2cMFPUs_Us = .text:0x000006F0; // type:function size:0x1C
calcTimer<Us>__4sLibFPUs_Us = .text:0x000006F0; // type:function size:0x1C
finalizeState_Wait__11dTgTouchTagFv = .text:0x00000710; // type:function size:0x4
__dt__11dTgTouchTagFv = .text:0x00000720; // type:function size:0xC8
getStateID__80sStateMgr_c<11dTgTouchTag,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x000007F0; // type:function size:0x10
@@ -14,7 +14,7 @@ changeState__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct
doDelete__15dTgTumbleWeed_cFv = .text:0x00000490; // type:function size:0x8
actorExecute__15dTgTumbleWeed_cFv = .text:0x000004A0; // type:function size:0x48
executeState__84sStateMgr_c<15dTgTumbleWeed_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000004F0; // type:function size:0x10
decr__FPUs = .text:0x00000500; // type:function size:0x1C
calcTimer<Us>__4sLibFPUs_Us = .text:0x00000500; // type:function size:0x1C
draw__15dTgTumbleWeed_cFv = .text:0x00000520; // type:function size:0x8
initializeState_AreaOut__15dTgTumbleWeed_cFv = .text:0x00000530; // type:function size:0x4
executeState_AreaOut__15dTgTumbleWeed_cFv = .text:0x00000540; // type:function size:0xA0
+17 -4
View File
@@ -1418,13 +1418,13 @@ fn_80037A30 = .text:0x80037A30; // type:function size:0xCC
fn_80037B00 = .text:0x80037B00; // type:function size:0x20
fn_80037B20 = .text:0x80037B20; // type:function size:0x4C
fn_80037B70 = .text:0x80037B70; // type:function size:0x1D4
calcTimer<Us>__2cMFPUs_Us = .text:0x80037D50; // type:function size:0x1C
calcTimer<Us>__4sLibFPUs_Us = .text:0x80037D50; // type:function size:0x1C
fn_80037D70 = .text:0x80037D70; // type:function size:0x158
fn_80037ED0 = .text:0x80037ED0; // type:function size:0x14
fn_80037EF0 = .text:0x80037EF0; // type:function size:0xA4
fn_80037FA0 = .text:0x80037FA0; // type:function size:0x220
fn_800381C0 = .text:0x800381C0; // type:function size:0x2F0
calcTimer<Uc>__2cMFPUc_Uc = .text:0x800384B0; // type:function size:0x1C
calcTimer<Uc>__4sLibFPUc_Uc = .text:0x800384B0; // type:function size:0x1C
fn_800384D0 = .text:0x800384D0; // type:function size:0x64
fn_80038540 = .text:0x80038540; // type:function size:0x108
fn_80038650 = .text:0x80038650; // type:function size:0x144
@@ -43853,7 +43853,20 @@ PARTICLE_RESOURCE_ID_MAPPING_721_ = .sdata2:0x8057A952; // type:object size:0x8
PARTICLE_RESOURCE_ID_MAPPING_725_ = .sdata2:0x8057A95A; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_726_ = .sdata2:0x8057A95C; // type:object size:0x1A data:2byte
PARTICLE_RESOURCE_ID_MAPPING_739_ = .sdata2:0x8057A976; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_740_ = .sdata2:0x8057A978; // type:object size:0x1C data:2byte
PARTICLE_RESOURCE_ID_MAPPING_740_ = .sdata2:0x8057A978; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_741_ = .sdata2:0x8057A97A; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_742_ = .sdata2:0x8057A97C; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_743_ = .sdata2:0x8057A97E; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_744_ = .sdata2:0x8057A980; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_745_ = .sdata2:0x8057A982; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_746_ = .sdata2:0x8057A984; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_747_ = .sdata2:0x8057A986; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_748_ = .sdata2:0x8057A988; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_749_ = .sdata2:0x8057A98A; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_750_ = .sdata2:0x8057A98C; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_751_ = .sdata2:0x8057A98E; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_752_ = .sdata2:0x8057A990; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_753_ = .sdata2:0x8057A992; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_754_ = .sdata2:0x8057A994; // type:object size:0x18 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_766_ = .sdata2:0x8057A9AC; // type:object size:0x2 data:2byte
PARTICLE_RESOURCE_ID_MAPPING_767_ = .sdata2:0x8057A9AE; // type:object size:0x2 data:2byte
@@ -45917,7 +45930,7 @@ lbl_8057CD8C = .sdata2:0x8057CD8C; // type:object size:0x4 data:float
sHalfCircleDeg__4mAng = .sdata2:0x8057CD90; // type:object size:0x4 data:float
sAngToDeg__4mAng = .sdata2:0x8057CD94; // type:object size:0x4 data:float
sAngToRad__4mAng = .sdata2:0x8057CD98; // type:object size:0x4 data:float
NotSure__4mAng = .sdata2:0x8057CD9C; // type:object size:0x4 data:float
sAngToNorm__4mAng = .sdata2:0x8057CD9C; // type:object size:0x4 data:float
sDegToRad__4mAng = .sdata2:0x8057CDA0; // type:object size:0x4 data:float
sDegToAng__4mAng = .sdata2:0x8057CDA4; // type:object size:0x4 data:float
sRadToAng__4mAng = .sdata2:0x8057CDA8; // type:object size:0x4 data:float
+2 -5
View File
@@ -12,11 +12,8 @@ f32 rndF(f32 max);
f32 rndFX(f32 amp);
template <typename T>
T calcTimer(T *value) {
if (*(T *)value != 0) {
*value = *value - 1;
}
return *value;
inline T minMaxLimit(T val, T min, T max) {
return (T)((T)val < (T)min ? (T)min : ((T)val > (T)max ? (T)max : (T)val));
}
} // namespace cM
+1 -1
View File
@@ -179,7 +179,7 @@ public:
/* vt 0x284 */ virtual bool isUsingBugnet() const;
/* vt 0x288 */ virtual const mVec3_c &getBugNetPos() const;
/* vt 0x28C */ virtual void isUsingBugnet1();
/* vt 0x290 */ virtual void bugNetCollectTreasure();
/* vt 0x290 */ virtual void bugNetCollectTreasure(u32 itemId);
/* vt 0x294 */ virtual void somethingSwitchDials();
/* vt 0x298 */ virtual void vt_0x298();
/* vt 0x29C */ virtual void getDieLargeDamageDir();
+9 -1
View File
@@ -4,6 +4,7 @@
#include "d/a/d_a_base.h"
#include "d/col/c/c_cc_d.h"
#include "d/col/c/c_m3d_g_aab.h"
#include "egg/math/eggMath.h"
#include "m/m3d/m_shadow.h"
#include "m/m3d/m_smdl.h"
#include "m/m_angle.h"
@@ -11,7 +12,6 @@
#include "m/m_vec.h"
#include "m/types_m.h"
// Size: 0xA8
struct ActorCarryStruct {
/* 0x00 */ fLiNdBa_c actorLink;
@@ -89,6 +89,14 @@ public:
return angle;
}
f32 getVelocityMag() const {
return fabsf(nw4r::math::VEC3LenSq(velocity));
}
bool isStopped() const {
return getVelocityMag() <= EGG::Math<f32>::epsilon();
}
// could be their own thing?
/* 8002de40 */ static void *getOarcFile(const char *oarcName, const char *fileName);
/* 8002de60 */ static void *getOarcSubEntry(const char *oarcName, const char *fileName);
+73 -3
View File
@@ -1,20 +1,90 @@
#ifndef D_A_OBJ_TUMBLE_WEED_H
#define D_A_OBJ_TUMBLE_WEED_H
#include "common.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/bg/d_bg_s_acch.h"
#include "d/col/cc/d_cc_d.h"
#include "d/d_shadow.h"
#include "m/m3d/m_smdl.h"
#include "m/m_mtx.h"
#include "m/m_quat.h"
#include "m/m_vec.h"
#include "nw4r/g3d/g3d_resfile.h"
#include "s/s_State.hpp"
#include "s/s_StateMgr.hpp"
#include "toBeSorted/dowsing_target.h"
#include "toBeSorted/time_area_mgr.h"
class dAcOTumbleWeed_c : public dAcObjBase_c {
public:
dAcOTumbleWeed_c() : mStateMgr(*this, sStateID::null) {}
dAcOTumbleWeed_c() : mDowsingTarget(this, DowsingTarget::SLOT_NONE), mStateMgr(*this, sStateID::null) {}
virtual ~dAcOTumbleWeed_c() {}
virtual int doDelete() override;
virtual int draw() override;
virtual bool createHeap() override;
virtual int actorCreate() override;
virtual int actorPostCreate() override;
virtual int actorExecute() override;
bool checkCollect();
bool checkBreak();
void doBreak();
void adjustTimeScale();
void adjustTumble(const mVec3_c &dir);
void calcWind();
mVec3_c getPosition() const;
void calcMatrix();
void adjustAngle();
void adjustSpeed();
void tumbleBounceMaybe();
void setWind(const mVec3_c &);
bool checkSlope();
bool fn_475_E40() const;
bool checkInvalidGround() const;
// Look at `isStopped` in dAcObjBase. This may be a diff inline
f32 getWindMag() const {
return fabsf(nw4r::math::VEC3LenSq(mWind));
}
bool isWindStop() const {
return getWindMag() <= EGG::Math<f32>::epsilon();
}
STATE_FUNC_DECLARE(dAcOTumbleWeed_c, Wait);
STATE_FUNC_DECLARE(dAcOTumbleWeed_c, Slope);
private:
/* 0x??? */ STATE_MGR_DECLARE(dAcOTumbleWeed_c);
/* 0x330 */ nw4r::g3d::ResFile mResFile;
/* 0x334 */ m3d::smdl_c mMdl;
/* 0x350 */ dShadowCircle_c mShdw;
/* 0x358 */ dCcD_Sph mSph;
/* 0x4A8 */ dBgS_AcchCir mAcchCir;
/* 0x504 */ dBgS_ObjAcch mObjAcch;
/* 0x8B4 */ DowsingTarget mDowsingTarget;
/* 0x8D4 */ STATE_MGR_DECLARE(dAcOTumbleWeed_c);
/* 0x910 */ mQuat_c mField_0x910;
/* 0x920 */ TimeAreaStruct mTimeArea;
/* 0x92C */ mMtx_c mShadowMtx;
/* 0x95C */ mVec3_c mWind;
/* 0x968 */ mVec3_c mField_0x968;
/* 0x974 */ f32 mField_0x974;
/* 0x978 */ f32 mField_0x978;
/* 0x97C */ f32 mField_0x97C;
/* 0x980 */ f32 mField_0x980;
/* 0x984 */ f32 mSpeedTarget;
/* 0x988 */ u16 mTumbleTimer;
/* 0x98A */ u8 mWindTimer;
/* 0x98B */ u8 mField_0x98B;
/* 0x98C */ u8 mField_0x98C;
/* 0x98D */ bool mbOnGround;
static dCcD_SrcSph sSphSrc;
};
#endif
+12
View File
@@ -27,6 +27,18 @@ enum dBgPc_ECode {
/* 0x80000000 */ CODE_UNUSED_8000_0000 = 0x80000000,
};
enum dBgPc_Attribute {
POLY_ATTR_NORMAL = 0,
POLY_ATTR_SLOPE = 1,
POLY_ATTR_LAVA = 7,
POLY_ATTR_SAND_SHALLOW = 9,
POLY_ATTR_SAND_MED = 10,
POLY_ATTR_SAND_DEEP_INSTANT = 11,
POLY_ATTR_WATER = 12,
POLY_ATTR_DAMAGE = 13,
POLY_ATTR_SLOPE_RUN = 15,
POLY_ATTR_SAND_DEEP_SLOW = 16,
};
class dBgPc {
public:
void setCode(sBgPc &);
+4
View File
@@ -488,6 +488,10 @@ public:
return mFlags & GROUND_HIT;
}
dBgS_GndChk &GetGnd() {
return mGnd;
}
public:
/* 0x040 */ u32 mFlags;
/* 0x044 */ mVec3_c *mpPos;
+37 -3
View File
@@ -308,6 +308,10 @@ public:
dAcObjBase_c *GetAc() {
return mpActor;
}
const mVec3_c &GetCcMove() const {
return mCcMove;
}
};
struct cCcD_SrcGObjTgInfo {
@@ -323,6 +327,36 @@ struct cCcD_SrcGObjTg {
/* 0x0E */ u16 mField_0x0E;
};
enum cCcD_AtType_e {
/* 0x 0000 0001 */ AT_TYPE_0x1 = (1 << 0),
/* 0x 0000 0002 */ AT_TYPE_0x2 = (1 << 1),
/* 0x 0000 0004 */ AT_TYPE_0x4 = (1 << 2),
/* 0x 0000 0008 */ AT_TYPE_0x8 = (1 << 3),
/* 0x 0000 0010 */ AT_TYPE_0x10 = (1 << 4),
/* 0x 0000 0020 */ AT_TYPE_0x20 = (1 << 5),
/* 0x 0000 0040 */ AT_TYPE_0x40 = (1 << 6),
/* 0x 0000 0080 */ AT_TYPE_0x80 = (1 << 7),
/* 0x 0000 0100 */ AT_TYPE_0x100 = (1 << 8),
/* 0x 0000 0200 */ AT_TYPE_0x200 = (1 << 9),
/* 0x 0000 0400 */ AT_TYPE_0x400 = (1 << 10),
/* 0x 0000 0800 */ AT_TYPE_0x800 = (1 << 11),
/* 0x 0000 1000 */ AT_TYPE_0x1000 = (1 << 12),
/* 0x 0000 2000 */ AT_TYPE_0x2000 = (1 << 13),
/* 0x 0000 4000 */ AT_TYPE_0x4000 = (1 << 14),
/* 0x 0000 8000 */ AT_TYPE_0x8000 = (1 << 15),
/* 0x 0001 0000 */ AT_TYPE_0x10000 = (1 << 16),
/* 0x 0002 0000 */ AT_TYPE_0x20000 = (1 << 17),
/* 0x 0004 0000 */ AT_TYPE_0x40000 = (1 << 18),
/* 0x 0008 0000 */ AT_TYPE_0x80000 = (1 << 19),
/* 0x 0010 0000 */ AT_TYPE_0x100000 = (1 << 20),
/* 0x 0020 0000 */ AT_TYPE_0x200000 = (1 << 21),
/* 0x 0040 0000 */ AT_TYPE_0x400000 = (1 << 22),
/* 0x 0080 0000 */ AT_TYPE_0x800000 = (1 << 23),
/* 0x 0100 0000 */ AT_TYPE_BUGNET = (1 << 24),
/* 0x 0200 0000 */ AT_TYPE_0x2000000 = (1 << 25),
/* 0x 0400 0000 */ AT_TYPE_0x4000000 = (1 << 26),
/* 0x 0800 0000 */ AT_TYPE_0x8000000 = (1 << 27),
};
enum cCcD_AtModifiers_e {
/* 0x 0000 0001 */ AT_MOD_FIRE = (1 << 0),
/* 0x 0000 0002 */ AT_MOD_0x2 = (1 << 1),
@@ -758,13 +792,13 @@ public:
}
bool ChkTgHit() {
return mTg.MskSPrm(1) != 0 && mTg.GetActor() != nullptr;
return mTg.MskRPrm(1) != 0 && mTg.GetActor() != nullptr;
}
bool ChkAtHit() {
return mAt.MskSPrm(1) != 0 && mAt.GetActor() != nullptr;
return mAt.MskRPrm(1) != 0 && mAt.GetActor() != nullptr;
}
bool ChkCoHit() {
return mCo.MskSPrm(1) != 0 && mCo.GetActor() != nullptr;
return mCo.MskRPrm(1) != 0 && mCo.GetActor() != nullptr;
}
dAcObjBase_c *GetAc() {
+2 -2
View File
@@ -57,8 +57,8 @@ public:
return EGG::Math<f32>::sqrt(mNormal.x * mNormal.x + mNormal.z * mNormal.z);
}
mAng GetAngleY() const {
return cM::atan2s(mNormal.x, mNormal.z);
s32 GetAngleY() const {
return mAng(cM::atan2s(mNormal.x, mNormal.z));
}
};
+4
View File
@@ -16,6 +16,10 @@ public:
void SetR(f32);
void SetC(f32, f32, f32);
void SetC(const mVec3_c &p) {
SetC(&p);
}
f32 GetYDist(f32) const;
bool Cross(const cM3dGTri *, f32 *, mVec3_c *);
void Clamp(const mVec3_c &, mVec3_c &) const;
+2 -4
View File
@@ -1,10 +1,9 @@
#ifndef D_T_TUMBLE_WEED_H
#define D_T_TUMBLE_WEED_H
#include "d/a/obj/d_a_obj_tumble_weed.h"
#include "d/t/d_tg.h"
#include "f/f_list_nd.h"
#include "s/s_State.hpp"
#include "s/s_StateMgr.hpp"
class dTgTumbleWeed_c : public dTg_c {
public:
@@ -29,8 +28,7 @@ private:
u16 tumbleweedTimer;
u16 padding;
u16 windTimer;
// TODO dAcObjTumbleWeed
dAcRef_c<dAcBase_c> childTumbleweed;
dAcRef_c<dAcOTumbleWeed_c> childTumbleweed;
u16 someField;
};
+21 -30
View File
@@ -4,31 +4,32 @@
#include "common.h"
#include "egg/math/eggVector.h"
namespace EGG {
struct Quatf : public Vector3f {
struct Quatf {
Quatf() {}
Quatf(f32 f, Vector3f v) : w(f), Vector3f(v) {}
Quatf(f32 f, f32 x, f32 y, f32 z) : w(f), Vector3f(Vector3f(x, y, z)) {}
Quatf(f32 f, const Vector3f &v) : w(f), v(v) {}
Quatf(f32 f, f32 x, f32 y, f32 z) : w(f), v(Vector3f(x, y, z)) {}
~Quatf() {}
friend Quatf operator*(const Quatf &q, const Vector3f &vec) {
Vector3f crossed = q.cross(vec);
Vector3f crossed = q.v.cross(vec);
Vector3f scaled = vec * q.w;
Quatf ret = Quatf(-q.Vector3f::dot(vec), crossed + scaled);
Quatf ret = Quatf(-q.v.dot(vec), crossed + scaled);
return ret;
}
// TODO: Implement
friend Quatf operator*(const Quatf &u, const Quatf &v) {
Vector3f cross = u.cross(v);
Vector3f v_mul_w = u.w * v;
Vector3f u_mul_w = v.w * v;
Vector3f added_2 = u_mul_w + (cross + v_mul_w);
Quatf out = Quatf(u.w * v.w - u.Vector3f::dot(v), added_2);
return out;
};
friend Quatf operator*(const Quatf &lhs, const Quatf &rhs) {
Vector3f cross = lhs.v.cross(rhs.v);
Vector3f scaledRhs = lhs.w * rhs.v;
Vector3f tmp0 = cross + scaledRhs;
Vector3f scaledLhs = rhs.w * lhs.v;
Vector3f tmp1 = tmp0 + scaledLhs;
return Quatf(lhs.w * rhs.w - lhs.v.dot(rhs.v), tmp1);
}
/* 8049b390 */ void set(f32 fw, f32 fx, f32 fy, f32 fz);
/* */ void set(f32 f, const Vector3f &vec);
@@ -47,27 +48,17 @@ struct Quatf : public Vector3f {
/* */ void makeVectorRotationLimit(Vector3f &, Vector3f &, f32);
/* 8049bbb0 */ void makeVectorRotation(Vector3f &, Vector3f &);
f32 dot(const Quatf &q) const {
return w * w + q.x * q.x + q.y * q.y + q.z * q.z;
}
f32 length() const {
return Math<f32>::sqrt(dot(*this));
}
void multScalar(f32 s) {
w *= s;
x *= s;
y *= s;
z *= s;
v.x *= s;
v.y *= s;
v.z *= s;
}
void setUnit() {
set(1.0f, 0.0f, 0.0f, 0.0f);
}
// union {
// Vector3f v;
// struct {
// f32 x, y, z;
// };
// };
Vector3f v;
f32 w;
};
+8 -3
View File
@@ -5,7 +5,6 @@
#include "egg/math/eggMath.h"
#include "nw4r/math.h"
namespace EGG {
struct Vector3f : public nw4r::math::VEC3 {
@@ -28,11 +27,11 @@ struct Vector3f : public nw4r::math::VEC3 {
}
friend Vector3f operator*(f32 f, const Vector3f &v) {
return v.operator*(f);
return Vector3f(v.x * f, v.y * f, v.z * f);
}
// __pl__Q23EGG8Vector3fCFRCQ23EGG8Vector3f
Vector3f operator+(const Vector3f &v) {
Vector3f operator+(const Vector3f &v) const {
return Vector3f(x + v.x, y + v.y, z + v.z);
}
@@ -96,6 +95,12 @@ struct Vector3f : public nw4r::math::VEC3 {
multScalar(1.0f / f);
}
f32 angle(const Vector3f &v) const {
f32 a = dot(v);
f32 b = cross(v).length();
return EGG::Math<f32>::abs(EGG::Math<f32>::atan2(b, a));
}
// dot__Q23EGG8Vector3fCFRCQ23EGG8Vector3f
f32 dot(const Vector3f &v) const {
return x * v.x + y * v.y + z * v.z;
+44 -1
View File
@@ -3,6 +3,8 @@
#include "c/c_math.h"
#include "common.h"
#include "m/m_vec.h"
#include "math.h"
#include "nw4r/math/math_triangular.h"
struct mAng {
@@ -13,6 +15,9 @@ struct mAng {
static mAng atan2s(f32 a, f32 b) {
return mAng(cM::atan2s(a, b));
}
static mAng fromVec(const mVec3_c &other) {
return mAng(cM::atan2s(other.x, other.z));
}
operator s16() const {
return mVal;
@@ -47,15 +52,53 @@ struct mAng {
s16 mVal;
f32 degree() const {
return (360.0f / 65536.0f) * mVal;
}
static mAng fromDeg(f32 deg) {
return deg * sDegToAng;
}
static s16 angle(const mVec3_c &a, const mVec3_c &b) {
f32 rads = a.angle(b);
return fromRad(rads);
}
f32 radian() const {
return ((2.f * M_PI) / 65536.0f) * mVal;
}
static s16 fromRad(f32 rad) {
return rad * sRadToAng;
}
static f32 rad2deg(f32 rad) {
return rad * (360.f / (2.f * M_PI));
}
static f32 deg2rad(f32 deg) {
return deg * ((2.f * M_PI) / 360.f);
}
static s16 deg2short(f32 deg) {
return deg * (65536.0f / 360.0f);
}
static f32 short2deg(s16 angle) {
return (360.0f / 65536.0f) * angle;
}
static f32 short2rad(s16 angle) {
return ((2.f * M_PI) / 65536.0f) * angle;
}
static f32 short2norm(s16 angle) {
return 3.0517578E-5f * angle;
}
static s16 rad2short(f32 rad) {
return rad * (65536.0f / (2.f * M_PI));
}
private:
static const f32 sHalfCircleDeg;
static const f32 sAngToDeg;
static const f32 sAngToRad;
static const f32 NotSure;
static const f32 sAngToNorm;
static const f32 sDegToRad;
static const f32 sDegToAng;
static const f32 sRadToAng;
+13
View File
@@ -8,6 +8,7 @@
#include "m/m_angle.h"
#include "m/m_vec.h"
#include "nw4r/types_nw4r.h"
#include "rvl/MTX/mtx.h"
class mMtx_c : public EGG::Matrix34f {
typedef f32 (*MtxRef)[4];
@@ -63,6 +64,18 @@ public:
void rot(int, int); // does some werrd operation to rotate the matrix
bool quatRelated();
void trans(const mVec3_c &v) {
PSMTXTrans(*this, v.x, v.y, v.z);
}
void trans(f32 x, f32 y, f32 z) {
PSMTXTrans(*this, x, y, z);
}
mMtx_c &operator+=(const mMtx_c &rhs) {
PSMTXConcat(*this, rhs, *this);
return *this;
}
public:
static mMtx_c Identity;
};
+6
View File
@@ -8,6 +8,12 @@ class mQuat_c : public EGG::Quatf {
public:
mQuat_c() {}
mQuat_c(f32 x, f32 y, f32 z, f32 w) : EGG::Quatf(w, x, y, z) {}
mQuat_c &operator=(const EGG::Quatf &rhs) {
v = rhs.v;
w = rhs.w;
return *this;
}
void fn_802F2780(const mQuat_c &other);
};
+7 -6
View File
@@ -3,9 +3,11 @@
#include "c/c_math.h"
#include "common.h"
#include "egg/math/eggMath.h"
#include "egg/math/eggVector.h"
#include "m/m_angle.h"
#include "nw4r/math/math_types.h"
#include "nw4r/types_nw4r.h"
#include "rvl/MTX/vec.h"
class mAng;
@@ -217,17 +219,16 @@ public:
void rotY(const mAng &angle);
// ???
s32 getAngleY() const {
return mAng(cM::atan2s(x, z));
}
void CopyTo(nw4r::math::VEC3 *p) {
p->x = x;
p->y = y;
p->z = z;
}
s16 ang() const {
return cM::atan2s(x * x, z * z);
}
static mVec3_c Zero;
static mVec3_c Ex;
static mVec3_c Ey;
+8
View File
@@ -22,6 +22,14 @@ void addCalcScaled(float *value, float stepSize, float maxStep);
int absDiff(short a1, short a2);
BOOL chaseUC(u8 *value, u8 target, u8 stepSize);
template <typename T>
T calcTimer(T *val) {
if (*val != 0) {
*val -= 1;
}
return *val;
}
} // namespace sLib
#endif
+393 -3
View File
@@ -1,13 +1,403 @@
#include "d/a/obj/d_a_obj_tumble_weed.h"
#include "c/c_math.h"
#include "common.h"
#include "d/a/d_a_player.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/bg/d_bg_s.h"
#include "d/col/bg/d_bg_s_gnd_chk.h"
#include "d/col/c/c_cc_d.h"
#include "d/col/c/c_m3d_g_pla.h"
#include "d/col/cc/d_cc_d.h"
#include "d/col/cc/d_cc_s.h"
#include "egg/math/eggMath.h"
#include "egg/math/eggQuat.h"
#include "f/f_base.h"
#include "m/m_angle.h"
#include "m/m_mtx.h"
#include "m/m_quat.h"
#include "m/m_vec.h"
#include "nw4r/math/math_triangular.h"
#include "rvl/MTX/mtx.h"
#include "rvl/MTX/vec.h"
#include "s/s_Math.h"
#include "toBeSorted/dowsing_target.h"
void float_ordering() {
const f32 arr[] = {5.f, 15.f, 7.f, 0.5f, 0.1f};
}
SPECIAL_ACTOR_PROFILE(OBJ_TUMBLE_WEED, dAcOTumbleWeed_c, fProfile::OBJ_TUMBLE_WEED, 0x243, 0, 2);
STATE_DEFINE(dAcOTumbleWeed_c, Wait);
STATE_DEFINE(dAcOTumbleWeed_c, Slope);
void dAcOTumbleWeed_c::initializeState_Wait() {}
void dAcOTumbleWeed_c::executeState_Wait() {}
dCcD_SrcSph dAcOTumbleWeed_c::sSphSrc = {
/* mObjInf */
{/* mObjAt */ {0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0},
/* mObjTg */ {0xFFB77FFF, 0x111, {8, 0x40F}, 0, 0},
/* mObjCo */ {0xE9}},
/* mSphInf */
{60.f},
};
bool dAcOTumbleWeed_c::createHeap() {
mResFile = getOarcResFile("GrassRollDry");
TRY_CREATE(mMdl.create(mResFile.GetResMdl("GrassRollDry"), &heap_allocator, 0x120, 1, nullptr));
return true;
}
int dAcOTumbleWeed_c::actorCreate() {
CREATE_ALLOCATOR(dAcOTumbleWeed_c);
mObjAcch.Set(this, 1, &mAcchCir);
mAcchCir.SetWall(20.f, 60.f);
mObjAcch.OffClrSpeedY();
mObjAcch.SetGndThinCellingOff();
mStts.SetRank(3);
mSph.Set(sSphSrc);
mSph.SetStts(mStts);
mDowsingTarget.initialize(DowsingTarget::SLOT_TREASURE, 0, nullptr, 0.0f);
mDowsingTarget.doRegister();
forwardAccel = -2.f;
forwardMaxSpeed = -40.f;
mField_0x974 = 0.0f;
mField_0x98B = true;
mWind = mVec3_c::Zero;
mSpeedTarget = cM::rndFX(2.5f) + 15.f;
mField_0x978 = cM::rndF(40.f);
mField_0x97C = cM::rndFX(0.25f) + 1.f;
mTumbleTimer = (150);
mField_0x910.set(1.f, 0.f, 0.f, 0.f);
mScale.set(1.f, 1.f, 1.f);
mStateMgr.changeState(StateID_Wait);
boundingBox.Set(mVec3_c(-50.f, -20.f, -50.f), mVec3_c(50.f, 60.f, 50.f));
return SUCCEEDED;
}
int dAcOTumbleWeed_c::actorPostCreate() {
return SUCCEEDED;
}
int dAcOTumbleWeed_c::doDelete() {
return SUCCEEDED;
}
extern "C" void fn_800247D0(void *, mVec3_c, f32);
extern "C" UNKWORD BLUR_AND_PALETTE_MGR;
int dAcOTumbleWeed_c::actorExecute() {
if (!mField_0x98C && !isStopped()) {
mField_0x968 = velocity;
mField_0x968.y = 0.0f;
mField_0x968.normalize();
mField_0x98C = true;
}
mStateMgr.executeState();
calcWind();
sLib::chase(&mField_0x980, 1.f, 0.1f);
fn_800247D0(&BLUR_AND_PALETTE_MGR, mField_0x968, mField_0x980);
calcVelocity();
position += velocity;
position += mStts.GetCcMove();
mObjAcch.CrrPos(*dBgS::GetInstance());
mField_0x974 += position.y - mOldPosition.y;
if (checkCollect()) {
dAcPy_c::LINK->bugNetCollectTreasure(0xA3 /* TODO(Item Id) ITEM_TUMBLEWEED */);
FUN_8002dcd0();
return SUCCEEDED;
}
if (checkBreak()) {
doBreak();
return SUCCEEDED;
}
if (mSph.ChkTgHit() && mSph.ChkTgAtHitType(AT_TYPE_0x10000 | AT_TYPE_0x200)) {
mField_0x974 = 0.f;
adjustTumble(mSph.GetTg_0x2C() * 0.06f);
}
adjustTimeScale();
// TODO(mObjectActorFlags)
if (mObjectActorFlags & 0x2) {
// Weak function not being placed right
if (sLib::calcTimer(&mTumbleTimer) == 0) {
FUN_8002dcd0();
return SUCCEEDED;
}
} else {
mTumbleTimer = 150;
}
mSph.SetC(getPosition());
mSph.SetR(mScale.x * 60.f);
dCcS::GetInstance()->Set(&mSph);
updateMatrix();
calcMatrix();
playSoundEffect1(0xC2C); // TODO(Sound Id)
mMdl.setLocalMtx(mWorldMtx);
mMdl.setScale(mScale);
mMdl.calc(false);
return SUCCEEDED;
}
int dAcOTumbleWeed_c::draw() {
drawModelType1(&mMdl);
static mQuat_c shadowRot(0.f, 30.f, 0.f, 50.f);
if (0.f < mScale.x) {
drawShadow(mShdw, nullptr, mShadowMtx, &shadowRot, -1, -1, -1, -1, -1, position.y - mObjAcch.GetGroundH());
}
return SUCCEEDED;
}
void dAcOTumbleWeed_c::initializeState_Wait() {
mbOnGround = false;
}
void dAcOTumbleWeed_c::executeState_Wait() {
if (mObjAcch.ChkGroundLanding() && !mbOnGround) {
tumbleBounceMaybe();
return;
}
if (!mObjAcch.ChkGndHit()) {
return;
}
velocity.y = 0.f;
mField_0x974 = 0.f;
if (checkSlope()) {
mStateMgr.changeState(StateID_Slope);
} else {
adjustSpeed();
if (forwardSpeed < 0.1f) {
mField_0x98B = false;
sLib::chase(&forwardSpeed, 0.f, 0.05f);
}
}
}
void dAcOTumbleWeed_c::finalizeState_Wait() {}
void dAcOTumbleWeed_c::initializeState_Slope() {}
void dAcOTumbleWeed_c::executeState_Slope() {}
void dAcOTumbleWeed_c::executeState_Slope() {
if (mObjAcch.ChkGroundLanding() && !mbOnGround) {
tumbleBounceMaybe();
return;
}
if (!mObjAcch.ChkGndHit()) {
return;
}
velocity.y = 0.f;
adjustAngle();
adjustSpeed();
if (!checkSlope()) {
mStateMgr.changeState(StateID_Wait);
}
}
void dAcOTumbleWeed_c::finalizeState_Slope() {}
bool dAcOTumbleWeed_c::checkBreak() {
if (mObjAcch.ChkWallHit(nullptr) && forwardSpeed > 5.f) {
return true;
}
if (mSph.ChkTgHit() && !mSph.ChkTgAtHitType(AT_TYPE_BUGNET)) {
return true;
}
if (mObjAcch.ChkGndHit() && mField_0x974 < -300.f) {
return true;
}
if (fn_475_E40()) {
return true;
}
if (mObjAcch.ChkGndHit() && checkInvalidGround()) {
return true;
}
return false;
}
bool dAcOTumbleWeed_c::fn_475_E40() const {
return mField_0x974 < -10000.f;
}
bool dAcOTumbleWeed_c::checkSlope() {
cM3dGPla pla;
dBgS::GetInstance()->GetTriPla(mObjAcch.mGnd, &pla);
mAng ang = mAng::angle(mVec3_c::Ey, pla.GetN());
return sLib::absDiff(ang, 0) > mAng::deg2short(1);
}
bool dAcOTumbleWeed_c::checkCollect() {
return mSph.ChkTgHit() && mSph.ChkTgAtHitType(AT_TYPE_BUGNET) ? true : false;
}
bool dAcOTumbleWeed_c::checkInvalidGround() const {
u32 code = dBgS::GetInstance()->GetSpecialCode(mObjAcch.mGnd);
return code == POLY_ATTR_LAVA || code == POLY_ATTR_SAND_MED || code == POLY_ATTR_SAND_DEEP_INSTANT ||
code == POLY_ATTR_SAND_DEEP_SLOW;
}
extern "C" u16 PARTICLE_RESOURCE_ID_MAPPING_743_;
extern "C" void fn_800298B0(u16, mVec3_c *, mAng3_c *, u32, u32, u32, u32, u32);
void dAcOTumbleWeed_c::doBreak() {
playSound(0xC2D); // TODO(Sound Id)
mVec3_c pos = getPosition();
fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_743_, &pos, nullptr, 0, 0, 0, 0, 0);
deleteRequest();
}
void dAcOTumbleWeed_c::calcMatrix() {
if (mField_0x98B) {
f32 vel_mag = PSVECMag(velocity);
f32 f1 = mAng(vel_mag * (mField_0x978 + 200.f)).radian();
f32 f2 = mAng(vel_mag * 182.0f * 0.2f).radian();
f32 f0 = mAng(angle.y - rotation.y).radian();
mQuat_c q0, q1, q2, q3;
q1.setAxisRotation(mVec3_c::Ey, f0);
q0.setAxisRotation(mVec3_c::Ey, -f0);
q3.setAxisRotation(mVec3_c::Ex, f1);
q2.setAxisRotation(mVec3_c::Ey, f2);
mField_0x910 = q1 * q3 * q2 * q0 * mField_0x910;
}
mMtx_c mtx0, mtx1, mtx2;
mShadowMtx.copyFrom(mWorldMtx);
mtx1.trans(getPosition() - position);
mShadowMtx += mtx1;
mtx0.fromQuat(mField_0x910);
mtx2.trans(0.f, 40.f, 0.f);
mWorldMtx += mtx2;
mWorldMtx += mtx0;
}
void dAcOTumbleWeed_c::adjustAngle() {
cM3dGPla pla;
dBgS::GetInstance()->GetTriPla(mObjAcch.mGnd, &pla);
mVec3_c vel = velocity; // ok?
angle.y = mAng::fromVec(velocity);
}
void dAcOTumbleWeed_c::adjustSpeed() {
cM3dGPla pla;
// BUG
// the ground angle calculation happens before retrieving the grounds normal
// this is probably hard to notice due to the little effect it has.
// Effect:
// Tumbleweed slows to the target much quicker than intended
// Tumbleweed speeds to the target + 5.0f much quicker than intended
mAng gndAngle = mAng::angle(mVec3_c::Ey, pla.GetN());
dBgS::GetInstance()->GetTriPla(mObjAcch.mGnd, &pla);
f32 speedStep = 0.5f;
f32 step = gndAngle.cos() * speedStep;
// Flat Ground or not in the direction of the slope
// Slows down
if (gndAngle < mAng::deg2short(1) ||
sLib::absDiff(cM::atan2s(pla.GetN().x, pla.GetN().z), GetAngle().y) > mAng::deg2short(90)) {
sLib::chase(&forwardSpeed, mSpeedTarget, step);
}
// Sloped Ground and in the direction of the slope
// Speeds up
else {
forwardSpeed = cM::minMaxLimit(forwardSpeed + step, mSpeedTarget, mSpeedTarget + 5.0f);
}
}
void dAcOTumbleWeed_c::tumbleBounceMaybe() {
velocity.y *= -0.75f;
forwardSpeed *= 0.9f;
if (forwardSpeed < 15.f) {
forwardSpeed = mSpeedTarget;
}
mbOnGround = false;
if (velocity.y < 5.f) {
velocity.y = 0.f;
mbOnGround = true;
}
}
void dAcOTumbleWeed_c::adjustTimeScale() {
mTimeArea.check(getRoomId(), GetPostion(), 0, 30.f, 0.1f);
if (0.f < mTimeArea.getDistMaybe()) {
sLib::chase(&mScale.y, 0.f, 0.07f);
mScale.z = mScale.y;
mScale.x = mScale.y;
} else {
sLib::chase(&mScale.y, 1.f, 0.07f);
mScale.z = mScale.y;
mScale.x = mScale.y;
}
}
void dAcOTumbleWeed_c::adjustTumble(const mVec3_c &dir) {
mField_0x98B = true;
velocity.x += dir.x;
velocity.z += dir.z;
forwardSpeed = mField_0x97C * EGG::Math<f32>::sqrt(velocity.x * velocity.x + velocity.z * velocity.z);
angle.y = mAng::fromVec(dir);
}
void dAcOTumbleWeed_c::setWind(const mVec3_c &wind) {
mWind = wind;
mWindTimer = cM::rndInt(10);
}
void dAcOTumbleWeed_c::calcWind() {
if (!isWindStop() && sLib::calcTimer(&mWindTimer) == 0) {
velocity.y = cM::rndFX(3.0f) + 15.f;
forwardSpeed = cM::rndFX(5.0f) + 15.f;
mWind = mVec3_c::Zero;
mField_0x980 = 0.f;
}
}
mVec3_c dAcOTumbleWeed_c::getPosition() const {
mMtx_c mtx;
mVec3_c vec;
mtx.ZXYrotS(rotation.x, rotation.y, rotation.z);
PSMTXMultVecSR(mtx, mVec3_c::Ey, vec);
return position + vec * 40.f;
}
void float_ordering2() {
const f32 arr[] = {30.f, 0.07f, 20.f, -10000.f, 5.f};
}
+3 -4
View File
@@ -1,13 +1,12 @@
#include "d/t/d_t_gekotag.h"
#include "c/c_math.h"
#include "common.h"
#include "d/a/d_a_player.h"
#include "d/a/e/d_a_e_geko.h"
#include "d/a/obj/d_a_obj_base.h"
#include "f/f_base.h"
#include "f/f_profile_name.h"
#include "m/m_angle.h"
#include "s/s_Math.h"
#pragma explicit_zero_data on
static u32 initialRotX = 0;
@@ -60,8 +59,8 @@ void dTgGekoTag::executeState_Wait() {
void dTgGekoTag::finalizeState_Wait() {}
void dTgGekoTag::doExecute() {
cM::calcTimer(&mTimer2);
if (cM::calcTimer(&mTimer1) != 0) {
sLib::calcTimer(&mTimer2);
if (sLib::calcTimer(&mTimer1) != 0) {
return;
}
+3 -3
View File
@@ -1,9 +1,9 @@
#include "d/t/d_t_touch.h"
#include "c/c_math.h"
#include "toBeSorted/area_math.h"
#include "d/flag/sceneflag_manager.h"
#include "s/s_Math.h"
#include "toBeSorted/area_math.h"
SPECIAL_ACTOR_PROFILE(TOUCH_TAG, dTgTouchTag, fProfile::TOUCH_TAG, 0x028E, 0, 0);
@@ -59,7 +59,7 @@ void dTgTouchTag::executeState_Wait() {
actor = static_cast<dAcBase_c *>(fManager_c::searchBaseByProfName(ACTIVATORS[mActivatorIndex], actor));
}
if (cM::calcTimer(&mFlagTimer) == 0) {
if (sLib::calcTimer(&mFlagTimer) == 0) {
if (mZoneFlag != 0xFF && SceneflagManager::sInstance->checkBoolFlag(roomid, mZoneFlag)) {
SceneflagManager::sInstance->unsetFlag(roomid, mZoneFlag);
}
+5 -15
View File
@@ -1,7 +1,7 @@
#include "d/t/d_t_tumble_weed.h"
#include "c/c_math.h"
#include "m/m_vec.h"
#include "s/s_Math.h"
SPECIAL_ACTOR_PROFILE(TUMBLE_WEED_TAG, dTgTumbleWeed_c, fProfile::TUMBLE_WEED_TAG, 0x0244, 0, 0);
@@ -17,32 +17,23 @@ int dTgTumbleWeed_c::create() {
return SUCCEEDED;
}
u16 decr(u16 *num);
int dTgTumbleWeed_c::doDelete() {
return SUCCEEDED;
}
int dTgTumbleWeed_c::actorExecute() {
mStateMgr.executeState();
decr(&tumbleweedTimer);
sLib::calcTimer(&tumbleweedTimer);
return SUCCEEDED;
}
u16 decr(u16 *num) {
if (*num != 0) {
(*num)--;
}
return *num;
}
int dTgTumbleWeed_c::draw() {
return SUCCEEDED;
}
void dTgTumbleWeed_c::initializeState_AreaOut() {}
void dTgTumbleWeed_c::executeState_AreaOut() {
if (decr(&windTimer) == 0) {
if (sLib::calcTimer(&windTimer) == 0) {
windTimer = 0x96;
if (shouldDoWind()) {
mStateMgr.changeState(StateID_Wind);
@@ -63,7 +54,7 @@ void dTgTumbleWeed_c::executeState_AreaIn() {
}
tumbleweedTimer = 600;
}
if (decr(&windTimer) == 0) {
if (sLib::calcTimer(&windTimer) == 0) {
windTimer = 0x96;
if (shouldDoWind()) {
mStateMgr.changeState(StateID_Wind);
@@ -76,12 +67,11 @@ void dTgTumbleWeed_c::executeState_AreaIn() {
}
void dTgTumbleWeed_c::finalizeState_AreaIn() {}
extern "C" void fn_475_1B00(fBase_c *, mVec3_c &);
void dTgTumbleWeed_c::initializeState_Wind() {
mVec3_c vec;
getWind(&vec);
if (childTumbleweed.get() != nullptr) {
fn_475_1B00(childTumbleweed.get(), vec);
childTumbleweed.get()->setWind(vec);
}
}
+2 -3
View File
@@ -1,12 +1,11 @@
#include "d/a/obj/d_a_obj_switch.h"
#include "c/c_math.h"
#include "d/a/d_a_player.h"
#include "d/col/bg/d_bg_s.h"
#include "d/col/bg/d_bg_w.h"
#include "d/flag/sceneflag_manager.h"
#include "nw4r/g3d/g3d_resfile.h"
#include "s/s_Math.h"
#include "d/flag/sceneflag_manager.h"
SPECIAL_ACTOR_PROFILE(OBJ_SW, dAcOsw_c, fProfile::OBJ_SW, 0x12B, 0, 0x1002);
@@ -269,7 +268,7 @@ void dAcOsw_c::executeState_OffWait() {
if (field_0x5F1 != 0) {
field_0x5F3 = 1;
}
if (mSwitchType != 1 && cM::calcTimer(&field_0x5EC) == 0 && field_0x5F3 == 0) {
if (mSwitchType != 1 && sLib::calcTimer(&field_0x5EC) == 0 && field_0x5F3 == 0) {
mStateMgr.changeState(StateID_Off);
}
}
+1 -1
View File
@@ -29,7 +29,7 @@ bool cM3dGPla::getCrossYLessD(const mVec3_c &point, f32 *out) const {
}
mAng cM3dGPla::GetAngle(mAng ang) const {
mAng angleY = mNormal.getAngleY();
mAng angleY = GetAngleY();
angleY = angleY - ang;
+4 -4
View File
@@ -1,8 +1,8 @@
#include "d/t/d_t_switch.h"
#include "c/c_math.h"
#include "toBeSorted/event.h"
#include "d/flag/sceneflag_manager.h"
#include "s/s_Math.h"
#include "toBeSorted/event.h"
#include "toBeSorted/scgame.h"
@@ -144,7 +144,7 @@ void dTgSw_c::initializeState_On() {
mTimer = 4;
}
void dTgSw_c::executeState_On() {
if (cM::calcTimer(&mTimer) == 0) {
if (sLib::calcTimer(&mTimer) == 0) {
mStateMgr.changeState(StateID_OffWait);
}
}
@@ -173,7 +173,7 @@ void dTgSw_c::executeState_Off() {
mActorEvent.scheduleEvent(event, 0);
return;
}
if (cM::calcTimer(&mTimer) == 0) {
if (sLib::calcTimer(&mTimer) == 0) {
if (mThird2 == 1) {
resetAllSwitches();
} else if (mThird2 != 2) {
+55 -55
View File
@@ -126,15 +126,15 @@ void Matrix34f::makeST(const Vector3f &s, const Vector3f &t) {
}
void Matrix34f::makeSQT(const Vector3f &s, const Quatf &q, const Vector3f &t) {
f32 yy = 2.0f * q.y * q.y;
f32 zz = 2.0f * q.z * q.z;
f32 xx = 2.0f * q.x * q.x;
f32 xy = 2.0f * q.x * q.y;
f32 xz = 2.0f * q.x * q.z;
f32 yz = 2.0f * q.y * q.z;
f32 wz = 2.0f * q.w * q.z;
f32 wx = 2.0f * q.w * q.x;
f32 wy = 2.0f * q.w * q.y;
f32 yy = 2.0f * q.v.y * q.v.y;
f32 zz = 2.0f * q.v.z * q.v.z;
f32 xx = 2.0f * q.v.x * q.v.x;
f32 xy = 2.0f * q.v.x * q.v.y;
f32 xz = 2.0f * q.v.x * q.v.z;
f32 yz = 2.0f * q.v.y * q.v.z;
f32 wz = 2.0f * q.w * q.v.z;
f32 wx = 2.0f * q.w * q.v.x;
f32 wy = 2.0f * q.w * q.v.y;
m[0][0] = s.x * (1.0f - yy - zz);
m[0][1] = s.y * (xy - wz);
@@ -154,15 +154,15 @@ void Matrix34f::makeSQT(const Vector3f &s, const Quatf &q, const Vector3f &t) {
}
void Matrix34f::makeQT(const Quatf &q, const Vector3f &t) {
f32 yy = 2.0f * q.y * q.y;
f32 zz = 2.0f * q.z * q.z;
f32 xx = 2.0f * q.x * q.x;
f32 xy = 2.0f * q.x * q.y;
f32 xz = 2.0f * q.x * q.z;
f32 yz = 2.0f * q.y * q.z;
f32 wz = 2.0f * q.w * q.z;
f32 wx = 2.0f * q.w * q.x;
f32 wy = 2.0f * q.w * q.y;
f32 yy = 2.0f * q.v.y * q.v.y;
f32 zz = 2.0f * q.v.z * q.v.z;
f32 xx = 2.0f * q.v.x * q.v.x;
f32 xy = 2.0f * q.v.x * q.v.y;
f32 xz = 2.0f * q.v.x * q.v.z;
f32 yz = 2.0f * q.v.y * q.v.z;
f32 wz = 2.0f * q.w * q.v.z;
f32 wx = 2.0f * q.w * q.v.x;
f32 wy = 2.0f * q.w * q.v.y;
m[0][0] = 1.0f - yy - zz;
m[0][1] = xy - wz;
@@ -182,15 +182,15 @@ void Matrix34f::makeQT(const Quatf &q, const Vector3f &t) {
}
void Matrix34f::makeQ(const Quatf &q) {
f32 yy = 2.0f * q.y * q.y;
f32 zz = 2.0f * q.z * q.z;
f32 xx = 2.0f * q.x * q.x;
f32 xy = 2.0f * q.x * q.y;
f32 xz = 2.0f * q.x * q.z;
f32 yz = 2.0f * q.y * q.z;
f32 wz = 2.0f * q.w * q.z;
f32 wx = 2.0f * q.w * q.x;
f32 wy = 2.0f * q.w * q.y;
f32 yy = 2.0f * q.v.y * q.v.y;
f32 zz = 2.0f * q.v.z * q.v.z;
f32 xx = 2.0f * q.v.x * q.v.x;
f32 xy = 2.0f * q.v.x * q.v.y;
f32 xz = 2.0f * q.v.x * q.v.z;
f32 yz = 2.0f * q.v.y * q.v.z;
f32 wz = 2.0f * q.w * q.v.z;
f32 wx = 2.0f * q.w * q.v.x;
f32 wy = 2.0f * q.w * q.v.y;
m[0][0] = 1.0f - yy - zz;
m[0][1] = xy - wz;
@@ -240,17 +240,17 @@ void Matrix34f::makeT(const Vector3f &t) {
}
void Matrix34f::fromQuat(const Quatf &q) {
m[0][0] = 1.0f - (2 * q.y * q.y) - (2.0f * q.z * q.z);
m[0][1] = (2.0f * q.x * q.y) - (2.0f * q.w * q.z);
m[0][2] = (2.0f * q.x * q.z) + (2.0f * q.w * q.y);
m[0][0] = 1.0f - (2 * q.v.y * q.v.y) - (2.0f * q.v.z * q.v.z);
m[0][1] = (2.0f * q.v.x * q.v.y) - (2.0f * q.w * q.v.z);
m[0][2] = (2.0f * q.v.x * q.v.z) + (2.0f * q.w * q.v.y);
m[1][0] = (2.0f * q.x * q.y) + (2.0f * q.w * q.z);
m[1][1] = 1.0f - (2.0f * q.x * q.x) - (2.0f * q.z * q.z);
m[1][2] = (2.0f * q.y * q.z) - (2.0f * q.w * q.x);
m[1][0] = (2.0f * q.v.x * q.v.y) + (2.0f * q.w * q.v.z);
m[1][1] = 1.0f - (2.0f * q.v.x * q.v.x) - (2.0f * q.v.z * q.v.z);
m[1][2] = (2.0f * q.v.y * q.v.z) - (2.0f * q.w * q.v.x);
m[2][0] = (2.0f * q.x * q.z) - (2.0f * q.w * q.y);
m[2][1] = (2.0f * q.y * q.z) + (2.0f * q.w * q.x);
m[2][2] = 1.0f - (2.0f * q.x * q.x) - (2.0f * q.y * q.y);
m[2][0] = (2.0f * q.v.x * q.v.z) - (2.0f * q.w * q.v.y);
m[2][1] = (2.0f * q.v.y * q.v.z) + (2.0f * q.w * q.v.x);
m[2][2] = 1.0f - (2.0f * q.v.x * q.v.x) - (2.0f * q.v.y * q.v.y);
m[2][3] = 0.0f;
m[1][3] = 0.0f;
@@ -298,38 +298,38 @@ void Matrix34f::toQuat(Quatf &q) const {
switch (tempMax) {
case 0:
q.w = Math<f32>::sqrt(temp0);
q.x = (0.25f / q.w) * (m[2][1] - m[1][2]);
q.y = (0.25f / q.w) * (m[0][2] - m[2][0]);
q.z = (0.25f / q.w) * (m[1][0] - m[0][1]);
q.v.x = (0.25f / q.w) * (m[2][1] - m[1][2]);
q.v.y = (0.25f / q.w) * (m[0][2] - m[2][0]);
q.v.z = (0.25f / q.w) * (m[1][0] - m[0][1]);
break;
case 1:
q.x = Math<f32>::sqrt(temp1);
q.w = (0.25f / q.x) * (m[2][1] - m[1][2]);
q.y = (0.25f / q.x) * (m[0][1] + m[1][0]);
q.z = (0.25f / q.x) * (m[0][2] + m[2][0]);
q.v.x = Math<f32>::sqrt(temp1);
q.w = (0.25f / q.v.x) * (m[2][1] - m[1][2]);
q.v.y = (0.25f / q.v.x) * (m[0][1] + m[1][0]);
q.v.z = (0.25f / q.v.x) * (m[0][2] + m[2][0]);
break;
case 2:
q.y = Math<f32>::sqrt(temp2);
q.w = (0.25f / q.y) * (m[0][2] - m[2][0]);
q.z = (0.25f / q.y) * (m[1][2] + m[2][1]);
q.x = (0.25f / q.y) * (m[1][0] + m[0][1]);
q.v.y = Math<f32>::sqrt(temp2);
q.w = (0.25f / q.v.y) * (m[0][2] - m[2][0]);
q.v.z = (0.25f / q.v.y) * (m[1][2] + m[2][1]);
q.v.x = (0.25f / q.v.y) * (m[1][0] + m[0][1]);
break;
case 3:
q.z = Math<f32>::sqrt(temp3);
q.w = (0.25f / q.z) * (m[1][0] - m[0][1]);
q.x = (0.25f / q.z) * (m[2][0] + m[0][2]);
q.y = (0.25f / q.z) * (m[2][1] + m[1][2]);
q.v.z = Math<f32>::sqrt(temp3);
q.w = (0.25f / q.v.z) * (m[1][0] - m[0][1]);
q.v.x = (0.25f / q.v.z) * (m[2][0] + m[0][2]);
q.v.y = (0.25f / q.v.z) * (m[2][1] + m[1][2]);
break;
default: break;
}
if (q.w < 0.0f) {
q.w = -q.w;
q.x = -q.x;
q.y = -q.y;
q.z = -q.z;
q.v.x = -q.v.x;
q.v.y = -q.v.y;
q.v.z = -q.v.z;
}
q.multScalar(Math<f32>::inv(q.length()));
q.multScalar(Math<f32>::inv(Math<f32>::sqrt(q.w * q.w + q.v.dot(q.v))));
}
void Matrix34f::slerpTo(const Matrix34f &m2, Matrix34f &out, f32 t) const {
+17 -17
View File
@@ -5,9 +5,9 @@ namespace EGG {
/* 8049b390 */
void Quatf::set(f32 fw, f32 fx, f32 fy, f32 fz) {
w = fw;
x = fx;
y = fy;
z = fz;
v.x = fx;
v.y = fy;
v.z = fz;
}
void Quatf::set(f32 fw, const Vector3f &vec) {
@@ -30,9 +30,9 @@ void Quatf::setRPY(const EGG::Vector3f &rpy) {
const f32 sy_cp = sy * cp;
w = (cy_cp * cr) + (sy_sp * sr);
x = (cy_cp * sr) - (sy_sp * cr);
y = (cy_sp * cr) + (sy_cp * sr);
z = (sy_cp * cr) - (cy_sp * sr);
v.x = (cy_cp * sr) - (sy_sp * cr);
v.y = (cy_sp * cr) + (sy_cp * sr);
v.z = (sy_cp * cr) - (cy_sp * sr);
}
/* NOT IN SS */
@@ -84,7 +84,7 @@ void Quatf::setAxisRotation(const Vector3f &axis, f32 rot) {
/* 8049b450 */
f32 Quatf::norm() {
return w * w + Vector3f::dot(*this);
return w * w + v.dot(v);
}
/* 8049b480 */
@@ -99,7 +99,7 @@ void Quatf::normalise() {
Quatf Quatf::conjugate() {
Quatf q;
q.w = w;
(Vector3f &)q = -1.0f * *this;
q.v = -1.0f * v;
return q;
}
@@ -109,7 +109,7 @@ Vector3f Quatf::rotateVector(const Vector3f &vec) {
conj = conjugate();
mult = *this * vec;
mult = mult * conj;
return (mult);
return (mult.v);
}
// /* NOT IN SS */
@@ -122,7 +122,7 @@ Vector3f Quatf::rotateVector(const Vector3f &vec) {
/* 8049b800 */
void Quatf::slerpTo(const Quatf &q2, f32 t, Quatf &out) const {
f32 dot = x * q2.x + y * q2.y + z * q2.z + w * q2.w;
f32 dot = v.x * q2.v.x + v.y * q2.v.y + v.z * q2.v.z + w * q2.w;
if (dot > 1.0f) {
dot = 1.0f;
@@ -156,9 +156,9 @@ void Quatf::slerpTo(const Quatf &q2, f32 t, Quatf &out) const {
b = -b;
}
out.x = a * x + b * q2.x;
out.y = a * y + b * q2.y;
out.z = a * z + b * q2.z;
out.v.x = a * v.x + b * q2.v.x;
out.v.y = a * v.y + b * q2.v.y;
out.v.z = a * v.z + b * q2.v.z;
out.w = a * w + b * q2.w;
}
@@ -166,7 +166,7 @@ void Quatf::slerpTo(const Quatf &q2, f32 t, Quatf &out) const {
void Quatf::limitSlerpTo(const Quatf &q2, f32 t, f32 t2, Quatf &out) const {
t2 *= 0.5f;
f32 dot = x * q2.x + y * q2.y + z * q2.z + w * q2.w;
f32 dot = v.x * q2.v.x + v.y * q2.v.y + v.z * q2.v.z + w * q2.w;
if (dot > 1.0f) {
dot = 1.0f;
@@ -204,9 +204,9 @@ void Quatf::limitSlerpTo(const Quatf &q2, f32 t, f32 t2, Quatf &out) const {
b = -b;
}
out.x = a * x + b * q2.x;
out.y = a * y + b * q2.y;
out.z = a * z + b * q2.z;
out.v.x = a * v.x + b * q2.v.x;
out.v.y = a * v.y + b * q2.v.y;
out.v.z = a * v.z + b * q2.v.z;
out.w = a * w + b * q2.w;
}
+2 -2
View File
@@ -488,7 +488,7 @@ bool mShadowChild_c::addMdl(scnLeaf_c &mdl, const mQuat_c &quat) {
// TODO this copy is a bit weird (reads members in a different order)
mQuat_c q = quat;
PSMTXMultVec(mtx.m, q, q);
PSMTXMultVec(mtx.m, q.v, q.v);
if (mNumLeaves == 0) {
mQuat = q;
@@ -501,7 +501,7 @@ bool mShadowChild_c::addMdl(scnLeaf_c &mdl, const mQuat_c &quat) {
bool mShadowChild_c::setGeom(const GXTexObj *texObj, const mMtx_c &mtx, const mQuat_c &quat) {
mQuat = quat;
PSMTXMultVec(mtx.m, mQuat, mQuat);
PSMTXMultVec(mtx.m, mQuat.v, mQuat.v);
if (texObj == nullptr) {
mTexObj = *mShadow_c::sTexObj;
} else {
+1 -1
View File
@@ -8,7 +8,7 @@ mAng3_c mAng3_c::Zero = mAng3_c(0, 0, 0);
const f32 mAng::sHalfCircleDeg = 360.0f / 2;
const f32 mAng::sAngToDeg = 360.0f / (1 << 16);
const f32 mAng::sAngToRad = 2 * M_PI / (1 << 16);
const f32 mAng::NotSure = 2.0f / (1 << 16);
const f32 mAng::sAngToNorm = 2.0f / (1 << 16);
const f32 mAng::sDegToRad = M_PI / 180.0f;
const f32 mAng::sDegToAng = (1 << 16) / 360.0f;
const f32 mAng::sRadToAng = (1 << 16) / (2 * M_PI);