-
Notifications
You must be signed in to change notification settings - Fork 0
/
CHLMdlController.cpp
113 lines (87 loc) · 2.13 KB
/
CHLMdlController.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
CHLMdlController.cpp
Author:
Description: <describe the CHLMdlController class here>
*/
#include "CHLMdlController.h"
CHLMdlController::CHLMdlController(CModelInstance *inModel) : CModelController(inModel)
{
_model = inModel;
_animating = true;
init();
}
CHLMdlController::~CHLMdlController()
{
}
Boolean CHLMdlController::init()
{
// find all the animation sequences
UInt32 frames = _model->modelClass()->frameCount();
Sequence *currSequence = nil;
for (int i = 0; i < frames; i++) {
string name = _model->modelClass()->frameName(i);
// index can be one or two digits
int digits = 1;
if (name[name.length()-2] >= '0' && name[name.length()-2] <= '9')
digits = 2;
string sequence = name.substr(0,name.length()-digits );
string index = name.substr(name.length()-digits ,name.length());
// continue or end
if (currSequence != nil) {
if (sequence != currSequence->name) {
_animations->insert(_animations->end(), currSequence);
currSequence = nil;
} else {
currSequence->endIndex++;
}
}
// start new
if (currSequence == nil) {
currSequence = new Sequence();
currSequence->name = sequence;
currSequence->startIndex = i;
currSequence->endIndex = i;
}
}
// make sure the last one gets in the vector
if (currSequence != nil) {
_animations->insert(_animations->end(), currSequence);
}
for(int i = 0; i < _animations->size(); i++) {
currSequence = (*_animations)[i];
dprintf("%s %d %d\n", currSequence->name.c_str(), currSequence->startIndex, currSequence->endIndex);
}
StartSequenceAtIndex(0);
return true;
}
void CHLMdlController::Reset()
{
}
Boolean CHLMdlController::Animate()
{
return false;
}
const char *CHLMdlController::DisplayString()
{
return nil;
}
void CHLMdlController::StartSequenceAtIndex(int index)
{
#pragma unused (index)
}
void CHLMdlController::appendAnimationNames(StringList *result)
{
#pragma unused (result)
}
int CHLMdlController::animationCount()
{
return 0;
}
void CHLMdlController::NextFrame(Sequence *sequence)
{
#pragma unused (sequence)
}
void CHLMdlController::BeginSequence(Sequence *sequence)
{
#pragma unused (sequence)
}