diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2025-02-07 14:36:55 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-07 14:36:55 -0700 |
| commit | fc1e1a97825c129f114a5c59ab1820d1a1b9187f (patch) | |
| tree | 3d18b98adf1a3c62fcbd203f55a89e047782808a /src/engine/objects/Bat.cpp | |
| parent | 6f8cbc0279004a39635c922b824e8561f5355bc5 (diff) | |
Reimpl star emitter (#180)
* Reimpl star emitter
* Remove OObject Lists
* wip mole reimpl
* nearly fix moles
* Cleanup
* Update reimpl seagull
* Rework finishline to auto spawn and not to run in credits
* Fix train crossing direction in extra mode
* Clarification
* micro optimization
* update mole
---------
Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
Diffstat (limited to 'src/engine/objects/Bat.cpp')
| -rw-r--r-- | src/engine/objects/Bat.cpp | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/src/engine/objects/Bat.cpp b/src/engine/objects/Bat.cpp index f32ef2d41..b90f7c857 100644 --- a/src/engine/objects/Bat.cpp +++ b/src/engine/objects/Bat.cpp @@ -19,19 +19,21 @@ const char* sBoardwalkTexList[] = { gTextureBat1, gTextureBat2, gTextureBat3, gT size_t OBat::_count = 0; OBat::OBat(const FVector& pos, const FRotation& rot) { - s32 objectId = indexObjectList1[0]; - init_texture_object(objectId, (uint8_t*)d_course_banshee_boardwalk_bat_tlut, sBoardwalkTexList, 0x20U, + + find_unused_obj_index(&_objectIndex); + + init_texture_object(_objectIndex, (uint8_t*)d_course_banshee_boardwalk_bat_tlut, sBoardwalkTexList, 0x20U, (u16) 0x00000040); - gObjectList[objectId].orientation[0] = rot.pitch; - gObjectList[objectId].orientation[1] = rot.roll; - gObjectList[objectId].orientation[2] = rot.yaw; // 0x8000 + gObjectList[_objectIndex].orientation[0] = rot.pitch; + gObjectList[_objectIndex].orientation[1] = rot.roll; + gObjectList[_objectIndex].orientation[2] = rot.yaw; // 0x8000 _count++; } void OBat::Tick() { s32 var_s2; - s32 temp_s0; + s32 objectIndex; Object* object; if (D_8018CFC8 != 0) { @@ -40,28 +42,28 @@ void OBat::Tick() { if (D_8018D000 != 0) { D_8018D000 -= 1; } - temp_s0 = indexObjectList1[0]; - func_80072E54(temp_s0, 0, 3, 1, 0, -1); - func_80073514(temp_s0); - object = &gObjectList[temp_s0]; - func_80073CB0(temp_s0, &object->primAlpha, -0x00001000, 0x00001000, 0x00000400, 0, -1); + objectIndex = _objectIndex; + func_80072E54(objectIndex, 0, 3, 1, 0, -1); + func_80073514(objectIndex); + object = &gObjectList[objectIndex]; + func_80073CB0(objectIndex, &object->primAlpha, -0x00001000, 0x00001000, 0x00000400, 0, -1); object->orientation[2] = object->primAlpha + 0x8000; if ((D_8018CFB0 != 0) || (D_8018CFC8 != 0)) { D_8018CFD8 = 0; for (var_s2 = 0; var_s2 < 40; var_s2++) { - temp_s0 = gObjectParticle2[var_s2]; - if (temp_s0 == -1) { + objectIndex = gObjectParticle2[var_s2]; + if (objectIndex == -1) { continue; } - object = &gObjectList[temp_s0]; + object = &gObjectList[objectIndex]; if (object->state == 0) { continue; } - OBat::func_8007D8D4(temp_s0, 1); - OBat::func_8007DAF8(temp_s0, 1); - OBat::func_8007D794(temp_s0); + OBat::func_8007D8D4(objectIndex, 1); + OBat::func_8007DAF8(objectIndex, 1); + OBat::func_8007D794(objectIndex); if (object->state == 0) { delete_object_wrapper(&gObjectParticle2[var_s2]); } @@ -74,19 +76,19 @@ void OBat::Tick() { if ((D_8018CFE8 != 0) || (D_8018D000 != 0)) { D_8018D010 = 0; for (var_s2 = 0; var_s2 < 30; var_s2++) { - temp_s0 = gObjectParticle3[var_s2]; - if (temp_s0 == -1) { + objectIndex = gObjectParticle3[var_s2]; + if (objectIndex == -1) { continue; } - object = &gObjectList[temp_s0]; + object = &gObjectList[objectIndex]; if (object->state == 0) { continue; } - OBat::func_8007D8D4(temp_s0, 2); - OBat::func_8007DAF8(temp_s0, 2); - OBat::func_8007D794(temp_s0); + OBat::func_8007D8D4(objectIndex, 2); + OBat::func_8007DAF8(objectIndex, 2); + OBat::func_8007D794(objectIndex); if (object->state == 0) { delete_object_wrapper(&gObjectParticle3[var_s2]); } @@ -103,7 +105,7 @@ void OBat::Draw(s32 cameraId) { s32 objectIndex; Camera* temp_s7; - objectIndex = indexObjectList1[0]; + objectIndex = _objectIndex; temp_s7 = &camera1[cameraId]; OBat::func_80046F60((u8*)gObjectList[objectIndex].activeTLUT, (u8*)gObjectList[objectIndex].activeTexture, 0x00000020, 0x00000040, 5); |
