Functional sardine mode + new menu option
This commit is contained in:
parent
f2f32825b6
commit
a9b2c87aa0
|
@ -32,7 +32,7 @@ include $(DEVKITPRO)/libnx/switch_rules
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
TARGET ?= $(notdir $(CURDIR))$(SMOVER)
|
TARGET ?= $(notdir $(CURDIR))$(SMOVER)
|
||||||
BUILD ?= build$(SMOVER)
|
BUILD ?= build$(SMOVER)
|
||||||
SOURCES := source/sead/time source/sead source/puppets source/server/hns source/server/gamemode source/server/gamemode/modifiers source/server source/layouts source/states source/cameras source/nx source
|
SOURCES := source/sead/time source/sead source/puppets source/server/hns source/server/snh source/server/gamemode source/server/gamemode/modifiers source/server source/layouts source/states source/cameras source/nx source
|
||||||
SOURCES += source/al/execute
|
SOURCES += source/al/execute
|
||||||
DATA := data
|
DATA := data
|
||||||
INCLUDES := include include/sead
|
INCLUDES := include include/sead
|
||||||
|
|
|
@ -13,6 +13,8 @@ class SocketBase {
|
||||||
|
|
||||||
virtual nn::Result init(const char * ip, u16 port) = 0;
|
virtual nn::Result init(const char * ip, u16 port) = 0;
|
||||||
virtual bool closeSocket();
|
virtual bool closeSocket();
|
||||||
|
virtual bool tryReconnect();
|
||||||
|
virtual struct Packet *tryGetPacket();
|
||||||
|
|
||||||
const char *getStateChar();
|
const char *getStateChar();
|
||||||
u8 getLogState();
|
u8 getLogState();
|
||||||
|
@ -37,6 +39,3 @@ class SocketBase {
|
||||||
|
|
||||||
int sock_flags;
|
int sock_flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "al/layout/LayoutActor.h"
|
||||||
|
#include "al/layout/LayoutInitInfo.h"
|
||||||
|
#include "al/util/NerveUtil.h"
|
||||||
|
|
||||||
|
#include "logger.hpp"
|
||||||
|
#include "server/gamemode/GameModeTimer.hpp"
|
||||||
|
|
||||||
|
// TODO: kill layout if going through loading zone or paused
|
||||||
|
|
||||||
|
class SardineIcon : public al::LayoutActor {
|
||||||
|
public:
|
||||||
|
SardineIcon(const char* name, const al::LayoutInitInfo& initInfo);
|
||||||
|
|
||||||
|
void appear() override;
|
||||||
|
|
||||||
|
bool tryStart();
|
||||||
|
bool tryEnd();
|
||||||
|
|
||||||
|
void showSolo();
|
||||||
|
void showPack();
|
||||||
|
|
||||||
|
void exeAppear();
|
||||||
|
void exeWait();
|
||||||
|
void exeEnd();
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct SardineInfo* mInfo;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
NERVE_HEADER(SardineIcon, Appear)
|
||||||
|
NERVE_HEADER(SardineIcon, Wait)
|
||||||
|
NERVE_HEADER(SardineIcon, End)
|
||||||
|
}
|
|
@ -24,8 +24,9 @@ class SocketClient : public SocketBase {
|
||||||
public:
|
public:
|
||||||
SocketClient(const char *name, sead::Heap *heap);
|
SocketClient(const char *name, sead::Heap *heap);
|
||||||
nn::Result init(const char* ip, u16 port) override;
|
nn::Result init(const char* ip, u16 port) override;
|
||||||
bool tryReconnect();
|
bool tryReconnect() override;
|
||||||
bool closeSocket() override;
|
bool closeSocket() override;
|
||||||
|
Packet *tryGetPacket() override;
|
||||||
|
|
||||||
bool startThreads();
|
bool startThreads();
|
||||||
void endThreads();
|
void endThreads();
|
||||||
|
@ -39,8 +40,6 @@ class SocketClient : public SocketBase {
|
||||||
void sendFunc();
|
void sendFunc();
|
||||||
void recvFunc();
|
void recvFunc();
|
||||||
|
|
||||||
Packet *tryGetPacket(sead::MessageQueue::BlockType blockType = sead::MessageQueue::BlockType::Blocking);
|
|
||||||
|
|
||||||
void printPacket(Packet* packet);
|
void printPacket(Packet* packet);
|
||||||
bool isConnected() { return socket_log_state == SOCKET_LOG_CONNECTED; }
|
bool isConnected() { return socket_log_state == SOCKET_LOG_CONNECTED; }
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#include <math.h>
|
|
||||||
#include "puppets/PuppetHolder.hpp"
|
|
||||||
#include "al/actor/ActorInitInfo.h"
|
#include "al/actor/ActorInitInfo.h"
|
||||||
#include "al/actor/IUseName.h"
|
#include "al/actor/IUseName.h"
|
||||||
#include "al/scene/Scene.h"
|
#include "al/scene/Scene.h"
|
||||||
|
@ -11,35 +8,41 @@
|
||||||
#include "game/StageScene/StageScene.h"
|
#include "game/StageScene/StageScene.h"
|
||||||
#include "layouts/HideAndSeekIcon.h"
|
#include "layouts/HideAndSeekIcon.h"
|
||||||
#include "prim/seadSafeString.h"
|
#include "prim/seadSafeString.h"
|
||||||
|
#include "puppets/PuppetHolder.hpp"
|
||||||
#include "server/gamemode/GameModeConfigMenu.hpp"
|
#include "server/gamemode/GameModeConfigMenu.hpp"
|
||||||
|
#include <cmath>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
|
||||||
// enum for defining game mode types
|
// enum for defining game mode types
|
||||||
enum GameMode : s8 {
|
enum GameMode : s8 {
|
||||||
NONE = -1,
|
NONE = -1,
|
||||||
HIDEANDSEEK
|
HIDEANDSEEK,
|
||||||
|
SARDINE
|
||||||
};
|
};
|
||||||
|
|
||||||
// struct containing info about the games state for use in gamemodes
|
// struct containing info about the games state for use in gamemodes
|
||||||
struct GameModeInitInfo {
|
struct GameModeInitInfo {
|
||||||
GameModeInitInfo(al::ActorInitInfo* info, al::Scene *scene){
|
GameModeInitInfo(al::ActorInitInfo* info, al::Scene* scene)
|
||||||
|
{
|
||||||
mLayoutInitInfo = info->mLayoutInitInfo;
|
mLayoutInitInfo = info->mLayoutInitInfo;
|
||||||
mPlayerHolder = info->mActorSceneInfo.mPlayerHolder;
|
mPlayerHolder = info->mActorSceneInfo.mPlayerHolder;
|
||||||
mSceneObjHolder = info->mActorSceneInfo.mSceneObjHolder;
|
mSceneObjHolder = info->mActorSceneInfo.mSceneObjHolder;
|
||||||
mScene = scene;
|
mScene = scene;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void initServerInfo(GameMode mode, PuppetHolder *pupHolder) {
|
void initServerInfo(GameMode mode, PuppetHolder* pupHolder)
|
||||||
|
{
|
||||||
mMode = mode;
|
mMode = mode;
|
||||||
mPuppetHolder = pupHolder;
|
mPuppetHolder = pupHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
al::LayoutInitInfo* mLayoutInitInfo;
|
al::LayoutInitInfo* mLayoutInitInfo;
|
||||||
al::PlayerHolder* mPlayerHolder;
|
al::PlayerHolder* mPlayerHolder;
|
||||||
al::SceneObjHolder *mSceneObjHolder;
|
al::SceneObjHolder* mSceneObjHolder;
|
||||||
al::Scene* mScene;
|
al::Scene* mScene;
|
||||||
GameMode mMode = GameMode::NONE;
|
GameMode mMode = GameMode::NONE;
|
||||||
PuppetHolder *mPuppetHolder;
|
PuppetHolder* mPuppetHolder;
|
||||||
};
|
};
|
||||||
|
|
||||||
// base class for all gamemodes, must inherit from this to have a functional gamemode
|
// base class for all gamemodes, must inherit from this to have a functional gamemode
|
||||||
|
@ -54,18 +57,18 @@ public:
|
||||||
|
|
||||||
virtual bool isModeActive() const { return mIsActive; }
|
virtual bool isModeActive() const { return mIsActive; }
|
||||||
|
|
||||||
virtual void init(GameModeInitInfo const &info);
|
virtual void init(GameModeInitInfo const& info);
|
||||||
|
|
||||||
virtual void begin() { mIsActive = true; }
|
virtual void begin() { mIsActive = true; }
|
||||||
virtual void update();
|
virtual void update();
|
||||||
virtual void end() { mIsActive = false; }
|
virtual void end() { mIsActive = false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
sead::FixedSafeString<0x10> mName;
|
sead::FixedSafeString<0x10> mName;
|
||||||
al::SceneObjHolder *mSceneObjHolder = nullptr;
|
al::SceneObjHolder* mSceneObjHolder = nullptr;
|
||||||
GameMode mMode = GameMode::NONE;
|
GameMode mMode = GameMode::NONE;
|
||||||
StageScene* mCurScene = nullptr;
|
StageScene* mCurScene = nullptr;
|
||||||
PuppetHolder *mPuppetHolder = nullptr;
|
PuppetHolder* mPuppetHolder = nullptr;
|
||||||
bool mIsActive = false;
|
bool mIsActive = false;
|
||||||
bool mIsFirstFrame = true;
|
bool mIsFirstFrame = true;
|
||||||
};
|
};
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "al/factory/Factory.h"
|
#include "al/factory/Factory.h"
|
||||||
#include "server/hns/HideAndSeekConfigMenu.hpp"
|
#include "server/hns/HideAndSeekConfigMenu.hpp"
|
||||||
|
#include "server/snh/SardineConfigMenu.hpp"
|
||||||
#include "server/gamemode/GameModeConfigMenu.hpp"
|
#include "server/gamemode/GameModeConfigMenu.hpp"
|
||||||
|
|
||||||
typedef GameModeConfigMenu* (*createMenu)(const char* name);
|
typedef GameModeConfigMenu* (*createMenu)(const char* name);
|
||||||
|
@ -13,6 +14,7 @@ GameModeConfigMenu* createGameModeConfigMenu(const char* name) {
|
||||||
|
|
||||||
__attribute((used)) constexpr al::NameToCreator<createMenu> menuTable[] = {
|
__attribute((used)) constexpr al::NameToCreator<createMenu> menuTable[] = {
|
||||||
{"HideAndSeek", &createGameModeConfigMenu<HideAndSeekConfigMenu>},
|
{"HideAndSeek", &createGameModeConfigMenu<HideAndSeekConfigMenu>},
|
||||||
|
{"Sardine", &createGameModeConfigMenu<SardineConfigMenu>},
|
||||||
};
|
};
|
||||||
|
|
||||||
class GameModeConfigMenuFactory : public al::Factory<createMenu> {
|
class GameModeConfigMenuFactory : public al::Factory<createMenu> {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "al/factory/Factory.h"
|
#include "al/factory/Factory.h"
|
||||||
#include "server/gamemode/GameModeBase.hpp"
|
#include "server/gamemode/GameModeBase.hpp"
|
||||||
#include "server/hns/HideAndSeekMode.hpp"
|
#include "server/hns/HideAndSeekMode.hpp"
|
||||||
|
#include "server/snh/SardineMode.hpp"
|
||||||
|
|
||||||
typedef GameModeBase* (*createMode)(const char* name);
|
typedef GameModeBase* (*createMode)(const char* name);
|
||||||
|
|
||||||
|
@ -13,11 +14,13 @@ GameModeBase* createGameMode(const char* name)
|
||||||
};
|
};
|
||||||
|
|
||||||
__attribute((used)) constexpr al::NameToCreator<createMode> modeTable[] = {
|
__attribute((used)) constexpr al::NameToCreator<createMode> modeTable[] = {
|
||||||
{"HideAndSeek", &createGameMode<HideAndSeekMode>}
|
{"HideAndSeek", &createGameMode<HideAndSeekMode>},
|
||||||
|
{"Sardines", &createGameMode<SardineMode>}
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr const char* modeNames[] = {
|
constexpr const char* modeNames[] = {
|
||||||
"Hide and Seek"
|
"Hide and Seek",
|
||||||
|
"Sardines"
|
||||||
};
|
};
|
||||||
|
|
||||||
class GameModeFactory : public al::Factory<createMode> {
|
class GameModeFactory : public al::Factory<createMode> {
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "server/gamemode/GameModeConfigMenu.hpp"
|
||||||
|
#include "game/Layouts/CommonVerticalList.h"
|
||||||
|
#include "server/gamemode/GameModeBase.hpp"
|
||||||
|
|
||||||
|
class SardineConfigMenu : public GameModeConfigMenu {
|
||||||
|
public:
|
||||||
|
SardineConfigMenu();
|
||||||
|
|
||||||
|
void initMenu(const al::LayoutInitInfo &initInfo) override;
|
||||||
|
const sead::WFixedSafeString<0x200> *getStringData() override;
|
||||||
|
bool updateMenu(int selectIndex) override;
|
||||||
|
|
||||||
|
const int getMenuSize() override { return mItemCount; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
static constexpr int mItemCount = 4;
|
||||||
|
};
|
|
@ -0,0 +1,51 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "al/camera/CameraTicket.h"
|
||||||
|
#include "server/gamemode/GameModeBase.hpp"
|
||||||
|
#include "server/gamemode/GameModeConfigMenu.hpp"
|
||||||
|
#include "server/gamemode/GameModeInfoBase.hpp"
|
||||||
|
#include "server/gamemode/GameModeTimer.hpp"
|
||||||
|
#include "server/snh/SardineConfigMenu.hpp"
|
||||||
|
#include "layouts/SardineIcon.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
struct SardineInfo : GameModeInfoBase {
|
||||||
|
SardineInfo() { mMode = GameMode::SARDINE; }
|
||||||
|
bool mIsIt = false;
|
||||||
|
bool mIsUseGravity = false;
|
||||||
|
bool mIsUseGravityCam = false;
|
||||||
|
bool mIsTether = true;
|
||||||
|
|
||||||
|
GameTime mHidingTime;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SardineMode : public GameModeBase {
|
||||||
|
public:
|
||||||
|
SardineMode(const char* name);
|
||||||
|
|
||||||
|
void init(GameModeInitInfo const& info) override;
|
||||||
|
|
||||||
|
virtual void begin() override;
|
||||||
|
virtual void update() override;
|
||||||
|
virtual void end() override;
|
||||||
|
|
||||||
|
bool isPlayerIt() const { return mInfo->mIsIt; };
|
||||||
|
|
||||||
|
void setPlayerTagState(bool state) { mInfo->mIsIt = state; }
|
||||||
|
|
||||||
|
void enableGravityMode() { mInfo->mIsUseGravity = true; }
|
||||||
|
void disableGravityMode() { mInfo->mIsUseGravity = false; }
|
||||||
|
bool isUseGravity() const { return mInfo->mIsUseGravity; }
|
||||||
|
|
||||||
|
void setCameraTicket(al::CameraTicket* ticket) { mTicket = ticket; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
GameModeTimer* mModeTimer = nullptr;
|
||||||
|
SardineIcon* mModeLayout = nullptr;
|
||||||
|
SardineInfo* mInfo = nullptr;
|
||||||
|
al::CameraTicket* mTicket = nullptr;
|
||||||
|
|
||||||
|
float pullDistanceMax = 2250.f;
|
||||||
|
float pullDistanceMin = 1000.f;
|
||||||
|
float pullPowerRate = 75.f;
|
||||||
|
};
|
|
@ -99,13 +99,14 @@ B59E28 B seadPrintHook // sead::system::print
|
||||||
|
|
||||||
// Pause Menu Changes
|
// Pause Menu Changes
|
||||||
|
|
||||||
4EAEC4 B overrideNerveHook // makes any button on pause menu run a specific nerve
|
// 4EAEC4 B overrideNerveHook // makes any button on pause menu run a specific nerve
|
||||||
4EA104 MOV W2, #5 // update state count to account for new custom state
|
4EA104 MOV W2, #5 // update state count to account for new custom state
|
||||||
4EA1F0 BL initNerveStateHook // inits options nerve state and server config state
|
4EA1F0 BL initNerveStateHook // inits options nerve state and server config state
|
||||||
4EA174 MOV X0, X20 // moves StageSceneStatePauseMenu to first arg
|
4EA174 MOV X0, X20 // moves StageSceneStatePauseMenu to first arg
|
||||||
4EA17C NOP // prevents first new of StageSceneStateOption
|
4EA17C NOP // prevents first new of StageSceneStateOption
|
||||||
4EA1A8 BL initStateHook // inits StageSceneStateOption and StageSceneStateServerConfig
|
4EA1A8 BL initStateHook // inits StageSceneStateOption and StageSceneStateServerConfig
|
||||||
4EA1C0 NOP // prevents mStateOption ptr from being overriden
|
4EA1C0 NOP // prevents mStateOption ptr from being overriden
|
||||||
|
4EAFA4 B overrideHelpFadeNerve
|
||||||
|
|
||||||
// Gravity hooks
|
// Gravity hooks
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -78,13 +78,21 @@ bool registerShineToList(Shine* shineActor) {
|
||||||
return al::isAlive(shineActor);
|
return al::isAlive(shineActor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void overrideNerveHook(StageSceneStatePauseMenu* thisPtr, al::Nerve* nrvSet) {
|
// void overrideNerveHook(StageSceneStatePauseMenu* thisPtr, al::Nerve* nrvSet) {
|
||||||
|
|
||||||
if (al::isPadHoldZL(-1)) {
|
// if (al::isPadHoldZL(-1)) {
|
||||||
al::setNerve(thisPtr, &nrvStageSceneStatePauseMenuServerConfig);
|
// al::setNerve(thisPtr, &nrvStageSceneStatePauseMenuServerConfig);
|
||||||
} else {
|
// } else {
|
||||||
al::setNerve(thisPtr, nrvSet);
|
// al::setNerve(thisPtr, nrvSet);
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
void overrideHelpFadeNerve(StageSceneStatePauseMenu* thisPtr)
|
||||||
|
{
|
||||||
|
// Set label in menu inside LocalizedData/lang/MessageData/LayoutData/Menu.msbt
|
||||||
|
thisPtr->exeServerConfig();
|
||||||
|
al::setNerve(thisPtr, &nrvStageSceneStatePauseMenuServerConfig);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StageSceneStateServerConfig *sceneStateServerConfig = nullptr;
|
StageSceneStateServerConfig *sceneStateServerConfig = nullptr;
|
||||||
|
|
|
@ -0,0 +1,136 @@
|
||||||
|
#include "layouts/SardineIcon.h"
|
||||||
|
#include "al/string/StringTmp.h"
|
||||||
|
#include "al/util.hpp"
|
||||||
|
#include "logger.hpp"
|
||||||
|
#include "main.hpp"
|
||||||
|
#include "prim/seadSafeString.h"
|
||||||
|
#include "puppets/PuppetInfo.h"
|
||||||
|
#include "rs/util.hpp"
|
||||||
|
#include "server/Client.hpp"
|
||||||
|
#include "server/gamemode/GameModeTimer.hpp"
|
||||||
|
#include "server/snh/SardineMode.hpp"
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
SardineIcon::SardineIcon(const char* name, const al::LayoutInitInfo& initInfo)
|
||||||
|
: al::LayoutActor(name)
|
||||||
|
{
|
||||||
|
|
||||||
|
al::initLayoutActor(this, initInfo, "SardineIcon", 0);
|
||||||
|
|
||||||
|
mInfo = GameModeManager::instance()->getInfo<SardineInfo>();
|
||||||
|
|
||||||
|
initNerve(&nrvSardineIconEnd, 0);
|
||||||
|
|
||||||
|
al::hidePane(this, "SoloIcon");
|
||||||
|
al::hidePane(this, "PackIcon");
|
||||||
|
|
||||||
|
kill();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SardineIcon::appear()
|
||||||
|
{
|
||||||
|
|
||||||
|
al::startAction(this, "Appear", 0);
|
||||||
|
|
||||||
|
al::setNerve(this, &nrvSardineIconAppear);
|
||||||
|
|
||||||
|
al::LayoutActor::appear();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SardineIcon::tryEnd()
|
||||||
|
{
|
||||||
|
if (!al::isNerve(this, &nrvSardineIconEnd)) {
|
||||||
|
al::setNerve(this, &nrvSardineIconEnd);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SardineIcon::tryStart()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!al::isNerve(this, &nrvSardineIconWait) && !al::isNerve(this, &nrvSardineIconAppear)) {
|
||||||
|
|
||||||
|
appear();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SardineIcon::exeAppear()
|
||||||
|
{
|
||||||
|
if (al::isActionEnd(this, 0)) {
|
||||||
|
al::setNerve(this, &nrvSardineIconWait);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SardineIcon::exeWait()
|
||||||
|
{
|
||||||
|
if (al::isFirstStep(this)) {
|
||||||
|
al::startAction(this, "Wait", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
GameTime& curTime = mInfo->mHidingTime;
|
||||||
|
|
||||||
|
if (curTime.mHours > 0) {
|
||||||
|
al::setPaneStringFormat(this, "TxtCounter", "%01d:%02d:%02d", curTime.mHours, curTime.mMinutes,
|
||||||
|
curTime.mSeconds);
|
||||||
|
} else {
|
||||||
|
al::setPaneStringFormat(this, "TxtCounter", "%02d:%02d", curTime.mMinutes,
|
||||||
|
curTime.mSeconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
int playerCount = Client::getMaxPlayerCount();
|
||||||
|
|
||||||
|
if (playerCount > 0) {
|
||||||
|
|
||||||
|
char playerNameBuf[0x100] = { 0 }; // max of 16 player names if player name size is 0x10
|
||||||
|
|
||||||
|
sead::BufferedSafeStringBase<char> playerList = sead::BufferedSafeStringBase<char>(playerNameBuf, 0x200);
|
||||||
|
|
||||||
|
if (mInfo->mIsIt)
|
||||||
|
playerList.appendWithFormat("%s\n", Client::instance()->getClientName());
|
||||||
|
|
||||||
|
for (size_t i = 0; i < playerCount; i++) {
|
||||||
|
PuppetInfo* curPuppet = Client::getPuppetInfo(i);
|
||||||
|
if (curPuppet && curPuppet->isConnected && curPuppet->isIt) {
|
||||||
|
playerList.appendWithFormat("%s\n", curPuppet->puppetName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
al::setPaneStringFormat(this, "TxtPlayerList", playerList.cstr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SardineIcon::exeEnd()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (al::isFirstStep(this)) {
|
||||||
|
al::startAction(this, "End", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (al::isActionEnd(this, 0)) {
|
||||||
|
kill();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SardineIcon::showSolo()
|
||||||
|
{
|
||||||
|
al::hidePane(this, "PackIcon");
|
||||||
|
al::showPane(this, "SoloIcon");
|
||||||
|
}
|
||||||
|
|
||||||
|
void SardineIcon::showPack()
|
||||||
|
{
|
||||||
|
al::hidePane(this, "SoloIcon");
|
||||||
|
al::showPane(this, "PackIcon");
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
NERVE_IMPL(SardineIcon, Appear)
|
||||||
|
NERVE_IMPL(SardineIcon, Wait)
|
||||||
|
NERVE_IMPL(SardineIcon, End)
|
||||||
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
#include "logger.hpp"
|
#include "logger.hpp"
|
||||||
#include "packets/Packet.h"
|
#include "packets/Packet.h"
|
||||||
#include "server/hns/HideAndSeekMode.hpp"
|
#include "server/hns/HideAndSeekMode.hpp"
|
||||||
|
#include "server/snh/SardineMode.hpp"
|
||||||
|
|
||||||
SEAD_SINGLETON_DISPOSER_IMPL(Client)
|
SEAD_SINGLETON_DISPOSER_IMPL(Client)
|
||||||
|
|
||||||
|
@ -599,26 +600,45 @@ void Client::sendTagInfPacket() {
|
||||||
Logger::log("Static Instance is Null!\n");
|
Logger::log("Static Instance is Null!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameMode curMode = GameModeManager::instance()->getGameMode();
|
||||||
|
HideAndSeekMode* hsMode;
|
||||||
|
HideAndSeekInfo* hsInfo;
|
||||||
|
SardineMode* sarMode;
|
||||||
|
SardineInfo* sarInfo;
|
||||||
|
|
||||||
sead::ScopedCurrentHeapSetter setter(sInstance->mHeap);
|
switch(GameModeManager::instance()->getGameMode()){
|
||||||
|
case GameMode::HIDEANDSEEK:
|
||||||
HideAndSeekMode* hsMode = GameModeManager::instance()->getMode<HideAndSeekMode>();
|
hsMode = GameModeManager::instance()->getMode<HideAndSeekMode>();
|
||||||
|
hsInfo = GameModeManager::instance()->getInfo<HideAndSeekInfo>();
|
||||||
if (!GameModeManager::instance()->isMode(GameMode::HIDEANDSEEK)) {
|
break;
|
||||||
Logger::log("State is not Hide and Seek!\n");
|
case GameMode::SARDINE:
|
||||||
return;
|
sarMode = GameModeManager::instance()->getMode<SardineMode>();
|
||||||
}
|
sarInfo = GameModeManager::instance()->getInfo<SardineInfo>();
|
||||||
|
break;
|
||||||
HideAndSeekInfo* curInfo = GameModeManager::instance()->getInfo<HideAndSeekInfo>();
|
case GameMode::NONE:
|
||||||
|
Logger::log("Tag info packet has unknown gamemode!\n");
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
Logger::log("Tag info packet has unknown gamemode!\n");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
TagInf *packet = new TagInf();
|
TagInf *packet = new TagInf();
|
||||||
|
|
||||||
packet->mUserID = sInstance->mUserID;
|
packet->mUserID = sInstance->mUserID;
|
||||||
|
|
||||||
packet->isIt = hsMode->isPlayerIt();
|
if(curMode == GameMode::HIDEANDSEEK){
|
||||||
|
packet->isIt = hsMode->isPlayerIt();
|
||||||
|
packet->minutes = hsInfo->mHidingTime.mMinutes;
|
||||||
|
packet->seconds = hsInfo->mHidingTime.mSeconds;
|
||||||
|
}
|
||||||
|
else if (curMode == GameMode::SARDINE){
|
||||||
|
packet->isIt = sarMode->isPlayerIt();
|
||||||
|
packet->minutes = sarInfo->mHidingTime.mMinutes;
|
||||||
|
packet->seconds = sarInfo->mHidingTime.mSeconds;
|
||||||
|
}
|
||||||
|
|
||||||
packet->minutes = curInfo->mHidingTime.mMinutes;
|
|
||||||
packet->seconds = curInfo->mHidingTime.mSeconds;
|
|
||||||
packet->updateType = static_cast<TagUpdateType>(TagUpdateType::STATE | TagUpdateType::TIME);
|
packet->updateType = static_cast<TagUpdateType>(TagUpdateType::STATE | TagUpdateType::TIME);
|
||||||
|
|
||||||
sInstance->mSocket->queuePacket(packet);
|
sInstance->mSocket->queuePacket(packet);
|
||||||
|
@ -909,6 +929,24 @@ void Client::updateTagInfo(TagInf *packet) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (packet->mUserID == mUserID && GameModeManager::instance()->isMode(GameMode::SARDINE)) {
|
||||||
|
|
||||||
|
SardineMode* mMode = GameModeManager::instance()->getMode<SardineMode>();
|
||||||
|
SardineInfo* curInfo = GameModeManager::instance()->getInfo<SardineInfo>();
|
||||||
|
|
||||||
|
if (packet->updateType & TagUpdateType::STATE) {
|
||||||
|
mMode->setPlayerTagState(packet->isIt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packet->updateType & TagUpdateType::TIME) {
|
||||||
|
curInfo->mHidingTime.mSeconds = packet->seconds;
|
||||||
|
curInfo->mHidingTime.mMinutes = packet->minutes;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
PuppetInfo* curInfo = findPuppetInfo(packet->mUserID, false);
|
PuppetInfo* curInfo = findPuppetInfo(packet->mUserID, false);
|
||||||
|
|
||||||
if (!curInfo) {
|
if (!curInfo) {
|
||||||
|
|
|
@ -176,7 +176,7 @@ bool SocketClient::recv() {
|
||||||
Logger::enableName();
|
Logger::enableName();
|
||||||
}
|
}
|
||||||
|
|
||||||
char* packetBuf = (char*)mHeap->alloc(fullSize);
|
char* packetBuf = (char*)malloc(fullSize);
|
||||||
|
|
||||||
if (packetBuf) {
|
if (packetBuf) {
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ bool SocketClient::recv() {
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
valread += result;
|
valread += result;
|
||||||
} else {
|
} else {
|
||||||
mHeap->free(packetBuf);
|
free(packetBuf);
|
||||||
Logger::log("Packet Read Failed! Value: %d\nPacket Size: %d\nPacket Type: %s\n", result, header->mPacketSize, packetNames[header->mType]);
|
Logger::log("Packet Read Failed! Value: %d\nPacket Size: %d\nPacket Type: %s\n", result, header->mPacketSize, packetNames[header->mType]);
|
||||||
return this->tryReconnect();
|
return this->tryReconnect();
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ bool SocketClient::recv() {
|
||||||
if (!mRecvQueue.isFull()) {
|
if (!mRecvQueue.isFull()) {
|
||||||
mRecvQueue.push((s64)packet, sead::MessageQueue::BlockType::NonBlocking);
|
mRecvQueue.push((s64)packet, sead::MessageQueue::BlockType::NonBlocking);
|
||||||
} else {
|
} else {
|
||||||
mHeap->free(packetBuf);
|
free(packetBuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -336,14 +336,16 @@ void SocketClient::recvFunc() {
|
||||||
|
|
||||||
bool SocketClient::queuePacket(Packet* packet) {
|
bool SocketClient::queuePacket(Packet* packet) {
|
||||||
if (socket_log_state == SOCKET_LOG_CONNECTED) {
|
if (socket_log_state == SOCKET_LOG_CONNECTED) {
|
||||||
mSendQueue.push((s64)packet,
|
if (!mSendQueue.isFull()) {
|
||||||
sead::MessageQueue::BlockType::NonBlocking); // as this is non-blocking, it
|
mSendQueue.push(
|
||||||
// will always return true.
|
(s64)packet,
|
||||||
return true;
|
sead::MessageQueue::BlockType::NonBlocking); // as this is non-blocking, it
|
||||||
} else {
|
// will always return true.
|
||||||
mHeap->free(packet);
|
return true;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
mHeap->free(packet);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SocketClient::trySendQueue() {
|
void SocketClient::trySendQueue() {
|
||||||
|
@ -355,6 +357,6 @@ void SocketClient::trySendQueue() {
|
||||||
mHeap->free(curPacket);
|
mHeap->free(curPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
Packet* SocketClient::tryGetPacket(sead::MessageQueue::BlockType blockType) {
|
Packet* SocketClient::tryGetPacket() {
|
||||||
return socket_log_state == SOCKET_LOG_CONNECTED ? (Packet*)mRecvQueue.pop(blockType) : nullptr;
|
return socket_log_state == SOCKET_LOG_CONNECTED ? (Packet*)mRecvQueue.pop(sead::MessageQueue::BlockType::Blocking) : nullptr;
|
||||||
}
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
#include "server/snh/SardineConfigMenu.hpp"
|
||||||
|
#include "logger.hpp"
|
||||||
|
#include "server/Client.hpp"
|
||||||
|
#include "server/gamemode/GameModeManager.hpp"
|
||||||
|
#include "server/snh/SardineMode.hpp"
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
SardineConfigMenu::SardineConfigMenu()
|
||||||
|
: GameModeConfigMenu()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SardineConfigMenu::initMenu(const al::LayoutInitInfo& initInfo)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const sead::WFixedSafeString<0x200>* SardineConfigMenu::getStringData()
|
||||||
|
{
|
||||||
|
sead::SafeArray<sead::WFixedSafeString<0x200>, mItemCount>* gamemodeConfigOptions = new sead::SafeArray<sead::WFixedSafeString<0x200>, mItemCount>();
|
||||||
|
|
||||||
|
gamemodeConfigOptions->mBuffer[0].copy(u"Sardine Gravity On");
|
||||||
|
gamemodeConfigOptions->mBuffer[1].copy(u"Sardine Gravity Off");
|
||||||
|
gamemodeConfigOptions->mBuffer[2].copy(u"Enable Sardine Tether (Default)");
|
||||||
|
gamemodeConfigOptions->mBuffer[3].copy(u"Disable Sardine Tether");
|
||||||
|
|
||||||
|
return gamemodeConfigOptions->mBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SardineConfigMenu::updateMenu(int selectIndex)
|
||||||
|
{
|
||||||
|
|
||||||
|
SardineInfo* curMode = GameModeManager::instance()->getInfo<SardineInfo>();
|
||||||
|
|
||||||
|
Logger::log("Setting Gravity Mode.\n");
|
||||||
|
|
||||||
|
if (!curMode) {
|
||||||
|
Logger::log("Unable to Load Mode info!\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (selectIndex) {
|
||||||
|
case 0: {
|
||||||
|
if (GameModeManager::instance()->isMode(GameMode::SARDINE)) {
|
||||||
|
curMode->mIsUseGravity = true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case 1: {
|
||||||
|
if (GameModeManager::instance()->isMode(GameMode::SARDINE)) {
|
||||||
|
curMode->mIsUseGravity = false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case 2: {
|
||||||
|
if (GameModeManager::instance()->isMode(GameMode::SARDINE)) {
|
||||||
|
curMode->mIsTether = true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case 3: {
|
||||||
|
if (GameModeManager::instance()->isMode(GameMode::SARDINE)) {
|
||||||
|
curMode->mIsTether = false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
Logger::log("Failed to interpret Index!\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,235 @@
|
||||||
|
#include "server/snh/SardineMode.hpp"
|
||||||
|
#include "al/async/FunctorV0M.hpp"
|
||||||
|
#include "al/util.hpp"
|
||||||
|
#include "al/util/ControllerUtil.h"
|
||||||
|
#include "al/util/LiveActorUtil.h"
|
||||||
|
#include "al/util/MathUtil.h"
|
||||||
|
#include "game/GameData/GameDataFunction.h"
|
||||||
|
#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 "game/Player/PlayerFunction.h"
|
||||||
|
#include "heap/seadHeapMgr.h"
|
||||||
|
#include "layouts/HideAndSeekIcon.h"
|
||||||
|
#include "logger.hpp"
|
||||||
|
#include "math/seadVector.h"
|
||||||
|
#include "rs/util.hpp"
|
||||||
|
#include "server/Client.hpp"
|
||||||
|
#include "server/gamemode/GameModeBase.hpp"
|
||||||
|
#include "server/gamemode/GameModeFactory.hpp"
|
||||||
|
#include "server/gamemode/GameModeManager.hpp"
|
||||||
|
#include "server/gamemode/GameModeTimer.hpp"
|
||||||
|
#include <cmath>
|
||||||
|
#include <heap/seadHeap.h>
|
||||||
|
|
||||||
|
#include "basis/seadNew.h"
|
||||||
|
#include "server/snh/SardineConfigMenu.hpp"
|
||||||
|
|
||||||
|
SardineMode::SardineMode(const char* name)
|
||||||
|
: GameModeBase(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SardineMode::init(const GameModeInitInfo& info)
|
||||||
|
{
|
||||||
|
mSceneObjHolder = info.mSceneObjHolder;
|
||||||
|
mMode = info.mMode;
|
||||||
|
mCurScene = (StageScene*)info.mScene;
|
||||||
|
mPuppetHolder = info.mPuppetHolder;
|
||||||
|
|
||||||
|
GameModeInfoBase* curGameInfo = GameModeManager::instance()->getInfo<HideAndSeekInfo>();
|
||||||
|
|
||||||
|
sead::ScopedCurrentHeapSetter heapSetter(GameModeManager::instance()->getHeap());
|
||||||
|
|
||||||
|
if (curGameInfo)
|
||||||
|
Logger::log("Gamemode info found: %s %s\n", GameModeFactory::getModeString(curGameInfo->mMode), GameModeFactory::getModeString(info.mMode));
|
||||||
|
else
|
||||||
|
Logger::log("No gamemode info found\n");
|
||||||
|
if (curGameInfo && curGameInfo->mMode == mMode) {
|
||||||
|
sead::ScopedCurrentHeapSetter heapSetter(GameModeManager::getSceneHeap());
|
||||||
|
mInfo = (SardineInfo*)curGameInfo;
|
||||||
|
mModeTimer = new GameModeTimer(mInfo->mHidingTime);
|
||||||
|
Logger::log("Reinitialized timer with time %d:%.2d\n", mInfo->mHidingTime.mMinutes, mInfo->mHidingTime.mSeconds);
|
||||||
|
} else {
|
||||||
|
if (curGameInfo)
|
||||||
|
delete curGameInfo; // attempt to destory previous info before creating new one
|
||||||
|
|
||||||
|
mInfo = GameModeManager::instance()->createModeInfo<SardineInfo>();
|
||||||
|
|
||||||
|
mModeTimer = new GameModeTimer();
|
||||||
|
}
|
||||||
|
sead::ScopedCurrentHeapSetter heapSetterr(GameModeManager::getSceneHeap());
|
||||||
|
|
||||||
|
mModeLayout = new SardineIcon("SardineIcon", *info.mLayoutInitInfo);
|
||||||
|
|
||||||
|
mModeLayout->showSolo();
|
||||||
|
|
||||||
|
// mModeTimer->disableTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SardineMode::begin()
|
||||||
|
{
|
||||||
|
mModeLayout->appear();
|
||||||
|
|
||||||
|
mIsFirstFrame = true;
|
||||||
|
|
||||||
|
if (mInfo->mIsIt) {
|
||||||
|
mModeTimer->enableTimer();
|
||||||
|
mModeLayout->showPack();
|
||||||
|
} else {
|
||||||
|
mModeTimer->disableTimer();
|
||||||
|
mModeLayout->showSolo();
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
if (coinCollect->mIsAlive)
|
||||||
|
coinCollect->tryEnd();
|
||||||
|
if (compass->mIsAlive)
|
||||||
|
compass->end();
|
||||||
|
if (playGuideLyt->mIsAlive)
|
||||||
|
playGuideLyt->end();
|
||||||
|
|
||||||
|
GameModeBase::begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SardineMode::end()
|
||||||
|
{
|
||||||
|
|
||||||
|
mModeLayout->tryEnd();
|
||||||
|
|
||||||
|
mModeTimer->disableTimer();
|
||||||
|
|
||||||
|
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();
|
||||||
|
if (!coinCollect->mIsAlive)
|
||||||
|
coinCollect->tryStart();
|
||||||
|
if (!compass->mIsAlive)
|
||||||
|
compass->appearSlideIn();
|
||||||
|
if (!playGuideLyt->mIsAlive)
|
||||||
|
playGuideLyt->appear();
|
||||||
|
|
||||||
|
GameModeBase::end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SardineMode::update()
|
||||||
|
{
|
||||||
|
PlayerActorBase* playerBase = rs::getPlayerActor(mCurScene);
|
||||||
|
bool isYukimaru = !playerBase->getPlayerInfo(); // if PlayerInfo is a nullptr, that means we're dealing with the bound bowl racer
|
||||||
|
|
||||||
|
float highPuppetDistance = -1.f;
|
||||||
|
int farPuppetID = -1;
|
||||||
|
bool isAnyIt = false;
|
||||||
|
|
||||||
|
if (mIsFirstFrame) {
|
||||||
|
if (mInfo->mIsUseGravityCam && mTicket)
|
||||||
|
al::startCamera(mCurScene, mTicket, -1);
|
||||||
|
mIsFirstFrame = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (playerBase) {
|
||||||
|
for (size_t i = 0; i < mPuppetHolder->getSize(); i++) {
|
||||||
|
PuppetInfo* curInfo = Client::getPuppetInfo(i);
|
||||||
|
|
||||||
|
if (!curInfo) {
|
||||||
|
Logger::log("Checking %d, hit bounds %d-%d\n", i, mPuppetHolder->getSize(), Client::getMaxPlayerCount());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
float pupDist = al::calcDistance(playerBase, curInfo->playerPos);
|
||||||
|
bool isPupInStage = al::isEqualString(curInfo->stageName, GameDataFunction::getCurrentStageName(mCurScene->mHolder));
|
||||||
|
|
||||||
|
if ((pupDist > highPuppetDistance || highPuppetDistance == -1) && isPupInStage && curInfo->isIt) {
|
||||||
|
highPuppetDistance = pupDist;
|
||||||
|
farPuppetID = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curInfo->isIt)
|
||||||
|
isAnyIt = true;
|
||||||
|
|
||||||
|
if (curInfo->isConnected && curInfo->isInSameStage && curInfo->isIt && !mInfo->mIsIt && !isYukimaru && pupDist < 300.f) {
|
||||||
|
if (((PlayerActorHakoniwa*)playerBase)->mDimKeeper->is2DModel == curInfo->is2D && !PlayerFunction::isPlayerDeadStatus(playerBase)) {
|
||||||
|
mInfo->mIsIt = true;
|
||||||
|
mModeTimer->enableTimer();
|
||||||
|
mModeLayout->showPack();
|
||||||
|
|
||||||
|
Client::sendTagInfPacket();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mModeTimer->updateTimer();
|
||||||
|
|
||||||
|
if ((PlayerFunction::isPlayerDeadStatus(playerBase) || highPuppetDistance > pullDistanceMax) && mInfo->mIsIt) {
|
||||||
|
mInfo->mIsIt = false;
|
||||||
|
mModeTimer->disableTimer();
|
||||||
|
mModeLayout->showSolo();
|
||||||
|
|
||||||
|
Client::sendTagInfPacket();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Player pulling
|
||||||
|
if (highPuppetDistance >= pullDistanceMin && mInfo->mIsIt && farPuppetID != -1 && mInfo->mIsTether) {
|
||||||
|
sead::Vector3f target = Client::getPuppetInfo(farPuppetID)->playerPos;
|
||||||
|
sead::Vector3f* playerPos = al::getTransPtr(playerBase);
|
||||||
|
sead::Vector3f direction = target - *playerPos;
|
||||||
|
|
||||||
|
al::normalize(&direction);
|
||||||
|
|
||||||
|
playerPos->add(direction * ((al::calcDistance(playerBase, target) - pullDistanceMin) / pullPowerRate));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mInfo->mIsUseGravity && !isYukimaru) {
|
||||||
|
sead::Vector3f gravity;
|
||||||
|
if (rs::calcOnGroundNormalOrGravityDir(&gravity, playerBase, playerBase->getPlayerCollision())) {
|
||||||
|
gravity = -gravity;
|
||||||
|
al::normalize(&gravity);
|
||||||
|
al::setGravity(playerBase, gravity);
|
||||||
|
al::setGravity(((PlayerActorHakoniwa*)playerBase)->mHackCap, gravity);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (al::isPadHoldL(-1)) {
|
||||||
|
if (al::isPadTriggerRight(-1)) {
|
||||||
|
if (al::isActiveCamera(mTicket)) {
|
||||||
|
al::endCamera(mCurScene, mTicket, -1, false);
|
||||||
|
mInfo->mIsUseGravityCam = false;
|
||||||
|
} else {
|
||||||
|
al::startCamera(mCurScene, mTicket, -1);
|
||||||
|
mInfo->mIsUseGravityCam = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (al::isPadTriggerZL(-1)) {
|
||||||
|
if (al::isPadTriggerLeft(-1)) {
|
||||||
|
killMainPlayer(((PlayerActorHakoniwa*)playerBase));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (al::isPadTriggerUp(-1) && !al::isPadHoldZL(-1)) {
|
||||||
|
if (!mInfo->mIsIt && !isAnyIt) {
|
||||||
|
mInfo->mIsIt = true;
|
||||||
|
mModeTimer->enableTimer();
|
||||||
|
mModeLayout->showPack();
|
||||||
|
} else {
|
||||||
|
mInfo->mIsIt = false;
|
||||||
|
mModeTimer->disableTimer();
|
||||||
|
mModeLayout->showSolo();
|
||||||
|
}
|
||||||
|
Client::sendTagInfPacket();
|
||||||
|
}
|
||||||
|
|
||||||
|
mInfo->mHidingTime = mModeTimer->getTime();
|
||||||
|
}
|
Loading…
Reference in New Issue