From 2bd41c6d90995cff7387e11374843cbe9e62b10f Mon Sep 17 00:00:00 2001 From: MegaMech Date: Sun, 29 Dec 2024 23:57:26 -0700 Subject: Fix Seagull, classes count their own instances --> cleanup --- src/engine/objects/Penguin.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/engine/objects/Penguin.cpp') diff --git a/src/engine/objects/Penguin.cpp b/src/engine/objects/Penguin.cpp index c126174a1..c690e1ef2 100644 --- a/src/engine/objects/Penguin.cpp +++ b/src/engine/objects/Penguin.cpp @@ -33,16 +33,19 @@ extern "C" { extern s8 gPlayerCount; } -OPenguin::OPenguin(s32 i, Vec3f pos, u16 direction, PenguinType type, Behaviour behaviour) { - if (i >= 32) { +size_t OPenguin::_count = 0; + +OPenguin::OPenguin(Vec3f pos, u16 direction, PenguinType type, Behaviour behaviour) { + _idx = _count; + _type = type; + _bhv = behaviour; + + if (_idx >= 32) { printf("MAX penguin REACHED (32), skipping\n"); return; } - _idx = i; - _type = type; - _bhv = behaviour; - s32 objectIndex = indexObjectList1[i]; + s32 objectIndex = indexObjectList1[_idx]; init_object(objectIndex, 0); Object *object = &gObjectList[objectIndex]; @@ -73,6 +76,7 @@ OPenguin::OPenguin(s32 i, Vec3f pos, u16 direction, PenguinType type, Behaviour break; } + _count++; } void OPenguin::Tick(void) { -- cgit v1.2.3