Various imps, completed CCollisionResponse RE

This commit is contained in:
Phillip Stephens 2016-07-24 23:24:57 -07:00
parent 7d33e6ede3
commit 9b62191975
16 changed files with 335 additions and 153 deletions

View File

@ -6,58 +6,59 @@ namespace DNAParticle
{
static const std::vector<FourCC> GeneratorTypes =
{
SBIG('DEFS'),SBIG('CRTS'),SBIG('MTLS'),SBIG('GRAS'),
SBIG('ICEE'),SBIG('GOOO'),SBIG('WODS'),SBIG('WATR'),
SBIG('1MUD'),SBIG('1LAV'),SBIG('1SAN'),SBIG('1PRJ'),
SBIG('DCHR'),SBIG('DCHS'),SBIG('DCSH'),SBIG('DENM'),
SBIG('DESP'),SBIG('DESH'),SBIG('BTLE'),SBIG('WASP'),
SBIG('TALP'),SBIG('PTGM'),SBIG('SPIR'),SBIG('FPIR'),
SBIG('FFLE'),SBIG('PARA'),SBIG('BMON'),SBIG('BFLR'),
SBIG('PBOS'),SBIG('IBOS'),SBIG('1SVA'),SBIG('1RPR'),
SBIG('1MTR'),SBIG('1PDS'),SBIG('1FLB'),SBIG('1DRN'),
SBIG('1MRE'),SBIG('CHOZ'),SBIG('JZAP'),SBIG('1ISE'),
SBIG('1BSE'),SBIG('1ATB'),SBIG('1ATA'),SBIG('BTSP'),
SBIG('WWSP'),SBIG('TASP'),SBIG('TGSP'),SBIG('SPSP'),
SBIG('FPSP'),SBIG('FFSP'),SBIG('PSSP'),SBIG('BMSP'),
SBIG('BFSP'),SBIG('PBSP'),SBIG('IBSP'),SBIG('2SVA'),
SBIG('2RPR'),SBIG('2MTR'),SBIG('2PDS'),SBIG('2FLB'),
SBIG('2DRN'),SBIG('2MRE'),SBIG('CHSP'),SBIG('JZSP'),
SBIG('3ISE'),SBIG('3BSE'),SBIG('3ATB'),SBIG('3ATA'),
SBIG('BTSH'),SBIG('WWSH'),SBIG('TASH'),SBIG('TGSH'),
SBIG('SPSH'),SBIG('FPSH'),SBIG('FFSH'),SBIG('PSSH'),
SBIG('BMSH'),SBIG('BFSH'),SBIG('PBSH'),SBIG('IBSH'),
SBIG('3SVA'),SBIG('3RPR'),SBIG('3MTR'),SBIG('3PDS'),
SBIG('3FLB'),SBIG('3DRN'),SBIG('3MRE'),SBIG('CHSH'),
SBIG('JZSH'),SBIG('5ISE'),SBIG('5BSE'),SBIG('5ATB'),
SBIG('5ATA')
SBIG('NODP'),SBIG('DEFS'),SBIG('CRTS'),SBIG('MTLS'),
SBIG('GRAS'),SBIG('ICEE'),SBIG('GOOO'),SBIG('WODS'),
SBIG('WATR'),SBIG('1MUD'),SBIG('1LAV'),SBIG('1SAN'),
SBIG('1PRJ'),SBIG('DCHR'),SBIG('DCHS'),SBIG('DCSH'),
SBIG('DENM'),SBIG('DESP'),SBIG('DESH'),SBIG('BTLE'),
SBIG('WASP'),SBIG('TALP'),SBIG('PTGM'),SBIG('SPIR'),
SBIG('FPIR'),SBIG('FFLE'),SBIG('PARA'),SBIG('BMON'),
SBIG('BFLR'),SBIG('PBOS'),SBIG('IBOS'),SBIG('1SVA'),
SBIG('1RPR'),SBIG('1MTR'),SBIG('1PDS'),SBIG('1FLB'),
SBIG('1DRN'),SBIG('1MRE'),SBIG('CHOZ'),SBIG('JZAP'),
SBIG('1ISE'),SBIG('1BSE'),SBIG('1ATB'),SBIG('1ATA'),
SBIG('BTSP'),SBIG('WWSP'),SBIG('TASP'),SBIG('TGSP'),
SBIG('SPSP'),SBIG('FPSP'),SBIG('FFSP'),SBIG('PSSP'),
SBIG('BMSP'),SBIG('BFSP'),SBIG('PBSP'),SBIG('IBSP'),
SBIG('2SVA'),SBIG('2RPR'),SBIG('2MTR'),SBIG('2PDS'),
SBIG('2FLB'),SBIG('2DRN'),SBIG('2MRE'),SBIG('CHSP'),
SBIG('JZSP'),SBIG('3ISE'),SBIG('3BSE'),SBIG('3ATB'),
SBIG('3ATA'),SBIG('BTSH'),SBIG('WWSH'),SBIG('TASH'),
SBIG('TGSH'),SBIG('SPSH'),SBIG('FPSH'),SBIG('FFSH'),
SBIG('PSSH'),SBIG('BMSH'),SBIG('BFSH'),SBIG('PBSH'),
SBIG('IBSH'),SBIG('3SVA'),SBIG('3RPR'),SBIG('3MTR'),
SBIG('3PDS'),SBIG('3FLB'),SBIG('3DRN'),SBIG('3MRE'),
SBIG('CHSH'),SBIG('JZSH'),SBIG('5ISE'),SBIG('5BSE'),
SBIG('5ATB'),SBIG('5ATA')
};
static const std::vector<FourCC> SFXTypes =
{
SBIG('DSFX'),SBIG('CSFX'),SBIG('MSFX'),SBIG('GRFX'),
SBIG('ICFX'),SBIG('GOFX'),SBIG('WSFX'),SBIG('WTFX'),
SBIG('2MUD'),SBIG('2LAV'),SBIG('2SAN'),SBIG('2PRJ'),
SBIG('DCFX'),SBIG('DSFX'),SBIG('DSHX'),SBIG('DEFX'),
SBIG('ESFX'),SBIG('SHFX'),SBIG('BEFX'),SBIG('WWFX'),
SBIG('TAFX'),SBIG('GTFX'),SBIG('SPFX'),SBIG('FPFX'),
SBIG('FFFX'),SBIG('PAFX'),SBIG('BMFX'),SBIG('BFFX'),
SBIG('PBFX'),SBIG('IBFX'),SBIG('4SVA'),SBIG('4RPR'),
SBIG('4MTR'),SBIG('4PDS'),SBIG('4FLB'),SBIG('4DRN'),
SBIG('4MRE'),SBIG('CZFX'),SBIG('JZAS'),SBIG('2ISE'),
SBIG('2BSE'),SBIG('2ATB'),SBIG('2ATA'),SBIG('BSFX'),
SBIG('WSFX'),SBIG('TSFX'),SBIG('GSFX'),SBIG('SSFX'),
SBIG('FSFX'),SBIG('SFFX'),SBIG('PSFX'),SBIG('MSFX'),
SBIG('SBFX'),SBIG('PBSX'),SBIG('IBSX'),SBIG('5SVA'),
SBIG('5RPR'),SBIG('5MTR'),SBIG('5PDS'),SBIG('5FLB'),
SBIG('5DRN'),SBIG('5MRE'),SBIG('CSFX'),SBIG('JZPS'),
SBIG('4ISE'),SBIG('4BSE'),SBIG('4ATB'),SBIG('4ATA'),
SBIG('BHFX'),SBIG('WHFX'),SBIG('THFX'),SBIG('GHFX'),
SBIG('SHFX'),SBIG('FHFX'),SBIG('HFFX'),SBIG('PHFX'),
SBIG('MHFX'),SBIG('HBFX'),SBIG('PBHX'),SBIG('IBHX'),
SBIG('6SVA'),SBIG('6RPR'),SBIG('6MTR'),SBIG('6PDS'),
SBIG('6FLB'),SBIG('6DRN'),SBIG('6MRE'),SBIG('CHFX'),
SBIG('JZHS'),SBIG('6ISE'),SBIG('6BSE'),SBIG('6ATB'),
SBIG('6ATA')
SBIG('NSFX'),SBIG('DSFX'),SBIG('CSFX'),SBIG('MSFX'),
SBIG('GRFX'),SBIG('ICFX'),SBIG('GOFX'),SBIG('WSFX'),
SBIG('WTFX'),SBIG('2MUD'),SBIG('2LAV'),SBIG('2SAN'),
SBIG('2PRJ'),SBIG('DCFX'),SBIG('DSFX'),SBIG('DSHX'),
SBIG('DEFX'),SBIG('ESFX'),SBIG('SHFX'),SBIG('BEFX'),
SBIG('WWFX'),SBIG('TAFX'),SBIG('GTFX'),SBIG('SPFX'),
SBIG('FPFX'),SBIG('FFFX'),SBIG('PAFX'),SBIG('BMFX'),
SBIG('BFFX'),SBIG('PBFX'),SBIG('IBFX'),SBIG('4SVA'),
SBIG('4RPR'),SBIG('4MTR'),SBIG('4PDS'),SBIG('4FLB'),
SBIG('4DRN'),SBIG('4MRE'),SBIG('CZFX'),SBIG('JZAS'),
SBIG('2ISE'),SBIG('2BSE'),SBIG('2ATB'),SBIG('2ATA'),
SBIG('BSFX'),SBIG('WSFX'),SBIG('TSFX'),SBIG('GSFX'),
SBIG('SSFX'),SBIG('FSFX'),SBIG('SFFX'),SBIG('PSFX'),
SBIG('MSFX'),SBIG('SBFX'),SBIG('PBSX'),SBIG('IBSX'),
SBIG('5SVA'),SBIG('5RPR'),SBIG('5MTR'),SBIG('5PDS'),
SBIG('5FLB'),SBIG('5DRN'),SBIG('5MRE'),SBIG('CSFX'),
SBIG('JZPS'),SBIG('4ISE'),SBIG('4BSE'),SBIG('4ATB'),
SBIG('4ATA'),SBIG('BHFX'),SBIG('WHFX'),SBIG('THFX'),
SBIG('GHFX'),SBIG('SHFX'),SBIG('FHFX'),SBIG('HFFX'),
SBIG('PHFX'),SBIG('MHFX'),SBIG('HBFX'),SBIG('PBHX'),
SBIG('IBHX'),SBIG('6SVA'),SBIG('6RPR'),SBIG('6MTR'),
SBIG('6PDS'),SBIG('6FLB'),SBIG('6DRN'),SBIG('6MRE'),
SBIG('CHFX'),SBIG('JZHS'),SBIG('6ISE'),SBIG('6BSE'),
SBIG('6ATB'),SBIG('6ATA'),
};
static const std::vector<FourCC> DecalTypes =

View File

@ -113,7 +113,7 @@ CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>&,
x904_loaderFuncs[int(EScriptObjectType::FishCloud)] = ScriptLoader::LoadFishCloud;
x904_loaderFuncs[int(EScriptObjectType::FishCloudModifier)] = ScriptLoader::LoadFishCloudModifier;
x904_loaderFuncs[int(EScriptObjectType::VisorFlare)] = ScriptLoader::LoadVisorFlare;
x904_loaderFuncs[int(EScriptObjectType::WorldTeleporterx52)] = ScriptLoader::LoadWorldTeleporter;
x904_loaderFuncs[int(EScriptObjectType::WorldTeleporter)] = ScriptLoader::LoadWorldTeleporter;
x904_loaderFuncs[int(EScriptObjectType::VisorGoo)] = ScriptLoader::LoadVisorGoo;
x904_loaderFuncs[int(EScriptObjectType::JellyZap)] = ScriptLoader::LoadJellyZap;
x904_loaderFuncs[int(EScriptObjectType::ControllerAction)] = ScriptLoader::LoadControllerAction;
@ -128,7 +128,7 @@ CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>&,
x904_loaderFuncs[int(EScriptObjectType::ThardusRockProjectile)] = ScriptLoader::LoadThardusRockProjectile;
x904_loaderFuncs[int(EScriptObjectType::Midi)] = ScriptLoader::LoadMidi;
x904_loaderFuncs[int(EScriptObjectType::StreamedAudio)] = ScriptLoader::LoadStreamedAudio;
x904_loaderFuncs[int(EScriptObjectType::WorldTeleporterx62)] = ScriptLoader::LoadWorldTeleporter;
x904_loaderFuncs[int(EScriptObjectType::WorldTeleporterToo)] = ScriptLoader::LoadWorldTeleporter;
x904_loaderFuncs[int(EScriptObjectType::Repulsor)] = ScriptLoader::LoadRepulsor;
x904_loaderFuncs[int(EScriptObjectType::GunTurret)] = ScriptLoader::LoadGunTurret;
x904_loaderFuncs[int(EScriptObjectType::FogVolume)] = ScriptLoader::LoadFogVolume;
@ -408,7 +408,7 @@ void CStateManager::InitScriptObjects(std::vector<TEditorId>& ids)
if (id == kInvalidEditorId)
continue;
TUniqueId uid = GetIdForScript(id);
SendScriptMsg(uid, kInvalidUniqueId, EScriptObjectMessage::UNKM15);
SendScriptMsg(uid, kInvalidUniqueId, EScriptObjectMessage::InternalMessage13);
}
MurderScriptInstanceNames();
}

View File

@ -78,7 +78,7 @@ class CStateManager
std::map<TEditorId, SScriptObjectStream> x8a4_loadedScriptObjects;
std::shared_ptr<CPlayerState> x8b8_playerState;
std::shared_ptr<CRelayTracker> x8bc_scriptMailbox;
std::shared_ptr<CRelayTracker> x8bc_relayTracker;
std::shared_ptr<CMapWorldInfo> x8c0_mapWorldInfo;
std::shared_ptr<CWorldTransManager> x8c4_worldTransManager;
@ -206,6 +206,7 @@ public:
void FrameBegin();
void InitializeState(u32, TAreaId, u32);
void CreateStandardGameObjects();
const std::unique_ptr<CObjectList>& GetObjectList() const { return x80c_allObjs; }
CObjectList* ObjectListById(EGameObjectList type);
const CObjectList* GetObjectListById(EGameObjectList type) const;
void RemoveObject(TUniqueId);
@ -244,6 +245,7 @@ public:
CCameraFilterPass& GetCameraFilterPass(int idx) {return xaf8_camFilterPasses[idx];}
CWorld* GetWorld() {return x850_world.get();}
CRelayTracker* GetRelayTracker() { return x8bc_relayTracker.get(); }
std::shared_ptr<CMapWorldInfo> MapWorldInfo() { return x8c0_mapWorldInfo; }
};

View File

@ -8,9 +8,15 @@ namespace urde
enum class EMaterialTypes
{
Zero = 0,
One = 1,
Two = 2,
Three = 3,
Four = 4,
Five = 5,
Six = 6,
Seven = 7,
Eight = 8,
Nine = 9,
Ten = 10,
Eleven = 11,
Twelve = 12,
@ -23,6 +29,8 @@ enum class EMaterialTypes
ThirtyThree = 33,
ThirtyFour = 34,
ThirtySeven = 37,
ThirtyEight = 38,
ThirtyNine = 39,
Fourty = 40,
FourtyOne = 41,
FourtyTwo = 42,

View File

@ -10,61 +10,101 @@
namespace urde
{
static const std::vector<FourCC> SFXTypes =
const EWeaponCollisionResponseTypes CCollisionResponseData::skWorldMaterialTable[32] =
{
SBIG('DSFX'),SBIG('CSFX'),SBIG('MSFX'),SBIG('GRFX'),
SBIG('ICFX'),SBIG('GOFX'),SBIG('WSFX'),SBIG('WTFX'),
SBIG('2MUD'),SBIG('2LAV'),SBIG('2SAN'),SBIG('2PRJ'),
SBIG('DCFX'),SBIG('DSFX'),SBIG('DSHX'),SBIG('DEFX'),
SBIG('ESFX'),SBIG('SHFX'),SBIG('BEFX'),SBIG('WWFX'),
SBIG('TAFX'),SBIG('GTFX'),SBIG('SPFX'),SBIG('FPFX'),
SBIG('FFFX'),SBIG('PAFX'),SBIG('BMFX'),SBIG('BFFX'),
SBIG('PBFX'),SBIG('IBFX'),SBIG('4SVA'),SBIG('4RPR'),
SBIG('4MTR'),SBIG('4PDS'),SBIG('4FLB'),SBIG('4DRN'),
SBIG('4MRE'),SBIG('CZFX'),SBIG('JZAS'),SBIG('2ISE'),
SBIG('2BSE'),SBIG('2ATB'),SBIG('2ATA'),SBIG('BSFX'),
SBIG('WSFX'),SBIG('TSFX'),SBIG('GSFX'),SBIG('SSFX'),
SBIG('FSFX'),SBIG('SFFX'),SBIG('PSFX'),SBIG('MSFX'),
SBIG('SBFX'),SBIG('PBSX'),SBIG('IBSX'),SBIG('5SVA'),
SBIG('5RPR'),SBIG('5MTR'),SBIG('5PDS'),SBIG('5FLB'),
SBIG('5DRN'),SBIG('5MRE'),SBIG('CSFX'),SBIG('JZPS'),
SBIG('4ISE'),SBIG('4BSE'),SBIG('4ATB'),SBIG('4ATA'),
SBIG('BHFX'),SBIG('WHFX'),SBIG('THFX'),SBIG('GHFX'),
SBIG('SHFX'),SBIG('FHFX'),SBIG('HFFX'),SBIG('PHFX'),
SBIG('MHFX'),SBIG('HBFX'),SBIG('PBHX'),SBIG('IBHX'),
SBIG('6SVA'),SBIG('6RPR'),SBIG('6MTR'),SBIG('6PDS'),
SBIG('6FLB'),SBIG('6DRN'),SBIG('6MRE'),SBIG('CHFX'),
SBIG('JZHS'),SBIG('6ISE'),SBIG('6BSE'),SBIG('6ATB'),
SBIG('6ATA')
EWeaponCollisionResponseTypes::Default,
EWeaponCollisionResponseTypes::Unknown2,
EWeaponCollisionResponseTypes::Metal,
EWeaponCollisionResponseTypes::Grass,
EWeaponCollisionResponseTypes::Ice,
EWeaponCollisionResponseTypes::Goo,
EWeaponCollisionResponseTypes::Metal,
EWeaponCollisionResponseTypes::Wood,
EWeaponCollisionResponseTypes::Grass,
EWeaponCollisionResponseTypes::Lava,
EWeaponCollisionResponseTypes::Lava,
EWeaponCollisionResponseTypes::Ice,
EWeaponCollisionResponseTypes::Mud,
EWeaponCollisionResponseTypes::Metal,
EWeaponCollisionResponseTypes::Default,
EWeaponCollisionResponseTypes::Goo,
EWeaponCollisionResponseTypes::Goo,
EWeaponCollisionResponseTypes::Sand,
EWeaponCollisionResponseTypes::Default,
EWeaponCollisionResponseTypes::Default,
EWeaponCollisionResponseTypes::Default,
EWeaponCollisionResponseTypes::Metal,
EWeaponCollisionResponseTypes::Default,
EWeaponCollisionResponseTypes::Default,
EWeaponCollisionResponseTypes::Default,
EWeaponCollisionResponseTypes::Default,
EWeaponCollisionResponseTypes::Default,
EWeaponCollisionResponseTypes::Default,
EWeaponCollisionResponseTypes::Default,
EWeaponCollisionResponseTypes::Default,
EWeaponCollisionResponseTypes::Default,
EWeaponCollisionResponseTypes::Default,
};
static const std::vector<FourCC> GeneratorTypes =
const s32 CCollisionResponseData::kInvalidSFX = -1;
static const std::vector<FourCC> kWCRTSFXIDs =
{
SBIG('DEFS'),SBIG('CRTS'),SBIG('MTLS'),SBIG('GRAS'),
SBIG('ICEE'),SBIG('GOOO'),SBIG('WODS'),SBIG('WATR'),
SBIG('1MUD'),SBIG('1LAV'),SBIG('1SAN'),SBIG('1PRJ'),
SBIG('DCHR'),SBIG('DCHS'),SBIG('DCSH'),SBIG('DENM'),
SBIG('DESP'),SBIG('DESH'),SBIG('BTLE'),SBIG('WASP'),
SBIG('TALP'),SBIG('PTGM'),SBIG('SPIR'),SBIG('FPIR'),
SBIG('FFLE'),SBIG('PARA'),SBIG('BMON'),SBIG('BFLR'),
SBIG('PBOS'),SBIG('IBOS'),SBIG('1SVA'),SBIG('1RPR'),
SBIG('1MTR'),SBIG('1PDS'),SBIG('1FLB'),SBIG('1DRN'),
SBIG('1MRE'),SBIG('CHOZ'),SBIG('JZAP'),SBIG('1ISE'),
SBIG('1BSE'),SBIG('1ATB'),SBIG('1ATA'),SBIG('BTSP'),
SBIG('WWSP'),SBIG('TASP'),SBIG('TGSP'),SBIG('SPSP'),
SBIG('FPSP'),SBIG('FFSP'),SBIG('PSSP'),SBIG('BMSP'),
SBIG('BFSP'),SBIG('PBSP'),SBIG('IBSP'),SBIG('2SVA'),
SBIG('2RPR'),SBIG('2MTR'),SBIG('2PDS'),SBIG('2FLB'),
SBIG('2DRN'),SBIG('2MRE'),SBIG('CHSP'),SBIG('JZSP'),
SBIG('3ISE'),SBIG('3BSE'),SBIG('3ATB'),SBIG('3ATA'),
SBIG('BTSH'),SBIG('WWSH'),SBIG('TASH'),SBIG('TGSH'),
SBIG('SPSH'),SBIG('FPSH'),SBIG('FFSH'),SBIG('PSSH'),
SBIG('BMSH'),SBIG('BFSH'),SBIG('PBSH'),SBIG('IBSH'),
SBIG('3SVA'),SBIG('3RPR'),SBIG('3MTR'),SBIG('3PDS'),
SBIG('3FLB'),SBIG('3DRN'),SBIG('3MRE'),SBIG('CHSH'),
SBIG('JZSH'),SBIG('5ISE'),SBIG('5BSE'),SBIG('5ATB'),
SBIG('5ATA')
SBIG('NSFX'),SBIG('DSFX'),SBIG('CSFX'),SBIG('MSFX'),
SBIG('GRFX'),SBIG('ICFX'),SBIG('GOFX'),SBIG('WSFX'),
SBIG('WTFX'),SBIG('2MUD'),SBIG('2LAV'),SBIG('2SAN'),
SBIG('2PRJ'),SBIG('DCFX'),SBIG('DSFX'),SBIG('DSHX'),
SBIG('DEFX'),SBIG('ESFX'),SBIG('SHFX'),SBIG('BEFX'),
SBIG('WWFX'),SBIG('TAFX'),SBIG('GTFX'),SBIG('SPFX'),
SBIG('FPFX'),SBIG('FFFX'),SBIG('PAFX'),SBIG('BMFX'),
SBIG('BFFX'),SBIG('PBFX'),SBIG('IBFX'),SBIG('4SVA'),
SBIG('4RPR'),SBIG('4MTR'),SBIG('4PDS'),SBIG('4FLB'),
SBIG('4DRN'),SBIG('4MRE'),SBIG('CZFX'),SBIG('JZAS'),
SBIG('2ISE'),SBIG('2BSE'),SBIG('2ATB'),SBIG('2ATA'),
SBIG('BSFX'),SBIG('WSFX'),SBIG('TSFX'),SBIG('GSFX'),
SBIG('SSFX'),SBIG('FSFX'),SBIG('SFFX'),SBIG('PSFX'),
SBIG('MSFX'),SBIG('SBFX'),SBIG('PBSX'),SBIG('IBSX'),
SBIG('5SVA'),SBIG('5RPR'),SBIG('5MTR'),SBIG('5PDS'),
SBIG('5FLB'),SBIG('5DRN'),SBIG('5MRE'),SBIG('CSFX'),
SBIG('JZPS'),SBIG('4ISE'),SBIG('4BSE'),SBIG('4ATB'),
SBIG('4ATA'),SBIG('BHFX'),SBIG('WHFX'),SBIG('THFX'),
SBIG('GHFX'),SBIG('SHFX'),SBIG('FHFX'),SBIG('HFFX'),
SBIG('PHFX'),SBIG('MHFX'),SBIG('HBFX'),SBIG('PBHX'),
SBIG('IBHX'),SBIG('6SVA'),SBIG('6RPR'),SBIG('6MTR'),
SBIG('6PDS'),SBIG('6FLB'),SBIG('6DRN'),SBIG('6MRE'),
SBIG('CHFX'),SBIG('JZHS'),SBIG('6ISE'),SBIG('6BSE'),
SBIG('6ATB'),SBIG('6ATA'),
};
static const std::vector<FourCC> DecalTypes =
static const std::vector<FourCC> kWCRTIDs =
{
SBIG('NODP'),SBIG('DEFS'),SBIG('CRTS'),SBIG('MTLS'),
SBIG('GRAS'),SBIG('ICEE'),SBIG('GOOO'),SBIG('WODS'),
SBIG('WATR'),SBIG('1MUD'),SBIG('1LAV'),SBIG('1SAN'),
SBIG('1PRJ'),SBIG('DCHR'),SBIG('DCHS'),SBIG('DCSH'),
SBIG('DENM'),SBIG('DESP'),SBIG('DESH'),SBIG('BTLE'),
SBIG('WASP'),SBIG('TALP'),SBIG('PTGM'),SBIG('SPIR'),
SBIG('FPIR'),SBIG('FFLE'),SBIG('PARA'),SBIG('BMON'),
SBIG('BFLR'),SBIG('PBOS'),SBIG('IBOS'),SBIG('1SVA'),
SBIG('1RPR'),SBIG('1MTR'),SBIG('1PDS'),SBIG('1FLB'),
SBIG('1DRN'),SBIG('1MRE'),SBIG('CHOZ'),SBIG('JZAP'),
SBIG('1ISE'),SBIG('1BSE'),SBIG('1ATB'),SBIG('1ATA'),
SBIG('BTSP'),SBIG('WWSP'),SBIG('TASP'),SBIG('TGSP'),
SBIG('SPSP'),SBIG('FPSP'),SBIG('FFSP'),SBIG('PSSP'),
SBIG('BMSP'),SBIG('BFSP'),SBIG('PBSP'),SBIG('IBSP'),
SBIG('2SVA'),SBIG('2RPR'),SBIG('2MTR'),SBIG('2PDS'),
SBIG('2FLB'),SBIG('2DRN'),SBIG('2MRE'),SBIG('CHSP'),
SBIG('JZSP'),SBIG('3ISE'),SBIG('3BSE'),SBIG('3ATB'),
SBIG('3ATA'),SBIG('BTSH'),SBIG('WWSH'),SBIG('TASH'),
SBIG('TGSH'),SBIG('SPSH'),SBIG('FPSH'),SBIG('FFSH'),
SBIG('PSSH'),SBIG('BMSH'),SBIG('BFSH'),SBIG('PBSH'),
SBIG('IBSH'),SBIG('3SVA'),SBIG('3RPR'),SBIG('3MTR'),
SBIG('3PDS'),SBIG('3FLB'),SBIG('3DRN'),SBIG('3MRE'),
SBIG('CHSH'),SBIG('JZSH'),SBIG('5ISE'),SBIG('5BSE'),
SBIG('5ATB'),SBIG('5ATA')
};
static const std::vector<FourCC> kWCRTDecalIDs =
{
SBIG('NCDL'),SBIG('DDCL'),SBIG('CODL'),SBIG('MEDL'),
SBIG('GRDL'),SBIG('ICDL'),SBIG('GODL'),SBIG('WODL'),
@ -85,7 +125,7 @@ void CCollisionResponseData::AddParticleSystemToResponse(EWeaponCollisionRespons
bool CCollisionResponseData::CheckAndAddDecalToResponse(FourCC clsId, CInputStream& in, CSimplePool* resPool)
{
int i = 0;
for (const FourCC& type : DecalTypes)
for (const FourCC& type : kWCRTDecalIDs)
{
if (type == clsId)
{
@ -108,7 +148,7 @@ bool CCollisionResponseData::CheckAndAddDecalToResponse(FourCC clsId, CInputStre
bool CCollisionResponseData::CheckAndAddSoundFXToResponse(FourCC clsId, CInputStream& in)
{
int i = 0;
for (const FourCC& type : SFXTypes)
for (const FourCC& type : kWCRTSFXIDs)
{
if (type == clsId)
{
@ -128,7 +168,7 @@ bool CCollisionResponseData::CheckAndAddSoundFXToResponse(FourCC clsId, CInputSt
bool CCollisionResponseData::CheckAndAddParticleSystemToResponse(FourCC clsId, CInputStream& in, CSimplePool* resPool)
{
int i = 0;
for (const FourCC& type : GeneratorTypes)
for (const FourCC& type : kWCRTIDs)
{
if (type == clsId)
{
@ -158,11 +198,11 @@ CCollisionResponseData::CCollisionResponseData(CInputStream& in, CSimplePool* re
x0_generators.resize(94);
x10_sfx.resize(94);
x20_decals.resize(94);
for (ResId& id : x10_sfx)
id = ~0;
for (s32& id : x10_sfx)
id = kInvalidSFX;
FourCC clsId = CPF::GetClassID(in);
if (clsId == SBIG('CRSM'))
if (clsId == UncookedResType())
{
CRandom16 rand{99};
CGlobalRandom gr(rand);
@ -187,6 +227,61 @@ CCollisionResponseData::CCollisionResponseData(CInputStream& in, CSimplePool* re
}
}
const rstl::optional_object<TLockedToken<CGenDescription>>& CCollisionResponseData::GetParticleDescription(EWeaponCollisionResponseTypes type) const
{
return x0_generators[u32(type)];
}
const rstl::optional_object<TLockedToken<CDecalDescription>>& CCollisionResponseData::GetDecalDescription(EWeaponCollisionResponseTypes type) const
{
return x20_decals[u32(type)];
}
s32 CCollisionResponseData::GetSoundEffectId(EWeaponCollisionResponseTypes type) const
{
if (x10_sfx[u32(type)] == kInvalidSFX)
{
if (ResponseTypeIsEnemyNormal(type))
type = EWeaponCollisionResponseTypes::EnemyNormal;
else if (ResponseTypeIsEnemySpecial(type))
type = EWeaponCollisionResponseTypes::EnemySpecial;
else if (ResponseTypeIsEnemyShielded(type))
type = EWeaponCollisionResponseTypes::EnemyShielded;
else
type = EWeaponCollisionResponseTypes::Default;
}
return x10_sfx[u32(type)];
}
EWeaponCollisionResponseTypes CCollisionResponseData::GetWorldCollisionResponseType(s32 id)
{
if (id < 0 || id >= 32)
return EWeaponCollisionResponseTypes::Default;
return skWorldMaterialTable[id];
}
bool CCollisionResponseData::ResponseTypeIsEnemyNormal(EWeaponCollisionResponseTypes type)
{
return (type >= EWeaponCollisionResponseTypes::Unknown19 && type <= EWeaponCollisionResponseTypes::Unknown43);
}
bool CCollisionResponseData::ResponseTypeIsEnemySpecial(EWeaponCollisionResponseTypes type)
{
return (type >= EWeaponCollisionResponseTypes::Unknown44 && type <= EWeaponCollisionResponseTypes::Unknown68);
}
bool CCollisionResponseData::ResponseTypeIsEnemyShielded(EWeaponCollisionResponseTypes type)
{
return (type >= EWeaponCollisionResponseTypes::Unknown69 && type <= EWeaponCollisionResponseTypes::Unknown93);
}
FourCC CCollisionResponseData::UncookedResType()
{
return SBIG('CRSM');
}
CFactoryFnReturn FCollisionResponseDataFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms)
{
CSimplePool* sp = static_cast<CSimplePool*>(static_cast<TObjOwnerParam<IObjectStore*>*>(vparms.GetObj())->GetParam());

View File

@ -2,11 +2,11 @@
#define __URDE_CCOLLISIONRESPONSEDATA_HPP__
#include "RetroTypes.hpp"
#include "Collision/CMaterialList.hpp"
#include "CFactoryMgr.hpp"
#include "IObj.hpp"
#include "CToken.hpp"
#include "IOStreams.hpp"
#include "optional.hpp"
namespace urde
{
@ -16,11 +16,11 @@ class CDecalDescription;
enum class EWeaponCollisionResponseTypes
{
Default, Unknown1, Metal, Grass,
Ice, Goo, Wood, Water,
Mud, Lava, Sand,Unknown11,
None, Default, Unknown2, Metal,
Grass, Ice, Goo, Wood,
Water, Mud, Lava, Sand,
Unknown12,Unknown13,Unknown14,Unknown15,
Unknown16,Unknown17,Unknown18,Unknown19,
EnemyNormal,EnemySpecial,EnemyShielded,Unknown19,
Unknown20,Unknown21,Unknown22,Unknown23,
Unknown24,Unknown25,Unknown26,Unknown27,
Unknown28,Unknown29,Unknown30,Unknown31,
@ -39,15 +39,16 @@ enum class EWeaponCollisionResponseTypes
Unknown80,Unknown81,Unknown82,Unknown83,
Unknown84,Unknown85,Unknown86,Unknown87,
Unknown88,Unknown89,Unknown90,Unknown91,
Unknown92
Unknown92,Unknown93
};
class CCollisionResponseData
{
std::vector<std::experimental::optional<TLockedToken<CGenDescription>>> x0_generators;
std::vector<ResId> x10_sfx;
std::vector<std::experimental::optional<TLockedToken<CDecalDescription>>> x20_decals;
static const EWeaponCollisionResponseTypes skWorldMaterialTable[32];
static const s32 kInvalidSFX;
std::vector<rstl::optional_object<TLockedToken<CGenDescription>>> x0_generators;
std::vector<s32> x10_sfx;
std::vector<rstl::optional_object<TLockedToken<CDecalDescription>>> x20_decals;
float x30_RNGE;
float x34_FOFF;
@ -58,6 +59,16 @@ class CCollisionResponseData
bool CheckAndAddResourceToResponse(FourCC clsId, CInputStream& in, CSimplePool* resPool);
public:
CCollisionResponseData(CInputStream& in, CSimplePool* resPool);
const rstl::optional_object<TLockedToken<CGenDescription>>& GetParticleDescription(EWeaponCollisionResponseTypes) const;
const rstl::optional_object<TLockedToken<CDecalDescription>>& GetDecalDescription(EWeaponCollisionResponseTypes type) const;
s32 GetSoundEffectId(EWeaponCollisionResponseTypes) const;
EWeaponCollisionResponseTypes GetWorldCollisionResponseType(s32);
static bool ResponseTypeIsEnemyShielded(EWeaponCollisionResponseTypes);
static bool ResponseTypeIsEnemyNormal(EWeaponCollisionResponseTypes);
static bool ResponseTypeIsEnemySpecial(EWeaponCollisionResponseTypes);
float GetAudibleRange() const { return x30_RNGE; }
float GetAudibleFallOff() const { return x34_FOFF; }
static FourCC UncookedResType();
};
CFactoryFnReturn FCollisionResponseDataFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms);

View File

@ -41,24 +41,24 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
case EScriptObjectMessage::Decrement:
RemoveEmitter();
break;
case EScriptObjectMessage::UNKM13: // 33
case EScriptObjectMessage::InternalMessage11: // 33
{
/* TODO: What's x98_?
if (x98_)
/*
if (x94_simpleShadow)
AddMaterial(EMaterialTypes::ThirtyNine, mgr);
else
RemoveMaterial(EMaterialTypes::ThirtyNine, mgr);
*/
/*
if (HasModelData() && x64_modelData->AnimationData())
{
TAreaId aid = GetCurrentAreaId();
x64_modelData->AnimationData()->sub_8002AE6C(mgr, aid, x64_modelData->x0_particleScale);
TAreaId aid = GetAreaId();
//x64_modelData->AnimationData()->sub_8002AE6C(mgr, aid, x64_modelData->x0_particleScale);
}
*/
}
break;
case EScriptObjectMessage::UNKM14: // 34
case EScriptObjectMessage::InternalMessage13: // 34
{
RemoveEmitter();
/* TODO: Not sure about this
@ -67,7 +67,7 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
*/
}
break;
case EScriptObjectMessage::UNKM15: // 35
case EScriptObjectMessage::InternalMessage14: // 35
{
for (const SConnection& conn : x20_conns)
{
@ -80,10 +80,10 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
}
}
break;
case EScriptObjectMessage::UNKM17: // 37
case EScriptObjectMessage::InternalMessage16: // 37
SetInFluid(true, uid);
break;
case EScriptObjectMessage::UNKM19: // 39
case EScriptObjectMessage::InternalMessage18: // 39
SetInFluid(false, kInvalidUniqueId);
break;
default:break;

View File

@ -63,7 +63,7 @@ public:
x30_24_active ^= 1;
}
TAreaId GetCurrentAreaId() const
TAreaId GetAreaId() const
{
if (x30_27_)
return x4_areaId;

View File

@ -119,7 +119,7 @@ void CScriptCoverPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid,
{
CActor::AcceptScriptMsg(msg, uid, mgr);
if (msg == EScriptObjectMessage::UNKM15)
if (msg == EScriptObjectMessage::InternalMessage14)
{
for (const SConnection& con : x20_conns)
if (con.x0_state == EScriptObjectState::Retreat)

View File

@ -1,4 +1,6 @@
#include "CScriptMemoryRelay.hpp"
#include "CStateManager.hpp"
#include "CRelayTracker.hpp"
namespace urde
{
@ -7,8 +9,30 @@ CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, const std::string& name, c
: CEntity(uid, info, true, name),
x34_24_(b1),
x34_25_(b2),
x34_26_(b3)
x34_26_ignoreMessages(b3)
{
}
void CScriptMemoryRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr)
{
if (x34_26_ignoreMessages)
return;
if (msg == EScriptObjectMessage::Deactivate)
{
stateMgr.GetRelayTracker()->RemoveRelay(xc_editorId);
return;
}
else if (msg == EScriptObjectMessage::Activate)
{
stateMgr.GetRelayTracker()->AddRelay(xc_editorId);
if (x34_25_)
return;
SendScriptMsgs(EScriptObjectState::Active, stateMgr, EScriptObjectMessage::None);
return;
}
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
}
}

View File

@ -13,12 +13,13 @@ class CScriptMemoryRelay : public CEntity
{
bool x34_24_;
bool x34_25_;
bool x34_26_;
bool x34_26_ignoreMessages;
};
u8 dummy = 0;
};
public:
CScriptMemoryRelay(TUniqueId, const std::string& name, const CEntityInfo&, bool, bool, bool);
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr);
};
}

View File

@ -1,4 +1,5 @@
#include "CScriptRandomRelay.hpp"
#include "CStateManager.hpp"
namespace urde
{
@ -10,4 +11,33 @@ CScriptRandomRelay::CScriptRandomRelay(TUniqueId uid, const std::string& name, c
x3c_clamp(clamp)
{
}
void CScriptRandomRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
{
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
if (msg == EScriptObjectMessage::SetToZero)
{
if (!x30_24_active)
return;
SendLocalScriptMsgs(EScriptObjectState::Zero, stateMgr);
}
}
void CScriptRandomRelay::SendLocalScriptMsgs(EScriptObjectState state, CStateManager &stateMgr)
{
if (state != EScriptObjectState::Zero)
{
SendScriptMsgs(state, stateMgr, EScriptObjectMessage::None);
return;
}
#if 0
std::vector<std::pair<CEntity*, EScriptObjectMessage>> objs;
objs.reserve(10);
for (SConnection& conn : x20_conns)
{
const std::unique_ptr<CObjectList>& objList = stateMgr.GetObjectList();
}
#endif
}
}

View File

@ -12,6 +12,9 @@ class CScriptRandomRelay : public CEntity
bool x3c_clamp;
public:
CScriptRandomRelay(TUniqueId, const std::string&, const CEntityInfo&, s32, s32, bool, bool);
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr);
void SendLocalScriptMsgs(EScriptObjectState state, CStateManager& stateMgr);
};
}

View File

@ -8,4 +8,9 @@ CScriptRelay::CScriptRelay(TUniqueId uid, const std::string& name, const CEntity
{
}
void CScriptRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr)
{
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
}
}

View File

@ -11,6 +11,8 @@ class CScriptRelay : public CEntity
u32 x38_ = 0;
public:
CScriptRelay(TUniqueId, const std::string&, const CEntityInfo&, bool);
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr);
};
}

View File

@ -79,7 +79,7 @@ enum class EScriptObjectType
FishCloud = 0x4F,
FishCloudModifier = 0x50,
VisorFlare = 0x51,
WorldTeleporterx52 = 0x52,
WorldTeleporter = 0x52,
VisorGoo = 0x53,
JellyZap = 0x54,
ControllerAction = 0x55,
@ -94,7 +94,7 @@ enum class EScriptObjectType
ThardusRockProjectile = 0x5F,
Midi = 0x60,
StreamedAudio = 0x61,
WorldTeleporterx62 = 0x62,
WorldTeleporterToo = 0x62,
Repulsor = 0x63,
GunTurret = 0x64,
FogVolume = 0x65,
@ -199,24 +199,24 @@ enum class EScriptObjectMessage
Action,
Play,
Alert,
UNKM4,
UNKM5,
UNKM6,
UNKM7,
UNKM8,
UNKM9,
UNKM10,
UNKM11,
UNKM12,
ObjectAdded,
DeleteRequested,
UNKM13,
UNKM14,
UNKM15,
UNKM16,
UNKM17,
UNKM18,
UNKM19
InternalMessage00,
InternalMessage01,
InternalMessage02,
InternalMessage03,
InternalMessage04,
InternalMessage05,
InternalMessage06,
InternalMessage07,
InternalMessage08,
InternalMessage09,
InternalMessage10,
InternalMessage11,
InternalMessage13,
InternalMessage14,
InternalMessage15,
InternalMessage16,
InternalMessage17,
InternalMessage18
};
}