mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-06-02 02:00:52 -04:00
Fix Crab Impl
This commit is contained in:
+15
-15
@@ -23,25 +23,28 @@ extern "C" {
|
||||
#include "assets/koopa_troopa_beach_data.h"
|
||||
}
|
||||
|
||||
OCrab::OCrab(s32 i, Vec3f pos) {
|
||||
size_t OCrab::_count = 0;
|
||||
|
||||
OCrab::OCrab(const FVector2D& start, const FVector2D& end) {
|
||||
s32 objectId;
|
||||
//for (i = 0; i < NUM_CRABS; i++) {
|
||||
_idx = i;
|
||||
objectId = indexObjectList1[i];
|
||||
_idx = _count;
|
||||
_start = start;
|
||||
_end = end;
|
||||
|
||||
objectId = indexObjectList1[_idx];
|
||||
init_object(objectId, 0);
|
||||
gObjectList[objectId].pos[0] = gObjectList[objectId].origin_pos[0] =
|
||||
gCrabSpawns[i].startX * xOrientation;
|
||||
gObjectList[objectId].pos[0] = gObjectList[objectId].origin_pos[0] = start.x * xOrientation;
|
||||
gObjectList[objectId].pos[2] = gObjectList[objectId].origin_pos[2] = start.z;
|
||||
|
||||
gObjectList[objectId].unk_01C[0] = gCrabSpawns[i].patrolX * xOrientation;
|
||||
gObjectList[objectId].unk_01C[0] = end.x * xOrientation;
|
||||
gObjectList[objectId].unk_01C[2] = end.z;
|
||||
|
||||
gObjectList[objectId].pos[2] = gObjectList[objectId].origin_pos[2] = gCrabSpawns[i].startZ;
|
||||
gObjectList[objectId].unk_01C[2] = gCrabSpawns[i].patrolZ;
|
||||
_count++;
|
||||
}
|
||||
|
||||
void OCrab::Tick(void) {
|
||||
s32 objectIndex;
|
||||
|
||||
//for (var_s1 = 0; var_s1 < NUM_CRABS; var_s1++) {
|
||||
objectIndex = indexObjectList1[_idx];
|
||||
if (gObjectList[objectIndex].state != 0) {
|
||||
OCrab::func_80082B34(objectIndex);
|
||||
@@ -49,12 +52,11 @@ void OCrab::Tick(void) {
|
||||
OCrab::func_80082C30(objectIndex);
|
||||
OCrab::func_80082E18(objectIndex);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
void OCrab::Draw(s32 objectIndex, s32 cameraId) {
|
||||
void OCrab::Draw(s32 cameraId) {
|
||||
Camera* camera;
|
||||
|
||||
s32 objectIndex = indexObjectList1[_idx];
|
||||
if (gObjectList[objectIndex].state >= 2) {
|
||||
Vtx* vtx = (Vtx*) LOAD_ASSET_RAW(common_vtx_hedgehog);
|
||||
camera = &camera1[cameraId];
|
||||
@@ -72,7 +74,6 @@ void OCrab::DrawModel(s32 cameraId) {
|
||||
s32 someIndex;
|
||||
s32 test;
|
||||
|
||||
//for (someIndex = 0; someIndex < NUM_CRABS; someIndex++) {
|
||||
test = indexObjectList1[_idx];
|
||||
func_8008A364(test, cameraId, 0x2AABU, 800);
|
||||
if (is_obj_flag_status_active(test, VISIBLE) != 0) {
|
||||
@@ -86,7 +87,6 @@ void OCrab::DrawModel(s32 cameraId) {
|
||||
draw_2d_texture_at(gObjectList[objectIndex].pos, gObjectList[objectIndex].orientation, gObjectList[objectIndex].sizeScaling, (u8*) gObjectList[objectIndex].activeTLUT, (u8*)gObjectList[objectIndex].activeTexture, (Vtx*)common_vtx_hedgehog, 0x00000040, 0x00000040, 0x00000040, 0x00000020);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
void OCrab::init_ktb_crab(s32 objectIndex) {
|
||||
|
||||
+20
-13
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <libultraship.h>
|
||||
#include <vector>
|
||||
#include "engine/objects/Object.h"
|
||||
#include "World.h"
|
||||
|
||||
extern "C" {
|
||||
#include "macros.h"
|
||||
@@ -14,20 +16,23 @@ extern "C" {
|
||||
#include "some_data.h"
|
||||
}
|
||||
|
||||
|
||||
class OCrab {
|
||||
/**
|
||||
* @arg start x and z spawn location
|
||||
* @arg end x and z patrol location
|
||||
*
|
||||
* Crab patrols between start and end.
|
||||
* The game automatically places the actor on the course surface.
|
||||
* Therefore, providing a Y height is unnecessary.
|
||||
*
|
||||
* Crab appears to have a maximum patrolling distance and will patrol between
|
||||
* end --> max distance rather than start --> end or start --> max distance.
|
||||
*/
|
||||
class OCrab : public OObject {
|
||||
public:
|
||||
enum Behaviour : uint16_t {
|
||||
};
|
||||
explicit OCrab(const FVector2D& start, const FVector2D& end);
|
||||
|
||||
public:
|
||||
f32 Diameter = 0.0f; // Waddle in a circle around the spawn point at this diameter.
|
||||
uint16_t MirrorModeAngleOffset;
|
||||
|
||||
explicit OCrab(s32 i, Vec3f pos);
|
||||
|
||||
void Tick();
|
||||
void Draw(s32 objectIndex, s32 cameraId);
|
||||
virtual void Tick() override;
|
||||
virtual void Draw(s32 cameraId) override;
|
||||
void DrawModel(s32 cameraId);
|
||||
|
||||
void init_ktb_crab(s32 objectIndex);
|
||||
@@ -36,6 +41,8 @@ public:
|
||||
void func_80082E18(s32 objectIndex);
|
||||
|
||||
private:
|
||||
|
||||
FVector2D _start;
|
||||
FVector2D _end;
|
||||
static size_t _count;
|
||||
s32 _idx;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user