mirror of
https://github.com/zeldaret/tp
synced 2026-07-11 15:28:38 -04:00
Z2SoundObject, JAUSoundAnimator OK, work on Z2SoundHandles (#1968)
* d_a_tag_evtarea mostly done, work on d_a_npc * work on d_a_npc_ash * work on Z2SoundHandles * Z2SoundObject, JAUSoundAnimator OK * Update Progress.md --------- Co-authored-by: randomsalience <randomsalience@gmail.com>
This commit is contained in:
@@ -48,6 +48,7 @@ public:
|
||||
int getMaxActiveSe() const { return mMaxActiveSe; }
|
||||
void setMaxActiveSe(int se) { mMaxActiveSe = se; }
|
||||
void setMaxInactiveSe(int se) { mMaxInactiveSe = se; }
|
||||
JSUList<JAISe>* getSeList() { return &mSeList; }
|
||||
int getNumSe() const { return mSeList.getNumLinks(); }
|
||||
JAIAudience* getAudience() { return (JAIAudience*)field_0x4.field_0x0; }
|
||||
|
||||
|
||||
@@ -90,8 +90,7 @@ struct JAISoundStatus_ {
|
||||
struct {
|
||||
u8 flag1 : 1;
|
||||
u8 flag2 : 1;
|
||||
u8 flag3 : 1;
|
||||
u8 flag4 : 1;
|
||||
u8 animationState : 2;
|
||||
u8 flag5 : 1;
|
||||
u8 flag6 : 1;
|
||||
u8 flag7 : 1;
|
||||
@@ -227,9 +226,16 @@ public:
|
||||
virtual bool JAISound_tryDie_() = 0;
|
||||
|
||||
JAISoundID getID() const;
|
||||
u8 getAnimationState() const { return status_.state.flags.animationState; }
|
||||
bool isAnimated() const { return getAnimationState() != 0; }
|
||||
void setAnimationState(u8 pState) {
|
||||
status_.state.flags.animationState = pState;
|
||||
}
|
||||
u32 getUserData() const { return status_.user_data; }
|
||||
void setUserData(u32 pUserData) { status_.user_data = pUserData; }
|
||||
JAIAudible* getAudible() const { return audible_; }
|
||||
bool isHandleAttached() const { return handle_ != NULL; }
|
||||
|
||||
bool hasLifeTime() const { return status_.field_0x1.flags.flag2; }
|
||||
void removeLifeTime_() { status_.field_0x1.flags.flag1 = false; }
|
||||
void stop_JAISound_() {
|
||||
status_.state.flags.flag5 = 0;
|
||||
|
||||
@@ -21,7 +21,9 @@ struct JAUAudibleParam {
|
||||
u8 b0_5 : 1;
|
||||
u8 b0_6 : 1;
|
||||
u8 b0_7 : 1;
|
||||
u8 b1;
|
||||
u8 b1_0 : 1;
|
||||
u8 b1_1 : 1;
|
||||
u8 b1_2_7 : 6;
|
||||
u8 b2;
|
||||
u8 b3;
|
||||
} bytes;
|
||||
|
||||
@@ -1,5 +1,109 @@
|
||||
#ifndef JAUSOUNDANIMATOR_H
|
||||
#define JAUSOUNDANIMATOR_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISound.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
class JAUSoundAnimation;
|
||||
|
||||
class JAUSoundAnimationSound {
|
||||
public:
|
||||
bool playsOnlyForward() const { return (mFlags & 1) != 0; }
|
||||
bool playsOnlyReverse() const { return (mFlags & 2) != 0; }
|
||||
bool stopsWhenAnimationChanges() const { return (mFlags & 4) != 0; }
|
||||
bool playsOnlyOnce() const { return (mFlags & 8) != 0; }
|
||||
bool stopsWhenNoteOff() const { return (mFlags & 0x10) != 0; }
|
||||
bool stopsWhenSpeedIsZero() const { return (mFlags & 0x20) != 0; }
|
||||
bool setsLifeTime() const { return (mFlags & 0x40) != 0; }
|
||||
bool playsAtIntervals() const { return (mFlags & 0x80) != 0; }
|
||||
|
||||
bool isNoting(f32 param_0) const {
|
||||
if (field_0x04 == field_0x08) {
|
||||
return true;
|
||||
}
|
||||
if (field_0x04 > field_0x08) {
|
||||
if (field_0x08 <= param_0 && param_0 < field_0x04) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (field_0x04 <= param_0 && param_0 < field_0x08) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isNotingOn(f32 param_0, bool param_1) const {
|
||||
if (setsLifeTime()) {
|
||||
return isNoting(param_0);
|
||||
}
|
||||
if (param_1) {
|
||||
return param_0 <= field_0x04;
|
||||
} else {
|
||||
return param_0 >= field_0x04;
|
||||
}
|
||||
}
|
||||
|
||||
bool isNotingOff(f32 param_0, bool param_1) const {
|
||||
if (setsLifeTime()) {
|
||||
return !isNoting(param_0);
|
||||
}
|
||||
if (field_0x04 == field_0x08) {
|
||||
return false;
|
||||
}
|
||||
if (param_1) {
|
||||
return param_0 <= field_0x08;
|
||||
} else {
|
||||
return param_0 >= field_0x08;
|
||||
}
|
||||
}
|
||||
|
||||
/* 0x00 */ JAISoundID mSoundId;
|
||||
/* 0x04 */ f32 field_0x04;
|
||||
/* 0x08 */ f32 field_0x08;
|
||||
/* 0x0C */ f32 field_0x0c;
|
||||
/* 0x10 */ u32 mFlags;
|
||||
/* 0x14 */ u8 field_0x14;
|
||||
/* 0x15 */ u8 field_0x15;
|
||||
/* 0x16 */ u8 field_0x16;
|
||||
/* 0x17 */ u8 field_0x17;
|
||||
/* 0x18 */ u8 field_0x18;
|
||||
/* 0x19 */ u8 field_0x19;
|
||||
/* 0x1A */ s8 field_0x1a;
|
||||
/* 0x1B */ u8 unk_0x1b[5];
|
||||
}; /* size 0x20 */
|
||||
|
||||
class JAUSoundAnimationControl {
|
||||
public:
|
||||
virtual ~JAUSoundAnimationControl() = 0;
|
||||
virtual JAUSoundAnimationSound* getSound(const JAUSoundAnimation*, int) = 0;
|
||||
virtual u16 getNumSounds(const JAUSoundAnimation*) = 0;
|
||||
};
|
||||
|
||||
class JAUSoundAnimation {
|
||||
public:
|
||||
/* 802A6F70 */ int getStartSoundIndex(f32) const;
|
||||
/* 802A7044 */ int getEndSoundIndex(f32) const;
|
||||
|
||||
u16 getNumSounds() const {
|
||||
if (mControl != NULL) {
|
||||
return mControl->getNumSounds(this);
|
||||
} else {
|
||||
return mNumSounds;
|
||||
}
|
||||
}
|
||||
|
||||
const JAUSoundAnimationSound* getSound(int i_index) const {
|
||||
if (mControl != NULL) {
|
||||
return mControl->getSound(this, i_index);
|
||||
} else {
|
||||
return &mSounds + i_index;
|
||||
}
|
||||
}
|
||||
|
||||
/* 0x0 */ u16 mNumSounds;
|
||||
/* 0x4 */ JAUSoundAnimationControl* mControl;
|
||||
/* 0x8 */ JAUSoundAnimationSound mSounds; // actually an array
|
||||
};
|
||||
|
||||
#endif /* JAUSOUNDANIMATOR_H */
|
||||
|
||||
@@ -122,6 +122,16 @@ struct TVec3<f32> {
|
||||
};
|
||||
}
|
||||
|
||||
inline TVec3<f32>& operator=(const Vec& b) {
|
||||
setTVec3f(&b.x, &this->x);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// inline TVec3<f32>& operator=(const TVec3<f32>& b) {
|
||||
// setTVec3f(&b.x, &this->x);
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
inline TVec3<f32>& operator+=(const TVec3<f32>& b) {
|
||||
add(b);
|
||||
return *this;
|
||||
|
||||
@@ -97,6 +97,8 @@ public:
|
||||
|
||||
JSULink<T>* getLast() const { return (JSULink<T>*)getLastLink(); }
|
||||
|
||||
JSULink<T>* getNth(int index) { return (JSULink<T>*)getNthLink(index); }
|
||||
|
||||
JSULink<T>* getEnd() const { return NULL; }
|
||||
|
||||
u32 getNumLinks() const { return this->JSUPtrList::getNumLinks(); }
|
||||
|
||||
Reference in New Issue
Block a user