MCPcopy Create free account
hub / github.com/doldecomp/mkdd / changeRandomId

Method changeRandomId

src/Inagaki/GameAudioCommon.cpp:28–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26 f32 Common::setMultiPlayModePan(u8 p1) { return (p1 & 1); }
27
28 u32 Common::changeRandomId(u32 id1, u32 id2)
29 {
30 u32 swBit = GetGameAudioMain()->getSoundTable()->getSwBit(id1);
31
32 if (swBit & 0x70000000) {
33 swBit = ((swBit & 0x70000000) >> 0x1c) + 1;
34 u32 rnd = Random::getRandomU32();
35 u32 randId = id1 + ((rnd >> 0xc) % swBit);
36 if (randId == id2 && (++randId == id1 + swBit))
37 {
38 randId = id1;
39 }
40 return randId;
41 }
42 return id1;
43 }
44
45 void Random::setSeed(u32 seed)
46 {

Callers

nothing calls this directly

Calls 2

getSwBitMethod · 0.80
getSoundTableMethod · 0.80

Tested by

no test coverage detected