mirror of
https://github.com/MonsterDruide1/OdysseyDecomp
synced 2026-04-23 09:04:21 +00:00
MapObj: Implement BlockEmpty2D (#974)
This commit is contained in:
parent
d5442627d4
commit
6161aae92f
|
|
@ -58915,40 +58915,40 @@ MapObj/BlockEmpty2D.o:
|
|||
- offset: 0x21d248
|
||||
size: 152
|
||||
label: _ZN12BlockEmpty2DC2EPKc
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x21d2e0
|
||||
size: 148
|
||||
label: _ZN12BlockEmpty2DC1EPKc
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x21d374
|
||||
size: 320
|
||||
label: _ZN12BlockEmpty2D4initERKN2al13ActorInitInfoE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x21d4b4
|
||||
size: 240
|
||||
label: _ZN12BlockEmpty2D18initAfterPlacementEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x21d5a4
|
||||
size: 16
|
||||
label: _ZN12BlockEmpty2D7controlEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x21d5b4
|
||||
size: 56
|
||||
label: _ZN12BlockEmpty2D6appearEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x21d5ec
|
||||
size: 104
|
||||
label: _ZN12BlockEmpty2D10receiveMsgEPKN2al9SensorMsgEPNS0_9HitSensorES5_
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x21d654
|
||||
size: 8
|
||||
label: _ZNK12BlockEmpty2D23getActorDimensionKeeperEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x21d65c
|
||||
size: 8
|
||||
label: _ZThn264_NK12BlockEmpty2D23getActorDimensionKeeperEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
MapObj/BlockHard.o:
|
||||
'.text':
|
||||
|
|
@ -133611,7 +133611,7 @@ Scene/ProjectActorFactory.o:
|
|||
- offset: 0x4b630c
|
||||
size: 52
|
||||
label: _ZN2al19createActorFunctionI12BlockEmpty2DEEPNS_9LiveActorEPKc
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x4b6340
|
||||
size: 52
|
||||
|
|
|
|||
74
src/MapObj/BlockEmpty2D.cpp
Normal file
74
src/MapObj/BlockEmpty2D.cpp
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
#include "MapObj/BlockEmpty2D.h"
|
||||
|
||||
#include <prim/seadSafeString.h>
|
||||
|
||||
#include "Library/Collision/PartsConnectorUtil.h"
|
||||
#include "Library/LiveActor/ActorActionFunction.h"
|
||||
#include "Library/LiveActor/ActorInitUtil.h"
|
||||
#include "Library/LiveActor/ActorPoseUtil.h"
|
||||
#include "Library/LiveActor/ActorSensorUtil.h"
|
||||
#include "Library/Placement/PlacementFunction.h"
|
||||
#include "Library/Placement/PlacementId.h"
|
||||
|
||||
#include "Util/ActorDimensionUtil.h"
|
||||
#include "Util/SensorMsgFunction.h"
|
||||
|
||||
BlockEmpty2D::BlockEmpty2D(const char* name) : al::LiveActor(name) {}
|
||||
|
||||
void BlockEmpty2D::init(const al::ActorInitInfo& info) {
|
||||
al::initActorWithArchiveName(this, info, "BlockEmpty2D", nullptr);
|
||||
mMtxConnector = al::tryCreateMtxConnector(this, info);
|
||||
if (mMtxConnector)
|
||||
al::tryGetArg(&mIsConnectToCollisionBack, info, "IsConnectToCollisionBack");
|
||||
mDimensionKeeper = rs::createDimensionKeeper(this);
|
||||
rs::updateDimensionKeeper(mDimensionKeeper);
|
||||
if (!rs::isIn2DArea(this)) {
|
||||
al::PlacementId placementId;
|
||||
al::tryGetPlacementId(&placementId, info);
|
||||
al::StringTmp<128> str;
|
||||
placementId.makeString(&str);
|
||||
kill();
|
||||
return;
|
||||
}
|
||||
|
||||
rs::snap2DParallelizeFront(this, this, 500.0f);
|
||||
makeActorAlive();
|
||||
}
|
||||
|
||||
void BlockEmpty2D::initAfterPlacement() {
|
||||
if (mMtxConnector) {
|
||||
if (mIsConnectToCollisionBack) {
|
||||
sead::Vector3f frontDir = sead::Vector3f::zero;
|
||||
al::calcFrontDir(&frontDir, this);
|
||||
al::attachMtxConnectorToCollision(
|
||||
mMtxConnector, this, al::getTrans(this) + 50.0f * frontDir, -400.0f * frontDir);
|
||||
} else {
|
||||
al::attachMtxConnectorToCollision(mMtxConnector, this, 50.0f, 400.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BlockEmpty2D::control() {
|
||||
if (mMtxConnector)
|
||||
al::connectPoseQT(this, mMtxConnector);
|
||||
}
|
||||
|
||||
void BlockEmpty2D::appear() {
|
||||
al::LiveActor::appear();
|
||||
if (mMtxConnector)
|
||||
al::connectPoseQT(this, mMtxConnector);
|
||||
}
|
||||
|
||||
bool BlockEmpty2D::receiveMsg(const al::SensorMsg* msg, al::HitSensor* other, al::HitSensor* self) {
|
||||
if (al::isMsgAskSafetyPoint(msg))
|
||||
return true;
|
||||
if (al::isMsgPlayerDisregard(msg))
|
||||
return true;
|
||||
if (rs::isMsgPlayerUpperPunch2D(msg))
|
||||
al::startHitReaction(this, "アッパーパンチ");
|
||||
return false;
|
||||
}
|
||||
|
||||
ActorDimensionKeeper* BlockEmpty2D::getActorDimensionKeeper() const {
|
||||
return mDimensionKeeper;
|
||||
}
|
||||
29
src/MapObj/BlockEmpty2D.h
Normal file
29
src/MapObj/BlockEmpty2D.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include "Library/LiveActor/LiveActor.h"
|
||||
|
||||
#include "Util/IUseDimension.h"
|
||||
|
||||
class ActorDimensionKeeper;
|
||||
|
||||
namespace al {
|
||||
class MtxConnector;
|
||||
} // namespace al
|
||||
|
||||
class BlockEmpty2D : public al::LiveActor, public IUseDimension {
|
||||
public:
|
||||
BlockEmpty2D(const char* name);
|
||||
void init(const al::ActorInitInfo& info) override;
|
||||
void initAfterPlacement() override;
|
||||
void control() override;
|
||||
void appear() override;
|
||||
bool receiveMsg(const al::SensorMsg* msg, al::HitSensor* other, al::HitSensor* self) override;
|
||||
ActorDimensionKeeper* getActorDimensionKeeper() const override;
|
||||
|
||||
private:
|
||||
bool mIsConnectToCollisionBack = false;
|
||||
al::MtxConnector* mMtxConnector = nullptr;
|
||||
ActorDimensionKeeper* mDimensionKeeper = nullptr;
|
||||
};
|
||||
|
||||
static_assert(sizeof(BlockEmpty2D) == 0x128);
|
||||
|
|
@ -67,6 +67,7 @@
|
|||
#include "Item/LifeUpItem2D.h"
|
||||
#include "MapObj/AllDeadWatcherWithShine.h"
|
||||
#include "MapObj/AnagramAlphabet.h"
|
||||
#include "MapObj/BlockEmpty2D.h"
|
||||
#include "MapObj/CapBomb.h"
|
||||
#include "MapObj/CapHanger.h"
|
||||
#include "MapObj/CapSwitch.h"
|
||||
|
|
@ -139,7 +140,7 @@ const al::NameToCreator<al::ActorCreatorFunction> sProjectActorFactoryEntries[]
|
|||
{"BlockBrick2D", nullptr},
|
||||
{"BlockBrickBig2D", nullptr},
|
||||
{"BlockEmpty", nullptr},
|
||||
{"BlockEmpty2D", nullptr},
|
||||
{"BlockEmpty2D", al::createActorFunction<BlockEmpty2D>},
|
||||
{"BlockHard", nullptr},
|
||||
{"ClashWorldBlockHard", nullptr},
|
||||
{"BlockQuestion", nullptr},
|
||||
|
|
|
|||
Loading…
Reference in a new issue