summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAECX <maurice@henke.gg>2021-07-10 19:39:59 +0200
committerGitHub <noreply@github.com>2021-07-10 19:39:59 +0200
commit8407ffcede5edd182fdf699744f1ae8f7bbe85c6 (patch)
treebe2f661712e47a9b61e3e82be3ca5700a2b7519c
parent729e31eff4daa933ed10542dad3f8765a4cdc989 (diff)
parentcd479e703c3c1b7374f5088d9e20300946631b91 (diff)
Merge pull request #7 from jdflyer/master
Add getRandom to tools, and function definitions for sceneChange and startBattleBgm from the Z2AudioLib
-rw-r--r--include/tools.h8
-rw-r--r--include/tp/Z2SceneMgr.h42
-rw-r--r--include/tp/Z2SeqMgr.h23
-rw-r--r--source/tools.cpp9
4 files changed, 82 insertions, 0 deletions
diff --git a/include/tools.h b/include/tools.h
index 5855374..805408a 100644
--- a/include/tools.h
+++ b/include/tools.h
@@ -53,4 +53,12 @@ namespace libtp::tools
* @return One of the CARD_RESULT Constants (CARD_RESULT_READY, ...)
*/
int32_t ReadGCI( int32_t chan, const char* fileName, int32_t length, int32_t offset, void* buffer );
+
+ /**
+ * @brief Generates a random number based on a seed and a maximum number
+ *
+ * @param seed A reference to the seed that's being used
+ * @param max The maximum number to be generated by the function
+ */
+ uint32_t getRandom( uint64_t* seed, uint32_t max );
} // namespace libtp::tools \ No newline at end of file
diff --git a/include/tp/Z2SceneMgr.h b/include/tp/Z2SceneMgr.h
new file mode 100644
index 0000000..4d84f5a
--- /dev/null
+++ b/include/tp/Z2SceneMgr.h
@@ -0,0 +1,42 @@
+/**
+ * @file Z2SceneMgr.h
+ * @author jdflyer
+ * @brief Provides a funciton definition for the sceneChange function
+ *
+ * @bug No known bugs
+ */
+
+#ifndef TP_Z2SCENEMGR_H
+#define TP_Z2SCENEMGR_H
+
+#include <cstdint>
+
+namespace libtp::tp::z2audiolib::z2scenemgr
+{
+ struct Z2SceneMgr;
+
+ /**
+ *@todo Move JAISoundID to its own file
+ */
+ struct JAISoundID
+ {
+ uint32_t id;
+ };
+
+ extern "C"
+ {
+ /**
+ * @brief sceneChange is called when the game changes the BGM playing
+ */
+ void sceneChange( Z2SceneMgr* sceneMgr,
+ JAISoundID id,
+ uint8_t SeWave1,
+ uint8_t SeWave2,
+ uint8_t BgmWave1,
+ uint8_t BgmWave2,
+ uint8_t DemoWave,
+ bool param_7 );
+ };
+} // namespace libtp::tp::z2audiolib::z2scenemgr
+
+#endif \ No newline at end of file
diff --git a/include/tp/Z2SeqMgr.h b/include/tp/Z2SeqMgr.h
new file mode 100644
index 0000000..3e0b497
--- /dev/null
+++ b/include/tp/Z2SeqMgr.h
@@ -0,0 +1,23 @@
+/**
+ * @file Z2SeqMgr.h
+ * @author jdflyer
+ * @brief Provides the definition for the funciton that starts the enemy BGM
+ *
+ * @bug No known bugs
+ */
+#ifndef TP_Z2SEQMGR_H
+#define TP_Z2SEQMGR_H
+
+#include <cstdint>
+
+namespace libtp::tp::z2audiolib::z2seqmgr
+{
+ struct Z2SeqMgr;
+
+ extern "C"
+ {
+ void startBattleBgm( Z2SeqMgr* seqMgr, bool param_1 );
+ }
+} // namespace libtp::tp::z2audiolib::z2seqmgr
+
+#endif \ No newline at end of file
diff --git a/source/tools.cpp b/source/tools.cpp
index 42cb205..08f519f 100644
--- a/source/tools.cpp
+++ b/source/tools.cpp
@@ -133,4 +133,13 @@ namespace libtp::tools
return result;
}
+
+ uint32_t getRandom( uint64_t* seed, uint32_t max )
+ {
+ uint64_t z = ( *seed += 0x9e3779b97f4a7c15 );
+ z = ( z ^ ( z >> 30 ) ) * 0xbf58476d1ce4e5b9;
+ z = ( z ^ ( z >> 27 ) ) * 0x94d049bb133111eb;
+
+ return ( z % max );
+ }
} // namespace libtp::tools \ No newline at end of file