summaryrefslogtreecommitdiff
path: root/src/engine/objects/Crab.cpp
diff options
context:
space:
mode:
authorMegaMech <MegaMech@users.noreply.github.com>2025-02-07 14:36:55 -0700
committerGitHub <noreply@github.com>2025-02-07 14:36:55 -0700
commitfc1e1a97825c129f114a5c59ab1820d1a1b9187f (patch)
tree3d18b98adf1a3c62fcbd203f55a89e047782808a /src/engine/objects/Crab.cpp
parent6f8cbc0279004a39635c922b824e8561f5355bc5 (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/Crab.cpp')
-rw-r--r--src/engine/objects/Crab.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/engine/objects/Crab.cpp b/src/engine/objects/Crab.cpp
index 3a71e075d..c722a9037 100644
--- a/src/engine/objects/Crab.cpp
+++ b/src/engine/objects/Crab.cpp
@@ -28,26 +28,24 @@ extern "C" {
size_t OCrab::_count = 0;
OCrab::OCrab(const FVector2D& start, const FVector2D& end) {
- s32 objectId;
_idx = _count;
_start = start;
_end = end;
- objectId = indexObjectList1[_idx];
- init_object(objectId, 0);
- gObjectList[objectId].pos[0] = gObjectList[objectId].origin_pos[0] = start.x * xOrientation;
- gObjectList[objectId].pos[2] = gObjectList[objectId].origin_pos[2] = start.z;
+ find_unused_obj_index(&_objectIndex);
- gObjectList[objectId].unk_01C[0] = end.x * xOrientation;
- gObjectList[objectId].unk_01C[2] = end.z;
+ init_object(_objectIndex, 0);
+ gObjectList[_objectIndex].pos[0] = gObjectList[_objectIndex].origin_pos[0] = start.x * xOrientation;
+ gObjectList[_objectIndex].pos[2] = gObjectList[_objectIndex].origin_pos[2] = start.z;
+
+ gObjectList[_objectIndex].unk_01C[0] = end.x * xOrientation;
+ gObjectList[_objectIndex].unk_01C[2] = end.z;
_count++;
}
void OCrab::Tick(void) {
- s32 objectIndex;
-
- objectIndex = indexObjectList1[_idx];
+ s32 objectIndex = _objectIndex;
if (gObjectList[objectIndex].state != 0) {
OCrab::func_80082B34(objectIndex);
func_8008A6DC(objectIndex, 500.0f);
@@ -58,7 +56,7 @@ void OCrab::Tick(void) {
void OCrab::Draw(s32 cameraId) {
Camera* camera;
- s32 objectIndex = indexObjectList1[_idx];
+ s32 objectIndex = _objectIndex;
if (gObjectList[objectIndex].state >= 2) {
Vtx* vtx = (Vtx*) LOAD_ASSET_RAW(common_vtx_hedgehog);
camera = &camera1[cameraId];
@@ -74,11 +72,9 @@ void OCrab::Draw(s32 cameraId) {
void OCrab::DrawModel(s32 cameraId) {
s32 someIndex;
- s32 test;
-
- test = indexObjectList1[_idx];
- func_8008A364(test, cameraId, 0x2AABU, 800);
- if (is_obj_flag_status_active(test, VISIBLE) != 0) {
+ s32 objectIndex = _objectIndex;
+ func_8008A364(objectIndex, cameraId, 0x2AABU, 800);
+ if (is_obj_flag_status_active(objectIndex, VISIBLE) != 0) {
Camera *camera;
s32 objectIndex;