diff options
| author | KuroiIeWa5Da <tyuki@adu.me> | 2012-01-23 01:41:05 -0600 |
|---|---|---|
| committer | KuroiIeWa5Da <tyuki@adu.me> | 2012-01-23 01:41:05 -0600 |
| commit | 4d0797bc3a6ae0ea4b44e8b6463339d662f5d669 (patch) | |
| tree | 03b824a1bb511bbb8c57ea378c1d27ea04c27ef7 /music/pokeredmusicdisasm/Velocity.cpp | |
| parent | Finished PkmnHealed music data - all 3 channels (diff) | |
| download | pokeyellow-4d0797bc3a6ae0ea4b44e8b6463339d662f5d669.tar.gz pokeyellow-4d0797bc3a6ae0ea4b44e8b6463339d662f5d669.tar.xz pokeyellow-4d0797bc3a6ae0ea4b44e8b6463339d662f5d669.zip | |
made changes in repo
hg-commit-id: 1145e088ee27
Diffstat (limited to 'music/pokeredmusicdisasm/Velocity.cpp')
| -rw-r--r-- | music/pokeredmusicdisasm/Velocity.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/music/pokeredmusicdisasm/Velocity.cpp b/music/pokeredmusicdisasm/Velocity.cpp new file mode 100644 index 00000000..0000d4ba --- /dev/null +++ b/music/pokeredmusicdisasm/Velocity.cpp @@ -0,0 +1,82 @@ +#include <sstream>
+#include "Velocity.h"
+using namespace std;
+
+Velocity::Velocity()
+{
+ velocity = 0;
+ length = 0;
+}
+
+Velocity::Velocity(unsigned char* byte) // Parse Immidiately
+{
+ Parse(byte);
+}
+
+Velocity::Velocity(unsigned char velocity, unsigned char length, bool) // Set value
+{
+ SetVelocity(velocity);
+ SetLength(length);
+}
+
+// Direct Getters/Setters
+unsigned char Velocity::GetVelocity()
+{
+ return velocity;
+}
+
+void Velocity::SetVelocity(unsigned char value)
+{
+ velocity = value;
+}
+
+unsigned char Velocity::GetLength()
+{
+ return length;
+}
+
+void Velocity::SetLength(unsigned char value)
+{
+ length = value;
+}
+
+bool Velocity::IsValid(unsigned char* byte)
+{
+ if(byte[0] == 0xDC)
+ {
+ error = false;
+ return true;
+ }
+ else
+ {
+ error = true;
+ return false;
+ }
+}
+
+string Velocity::GenAsm()
+{
+ string tmpRet = AbstractData::GenAsm();
+ if(tmpRet != "") return tmpRet;
+
+ stringstream tmpAsmOut;
+ tmpAsmOut << "mus_vel" << " " << (short)velocity << ", " << (short)length;
+ return tmpAsmOut.str();
+}
+
+bool Velocity::Parse(unsigned char* byte)
+{
+ if(!AbstractData::Parse(byte)) return false;
+
+ velocity = byte[1] & 0xF0;
+ velocity >>= 4;
+
+ length = byte[1] & 0x0F;
+ return true;
+}
+
+unsigned int Velocity::Arguments()
+{
+ // 1 1-byte argument
+ return 1;
+}
\ No newline at end of file |
