mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-03 12:31:15 +00:00
* Implement/match LegoPathActor::ParseAction (#946) * Implement/match LegoPathActor::ParseAction * Fix naming * Space * Implement/match Isle::UpdateGlobe (#947) * Implement/match Isle::UpdateGlobe * Change function access * Implement/match Isle::CreateState and related (#948) * Implement/match actor Create functions (#949) * Implement/match Isle::Escape (#950) * Implement/match Isle::FUN_10033350 (#951) * Implement/match Isle::HandleType19Notification (#952) * Implement/match Isle::HandleType19Notification * Fix * Implement/match LegoAnimationManager::FUN_10063b90 (#953) * Implement/match LegoAnimationManager::FUN_100648f0 (#954) * Implement LegoROI::FUN_100a9410 (#955) * WIP * WIP * Remove space * Fix * Implement/match LegoExtraActor::VTable0x6c (#956) * Match LegoUnknown::FUN_1009a1e0 (#957) * Fix extra actor collisions (#958) * Implement/match IslePathActor::FUN_1001b660 (#960) * Refactor MxBitmap (again) (#961) * Remove this * Starting list of beta addrs * Static for height-specific abs, fix StrechBits * MxBitmap refactor * Implement/match LegoPathBoundary::FUN_100586e0 and FUN_10057fe0 (#962) * Implement/match LegoAnimPresenter::FUN_1006b140 (#963) * Implement LegoMeterPresenter::DrawMeter (#964) * Implement LegoMeterPresenter::DrawMeter * New MxRect16 header, offsets and size annotations * Missing mxtypes include * Implement/match LegoAnimationManager::FUN_10063270 (#965) * Implement/match LegoAnimMMPresenter::FUN_1004b840 (#966) * Implement/match LegoAnimationManager::FUN_10062e20 (#967) * Beta match MxPalette (#968) * Beta match MxPalette * Modern compiler fix * Implement/match LegoCameraController::FUN_10012290 and FUN_10012320 (#969) * Implement/match LegoControlManager::FUN_100293c0 (#970) * Implement/match Pizzeria::HandleClick (#971) * Implement/match Lego3DWavePresenter::StartingTickle (#972) * Implement/match Lego3DWavePresenter::StartingTickle * Fix annotation * Add StreamingTickle * Rename * Add static HandlerClassName function (#973) * Add static HandlerClassName function * Use method in PresenterNameDispatch --------- Co-authored-by: disinvite@users.noreply.github.com <disinvite@users.noreply.github.com>
157 lines
4.0 KiB
C++
157 lines
4.0 KiB
C++
#include "historybook.h"
|
|
|
|
#include "jukebox.h"
|
|
#include "jukebox_actions.h"
|
|
#include "legocontrolmanager.h"
|
|
#include "legoinputmanager.h"
|
|
#include "misc.h"
|
|
#include "mxmisc.h"
|
|
#include "mxnotificationmanager.h"
|
|
#include "mxstillpresenter.h"
|
|
#include "mxtransitionmanager.h"
|
|
|
|
DECOMP_SIZE_ASSERT(HistoryBook, 0x3e4)
|
|
|
|
// FUNCTION: LEGO1 0x100822f0
|
|
HistoryBook::HistoryBook()
|
|
{
|
|
memset(m_alphabet, NULL, sizeof(m_alphabet));
|
|
memset(m_names, NULL, sizeof(m_names));
|
|
memset(m_scores, NULL, sizeof(m_scores));
|
|
NotificationManager()->Register(this);
|
|
}
|
|
|
|
// STUB: LEGO1 0x100824d0
|
|
HistoryBook::~HistoryBook()
|
|
{
|
|
// TODO
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x10082610
|
|
MxResult HistoryBook::Create(MxDSAction& p_dsAction)
|
|
{
|
|
MxResult result = LegoWorld::Create(p_dsAction);
|
|
if (result == SUCCESS) {
|
|
InputManager()->SetWorld(this);
|
|
ControlManager()->Register(this);
|
|
}
|
|
|
|
InputManager()->SetCamera(NULL);
|
|
InputManager()->Register(this);
|
|
|
|
GameState()->SetCurrentArea(LegoGameState::Area::e_histbook);
|
|
GameState()->StopArea(LegoGameState::Area::e_previousArea);
|
|
return result;
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x10082680
|
|
MxLong HistoryBook::Notify(MxParam& p_param)
|
|
{
|
|
LegoWorld::Notify(p_param);
|
|
|
|
if (m_worldStarted) {
|
|
switch (((MxNotificationParam&) p_param).GetNotification()) {
|
|
case c_notificationButtonUp:
|
|
m_destLocation = LegoGameState::Area::e_infoscor;
|
|
TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, FALSE);
|
|
break;
|
|
case c_notificationTransitioned:
|
|
GameState()->SwitchArea(m_destLocation);
|
|
break;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
inline void SetColor(MxStillPresenter* p_presenter, MxU8 p_color, MxU8* p_colors, MxS32 p_x, MxS32 p_y)
|
|
{
|
|
if (p_color) {
|
|
for (MxS32 lax = 0; lax < 4; lax++) {
|
|
if (p_presenter->GetAlphaMask() != NULL) {
|
|
memset(NULL, p_colors[p_color - 1], 4);
|
|
}
|
|
else {
|
|
memset(p_presenter->GetBitmap()->GetStart(p_x, p_y + lax), p_colors[p_color - 1], 4);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x100826f0
|
|
void HistoryBook::ReadyWorld()
|
|
{
|
|
LegoWorld::ReadyWorld();
|
|
GameState()->GetHistory()->WriteScoreHistory();
|
|
|
|
char bitmap[] = "A_Bitmap";
|
|
for (MxS16 i = 0; i < 26; i++) {
|
|
m_alphabet[i] = (MxStillPresenter*) Find("MxStillPresenter", bitmap);
|
|
bitmap[0]++;
|
|
}
|
|
|
|
MxStillPresenter* scoreboxMaster = (MxStillPresenter*) Find("MxStillPresenter", "ScoreBox");
|
|
MxU8 scoreColors[3] =
|
|
{0x76, 0x4c, 0x38}; // yellow - #FFB900, blue - #00548C, red - #CB1220, background - #CECECE, border - #74818B
|
|
MxS32 scoreY = 0x79;
|
|
|
|
for (MxS16 scoreIndex = 0; scoreIndex < GameState()->GetHistory()->m_count; scoreIndex++) {
|
|
LegoGameState::ScoreItem* score = GameState()->GetHistory()->GetScore(scoreIndex);
|
|
|
|
MxStillPresenter** scorebox = &m_scores[scoreIndex];
|
|
*scorebox = scoreboxMaster->Clone();
|
|
|
|
MxS32 scoreX = 0x90;
|
|
if (scoreIndex >= 10) {
|
|
if (scoreIndex == 10) {
|
|
scoreY = 0x79;
|
|
}
|
|
|
|
scoreX = 0x158;
|
|
}
|
|
|
|
MxS32 scoreboxX = 1;
|
|
MxS32 scoreboxRow = 5;
|
|
MxS32 scoreState = 0;
|
|
|
|
for (; scoreboxRow > 0; scoreboxRow--) {
|
|
for (MxS32 scoreBoxColumn = 0, scoreboxY = 1; scoreBoxColumn < 5; scoreBoxColumn++, scoreboxY += 5) {
|
|
SetColor(*scorebox, score->m_state[scoreState][scoreBoxColumn], scoreColors, scoreboxX, scoreboxY);
|
|
}
|
|
|
|
scoreState++;
|
|
scoreboxX += 5;
|
|
}
|
|
|
|
(*scorebox)->Enable(TRUE);
|
|
(*scorebox)->SetTickleState(MxPresenter::e_repeating);
|
|
(*scorebox)->SetPosition(scoreX + 0xa1, scoreY);
|
|
|
|
for (MxS16 letterIndex = 0; letterIndex < (MxS16) sizeOfArray(m_names[0]);) {
|
|
MxS16 letter = score->m_name.m_letters[letterIndex];
|
|
|
|
if (letter == -1) {
|
|
break;
|
|
}
|
|
|
|
MxS16 nameIndex = letterIndex++;
|
|
m_names[scoreIndex][nameIndex] = m_alphabet[letter]->Clone();
|
|
m_names[scoreIndex][nameIndex]->Enable(TRUE);
|
|
m_names[scoreIndex][nameIndex]->SetTickleState(MxPresenter::e_repeating);
|
|
m_names[scoreIndex][nameIndex]->SetPosition(scoreX, scoreY);
|
|
scoreX += 0x17;
|
|
}
|
|
|
|
scoreY += 0x1b;
|
|
}
|
|
|
|
PlayMusic(JukeboxScript::c_InformationCenter_Music);
|
|
}
|
|
|
|
// FUNCTION: LEGO1 0x10082a10
|
|
MxBool HistoryBook::Escape()
|
|
{
|
|
m_destLocation = LegoGameState::Area::e_infomain;
|
|
return TRUE;
|
|
}
|