summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2PeopleAnimeDef.cpp
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-06-28 22:22:32 +0100
committerAsh Wolf <ninji@wuffs.org>2023-06-28 22:22:32 +0100
commitc0c336500955a23e344651e5412c9d9d441ef4ee (patch)
tree790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2PeopleAnimeDef.cpp
parent37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff)
downloadt2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz
t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r--src/T2DLL/T2PeopleAnimeDef.cpp48
1 files changed, 44 insertions, 4 deletions
diff --git a/src/T2DLL/T2PeopleAnimeDef.cpp b/src/T2DLL/T2PeopleAnimeDef.cpp
index 59e8ace..7297df0 100644
--- a/src/T2DLL/T2PeopleAnimeDef.cpp
+++ b/src/T2DLL/T2PeopleAnimeDef.cpp
@@ -1,25 +1,65 @@
+#include "CResFile.h"
+#include "T2People.h"
#include "T2PeopleAnimeDef.h"
+#include "UT2Utils.h"
-T2PeopleAnimeDef::T2PeopleAnimeDef(CResFile&) {
+T2PeopleAnimeDef::T2PeopleAnimeDef(CResFile& resFile) {
+ Init();
+
+ resFile >> m4;
+ resFile >> m8;
+ resFile >> mNumOfElems;
+
+ mElems = new T2PeopleAnimeDefElem[mNumOfElems];
+ for (int i = 0; i < mNumOfElems; i++)
+ mElems[i].Initialize(resFile);
}
void T2PeopleAnimeDef::Init() {
+ m4 = 0;
+ m8 = 0;
+ mNumOfElems = 0;
+ mElems = NULL;
}
/*virtual*/ T2PeopleAnimeDef::~T2PeopleAnimeDef() {
+ if (mElems)
+ delete[] mElems;
}
-void T2PeopleAnimeDef::Set(T2People*, int, int) {
+void T2PeopleAnimeDef::Set(T2People* people, int h, int inIndex) {
+ if (inIndex < mNumOfElems) {
+ int index = inIndex;
+ if (inIndex < 0)
+ index = UT2Utils::Randomize(mNumOfElems);
+ mElems[index].Set(people, h);
+ }
}
+
+
T2PeopleAnimeDefElem::T2PeopleAnimeDefElem() {
+ mFillerStart = 0;
+ mFillerRange = 0;
+ mHStart = 0;
+ mHRange = 0;
}
/*virtual*/ T2PeopleAnimeDefElem::~T2PeopleAnimeDefElem() {
}
-void T2PeopleAnimeDefElem::Initialize(CResFile&) {
+void T2PeopleAnimeDefElem::Initialize(CResFile& resFile) {
+ resFile >> mFillerStart;
+ resFile >> mFillerRange;
+ resFile >> mHStart;
+ resFile >> mHRange;
}
-void T2PeopleAnimeDefElem::Set(T2People*, int) {
+void T2PeopleAnimeDefElem::Set(T2People* people, int h) {
+ if (mFillerStart >= 0) {
+ people->SetFiller(mFillerStart + UT2Utils::Randomize(mFillerRange));
+ people->MoveHTo(h + mHStart + UT2Utils::Randomize(mHRange));
+ } else {
+ people->SetFiller(-1);
+ }
}