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
6 changes: 3 additions & 3 deletions config/SZBE69_B8/objects.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"band3/game/Tracker.cpp": "NonMatching",
"band3/game/TrackerDisplay.cpp": "NonMatching",
"band3/game/TrackerManager.cpp": "NonMatching",
"band3/game/TrackerSource.cpp": "NonMatching",
"band3/game/TrackerSource.cpp": "Matching",
"band3/game/TrackerUtils.cpp": "NonMatching",
"band3/game/TrainerGemTab.cpp": "NonMatching",
"band3/game/TrainerPanel.cpp": "NonMatching",
Expand Down Expand Up @@ -1451,7 +1451,7 @@
"system/utl/MakeString.cpp": "Matching",
"system/utl/MBT.cpp": "Matching",
"system/utl/MeasureMap.cpp": "NonMatching",
"system/utl/Mem_Wii.cpp": "MISSING",
"system/utl/Mem_Wii.cpp": "NonMatching",
"system/utl/MemMgr.cpp": "MISSING",
"system/utl/MemPoint.cpp": "Matching",
"system/utl/MemStream.cpp": { "status": "Matching", "extra_cflags": ["-ipa function"] },
Expand All @@ -1462,7 +1462,7 @@
"system/utl/Messages3.cpp": "Matching",
"system/utl/Messages4.cpp": "Matching",
"system/utl/MultiTempoTempoMap.cpp": "NonMatching",
"system/utl/NetCacheLoader.cpp": "MISSING",
"system/utl/NetCacheLoader.cpp": "NonMatching",
"system/utl/NetCacheMgr.cpp": "NonMatching",
"system/utl/NetLoader.cpp": "NonMatching",
"system/utl/NetLoader_Wii.cpp": "MISSING",
Expand Down
93 changes: 91 additions & 2 deletions src/band3/game/Band.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
#include "game/Band.h"
#include "BandPerformer.h"
#include "bandobj/BandDirector.h"
#include "bandobj/BandTrack.h"
#include "bandtrack/TrackPanel.h"
#include "beatmatch/PlayerTrackConfig.h"
#include "beatmatch/TrackType.h"
#include "decomp.h"
#include "game/BandUser.h"
#include "game/BandUserMgr.h"
#include "game/CommonPhraseCapturer.h"
#include "game/Game.h"
#include "game/GameConfig.h"
#include "game/GameMode.h"
#include "game/GamePanel.h"
#include "game/GemPlayer.h"
#include "game/Player.h"
#include "game/RealGuitarGemPlayer.h"
#include "game/SongDB.h"
#include "game/TrainerPanel.h"
#include "game/VocalPlayer.h"
#include "meta_band/MetaPerformer.h"
#include "obj/Data.h"
#include "obj/Dir.h"
Expand All @@ -21,7 +28,6 @@
#include "os/Debug.h"
#include "os/System.h"
#include "utl/Messages.h"
#include "utl/Messages3.h"
#include "utl/Std.h"
#include "utl/Symbols.h"

Expand Down Expand Up @@ -238,14 +244,55 @@ void Band::SaveAll() {
}
}

void Band::CheckCoda(SongPos &pos) {
if (NumNonQuarantinedPlayers() != 1
|| mActivePlayers[1]->mTrackType != kTrackVocals) {
bool past_start_of_coda = false;
if (TheSongDB->GetCodaStartTick() >= 0
&& TheSongDB->GetCodaStartTick() >= pos.GetTick()) {
past_start_of_coda = true;
}
bool end_of_coda = IsEndOfCoda(pos.GetTick());
if (past_start_of_coda) {
if (end_of_coda && unk60 == 1) {
unk60 = 2;
TheBandDirector->SetCharacterHideHackEnabled(false);
} else if (!end_of_coda && unk60 == 0 && mActivePlayers.size() > 2) {
unk60 = 1;
TheBandDirector->SetCharacterHideHackEnabled(true);
}
}
if (unk40 && past_start_of_coda && end_of_coda) {
}
if (EveryoneFinishedCoda()) {
WinCoda();
}
GetTrackPanelDir()->CodaEnd();
unk40 = true;
}
}

void Band::BlowCoda(Player *p) {
if (p->IsLocal()) {
LocalBlowCoda(p);
p->Handle(send_blow_coda_msg, true);
}
}

void Band::LocalBlowCoda(Player *p) {}
void Band::LocalBlowCoda(Player *p) {
if (!p->mHasBlownCoda) {
TheGamePanel->Handle(coda_blown_msg, false);
for (int i = 0; i < mActivePlayers.size(); i++) {
BandTrack *bandtrack = mActivePlayers[i]->GetBandTrack();
if (bandtrack) {
bandtrack->CodaFail(p == mActivePlayers[i]);
}
mActivePlayers[i]->ResetCodaPoints();
}
p->SetBlownCoda();
unk44 = 2;
}
}

void Band::DealWithCodaGem(Player *p, int, bool b3, bool b4) {
if (!b3)
Expand All @@ -272,6 +319,32 @@ bool Band::IsEndOfCoda(int i1) {
}
}

bool Band::EveryoneFinishedCoda() {
if (unk44 == 2)
return false;
for (int i = 0; i < mActivePlayers.size(); i++) {
Player *p = mActivePlayers[i];
bool b = false;
if (p->AutoplaysCoda() || p->mHasFinishedCoda || p->mQuarantined) {
b = true;
}
if (!b)
return false;
}
return true;
}

void Band::WinCoda() {
TheGamePanel->Handle(coda_success_msg, false);
for (int i = 0; i < mActivePlayers.size(); i++) {
BandTrack *bt = mActivePlayers[i]->GetBandTrack();
if (bt)
bt->CodaSuccess();
mActivePlayers[i]->AddCodaPoints();
}
unk44 = 1;
}

void Band::FinishedCoda(Player *p) {
if (p->IsLocal()) {
LocalFinishedCoda(p);
Expand Down Expand Up @@ -324,6 +397,22 @@ Player *Band::AddPlayer(BeatMaster *m, BandUser *u) {
return p;
}

Player *Band::NewPlayer(BeatMaster *master, BandUser *user) {
MILO_ASSERT(user, 820);
const PlayerTrackConfigList *ptclist = TheGameConfig->GetConfigList();
int track_num = ptclist->GetConfigByUserGuid(user->GetUserGuid()).TrackNum();
switch (user->GetTrackType()) {
case kTrackVocals:
int sing_ct = ptclist->NumSingers();
return new VocalPlayer(user, master, this, track_num, mBandPerformer, sing_ct);
case kTrackRealGuitar:
case kTrackRealBass:
return new RealGuitarGemPlayer(user, master, this, track_num, mBandPerformer);
default:
return new GemPlayer(user, master, this, track_num, mBandPerformer);
}
}

void Band::UpdateBonusLevel(float f1) {
if (IsMultiplierActive()) {
int count = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/band3/game/Band.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Band : public Hmx::Object {
Player *AddPlayerDynamically(BeatMaster *, BandUser *);
Player *NewPlayer(BeatMaster *, BandUser *);
bool EveryoneDoneWithSong() const;
bool EveryoneFinishedCoda();
void DealWithCodaGem(Player *, int, bool, bool);
bool AnyoneSaveable() const;
void SetGameOver();
Expand All @@ -49,6 +50,7 @@ class Band : public Hmx::Object {
void Poll(float, SongPos &);
void CheckCoda(SongPos &);
bool IsEndOfCoda(int);
void WinCoda();
bool IsMultiplierActive() const { return mMultiplierActive; }
int AccumulatedScore() const { return mAccumulatedScore; }
float GetTotalStars() const { return mTotalStars; }
Expand Down
15 changes: 13 additions & 2 deletions src/band3/game/BandUser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@ RemoteBandUser *LocalBandUser::GetRemoteBandUser() const {
return 0;
}

const std::vector<unsigned long long> &LocalBandUser::GetFriendsConsoleCodes() const {}
const std::vector<u64> &LocalBandUser::GetFriendsConsoleCodes() const {
return TheBandUI.mOvershell->unk4c0;
}

void LocalBandUser::Reset() {
BandUser::Reset();
Expand Down Expand Up @@ -639,7 +641,16 @@ DataNode RemoteBandUser::OnMsg(const WiiFriendsListChangedMsg &msg) {
return 1;
}

void RemoteBandUser::ShowCustomCharacter() {}
void RemoteBandUser::ShowCustomCharacter() {
if (unk18 && mChar != mRemoteChar && mOnlineID->mValid) {
int id = mOnlineID->GetPrincipalID();
WiiFriendList wfl;
TheWiiFriendMgr.GetCachedFriends(&wfl);
WiiFriendProfile *wfp = wfl.GetProfile(id);
if (wfp != NULL)
mChar = mRemoteChar;
}
}

BEGIN_HANDLERS(RemoteBandUser)
HANDLE_MESSAGE(WiiFriendsListChangedMsg)
Expand Down
11 changes: 8 additions & 3 deletions src/band3/game/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "PlayerBehavior.h"
#include "PracticeSectionProvider.h"
#include "bandobj/BandTrack.h"
#include "os/Debug.h"
#include "utl/SongPos.h"
#include "beatmatch/TrackType.h"
#include "game/BandUser.h"
Expand Down Expand Up @@ -105,8 +106,8 @@ class Player : public Performer, public MsgSource {
virtual bool FillsEnabled(int) = 0;
virtual bool AreFillsForced() const { return false; }
virtual void EnterCoda();
virtual void ResetCodaPoints();
virtual void AddCodaPoints();
virtual void ResetCodaPoints() {}
virtual void AddCodaPoints() {}
virtual int GetCodaPoints() { return 0; }
virtual bool InFill() const;
virtual void SetFillLogic(FillLogic);
Expand All @@ -132,7 +133,7 @@ class Player : public Performer, public MsgSource {
virtual bool InTambourinePhrase() const;
virtual bool InFreestyleSection() const;
virtual void PopupHelp(Symbol, bool);
virtual bool AutoplaysCoda() const;
virtual bool AutoplaysCoda() const { return false; }
virtual void SetCodaEndMs(float) {}
virtual bool NeedsToOverrideBasePoints() const { return false; }
virtual bool NeedsToSetCodaEnd() const { return false; }
Expand Down Expand Up @@ -192,6 +193,10 @@ class Player : public Performer, public MsgSource {
float GetBandEnergy() const { return mBandEnergy; }
EnabledState GetEnabledState() const { return mEnabledState; }
void SetTrackNum(int num) { mTrackNum = num; }
void SetBlownCoda(void) {
MILO_ASSERT(!mHasFinishedCoda, 197);
mHasBlownCoda = true;
}

DataNode OnGetOverdriveMeter(DataArray *);
DataNode OnSendNetGameplayMsg(DataArray *);
Expand Down
2 changes: 1 addition & 1 deletion src/band3/game/Tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void Tracker::Poll(float f) {
ReachedTargetLevel(-1);
FirstFrame_(f);
mFirstPoll = false;
GetTrackPanel()->SetSuppressUnisonDisplay(mDesc.unk11);
GetTrackPanel()->SetSuppressTambourineDisplay(mDesc.unk11);
GetTrackPanel()->SetSuppressPlayerFeedback(mDesc.unk12);
SetupDisplays();
}
Expand Down
63 changes: 62 additions & 1 deletion src/band3/game/TrackerSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,65 @@ BandTrackerSource::BandTrackerSource(Band *band) : mBand(band) {
MILO_ASSERT(mBand, 0xFA);
}

BandTrackerSource::~BandTrackerSource() {}
BandTrackerSource::~BandTrackerSource() {}

TrackerPlayerID BandTrackerSource::GetFirstPlayer() const {
UserGuid id = gNullUserGuid;
std::vector<Player *> &players = mBand->GetActivePlayers();
for (int i = 0; i < players.size(); i++) {
Player *p = players[i];
const UserGuid &g = p->GetUserGuid();
if (PlayerIsEligible(p)) {
if (id == gNullUserGuid || g < id) {
id = g;
}
}
}
return id;
}

TrackerPlayerID BandTrackerSource::GetNextPlayer(const TrackerPlayerID &tpid) const {
UserGuid id = gNullUserGuid;
std::vector<Player *> &players = mBand->GetActivePlayers();
for (int i = 0; i < players.size(); i++) {
Player *p = players[i];
const UserGuid &g = p->GetUserGuid();
if (PlayerIsEligible(p)) {
if (tpid.GetGuid() < g) {
if (id == gNullUserGuid) {
id = g;
} else if (g < id) {
id = g;
}
}
}
}
if (id == tpid.GetGuid()) {
return gNullUserGuid;
} else {
return id;
}
}

int BandTrackerSource::GetPlayerCount() const {
std::vector<Player *> &players = mBand->GetActivePlayers();
int count = 0;
for (int i = 0; i < players.size(); i++) {
if (PlayerIsEligible(players[i]))
count++;
}
return count;
}

Player *BandTrackerSource::GetPlayer(const TrackerPlayerID &iID) const {
std::vector<Player *> &players = mBand->GetActivePlayers();
for (int i = 0; i < players.size(); i++) {
Player *p = players[i];
if (p->GetUserGuid() == iID.GetGuid())
return p;
}
MILO_FAIL("Couldn\'t find player in band source!");
return nullptr;
}

bool BandTrackerSource::IsFinished() const { return mBand->GetBand()->unk1e1; }
1 change: 1 addition & 0 deletions src/band3/game/TrackerSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "beatmatch/TrackType.h"
#include "game/Player.h"
#include "utl/HxGuid.h"
#include "game/Band.h"

struct TrackerPlayerID {
TrackerPlayerID() : mGuid(gNullUserGuid) {}
Expand Down
2 changes: 1 addition & 1 deletion src/band3/meta_band/OvershellPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class OvershellPanel : public UIPanel, public Synchronizable, public MsgSource {
Rand mPartResolver; // 0xa8
int mPartResolverSeed; // 0x4b8
bool mAllowRealGuitarFlow; // 0x4bc
std::vector<int> unk4c0;
std::vector<u64> unk4c0;
bool unk4c8;
int unk4cc;
};
Expand Down
4 changes: 2 additions & 2 deletions src/system/synth/StandardStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ void StandardStream::setJumpSamplesFromMs(float f1, float f2) {
}
if (unk144 != -1) {
if (mJumpFromSamples >= unk144) {
String str = mFile ? mFile->Filename() : "SynthStream";
String str = mFile ? mFile->Filename().c_str() : "SynthStream";
MILO_WARN(
"%s: JumpFromSamples (%g sec) exceeds the length of the stream (%g sec)!",
str,
Expand All @@ -353,7 +353,7 @@ void StandardStream::setJumpSamplesFromMs(float f1, float f2) {
);
}
if (mJumpToSamples >= unk144) {
String str = mFile ? mFile->Filename() : "SynthStream:";
String str = mFile ? mFile->Filename().c_str() : "SynthStream:";
MILO_WARN(
"%s: JumpToSamples (%g sec) exceeds the length of the stream (%g sec)!",
str,
Expand Down
3 changes: 3 additions & 0 deletions src/system/utl/MemMgr.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#ifndef UTL_MEMMGR_H
#define UTL_MEMMGR_H
#include "os/CritSec.h"
#include <stddef.h>
#include <new>
#include "utl/PoolAlloc.h"

extern CriticalSection *gMemLock;

class MemDoTempAllocations {
public:
MemDoTempAllocations(bool, bool);
Expand Down
Loading