Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 39 additions & 53 deletions src/lazer/game/PartyModeMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "utl/DataPointMgr.h"
#include "utl/JobMgr.h"
#include "utl/Locale.h"
#include "utl/Std.h"
#include "utl/Symbol.h"
#include <cstdlib>

Expand Down Expand Up @@ -191,11 +192,9 @@ PartyModeMgr::PartyModeMgr() : mFrameSmoothers() {
mPerSongDifficulty = false;
mCustomParty = false;
mUsingPerSongOptions = false;
mSetPartyOptionsJob = nullptr;
mGetPartyOptionsJob = nullptr;
mGetPartySongQueueJob = nullptr;
mAddSongToPartySongQueueJob = nullptr;
mDeleteSongFromPartySongQueueJob = nullptr;
for (int i = 0; i < 5; i++) {
mPartyJobs[i] = nullptr;
}
unk314 = false;
unk324 = 0;
}
Expand Down Expand Up @@ -816,9 +815,8 @@ void PartyModeMgr::SendPartyOptionsToRC() {
if (!profile) {
BroadcastSyncMsg("skipped_sync");
} else {
mSetPartyOptionsJob =
new SetPartyOptionsJob(this, profile->GetOnlineID()->ToString());
TheRockCentral.ManageJob(mSetPartyOptionsJob);
mPartyJobs[0] = new SetPartyOptionsJob(this, profile->GetOnlineID()->ToString());
TheRockCentral.ManageJob(mPartyJobs[0]);
}
}

Expand All @@ -827,15 +825,14 @@ void PartyModeMgr::GetPartyOptionsFromRC() {
if (!profile) {
BroadcastSyncMsg("skipped_sync");
} else {
mGetPartyOptionsJob =
new GetPartyOptionsJob(this, profile->GetOnlineID()->ToString());
TheRockCentral.ManageJob(mGetPartyOptionsJob);
mPartyJobs[1] = new GetPartyOptionsJob(this, profile->GetOnlineID()->ToString());
TheRockCentral.ManageJob(mPartyJobs[1]);
}
}

void PartyModeMgr::ReadPartyOptions() {
mGetPartyOptionsJob->GetOptions();
mGetPartyOptionsJob = nullptr;
((GetPartyOptionsJob *)mPartyJobs[1])->GetOptions();
mPartyJobs[1] = nullptr;
BroadcastSyncMsg("options_updated");
}

Expand All @@ -844,9 +841,9 @@ void PartyModeMgr::GetPartySongQueueFromRC() {
if (!profile) {
BroadcastSyncMsg("skipped_sync");
} else {
mGetPartySongQueueJob =
mPartyJobs[2] =
new GetPartySongQueueJob(this, profile->GetOnlineID()->ToString());
TheRockCentral.ManageJob(mGetPartySongQueueJob);
TheRockCentral.ManageJob(mPartyJobs[2]);
}
}

Expand All @@ -855,10 +852,10 @@ void PartyModeMgr::DeleteSongFromRCPartySongQueue(int songID) {
if (!profile) {
BroadcastSyncMsg("skipped_sync");
} else {
mDeleteSongFromPartySongQueueJob = new DeleteSongFromPartySongQueueJob(
mPartyJobs[4] = new DeleteSongFromPartySongQueueJob(
this, profile->GetOnlineID()->ToString(), songID
);
TheRockCentral.ManageJob(mDeleteSongFromPartySongQueueJob);
TheRockCentral.ManageJob(mPartyJobs[4]);
}
}

Expand All @@ -867,10 +864,10 @@ void PartyModeMgr::AddNextSongToRCPartySongQueue() {
if (!profile) {
BroadcastSyncMsg("skipped_sync");
} else {
mAddSongToPartySongQueueJob = new AddSongToPartySongQueueJob(
mPartyJobs[3] = new AddSongToPartySongQueueJob(
this, profile->GetOnlineID()->ToString(), unk308.front().mSongID
);
TheRockCentral.ManageJob(mAddSongToPartySongQueueJob);
TheRockCentral.ManageJob(mPartyJobs[3]);
}
}

Expand Down Expand Up @@ -1381,52 +1378,41 @@ DataNode PartyModeMgr::OnMsg(const RCJobCompleteMsg &msg) {
if (!msg.Success()) {
MILO_LOG("[PartyModeMgr::OnMsg] Party net API failed.\n");
for (int i = 0; i < 5; i++) {
if (mSetPartyOptionsJob == msg.Job()) {
mSetPartyOptionsJob->Cancel(false);
mSetPartyOptionsJob = nullptr;
if (mPartyJobs[i] == msg.Job()) {
mPartyJobs[i]->Cancel(false);
mPartyJobs[i] = nullptr;
}
}
BroadcastSyncMsg("skipped_sync");
return 1;
}
b = false;
if (msg.Job() == mSetPartyOptionsJob) {
if (msg.Job() == mPartyJobs[0]) {
BroadcastSyncMsg("options_sent");
mSetPartyOptionsJob = nullptr;
mPartyJobs[0] = nullptr;
b = true;
} else {
if (msg.Job() == mGetPartyOptionsJob) {
ReadPartyOptions();
} else if (msg.Job() == mPartyJobs[1]) {
ReadPartyOptions();
} else if (msg.Job() == mPartyJobs[2]) {
ReadPartySongQueue();
} else if (msg.Job() == mPartyJobs[4]) {
mPartyJobs[4] = nullptr;
BroadcastSyncMsg("song_queue_updated");
b = true;
} else if (msg.Job() == mPartyJobs[3]) {
mPartyJobs[3] = nullptr;
unk308.pop_front();
if (!unk308.empty()) {
AddNextSongToRCPartySongQueue();
} else {
if (msg.Job() == mGetPartySongQueueJob) {
ReadPartySongQueue();
} else {
if (msg.Job() == mDeleteSongFromPartySongQueueJob) {
mDeleteSongFromPartySongQueueJob = nullptr;
} else {
if (msg.Job() != mAddSongToPartySongQueueJob) {
goto leave;
}
mAddSongToPartySongQueueJob = nullptr;
unk308.pop_front();
if (!unk308.empty()) {
AddNextSongToRCPartySongQueue();
b = true;
} else {
mAddSongToPartySongQueueJob = nullptr;
unk314 = false;
}
}
BroadcastSyncMsg("song_queue_updated");
b = true;
}
mPartyJobs[3] = nullptr;
unk314 = false;
BroadcastSyncMsg("song_queue_updated");
}
b = true;
}
leave:
if (b) {
DataNode party("party");
DataNode updated("updated");
ThePlatformMgr.SmartGlassSend(0, DataArrayPtr(updated, party));
ThePlatformMgr.SmartGlassSend(0, DataArrayPtr("updated", "party"));
}
return 1;
}
11 changes: 6 additions & 5 deletions src/lazer/game/PartyModeMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,12 @@ class PartyModeMgr : public Hmx::Object, public ContentMgr::Callback {
float unk2e8;
float unk2ec;
float mSixStarBonus; // 0x2f0
SetPartyOptionsJob *mSetPartyOptionsJob; // 0x2f4
GetPartyOptionsJob *mGetPartyOptionsJob; // 0x2f8
GetPartySongQueueJob *mGetPartySongQueueJob; // 0x2fc
AddSongToPartySongQueueJob *mAddSongToPartySongQueueJob; // 0x300
DeleteSongFromPartySongQueueJob *mDeleteSongFromPartySongQueueJob; // 0x304
RCJob *mPartyJobs[5]; // 0x2f4
// SetPartyOptionsJob [0] - 0x2f4
// GetPartyOptionsJob [1] - 0x2f8
// GetPartySongQueueJob [2] - 0x2fc
// AddSongToPartySongQueueJob [3]- 0x300
// DeleteSongFromPartySongQueueJob [4] - 0x304
std::list<SongQueueRow> unk308;
int mCurrSyncedSongID; // 0x310
bool unk314;
Expand Down
3 changes: 2 additions & 1 deletion src/lazer/meta_ham/CampaignPerformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,8 @@ int CampaignPerformer::GetNumSongCrazeMoves(Symbol s) {
void CampaignPerformer::BookmarkCurrentProgress() {
HamProfile *pProfile = TheProfileMgr.GetActiveProfile(true);
MILO_ASSERT(pProfile, 0x4e9);
for (int i = 0; i <= mDifficulty; i++) {
Difficulty diff = mDifficulty; // i hate it here
for (int i = 0; i <= diff; i++) {
pProfile->AccessCampaignProgress((Difficulty)i).BookmarkCurrentProgress();
}
}
Expand Down
11 changes: 10 additions & 1 deletion src/lazer/meta_ham/HamPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,16 @@ void HamPanel::Poll() { UIPanel::Poll(); }
UIComponent *HamPanel::FocusComponent() {
auto pEventDialog = TheHamUI.EventDialogPanel();
MILO_ASSERT(pEventDialog, 60);
return UIPanel::FocusComponent();
if (pEventDialog->GetState() == kUp) {
if (pEventDialog == this) {
return UIPanel::FocusComponent();
}
return pEventDialog->FocusComponent();
}
if (!TheHamUI.GetOverlayPanel() || TheHamUI.GetOverlayPanel() == this) {
return UIPanel::FocusComponent();
}
return TheHamUI.GetOverlayPanel()->FocusComponent();
}

BEGIN_HANDLERS(HamPanel)
Expand Down
18 changes: 15 additions & 3 deletions src/lazer/meta_ham/HamStorePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "os/User.h"
#include "stl/_vector.h"
#include "ui/UI.h"
#include "utl/JobMgr.h"
#include "utl/Loader.h"
#include "utl/MakeString.h"
#include "utl/NetCacheMgr.h"
Expand Down Expand Up @@ -268,8 +269,19 @@ void HamStorePanel::CreateCartUIs() {
static Symbol description("description");
static Symbol art("art");
static Symbol store_filter_song_import_offers("store_filter_song_import_offers");
unkac.insert(unkac.begin(), 1, new HamStoreFilter(store_filter_shopping_cart));
auto it = unkac.begin();
unkac.insert(it, new HamStoreFilter(store_filter_shopping_cart));
unkac.push_back(new HamStoreFilter(store_filter_song_import_offers));

DataArrayPtr ptr;
ptr->Insert(ptr->Size(), store_checkout);
ptr->Insert(ptr->Size(), DataArrayPtr(type, fake));
ptr->Insert(ptr->Size(), DataArrayPtr(name, ""));
ptr->Insert(ptr->Size(), DataArrayPtr(artist, ""));
ptr->Insert(ptr->Size(), DataArrayPtr(album_name, ""));
ptr->Insert(ptr->Size(), DataArrayPtr(description, ""));
ptr->Insert(ptr->Size(), DataArrayPtr(art, "avatar_theboombox_nomip_xbox.dxt"));
unk38.push_back(MakeNewOffer(ptr));
}

bool HamStorePanel::IsSpecialOfferOwned(Symbol offer) const {
Expand Down Expand Up @@ -378,7 +390,7 @@ void HamStorePanel::Poll() {
unk154 = true;
} else {
if (!unka0->HasFailed()) {
goto tag;
goto exit;
}
MILO_NOTIFY("Request for %s failed.", GetIndexFile());
ExitError((StoreError)3);
Expand All @@ -393,7 +405,7 @@ void HamStorePanel::Poll() {
unk70 = true;
}
}
tag:
exit:
if (unk156 && unk128 != 0) {
if (unkf8.SplitMs() >= unk128) {
RelockCart();
Expand Down
Loading