Skip to content

Commit

Permalink
register SwitchStateBooleanLogic and Elum AO types
Browse files Browse the repository at this point in the history
  • Loading branch information
mouzedrift committed Aug 9, 2022
1 parent 75a1097 commit 5e6032e
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Source/AliveLibAO/Factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,7 @@ EXPORT void Factory_ChimeLock_4870D0(Path_TLV* pTlv, Map* /*pMap*/, TlvItemInfoU
}
}

EXPORT void Factory_ElumStart_Unknown_4873D0(Path_TLV* pTlv, Map* /*pMap*/, TlvItemInfoUnion tlvOffsetLevelIdPathId, LoadMode loadMode)
EXPORT void Factory_Elum_4873D0(Path_TLV* pTlv, Map* /*pMap*/, TlvItemInfoUnion tlvOffsetLevelIdPathId, LoadMode loadMode)
{
if (loadMode == LoadMode::LoadResourceFromList_1 || loadMode == LoadMode::LoadResource_2)
{
Expand Down Expand Up @@ -2768,7 +2768,7 @@ const PathFunctionTable kObjectFactory = {
Factory_ElectricWall_4874E0,
Factory_LiftMover_487580,
Factory_ChimeLock_4870D0,
Factory_ElumStart_Unknown_4873D0,
Factory_Elum_4873D0,
Factory_MeatSack_483790,
Factory_Scrab_4863E0,
Factory_FlintLockFire_487640,
Expand Down
6 changes: 3 additions & 3 deletions Source/AliveLibAO/PathData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ enum class TlvTypes : s16
Pulley_35 = 35,
HoneySack_36 = 36,
AbeStart_37 = 37,
ElumStart_38 = 38,
ElumStart_38 = 38, // this just controls whether the bell hammer does a sound when abe jumps against it

ElumWall_40 = 40,
SlingMudokon_41 = 41,
Expand Down Expand Up @@ -115,7 +115,7 @@ enum class TlvTypes : s16
ElectricWall_67 = 67,
LiftMover_68 = 68,
ChimeLock_69 = 69,

Elum_70 = 70,
MeatSack_71 = 71,
Scrab_72 = 72,
FlintLockFire_73 = 73,
Expand Down Expand Up @@ -148,7 +148,7 @@ enum class TlvTypes : s16
CreditsController_101 = 101,
Preloader_102 = 102,
LCDStatusBoard_103 = 103,

SwitchStateBooleanLogic_104 = 104,
MusicTrigger_105 = 105,
LightEffect_106 = 106,
SlogSpawner_107 = 107,
Expand Down
8 changes: 4 additions & 4 deletions Source/AliveLibAO/SwitchStateBooleanLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void SwitchStateBooleanLogic::VUpdate_436B60()
s8 id_value = 0;
switch (field_16_operator)
{
case BooleanOperatorType::eAnd_0:
case BooleanOperatorType::eAllOn_0:
if (id1_value && id2_value)
{
id_value = 1;
Expand All @@ -86,7 +86,7 @@ void SwitchStateBooleanLogic::VUpdate_436B60()
}
break;

case BooleanOperatorType::eAndNot_1:
case BooleanOperatorType::e1OnAnd2Off_1:
if (id1_value && !id2_value)
{
id_value = 1;
Expand All @@ -97,7 +97,7 @@ void SwitchStateBooleanLogic::VUpdate_436B60()
}
break;

case BooleanOperatorType::eOr_2:
case BooleanOperatorType::e1Or2On_2:
if (id1_value || id2_value)
{
id_value = 1;
Expand All @@ -108,7 +108,7 @@ void SwitchStateBooleanLogic::VUpdate_436B60()
}
break;

case BooleanOperatorType::eOrNot_3:
case BooleanOperatorType::e1OnOr2Off_3:
if (id1_value || !id2_value)
{
id_value = 1;
Expand Down
8 changes: 4 additions & 4 deletions Source/AliveLibAO/SwitchStateBooleanLogic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ namespace AO {

enum class BooleanOperatorType : s16
{
eAnd_0 = 0,
eAndNot_1 = 1,
eOr_2 = 2,
eOrNot_3 = 3,
eAllOn_0 = 0,
e1OnAnd2Off_1 = 1,
e1Or2On_2 = 2,
e1OnOr2Off_3 = 3,
};

struct Path_SwitchStateBooleanLogic final : public Path_TLV
Expand Down
36 changes: 36 additions & 0 deletions Source/Tools/relive_api/TlvsAO.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
#include "../../AliveLibAO/BackgroundGlukkon.hpp"
#include "../../AliveLibAO/CreditsController.hpp"
#include "../../AliveLibAO/DoorFlame.hpp"
#include "../../AliveLibAO/SwitchStateBooleanLogic.hpp"

#define CTOR_AO(className, objectTypeName, tlvEnumType)\
className() : TlvObjectBaseAO(sizeof(AO::className), tlvEnumType, objectTypeName, &mTlv)\
Expand Down Expand Up @@ -95,6 +96,11 @@ struct Path_HoneyDripTarget final : public Path_TLV
// No fields
};

struct Path_Elum final : public Path_TLV
{
// No fields
};

struct Path_Honey final : public Path_TLV
{
s16 switch_id;
Expand Down Expand Up @@ -267,6 +273,28 @@ struct Path_KillUnsavedMuds final : public ReliveAPI::TlvObjectBaseAO
}
};

struct Path_SwitchStateBooleanLogic final : public ReliveAPI::TlvObjectBaseAO
{
void AddTypes(ReliveAPI::TypesCollectionBase& types) override
{
types.AddEnum<AO::BooleanOperatorType>("Enum_BooleanOperatorType",
{
{AO::BooleanOperatorType::eAllOn_0, "All On"},
{AO::BooleanOperatorType::e1OnAnd2Off_1, "1 On And 2 Off"},
{AO::BooleanOperatorType::e1Or2On_2, "1 Or 2 On"},
{AO::BooleanOperatorType::e1OnOr2Off_3, "1 On Or 2 Off"},
});
}

CTOR_AO(Path_SwitchStateBooleanLogic, "SwitchStateBooleanLogic", AO::TlvTypes::SwitchStateBooleanLogic_104)
{
ADD("Input Switch ID 1", mTlv.field_18_input1);
ADD("Input Switch ID 2", mTlv.field_1A_input2);
ADD("Output Switch ID", mTlv.field_1C_output);
ADD("Operator", mTlv.field_1E_operator);
}
};

struct Path_DoorFlame final : public ReliveAPI::TlvObjectBaseAO
{
void AddTypes(ReliveAPI::TypesCollectionBase& types) override
Expand Down Expand Up @@ -996,6 +1024,14 @@ struct Path_ElumPathTrans final : public ReliveAPI::TlvObjectBaseAO
}
};

struct Path_Elum final : public ReliveAPI::TlvObjectBaseAO
{
CTOR_AO(Path_Elum, "Elum", AO::TlvTypes::Elum_70)
{
EMPTY_CTOR_AO();
}
};

struct Path_ElumStart final : public ReliveAPI::TlvObjectBaseAO
{
CTOR_AO(Path_ElumStart, "ElumStart", AO::TlvTypes::ElumStart_38)
Expand Down
2 changes: 2 additions & 0 deletions Source/Tools/relive_api/TypesCollectionAO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ void TypesCollectionAO::AddAOTypes()
REGISTER_TYPE_AO(AOTlvs::Path_TimerTrigger);
REGISTER_TYPE_AO(AOTlvs::Path_PullRingRope);
REGISTER_TYPE_AO(AOTlvs::Path_MusicTrigger);
REGISTER_TYPE_AO(AOTlvs::Path_Elum);
REGISTER_TYPE_AO(AOTlvs::Path_ElumPathTrans);
REGISTER_TYPE_AO(AOTlvs::Path_ElumStart);
REGISTER_TYPE_AO(AOTlvs::Path_ElumWall);
Expand Down Expand Up @@ -136,6 +137,7 @@ void TypesCollectionAO::AddAOTypes()
REGISTER_TYPE_AO(AOTlvs::Path_HandStone);
REGISTER_TYPE_AO(AOTlvs::Path_BellsongStone);
REGISTER_TYPE_AO(AOTlvs::Path_MovieStone);
REGISTER_TYPE_AO(AOTlvs::Path_SwitchStateBooleanLogic);

#undef REGISTER_TYPE_AO
AddEnum<AO::eLineTypes>("Enum_LineTypes",
Expand Down

0 comments on commit 5e6032e

Please sign in to comment.