mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-23 16:18:31 -05:00
Implement/match Act1State::PlaceActors and related (#1142)
* Implement/match Act1State::PlaceActors and related * Fix naming
This commit is contained in:
parent
6885abdc78
commit
5d3d66965d
9 changed files with 207 additions and 18 deletions
|
@ -54,7 +54,7 @@ class Act1State : public LegoState {
|
|||
void PlayCptClickDialogue();
|
||||
void StopCptClickDialogue();
|
||||
void RemoveActors();
|
||||
void FUN_10034d00();
|
||||
void PlaceActors();
|
||||
|
||||
MxU32 GetUnknown18() { return m_unk0x018; }
|
||||
ElevatorFloor GetElevatorFloor() { return (ElevatorFloor) m_elevFloor; }
|
||||
|
@ -129,18 +129,18 @@ class Isle : public LegoWorld {
|
|||
}
|
||||
|
||||
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
|
||||
void ReadyWorld() override; // vtable+50
|
||||
void Add(MxCore* p_object) override; // vtable+58
|
||||
void ReadyWorld() override; // vtable+0x50
|
||||
void Add(MxCore* p_object) override; // vtable+0x58
|
||||
|
||||
// FUNCTION: LEGO1 0x10030900
|
||||
MxBool VTable0x5c() override { return TRUE; } // vtable+5c
|
||||
MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c
|
||||
|
||||
// FUNCTION: LEGO1 0x10033170
|
||||
void VTable0x60() override {} // vtable+60
|
||||
|
||||
MxBool Escape() override; // vtable+64
|
||||
void Enable(MxBool p_enable) override; // vtable+68
|
||||
virtual void VTable0x6c(LegoPathActor* p_actor); // vtable+6c
|
||||
MxBool Escape() override; // vtable+0x64
|
||||
void Enable(MxBool p_enable) override; // vtable+0x68
|
||||
virtual void VTable0x6c(LegoPathActor* p_actor); // vtable+0x6c
|
||||
|
||||
void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; }
|
||||
MxBool HasHelicopter() { return m_helicopter != NULL; }
|
||||
|
|
|
@ -137,6 +137,8 @@ class IslePathActor : public LegoPathActor {
|
|||
SetState(0);
|
||||
}
|
||||
|
||||
void SetWorld(LegoWorld* p_world) { m_world = p_world; }
|
||||
|
||||
static void RegisterSpawnLocations();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -14,9 +14,12 @@ class LegoNamedPlane {
|
|||
// FUNCTION: LEGO1 0x10033a70
|
||||
// LegoNamedPlane::~LegoNamedPlane
|
||||
|
||||
void SetName(const char* p_name) { m_name = p_name; }
|
||||
const MxString* GetName() const { return &m_name; }
|
||||
const Mx3DPointFloat& GetPosition() { return m_position; }
|
||||
const Mx3DPointFloat& GetDirection() { return m_direction; }
|
||||
const Mx3DPointFloat& GetUp() { return m_up; }
|
||||
|
||||
void SetName(const char* p_name) { m_name = p_name; }
|
||||
void SetPosition(const Mx3DPointFloat& p_position) { m_position = p_position; }
|
||||
void SetDirection(const Mx3DPointFloat& p_direction) { m_direction = p_direction; }
|
||||
void SetUp(const Mx3DPointFloat& p_up) { m_up = p_up; }
|
||||
|
|
|
@ -21,7 +21,7 @@ class LegoNamedTexture {
|
|||
|
||||
private:
|
||||
MxString m_name; // 0x00
|
||||
LegoTexture* m_texture; // 0x04
|
||||
LegoTexture* m_texture; // 0x10
|
||||
};
|
||||
|
||||
#endif // LEGONAMEDTEXTURE_H
|
||||
|
|
|
@ -142,6 +142,7 @@ class LegoPathActor : public LegoActor {
|
|||
void SetController(LegoPathController* p_controller) { m_controller = p_controller; }
|
||||
|
||||
void UpdatePlane(LegoNamedPlane& p_namedPlane);
|
||||
void PlaceActor(LegoNamedPlane& p_namedPlane);
|
||||
|
||||
// SYNTHETIC: LEGO1 0x1002d800
|
||||
// LegoPathActor::`scalar deleting destructor'
|
||||
|
|
|
@ -63,7 +63,8 @@ MxS32 UpdateLightPosition(MxS32 p_increase);
|
|||
void SetLightPosition(MxS32 p_index);
|
||||
LegoNamedTexture* ReadNamedTexture(LegoFile* p_file);
|
||||
void FUN_1003f540(LegoFile* p_file, const char* p_filename);
|
||||
void WriteNamedTexture(LegoFile* p_file, LegoNamedTexture* p_texture);
|
||||
void WriteNamedTexture(LegoFile* p_file, LegoNamedTexture* p_namedTexture);
|
||||
void FUN_1003f930(LegoNamedTexture* p_namedTexture);
|
||||
|
||||
// FUNCTION: BETA10 0x100260a0
|
||||
inline void StartIsleAction(IsleScript::Script p_objectId)
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include "legoworld.h"
|
||||
#include "legoworldlist.h"
|
||||
#include "misc.h"
|
||||
#include "misc/legocontainer.h"
|
||||
#include "misc/legoimage.h"
|
||||
#include "misc/legotree.h"
|
||||
#include "mxdsaction.h"
|
||||
#include "mxmisc.h"
|
||||
|
@ -664,8 +666,18 @@ void FUN_1003f540(LegoFile* p_file, const char* p_filename)
|
|||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003f8a0
|
||||
void WriteNamedTexture(LegoFile* p_file, LegoNamedTexture* p_texture)
|
||||
void WriteNamedTexture(LegoFile* p_file, LegoNamedTexture* p_namedTexture)
|
||||
{
|
||||
p_file->WriteString(*p_texture->GetName());
|
||||
p_texture->GetTexture()->Write(p_file);
|
||||
p_file->WriteString(*p_namedTexture->GetName());
|
||||
p_namedTexture->GetTexture()->Write(p_file);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003f930
|
||||
void FUN_1003f930(LegoNamedTexture* p_namedTexture)
|
||||
{
|
||||
LegoTextureInfo* textureInfo = TextureContainer()->Get(p_namedTexture->GetName()->GetData());
|
||||
|
||||
if (textureInfo != NULL) {
|
||||
textureInfo->FUN_10066010(p_namedTexture->GetTexture()->GetImage()->GetBits());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -728,3 +728,13 @@ void LegoPathActor::UpdatePlane(LegoNamedPlane& p_namedPlane)
|
|||
p_namedPlane.SetDirection(GetWorldDirection());
|
||||
p_namedPlane.SetUp(GetWorldUp());
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1002f830
|
||||
void LegoPathActor::PlaceActor(LegoNamedPlane& p_namedPlane)
|
||||
{
|
||||
if (strcmp(p_namedPlane.GetName()->GetData(), "") != 0) {
|
||||
LegoWorld* world = CurrentWorld();
|
||||
world->PlaceActor(this, p_namedPlane.GetName()->GetData(), 0, 0.5f, 1, 0.5f);
|
||||
SetLocation(p_namedPlane.GetPosition(), p_namedPlane.GetDirection(), p_namedPlane.GetUp(), TRUE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "scripts.h"
|
||||
#include "skateboard.h"
|
||||
#include "towtrack.h"
|
||||
#include "viewmanager/viewmanager.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(Act1State, 0x26c)
|
||||
DECOMP_SIZE_ASSERT(LegoNamedPlane, 0x4c)
|
||||
|
@ -279,7 +280,7 @@ void Isle::ReadyWorld()
|
|||
else if (GameState()->GetLoadedAct() != LegoGameState::e_act1) {
|
||||
EnableAnimations(TRUE);
|
||||
FUN_10032620();
|
||||
m_act1state->FUN_10034d00();
|
||||
m_act1state->PlaceActors();
|
||||
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
||||
}
|
||||
}
|
||||
|
@ -541,7 +542,7 @@ void Isle::Enable(MxBool p_enable)
|
|||
CreateState();
|
||||
|
||||
VideoManager()->ResetPalette(FALSE);
|
||||
m_act1state->FUN_10034d00();
|
||||
m_act1state->PlaceActors();
|
||||
|
||||
if (UserActor() != NULL && UserActor()->GetActorId() != LegoActor::c_none) {
|
||||
// TODO: Match, most likely an inline function
|
||||
|
@ -1599,8 +1600,167 @@ void Act1State::RemoveActors()
|
|||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10034d00
|
||||
void Act1State::FUN_10034d00()
|
||||
// FUNCTION: LEGO1 0x10034d00
|
||||
void Act1State::PlaceActors()
|
||||
{
|
||||
// TODO
|
||||
Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle);
|
||||
|
||||
if (strcmp(m_motocyclePlane.GetName()->GetData(), "") != 0) {
|
||||
isle->m_motocycle->PlaceActor(m_motocyclePlane);
|
||||
}
|
||||
else {
|
||||
isle->PlaceActor(isle->m_motocycle, "INT43", 4, 0.5f, 1, 0.5f);
|
||||
}
|
||||
|
||||
if (strcmp(m_bikePlane.GetName()->GetData(), "") != 0) {
|
||||
isle->m_bike->PlaceActor(m_bikePlane);
|
||||
}
|
||||
else {
|
||||
isle->PlaceActor(isle->m_bike, "INT44", 2, 0.5f, 0, 0.5f);
|
||||
}
|
||||
|
||||
if (strcmp(m_skateboardPlane.GetName()->GetData(), "") != 0) {
|
||||
isle->m_skateboard->PlaceActor(m_skateboardPlane);
|
||||
}
|
||||
else {
|
||||
isle->PlaceActor(isle->m_skateboard, "EDG02_84", 4, 0.5f, 0, 0.5f);
|
||||
}
|
||||
|
||||
if (m_helicopter != NULL) {
|
||||
if (!strcmp(m_helicopterPlane.GetName()->GetData(), "")) {
|
||||
m_helicopter->SpawnPlayer(LegoGameState::e_unk40, FALSE, 0);
|
||||
}
|
||||
else {
|
||||
isle->PlaceActor(m_helicopter, m_helicopterPlane.GetName()->GetData(), 0, 0.5f, 1, 0.5f);
|
||||
m_helicopter->SetLocation(
|
||||
m_helicopterPlane.GetPosition(),
|
||||
m_helicopterPlane.GetDirection(),
|
||||
m_helicopterPlane.GetUp(),
|
||||
TRUE
|
||||
);
|
||||
isle->Add(m_helicopter);
|
||||
m_helicopter->SetWorld(isle);
|
||||
}
|
||||
|
||||
GetViewManager()->Add(m_helicopter->GetROI());
|
||||
m_helicopter->GetROI()->SetVisibility(TRUE);
|
||||
m_helicopterPlane.SetName("");
|
||||
m_helicopter = NULL;
|
||||
|
||||
if (m_unk0x154 != NULL) {
|
||||
FUN_1003f930(m_unk0x154);
|
||||
delete m_unk0x154;
|
||||
m_unk0x154 = NULL;
|
||||
}
|
||||
|
||||
if (m_unk0x158 != NULL) {
|
||||
FUN_1003f930(m_unk0x158);
|
||||
delete m_unk0x158;
|
||||
m_unk0x158 = NULL;
|
||||
}
|
||||
|
||||
if (m_unk0x15c != NULL) {
|
||||
FUN_1003f930(m_unk0x15c);
|
||||
delete m_unk0x15c;
|
||||
m_unk0x15c = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_jetski != NULL) {
|
||||
if (!strcmp(m_jetskiPlane.GetName()->GetData(), "")) {
|
||||
m_jetski->SpawnPlayer(LegoGameState::e_unk45, FALSE, 0);
|
||||
}
|
||||
else {
|
||||
isle->PlaceActor(m_jetski, m_jetskiPlane.GetName()->GetData(), 0, 0.5f, 1, 0.5f);
|
||||
m_jetski
|
||||
->SetLocation(m_jetskiPlane.GetPosition(), m_jetskiPlane.GetDirection(), m_jetskiPlane.GetUp(), TRUE);
|
||||
isle->Add(m_jetski);
|
||||
m_jetski->SetWorld(isle);
|
||||
}
|
||||
|
||||
GetViewManager()->Add(m_jetski->GetROI());
|
||||
m_jetski->GetROI()->SetVisibility(TRUE);
|
||||
m_jetskiPlane.SetName("");
|
||||
m_jetski = NULL;
|
||||
|
||||
if (m_unk0x1b0 != NULL) {
|
||||
FUN_1003f930(m_unk0x1b0);
|
||||
delete m_unk0x1b0;
|
||||
m_unk0x1b0 = NULL;
|
||||
}
|
||||
|
||||
if (m_unk0x1b4 != NULL) {
|
||||
FUN_1003f930(m_unk0x1b4);
|
||||
delete m_unk0x1b4;
|
||||
m_unk0x1b4 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_dunebuggy != NULL) {
|
||||
if (!strcmp(m_dunebuggyPlane.GetName()->GetData(), "")) {
|
||||
m_dunebuggy->SpawnPlayer(LegoGameState::e_unk43, FALSE, 0);
|
||||
}
|
||||
else {
|
||||
isle->PlaceActor(m_dunebuggy, m_dunebuggyPlane.GetName()->GetData(), 0, 0.5f, 1, 0.5f);
|
||||
m_dunebuggy->SetLocation(
|
||||
m_dunebuggyPlane.GetPosition(),
|
||||
m_dunebuggyPlane.GetDirection(),
|
||||
m_dunebuggyPlane.GetUp(),
|
||||
TRUE
|
||||
);
|
||||
isle->Add(m_dunebuggy);
|
||||
m_dunebuggy->SetWorld(isle);
|
||||
}
|
||||
|
||||
GetViewManager()->Add(m_dunebuggy->GetROI());
|
||||
m_dunebuggy->GetROI()->SetVisibility(TRUE);
|
||||
m_dunebuggyPlane.SetName("");
|
||||
m_dunebuggy = NULL;
|
||||
|
||||
if (m_unk0x208 != NULL) {
|
||||
FUN_1003f930(m_unk0x208);
|
||||
delete m_unk0x208;
|
||||
m_unk0x208 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_racecar != NULL) {
|
||||
if (!strcmp(m_racecarPlane.GetName()->GetData(), "")) {
|
||||
m_racecar->SpawnPlayer(LegoGameState::e_unk44, FALSE, 0);
|
||||
}
|
||||
else {
|
||||
isle->PlaceActor(m_racecar, m_racecarPlane.GetName()->GetData(), 0, 0.5f, 1, 0.5f);
|
||||
m_racecar->SetLocation(
|
||||
m_racecarPlane.GetPosition(),
|
||||
m_racecarPlane.GetDirection(),
|
||||
m_racecarPlane.GetUp(),
|
||||
TRUE
|
||||
);
|
||||
isle->Add(m_racecar);
|
||||
m_racecar->SetWorld(isle);
|
||||
}
|
||||
|
||||
GetViewManager()->Add(m_racecar->GetROI());
|
||||
m_racecar->GetROI()->SetVisibility(TRUE);
|
||||
m_racecarPlane.SetName("");
|
||||
m_racecar = NULL;
|
||||
|
||||
if (m_unk0x25c != NULL) {
|
||||
FUN_1003f930(m_unk0x25c);
|
||||
delete m_unk0x25c;
|
||||
m_unk0x25c = NULL;
|
||||
}
|
||||
|
||||
if (m_unk0x260 != NULL) {
|
||||
FUN_1003f930(m_unk0x260);
|
||||
delete m_unk0x260;
|
||||
m_unk0x260 = NULL;
|
||||
}
|
||||
|
||||
if (m_unk0x264 != NULL) {
|
||||
FUN_1003f930(m_unk0x264);
|
||||
delete m_unk0x264;
|
||||
m_unk0x264 = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue