1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 11:29:59 +00:00

Merge pull request #948 from Sergeanur/lcsPR/CutsceneMgr

CutsceneMgr done + use original VB audio + make interiors visible + use hashed model info names a bit
This commit is contained in:
Sergeanur 2021-01-12 13:22:44 +02:00 committed by GitHub
commit 8888ee3974
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 1590 additions and 3128 deletions

View file

@ -14,6 +14,7 @@
#include "RpAnimBlend.h"
#include "AnimBlendAssociation.h"
#include "AnimBlendAssocGroup.h"
#include "KeyGen.h"
//--MIAMI: file done
@ -109,27 +110,34 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
}
}
extern const char* csPlayerNames[];
extern const char* playerNames[];
CBaseModelInfo*
GetModelFromName(const char *name)
{
int i;
CBaseModelInfo* mi;
char playername[32];
if(strncasecmp(name, "CSplay", 6) == 0 &&
strncasecmp(CModelInfo::GetModelInfo(MI_PLAYER)->GetModelName(), "ig", 2) == 0){
strcpy(playername, CModelInfo::GetModelInfo(MI_PLAYER)->GetModelName());
playername[0] = 'C';
playername[1] = 'S';
name = playername;
if (CKeyGen::GetUppercaseKey(name) == CKeyGen::GetUppercaseKey("cstoni_a")) {
i = 0;
while (csPlayerNames[i][0] != '\0') {
if (CModelInfo::GetModelInfo(0)->GetNameHashKey() == CKeyGen::GetUppercaseKey(playerNames[i])) {
name = csPlayerNames[i];
break;
}
i++;
}
}
uint32 hashKey = CKeyGen::GetUppercaseKey(name);
for (i = 0; i < MODELINFOSIZE; i++) {
mi = CModelInfo::GetModelInfo(i);
if(mi && mi->GetRwObject() && RwObjectGetType(mi->GetRwObject()) == rpCLUMP &&
strcmpIgnoringDigits(mi->GetModelName(), name))
if (mi && mi->GetRwObject()
&& RwObjectGetType(mi->GetRwObject()) == rpCLUMP &&
hashKey == mi->GetNameHashKey())
return mi;
}
return nil;
}
@ -183,3 +191,45 @@ CAnimBlendAssocGroup::CreateAssociations(const char *blockName, RpClump *clump,
}
numAssociations = numAssocs;
}
void
CAnimBlendAssocGroup::CreateAssociations(const char *blockName, const char *animNames, const char *objectNames, int numChars)
{
if (!objectNames) {
CreateAssociations(blockName);
return;
}
if (assocList)
DestroyAssociations();
animBlock = CAnimManager::GetAnimationBlock(blockName);
assocList = new CAnimBlendAssociation[animBlock->numAnims];
numAssociations = 0;
if (animBlock->numAnims > 0)
{
int i, j;
for (i = 0; i < animBlock->numAnims; i++) {
int animId = -1;
for (j = 0; j != animBlock->numAnims; j++)
if (strcmp(CAnimManager::GetAnimation(i + animBlock->firstIndex)->name, animNames + numChars * j) == 0)
animId = j;
if (animId != -1) {
CBaseModelInfo* minfo = GetModelFromName(objectNames + numChars * animId);
if (minfo)
{
RpClump* clump = (RpClump*)minfo->CreateInstance();
RpAnimBlendClumpInit(clump);
assocList[numAssociations].Init(clump, CAnimManager::GetAnimation(i + animBlock->firstIndex));
if (IsClumpSkinned(clump))
RpClumpForAllAtomics(clump, AtomicRemoveAnimFromSkinCB, nil);
RpClumpDestroy(clump);
assocList[numAssociations].animId = i + numAssociations;
assocList[numAssociations++].groupId = groupId;
}
}
}
}
}

View file

@ -21,4 +21,5 @@ public:
CAnimBlendAssociation *CopyAnimation(const char *name);
void CreateAssociations(const char *name);
void CreateAssociations(const char *blockName, RpClump *clump, const char **animNames, int numAssocs);
void CreateAssociations(const char *blockName, const char *animNames, const char *objectNames, int numChars);
};

View file

@ -22,156 +22,56 @@
#include "ColStore.h"
#include "Radar.h"
#include "Pools.h"
#include "crossplatform.h"
//--MIAMI: file done
const struct {
const char *szTrackName;
int iTrackId;
} musicNameIdAssoc[] = {
{ "ASS_1", STREAMED_SOUND_CUTSCENE_ASS_1 },
{ "ASS_2", STREAMED_SOUND_CUTSCENE_ASS_2 },
{ "BANK_1", STREAMED_SOUND_CUTSCENE_BANK_1 },
{ "BANK_2A", STREAMED_SOUND_CUTSCENE_BANK_2A },
{ "BANK_2B", STREAMED_SOUND_CUTSCENE_BANK_2B },
{ "BANK_3A", STREAMED_SOUND_CUTSCENE_BANK_3A },
{ "BANK_3B", STREAMED_SOUND_CUTSCENE_BANK_3B },
{ "BANK_4", STREAMED_SOUND_CUTSCENE_BANK_4 },
{ "BIKE_1", STREAMED_SOUND_CUTSCENE_BIKE_1 },
{ "BIKE_2", STREAMED_SOUND_CUTSCENE_BIKE_2 },
{ "BIKE_3", STREAMED_SOUND_CUTSCENE_BIKE_3 },
{ "BUD_1", STREAMED_SOUND_CUTSCENE_BUD_1 },
{ "BUD_2", STREAMED_SOUND_CUTSCENE_BUD_2 },
{ "BUD_3", STREAMED_SOUND_CUTSCENE_BUD_3 },
{ "CAP_1", STREAMED_SOUND_CUTSCENE_CAP_1 },
{ "CAR_1", STREAMED_SOUND_CUTSCENE_CAR_1 },
{ "CNT_1A", STREAMED_SOUND_CUTSCENE_CNT_1A },
{ "CNT_1B", STREAMED_SOUND_CUTSCENE_CNT_1B },
{ "CNT_2", STREAMED_SOUND_CUTSCENE_CNT_2 },
{ "COK_1", STREAMED_SOUND_CUTSCENE_COK_1 },
{ "COK_2A", STREAMED_SOUND_CUTSCENE_COK_2A },
{ "COK_2B", STREAMED_SOUND_CUTSCENE_COK_2B },
{ "COK_3", STREAMED_SOUND_CUTSCENE_COK_3 },
{ "COK_4A", STREAMED_SOUND_CUTSCENE_COK_4A },
{ "COK_4A2", STREAMED_SOUND_CUTSCENE_COK_4A2 },
{ "COK_4B", STREAMED_SOUND_CUTSCENE_COK_4B },
{ "COL_1", STREAMED_SOUND_CUTSCENE_COL_1 },
{ "COL_2", STREAMED_SOUND_CUTSCENE_COL_2 },
{ "COL_3A", STREAMED_SOUND_CUTSCENE_COL_3A },
{ "COL_4A", STREAMED_SOUND_CUTSCENE_COL_4A },
{ "COL_5A", STREAMED_SOUND_CUTSCENE_COL_5A },
{ "COL_5B", STREAMED_SOUND_CUTSCENE_COL_5B },
{ "CUB_1", STREAMED_SOUND_CUTSCENE_CUB_1 },
{ "CUB_2", STREAMED_SOUND_CUTSCENE_CUB_2 },
{ "CUB_3", STREAMED_SOUND_CUTSCENE_CUB_3 },
{ "CUB_4", STREAMED_SOUND_CUTSCENE_CUB_4 },
{ "DRUG_1", STREAMED_SOUND_CUTSCENE_DRUG_1 },
{ "FIN", STREAMED_SOUND_CUTSCENE_FIN },
{ "FIN_2", STREAMED_SOUND_CUTSCENE_FIN2 },
{ "FINALE", STREAMED_SOUND_CUTSCENE_FINALE },
{ "HAT_1", STREAMED_SOUND_CUTSCENE_HAT_1 },
{ "HAT_2", STREAMED_SOUND_CUTSCENE_HAT_2 },
{ "HAT_3", STREAMED_SOUND_CUTSCENE_HAT_3 },
{ "ICE_1", STREAMED_SOUND_CUTSCENE_ICE_1 },
{ "INT_A", STREAMED_SOUND_CUTSCENE_INT_A },
{ "INT_B", STREAMED_SOUND_CUTSCENE_INT_B },
{ "INT_D", STREAMED_SOUND_CUTSCENE_INT_D },
{ "INT_M", STREAMED_SOUND_CUTSCENE_INT_M },
{ "LAW_1A", STREAMED_SOUND_CUTSCENE_LAW_1A },
{ "LAW_1B", STREAMED_SOUND_CUTSCENE_LAW_1B },
{ "LAW_2A", STREAMED_SOUND_CUTSCENE_LAW_2A },
{ "LAW_2B", STREAMED_SOUND_CUTSCENE_LAW_2B },
{ "LAW_2C", STREAMED_SOUND_CUTSCENE_LAW_2C },
{ "LAW_3", STREAMED_SOUND_CUTSCENE_LAW_3 },
{ "LAW_4", STREAMED_SOUND_CUTSCENE_LAW_4 },
{ "PHIL_1", STREAMED_SOUND_CUTSCENE_PHIL_1 },
{ "PHIL_2", STREAMED_SOUND_CUTSCENE_PHIL_2 },
{ "PORN_1", STREAMED_SOUND_CUTSCENE_PORN_1 },
{ "PORN_2", STREAMED_SOUND_CUTSCENE_PORN_2 },
{ "PORN_3", STREAMED_SOUND_CUTSCENE_PORN_3 },
{ "PORN_4", STREAMED_SOUND_CUTSCENE_PORN_4 },
{ "RESC_1A", STREAMED_SOUND_CUTSCENE_RESC_1A },
{ "ROK_1", STREAMED_SOUND_CUTSCENE_ROK_1 },
{ "ROK_2", STREAMED_SOUND_CUTSCENE_ROK_2 },
{ "ROK_3A", STREAMED_SOUND_CUTSCENE_ROK_3A },
{ "STRIPA", STREAMED_SOUND_CUTSCENE_STRIPA },
{ "TAX_1", STREAMED_SOUND_CUTSCENE_TAX_1 },
{ "TEX_1", STREAMED_SOUND_CUTSCENE_TEX_1 },
{ "TEX_2", STREAMED_SOUND_CUTSCENE_TEX_2 },
{ "TEX_3", STREAMED_SOUND_CUTSCENE_TEX_3 },
{ "GSPOT", STREAMED_SOUND_CUTSCENE_GLIGHT },
{ "FIST", STREAMED_SOUND_CUTSCENE_FIST },
{ "EL_PH1", STREAMED_SOUND_CUTSCENE_ELBURRO1_PH1 },
{ "EL_PH2", STREAMED_SOUND_CUTSCENE_ELBURRO2_PH2 },
{ NULL, 0 }
};
static bool bModelsRemovedForCutscene;
static int32 NumberOfSavedWeapons;
static eWeaponType SavedWeaponIDs[TOTAL_WEAPON_SLOTS];
static int32 SavedWeaponAmmo[TOTAL_WEAPON_SLOTS];
int
FindCutsceneAudioTrackId(const char *szCutsceneName)
{
for (int i = 0; musicNameIdAssoc[i].szTrackName; i++) {
if (!CGeneral::faststricmp(musicNameIdAssoc[i].szTrackName, szCutsceneName))
return musicNameIdAssoc[i].iTrackId;
}
return -1;
}
bool CCutsceneMgr::ms_running;
bool CCutsceneMgr::ms_cutsceneProcessing;
char CCutsceneMgr::ms_cAppendAnimName[NUMCUTSCENEOBJECTS][NAMELENGTH];
char CCutsceneMgr::ms_cAppendObjectName[NUMCUTSCENEOBJECTS][NAMELENGTH];
int CCutsceneMgr::ms_numAppendObjectNames;
CDirectory *CCutsceneMgr::ms_pCutsceneDir;
CCutsceneObject *CCutsceneMgr::ms_pCutsceneObjects[NUMCUTSCENEOBJECTS];
int32 CCutsceneMgr::ms_numCutsceneObjs;
bool CCutsceneMgr::ms_loaded;
bool CCutsceneMgr::ms_animLoaded;
bool CCutsceneMgr::ms_useLodMultiplier;
char CCutsceneMgr::ms_cutsceneName[CUTSCENENAMESIZE];
CAnimBlendAssocGroup CCutsceneMgr::ms_cutsceneAssociations;
CVector CCutsceneMgr::ms_cutsceneOffset;
float CCutsceneMgr::ms_cutsceneTimer;
bool CCutsceneMgr::ms_hasFileInfo;
bool CCutsceneMgr::ms_wasCutsceneSkipped;
bool CCutsceneMgr::ms_useLodMultiplier;
bool CCutsceneMgr::ms_cutsceneProcessing;
bool CCutsceneMgr::ms_running;
bool CCutsceneMgr::ms_animLoaded;
uint32 CCutsceneMgr::ms_cutsceneLoadStatus;
bool CCutsceneMgr::ms_useCutsceneShadows = true;
bool bCamLoaded;
bool bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver; // pls don't shrink the name :P
int32 NumberOfSavedWeapons;
eWeaponType SavedWeaponIDs[TOTAL_WEAPON_SLOTS];
int32 SavedWeaponAmmo[TOTAL_WEAPON_SLOTS];
char uncompressedAnims[8][32];
uint32 numUncompressedAnims;
RpAtomic *
CalculateBoundingSphereRadiusCB(RpAtomic *atomic, void *data)
{
float radius = RpAtomicGetBoundingSphere(atomic)->radius;
RwV3d center = RpAtomicGetBoundingSphere(atomic)->center;
for (RwFrame *frame = RpAtomicGetFrame(atomic); RwFrameGetParent(frame); frame = RwFrameGetParent(frame))
RwV3dTransformPoints(&center, &center, 1, RwFrameGetMatrix(frame));
float size = RwV3dLength(&center) + radius;
if (size > *(float *)data)
*(float *)data = size;
return atomic;
}
void
CCutsceneMgr::Initialise(void)
CCutsceneMgr::Initialise(void *dir)
{
ms_numCutsceneObjs = 0;
ms_loaded = false;
ms_wasCutsceneSkipped = false;
ms_cutsceneLoadStatus = CUTSCENE_NOT_LOADED;
ms_running = false;
ms_useLodMultiplier = false;
ms_animLoaded = false;
ms_cutsceneProcessing = false;
ms_useLodMultiplier = false;
ms_wasCutsceneSkipped = false;
ms_hasFileInfo = false;
//ms_numCutsceneObjs = 0;
//ms_loaded = false;
if (gMakeResources) {
ms_pCutsceneDir = new CDirectory(CUTSCENEDIRSIZE);
ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR");
}
else
ms_pCutsceneDir = (CDirectory*)dir;
numUncompressedAnims = 0;
uncompressedAnims[0][0] = '\0';
//numUncompressedAnims = 0;
//uncompressedAnims[0][0] = '\0';
}
void CCutsceneMgr::Write(base::cRelocatableChunkWriter& writer)
{
writer.AllocateRaw(ms_pCutsceneDir, sizeof(*ms_pCutsceneDir), 4, false, true);
writer.AllocateRaw(ms_pCutsceneDir->entries, sizeof(CDirectory::DirectoryInfo) * ms_pCutsceneDir->numEntries, 4, false, true);
writer.AddPatch(ms_pCutsceneDir);
}
void
@ -183,433 +83,25 @@ CCutsceneMgr::Shutdown(void)
void
CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
{
int file;
uint32 size;
uint32 offset;
CPlayerPed *pPlayerPed;
ms_cutsceneProcessing = true;
ms_wasCutsceneSkipped = false;
CTimer::Suspend();
if (!bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver)
CStreaming::RemoveCurrentZonesModels();
ms_pCutsceneDir->numEntries = 0;
ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR");
CStreaming::RemoveUnusedModelsInLoadedList();
CGame::DrasticTidyUpMemory(true);
strcpy(ms_cutsceneName, szCutsceneName);
RwStream *stream;
stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "ANIM\\CUTS.IMG");
assert(stream);
// Load animations
sprintf(gString, "%s.IFP", szCutsceneName);
if (ms_pCutsceneDir->FindItem(gString, offset, size)) {
CStreaming::MakeSpaceFor(size << 11);
CStreaming::ImGonnaUseStreamingMemory();
RwStreamSkip(stream, offset << 11);
CAnimManager::LoadAnimFile(stream, true, uncompressedAnims);
ms_cutsceneAssociations.CreateAssociations(szCutsceneName);
CStreaming::IHaveUsedStreamingMemory();
ms_animLoaded = true;
} else {
ms_animLoaded = false;
}
RwStreamClose(stream, nil);
// Load camera data
file = CFileMgr::OpenFile("ANIM\\CUTS.IMG", "rb");
sprintf(gString, "%s.DAT", szCutsceneName);
if (ms_pCutsceneDir->FindItem(gString, offset, size)) {
CStreaming::ImGonnaUseStreamingMemory();
CFileMgr::Seek(file, offset << 11, SEEK_SET);
TheCamera.LoadPathSplines(file);
CStreaming::IHaveUsedStreamingMemory();
bCamLoaded = true;
} else {
bCamLoaded = false;
}
CFileMgr::CloseFile(file);
if (CGeneral::faststricmp(ms_cutsceneName, "finale")) {
DMAudio.ChangeMusicMode(MUSICMODE_CUTSCENE);
int trackId = FindCutsceneAudioTrackId(szCutsceneName);
if (trackId != -1) {
printf("Start preload audio %s\n", szCutsceneName);
DMAudio.PreloadCutSceneMusic(trackId);
printf("End preload audio %s\n", szCutsceneName);
}
}
ms_cutsceneTimer = 0.0f;
ms_loaded = true;
ms_cutsceneOffset = CVector(0.0f, 0.0f, 0.0f);
pPlayerPed = FindPlayerPed();
pPlayerPed->m_pWanted->ClearQdCrimes();
pPlayerPed->bIsVisible = false;
pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina;
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CUTSCENE);
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(true);
CTimer::Resume();
}
void
CCutsceneMgr::FinishCutscene()
{
ms_wasCutsceneSkipped = true;
if (bCamLoaded) {
CCutsceneMgr::ms_cutsceneTimer = TheCamera.GetCutSceneFinishTime() * 0.001f;
TheCamera.FinishCutscene();
}
FindPlayerPed()->bIsVisible = true;
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
}
void
CCutsceneMgr::SetupCutsceneToStart(void)
{
if (bCamLoaded) {
TheCamera.SetCamCutSceneOffSet(ms_cutsceneOffset);
TheCamera.TakeControlWithSpline(JUMP_CUT);
TheCamera.SetWideScreenOn();
}
ms_cutsceneOffset.z++;
for (int i = ms_numCutsceneObjs - 1; i >= 0; i--) {
assert(RwObjectGetType(ms_pCutsceneObjects[i]->m_rwObject) == rpCLUMP);
if (CAnimBlendAssociation *pAnimBlendAssoc = RpAnimBlendClumpGetFirstAssociation((RpClump*)ms_pCutsceneObjects[i]->m_rwObject)) {
assert(pAnimBlendAssoc->hierarchy->sequences[0].HasTranslation());
if (ms_pCutsceneObjects[i]->m_pAttachTo != nil) {
pAnimBlendAssoc->flags &= (~ASSOC_HAS_TRANSLATION);
} else {
if (pAnimBlendAssoc->hierarchy->IsCompressed()){
KeyFrameTransCompressed *keyFrames = ((KeyFrameTransCompressed*)pAnimBlendAssoc->hierarchy->sequences[0].GetKeyFrameCompressed(0));
CVector trans;
keyFrames->GetTranslation(&trans);
ms_pCutsceneObjects[i]->SetPosition(ms_cutsceneOffset + trans);
}else{
KeyFrameTrans *keyFrames = ((KeyFrameTrans*)pAnimBlendAssoc->hierarchy->sequences[0].GetKeyFrame(0));
ms_pCutsceneObjects[i]->SetPosition(ms_cutsceneOffset + keyFrames->translation);
}
}
pAnimBlendAssoc->SetRun();
} else {
ms_pCutsceneObjects[i]->SetPosition(ms_cutsceneOffset);
}
CWorld::Add(ms_pCutsceneObjects[i]);
if (RwObjectGetType(ms_pCutsceneObjects[i]->m_rwObject) == rpCLUMP) {
ms_pCutsceneObjects[i]->UpdateRpHAnim();
}
}
CTimer::Update();
CTimer::Update();
ms_running = true;
ms_cutsceneTimer = 0.0f;
}
void
CCutsceneMgr::SetCutsceneAnim(const char *animName, CObject *pObject)
{
CAnimBlendAssociation *pNewAnim;
CAnimBlendClumpData *pAnimBlendClumpData;
assert(RwObjectGetType(pObject->m_rwObject) == rpCLUMP);
debug("Give cutscene anim %s\n", animName);
RpAnimBlendClumpRemoveAllAssociations((RpClump*)pObject->m_rwObject);
pNewAnim = ms_cutsceneAssociations.GetAnimation(animName);
if (!pNewAnim) {
debug("\n\nHaven't I told you I can't find the fucking animation %s\n\n\n", animName);
return;
}
if (pNewAnim->hierarchy->IsCompressed())
pNewAnim->hierarchy->keepCompressed = true;
CStreaming::ImGonnaUseStreamingMemory();
pNewAnim = ms_cutsceneAssociations.CopyAnimation(animName);
CStreaming::IHaveUsedStreamingMemory();
pNewAnim->SetCurrentTime(0.0f);
pNewAnim->flags |= ASSOC_HAS_TRANSLATION;
pNewAnim->flags &= ~ASSOC_RUNNING;
pAnimBlendClumpData = *RPANIMBLENDCLUMPDATA(pObject->m_rwObject);
pAnimBlendClumpData->link.Prepend(&pNewAnim->link);
if (pNewAnim->hierarchy->keepCompressed)
pAnimBlendClumpData->frames->flag |= AnimBlendFrameData::COMPRESSED;
}
void
CCutsceneMgr::SetCutsceneAnimToLoop(const char* animName)
{
ms_cutsceneAssociations.GetAnimation(animName)->flags |= ASSOC_REPEAT;
}
CCutsceneHead *
CCutsceneMgr::AddCutsceneHead(CObject *pObject, int modelId)
{
return nil;
}
void UpdateCutsceneObjectBoundingBox(RpClump* clump, int modelId)
{
if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ05) {
CColModel* pColModel = &CTempColModels::ms_colModelCutObj[modelId - MI_CUTOBJ01];
float radius = 0.0f;
RpClumpForAllAtomics(clump, CalculateBoundingSphereRadiusCB, &radius);
pColModel->boundingSphere.radius = radius;
pColModel->boundingBox.min = CVector(-radius, -radius, -radius);
pColModel->boundingBox.max = CVector(radius, radius, radius);
}
}
CCutsceneObject *
CCutsceneMgr::CreateCutsceneObject(int modelId)
{
CBaseModelInfo *pModelInfo;
CColModel *pColModel;
CCutsceneObject *pCutsceneObject;
CStreaming::ImGonnaUseStreamingMemory();
debug("Created cutscene object %s\n", CModelInfo::GetModelInfo(modelId)->GetModelName());
if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ05) {
pModelInfo = CModelInfo::GetModelInfo(modelId);
pColModel = &CTempColModels::ms_colModelCutObj[modelId - MI_CUTOBJ01];
pModelInfo->SetColModel(pColModel);
UpdateCutsceneObjectBoundingBox((RpClump*)pModelInfo->GetRwObject(), modelId);
} else if (modelId >= MI_SPECIAL01 && modelId <= MI_SPECIAL21) {
pModelInfo = CModelInfo::GetModelInfo(modelId);
if (pModelInfo->GetColModel() == &CTempColModels::ms_colModelPed1) {
CColModel *colModel = new CColModel();
colModel->boundingSphere.radius = 2.0f;
colModel->boundingSphere.center = CVector(0.0f, 0.0f, 0.0f);
pModelInfo->SetColModel(colModel, true);
}
pColModel = pModelInfo->GetColModel();
float radius = 2.0f;
pColModel->boundingSphere.radius = radius;
pColModel->boundingBox.min = CVector(-radius, -radius, -radius);
pColModel->boundingBox.max = CVector(radius, radius, radius);
}
pCutsceneObject = new CCutsceneObject();
pCutsceneObject->SetModelIndex(modelId);
if (ms_useCutsceneShadows)
pCutsceneObject->CreateShadow();
ms_pCutsceneObjects[ms_numCutsceneObjs++] = pCutsceneObject;
CStreaming::IHaveUsedStreamingMemory();
return pCutsceneObject;
LoadCutsceneData_overlay(szCutsceneName);
}
void
CCutsceneMgr::DeleteCutsceneData(void)
{
if (!ms_loaded) return;
CTimer::Suspend();
ms_cutsceneProcessing = false;
ms_useLodMultiplier = false;
ms_useCutsceneShadows = true;
for (--ms_numCutsceneObjs; ms_numCutsceneObjs >= 0; ms_numCutsceneObjs--) {
CWorld::Remove(ms_pCutsceneObjects[ms_numCutsceneObjs]);
ms_pCutsceneObjects[ms_numCutsceneObjs]->DeleteRwObject();
delete ms_pCutsceneObjects[ms_numCutsceneObjs];
ms_pCutsceneObjects[ms_numCutsceneObjs] = nil;
}
ms_numCutsceneObjs = 0;
/* TODO!!! tmp hack
for (int i = MI_SPECIAL01; i < MI_SPECIAL21; i++) {
CBaseModelInfo *minfo = CModelInfo::GetModelInfo(i);
CColModel *colModel = minfo->GetColModel();
if (colModel != &CTempColModels::ms_colModelPed1) {
delete colModel;
minfo->SetColModel(&CTempColModels::ms_colModelPed1);
}
}
*/
if (ms_animLoaded)
CAnimManager::RemoveLastAnimFile();
ms_animLoaded = false;
numUncompressedAnims = 0;
uncompressedAnims[0][0] = '\0';
if (bCamLoaded) {
TheCamera.RestoreWithJumpCut();
TheCamera.SetWideScreenOff();
TheCamera.DeleteCutSceneCamDataMemory();
}
ms_running = false;
ms_loaded = false;
FindPlayerPed()->bIsVisible = true;
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CUTSCENE);
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
if (CGeneral::faststricmp(ms_cutsceneName, "finale")) {
DMAudio.StopCutSceneMusic();
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
}
CStreaming::ms_disableStreaming = false;
CWorld::bProcessCutsceneOnly = false;
if(bCamLoaded)
CGame::DrasticTidyUpMemory(TheCamera.GetScreenFadeStatus() == FADE_2);
CPad::GetPad(0)->Clear(false);
if (bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver) {
CStreaming::LoadInitialPeds();
CStreaming::LoadInitialWeapons();
CStreaming::LoadInitialVehicles();
bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver = false;
CPlayerPed *pPlayerPed = FindPlayerPed();
for (int i = 0; i < NumberOfSavedWeapons; i++) {
int32 weaponModelId = CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModelId;
uint8 flags = CStreaming::ms_aInfoForModel[weaponModelId].m_flags;
CStreaming::RequestModel(weaponModelId, STREAMFLAGS_DONT_REMOVE);
CStreaming::LoadAllRequestedModels(false);
if (CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModel2Id != -1) {
CStreaming::RequestModel(CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModel2Id, 0);
CStreaming::LoadAllRequestedModels(false);
}
if (!(flags & STREAMFLAGS_DONT_REMOVE))
CStreaming::SetModelIsDeletable(weaponModelId);
pPlayerPed->GiveWeapon(SavedWeaponIDs[i], SavedWeaponAmmo[i], true);
}
NumberOfSavedWeapons = 0;
}
CTimer::Resume();
DeleteCutsceneData_overlay();
if (bModelsRemovedForCutscene)
LoadEverythingBecauseCutsceneDeletedAllOfIt();
}
void
CCutsceneMgr::Update(void)
CCutsceneMgr::RemoveEverythingBecauseCutsceneDoesntFitInMemory()
{
enum {
CUTSCENE_LOADING_0 = 0,
CUTSCENE_LOADING_AUDIO,
CUTSCENE_LOADING_2,
CUTSCENE_LOADING_3,
CUTSCENE_LOADING_4
};
switch (ms_cutsceneLoadStatus) {
case CUTSCENE_LOADING_AUDIO:
SetupCutsceneToStart();
if (CGeneral::faststricmp(ms_cutsceneName, "finale"))
DMAudio.PlayPreloadedCutSceneMusic();
ms_cutsceneLoadStatus++;
break;
case CUTSCENE_LOADING_2:
case CUTSCENE_LOADING_3:
ms_cutsceneLoadStatus++;
break;
case CUTSCENE_LOADING_4:
ms_cutsceneLoadStatus = CUTSCENE_LOADING_0;
break;
default:
break;
}
if (!ms_running) return;
ms_cutsceneTimer += CTimer::GetTimeStepNonClippedInSeconds();
for (int i = 0; i < ms_numCutsceneObjs; i++) {
int modelId = ms_pCutsceneObjects[i]->GetModelIndex();
if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ05)
UpdateCutsceneObjectBoundingBox(ms_pCutsceneObjects[i]->GetClump(), modelId);
if (ms_pCutsceneObjects[i]->m_pAttachTo != nil && modelId >= MI_SPECIAL01 && modelId <= MI_SPECIAL21)
UpdateCutsceneObjectBoundingBox(ms_pCutsceneObjects[i]->GetClump(), modelId);
}
if (bCamLoaded)
if (CGeneral::faststricmp(ms_cutsceneName, "finale") && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FLYBY && ms_cutsceneLoadStatus == CUTSCENE_LOADING_0) {
if (CPad::GetPad(0)->GetCrossJustDown()
|| (CGame::playingIntro && CPad::GetPad(0)->GetStartJustDown())
|| CPad::GetPad(0)->GetLeftMouseJustDown()
|| CPad::GetPad(0)->GetEnterJustDown()
|| CPad::GetPad(0)->GetCharJustDown(' '))
FinishCutscene();
}
}
bool CCutsceneMgr::HasCutsceneFinished(void) { return !bCamLoaded || TheCamera.GetPositionAlongSpline() == 1.0f; }
void
CCutsceneMgr::LoadAnimationUncompressed(char const* name)
{
strcpy(uncompressedAnims[numUncompressedAnims], name);
// Because that's how CAnimManager knows the end of array
++numUncompressedAnims;
assert(numUncompressedAnims < ARRAY_SIZE(uncompressedAnims));
uncompressedAnims[numUncompressedAnims][0] = '\0';
}
void
CCutsceneMgr::AttachObjectToParent(CObject *pObject, CEntity *pAttachTo)
{
((CCutsceneObject*)pObject)->m_pAttachmentObject = nil;
((CCutsceneObject*)pObject)->m_pAttachTo = RpClumpGetFrame(pAttachTo->GetClump());
debug("Attach %s to %s\n", CModelInfo::GetModelInfo(pObject->GetModelIndex())->GetModelName(), CModelInfo::GetModelInfo(pAttachTo->GetModelIndex())->GetModelName());
}
void
CCutsceneMgr::AttachObjectToFrame(CObject *pObject, CEntity *pAttachTo, const char *frame)
{
((CCutsceneObject*)pObject)->m_pAttachmentObject = nil;
((CCutsceneObject*)pObject)->m_pAttachTo = RpAnimBlendClumpFindFrame(pAttachTo->GetClump(), frame)->frame;
debug("Attach %s to component %s of %s\n",
CModelInfo::GetModelInfo(pObject->GetModelIndex())->GetModelName(),
frame,
CModelInfo::GetModelInfo(pAttachTo->GetModelIndex())->GetModelName());
if (RwObjectGetType(pObject->m_rwObject) == rpCLUMP) {
RpClump *clump = (RpClump*)pObject->m_rwObject;
if (IsClumpSkinned(clump))
RpAtomicGetBoundingSphere(GetFirstAtomic(clump))->radius *= 1.1f;
}
}
void
CCutsceneMgr::AttachObjectToBone(CObject *pObject, CObject *pAttachTo, int bone)
{
RpHAnimHierarchy *hanim = GetAnimHierarchyFromSkinClump(pAttachTo->GetClump());
RwInt32 id = RpHAnimIDGetIndex(hanim, bone);
RwMatrix *matrixArray = RpHAnimHierarchyGetMatrixArray(hanim);
((CCutsceneObject*)pObject)->m_pAttachmentObject = pAttachTo;
((CCutsceneObject*)pObject)->m_pAttachTo = &matrixArray[id];
debug("Attach %s to %s\n",
CModelInfo::GetModelInfo(pObject->GetModelIndex())->GetModelName(),
CModelInfo::GetModelInfo(pAttachTo->GetModelIndex())->GetModelName());
}
void
CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver()
{
CStreaming::ms_disableStreaming = true;
//CStreaming::ms_disableStreaming = true;
CWorld::ClearExcitingStuffFromArea(FindPlayerCoors(), 120.0f, true);
CColStore::RemoveAllCollision();
CWorld::bProcessCutsceneOnly = true;
ms_cutsceneProcessing = true;
/*ms_cutsceneProcessing = true;
for (int i = CPools::GetPedPool()->GetSize() - 1; i >= 0; i--) {
CPed *pPed = CPools::GetPedPool()->GetSlot(i);
@ -630,25 +122,21 @@ CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver()
}
}
}
bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver = true;
CWorld::bProcessCutsceneOnly = true;
//bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver = true;*/
CStreaming::RemoveCurrentZonesModels();
while (CStreaming::RemoveLoadedVehicle());
CRadar::RemoveRadarSections();
CStreaming::SetModelIsDeletable(MI_MALE01);
CStreaming::SetModelTxdIsDeletable(MI_MALE01);
CStreaming::SetModelIsDeletable(MI_TAXI_D);
CStreaming::SetModelTxdIsDeletable(MI_TAXI_D);
CStreaming::SetModelIsDeletable(MI_COLT45);
CStreaming::SetModelTxdIsDeletable(MI_COLT45);
CStreaming::SetModelIsDeletable(MI_NIGHTSTICK);
CStreaming::SetModelTxdIsDeletable(MI_NIGHTSTICK);
CStreaming::SetModelIsDeletable(MI_MISSILE);
CStreaming::SetModelTxdIsDeletable(MI_MISSILE);
CStreaming::SetModelIsDeletable(MI_POLICE);
CStreaming::SetModelTxdIsDeletable(MI_POLICE);
while (CStreaming::RemoveLoadedVehicle()) ;
CRadar::RemoveRadarSections();
for (int i = CPools::GetDummyPool()->GetSize() - 1; i >= 0; i--) {
/*for (int i = CPools::GetDummyPool()->GetSize() - 1; i >= 0; i--) {
CDummy* pDummy = CPools::GetDummyPool()->GetSlot(i);
if (pDummy)
pDummy->DeleteRwObject();
@ -668,7 +156,7 @@ CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver()
if (!pBuilding->bImBeingRendered)
pBuilding->DeleteRwObject();
}
}
}*/
CPlayerPed *pPlayerPed = FindPlayerPed();
pPlayerPed->RemoveWeaponAnims(0, -1000.0f);
@ -683,5 +171,69 @@ CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver()
}
pPlayerPed->ClearWeapons();
CGame::DrasticTidyUpMemory(true);
bModelsRemovedForCutscene = true;
//CGame::DrasticTidyUpMemory(true);
}
void
CCutsceneMgr::LoadEverythingBecauseCutsceneDeletedAllOfIt()
{
bModelsRemovedForCutscene = false;
CStreaming::LoadInitialPeds();
CStreaming::LoadInitialWeapons();
//CStreaming::LoadInitialVehicles();
CPlayerPed *pPlayerPed = FindPlayerPed();
for (int i = 0; i < NumberOfSavedWeapons; i++) {
int32 weaponModelId = CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModelId;
uint8 flags = CStreaming::ms_aInfoForModel[weaponModelId].m_flags;
CStreaming::RequestModel(weaponModelId, STREAMFLAGS_DONT_REMOVE);
CStreaming::LoadAllRequestedModels(false);
if (CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModel2Id != -1) {
CStreaming::RequestModel(CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModel2Id, 0);
CStreaming::LoadAllRequestedModels(false);
}
if (!(flags & STREAMFLAGS_DONT_REMOVE))
CStreaming::SetModelIsDeletable(weaponModelId);
pPlayerPed->GiveWeapon(SavedWeaponIDs[i], SavedWeaponAmmo[i], true);
}
NumberOfSavedWeapons = 0;
}
void
CCutsceneMgr::Update(void)
{
if (ms_cutsceneLoadStatus != CUTSCENE_NOT_LOADED)
Update_overlay();
}
void
CCutsceneMgr::LoadAnimationUncompressed(char const* name)
{
strcpy(ms_aUncompressedCutsceneAnims[ms_numUncompressedCutsceneAnims], name);
// Because that's how CAnimManager knows the end of array
++ms_numUncompressedCutsceneAnims;
assert(ms_numUncompressedCutsceneAnims < ARRAY_SIZE(ms_aUncompressedCutsceneAnims));
ms_aUncompressedCutsceneAnims[ms_numUncompressedCutsceneAnims][0] = '\0';
}
bool
CCutsceneMgr::IsCutsceneSkipButtonBeingPressed()
{
return (CPad::GetPad(0)->GetCrossJustDown()
|| CPad::GetPad(0)->GetLeftMouseJustDown()
|| CPad::GetPad(0)->GetEnterJustDown()
|| CPad::GetPad(0)->GetCharJustDown(' '));
}
void
CCutsceneMgr::AppendToNextCutscene(const char *object, const char *anim)
{
strcpy(ms_cAppendObjectName[ms_numAppendObjectNames], object);
strlwr(ms_cAppendObjectName[ms_numAppendObjectNames]);
strcpy(ms_cAppendAnimName[ms_numAppendObjectNames], anim);
strlwr(ms_cAppendAnimName[ms_numAppendObjectNames]);
ms_numAppendObjectNames++;
}

View file

@ -1,14 +1,69 @@
#pragma once
#include "CutsceneObject.h"
#define CUTSCENENAMESIZE 8
class CDirectory;
class CAnimBlendAssocGroup;
class CCutsceneHead;
enum {
CUTSCENE_NOT_LOADED = 0,
CUTSCENE_LOADING,
CUTSCENE_LOADED,
};
enum {
CUTSCENE_PLAYING_0 = 0,
CUTSCENE_STARTED,
CUTSCENE_PLAYING_2,
CUTSCENE_PLAYING_3,
CUTSCENE_PLAYING_4,
};
enum
{
NAMELENGTH = 32,
NUM_CUTS_PARTICLE_EFFECTS = 8,
NUM_CUTS_MAX_TEXTS = 64,
NUM_CUTS_UNCOMPRESSED_ANIMS = 8,
TEXT_KEY_SIZE = 8,
CUTSCENENAMESIZE = 8
};
struct sToHideItem
{
float x, y, z;
char name[NAMELENGTH];
};
// TODO: figure out from SA
// this is unused in LCS anyway
struct sParticleEffect
{
char name[NAMELENGTH];
bool bPlayed; // ??
int iTime;
int unk1;
int unk2;
char name2[NAMELENGTH];
float x;
float y;
float z;
float unkX;
float unkY;
float unkZ;
bool unk10;
bool unk11;
};
struct sAttachInfo
{
int attachToId, objectId, boneId;
};
class CCutsceneMgr
{
static bool ms_running;
static CCutsceneObject *ms_pCutsceneObjects[NUMCUTSCENEOBJECTS];
@ -24,10 +79,55 @@ class CCutsceneMgr
static bool ms_wasCutsceneSkipped;
static bool ms_cutsceneProcessing;
static bool ms_useCutsceneShadows;
static bool ms_hasFileInfo;
static int ms_numLoadObjectNames;
static char ms_cAppendAnimName[NUMCUTSCENEOBJECTS][NAMELENGTH];
static char ms_cAppendObjectName[NUMCUTSCENEOBJECTS][NAMELENGTH];
static int ms_numAppendObjectNames;
public:
static CDirectory *ms_pCutsceneDir;
static uint32 ms_cutsceneLoadStatus;
static bool mCutsceneSkipFading;
static int mCutsceneSkipFadeTime;
static float m_fPrevCarDensity;
static float m_fPrevPedDensity;
static bool m_PrevExtraColourOn;
static uint32 m_PrevExtraColour;
static uint32 ms_iNumParticleEffects;
static sParticleEffect ms_pParticleEffects[NUM_CUTS_PARTICLE_EFFECTS];
static sToHideItem ms_crToHideItems[NUMCUTSCENEOBJECTS];
static uint32 ms_iNumHiddenEntities;
static CEntity *ms_pHiddenEntities[NUMCUTSCENEOBJECTS];
static int ms_numAttachObjectToBones;
static bool ms_bRepeatObject[NUMCUTSCENEOBJECTS];
static sAttachInfo ms_iAttachObjectToBone[NUMCUTSCENEOBJECTS];
static uint32 ms_numUncompressedCutsceneAnims;
static char ms_aUncompressedCutsceneAnims[NUM_CUTS_UNCOMPRESSED_ANIMS][NAMELENGTH];
static uint32 ms_iTextDuration[NUM_CUTS_MAX_TEXTS];
static uint32 ms_iTextStartTime[NUM_CUTS_MAX_TEXTS];
static char ms_cTextOutput[NUM_CUTS_MAX_TEXTS][TEXT_KEY_SIZE];
static uint32 ms_currTextOutput;
static uint32 ms_numTextOutput;
static uint32 ms_iModelIndex[NUMCUTSCENEOBJECTS];
static char ms_cLoadAnimName[NUMCUTSCENEOBJECTS][NAMELENGTH];
static char ms_cLoadObjectName[NUMCUTSCENEOBJECTS][NAMELENGTH];
static uint32 ms_cutscenePlayStatus;
static void StartCutscene();
static void StartCutsceneProcessing() { ms_cutsceneProcessing = true; }
static bool IsRunning(void) { return ms_running; }
static bool HasLoaded(void) { return ms_loaded; }
@ -35,19 +135,19 @@ public:
static bool WasCutsceneSkipped(void) { return ms_wasCutsceneSkipped; }
static bool UseLodMultiplier(void) { return ms_useLodMultiplier; }
static CCutsceneObject* GetCutsceneObject(int id) { return ms_pCutsceneObjects[id]; }
static int GetCutsceneTimeInMilleseconds(void) { return 1000.0f * ms_cutsceneTimer; }
static uint32 GetCutsceneTimeInMilleseconds(void);
static char *GetCutsceneName(void) { return ms_cutsceneName; }
static void SetCutsceneOffset(const CVector& vec) { ms_cutsceneOffset = vec; }
static bool HasCutsceneFinished(void);
static void Initialise(void);
static void Initialise(void *dir = nil);
static void Shutdown(void);
static void LoadCutsceneData(const char *szCutsceneName);
static void FinishCutscene(void);
static void SetupCutsceneToStart(void);
static void SetCutsceneAnim(const char *animName, CObject *pObject);
static void SetCutsceneAnimToLoop(const char *animName);
static CCutsceneHead *AddCutsceneHead(CObject *pObject, int modelId);
static CCutsceneHead *SetHeadAnim(const char*, CObject *pObject);
static CCutsceneObject *CreateCutsceneObject(int modelId);
static void DeleteCutsceneData(void);
static void LoadAnimationUncompressed(char const*);
@ -56,6 +156,24 @@ public:
static void AttachObjectToParent(CObject *pObject, CEntity *pAttachTo);
static void AttachObjectToFrame(CObject *pObject, CEntity *pAttachTo, const char *frame);
static void AttachObjectToBone(CObject *pObject, CObject *pAttachTo, int frame);
static void RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver();
static void RemoveEverythingBecauseCutsceneDoesntFitInMemory();
static void LoadEverythingBecauseCutsceneDeletedAllOfIt();
static void DisableCutsceneShadows() { ms_useCutsceneShadows = false; }
static void LoadCutsceneData_overlay(const char* szCutsceneName);
static bool LoadCutsceneData_postload(bool b = false);
static void Update_overlay(void);
static void DeleteCutsceneData_overlay(void);
static bool IsCutsceneSkipButtonBeingPressed();
static void AppendToNextCutscene(const char *object, const char *anim);
static void LoadCutsceneData_preload();
static void LoadCutsceneData_loading();
static void HideRequestedObjects();
static bool PresubBodge();
static void Write(base::cRelocatableChunkWriter& writer);
};

File diff suppressed because it is too large Load diff

View file

@ -9407,7 +9407,7 @@ struct MissionAudioData {
const MissionAudioData MissionAudioNameSfxAssoc[] = {
{"mobring", STREAMED_SOUND_MISSION_MOBR1}, {"pagring", STREAMED_SOUND_MISSION_PAGER}, {"carrev", STREAMED_SOUND_MISSION_CARREV},
/*{"mobring", STREAMED_SOUND_MISSION_MOBR1}, {"pagring", STREAMED_SOUND_MISSION_PAGER}, {"carrev", STREAMED_SOUND_MISSION_CARREV},
{"bikerev", STREAMED_SOUND_MISSION_BIKEREV}, {"liftop", STREAMED_SOUND_MISSION_LIFTOP}, {"liftcl", STREAMED_SOUND_MISSION_LIFTCL},
{"liftrun", STREAMED_SOUND_MISSION_LIFTRUN}, {"liftbel", STREAMED_SOUND_MISSION_LIFTBEL}, {"inlift", STREAMED_SOUND_MISSION_INLIFT},
{"caml", STREAMED_SOUND_MISSION_CAMERAL}, {"camr", STREAMED_SOUND_MISSION_CAMERAR}, {"cheer1", STREAMED_SOUND_MISSION_CHEER1},
@ -9780,7 +9780,7 @@ const MissionAudioData MissionAudioNameSfxAssoc[] = {
{"bust_18", STREAMED_SOUND_MISSION_BUST_18}, {"bust_19", STREAMED_SOUND_MISSION_BUST_19}, {"bust_20", STREAMED_SOUND_MISSION_BUST_20},
{"bust_21", STREAMED_SOUND_MISSION_BUST_21}, {"bust_22", STREAMED_SOUND_MISSION_BUST_22}, {"bust_23", STREAMED_SOUND_MISSION_BUST_23},
{"bust_24", STREAMED_SOUND_MISSION_BUST_24}, {"bust_25", STREAMED_SOUND_MISSION_BUST_25}, {"bust_26", STREAMED_SOUND_MISSION_BUST_26},
{"bust_27", STREAMED_SOUND_MISSION_BUST_27}, {"bust_28", STREAMED_SOUND_MISSION_BUST_28}, {nil, 0} };
{"bust_27", STREAMED_SOUND_MISSION_BUST_27}, {"bust_28", STREAMED_SOUND_MISSION_BUST_28}, */ {nil, 0} };
int32
FindMissionAudioSfx(const char *name)
@ -9847,8 +9847,8 @@ cAudioManager::PlayLoadedMissionAudio(uint8 slot)
bool
cAudioManager::ShouldDuckMissionAudio(uint8 slot) const
{
if (IsMissionAudioSamplePlaying(slot))
return m_sMissionAudio.m_nSampleIndex[slot] != STREAMED_SOUND_MISSION_ROK2_01;
//if (IsMissionAudioSamplePlaying(slot))
// return m_sMissionAudio.m_nSampleIndex[slot] != STREAMED_SOUND_MISSION_ROK2_01;
return false;
}
@ -9947,11 +9947,11 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
if (m_nUserPause)
SampleManager.PauseStream(1, slot + 1);
if (m_sMissionAudio.m_bPredefinedProperties[slot]) {
if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAL)
SampleManager.SetStreamedVolumeAndPan(80, 0, 1, slot + 1);
else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAR)
SampleManager.SetStreamedVolumeAndPan(80, 127, 1, slot + 1);
else
//if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAL)
// SampleManager.SetStreamedVolumeAndPan(80, 0, 1, slot + 1);
//else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAR)
// SampleManager.SetStreamedVolumeAndPan(80, 127, 1, slot + 1);
//else
SampleManager.SetStreamedVolumeAndPan(80, 63, 1, slot + 1);
} else {
distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]);
@ -9973,8 +9973,8 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
}
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_PLAYING;
nCheckPlayingDelay[slot] = 30;
if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A)
m_sMissionAudio.m_bIsMobile[slot] = true;
//if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A)
// m_sMissionAudio.m_bIsMobile[slot] = true;
break;
case PLAY_STATUS_PLAYING:
if (m_bTimerJustReset) {
@ -10017,12 +10017,12 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1);
}
}
} else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_ROK2_01) {
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED;
//} else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_ROK2_01) {
// m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED;
} else {
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED;
if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A)
m_sMissionAudio.m_bIsMobile[slot] = false;
//if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A)
// m_sMissionAudio.m_bIsMobile[slot] = false;
m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE;
SampleManager.StopStreamedFile(slot + 1);
m_sMissionAudio.m_nMissionAudioCounter[slot] = 0;

View file

@ -160,8 +160,8 @@ cMusicManager::SetStartingTrackPositions(uint8 isNewGameTimer)
if (i < STREAMED_SOUND_CITY_AMBIENT && isNewGameTimer)
m_aTracks[i].m_nPosition = NewGameRadioTimers[i];
else if (i < STREAMED_SOUND_ANNOUNCE_BRIDGE_CLOSED)
m_aTracks[i].m_nPosition = (pos * AudioManager.GetRandomNumber(i % 5)) % m_aTracks[i].m_nLength;
//else if (i < STREAMED_SOUND_ANNOUNCE_BRIDGE_CLOSED)
// m_aTracks[i].m_nPosition = (pos * AudioManager.GetRandomNumber(i % 5)) % m_aTracks[i].m_nLength;
else
m_aTracks[i].m_nPosition = 0;
@ -658,7 +658,7 @@ cMusicManager::ServiceGameMode()
}
if (vehicle == nil)
{
m_nFrontendTrack = STREAMED_SOUND_RADIO_WAVE; // huh?
m_nFrontendTrack = STREAMED_SOUND_RADIO_LCFR; // huh?
return;
}
if (m_bRadioSetByScript)
@ -712,7 +712,7 @@ cMusicManager::SetUpCorrectAmbienceTrack()
else if (TheCamera.DistanceToWater <= 90.0f) {
if (CCullZones::bAtBeachForAudio) {
if (CWeather::OldWeatherType != WEATHER_HURRICANE && CWeather::NewWeatherType != WEATHER_HURRICANE || CWeather::Wind <= 1.0f)
m_nFrontendTrack = STREAMED_SOUND_BEACH_AMBIENT;
m_nFrontendTrack = STREAMED_SOUND_SAWMILL;
else
m_nFrontendTrack = STREAMED_SOUND_HAVANA_BEACH_AMBIENT;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1057,7 +1057,7 @@ cSampleManager::Initialise(void)
m_szCDRomRootPath[0] = '\0';
strcpy(m_WavFilesPath, m_szCDRomRootPath);
/*
#ifdef AUDIO_CACHE
if ( CreateCache )
#endif
@ -1084,7 +1084,7 @@ cSampleManager::Initialise(void)
return false;
}
}
*/
// Find path of MP3s (originally in CD-Rom)
// if NO_CDCHECK is NOT defined but AUDIO_CACHE is defined, we still need to find MP3s' path, but will exit after the first file
#ifndef NO_CDCHECK
@ -1102,7 +1102,7 @@ cSampleManager::Initialise(void)
{
#endif
for (int32 i = 0; i < STREAMED_SOUND_MISSION_MOBR1; i++)
for (int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++)
{
strcpy(filepath, m_MP3FilesPath);
strcat(filepath, StreamedNameTable[i]);
@ -1143,7 +1143,7 @@ cSampleManager::Initialise(void)
#endif
if ( !bFileNotFound ) {
/*
#ifdef AUDIO_CACHE
if ( CreateCache )
#endif
@ -1169,7 +1169,7 @@ cSampleManager::Initialise(void)
bFileNotFound = true;
break;
}
}
}*/
}
m_bInitialised = !bFileNotFound;
@ -2046,7 +2046,7 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream)
char filepath[MAX_PATH];
strcpy(filepath, nFile < STREAMED_SOUND_MISSION_COMPLETED4 ? m_MP3FilesPath : (nFile < STREAMED_SOUND_MISSION_MOBR1 ? m_MiscomPath : m_WavFilesPath));
strcpy(filepath, m_MP3FilesPath);
strcat(filepath, StreamedNameTable[nFile]);
mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);

View file

@ -396,7 +396,7 @@ set_new_provider(int index)
static bool
IsThisTrackAt16KHz(uint32 track)
{
return track == STREAMED_SOUND_RADIO_KCHAT || track == STREAMED_SOUND_RADIO_VCPR || track == STREAMED_SOUND_RADIO_POLICE;
return false;// track == STREAMED_SOUND_RADIO_KCHAT || track == STREAMED_SOUND_RADIO_VCPR || track == STREAMED_SOUND_RADIO_POLICE;
}
cSampleManager::cSampleManager(void)

View file

@ -10,7 +10,7 @@ CColModel CTempColModels::ms_colModelWheel1;
CColModel CTempColModels::ms_colModelPanel1;
CColModel CTempColModels::ms_colModelBodyPart2;
CColModel CTempColModels::ms_colModelBodyPart1;
CColModel CTempColModels::ms_colModelCutObj[5];
CColModel CTempColModels::ms_colModelCutObj[10];
CColModel CTempColModels::ms_colModelPedGroundHit;
CColModel CTempColModels::ms_colModelBoot1;
CColModel CTempColModels::ms_colModelDoor1;

View file

@ -13,7 +13,7 @@ public:
static CColModel ms_colModelPanel1;
static CColModel ms_colModelBodyPart2;
static CColModel ms_colModelBodyPart1;
static CColModel ms_colModelCutObj[5];
static CColModel ms_colModelCutObj[10];
static CColModel ms_colModelPedGroundHit;
static CColModel ms_colModelBoot1;
static CColModel ms_colModelDoor1;

View file

@ -1984,7 +1984,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
return 0;
}
case COMMAND_START_CUTSCENE:
CCutsceneMgr::ms_cutsceneLoadStatus = 1;
CCutsceneMgr::StartCutscene();
return 0;
case COMMAND_GET_CUTSCENE_TIME:
SET_INTEGER_PARAM(0, CCutsceneMgr::GetCutsceneTimeInMilleseconds());

View file

@ -2754,30 +2754,16 @@ void CTheScripts::ReadObjectNamesFromScript()
void CTheScripts::UpdateObjectIndices()
{
char name[USED_OBJECT_NAME_LENGTH];
char error[112];
for (int i = 1; i < NumberOfUsedObjects; i++) {
bool found = false;
for (int j = 0; j < MODELINFOSIZE && !found; j++) {
CBaseModelInfo* pModel = CModelInfo::GetModelInfo(j);
if (!pModel)
continue;
strcpy(name, pModel->GetModelName());
#ifdef FIX_BUGS
for (int k = 0; k < USED_OBJECT_NAME_LENGTH && name[k]; k++)
#else
for (int k = 0; k < USED_OBJECT_NAME_LENGTH; k++)
#endif
name[k] = toupper(name[k]);
if (strcmp(name, UsedObjectArray[i].name) == 0) {
found = true;
UsedObjectArray[i].index = j;
}
}
if (!found) {
UsedObjectArray[i].index = -1;
CModelInfo::GetModelInfo(UsedObjectArray[i].name, &UsedObjectArray[i].index);
#ifndef FINAL
if (UsedObjectArray[i].index == -1) {
sprintf(error, "CTheScripts::UpdateObjectIndices - Couldn't find %s", UsedObjectArray[i].name);
debug("%s\n", error);
}
#endif
}
}

View file

@ -1018,7 +1018,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
return 0;
case COMMAND_REMOVE_EVERYTHING_FOR_HUGE_CUTSCENE:
{
CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver();
//CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver();
return 0;
}
case COMMAND_IS_PLAYER_TOUCHING_VEHICLE:

View file

@ -77,7 +77,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
case COMMAND_PLAY_ANNOUNCEMENT:
{
CollectParameters(&m_nIp, 1);
DMAudio.PlayRadioAnnouncement(ScriptParams[0] + STREAMED_SOUND_ANNOUNCE_BRIDGE_CLOSED);
DMAudio.PlayRadioAnnouncement(ScriptParams[0] + STREAMED_SOUND_NEWS_A);
return 0;
}
case COMMAND_SET_PLAYER_IS_IN_STADIUM:

View file

@ -80,4 +80,4 @@ public:
static void ProcessTidyUpMemory(void);
};
inline bool IsAreaVisible(int area) { return area == CGame::currArea || area == AREA_EVERYWHERE; }
inline bool IsAreaVisible(int area) { return true; }

View file

@ -37,6 +37,7 @@
#include "Font.h"
#include "Frontend.h"
#include "VarConsole.h"
#include "KeyGen.h"
//--MIAMI: file done (possibly bugs)
@ -948,53 +949,45 @@ CStreaming::RequestIslands(eLevelName level)
}
}
static char *IGnames[] = {
"player",
"player2",
"player3",
"player4",
"player5",
"player6",
"player7",
"player8",
"player9",
"play10",
"play11",
"igken",
"igcandy",
"igsonny",
"igbuddy",
"igjezz",
"ighlary",
"igphil",
"igmerc",
"igdick",
"igdiaz",
const char *csPlayerNames[] =
{
"csplr",
"csplr2",
"csplr3",
"csplr4",
"csplr5",
"csplr6",
"csplr7",
"csplr8",
"csplr9",
"csplr10",
"csplr11",
"csplr12",
"csplr13",
"csplr14",
"csplr15",
"csplr16",
""
};
static char *CSnames[] = {
"csplay",
"csplay2",
"csplay3",
"csplay4",
"csplay5",
"csplay6",
"csplay7",
"csplay8",
"csplay9",
"csplay10",
"csplay11",
"csken",
"cscandy",
"cssonny",
"csbuddy",
"csjezz",
"cshlary",
"csphil",
"csmerc",
"csdick",
"csdiaz",
const char* playerNames[] =
{
"plr",
"plr2",
"plr3",
"plr4",
"plr5",
"plr6",
"plr7",
"plr8",
"plr9",
"plr10",
"plr11",
"plr12",
"plr13",
"plr14",
"plr15",
"plr16",
""
};
@ -1008,15 +1001,17 @@ CStreaming::RequestSpecialModel(int32 modelId, const char *modelName, int32 flag
int i, n;
mi = CModelInfo::GetModelInfo(modelId);
if(strncasecmp("CSPlay", modelName, 6) == 0){
char *curname = CModelInfo::GetModelInfo(MI_PLAYER)->GetModelName();
for(int i = 0; CSnames[i][0]; i++){
if(strcasecmp(curname, IGnames[i]) == 0){
modelName = CSnames[i];
if (CKeyGen::GetUppercaseKey(modelName) == CKeyGen::GetUppercaseKey("cstoni_a")) {
i = 0;
while (csPlayerNames[i][0] != '\0') {
if (CModelInfo::GetModelInfo(0)->GetNameHashKey() == CKeyGen::GetUppercaseKey(playerNames[i])) {
modelName = csPlayerNames[i];
break;
}
i++;
}
}
if(!CGeneral::faststrcmp(mi->GetModelName(), modelName)){
// Already have the correct name, just request it
RequestModel(modelId, flags);

View file

@ -93,6 +93,7 @@ typedef ptrdiff_t ssize_t;
#include "config.h"
#include "memoryManager.h"
#include "relocatableChunk.h"
#include <rphanim.h>
#include <rpskin.h>

View file

@ -371,7 +371,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
// Audio
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
//#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files

View file

@ -82,6 +82,10 @@ char gString2[512];
wchar gUString[256];
wchar gUString2[256];
// leeds
bool gMakeResources = true;
bool gUseChunkFiles = false;
float FramesPerSecond = 30.0f;
bool gbPrintShite = false;

View file

@ -24,6 +24,10 @@ extern bool gbShowTimebars;
extern bool gbPrintMemoryUsage;
#endif
// leeds
extern bool gMakeResources;
extern bool gUseChunkFiles;
class CSprite2d;
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);

View file

@ -394,7 +394,7 @@ RwStream *RwStreamOpen(RwStreamType type, RwStreamAccessType accessType, const v
return nil;
}
}
RwBool RwStreamClose(RwStream * stream, void *pData) { stream->close(); rwFree(stream); return true; }
RwBool RwStreamClose(RwStream * stream, void *pData) { if (!stream) return false; stream->close(); rwFree(stream); return true; }
RwUInt32 RwStreamRead(RwStream * stream, void *buffer, RwUInt32 length) { return stream->read8(buffer, length); }
RwStream *RwStreamWrite(RwStream * stream, const void *buffer, RwUInt32 length) { stream->write8(buffer, length); return stream; }
RwStream *RwStreamSkip(RwStream * stream, RwUInt32 offset) { stream->seek(offset); return stream; }

View file

@ -1,10 +1,12 @@
#include "common.h"
#include "templates.h"
#include "main.h"
#include "TxdStore.h"
#include "2dEffect.h"
#include "BaseModelInfo.h"
#include "ModelInfo.h"
#include "KeyGen.h"
//--MIAMI: file done
@ -18,6 +20,7 @@ CBaseModelInfo::CBaseModelInfo(ModelInfoType type)
m_type = type;
m_num2dEffects = 0;
m_bOwnsColModel = false;
m_name = new char[MAX_MODEL_NAME];
}
void
@ -101,3 +104,12 @@ CBaseModelInfo::Get2dEffect(int n)
else
return nil;
}
void
CBaseModelInfo::SetModelName(const char *name)
{
m_nameKey = CKeyGen::GetUppercaseKey(name);
if (!gUseChunkFiles)
strcpy(m_name, name);
}

View file

@ -23,7 +23,9 @@ class C2dEffect;
class CBaseModelInfo
{
protected:
char m_name[MAX_MODEL_NAME];
char *m_name;
uint32 m_nameKey;
RwObject *m_object;
uint8 m_type;
uint8 m_num2dEffects;
bool m_bOwnsColModel;
@ -35,7 +37,11 @@ protected:
public:
CBaseModelInfo(ModelInfoType type);
#ifdef FIX_BUGS
virtual ~CBaseModelInfo() { delete []m_name; }
#else
virtual ~CBaseModelInfo() {}
#endif
virtual void Shutdown(void);
virtual void DeleteRwObject(void) = 0;
virtual RwObject *CreateInstance(RwMatrix *) = 0;
@ -51,7 +57,8 @@ public:
bool IsSimple(void) { return m_type == MITYPE_SIMPLE || m_type == MITYPE_TIME || m_type == MITYPE_WEAPON; }
bool IsClump(void) { return m_type == MITYPE_CLUMP || m_type == MITYPE_PED || m_type == MITYPE_VEHICLE; }
char *GetModelName(void) { return m_name; }
void SetModelName(const char *name) { strncpy(m_name, name, MAX_MODEL_NAME); }
void SetModelName(const char *name);
uint32 GetNameHashKey() { return m_nameKey; }
void SetColModel(CColModel *col, bool owns = false){
m_colModel = col; m_bOwnsColModel = owns; }
CColModel *GetColModel(void) { return m_colModel; }

View file

@ -4,6 +4,7 @@
#include "TempColModels.h"
#include "ModelIndices.h"
#include "ModelInfo.h"
#include "KeyGen.h"
// --MIAMI: file done
@ -186,10 +187,11 @@ CModelInfo::AddVehicleModel(int id)
CBaseModelInfo*
CModelInfo::GetModelInfo(const char *name, int *id)
{
uint32 hashKey = CKeyGen::GetUppercaseKey(name);
CBaseModelInfo *modelinfo;
for(int i = 0; i < MODELINFOSIZE; i++){
modelinfo = CModelInfo::ms_modelInfoPtrs[i];
if(modelinfo && !CGeneral::faststricmp(modelinfo->GetModelName(), name)){
if(modelinfo && hashKey == modelinfo->GetNameHashKey()){
if(id)
*id = i;
return modelinfo;
@ -201,13 +203,14 @@ CModelInfo::GetModelInfo(const char *name, int *id)
CBaseModelInfo*
CModelInfo::GetModelInfo(const char *name, int minIndex, int maxIndex)
{
uint32 hashKey = CKeyGen::GetUppercaseKey(name);
if (minIndex > maxIndex)
return 0;
CBaseModelInfo *modelinfo;
for(int i = minIndex; i <= maxIndex; i++){
modelinfo = CModelInfo::ms_modelInfoPtrs[i];
if(modelinfo && !CGeneral::faststricmp(modelinfo->GetModelName(), name))
if(modelinfo && hashKey == modelinfo->GetNameHashKey())
return modelinfo;
}
return nil;

View file

@ -53,12 +53,15 @@ CCutsceneObject::SetModelIndex(uint32 id)
void
CCutsceneObject::CreateShadow(void)
{
// empty in LCS
/*
if ( IsPedModel(GetModelIndex()) )
{
m_pShadow = new CCutsceneShadow();
if (!m_pShadow->IsInitialized())
m_pShadow->Create(m_rwObject, 6, true, 4, true);
}
*/
}
void
@ -150,9 +153,9 @@ CCutsceneObject::PreRender(void)
void
CCutsceneObject::Render(void)
{
RwRenderStateSet(rwRENDERSTATECULLMODE, (void *)rwCULLMODECULLNONE);
SetCullMode(rwCULLMODECULLNONE);
CObject::Render();
RwRenderStateSet(rwRENDERSTATECULLMODE, (void *)rwCULLMODECULLBACK);
SetCullMode(rwCULLMODECULLBACK);
}
bool

View file

@ -91,7 +91,7 @@ bool CHud::m_HideRadar;
int32 CHud::m_ClockState;
// These aren't really in CHud
float CHud::BigMessageInUse[6];
float BigMessageInUse[6];
float CHud::BigMessageAlpha[6];
float CHud::BigMessageX[6];
float CHud::OddJob2OffTimer;

View file

@ -47,6 +47,8 @@ enum eSprites
NUM_HUD_SPRITES = 69,
};
extern float BigMessageInUse[6];
class CHud
{
public:
@ -82,7 +84,6 @@ public:
static int32 m_ClockState;
// These aren't really in CHud
static float BigMessageInUse[6];
static float BigMessageAlpha[6];
static float BigMessageX[6];
static float OddJob2OffTimer;

View file

@ -815,3 +815,12 @@ CMessages::ClearAllMessagesDisplayedByGame()
CHud::GetRidOfAllHudMessages();
CUserDisplay::Pager.ClearMessages();
}
void
CMessages::ClearThisBigPrintNow(uint32 id)
{
if (BIGMessages[id].m_Stack[0].m_pText)
ClearThisBigPrint(BIGMessages[id].m_Stack[0].m_pText);
CHud::m_BigMessage[id][0] = '\0';
BigMessageInUse[id] = 0.0f;
}

View file

@ -61,6 +61,7 @@ public:
static void ClearThisPrint(wchar *str);
static void ClearThisBigPrint(wchar *str);
static void ClearAllMessagesDisplayedByGame(void);
static void ClearThisBigPrintNow(uint32 id);
// unused or cut
//static void AddMessageSoonWithString(wchar*, uint32, uint16, wchar*);