mirror of
https://github.com/zeldaret/ss
synced 2026-08-04 09:08:55 -04:00
I can't believe this function matches
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define D_SND_BGM_HARP_DATA_H
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_rng_mgr.h"
|
||||
|
||||
/**
|
||||
* This file deals with the pitch of the Goddess' Harp when Link
|
||||
@@ -37,6 +38,10 @@ struct dSndBgmDataHarpVar_c {
|
||||
field_0x00 |= 1;
|
||||
}
|
||||
|
||||
bool checkFlag() const {
|
||||
return field_0x00 & 1;
|
||||
}
|
||||
|
||||
/* 0x00 */ u8 field_0x00; // flags
|
||||
/* 0x01 */ s8 field_0x01; // var
|
||||
};
|
||||
@@ -61,7 +66,7 @@ public:
|
||||
mPosition = position;
|
||||
}
|
||||
|
||||
s32 getCount() const {
|
||||
s32 getCount() {
|
||||
return mCount;
|
||||
}
|
||||
|
||||
@@ -69,6 +74,16 @@ public:
|
||||
return mMax;
|
||||
}
|
||||
|
||||
s32 getNumBitsSet() {
|
||||
s32 numBits = 0;
|
||||
for (int i = 0; i < getCount(); i++) {
|
||||
if (mpVars[i].checkFlag()) {
|
||||
numBits++;
|
||||
}
|
||||
}
|
||||
return numBits;
|
||||
}
|
||||
|
||||
dSndBgmDataHarpVar_c *getVar(s32 idx) {
|
||||
if (idx >= getCount()) {
|
||||
return nullptr;
|
||||
@@ -76,6 +91,33 @@ public:
|
||||
return &mpVars[idx];
|
||||
}
|
||||
|
||||
s32 getRandomIdx() {
|
||||
return dSndRngMgr_c::GetInstance()->rndIntRange(0, getCount());
|
||||
}
|
||||
|
||||
s32 getRandomIdxWithBitSet() {
|
||||
s32 numBitsSet = getNumBitsSet();
|
||||
s32 idx;
|
||||
if (numBitsSet <= 0) {
|
||||
return 0;
|
||||
} else {
|
||||
idx = dSndRngMgr_c::GetInstance()->rndIntRange(0, getCount());
|
||||
while (true) {
|
||||
if (mpVars[idx].checkFlag()) {
|
||||
return idx;
|
||||
}
|
||||
idx = dSndRngMgr_c::GetInstance()->rndIntRange(0, getCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 getVal(s32 idx) {
|
||||
if (idx >= getCount()) {
|
||||
return 0;
|
||||
}
|
||||
return mpVars[idx].field_0x01;
|
||||
}
|
||||
|
||||
dSndBgmDataHarpVar_c *getUnusedVar() {
|
||||
if (mCount >= mMax) {
|
||||
return nullptr;
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
void onBecomeActive();
|
||||
bool isBgmBattle() const;
|
||||
|
||||
const dSndBgmDataHarpVarSetBase_c *getCurrentHarpVarSet();
|
||||
dSndBgmDataHarpVarSetBase_c *getCurrentHarpVarSet();
|
||||
|
||||
u32 getStrmPlaySamplePosition();
|
||||
u32 getWavePlaySamplePosition();
|
||||
|
||||
@@ -15,7 +15,7 @@ public:
|
||||
|
||||
void setPlaySamplePosition(s32 position);
|
||||
|
||||
const dSndBgmDataHarpVarSetBase_c *getCurrentVarSet();
|
||||
dSndBgmDataHarpVarSetBase_c *getCurrentVarSet();
|
||||
|
||||
bool isLoaded() const {
|
||||
return mIsLoaded;
|
||||
|
||||
@@ -10,10 +10,9 @@ class dSndRngMgr_c : public dSndRng_c {
|
||||
public:
|
||||
SND_DISPOSER_MEMBERS(dSndRngMgr_c)
|
||||
|
||||
u32 rndIntRange(s32 min, s32 max);
|
||||
|
||||
public:
|
||||
dSndRngMgr_c() {}
|
||||
u32 rndIntRange(s32 min, s32 max);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -82,6 +82,8 @@ private:
|
||||
bool isPlayingSound(u32 playerIdx, u32 soundId);
|
||||
bool isPlayingSound(u32 soundId);
|
||||
|
||||
void setBitsIfAdjacent(dSndBgmDataHarpVarSetBase_c *set, s32 count, s32 target, u32 *pMask);
|
||||
|
||||
/**
|
||||
* Finds a sound handle currently playing the given sound,
|
||||
* or an idle sound handle,
|
||||
@@ -100,9 +102,9 @@ private:
|
||||
/* 0x30 */ s32 mDelayedSoundTimers[NUM_DELAYED_SOUNDS];
|
||||
/* 0x38 */ u32 mTextboxAdvanceSound;
|
||||
/* 0x3C */ nw4r::snd::SoundHandle mBattleTuttiHandle;
|
||||
/* 0x40 */ u16 field_0x40;
|
||||
/* 0x42 */ u16 field_0x42;
|
||||
/* 0x44 */ s32 field_0x44;
|
||||
/* 0x40 */ s16 field_0x40;
|
||||
/* 0x42 */ s16 field_0x42;
|
||||
/* 0x44 */ u32 field_0x44;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,6 +28,8 @@ class dSndBgmSoundHarpMgr_c;
|
||||
class dSndBgmSeqConfig;
|
||||
class dSndBgmBattleConfig;
|
||||
|
||||
class dSndBgmDataHarpVarSetBase_c;
|
||||
|
||||
class dSndHarpSongData_c;
|
||||
class dSndTagData;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user