diff options
| author | MegaMech <inkstudios1@hotmail.com> | 2024-12-29 23:57:26 -0700 |
|---|---|---|
| committer | MegaMech <inkstudios1@hotmail.com> | 2024-12-29 23:57:26 -0700 |
| commit | 2bd41c6d90995cff7387e11374843cbe9e62b10f (patch) | |
| tree | c431d7aaa840e6277d53dc54c8f1edb7408e3bb0 /src/engine/objects/Thwomp.cpp | |
| parent | 08e4bf37979131e76e617beafb3f5ca6286e5ebb (diff) | |
Fix Seagull, classes count their own instances --> cleanup
Diffstat (limited to 'src/engine/objects/Thwomp.cpp')
| -rw-r--r-- | src/engine/objects/Thwomp.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/engine/objects/Thwomp.cpp b/src/engine/objects/Thwomp.cpp index 87d670cfd..afa12b03b 100644 --- a/src/engine/objects/Thwomp.cpp +++ b/src/engine/objects/Thwomp.cpp @@ -44,16 +44,19 @@ f32 D_800E594C[][2] = { s16 D_800E597C[] = { 0x0000, 0x0000, 0x4000, 0x8000, 0x8000, 0xc000 }; -OThwomp::OThwomp(s32 i, s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha, u16 boundingBoxSize) { - if (i >= 32) { - printf("MAX THWOMPS REACHED (32), skipping\n"); - return; - } - _idx = i; +size_t OThwomp::_count = 0; + +OThwomp::OThwomp(s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s16 primAlpha, u16 boundingBoxSize) { + _idx = _count; _faceDirection = direction; _boundingBoxSize = boundingBoxSize; State = (States)behaviour; - s32 objectId = indexObjectList1[i]; + + if (_idx >= 32) { + printf("MAX THWOMPS REACHED (32), skipping\n"); + return; + } + s32 objectId = indexObjectList1[_idx]; init_object(objectId, 0); gObjectList[objectId].origin_pos[0] = x * xOrientation; gObjectList[objectId].origin_pos[2] = z; @@ -66,9 +69,11 @@ OThwomp::OThwomp(s32 i, s16 x, s16 z, s16 direction, f32 scale, s16 behaviour, s } gObjectList[objectId].sizeScaling = scale; + + _count++; } -void OThwomp::Tick() { // func_80081210 +void OThwomp::Tick60fps() { // func_80081210 Player* player; s32 objectIndex; s32 var_s2_3; @@ -80,6 +85,13 @@ void OThwomp::Tick() { // func_80081210 OThwomp::func_8007F8D8(); + // Tick lights only one time. This gets applied to every thwomp. + // Running this more than once per frame will result in the lights moving at a high rate of speed. + if (_idx == 0) { + D_80165834[0] += 0x100; + D_80165834[1] += 0x200; + } + objectIndex = indexObjectList1[_idx]; if (gObjectList[objectIndex].state != 0) { switch (State) { |
