Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MapObj: Implement TransparentWall #276

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions data/odyssey_functions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -20225,10 +20225,10 @@ Address,Quality,Size,Name
0x000000710033c570,U,000124,_ZNK12_GLOBAL__N_127TrampleSwitchTimerNrvOnWait7executeEPN2al11NerveKeeperE
0x000000710033c5ec,U,000096,_ZNK12_GLOBAL__N_124TrampleSwitchTimerNrvOff7executeEPN2al11NerveKeeperE
0x000000710033c64c,U,000092,_ZNK12_GLOBAL__N_123TrampleSwitchTimerNrvOn7executeEPN2al11NerveKeeperE
0x000000710033c6a8,U,000120,_ZN15TransparentWallC2EPKc
0x000000710033c720,U,000132,_ZN15TransparentWallC1EPKc
0x000000710033c7a4,U,000232,_ZN15TransparentWall4initERKN2al13ActorInitInfoE
0x000000710033c88c,U,000008,_ZN15TransparentWall10receiveMsgEPKN2al9SensorMsgEPNS0_9HitSensorES5_
0x000000710033c6a8,O,000120,_ZN15TransparentWallC2EPKc
0x000000710033c720,O,000132,_ZN15TransparentWallC1EPKc
0x000000710033c7a4,O,000232,_ZN15TransparentWall4initERKN2al13ActorInitInfoE
0x000000710033c88c,O,000008,_ZN15TransparentWall10receiveMsgEPKN2al9SensorMsgEPNS0_9HitSensorES5_
0x000000710033c894,U,000172,_ZN11TreasureBoxC2EPKc
0x000000710033c940,U,000184,_ZN11TreasureBoxC1EPKc
0x000000710033c9f8,U,000980,_ZN11TreasureBox4initERKN2al13ActorInitInfoE
Expand Down
35 changes: 35 additions & 0 deletions src/MapObj/TransparentWall.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "MapObj/TransparentWall.h"

#include "Library/Base/StringUtil.h"
#include "Library/LiveActor/ActorClippingFunction.h"
#include "Library/LiveActor/ActorCollisionFunction.h"
#include "Library/LiveActor/ActorInitInfo.h"
#include "Library/LiveActor/ActorPoseKeeper.h"
#include "Library/LiveActor/ActorSensorMsgFunction.h"
#include "Library/LiveActor/LiveActorUtil.h"
#include "Library/Placement/PlacementFunction.h"

#include "Util/ActorDimensionKeeper.h"

TransparentWall::TransparentWall(const char* name) : al::LiveActor(name) {}

void TransparentWall::init(const al::ActorInitInfo& info) {
const char* objectName;
al::getObjectName(&objectName, info);

if (al::isEqualString("TransparentWall2D", objectName)) {
al::initActorWithArchiveName(this, info, "TransparentWall", nullptr);
al::setCollisionPartsSpecialPurposeName(this, rs::getSpecialPurposeName2DOnly());
} else {
al::initActor(this, info);
}

al::setClippingInfo(this, al::getScaleX(this) * 500.0f * sqrtf(2.0f), nullptr);

al::trySyncStageSwitchAppearAndKill(this);
}

bool TransparentWall::receiveMsg(const al::SensorMsg* message, al::HitSensor* other,
al::HitSensor* self) {
return al::isMsgScreenPointInvalidCollisionParts(message);
}
12 changes: 12 additions & 0 deletions src/MapObj/TransparentWall.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once

#include "Library/LiveActor/LiveActor.h"

class TransparentWall : public al::LiveActor {
public:
TransparentWall(const char* name);

void init(const al::ActorInitInfo& info) override;
bool receiveMsg(const al::SensorMsg* message, al::HitSensor* other,
al::HitSensor* self) override;
};
7 changes: 6 additions & 1 deletion src/Util/ActorDimensionKeeper.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
#include <basis/seadTypes.h>

namespace al {
class CollisionPartsFilterOnlySpecialPurpose;
class LiveActor;
}
} // namespace al
class In2DAreaMoveControl;
class IUseDimension;

Expand Down Expand Up @@ -45,6 +46,10 @@ namespace rs {
ActorDimensionKeeper* createDimensionKeeper(const al::LiveActor* actor);
void updateDimensionKeeper(ActorDimensionKeeper* keeper);

const char* getSpecialPurposeName2DOnly();
void createAndSetFilter2DOnly(al::LiveActor* actor);
al::CollisionPartsFilterOnlySpecialPurpose* createCollisionPartsFilter2DOnly();

bool is2D(const IUseDimension* dimension);
bool isIn2DArea(const IUseDimension* dimension);
bool isChange2D(const IUseDimension* dimension);
Expand Down
Loading