|
1 | 1 | #include "mithrilchain0x8.h" |
2 | 2 |
|
3 | 3 | DECOMP_SIZE_ASSERT(MithrilChain0x8, 0x8) |
| 4 | +DECOMP_SIZE_ASSERT(MithrilChain0x8::Entry, 0x18) |
4 | 5 |
|
5 | | -// STUB: LEGORACERS 0x0045c3b0 |
| 6 | +// FUNCTION: LEGORACERS 0x0045c3b0 |
6 | 7 | MithrilChain0x8::MithrilChain0x8() |
| 8 | +{ |
| 9 | + m_entries = NULL; |
| 10 | + m_count = 0; |
| 11 | +} |
| 12 | + |
| 13 | +// FUNCTION: LEGORACERS 0x00490500 |
| 14 | +MithrilChain0x8::Entry::Entry() |
| 15 | +{ |
| 16 | + Clear(); |
| 17 | +} |
| 18 | + |
| 19 | +// FUNCTION: LEGORACERS 0x00490510 |
| 20 | +MithrilChain0x8::Entry::~Entry() |
| 21 | +{ |
| 22 | + Reset(); |
| 23 | +} |
| 24 | + |
| 25 | +// FUNCTION: LEGORACERS 0x00490520 |
| 26 | +void MithrilChain0x8::Entry::Reset() |
| 27 | +{ |
| 28 | + Deactivate(); |
| 29 | +} |
| 30 | + |
| 31 | +// FUNCTION: LEGORACERS 0x00490530 |
| 32 | +void MithrilChain0x8::Entry::Clear() |
| 33 | +{ |
| 34 | + m_unk0x00 = 0; |
| 35 | + m_unk0x04 = 0; |
| 36 | + m_remainingMs = 0; |
| 37 | + m_durationMs = 0; |
| 38 | + m_flags = 0; |
| 39 | + m_unk0x08[0] = 0; |
| 40 | + m_unk0x08[1] = 0; |
| 41 | + m_unk0x08[2] = 0; |
| 42 | + m_unk0x08[3] = 0; |
| 43 | +} |
| 44 | + |
| 45 | +// FUNCTION: LEGORACERS 0x00490580 |
| 46 | +void MithrilChain0x8::Entry::Deactivate() |
| 47 | +{ |
| 48 | + Clear(); |
| 49 | +} |
| 50 | + |
| 51 | +// FUNCTION: LEGORACERS 0x00490590 |
| 52 | +void MithrilChain0x8::Entry::Update(LegoU32 p_elapsedMs) |
| 53 | +{ |
| 54 | + if (m_flags & c_flagActive) { |
| 55 | + if (!m_remainingMs) { |
| 56 | + if (m_flags & c_flagExpired) { |
| 57 | + Deactivate(); |
| 58 | + } |
| 59 | + else { |
| 60 | + m_flags |= c_flagExpired; |
| 61 | + } |
| 62 | + } |
| 63 | + |
| 64 | + if (p_elapsedMs > m_remainingMs) { |
| 65 | + m_remainingMs = 0; |
| 66 | + return; |
| 67 | + } |
| 68 | + |
| 69 | + m_remainingMs -= p_elapsedMs; |
| 70 | + } |
| 71 | +} |
| 72 | + |
| 73 | +// STUB: LEGORACERS 0x004905e0 |
| 74 | +void MithrilChain0x8::Entry::Draw(BronzeFalcon0xc8770*) |
7 | 75 | { |
8 | 76 | // TODO |
9 | | - STUB(0x45c3b0); |
| 77 | + STUB(0x4905e0); |
10 | 78 | } |
11 | 79 |
|
12 | | -// STUB: LEGORACERS 0x00494d90 |
| 80 | +// FUNCTION: LEGORACERS 0x00494d90 |
13 | 81 | MithrilChain0x8::~MithrilChain0x8() |
14 | 82 | { |
15 | | - // TODO |
16 | | - STUB(0x494d90); |
| 83 | + Reset(); |
17 | 84 | } |
18 | 85 |
|
19 | | -// STUB: LEGORACERS 0x00494f60 |
20 | | -void MithrilChain0x8::FUN_00494f60(LegoU32) |
| 86 | +// FUNCTION: LEGORACERS 0x00494da0 |
| 87 | +void MithrilChain0x8::Reset() |
21 | 88 | { |
22 | | - // TODO |
23 | | - STUB(0x494f60); |
| 89 | + if (m_entries) { |
| 90 | + for (LegoU32 i = 0; i < m_count; i++) { |
| 91 | + m_entries[i].Reset(); |
| 92 | + } |
| 93 | + |
| 94 | + delete[] m_entries; |
| 95 | + m_entries = NULL; |
| 96 | + } |
| 97 | + |
| 98 | + m_count = 0; |
24 | 99 | } |
25 | 100 |
|
26 | | -// STUB: LEGORACERS 0x00494fa0 |
27 | | -void MithrilChain0x8::FUN_00494fa0(BronzeFalcon0xc8770*) |
| 101 | +// FUNCTION: LEGORACERS 0x00494f60 |
| 102 | +void MithrilChain0x8::Update(LegoU32 p_elapsedMs) |
28 | 103 | { |
29 | | - // TODO |
30 | | - STUB(0x494fa0); |
| 104 | + for (LegoU32 i = 0; i < m_count; i++) { |
| 105 | + if (m_entries[i].IsActive()) { |
| 106 | + m_entries[i].Update(p_elapsedMs); |
| 107 | + } |
| 108 | + } |
| 109 | +} |
| 110 | + |
| 111 | +// FUNCTION: LEGORACERS 0x00494fa0 |
| 112 | +void MithrilChain0x8::Draw(BronzeFalcon0xc8770* p_renderer) |
| 113 | +{ |
| 114 | + for (LegoU32 i = 0; i < m_count; i++) { |
| 115 | + if (m_entries[i].IsActive()) { |
| 116 | + m_entries[i].Draw(p_renderer); |
| 117 | + } |
| 118 | + } |
31 | 119 | } |
0 commit comments