1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-14 06:19:15 +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 "RpAnimBlend.h"
#include "AnimBlendAssociation.h" #include "AnimBlendAssociation.h"
#include "AnimBlendAssocGroup.h" #include "AnimBlendAssocGroup.h"
#include "KeyGen.h"
//--MIAMI: file done //--MIAMI: file done
@ -109,27 +110,34 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
} }
} }
extern const char* csPlayerNames[];
extern const char* playerNames[];
CBaseModelInfo* CBaseModelInfo*
GetModelFromName(const char *name) GetModelFromName(const char *name)
{ {
int i; int i;
CBaseModelInfo *mi; CBaseModelInfo* mi;
char playername[32]; if (CKeyGen::GetUppercaseKey(name) == CKeyGen::GetUppercaseKey("cstoni_a")) {
i = 0;
if(strncasecmp(name, "CSplay", 6) == 0 && while (csPlayerNames[i][0] != '\0') {
strncasecmp(CModelInfo::GetModelInfo(MI_PLAYER)->GetModelName(), "ig", 2) == 0){ if (CModelInfo::GetModelInfo(0)->GetNameHashKey() == CKeyGen::GetUppercaseKey(playerNames[i])) {
strcpy(playername, CModelInfo::GetModelInfo(MI_PLAYER)->GetModelName()); name = csPlayerNames[i];
playername[0] = 'C'; break;
playername[1] = 'S'; }
name = playername; i++;
}
} }
for(i = 0; i < MODELINFOSIZE; i++){ uint32 hashKey = CKeyGen::GetUppercaseKey(name);
for (i = 0; i < MODELINFOSIZE; i++) {
mi = CModelInfo::GetModelInfo(i); mi = CModelInfo::GetModelInfo(i);
if(mi && mi->GetRwObject() && RwObjectGetType(mi->GetRwObject()) == rpCLUMP && if (mi && mi->GetRwObject()
strcmpIgnoringDigits(mi->GetModelName(), name)) && RwObjectGetType(mi->GetRwObject()) == rpCLUMP &&
hashKey == mi->GetNameHashKey())
return mi; return mi;
} }
return nil; return nil;
} }
@ -183,3 +191,45 @@ CAnimBlendAssocGroup::CreateAssociations(const char *blockName, RpClump *clump,
} }
numAssociations = numAssocs; 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); CAnimBlendAssociation *CopyAnimation(const char *name);
void CreateAssociations(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, 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 "ColStore.h"
#include "Radar.h" #include "Radar.h"
#include "Pools.h" #include "Pools.h"
#include "crossplatform.h"
//--MIAMI: file done //--MIAMI: file done
const struct { static bool bModelsRemovedForCutscene;
const char *szTrackName; static int32 NumberOfSavedWeapons;
int iTrackId; static eWeaponType SavedWeaponIDs[TOTAL_WEAPON_SLOTS];
} musicNameIdAssoc[] = { static int32 SavedWeaponAmmo[TOTAL_WEAPON_SLOTS];
{ "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 }
};
int char CCutsceneMgr::ms_cAppendAnimName[NUMCUTSCENEOBJECTS][NAMELENGTH];
FindCutsceneAudioTrackId(const char *szCutsceneName) char CCutsceneMgr::ms_cAppendObjectName[NUMCUTSCENEOBJECTS][NAMELENGTH];
{ int CCutsceneMgr::ms_numAppendObjectNames;
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;
CDirectory *CCutsceneMgr::ms_pCutsceneDir; CDirectory *CCutsceneMgr::ms_pCutsceneDir;
CCutsceneObject *CCutsceneMgr::ms_pCutsceneObjects[NUMCUTSCENEOBJECTS];
int32 CCutsceneMgr::ms_numCutsceneObjs;
bool CCutsceneMgr::ms_loaded; bool CCutsceneMgr::ms_loaded;
bool CCutsceneMgr::ms_animLoaded; bool CCutsceneMgr::ms_hasFileInfo;
bool CCutsceneMgr::ms_useLodMultiplier;
char CCutsceneMgr::ms_cutsceneName[CUTSCENENAMESIZE];
CAnimBlendAssocGroup CCutsceneMgr::ms_cutsceneAssociations;
CVector CCutsceneMgr::ms_cutsceneOffset;
float CCutsceneMgr::ms_cutsceneTimer;
bool CCutsceneMgr::ms_wasCutsceneSkipped; bool CCutsceneMgr::ms_wasCutsceneSkipped;
bool CCutsceneMgr::ms_useLodMultiplier;
bool CCutsceneMgr::ms_cutsceneProcessing;
bool CCutsceneMgr::ms_running;
bool CCutsceneMgr::ms_animLoaded;
uint32 CCutsceneMgr::ms_cutsceneLoadStatus; 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 void
CCutsceneMgr::Initialise(void) CCutsceneMgr::Initialise(void *dir)
{ {
ms_numCutsceneObjs = 0; ms_cutsceneLoadStatus = CUTSCENE_NOT_LOADED;
ms_loaded = false;
ms_wasCutsceneSkipped = false;
ms_running = false; ms_running = false;
ms_useLodMultiplier = false;
ms_animLoaded = false; ms_animLoaded = false;
ms_cutsceneProcessing = 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;
ms_pCutsceneDir = new CDirectory(CUTSCENEDIRSIZE); //numUncompressedAnims = 0;
ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR"); //uncompressedAnims[0][0] = '\0';
}
numUncompressedAnims = 0; void CCutsceneMgr::Write(base::cRelocatableChunkWriter& writer)
uncompressedAnims[0][0] = '\0'; {
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 void
@ -183,433 +83,25 @@ CCutsceneMgr::Shutdown(void)
void void
CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName) CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
{ {
int file; LoadCutsceneData_overlay(szCutsceneName);
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;
} }
void void
CCutsceneMgr::DeleteCutsceneData(void) CCutsceneMgr::DeleteCutsceneData(void)
{ {
if (!ms_loaded) return; DeleteCutsceneData_overlay();
CTimer::Suspend(); if (bModelsRemovedForCutscene)
LoadEverythingBecauseCutsceneDeletedAllOfIt();
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();
} }
void void
CCutsceneMgr::Update(void) CCutsceneMgr::RemoveEverythingBecauseCutsceneDoesntFitInMemory()
{ {
enum { //CStreaming::ms_disableStreaming = true;
CUTSCENE_LOADING_0 = 0, CWorld::ClearExcitingStuffFromArea(FindPlayerCoors(), 120.0f, true);
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;
CColStore::RemoveAllCollision(); CColStore::RemoveAllCollision();
CWorld::bProcessCutsceneOnly = true; CWorld::bProcessCutsceneOnly = true;
ms_cutsceneProcessing = true; /*ms_cutsceneProcessing = true;
for (int i = CPools::GetPedPool()->GetSize() - 1; i >= 0; i--) { for (int i = CPools::GetPedPool()->GetSize() - 1; i >= 0; i--) {
CPed *pPed = CPools::GetPedPool()->GetSlot(i); CPed *pPed = CPools::GetPedPool()->GetSlot(i);
@ -630,25 +122,21 @@ CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver()
} }
} }
} }
CWorld::bProcessCutsceneOnly = true;
bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver = true; //bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver = true;*/
CStreaming::RemoveCurrentZonesModels(); CStreaming::RemoveCurrentZonesModels();
while (CStreaming::RemoveLoadedVehicle());
CRadar::RemoveRadarSections();
CStreaming::SetModelIsDeletable(MI_MALE01); CStreaming::SetModelIsDeletable(MI_MALE01);
CStreaming::SetModelTxdIsDeletable(MI_MALE01); CStreaming::SetModelTxdIsDeletable(MI_MALE01);
CStreaming::SetModelIsDeletable(MI_TAXI_D); CStreaming::SetModelIsDeletable(MI_COLT45);
CStreaming::SetModelTxdIsDeletable(MI_TAXI_D); CStreaming::SetModelTxdIsDeletable(MI_COLT45);
CStreaming::SetModelIsDeletable(MI_NIGHTSTICK); CStreaming::SetModelIsDeletable(MI_NIGHTSTICK);
CStreaming::SetModelTxdIsDeletable(MI_NIGHTSTICK); CStreaming::SetModelTxdIsDeletable(MI_NIGHTSTICK);
CStreaming::SetModelIsDeletable(MI_MISSILE); CStreaming::SetModelIsDeletable(MI_MISSILE);
CStreaming::SetModelTxdIsDeletable(MI_MISSILE); CStreaming::SetModelTxdIsDeletable(MI_MISSILE);
CStreaming::SetModelIsDeletable(MI_POLICE);
CStreaming::SetModelTxdIsDeletable(MI_POLICE);
while (CStreaming::RemoveLoadedVehicle()) ; /*for (int i = CPools::GetDummyPool()->GetSize() - 1; i >= 0; i--) {
CRadar::RemoveRadarSections();
for (int i = CPools::GetDummyPool()->GetSize() - 1; i >= 0; i--) {
CDummy* pDummy = CPools::GetDummyPool()->GetSlot(i); CDummy* pDummy = CPools::GetDummyPool()->GetSlot(i);
if (pDummy) if (pDummy)
pDummy->DeleteRwObject(); pDummy->DeleteRwObject();
@ -668,7 +156,7 @@ CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver()
if (!pBuilding->bImBeingRendered) if (!pBuilding->bImBeingRendered)
pBuilding->DeleteRwObject(); pBuilding->DeleteRwObject();
} }
} }*/
CPlayerPed *pPlayerPed = FindPlayerPed(); CPlayerPed *pPlayerPed = FindPlayerPed();
pPlayerPed->RemoveWeaponAnims(0, -1000.0f); pPlayerPed->RemoveWeaponAnims(0, -1000.0f);
@ -683,5 +171,69 @@ CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver()
} }
pPlayerPed->ClearWeapons(); 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 #pragma once
#include "CutsceneObject.h" #include "CutsceneObject.h"
#define CUTSCENENAMESIZE 8
class CDirectory; class CDirectory;
class CAnimBlendAssocGroup; class CAnimBlendAssocGroup;
class CCutsceneHead; 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 class CCutsceneMgr
{ {
static bool ms_running; static bool ms_running;
static CCutsceneObject *ms_pCutsceneObjects[NUMCUTSCENEOBJECTS]; static CCutsceneObject *ms_pCutsceneObjects[NUMCUTSCENEOBJECTS];
@ -24,10 +79,55 @@ class CCutsceneMgr
static bool ms_wasCutsceneSkipped; static bool ms_wasCutsceneSkipped;
static bool ms_cutsceneProcessing; static bool ms_cutsceneProcessing;
static bool ms_useCutsceneShadows; 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: public:
static CDirectory *ms_pCutsceneDir; static CDirectory *ms_pCutsceneDir;
static uint32 ms_cutsceneLoadStatus; 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 void StartCutsceneProcessing() { ms_cutsceneProcessing = true; }
static bool IsRunning(void) { return ms_running; } static bool IsRunning(void) { return ms_running; }
static bool HasLoaded(void) { return ms_loaded; } static bool HasLoaded(void) { return ms_loaded; }
@ -35,19 +135,19 @@ public:
static bool WasCutsceneSkipped(void) { return ms_wasCutsceneSkipped; } static bool WasCutsceneSkipped(void) { return ms_wasCutsceneSkipped; }
static bool UseLodMultiplier(void) { return ms_useLodMultiplier; } static bool UseLodMultiplier(void) { return ms_useLodMultiplier; }
static CCutsceneObject* GetCutsceneObject(int id) { return ms_pCutsceneObjects[id]; } 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 char *GetCutsceneName(void) { return ms_cutsceneName; }
static void SetCutsceneOffset(const CVector& vec) { ms_cutsceneOffset = vec; } static void SetCutsceneOffset(const CVector& vec) { ms_cutsceneOffset = vec; }
static bool HasCutsceneFinished(void); static bool HasCutsceneFinished(void);
static void Initialise(void); static void Initialise(void *dir = nil);
static void Shutdown(void); static void Shutdown(void);
static void LoadCutsceneData(const char *szCutsceneName); static void LoadCutsceneData(const char *szCutsceneName);
static void FinishCutscene(void); static void FinishCutscene(void);
static void SetupCutsceneToStart(void); static void SetupCutsceneToStart(void);
static void SetCutsceneAnim(const char *animName, CObject *pObject); static void SetCutsceneAnim(const char *animName, CObject *pObject);
static void SetCutsceneAnimToLoop(const char *animName); 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 CCutsceneObject *CreateCutsceneObject(int modelId);
static void DeleteCutsceneData(void); static void DeleteCutsceneData(void);
static void LoadAnimationUncompressed(char const*); static void LoadAnimationUncompressed(char const*);
@ -56,6 +156,24 @@ public:
static void AttachObjectToParent(CObject *pObject, CEntity *pAttachTo); static void AttachObjectToParent(CObject *pObject, CEntity *pAttachTo);
static void AttachObjectToFrame(CObject *pObject, CEntity *pAttachTo, const char *frame); static void AttachObjectToFrame(CObject *pObject, CEntity *pAttachTo, const char *frame);
static void AttachObjectToBone(CObject *pObject, CObject *pAttachTo, int 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 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[] = { 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}, {"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}, {"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}, {"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_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_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_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 int32
FindMissionAudioSfx(const char *name) FindMissionAudioSfx(const char *name)
@ -9847,8 +9847,8 @@ cAudioManager::PlayLoadedMissionAudio(uint8 slot)
bool bool
cAudioManager::ShouldDuckMissionAudio(uint8 slot) const cAudioManager::ShouldDuckMissionAudio(uint8 slot) const
{ {
if (IsMissionAudioSamplePlaying(slot)) //if (IsMissionAudioSamplePlaying(slot))
return m_sMissionAudio.m_nSampleIndex[slot] != STREAMED_SOUND_MISSION_ROK2_01; // return m_sMissionAudio.m_nSampleIndex[slot] != STREAMED_SOUND_MISSION_ROK2_01;
return false; return false;
} }
@ -9947,11 +9947,11 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
if (m_nUserPause) if (m_nUserPause)
SampleManager.PauseStream(1, slot + 1); SampleManager.PauseStream(1, slot + 1);
if (m_sMissionAudio.m_bPredefinedProperties[slot]) { if (m_sMissionAudio.m_bPredefinedProperties[slot]) {
if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAL) //if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAL)
SampleManager.SetStreamedVolumeAndPan(80, 0, 1, slot + 1); // SampleManager.SetStreamedVolumeAndPan(80, 0, 1, slot + 1);
else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAR) //else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAR)
SampleManager.SetStreamedVolumeAndPan(80, 127, 1, slot + 1); // SampleManager.SetStreamedVolumeAndPan(80, 127, 1, slot + 1);
else //else
SampleManager.SetStreamedVolumeAndPan(80, 63, 1, slot + 1); SampleManager.SetStreamedVolumeAndPan(80, 63, 1, slot + 1);
} else { } else {
distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]); distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]);
@ -9973,8 +9973,8 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
} }
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_PLAYING; m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_PLAYING;
nCheckPlayingDelay[slot] = 30; nCheckPlayingDelay[slot] = 30;
if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A) //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; // m_sMissionAudio.m_bIsMobile[slot] = true;
break; break;
case PLAY_STATUS_PLAYING: case PLAY_STATUS_PLAYING:
if (m_bTimerJustReset) { if (m_bTimerJustReset) {
@ -10017,12 +10017,12 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1); SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1);
} }
} }
} else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_ROK2_01) { //} else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_ROK2_01) {
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED; // m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED;
} else { } else {
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED; 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) //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_bIsMobile[slot] = false;
m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE; m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE;
SampleManager.StopStreamedFile(slot + 1); SampleManager.StopStreamedFile(slot + 1);
m_sMissionAudio.m_nMissionAudioCounter[slot] = 0; m_sMissionAudio.m_nMissionAudioCounter[slot] = 0;

View file

@ -160,8 +160,8 @@ cMusicManager::SetStartingTrackPositions(uint8 isNewGameTimer)
if (i < STREAMED_SOUND_CITY_AMBIENT && isNewGameTimer) if (i < STREAMED_SOUND_CITY_AMBIENT && isNewGameTimer)
m_aTracks[i].m_nPosition = NewGameRadioTimers[i]; m_aTracks[i].m_nPosition = NewGameRadioTimers[i];
else if (i < STREAMED_SOUND_ANNOUNCE_BRIDGE_CLOSED) //else if (i < STREAMED_SOUND_ANNOUNCE_BRIDGE_CLOSED)
m_aTracks[i].m_nPosition = (pos * AudioManager.GetRandomNumber(i % 5)) % m_aTracks[i].m_nLength; // m_aTracks[i].m_nPosition = (pos * AudioManager.GetRandomNumber(i % 5)) % m_aTracks[i].m_nLength;
else else
m_aTracks[i].m_nPosition = 0; m_aTracks[i].m_nPosition = 0;
@ -658,7 +658,7 @@ cMusicManager::ServiceGameMode()
} }
if (vehicle == nil) if (vehicle == nil)
{ {
m_nFrontendTrack = STREAMED_SOUND_RADIO_WAVE; // huh? m_nFrontendTrack = STREAMED_SOUND_RADIO_LCFR; // huh?
return; return;
} }
if (m_bRadioSetByScript) if (m_bRadioSetByScript)
@ -712,7 +712,7 @@ cMusicManager::SetUpCorrectAmbienceTrack()
else if (TheCamera.DistanceToWater <= 90.0f) { else if (TheCamera.DistanceToWater <= 90.0f) {
if (CCullZones::bAtBeachForAudio) { if (CCullZones::bAtBeachForAudio) {
if (CWeather::OldWeatherType != WEATHER_HURRICANE && CWeather::NewWeatherType != WEATHER_HURRICANE || CWeather::Wind <= 1.0f) 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 else
m_nFrontendTrack = STREAMED_SOUND_HAVANA_BEACH_AMBIENT; 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'; m_szCDRomRootPath[0] = '\0';
strcpy(m_WavFilesPath, m_szCDRomRootPath); strcpy(m_WavFilesPath, m_szCDRomRootPath);
/*
#ifdef AUDIO_CACHE #ifdef AUDIO_CACHE
if ( CreateCache ) if ( CreateCache )
#endif #endif
@ -1084,7 +1084,7 @@ cSampleManager::Initialise(void)
return false; return false;
} }
} }
*/
// Find path of MP3s (originally in CD-Rom) // 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 // 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 #ifndef NO_CDCHECK
@ -1102,7 +1102,7 @@ cSampleManager::Initialise(void)
{ {
#endif #endif
for (int32 i = 0; i < STREAMED_SOUND_MISSION_MOBR1; i++) for (int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++)
{ {
strcpy(filepath, m_MP3FilesPath); strcpy(filepath, m_MP3FilesPath);
strcat(filepath, StreamedNameTable[i]); strcat(filepath, StreamedNameTable[i]);
@ -1143,7 +1143,7 @@ cSampleManager::Initialise(void)
#endif #endif
if ( !bFileNotFound ) { if ( !bFileNotFound ) {
/*
#ifdef AUDIO_CACHE #ifdef AUDIO_CACHE
if ( CreateCache ) if ( CreateCache )
#endif #endif
@ -1169,7 +1169,7 @@ cSampleManager::Initialise(void)
bFileNotFound = true; bFileNotFound = true;
break; break;
} }
} }*/
} }
m_bInitialised = !bFileNotFound; m_bInitialised = !bFileNotFound;
@ -2046,7 +2046,7 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream)
char filepath[MAX_PATH]; 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]); strcat(filepath, StreamedNameTable[nFile]);
mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0); mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);

View file

@ -396,7 +396,7 @@ set_new_provider(int index)
static bool static bool
IsThisTrackAt16KHz(uint32 track) 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) cSampleManager::cSampleManager(void)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -371,7 +371,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
// Audio // Audio
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot #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_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files #define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files

View file

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

View file

@ -24,6 +24,10 @@ extern bool gbShowTimebars;
extern bool gbPrintMemoryUsage; extern bool gbPrintMemoryUsage;
#endif #endif
// leeds
extern bool gMakeResources;
extern bool gUseChunkFiles;
class CSprite2d; class CSprite2d;
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); 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; 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); } 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 *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; } RwStream *RwStreamSkip(RwStream * stream, RwUInt32 offset) { stream->seek(offset); return stream; }

View file

@ -1,10 +1,12 @@
#include "common.h" #include "common.h"
#include "templates.h" #include "templates.h"
#include "main.h"
#include "TxdStore.h" #include "TxdStore.h"
#include "2dEffect.h" #include "2dEffect.h"
#include "BaseModelInfo.h" #include "BaseModelInfo.h"
#include "ModelInfo.h" #include "ModelInfo.h"
#include "KeyGen.h"
//--MIAMI: file done //--MIAMI: file done
@ -18,6 +20,7 @@ CBaseModelInfo::CBaseModelInfo(ModelInfoType type)
m_type = type; m_type = type;
m_num2dEffects = 0; m_num2dEffects = 0;
m_bOwnsColModel = false; m_bOwnsColModel = false;
m_name = new char[MAX_MODEL_NAME];
} }
void void
@ -101,3 +104,12 @@ CBaseModelInfo::Get2dEffect(int n)
else else
return nil; 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 class CBaseModelInfo
{ {
protected: protected:
char m_name[MAX_MODEL_NAME]; char *m_name;
uint32 m_nameKey;
RwObject *m_object;
uint8 m_type; uint8 m_type;
uint8 m_num2dEffects; uint8 m_num2dEffects;
bool m_bOwnsColModel; bool m_bOwnsColModel;
@ -35,7 +37,11 @@ protected:
public: public:
CBaseModelInfo(ModelInfoType type); CBaseModelInfo(ModelInfoType type);
#ifdef FIX_BUGS
virtual ~CBaseModelInfo() { delete []m_name; }
#else
virtual ~CBaseModelInfo() {} virtual ~CBaseModelInfo() {}
#endif
virtual void Shutdown(void); virtual void Shutdown(void);
virtual void DeleteRwObject(void) = 0; virtual void DeleteRwObject(void) = 0;
virtual RwObject *CreateInstance(RwMatrix *) = 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 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; } bool IsClump(void) { return m_type == MITYPE_CLUMP || m_type == MITYPE_PED || m_type == MITYPE_VEHICLE; }
char *GetModelName(void) { return m_name; } 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){ void SetColModel(CColModel *col, bool owns = false){
m_colModel = col; m_bOwnsColModel = owns; } m_colModel = col; m_bOwnsColModel = owns; }
CColModel *GetColModel(void) { return m_colModel; } CColModel *GetColModel(void) { return m_colModel; }

View file

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

View file

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

View file

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

View file

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

View file

@ -815,3 +815,12 @@ CMessages::ClearAllMessagesDisplayedByGame()
CHud::GetRidOfAllHudMessages(); CHud::GetRidOfAllHudMessages();
CUserDisplay::Pager.ClearMessages(); 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 ClearThisPrint(wchar *str);
static void ClearThisBigPrint(wchar *str); static void ClearThisBigPrint(wchar *str);
static void ClearAllMessagesDisplayedByGame(void); static void ClearAllMessagesDisplayedByGame(void);
static void ClearThisBigPrintNow(uint32 id);
// unused or cut // unused or cut
//static void AddMessageSoonWithString(wchar*, uint32, uint16, wchar*); //static void AddMessageSoonWithString(wchar*, uint32, uint16, wchar*);