From 8f4fac417fd718fa1bda515228c713061e30df14 Mon Sep 17 00:00:00 2001 From: CraftyBoss Date: Wed, 10 Aug 2022 14:11:52 -0700 Subject: [PATCH] change recieve logs, update headers, fix bound bowl crash --- include/al/PlayerHolder/PlayerHolder.h | 5 +- include/al/util.hpp | 2 +- include/al/util/LiveActorUtil.h | 3 +- include/game/Actors/Shine.h | 80 ++++++- include/game/GameData/GameDataFile.h | 202 +++++++++++++++++- include/game/GameData/GameDataFunction.h | 14 ++ .../game/HakoniwaSequence/HakoniwaSequence.h | 30 +-- include/game/Interfaces/IUsePlayerHack.h | 3 +- include/game/Layouts/CommonVerticalList.h | 9 +- include/game/Player/HackCap.h | 7 +- .../Player/HackCap/PlayerCapActionHistory.h | 29 +++ include/game/Player/PlayerActorBase.h | 58 ++++- include/game/Player/PlayerActorHakoniwa.h | 139 +++++++++--- include/game/Player/PlayerInfo.h | 6 +- include/game/Sequence/SequenceFactory.h | 6 + include/game/StageScene/StageScene.h | 115 ++++++++-- .../game/StageScene/StageSceneStateOption.h | 4 +- include/main.hpp | 6 + include/packets/Packet.h | 3 +- include/rs/util.hpp | 9 +- include/server/Client.hpp | 2 +- patches/codehook.slpatch | 4 +- source/layouts/HideAndSeekIcon.cpp | 4 +- source/main.cpp | 77 ++++--- source/server/Client.cpp | 84 +++++--- source/server/HideAndSeekMode.cpp | 73 ++++--- source/server/SocketClient.cpp | 17 +- source/server/logger.cpp | 5 +- source/states/StageSceneStateServerConfig.cpp | 26 +++ 29 files changed, 816 insertions(+), 206 deletions(-) create mode 100644 include/game/Player/HackCap/PlayerCapActionHistory.h create mode 100644 include/game/Sequence/SequenceFactory.h diff --git a/include/al/PlayerHolder/PlayerHolder.h b/include/al/PlayerHolder/PlayerHolder.h index 068bb93..88be704 100644 --- a/include/al/PlayerHolder/PlayerHolder.h +++ b/include/al/PlayerHolder/PlayerHolder.h @@ -1,5 +1,6 @@ #pragma once +#include "game/Player/PlayerActorBase.h" #include "sead/math/seadVector.h" #include "al/scene/Scene.h" #include "al/LiveActor/LiveActor.h" @@ -15,8 +16,8 @@ namespace al { PlayerHolder(int bufSize); void clear(void); void registerPlayer(al::LiveActor *, al::PadRumbleKeeper *); - PlayerActorHakoniwa *getPlayer(int) const; - PlayerActorHakoniwa *tryGetPlayer(int) const; + PlayerActorBase *getPlayer(int) const; + PlayerActorBase *tryGetPlayer(int) const; int getPlayerNum() const; int getBufferSize() const {return bufferSize;}; bool isFull(void) const; diff --git a/include/al/util.hpp b/include/al/util.hpp index 3ef495d..981543e 100644 --- a/include/al/util.hpp +++ b/include/al/util.hpp @@ -242,7 +242,7 @@ namespace al bool tryGetByamlColor(sead::Color4f *,al::ByamlIter const&); bool tryGetByamlColor(sead::Color4f *,al::ByamlIter const&,char const*); bool tryGetByamlBool(bool *,al::ByamlIter const&,char const*); - bool tryGetByamlKeyStringOrNULL(al::ByamlIter const&,char const*); + const char * tryGetByamlKeyStringOrNULL(al::ByamlIter const&,char const*); bool tryGetByamlKeyIntOrZero(al::ByamlIter const&,char const*); bool tryGetByamlKeyU32OrZero(al::ByamlIter const&,char const*); bool tryGetByamlKeyFloatOrZero(al::ByamlIter const&,char const*); diff --git a/include/al/util/LiveActorUtil.h b/include/al/util/LiveActorUtil.h index fdd1a0b..7c42255 100644 --- a/include/al/util/LiveActorUtil.h +++ b/include/al/util/LiveActorUtil.h @@ -7,6 +7,7 @@ #include "al/LiveActor/LiveActor.h" #include "al/async/FunctorBase.h" #include "al/collision/Collider.h" +#include "game/Player/PlayerActorBase.h" #include "game/Player/PlayerActorHakoniwa.h" #include "al/layout/LayoutActor.h" #include "al/layout/LayoutInitInfo.h" @@ -91,7 +92,7 @@ namespace al { bool tryOnSwitchDeadOn(IUseStageSwitch *); bool trySyncStageSwitchAppear(LiveActor *); - PlayerActorHakoniwa* tryFindNearestPlayerActor(const LiveActor *); + PlayerActorBase* tryFindNearestPlayerActor(const LiveActor *); bool tryFindNearestPlayerPos(sead::Vector3f *, const LiveActor *); bool tryAddRippleMiddle(LiveActor*); bool tryStartActionIfNotPlaying(LiveActor*, const char*); diff --git a/include/game/Actors/Shine.h b/include/game/Actors/Shine.h index f27db23..c51df7a 100644 --- a/include/game/Actors/Shine.h +++ b/include/game/Actors/Shine.h @@ -8,6 +8,12 @@ #include "game/Interfaces/IUseDimension.h" #include "al/LiveActor/LiveActor.h" +enum ShineType { Normal, Dot, Grand }; + +namespace al { + struct RateParamV3f; +} + class Shine : public al::LiveActor , public IUseDimension { public: Shine(const char* actorName); @@ -16,23 +22,79 @@ class Shine : public al::LiveActor , public IUseDimension { void offAppear(); void onAppear(); - void getDirectWithDemo(void); void getDirect(); void get(); - void onSwitchGet(void); - bool isGot() const; - void setGrandShine(void); - unsigned char padding[0x10]; - // 0x11C mIsEmptyShine + void *qword110; + int dword118; + bool mIsGotShine; ShineInfo *curShineInfo; // 0x120 - unsigned char padding_290[0x278 - 0x128]; + unsigned char padding_188[0x188 - 0x128]; + al::RateParamV3f *mRateParam; + void * qword190; + void * qword198; + ShineType mModelType; + void * qword1A8; + bool byte1B0; + void * qword1B8; + int dword1C0; + int dword1C4; + sead::FixedSafeString<0x80> mShineLabel; + void * qword260; + int dword268; + bool byte26C; + void * qword270; QuestInfo *shineQuestInfo; // 0x278 void *unkPtr1; // 0x280 ActorDimensionKeeper *mDimensionKeeper; // 0x288 - int shineId; // 0x290 -}; \ No newline at end of file + int shineId; // 0x290 + bool mIsMainShine; + void *qword298; + void *qword2A0; + void *qword2A8; + void *qword2B0; + void *qword2B8; + int dword2C0; + __attribute__((packed)) void * qword2C4; + int dword2CC; + int dword2D0; + bool mIsAddHeight; + int dword2D8; + al::LiveActor *mModelEmpty; + al::LiveActor *mModelShine; + int dword2F0; + u16 word2F4; + int dword2F8; + bool mIsNoRotate; + void * qword300; + bool mIsUseDemoCam; + struct WaterSurfaceShadow *mWaterShadow; + void * qword318; + int dword320; + int dword324; + bool byte328; + void * qword330; + bool mIsCheckGroundHeightMoon; + bool mIsHintPhoto; + void * qword340; + bool byte348; + void * qword350; + bool mIsUseAppearDemoForce; + int dword35C; + int dword360; + int dword364; + int dword368; + bool mIsPowerStar; + bool mIsAppearDemoHeightHigh; + void * qword370; + u16 word378; + int dword37C; +}; + +namespace rs { + void setStageShineAnimFrame(al::LiveActor *,char const*,int,bool); +} \ No newline at end of file diff --git a/include/game/GameData/GameDataFile.h b/include/game/GameData/GameDataFile.h index 0dcd582..5728bfa 100644 --- a/include/game/GameData/GameDataFile.h +++ b/include/game/GameData/GameDataFile.h @@ -6,8 +6,10 @@ #pragma once #include "al/scene/SceneObjHolder.h" +#include "container/seadPtrArray.h" #include "types.h" #include "UniqueObjInfo.h" +#include "GameProgressData.h" #include "sead/math/seadVector.h" #include "sead/stream/seadStream.h" @@ -16,7 +18,24 @@ namespace al { class ActorInitInfo; class PlacementInfo; class PlacementId; -} + } // namespace al + +class SphinxQuizData; +class TimeBalloonSaveData; +class WorldWarpTalkData; +class VisitStageData; +class MoonRockData; +class BossSaveData; +class AchievementSaveData; +class SearchAmiiboDataTable; +class NetworkUploadFlag; +class SequenceDemoSkipData; +class HintPhotoData; +class ShopTalkData; +class RaceRecord; + +class PlayerHitPointData; + class GameDataHolder; class ShineInfo; @@ -296,15 +315,176 @@ class GameDataFile bool isEmpty(void) const; bool isKidsMode(void) const; - undefined padding[0x5C8]; - UniqObjInfo** mUniqueInfo; // 0x5C8 - void *unkPtr1; // 0x5D0 - void *unkPtr2; // 0x5D8 - void *unkPtr3; // 0x5E0 - void* unkPtr4; // 0x5E8 - void* unkPtr5; // 0x5F0 - bool unkBool1; // 0x5F8 - bool unkBool2; // 0x5F9 - bool mIsCapEnable; // 0x5FA + ShineInfo **mShineInfoArray; + ShineInfo **mShineInfoArray2; + ShineInfo *mShineInfo; + void *qword18; + void *qword20; + int dword28; + int dword2C; + sead::FixedSafeString<0x80> char30; + sead::FixedSafeString<0x80> charC8; + sead::FixedSafeString<0x80> char160; + sead::FixedSafeString<0x80> char1F8; + sead::FixedSafeString<0x80> char290; + sead::FixedSafeString<0x80> char328; + sead::FixedSafeString<0x80> char3C0; + u16 word458; + char gap45A[6]; + void *qword460; + void *qword468; + void *qword470; + void *qword478; + void *qword480; + void *qword488; + sead::FixedSafeString<0x100> char490; + void *qword5A8; + bool byte5B0; + void *qword5B4; + sead::FixedSafeString<0x80> *qword5C0; + UniqObjInfo** mUniqueObjInfoArr; + void *qword5D0; + void *qword5D8; + void *qword5E0; + void *qword5E8; + void *qword5F0; + u16 word5F8; + bool byte5FA; + void *qword600; + int dword608; + bool byte60C; + SphinxQuizData *mSphinxQuizData; + void *qword618; + void *qword620; + void *qword628; + TimeBalloonSaveData *qword630; + sead::FixedSafeString<0x40> char638; + int dword690; + WorldWarpTalkData *mWorldWarpTalkData; + VisitStageData *mVisitStageData; + GameProgressData *mGameProgressData; + MoonRockData *mMoonRockData; + BossSaveData *mBossSaveData; + AchievementSaveData *mAchievementSaveData; + SearchAmiiboDataTable *mSearchAmiiboDataTable; + NetworkUploadFlag *mNetworkUploadFlag; + SequenceDemoSkipData *mSequenceDemoSkipData; + HintPhotoData *mHintPhotoData; + void *qword6E8; + void *qword6F0; + void *qword6F8; + void *qword700; + void *qword708; + sead::FixedSafeString<0x40> char710; + sead::FixedSafeString<0x40> char768; + u16 word7C0; + void *qword7C8; + u16 word7D0; + void *qword7D8; + sead::PtrArray mLatestRaceRecords; + void *qword7F0; + void *qword7F8; + void *qword800; + void *qword808; + void *qword810; + bool byte818; + void *qword820; + bool byte828; + sead::PtrArrayImpl sead__ptrarrayimpl830; + u16 word840; + bool byte842; + int dword844; + bool byte848; + GameDataHolder *mGameDataHolder; + void *qword858; + PlayerHitPointData *mPlayerHintPointData; + sead::FixedSafeString<0x80> char868; + bool byte900; + bool byte901; + int dword904; + sead::FixedSafeString<0x80> char908; + void *char9A0; + sead::PtrArrayImpl sead__ptrarrayimpl9A8; + sead::PtrArrayImpl sead__ptrarrayimpl9B8; + sead::PtrArrayImpl sead__ptrarrayimpl9C8; + sead::PtrArrayImpl sead__ptrarrayimpl9D8; + void *qword9E8; + int mCurWorldID; + void *qword9F8; + void *qwordA00; + u16 wordA08; + bool byteA0A; + void *qwordA10; + void *qwordA18; + int dwordA20; + int dwordA24; + int dwordA28; + bool byteA2C; + ChangeStageInfo *mChangeStageInfo; + ChangeStageInfo *mChangeStageInfo2; + void *qwordA40; + void *qwordA48; + void *qwordA50; + void *qwordA58; + ShopTalkData *mShopTalkData; + void *qwordA68; + bool byteA70; + char gapA71[3]; + void *qwordA74; + void *qwordA7C; + int dwordA84; + bool byteA88; + char gapA89[3]; + void *qwordA8C; + int dwordA94; + bool byteA98; + char gapA99[3]; + void *qwordA9C; + int dwordAA4; + bool byteAA8; + char gapAA9[3]; + void *qwordAAC; + int dwordAB4; + bool byteAB8; + char gapAB9[3]; + void *qwordABC; + int dwordAC4; + bool byteAC8; + char gapAC9[3]; + void *qwordACC; + int dwordAD4; + bool byteAD8; + char gapAD9[3]; + void *qwordADC; + int dwordAE4; + bool byteAE8; + char gapAE9[3]; + void *qwordAEC; + int dwordAF4; + bool byteAF8; + char gapAF9[3]; + void *qwordAFC; + int dwordB04; + bool byteB08; + char gapB09[3]; + void *qwordB0C; + int dwordB14; + bool byteB18; + char gapB19[3]; + void *qwordB1C; + int dwordB24; + bool byteB28; + char gapB29[7]; + void *qwordB30; + bool byteB38; + char gapB39[7]; + void *qwordB40; + int dwordB48; + char gapB4C[4]; + void *qwordB50; + int dwordB58; + int dwordB5C; + int dwordB60; + u16 wordB64; }; \ No newline at end of file diff --git a/include/game/GameData/GameDataFunction.h b/include/game/GameData/GameDataFunction.h index 3641870..bd9a987 100644 --- a/include/game/GameData/GameDataFunction.h +++ b/include/game/GameData/GameDataFunction.h @@ -138,4 +138,18 @@ public: // subtracts the supplied int value from the current coin count static void subCoin(GameDataHolderWriter, int value); + static bool isUnlockedWorld(GameDataHolderAccessor, int); + + static bool isUnlockedNextWorld(GameDataHolderAccessor); + + static bool isUnlockedAllWorld(GameDataHolderAccessor); + + static bool isUnlockedCurrentWorld(GameDataHolderAccessor); + + static bool isUnlockWorld(int); + + static bool isUnlockFirstForest(void); + + static bool isUnlockFirstSea(void); + }; \ No newline at end of file diff --git a/include/game/HakoniwaSequence/HakoniwaSequence.h b/include/game/HakoniwaSequence/HakoniwaSequence.h index fe673cc..2e4b056 100644 --- a/include/game/HakoniwaSequence/HakoniwaSequence.h +++ b/include/game/HakoniwaSequence/HakoniwaSequence.h @@ -70,32 +70,6 @@ class HakoniwaSequence : public al::Sequence { HakoniwaStateBootLoadData *mBootLoadData; // 0xE8 HakoniwaStateDeleteScene *mDeleteScene; // 0xF0 al::LayoutKit* mLytKit; // 0xF8 - - // al::initSceneCreator(al::IUseSceneCreator *,al::SequenceInitInfo const&,al::GameDataHolderBase *,al::AudioDirector *,al::ScreenCaptureExecutor *,alSceneFunction::SceneFactory *) .text 00000000009F2270 0000007C 00000050 FFFFFFFFFFFFFFF8 R . . . B . . - - - // undefined * * field_0x0; - // undefined padding_120[0x120]; - // al::Scene * curScene; - // undefined padding_8[0x8]; - // al::AudioDirector * field_0x90; - // undefined padding_24[0x24]; - // StageScene * stageScene; - // GameDataHolderAccessor *gameDataHolder; - // undefined padding_024[0x24]; - // HakoniwaStateDemoWorldWarp * stateDemoWorldWarp; - // undefined padding_192[0x192]; - // int nextScenarioNo; - // undefined padding_12[0x12]; - // al::WipeHolder * field_0x1b0; - // undefined padding_0024[0x24]; - // long * field_0x1d0; - // undefined padding_48[0x48]; - // WorldResourceLoader * worldResourceLoader; - // undefined padding_0x16[0x16]; - // undefined * field_0x220; - // undefined padding_0x144[0x144]; - // undefined * field_0x2b8; - // undefined padding_0x160[0x160]; - // undefined8 field_0x360; + unsigned char padding_168[0x108]; + WorldResourceLoader* mResourceLoader; // 0x208 }; \ No newline at end of file diff --git a/include/game/Interfaces/IUsePlayerHack.h b/include/game/Interfaces/IUsePlayerHack.h index 5ecaa73..91597f3 100644 --- a/include/game/Interfaces/IUsePlayerHack.h +++ b/include/game/Interfaces/IUsePlayerHack.h @@ -6,5 +6,6 @@ */ class IUsePlayerHack { - +public: + virtual struct PlayerHackKeeper *getPlayerHackKeeper() const = 0; }; \ No newline at end of file diff --git a/include/game/Layouts/CommonVerticalList.h b/include/game/Layouts/CommonVerticalList.h index 0035603..20c1de9 100644 --- a/include/game/Layouts/CommonVerticalList.h +++ b/include/game/Layouts/CommonVerticalList.h @@ -6,7 +6,10 @@ #include "prim/seadSafeString.h" struct RollPartsData { - + int mRollMsgCount = 0; // 0x0 + const char16_t **mRollMsgList; // 0x8 + int unkInt1 = 0; // 0x10 + bool mUnkBool = false; // 0x14 }; class CommonVerticalList : public al::NerveExecutor { @@ -75,14 +78,14 @@ public: void *unkPtr3; // 0x50 sead::Vector2f mCursorPos; // 0x58 void *unkPtr4; // 0x60 - void *unkPtr5; // 0x68 + int unkInt1; // 0x68 sead::WFixedSafeString<0x200> **mStringDataArr; // 0x70 sead::FixedSafeString<0x90> **mPaneNameList; // 0x78 void *unkPtr8; // 0x80 void *unkPtr9; // 0x88 const bool *mIsEnableData; // 0x90 int mStringDataCount; // 0x98 - int unkInt2; // 0x9C + int mDataCount; // 0x9C void *unkPtr12; // 0xA0 void *unkPtr13; // 0xA8 void *unkPtr14; // 0xB0 diff --git a/include/game/Player/HackCap.h b/include/game/Player/HackCap.h index eb7fa57..eccc2d5 100644 --- a/include/game/Player/HackCap.h +++ b/include/game/Player/HackCap.h @@ -14,9 +14,9 @@ #include "HackCapThrowParam.h" #include "HackCap/HackCapJointControlKeeper.h" +#include "HackCap/PlayerCapActionHistory.h" class PlayerWallActionHistory; -class PlayerCapActionHistory; class PlayerEyeSensorHitHolder; class IUsePlayerHeightCheck; class PlayerWetControl; @@ -201,6 +201,9 @@ class HackCap : public al::LiveActor { al::LiveActor *mCapEyes; // 0x120 PlayerActorHakoniwa *mPlayerActor; // 0x128 unsigned char padding_220[0x220-0x130]; - HackCapThrowParam throwParam; // 0x220 + HackCapThrowParam *throwParam; // 0x220 + unsigned char padding_2B8[0x2B8-0x228]; + PlayerCapActionHistory *mCapActionHistory; // 0x2B8 + unsigned char padding_2E0[0x2E0-0x2C0]; HackCapJointControlKeeper *mJointKeeper; // 0x2E0 }; \ No newline at end of file diff --git a/include/game/Player/HackCap/PlayerCapActionHistory.h b/include/game/Player/HackCap/PlayerCapActionHistory.h new file mode 100644 index 0000000..979bd66 --- /dev/null +++ b/include/game/Player/HackCap/PlayerCapActionHistory.h @@ -0,0 +1,29 @@ +#pragma once + +#include "al/LiveActor/LiveActor.h" +#include "game/Interfaces/IUsePlayerCollision.h" +#include "game/Player/PlayerConst.h" +#include "math/seadVector.h" + +class PlayerCapActionHistory { +public: + PlayerCapActionHistory(al::LiveActor const*,PlayerConst const*,struct PlayerTrigger const*,IUsePlayerCollision const*); + void update(void); + void clearLandLimit(void); + void clearLimitHeight(void); + void clearCapJump(void); + void clearLandLimitStandAngle(void); + void clearWallAirLimit(void); + void recordLimitHeight(void); + bool isOverLimitHeight(void) const; + + al::LiveActor* mHostActor; // 0x0 + PlayerConst* mPlayerConst; // 0x8 + PlayerTrigger* mPlayerTrigger; // 0x10 + IUsePlayerCollision* mCollider; // 0x18 + struct PlayerCounterAfterCapCatch* mCapCatchCounter; // 0x20 + bool mIsCapBounced = false; // 0x28 + sead::Vector3f mUnkVec = sead::Vector3f::zero; // 0x2C + bool mIsCapJumpReady = true; // 0x38 + bool mIsLimited = true; // 0x39 (unsure what this actually is called) +}; \ No newline at end of file diff --git a/include/game/Player/PlayerActorBase.h b/include/game/Player/PlayerActorBase.h index 01f0baf..b26ce2c 100644 --- a/include/game/Player/PlayerActorBase.h +++ b/include/game/Player/PlayerActorBase.h @@ -7,11 +7,61 @@ #include "PlayerHackKeeper.h" #include "al/LiveActor/LiveActor.h" +#include "game/Interfaces/IUsePlayerCollision.h" #include "game/Interfaces/IUsePlayerHack.h" +#include "game/Player/PlayerCollider.h" +#include "game/Player/PlayerInfo.h" +#include "game/Player/PlayerInitInfo.h" +#include "game/Player/PlayerPuppet.h" -class PlayerActorBase : public al::LiveActor , public IUsePlayerHack { +class PlayerActorBase : public al::LiveActor, public IUsePlayerHack { public: - PlayerHackKeeper *getPlayerHackKeeper() const; - void movement(void); - int getPortNo(); + PlayerActorBase(char const*); + + virtual void movement(void) override; + virtual void init(al::ActorInitInfo const&) override; + virtual void initPlayer(al::ActorInitInfo const&, PlayerInitInfo const&); + virtual int getPortNo(void); + virtual sead::Matrix34f *getViewMtx(void) const; + virtual IUsePlayerCollision* getPlayerCollision(void) const; + + virtual bool isEnableDemo(void); + virtual void startDemo(void); + virtual void endDemo(void); + + virtual void startDemoPuppetable(void); + virtual void endDemoPuppetable(void); + + virtual void startDemoShineGet(void); + virtual void endDemoShineGet(void); + + virtual void startDemoMainShineGet(void); + virtual void endDemoMainShineGet(void); + + virtual void startDemoHack(void); + virtual void endDemoHack(void); + + virtual void startDemoKeepBind(void); + virtual void noticeDemoKeepBindExecute(void); + virtual void endDemoKeepBind(void); + + virtual void startDemoKeepCarry(void); + virtual void endDemoKeepCarry(void); + + virtual void getDemoActor(void); + virtual void getDemoAnimator(void); + + virtual bool isDamageStopDemo(void) const; + + virtual PlayerPuppet *getPlayerPuppet(void); + virtual PlayerInfo *getPlayerInfo(void) const; + + virtual bool checkDeathArea(void); + virtual void sendCollisionMsg(void); + + virtual bool receivePushMsg(al::SensorMsg const*,al::HitSensor *,al::HitSensor *,float); + virtual PlayerHackKeeper* getPlayerHackKeeper() const override; + + sead::Matrix34f* mViewMtx; // 0x110 + int mPortNo; // 0x118 }; \ No newline at end of file diff --git a/include/game/Player/PlayerActorHakoniwa.h b/include/game/Player/PlayerActorHakoniwa.h index 02458ae..54dd75d 100644 --- a/include/game/Player/PlayerActorHakoniwa.h +++ b/include/game/Player/PlayerActorHakoniwa.h @@ -25,7 +25,9 @@ #include "Attacks/PlayerSpinCapAttack.h" -#define PACTORSIZE 0xC8 +namespace al { +class WaterSurfaceFinder; +} class PlayerActorHakoniwa : public PlayerActorBase , public IUseDimension { public: @@ -36,11 +38,10 @@ class PlayerActorHakoniwa : public PlayerActorBase , public IUseDimension { void startPlayerPuppet(void); void initPlayer(al::ActorInitInfo const&, PlayerInitInfo const&); - unsigned char padding[0x18]; // 0x108 PlayerInfo *mPlayerInfo; // 0x128 PlayerConst *mPlayerConst; // 0x130 PlayerInput *mPlayerInput; //0x138 - unsigned char padding_148[0x8]; // PlayerTrigger + PlayerTrigger *mPlayerTrigger; // 0x140 HackCap *mHackCap; // 0x148 ActorDimensionKeeper *mDimKeeper; // 0x150 PlayerModelKeeper *mPlayerModelKeeper; // 0x158 @@ -48,27 +49,117 @@ class PlayerActorHakoniwa : public PlayerActorBase , public IUseDimension { PlayerAnimator *mPlayerAnimator; // 0x168 PlayerColliderHakoniwa *mPlayerCollider; // 0x170 PlayerPuppet *mPlayerPuppet; // 0x178 - // 0x180 PlayerAreaChecker - // 0x188 WaterSurfaceFinder - // 0x190 unk - // 0x198 unk - // 0x1A0 unk - // 0x1A8 unk - // 0x1B0 unk - // 0x1B8 unk - // 0x1C0 unk - // 0x1C8 unk - // 0x1D0 unk - // 0x1D8 unk - // 0x1E0 unk - // 0x1E8 unk - // 0x1F0 unk - // 0x1F8 PlayerBindKeeper - unsigned char padding_208[0x208 - 0x180]; + PlayerAreaChecker *mAreaChecker; // 0x180 + al::WaterSurfaceFinder *mWaterSurfaceFinder; // 0x188 + PlayerOxygen* mPlayerOxygen; // 0x190 + PlayerDamageKeeper* mPlayerDamageKeeper; // 0x198 + PlayerDemoActionFlag* mPlayerDemoActionFlag; // 0x1A0 + PlayerCapActionHistory* mPlayerCapActionHistory; // 0x1A8 + PlayerCapManHeroEyesControl* mPlayerCapManHeroEyesControl; // 0x1B0 + struct PlayerContinuousJump* mPlayerContinuousJump; // 0x1B8 + struct PlayerContinuousLongJump* mPlayerContinuousLongJump; // 0x1C0 + struct PlayerCounterAfterUpperPunch* mPlayerCounterAfterUpperPunch; // 0x1C8 + struct PlayerCounterForceRun* mPlayerCounterForceRun; // 0x1D0 + PlayerCounterIceWater* mPlayerCounterIceWater; // 0x1D8 + struct PlayerCounterQuickTurnJump* mPlayerCounterQuickTurnJump; // 0x1E0 + PlayerWallActionHistory* mPlayerWallActionHistory; // 0x1E8 + PlayerBindKeeper* mPlayerBindKeeper; // 0x1F0 + PlayerCarryKeeper* mPlayerCarryKeeper; // 0x1F8 + PlayerEquipmentUser* mPlayerEquipmentUser; // 0x200 PlayerHackKeeper *mHackKeeper; // 0x208 PlayerFormSensorCollisionArranger *mCollArranger; // 0x210 - void *unkPtr2; // 0x218 - void *unkPtr3; // 0x220 - PlayerSpinCapAttack *mSpinCapAttack; // 0x228 - + struct PlayerJumpMessageRequest* mPlayerJumpMessageRequest; // 0x218 + struct PlayerSandSinkAffect* mPlayerSandSinkAffect; // 0x220 + PlayerSpinCapAttack* mSpinCapAttack; // 0x228 + struct PlayerActionDiveInWater* mPlayerActionDiveInWater; + struct PlayerEffect* mPlayerEffect; + PlayerEyeSensorHitHolder* mPlayerEyeSensorHitHolder; + struct PlayerPushReceiver* mPlayerPushReceiver; + struct PlayerHitPush* mPlayerHitPush; + struct PlayerExternalVelocity* mPlayerExternalVelocity; + PlayerJointControlKeeper* mPlayerJointControlKeeper; + PlayerPainPartsKeeper* mPlayerPainPartsKeeper; + PlayerRecoverySafetyPoint* mPlayerRecoverySafetyPoint; + struct PlayerRippleGenerator* mPlayerRippleGenerator; + PlayerSeparateCapFlag* mPlayerSeparateCapFlag; + PlayerWetControl* mPlayerWetControl; + PlayerStainControl* mPlayerStainControl; + al::FootPrintHolder* mFootPrintHolder; + struct GaugeAir* mGaugeAir; + struct WaterSurfaceShadow* mWaterSurfaceShadow; + WorldEndBorderKeeper* mWorldEndBorderKeeper; + void* gap; + struct PlayerSeCtrl* mPlayerSeCtrl; + al::HitSensor* mBodyHitSensor; + bool mIsLongShadow; + struct PlayerStateWait* mPlayerStateWait; + struct PlayerStateSquat* mPlayerStateSquat; + struct PlayerStateRunHakoniwa2D3D* mPlayerStateRunHakoniwa2D3D; + struct PlayerStateSlope* mPlayerStateSlope; + struct PlayerStateRolling* mPlayerStateRolling; + struct PlayerStateSpinCap* mPlayerStateSpinCap; + struct PlayerStateJump* mPlayerStateJump; + struct PlayerStateCapCatchPop* mPlayerStateCapCatchPop; + struct PlayerStateWallAir* mPlayerStateWallAir; + struct PlayerStateWallCatch* mPlayerStateWallCatch; + struct PlayerStateGrabCeil* mPlayerStateGrabCeil; + struct PlayerStatePoleClimb* mPlayerStatePoleClimb; + struct PlayerStateHipDrop* mPlayerStateHipDrop; + struct PlayerStateHeadSliding* mPlayerStateHeadSliding; + struct PlayerStateLongJump* mPlayerStateLongJump; + struct PlayerStateFallHakoniwa* mPlayerStateFallHakoniwa; + struct PlayerStateSandSink* mPlayerStateSandSink; + struct ActorStateSandGeyser* mActorStateSandGeyser; + struct PlayerStateRise* mPlayerStateRise; + struct PlayerStateSwim* mPlayerStateSwim; + struct PlayerStateDamageLife* mPlayerStateDamageLife; + struct PlayerStateDamageSwim* mPlayerStateDamageSwim; + struct PlayerStateDamageFire* mPlayerStateDamageFire; + struct PlayerStatePress* mPlayerStatePress; + struct PlayerStateBind* mPlayerStateBind; + struct PlayerStateHack* mPlayerStateHack; + struct PlayerStateEndHack* mPlayerStateEndHack; + struct PlayerStateCameraSubjective* mPlayerStateCameraSubjective; + struct PlayerStateAbyss* mPlayerStateAbyss; + struct PlayerJudgeAirForceCount* mPlayerJudgeAirForceCount; + struct PlayerJudgeCameraSubjective* mPlayerJudgeCameraSubjective; + struct PlayerJudgeCapCatchPop* mPlayerJudgeCapCatchPop; + struct PlayerJudgeDeadWipeStart* mPlayerJudgeDeadWipeStart; + struct PlayerJudgeDirectRolling* mPlayerJudgeDirectRolling; + struct PlayerJudgeEnableStandUp* mPlayerJudgeEnableStandUp; + struct PlayerJudgeForceLand* mPlayerJudgeForceLand; + struct PlayerJudgeForceSlopeSlide* mPlayerJudgeForceSlopeSlide; + struct PlayerJudgeForceRolling* mPlayerJudgeForceRolling; + struct PlayerJudgeGrabCeil* mPlayerJudgeGrabCeil; + struct PlayerJudgeInWater* mPlayerJudgeInWater1; + struct PlayerJudgeInWater* mPlayerJudgeInWater2; + struct PlayerJudgeInWater* mPlayerJudgeInWater3; + struct PlayerJudgeInWater* mPlayerJudgeInWater4; + struct PlayerJudgeInvalidateInputFall* mPlayerJudgeInvalidateInputFall; + struct PlayerJudgeLongFall* mPlayerJudgeLongFall; + struct PlayerJudgeOutInWater* mPlayerJudgeOutInWater; + struct PlayerJudgeRecoveryLifeFast* mPlayerJudgeRecoveryLifeFast; + struct PlayerJudgeSandSink* mPlayerJudgeSandSink; + struct PlayerJudgeSpeedCheckFall* mPlayerJudgeSpeedCheckFall; + struct PlayerJudgeStartHipDrop* mPlayerJudgeStartHipDrop; + struct PlayerJudgeStartRise* mPlayerJudgeStartRise; + struct PlayerJudgeStartRolling* mPlayerJudgeStartRolling; + struct PlayerJudgeStartRun* mPlayerJudgeStartRun; + struct PlayerJudgeStartSquat* mPlayerJudgeStartSquat; + struct PlayerJudgeStartWaterSurfaceRun* mPlayerJudgeStartWaterSurfaceRun; + struct PlayerJudgeSlopeSlide* mPlayerJudgeSlopeSlide; + struct PlayerJudgePoleClimb* mPlayerJudgePoleClimb; + struct PlayerJudgePreInputJump* mPlayerJudgePreInputJump; + struct PlayerJudgePreInputCapThrow* mPlayerJudgePreInputCapThrow; + struct PlayerJudgePreInputHackAction* mPlayerJudgePreInputHackAction; + struct HackCapJudgePreInputHoveringJump* mHackCapJudgePreInputHoveringJump; + struct HackCapJudgePreInputSeparateThrow* mHackCapJudgePreInputSeparateThrow; + struct HackCapJudgePreInputSeparateJump* mHackCapJudgePreInputSeparateJump; + struct PlayerJudgeWallCatch* mPlayerJudgeWallCatch; + struct PlayerJudgeWallCatchInputDir* mPlayerJudgeWallCatchInputDir; + struct PlayerJudgeWallHitDown* mPlayerJudgeWallHitDown; + struct PlayerJudgeWallHitDownForceRun* mPlayerJudgeWallHitDownForceRun; + struct PlayerJudgeWallHitDownRolling* mPlayerJudgeWallHitDownRolling; + struct PlayerJudgeWallKeep* mPlayerJudgeWallKeep; + void* gap_2; }; \ No newline at end of file diff --git a/include/game/Player/PlayerInfo.h b/include/game/Player/PlayerInfo.h index 444e318..5dbcbd2 100644 --- a/include/game/Player/PlayerInfo.h +++ b/include/game/Player/PlayerInfo.h @@ -9,6 +9,10 @@ #include "PlayerCostumeInfo.h" #include "PlayerModelChangerHakoniwa.h" +namespace al { +struct FootPrintHolder; +} + class PlayerInfo { public: PlayerInfo(); @@ -26,7 +30,7 @@ class PlayerInfo { struct PlayerJointControlKeeper *pJoinControlKeeper; // 0x50 struct PlayerCounterIceWater *pCounterIceWater; // 0x58 struct PlayerStainControl *pStainControl; // 0x60 - struct FootPrintHolder *mFootPrintHolder; // 0x68 + al::FootPrintHolder *mFootPrintHolder; // 0x68 al::HitSensor *mHitSensor; // 0x70 struct PlayerFormSensorCollisionArranger *pSensorCollArranger; // 0x78 PlayerInput *pInput; // 0x80 diff --git a/include/game/Sequence/SequenceFactory.h b/include/game/Sequence/SequenceFactory.h new file mode 100644 index 0000000..f5c414e --- /dev/null +++ b/include/game/Sequence/SequenceFactory.h @@ -0,0 +1,6 @@ +#pragma once + +class SequenceFactory { +public: + static void createSequence(const char *); +}; \ No newline at end of file diff --git a/include/game/StageScene/StageScene.h b/include/game/StageScene/StageScene.h index 684d4b7..c3ed20e 100644 --- a/include/game/StageScene/StageScene.h +++ b/include/game/StageScene/StageScene.h @@ -4,22 +4,113 @@ #include "game/StageScene/StageSceneLayout.h" #include "game/StageScene/StageSceneStatePauseMenu.h" -#define INHERITSIZE sizeof(al::Scene) +namespace al { +struct LayoutTextureRenderer; +struct SimpleAudioUser; +struct ParabolicPath; +struct DemoSyncedEventKeeper; +struct ChromakeyDrawer; +struct WipeHolder; +} class StageScene : public al::Scene { public: bool isPause() const; - // 0x88 StageResourceKeeper * - // 0x90 LiveActorKit * - // 0x98 LayoutKit * - // 0xA0 SceneObjHolder * - // 0xA8 SceneStopCtrl * - unsigned char padding_180[0x180 - INHERITSIZE]; - StageSceneStatePauseMenu *mStatePauseMenu; // 0x180 - unsigned char padding_2D0[0x148]; - GameDataHolderAccessor mHolder; // 0x2D0 - unsigned char padding_2F8[0x20]; - StageSceneLayout *stageSceneLayout; // 0x2F8 + sead::FixedSafeString<0x40> mStageName; + int field_130; + struct StageSceneStateWorldMap *field_138; + struct StageSceneStateShop *field_140; + struct StageSceneStateSnapShot *field_148; + struct StageSceneStateGetShine *field_150; + struct StageSceneStateGetShineMain *field_158; + struct StageSceneStateGetShineGrand *field_160; + struct StageSceneStateCollectBgm *field_168; + struct StageSceneStateCollectionList *field_170; + struct StageSceneStateMiniGameRanking *field_178; + struct StageSceneStatePauseMenu *field_180; + struct StageSceneStateCloset *field_188; + struct StageSceneStateSkipDemo *field_190; + struct StageSceneStateCheckpointWarp *field_198; + struct StageSceneStateCarryMeat *field_1A0; + void *field_1A8; + void *field_1B0; + struct StageSceneStateMiss *field_1B8; + struct StageSceneStateYukimaruRace *field_1C0; + struct StageSceneStateYukimaruRaceTutorial *field_1C8; + struct StageSceneStateRaceManRace *field_1D0; + struct StageSceneStateRadicon *field_1D8; + struct StageSceneStateScenarioCamera *field_1E0; + struct StageSceneStateRecoverLife *field_1E8; + struct StageSceneStateGetShineMainSandWorld *field_1F0; + void *field_1F8; + struct StageSceneStateWarp *field_200; + void *field_208; + struct ScenarioStartCameraHolder *field_210; + sead::FixedSafeString<0x40> field_218; + sead::FixedSafeString<0x40> field_270; + void *qword2C8; + GameDataHolderAccessor mHolder; + void *qword2D8; + al::LayoutTextureRenderer *qword2E0; + struct PlayGuideSkip *qword2E8; + struct CinemaCaption *qword2F0; + StageSceneLayout *mSceneLayout; + char field_300; + char field_301; + al::SimpleLayoutAppearWaitEnd *char308; + al::SimpleLayoutAppearWaitEnd *field_310; + al::SimpleLayoutAppearWaitEnd *field_318; + struct ControllerGuideSnapShotCtrl *field_320; + InputSeparator *field_328; + al::WipeSimple *field_330; + al::WipeHolder *field_338; + void *field_340; + al::WindowConfirm *field_348; + struct MiniGameMenu *field_350; + bool field_358; + char gap359[15]; + char char368; + struct MapLayout *field_370; + al::SimpleLayoutAppearWaitEnd *field_378; + al::LiveActorGroup *field_380; + void *field_388; + void *mKoopaLv1Actor; + struct TimeBalloonNpc *mTimeBalloonNpc; + struct ProjectItemDirector *field_3A0; + struct Pyramid *field_3A8; + void *field_3B0; + al::Nerve *field_3B8; + SceneAudioSystemPauseController *field_3C0; + struct DemoSoundSynchronizer *mDemoSoundSynchronizer; + al::SimpleAudioUser *mStageStartAtmosSe; + al::SimpleAudioUser *mSePlayArea; + al::SimpleAudioUser *mSnapShotCameraCtrlAudio; + struct ProjectSeNamedList *field_3E8; + void *field_3F0; + struct TimeBalloonDirector *mTimeBalloonDirector; + struct TimeBalloonSequenceInfo *mTimeBalloonSequenceInfo; + void *qword408; + void *qword410; + sead::Vector3f qword418; + sead::Vector3f qword424; + void *qword430; + int dword438; + const al::LiveActor *field_440; + al::ParabolicPath *field_448; + al::LiveActor *field_450; + void *qword458; + int dword460; + struct CollectBgmPlayer *qword468; + struct CollectBgmRegister *qword470; + struct BgmAnimeSyncDirector *qword478; + al::DemoSyncedEventKeeper *field_480; + void *field_488; + int field_490; + struct NpcEventDirector *qword498; + al::ChromakeyDrawer *field_4A0; + void *qword4A8; + ProjectNfpDirector *qword4B0; + void *qword4B8; }; diff --git a/include/game/StageScene/StageSceneStateOption.h b/include/game/StageScene/StageSceneStateOption.h index fcf88ef..bdc69ad 100644 --- a/include/game/StageScene/StageSceneStateOption.h +++ b/include/game/StageScene/StageSceneStateOption.h @@ -125,4 +125,6 @@ class StageSceneStateOption : public al::HostStateBase, public al::IU bool field_0x180; al::MessageSystem *mMsgSystem; InputSeparator *mInputSeperator; -}; \ No newline at end of file +}; + +static_assert(sizeof(StageSceneStateOption) == 0x198, "StageSceneStateOption Size"); \ No newline at end of file diff --git a/include/main.hpp b/include/main.hpp index 548f2f7..b288d12 100644 --- a/include/main.hpp +++ b/include/main.hpp @@ -55,6 +55,12 @@ static bool isInGame = false; static bool debugMode = false; +static bool isSmallMode = true; + +static float scale = 0.3f; + +extern float camDist; + constexpr const char* captureNames[] = { "AnagramAlphabetCharacter", "Byugo", "Bubble", "Bull", "Car", "ElectricWire", "KillerLauncherMagnum", "KuriboPossessed", diff --git a/include/packets/Packet.h b/include/packets/Packet.h index f536331..400ee46 100644 --- a/include/packets/Packet.h +++ b/include/packets/Packet.h @@ -25,7 +25,8 @@ enum PacketType : short { SHINECOLL, CAPTUREINF, CHANGESTAGE, - CMD + CMD, + End // end of enum for bounds checking }; // attribute otherwise the build log is spammed with unused warnings diff --git a/include/rs/util.hpp b/include/rs/util.hpp index 6da13c9..11f6ad2 100644 --- a/include/rs/util.hpp +++ b/include/rs/util.hpp @@ -2,6 +2,7 @@ #include "game/GameData/GameDataFile.h" #include "game/Info/QuestInfoHolder.h" +#include "game/Player/PlayerActorBase.h" #include "sead/math/seadVector.h" #include "al/util.hpp" #include "al/sensor/SensorMsg.h" @@ -33,7 +34,7 @@ namespace rs { bool isPlayerDamageStopDemo(const al::LiveActor *); - PlayerActorHakoniwa * getPlayerActor(const al::Scene *); + PlayerActorBase * getPlayerActor(const al::Scene *); void get2DAreaPos(sead::Vector3 *, al::AreaObj const *); @@ -75,5 +76,9 @@ namespace rs { void calcGroundNormalOrGravityDir(sead::Vector3f *result, al::LiveActor const *actor, IUsePlayerCollision const *col); - void calcPlayerFrontDir(sead::Vector3f *result, al::LiveActor const *); + void calcPlayerFrontDir(sead::Vector3f* result, al::LiveActor const*); + + int getStageShineAnimFrame(al::LiveActor const*, char const*); + const char* getStageShineArchiveName(al::LiveActor const*, char const*); + const char* getStageShineEmptyArchiveName(al::LiveActor const*, char const*); } diff --git a/include/server/Client.hpp b/include/server/Client.hpp index 7682263..b20c062 100644 --- a/include/server/Client.hpp +++ b/include/server/Client.hpp @@ -99,7 +99,7 @@ class Client { static void initMode(GameModeInitInfo const &initInfo); static void sendHackCapInfPacket(const HackCap *hackCap); - static void sendPlayerInfPacket(const PlayerActorHakoniwa *player); + static void sendPlayerInfPacket(const PlayerActorBase *player, bool isYukimaru); static void sendGameInfPacket(const PlayerActorHakoniwa *player, GameDataHolderAccessor holder); static void sendGameInfPacket(GameDataHolderAccessor holder); static void sendCostumeInfPacket(const char *body, const char *cap); diff --git a/patches/codehook.slpatch b/patches/codehook.slpatch index 0a67d8c..992672f 100644 --- a/patches/codehook.slpatch +++ b/patches/codehook.slpatch @@ -29,6 +29,7 @@ B59E28 B seadPrintHook // sead::system::print 1B3F0C NOP // disables call to open HTML viewer during first time odyssey flight 1F2A2C MOV W0, #1 // patches checkpoint system to always allow warping +216FAC MOV W0, #0 // disables AppearSwitchTimer's camera switch // Puppet Actor Setup 4B5E30 B ProjectActorFactory // patches actor factory ctor with custom matching factory @@ -110,4 +111,5 @@ B59E28 B seadPrintHook // sead::system::print 4C9080 BL createTicketHook // hook to the init of a stage to create custom gravity camera ticket 5C00B0 BL borderPullBackHook // hooks over isFirstStep in WorldEndBorderKeeper::exePullBack so we can kill the player if they reach the border of the map - \ No newline at end of file + +// 4E46BC NOP // removes call to setEnableData for one of the commonverticallists in the options menu, which makes all entries in the menu look the same \ No newline at end of file diff --git a/source/layouts/HideAndSeekIcon.cpp b/source/layouts/HideAndSeekIcon.cpp index 7b8b579..bf44212 100644 --- a/source/layouts/HideAndSeekIcon.cpp +++ b/source/layouts/HideAndSeekIcon.cpp @@ -80,7 +80,7 @@ void HideAndSeekIcon::exeWait() { - int playerCount = Client::getConnectCount(); + int playerCount = Client::getMaxPlayerCount(); if (playerCount > 0) { @@ -91,7 +91,7 @@ void HideAndSeekIcon::exeWait() { for (size_t i = 0; i < playerCount; i++) { PuppetInfo* curPuppet = Client::getPuppetInfo(i); - if (curPuppet->isConnected && (curPuppet->isIt == mInfo->mIsPlayerIt)) { + if (curPuppet && curPuppet->isConnected && (curPuppet->isIt == mInfo->mIsPlayerIt)) { playerList.appendWithFormat("%s\n", curPuppet->puppetName); } } diff --git a/source/main.cpp b/source/main.cpp index 74b9010..5076130 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,6 +1,10 @@ #include "main.hpp" #include #include +#include "game/Player/PlayerActorBase.h" +#include "game/Player/PlayerActorHakoniwa.h" +#include "game/Player/PlayerHackKeeper.h" +#include "math/seadVector.h" #include "server/Client.hpp" #include "puppets/PuppetInfo.h" #include "actors/PuppetActor.h" @@ -26,20 +30,29 @@ static int pInfSendTimer = 0; static int gameInfSendTimer = 0; -void updatePlayerInfo(GameDataHolderAccessor holder, PlayerActorHakoniwa *p1) { - if(pInfSendTimer >= 3) { - Client::sendPlayerInfPacket(p1); +void updatePlayerInfo(GameDataHolderAccessor holder, PlayerActorBase* playerBase, bool isYukimaru) { + + if (pInfSendTimer >= 3) { - Client::sendHackCapInfPacket(p1->mHackCap); + Client::sendPlayerInfPacket(playerBase, isYukimaru); - Client::sendCaptureInfPacket(p1); + if (!isYukimaru) { + Client::sendHackCapInfPacket(((PlayerActorHakoniwa*)playerBase)->mHackCap); + + Client::sendCaptureInfPacket((PlayerActorHakoniwa*)playerBase); + } pInfSendTimer = 0; } if (gameInfSendTimer >= 60) { - Client::sendGameInfPacket(p1, holder); + if (isYukimaru) { + Client::sendGameInfPacket(holder); + } else { + Client::sendGameInfPacket((PlayerActorHakoniwa*)playerBase, holder); + } + gameInfSendTimer = 0; } @@ -100,7 +113,7 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead: sead::LookAtCamera *cam = al::getLookAtCamera(curScene, 0); sead::Projection* projection = al::getProjectionSead(curScene, 0); - PlayerActorHakoniwa* p1 = rs::getPlayerActor(curScene); + PlayerActorBase* playerBase = rs::getPlayerActor(curScene); PuppetActor* curPuppet = Client::getPuppet(debugPuppetIndex); @@ -174,16 +187,19 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead: break; case 2: { - al::PlayerHolder *pHolder = al::getScenePlayerHolder(curScene); - PlayerActorHakoniwa *p1 = pHolder->tryGetPlayer(0); + PlayerHackKeeper* hackKeeper = playerBase->getPlayerHackKeeper(); - if (p1->mHackKeeper && p1->mHackKeeper->currentHackActor) { + if (hackKeeper) { - al::LiveActor *curHack = p1->mHackKeeper->currentHackActor; + PlayerActorHakoniwa *p1 = (PlayerActorHakoniwa*)playerBase; // its safe to assume that we're using a playeractorhakoniwa if the hack keeper isnt null + + if(hackKeeper->currentHackActor) { + + al::LiveActor *curHack = hackKeeper->currentHackActor; gTextWriter->printf("Current Hack Animation: %s\n", al::getActionName(curHack)); gTextWriter->printf("Current Hack Name: %s\n", - p1->mHackKeeper->getCurrentHackName()); + hackKeeper->getCurrentHackName()); sead::Quatf captureRot = curHack->mPoseKeeper->getQuat(); gTextWriter->printf("Current Hack Rot: %f %f %f %f\n", captureRot.x, captureRot.y, captureRot.z, captureRot.w); @@ -191,7 +207,7 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead: al::calcQuat(&calcRot, curHack); gTextWriter->printf("Calc Hack Rot: %f %f %f %f\n", calcRot.x, calcRot.y, calcRot.z, calcRot.w); - }else { + } else { gTextWriter->printf("Cur Action: %s\n", p1->mPlayerAnimator->mAnimFrameCtrl->getActionName()); gTextWriter->printf("Cur Sub Action: %s\n", p1->mPlayerAnimator->curSubAnim.cstr()); gTextWriter->printf("Is Cappy Flying? %s\n", BTOC(p1->mHackCap->isFlying())); @@ -205,6 +221,8 @@ void drawMainHook(HakoniwaSequence *curSequence, sead::Viewport *viewport, sead: } } } + + } break; default: break; @@ -301,11 +319,13 @@ bool hakoniwaSequenceHook(HakoniwaSequence* sequence) { bool isFirstStep = al::isFirstStep(sequence); al::PlayerHolder *pHolder = al::getScenePlayerHolder(stageScene); - PlayerActorHakoniwa* p1 = (PlayerActorHakoniwa*)al::tryGetPlayerActor(pHolder, 0); + PlayerActorBase* playerBase = al::tryGetPlayerActor(pHolder, 0); if (isFirstStep) { Client::tryRestartCurrentMode(); } + + bool isYukimaru = !playerBase->getPlayerInfo(); isInGame = !stageScene->isPause(); @@ -318,7 +338,7 @@ bool hakoniwaSequenceHook(HakoniwaSequence* sequence) { Client::updateShines(); } - updatePlayerInfo(stageScene->mHolder, p1); + updatePlayerInfo(stageScene->mHolder, playerBase, isYukimaru); static bool isDisableMusic = false; @@ -348,17 +368,26 @@ bool hakoniwaSequenceHook(HakoniwaSequence* sequence) { if (al::isPadTriggerLeft(-1)) Client::toggleCurrentMode(); if (al::isPadTriggerRight(-1)) { if (debugMode) { - PuppetInfo *debugPuppet = Client::getDebugPuppetInfo(); + + PuppetInfo* debugPuppet = Client::getDebugPuppetInfo(); + if (debugPuppet) { - debugPuppet->playerPos = al::getTrans(p1); - al::calcQuat(&debugPuppet->playerRot, p1); - const char *hackName = p1->mHackKeeper->getCurrentHackName(); - debugPuppet->isCaptured = hackName != nullptr; - if (debugPuppet->isCaptured) { - strcpy(debugPuppet->curHack, hackName); - } else { - strcpy(debugPuppet->curHack, ""); + + debugPuppet->playerPos = al::getTrans(playerBase); + al::calcQuat(&debugPuppet->playerRot, playerBase); + + PlayerHackKeeper* hackKeeper = playerBase->getPlayerHackKeeper(); + + if (hackKeeper) { + const char *hackName = hackKeeper->getCurrentHackName(); + debugPuppet->isCaptured = hackName != nullptr; + if (debugPuppet->isCaptured) { + strcpy(debugPuppet->curHack, hackName); + } else { + strcpy(debugPuppet->curHack, ""); + } } + } } } diff --git a/source/server/Client.cpp b/source/server/Client.cpp index 6059bc1..e5d77f0 100644 --- a/source/server/Client.cpp +++ b/source/server/Client.cpp @@ -9,6 +9,7 @@ #include "game/GameData/GameDataFunction.h" #include "game/GameData/GameDataHolderAccessor.h" #include "game/Info/QuestInfo.h" +#include "game/Player/PlayerActorBase.h" #include "game/Player/PlayerActorHakoniwa.h" #include "game/SaveData/SaveDataAccessFunction.h" #include "game/StageScene/StageScene.h" @@ -203,12 +204,7 @@ void Client::restartConnection() { initPacket.mUserID = sInstance->mUserID; strcpy(initPacket.clientName, sInstance->mUsername.cstr()); - if (sInstance->isFirstConnect) { - initPacket.conType = ConnectionTypes::INIT; - sInstance->isFirstConnect = false; - } else { - initPacket.conType = ConnectionTypes::RECONNECT; - } + initPacket.conType = ConnectionTypes::INIT; sInstance->mSocket->SEND(&initPacket); @@ -541,14 +537,14 @@ void Client::recvFunc() {} * * @param player pointer to current player class, used to get translation, animation, and capture data */ -void Client::sendPlayerInfPacket(const PlayerActorHakoniwa *player) { +void Client::sendPlayerInfPacket(const PlayerActorBase *playerBase, bool isYukimaru) { if (!sInstance) { Logger::log("Static Instance is Null!\n"); return; } - if(!player) { + if(!playerBase) { Logger::log("Error: Null Player Reference\n"); return; } @@ -556,36 +552,56 @@ void Client::sendPlayerInfPacket(const PlayerActorHakoniwa *player) { PlayerInf packet = PlayerInf(); packet.mUserID = sInstance->mUserID; - packet.playerPos = al::getTrans(player); + packet.playerPos = al::getTrans(playerBase); - al::calcQuat(&packet.playerRot, player); // calculate rotation based off pose instead of using quat rotation + al::calcQuat(&packet.playerRot, + playerBase); // calculate rotation based off pose instead of using quat rotation - for (size_t i = 0; i < 6; i++) - { - packet.animBlendWeights[i] = player->mPlayerAnimator->getBlendWeight(i); - } + if (!isYukimaru) { + + PlayerActorHakoniwa* player = (PlayerActorHakoniwa*)playerBase; - const char *hackName = player->mHackKeeper->getCurrentHackName(); - - if (hackName != nullptr) { - - sInstance->isClientCaptured = true; - - const char* actName = al::getActionName(player->mHackKeeper->currentHackActor); - - if (actName) { - packet.actName = PlayerAnims::FindType(actName); - packet.subActName = PlayerAnims::Type::Unknown; - //strcpy(packet.actName, actName); - } else { - packet.actName = PlayerAnims::Type::Unknown; - packet.subActName = PlayerAnims::Type::Unknown; + for (size_t i = 0; i < 6; i++) + { + packet.animBlendWeights[i] = player->mPlayerAnimator->getBlendWeight(i); } + + const char *hackName = player->mHackKeeper->getCurrentHackName(); + + if (hackName != nullptr) { + + sInstance->isClientCaptured = true; + + const char* actName = al::getActionName(player->mHackKeeper->currentHackActor); + + if (actName) { + packet.actName = PlayerAnims::FindType(actName); + packet.subActName = PlayerAnims::Type::Unknown; + //strcpy(packet.actName, actName); + } else { + packet.actName = PlayerAnims::Type::Unknown; + packet.subActName = PlayerAnims::Type::Unknown; + } + } else { + packet.actName = PlayerAnims::FindType(player->mPlayerAnimator->mAnimFrameCtrl->getActionName()); + packet.subActName = PlayerAnims::FindType(player->mPlayerAnimator->curSubAnim.cstr()); + + sInstance->isClientCaptured = false; + } + } else { - packet.actName = PlayerAnims::FindType(player->mPlayerAnimator->mAnimFrameCtrl->getActionName()); - packet.subActName = PlayerAnims::FindType(player->mPlayerAnimator->curSubAnim.cstr()); + + // TODO: implement YukimaruRacePlayer syncing + + for (size_t i = 0; i < 6; i++) + { + packet.animBlendWeights[i] = 0; + } sInstance->isClientCaptured = false; + + packet.actName = PlayerAnims::Type::Unknown; + packet.subActName = PlayerAnims::Type::Unknown; } if(sInstance->lastPlayerInfPacket != packet) { @@ -641,7 +657,7 @@ void Client::sendHackCapInfPacket(const HackCap* hackCap) { /** * @brief - * + * Sends both stage info and player 2D info to the server. * @param player * @param holder */ @@ -673,7 +689,7 @@ void Client::sendGameInfPacket(const PlayerActorHakoniwa* player, GameDataHolder } /** * @brief - * + * Sends only stage info to the server. * @param holder */ void Client::sendGameInfPacket(GameDataHolderAccessor holder) { @@ -1284,7 +1300,7 @@ void Client::updateShines() { } sInstance->resetCollectedShines(); - sInstance->mCurStageScene->stageSceneLayout->startShineCountAnim(false); + sInstance->mCurStageScene->mSceneLayout->startShineCountAnim(false); } /** diff --git a/source/server/HideAndSeekMode.cpp b/source/server/HideAndSeekMode.cpp index 032965c..128703f 100644 --- a/source/server/HideAndSeekMode.cpp +++ b/source/server/HideAndSeekMode.cpp @@ -6,6 +6,7 @@ #include "game/GameData/GameDataHolderAccessor.h" #include "game/Layouts/CoinCounter.h" #include "game/Layouts/MapMini.h" +#include "game/Player/PlayerActorBase.h" #include "game/Player/PlayerActorHakoniwa.h" #include "layouts/HideAndSeekIcon.h" #include "logger.hpp" @@ -61,10 +62,10 @@ void HideAndSeekMode::begin() { mModeLayout->showSeeking(); } - CoinCounter *coinCollect = mCurScene->stageSceneLayout->mCoinCollectLyt; - CoinCounter* coinCounter = mCurScene->stageSceneLayout->mCoinCountLyt; - MapMini* compass = mCurScene->stageSceneLayout->mMapMiniLyt; - al::SimpleLayoutAppearWaitEnd* playGuideLyt = mCurScene->stageSceneLayout->mPlayGuideMenuLyt; + CoinCounter *coinCollect = mCurScene->mSceneLayout->mCoinCollectLyt; + CoinCounter* coinCounter = mCurScene->mSceneLayout->mCoinCountLyt; + MapMini* compass = mCurScene->mSceneLayout->mMapMiniLyt; + al::SimpleLayoutAppearWaitEnd* playGuideLyt = mCurScene->mSceneLayout->mPlayGuideMenuLyt; if(coinCounter->mIsAlive) coinCounter->tryEnd(); @@ -84,10 +85,10 @@ void HideAndSeekMode::end() { mModeTimer->disableTimer(); - CoinCounter *coinCollect = mCurScene->stageSceneLayout->mCoinCollectLyt; - CoinCounter* coinCounter = mCurScene->stageSceneLayout->mCoinCountLyt; - MapMini* compass = mCurScene->stageSceneLayout->mMapMiniLyt; - al::SimpleLayoutAppearWaitEnd* playGuideLyt = mCurScene->stageSceneLayout->mPlayGuideMenuLyt; + CoinCounter *coinCollect = mCurScene->mSceneLayout->mCoinCollectLyt; + CoinCounter* coinCounter = mCurScene->mSceneLayout->mCoinCountLyt; + MapMini* compass = mCurScene->mSceneLayout->mMapMiniLyt; + al::SimpleLayoutAppearWaitEnd* playGuideLyt = mCurScene->mSceneLayout->mPlayGuideMenuLyt; if(!coinCounter->mIsAlive) coinCounter->tryStart(); @@ -103,7 +104,9 @@ void HideAndSeekMode::end() { void HideAndSeekMode::update() { - PlayerActorHakoniwa* mainPlayer = rs::getPlayerActor(mCurScene); + PlayerActorBase* playerBase = rs::getPlayerActor(mCurScene); + + bool isYukimaru = !playerBase->getPlayerInfo(); // if PlayerInfo is a nullptr, that means we're dealing with the bound bowl racer if (mIsFirstFrame) { @@ -117,39 +120,41 @@ void HideAndSeekMode::update() { if (!mInfo->mIsPlayerIt) { if (mInvulnTime >= 5) { - if (mainPlayer) { + if (playerBase) { for (size_t i = 0; i < mPuppetHolder->getSize(); i++) { PuppetInfo *curInfo = Client::getPuppetInfo(i); if(curInfo->isConnected && curInfo->isInSameStage && curInfo->isIt) { - float pupDist = al::calcDistance(mainPlayer, curInfo->playerPos); // TODO: remove distance calculations and use hit sensors to determine this + float pupDist = al::calcDistance(playerBase, curInfo->playerPos); // TODO: remove distance calculations and use hit sensors to determine this - if(pupDist < 200.f && mainPlayer->mDimKeeper->is2DModel == curInfo->is2D) { - if(!PlayerFunction::isPlayerDeadStatus(mainPlayer)) { - - GameDataFunction::killPlayer(GameDataHolderAccessor(this)); - mainPlayer->startDemoPuppetable(); - al::setVelocityZero(mainPlayer); - rs::faceToCamera(mainPlayer); - mainPlayer->mPlayerAnimator->endSubAnim(); - mainPlayer->mPlayerAnimator->startAnimDead(); + if (!isYukimaru) { + if(pupDist < 200.f && ((PlayerActorHakoniwa*)playerBase)->mDimKeeper->is2DModel == curInfo->is2D) { + if(!PlayerFunction::isPlayerDeadStatus(playerBase)) { + + GameDataFunction::killPlayer(GameDataHolderAccessor(this)); + playerBase->startDemoPuppetable(); + al::setVelocityZero(playerBase); + rs::faceToCamera(playerBase); + ((PlayerActorHakoniwa*)playerBase)->mPlayerAnimator->endSubAnim(); + ((PlayerActorHakoniwa*)playerBase)->mPlayerAnimator->startAnimDead(); + + mInfo->mIsPlayerIt = true; + mModeTimer->disableTimer(); + mModeLayout->showSeeking(); + + Client::sendTagInfPacket(); + } + } else if (PlayerFunction::isPlayerDeadStatus(playerBase)) { mInfo->mIsPlayerIt = true; mModeTimer->disableTimer(); mModeLayout->showSeeking(); - + Client::sendTagInfPacket(); + } - } else if (PlayerFunction::isPlayerDeadStatus(mainPlayer)) { - - mInfo->mIsPlayerIt = true; - mModeTimer->disableTimer(); - mModeLayout->showSeeking(); - - Client::sendTagInfPacket(); - } } } @@ -162,13 +167,13 @@ void HideAndSeekMode::update() { mModeTimer->updateTimer(); } - if (mInfo->mIsUseGravity) { + if (mInfo->mIsUseGravity && !isYukimaru) { sead::Vector3f gravity; - if (rs::calcOnGroundNormalOrGravityDir(&gravity, mainPlayer, mainPlayer->mPlayerCollider)) { + if (rs::calcOnGroundNormalOrGravityDir(&gravity, playerBase, playerBase->getPlayerCollision())) { gravity = -gravity; al::normalize(&gravity); - al::setGravity(mainPlayer, gravity); - al::setGravity(mainPlayer->mHackCap, gravity); + al::setGravity(playerBase, gravity); + al::setGravity(((PlayerActorHakoniwa*)playerBase)->mHackCap, gravity); } if (al::isPadHoldL(-1)) { @@ -183,7 +188,7 @@ void HideAndSeekMode::update() { } } else if (al::isPadTriggerZL(-1)) { if (al::isPadTriggerLeft(-1)) { - killMainPlayer(mainPlayer); + killMainPlayer(((PlayerActorHakoniwa*)playerBase)); } } } diff --git a/source/server/SocketClient.cpp b/source/server/SocketClient.cpp index 9dd5d97..0279964 100644 --- a/source/server/SocketClient.cpp +++ b/source/server/SocketClient.cpp @@ -128,11 +128,20 @@ bool SocketClient::RECV() { int fullSize = header->mPacketSize + sizeof(Packet); - if (header->mType != PacketType::UNKNOWN && fullSize <= MAXPACKSIZE && fullSize > 0 && valread == sizeof(Packet)) { + if (header->mType > PacketType::UNKNOWN && header->mType < PacketType::End && + fullSize <= MAXPACKSIZE && fullSize > 0 && valread == sizeof(Packet)) { - if (header->mType != PLAYERINF && header->mType != HACKCAPINF) - Logger::log("Received packet (from %02X%02X): %s\n", - header->mUserID.data[0], header->mUserID.data[1], packetNames[header->mType]); + if (header->mType != PLAYERINF && header->mType != HACKCAPINF) { + Logger::log("Received packet (from %02X%02X):", header->mUserID.data[0], + header->mUserID.data[1]); + Logger::disableName(); + Logger::log(" Size: %d", header->mPacketSize); + Logger::log(" Type: %d", header->mType); + if(packetNames[header->mType]) + Logger::log(" Type String: %s\n", packetNames[header->mType]); + Logger::enableName(); + } + char* packetBuf = (char*)malloc(fullSize); diff --git a/source/server/logger.cpp b/source/server/logger.cpp index 6fa0b61..99fd356 100644 --- a/source/server/logger.cpp +++ b/source/server/logger.cpp @@ -116,8 +116,7 @@ bool Logger::pingSocket() { void tryInitSocket() { __asm("STR X20, [X8,#0x18]"); - #ifdef DEBUGLOG + #if DEBUGLOG Logger::createInstance(); // creates a static instance for debug logger #endif -} - +} \ No newline at end of file diff --git a/source/states/StageSceneStateServerConfig.cpp b/source/states/StageSceneStateServerConfig.cpp index c4eeb51..0163845 100644 --- a/source/states/StageSceneStateServerConfig.cpp +++ b/source/states/StageSceneStateServerConfig.cpp @@ -1,6 +1,10 @@ #include "game/StageScene/StageSceneStateServerConfig.hpp" #include +#include #include +#include "al/string/StringTmp.h" +#include "basis/seadNew.h" +#include "game/Layouts/CommonVerticalList.h" #include "game/SaveData/SaveDataAccessFunction.h" #include "server/Client.hpp" #include "al/util.hpp" @@ -15,6 +19,10 @@ #include "server/gamemode/GameModeFactory.hpp" #include "server/HideAndSeekMode.hpp" +// WIP work on RollPartsData, not exactly working out atm +const char16_t* testValues[] = {u"Test 1", u"Test 2", u"Test 3", u"Test 4", u"Test 5", + u"Test 6", u"Test 7", u"Test 8", u"Test 9"}; + StageSceneStateServerConfig::StageSceneStateServerConfig(const char *name, al::Scene *scene, const al::LayoutInitInfo &initInfo, FooterParts *footerParts, GameDataHolder *dataHolder, bool) : al::HostStateBase(name, scene) { mFooterParts = footerParts; mGameDataHolder = dataHolder; @@ -29,6 +37,8 @@ StageSceneStateServerConfig::StageSceneStateServerConfig(const char *name, al::S al::setPaneString(mMainOptions, "TxtOption", u"Server Configuration", 0); + mMainOptionsList->unkInt1 = 1; + mMainOptionsList->initDataNoResetSelected(5); sead::SafeArray, 5>* mainMenuOptions = @@ -42,6 +52,22 @@ StageSceneStateServerConfig::StageSceneStateServerConfig(const char *name, al::S mMainOptionsList->addStringData(mainMenuOptions->mBuffer, "TxtContent"); + // WIP work on RollPartsData, not exactly working out atm + // RollPartsData* testArr = new RollPartsData[2](); + + // for (int i = 0; i < 2; i++) { + // RollPartsData* part = &testArr[i]; + + // part->mRollMsgCount = 3; + // part->mRollMsgList = testValues; + // part->unkInt1 = 0; + // part->mUnkBool = i == 0; + // } + + //mMainOptionsList->startLoopActionAll("Loop", "Loop"); + + // mMainOptionsList->setRollPartsData(testArr); + // gamemode select menu mModeSelect = new SimpleLayoutMenu("GamemodeSelectMenu", "OptionSelect", initInfo, 0, false);