mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 14:37:44 +00:00
bgm is set correctly for instances
This commit is contained in:
parent
3f0cdfac73
commit
093f23c5c4
6 changed files with 36 additions and 7 deletions
|
@ -477,6 +477,8 @@ namespace Common {
|
|||
|
||||
FreeEventPos = 0x8A,
|
||||
|
||||
SetBGM = 0xA1,
|
||||
|
||||
UnlockAetherCurrentMsg = 0xA4,
|
||||
|
||||
RemoveName = 0xA8,
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
/*! play a subevent */
|
||||
void eventPlay( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam2, uint32_t eventParam3 );
|
||||
|
||||
void directorPlayScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam2, uint32_t eventParam3 );
|
||||
void directorPlayScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam3, uint32_t eventParam4, uint32_t eventParam5 = 0 );
|
||||
|
||||
/*! play a subevent */
|
||||
void eventPlay( uint32_t eventId, uint32_t scene, uint32_t flags,
|
||||
|
|
|
@ -75,8 +75,8 @@ void Core::Entity::Player::checkEvent( uint32_t eventId )
|
|||
}
|
||||
|
||||
|
||||
void Core::Entity::Player::directorPlayScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam2,
|
||||
uint32_t eventParam3 )
|
||||
void Core::Entity::Player::directorPlayScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam3,
|
||||
uint32_t eventParam4, uint32_t eventParam5 )
|
||||
{
|
||||
if( flags & 0x02 )
|
||||
setStateFlag( PlayerStateFlag::WatchingCutscene );
|
||||
|
@ -92,7 +92,7 @@ void Core::Entity::Player::directorPlayScene( uint32_t eventId, uint32_t scene,
|
|||
pEvent->setPlayedScene( true );
|
||||
pEvent->setEventReturnCallback( nullptr );
|
||||
DirectorPlayScenePacket eventPlay( getId(), getId(), pEvent->getId(),
|
||||
scene, flags, eventParam2, eventParam3 );
|
||||
scene, flags, eventParam3, eventParam4, eventParam5 );
|
||||
|
||||
queuePacket( eventPlay );
|
||||
}
|
||||
|
|
|
@ -830,6 +830,14 @@ void Core::DebugCommandHandler::instance( char* data, Entity::Player &player, bo
|
|||
player.sendDebug( "evt end" );
|
||||
instance->endEventCutscene();
|
||||
}
|
||||
else if( subCommand == "bgm" )
|
||||
{
|
||||
uint16_t bgmId;
|
||||
sscanf( params.c_str(), "%hd", &bgmId );
|
||||
|
||||
if( auto instance = player.getCurrentInstance() )
|
||||
instance->setCurrentBGM( bgmId );
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendDebug( "Unknown sub command." );
|
||||
|
|
|
@ -38,7 +38,8 @@ Core::InstanceContent::InstanceContent( boost::shared_ptr< Core::Data::InstanceC
|
|||
m_instanceContentId( instanceContentId ),
|
||||
m_state( Created ),
|
||||
m_pEntranceEObj( nullptr ),
|
||||
m_instanceCommenceTime( 0 )
|
||||
m_instanceCommenceTime( 0 ),
|
||||
m_currentBgm( pInstanceContent->bGM )
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -385,8 +386,20 @@ void Core::InstanceContent::onEnterTerritory( Entity::Player& player, uint32_t e
|
|||
player.directorPlayScene( getDirectorId(), 1, NO_DEFAULT_CAMERA | CONDITION_CUTSCENE | SILENT_ENTER_TERRI_ENV |
|
||||
HIDE_HOTBAR | SILENT_ENTER_TERRI_BGM | SILENT_ENTER_TERRI_SE |
|
||||
DISABLE_STEALTH | 0x00100000 | LOCK_HUD | LOCK_HOTBAR | // todo: wtf is 0x00100000
|
||||
DISABLE_CANCEL_EMOTE, 0, 0x9 );
|
||||
DISABLE_CANCEL_EMOTE, 0, 0x9, getCurrentBGM() );
|
||||
}
|
||||
else
|
||||
player.directorPlayScene( getDirectorId(), 2, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 0, 0x9 );
|
||||
player.directorPlayScene( getDirectorId(), 2, NO_DEFAULT_CAMERA | HIDE_HOTBAR, 0, 0x9, getCurrentBGM() );
|
||||
}
|
||||
|
||||
void Core::InstanceContent::setCurrentBGM( uint16_t bgmIndex )
|
||||
{
|
||||
m_currentBgm = bgmIndex;
|
||||
|
||||
// todo: actrl a1 does not override whatever is set with directorplayscene, need to figure out the magic behind it
|
||||
}
|
||||
|
||||
uint16_t Core::InstanceContent::getCurrentBGM() const
|
||||
{
|
||||
return m_currentBgm;
|
||||
}
|
|
@ -50,6 +50,11 @@ public:
|
|||
void startEventCutscene();
|
||||
void endEventCutscene();
|
||||
|
||||
/*! set the current bgm index (inside bgm.exd) */
|
||||
void setCurrentBGM( uint16_t bgmIndex );
|
||||
/*! get the currently playing bgm index */
|
||||
uint16_t getCurrentBGM() const;
|
||||
|
||||
bool hasPlayerPreviouslySpawned( Entity::Player &player ) const;
|
||||
InstanceContentState getState() const;
|
||||
|
||||
|
@ -66,6 +71,7 @@ private:
|
|||
boost::shared_ptr< Core::Data::InstanceContent > m_instanceContentInfo;
|
||||
uint32_t m_instanceContentId;
|
||||
InstanceContentState m_state;
|
||||
uint16_t m_currentBgm;
|
||||
|
||||
int64_t m_instanceExpireTime;
|
||||
int64_t m_instanceCommenceTime;
|
||||
|
|
Loading…
Add table
Reference in a new issue