mirror of
https://github.com/zeldaret/st
synced 2026-08-24 23:36:03 -04:00
473e1e102b
* feat: begin decompiling * feat: some progress * fix: forgot to change symbol * feat: increase matching * fix: function params not updated * feat: more matching * fix: noo more errors oon local help * fix: match back UnkStruct_PlayerGet_74.data * feat: little progress * fix: SWBM.data regression * feat: up jp version * feat: update matching * refactor: rename UnkBOMB to Bomb * feat: decompiling part of MapObjectUnkBMFL * feat: destroy MapObjectPot's vfunc_24 for the good of all * fix: revert wrong symbol * feat: updating jp symbols * feat: eur advancements * feat: weird stuff * feat: fix build issue * feat: rename BMFL to BombFlower * feat: catchup jp .data * feat: improve BombFlower * feat: improve bomb matching * style: cleanup * style: cleanup v2 * fix: mapobjectpot_base .data * feat: better match for mapobjectpot_base * style: use deg_to_rad macro * style: cleaner variable definition * doc: better comment * fix: build
176 lines
4.8 KiB
C++
176 lines
4.8 KiB
C++
#include "MapObject/MapObjectGrass.hpp"
|
|
|
|
#include "System/Random.hpp"
|
|
#include "System/SysNew.hpp"
|
|
#include "Unknown/UnkStruct_027e09a8.hpp"
|
|
#include "Unknown/UnkStruct_027e0cec.hpp"
|
|
|
|
DECL_PROFILE(MapObjectProfileGrass);
|
|
|
|
MapObject *MapObjectProfileGrass::Create() {
|
|
return new(HeapIndex_ITCM) MapObjectGrass();
|
|
}
|
|
|
|
// non-matching
|
|
MapObjectProfileGrass::MapObjectProfileGrass() :
|
|
MapObjectProfilePot_Base(MapObjectId_Grass, MapObjectId_Grass) {
|
|
this->mUnk_D4.mUnk_08 = 0x2A807003;
|
|
VecFx32_Init(FLOAT_TO_FX32(0.0f), FLOAT_TO_FX32(0.0f), FLOAT_TO_FX32(0.0f), &this->mUnk_D4.mUnk_0C);
|
|
this->mUnk_D4.mUnk_18 = FLOAT_TO_FX32(0.35f);
|
|
this->mUnk_D4.mUnk_1C = FLOAT_TO_FX32(1.0f);
|
|
this->mUnk_D4.mUnk_04 &= 0xFD;
|
|
this->mUnk_06 = -0x1;
|
|
this->mUnk_1E &= ~0x1;
|
|
}
|
|
|
|
MapObjectGrass::MapObjectGrass() :
|
|
mUnk_58(0x0),
|
|
mUnk_5C(FLOAT_TO_FX32(0.0f)),
|
|
mUnk_64(-1) {
|
|
this->mUnk_62 = 0x0;
|
|
this->mUnk_60 = 0x0;
|
|
SET_FLAG(this->mFlags, MapObjFlag_6);
|
|
}
|
|
|
|
// non-matching
|
|
bool MapObjectGrass::vfunc_00() {}
|
|
|
|
void MapObjectGrass::vfunc_08() {
|
|
MapObjState state = this->mState;
|
|
if (state != MapObjGrassState_1) {
|
|
if (state == MapObjGrassState_2 && this->func_ov031_021016b4()) {
|
|
this->vfunc_38(MapObjGrassState_3, 0x0);
|
|
}
|
|
} else if (this->func_ov031_02101778()) {
|
|
this->vfunc_38(MapObjGrassState_0, 0x0);
|
|
}
|
|
if (this->mUnk_64 > -1) {
|
|
--this->mUnk_64;
|
|
}
|
|
}
|
|
|
|
// non-matching
|
|
void MapObjectGrass::vfunc_14() {
|
|
VecFx32 vec;
|
|
for (unk32 i = 0; i < ARRAY_LEN(this->mUnk_40); ++i) {
|
|
VecFx32_Add(&this->mUnk_40[i], &this->mPos, &vec);
|
|
vec.x += this->mUnk_5C;
|
|
}
|
|
}
|
|
|
|
bool MapObjectGrass::vfunc_38(MapObjState state, unk32 param2) {
|
|
if (this->mState == state) {
|
|
return true;
|
|
}
|
|
this->mState = state;
|
|
switch (this->mState) {
|
|
case MapObjGrassState_0:
|
|
this->mUnk_5C = FLOAT_TO_FX32(0.0f);
|
|
if (param2 != 0) {
|
|
this->func_ov031_021018a4(0x0);
|
|
}
|
|
break;
|
|
case MapObjGrassState_2:
|
|
this->mUnk_58 = 0x0;
|
|
this->mUnk_5C = FLOAT_TO_FX32(0.0f);
|
|
|
|
VecFx32 vec;
|
|
for (unk32 i = 0; i < ARRAY_LEN(this->mUnk_40); ++i) {
|
|
VecFx32_Init(this->mUnk_40[i].x, this->mUnk_40[i].y + FLOAT_TO_FX32(0.35f), this->mUnk_40[i].z, &vec);
|
|
VecFx32_Add(&vec, &this->mPos, &vec);
|
|
this->vfunc_3C(&vec);
|
|
}
|
|
|
|
if (this->GetMapObjectId() == MapObjectId_GRSV) {
|
|
data_027e09a8->func_ov000_02071b30(0xFB, &this->mPos, 0);
|
|
} else {
|
|
data_027e09a8->func_ov000_02071b30(0xF7, &this->mPos, 0);
|
|
}
|
|
this->func_ov031_021018a4(0x1);
|
|
break;
|
|
case MapObjGrassState_1:
|
|
this->mUnk_5C = FLOAT_TO_FX32(0.0f);
|
|
this->mUnk_58 = 0x0;
|
|
break;
|
|
case MapObjGrassState_3:
|
|
this->mUnk_5C = FLOAT_TO_FX32(0.0f);
|
|
this->func_ov031_021018a4(0x1);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// non-matching
|
|
bool MapObjectGrass::func_ov031_021016b4() {}
|
|
|
|
void MapObjectGrass::vfunc_3C(VecFx32 *param1) {
|
|
data_027e0cec->func_ov000_0209feac(0x923, param1, 0x4, 0x0, 0x0);
|
|
}
|
|
|
|
bool MapObjectGrass::func_ov031_02101778() {
|
|
this->mUnk_5C = gRandom.Next32(0x4CD) + 0xFFFFFD9A;
|
|
if (this->mUnk_58 >= 4U) {
|
|
return true;
|
|
}
|
|
++this->mUnk_58;
|
|
return false;
|
|
}
|
|
|
|
bool MapObjectGrass::vfunc_1C(ActorRef param1, unk32 param2, VecFx32 *param3) {
|
|
if (this->mUnk_64 != -0x1) {
|
|
return false;
|
|
}
|
|
switch (param2) {
|
|
case 0x7:
|
|
case 0x8:
|
|
case 0xC:
|
|
if (this->mState >= MapObjGrassState_2) {
|
|
return false;
|
|
}
|
|
this->vfunc_38(MapObjGrassState_2, 0x0);
|
|
return false;
|
|
case 0x4:
|
|
if (this->mState >= MapObjGrassState_1) {
|
|
return false;
|
|
}
|
|
this->vfunc_38(MapObjGrassState_1, 0x0);
|
|
return false;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
void MapObjectGrass::func_ov031_021018a4(unk16 param1) {
|
|
if (param1 != 0x0) {
|
|
this->mUnk_60 = 0x4;
|
|
this->mUnk_62 = 0x4;
|
|
return;
|
|
}
|
|
if (this->mUnk_20.mParams[1] == 0x1) {
|
|
this->mUnk_60 = 0x3;
|
|
} else {
|
|
this->mUnk_60 = gRandom.Next32(0x3);
|
|
}
|
|
this->mUnk_62 = gRandom.Next32(0x3);
|
|
}
|
|
|
|
unk32 MapObjectGrass::func_ov031_02101950() {
|
|
if (!(this->mState != MapObjGrassState_0 && this->mState != MapObjGrassState_1)) {
|
|
return 0x15;
|
|
}
|
|
return 0x16;
|
|
}
|
|
|
|
void MapObjectGrass::func_ov031_02101968(unk32 param1) {
|
|
if (param1 != 0x0) {
|
|
this->mUnk_64 = 0xA;
|
|
}
|
|
}
|
|
|
|
// non-matching
|
|
void MapObjectGrass::func_ov031_02101978(unk32 param1, VecFx32 *param2) {
|
|
VecFx32_Copy(param2, &this->mUnk_40[param1]);
|
|
}
|