diff options
author | Fire-Head <Fire-Head@users.noreply.github.com> | 2021-01-12 22:11:15 +0100 |
---|---|---|
committer | Fire-Head <Fire-Head@users.noreply.github.com> | 2021-01-12 22:11:15 +0100 |
commit | 3e6016dc6ee40372a06b74d24cae2f97428358f2 (patch) | |
tree | ff2420d56a8cc4ab1b9c0f43f720e6f6fbb8bc11 /src | |
parent | rem gMakeResources (diff) | |
parent | Merge remote-tracking branch 'origin/miami' into lcs (diff) | |
download | re3-3e6016dc6ee40372a06b74d24cae2f97428358f2.tar re3-3e6016dc6ee40372a06b74d24cae2f97428358f2.tar.gz re3-3e6016dc6ee40372a06b74d24cae2f97428358f2.tar.bz2 re3-3e6016dc6ee40372a06b74d24cae2f97428358f2.tar.lz re3-3e6016dc6ee40372a06b74d24cae2f97428358f2.tar.xz re3-3e6016dc6ee40372a06b74d24cae2f97428358f2.tar.zst re3-3e6016dc6ee40372a06b74d24cae2f97428358f2.zip |
Diffstat (limited to '')
125 files changed, 7724 insertions, 5554 deletions
diff --git a/src/animation/AnimBlendAssocGroup.cpp b/src/animation/AnimBlendAssocGroup.cpp index df47e9b5..ea6dea3e 100644 --- a/src/animation/AnimBlendAssocGroup.cpp +++ b/src/animation/AnimBlendAssocGroup.cpp @@ -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; + CBaseModelInfo* mi; + 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++; + } } - for(i = 0; i < MODELINFOSIZE; 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; + } + } + } + } +}
\ No newline at end of file diff --git a/src/animation/AnimBlendAssocGroup.h b/src/animation/AnimBlendAssocGroup.h index 86f0ca18..e264787e 100644 --- a/src/animation/AnimBlendAssocGroup.h +++ b/src/animation/AnimBlendAssocGroup.h @@ -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); }; diff --git a/src/animation/CutsceneMgr.cpp b/src/animation/CutsceneMgr.cpp index eeec2728..bbbd9aa3 100644 --- a/src/animation/CutsceneMgr.cpp +++ b/src/animation/CutsceneMgr.cpp @@ -22,592 +22,86 @@ #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(¢er, ¢er, 1, RwFrameGetMatrix(frame)); - - float size = RwV3dLength(¢er) + 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_pCutsceneDir = new CDirectory(CUTSCENEDIRSIZE); - ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR"); - - numUncompressedAnims = 0; - uncompressedAnims[0][0] = '\0'; -} - -void -CCutsceneMgr::Shutdown(void) -{ - delete ms_pCutsceneDir; -} - -void -CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName) -{ - int file; - uint32 size; - uint32 offset; - CPlayerPed *pPlayerPed; - - ms_cutsceneProcessing = true; + ms_useLodMultiplier = false; 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_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_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); + //numUncompressedAnims = 0; + //uncompressedAnims[0][0] = '\0'; } -void -CCutsceneMgr::SetupCutsceneToStart(void) +void CCutsceneMgr::Write(base::cRelocatableChunkWriter& writer) { - 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; + 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 -CCutsceneMgr::SetCutsceneAnim(const char *animName, CObject *pObject) +CCutsceneMgr::Shutdown(void) { - 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; + delete ms_pCutsceneDir; } 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) +CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName) { - 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; - - 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 -CCutsceneMgr::Update(void) -{ - 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; - } + DeleteCutsceneData_overlay(); + if (bModelsRemovedForCutscene) + LoadEverythingBecauseCutsceneDeletedAllOfIt(); } void -CCutsceneMgr::AttachObjectToBone(CObject *pObject, CObject *pAttachTo, int bone) +CCutsceneMgr::RemoveEverythingBecauseCutsceneDoesntFitInMemory() { - 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); @@ -628,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(); @@ -666,7 +156,7 @@ CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver() if (!pBuilding->bImBeingRendered) pBuilding->DeleteRwObject(); } - } + }*/ CPlayerPed *pPlayerPed = FindPlayerPed(); pPlayerPed->RemoveWeaponAnims(0, -1000.0f); @@ -681,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++; }
\ No newline at end of file diff --git a/src/animation/CutsceneMgr.h b/src/animation/CutsceneMgr.h index 51ef6c04..7c749d4b 100644 --- a/src/animation/CutsceneMgr.h +++ b/src/animation/CutsceneMgr.h @@ -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); }; diff --git a/src/animation/CutsceneMgr_overlay.cpp b/src/animation/CutsceneMgr_overlay.cpp new file mode 100644 index 00000000..5fcb752d --- /dev/null +++ b/src/animation/CutsceneMgr_overlay.cpp @@ -0,0 +1,1030 @@ +#include "common.h" +#include "relocatableChunk.h" + +#include "General.h" +#include "CutsceneMgr.h" +#include "Directory.h" +#include "Camera.h" +#include "Streaming.h" +#include "FileMgr.h" +#include "main.h" +#include "AnimManager.h" +#include "AnimBlendAssociation.h" +#include "AnimBlendAssocGroup.h" +#include "AnimBlendClumpData.h" +#include "Pad.h" +#include "DMAudio.h" +#include "World.h" +#include "PlayerPed.h" +#include "Wanted.h" +#include "RpAnimBlend.h" +#include "ModelIndices.h" +#include "TempColModels.h" +#include "ColStore.h" +#include "Radar.h" +#include "Pools.h" +#include "Messages.h" +#include "Population.h" +#include "CarCtrl.h" +#include "Timecycle.h" +#include "Rubbish.h" +#include "Text.h" +#include "Hud.h" +#include "crossplatform.h" + +const struct { + const char *szTrackName; + int iTrackId; +} musicNameIdAssoc[] = { + { "BIKER", STREAMED_SOUND_CUTSCENE_BIKER }, + { "BONEVOY", STREAMED_SOUND_CUTSCENE_BONEVOY }, + { "CAMPAIN", STREAMED_SOUND_CUTSCENE_CAMPAIN }, + { "CASHCHP", STREAMED_SOUND_CUTSCENE_CASHCHP }, + { "CONTBAN", STREAMED_SOUND_CUTSCENE_CONTBAN }, + { "CRAZY69", STREAMED_SOUND_CUTSCENE_CRAZY69 }, + { "CUTTEST", STREAMED_SOUND_CUTSCENE_CUTTEST }, + { "DEADLY", STREAMED_SOUND_CUTSCENE_DEADLY }, + { "DONPROB", STREAMED_SOUND_CUTSCENE_DONPROB }, + { "DRIVNMR", STREAMED_SOUND_CUTSCENE_DRIVNMR }, + { "ELECTON", STREAMED_SOUND_CUTSCENE_ELECTON }, + { "FINAL", STREAMED_SOUND_CUTSCENE_FINAL }, + { "FINAL_2", STREAMED_SOUND_CUTSCENE_FINAL_2 }, + { "HOMSWET", STREAMED_SOUND_CUTSCENE_HOMSWET }, + { "HOTWHEL", STREAMED_SOUND_CUTSCENE_HOTWHEL }, + { "KIDNAPP", STREAMED_SOUND_CUTSCENE_KIDNAPP }, + { "LANDGRB", STREAMED_SOUND_CUTSCENE_LANDGRB }, + { "MORGUE", STREAMED_SOUND_CUTSCENE_MORGUE }, + { "OVERDOS", STREAMED_SOUND_CUTSCENE_OVERDOS }, + { "RUFJUST", STREAMED_SOUND_CUTSCENE_RUFJUST }, + { "SAYONAR", STREAMED_SOUND_CUTSCENE_SAYONAR }, + { "SICILAN", STREAMED_SOUND_CUTSCENE_SICILAN }, + { "THEOFER", STREAMED_SOUND_CUTSCENE_THEOFER }, + { "INTRO", STREAMED_SOUND_CUTSCENE_INTRO }, + { "FINALE", STREAMED_SOUND_CUTSCENE_FINALE }, + { NULL, 0 } +}; + +int +FindCutsceneAudioTrackId(const char *szCutsceneName) +{ + debug("looking for cutscene music track\n"); + for (int i = 0; musicNameIdAssoc[i].szTrackName; i++) { + if (!CGeneral::faststricmp(musicNameIdAssoc[i].szTrackName, szCutsceneName)) { + debug("HUZZA! FOUND cutscene music track\n"); + return musicNameIdAssoc[i].iTrackId; + } + } + debug("NOT FOUND cutscene music track\n"); + return -1; +} + +const char * +GetNextLine(const char *buf, char *line, uint32 lineSize) +{ + while (*buf == '\n' || *buf == '\r') + buf++; + + if (*buf == '\0') + return nil; + + // size check never happened, eh? + while (*buf != '\n' && *buf != '\r') { + if (*buf == '\0') + break; + *(line++) = *(buf++); + } + *(line++) = '\0'; + return buf; +} + +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(¢er, ¢er, 1, RwFrameGetMatrix(frame)); + + float size = RwV3dLength(¢er) + radius; + if (size > *(float*)data) + *(float*)data = size; + return atomic; +} + +void UpdateCutsceneObjectBoundingBox(RpClump* clump, int modelId) +{ + if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ10) { + CColModel* pColModel = &CTempColModels::ms_colModelCutObj[modelId - MI_CUTOBJ01]; + float oldRadius = pColModel->boundingSphere.radius; + float radius = 0.0f; + RpClumpForAllAtomics(clump, CalculateBoundingSphereRadiusCB, &radius); + if (oldRadius < 20.0f) oldRadius = 20.0f; + if (oldRadius < radius) { + debug("Limiting cutscene object radius %f\n", oldRadius); + radius = oldRadius; + } + radius = oldRadius; + pColModel->boundingSphere.radius = radius; + pColModel->boundingBox.min = CVector(-radius, -radius, -radius); + pColModel->boundingBox.max = CVector(radius, radius, radius); + } +} + +bool bCamLoaded; +bool bCamFading; + +// yes, they've actually doubled this thing here, thus this one is unused +static bool bModelsRemovedForCutscene; +static int32 NumberOfSavedWeapons; +static eWeaponType SavedWeaponIDs[TOTAL_WEAPON_SLOTS]; +static int32 SavedWeaponAmmo[TOTAL_WEAPON_SLOTS]; + +enum +{ + CUTMODEL_PLAYER = 1, + CUTMODEL_SIMPLE, + CUTMODEL_REPEATED, +}; + +bool CCutsceneMgr::ms_useCutsceneShadows = true; +bool CCutsceneMgr::mCutsceneSkipFading; +int CCutsceneMgr::mCutsceneSkipFadeTime; +float CCutsceneMgr::m_fPrevCarDensity; +float CCutsceneMgr::m_fPrevPedDensity; +bool CCutsceneMgr::m_PrevExtraColourOn; +uint32 CCutsceneMgr::m_PrevExtraColour; +uint32 CCutsceneMgr::ms_iNumParticleEffects; +sParticleEffect CCutsceneMgr::ms_pParticleEffects[NUM_CUTS_PARTICLE_EFFECTS]; +sToHideItem CCutsceneMgr::ms_crToHideItems[NUMCUTSCENEOBJECTS]; +uint32 CCutsceneMgr::ms_iNumHiddenEntities; +CEntity *CCutsceneMgr::ms_pHiddenEntities[NUMCUTSCENEOBJECTS]; +int CCutsceneMgr::ms_numAttachObjectToBones; +bool CCutsceneMgr::ms_bRepeatObject[NUMCUTSCENEOBJECTS]; +sAttachInfo CCutsceneMgr::ms_iAttachObjectToBone[NUMCUTSCENEOBJECTS]; +uint32 CCutsceneMgr::ms_numUncompressedCutsceneAnims; +char CCutsceneMgr::ms_aUncompressedCutsceneAnims[NUM_CUTS_UNCOMPRESSED_ANIMS][NAMELENGTH]; +uint32 CCutsceneMgr::ms_iTextDuration[NUM_CUTS_MAX_TEXTS]; +uint32 CCutsceneMgr::ms_iTextStartTime[NUM_CUTS_MAX_TEXTS]; +char CCutsceneMgr::ms_cTextOutput[NUM_CUTS_MAX_TEXTS][TEXT_KEY_SIZE]; +uint32 CCutsceneMgr::ms_currTextOutput; +uint32 CCutsceneMgr::ms_numTextOutput; +uint32 CCutsceneMgr::ms_iModelIndex[NUMCUTSCENEOBJECTS]; +char CCutsceneMgr::ms_cLoadAnimName[NUMCUTSCENEOBJECTS][NAMELENGTH]; +char CCutsceneMgr::ms_cLoadObjectName[NUMCUTSCENEOBJECTS][NAMELENGTH]; +int CCutsceneMgr::ms_numLoadObjectNames; +CCutsceneObject *CCutsceneMgr::ms_pCutsceneObjects[NUMCUTSCENEOBJECTS]; +int32 CCutsceneMgr::ms_numCutsceneObjs; +CVector CCutsceneMgr::ms_cutsceneOffset; +float CCutsceneMgr::ms_cutsceneTimer; +uint32 CCutsceneMgr::ms_cutscenePlayStatus; +CAnimBlendAssocGroup CCutsceneMgr::ms_cutsceneAssociations; +char CCutsceneMgr::ms_cutsceneName[CUTSCENENAMESIZE]; + +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_CUTOBJ10) { + pModelInfo = CModelInfo::GetModelInfo(modelId); + pColModel = &CTempColModels::ms_colModelCutObj[modelId - MI_CUTOBJ01]; + pModelInfo->SetColModel(pColModel); + UpdateCutsceneObjectBoundingBox((RpClump*)pModelInfo->GetRwObject(), modelId); + } + + pCutsceneObject = new CCutsceneObject(); + pCutsceneObject->SetModelIndex(modelId); + if (ms_useCutsceneShadows) + pCutsceneObject->CreateShadow(); + ms_pCutsceneObjects[ms_numCutsceneObjs++] = pCutsceneObject; + CStreaming::IHaveUsedStreamingMemory(); + return pCutsceneObject; +} + +void +CCutsceneMgr::SetCutsceneAnim(const char *animName, CObject *pObject) +{ + CAnimBlendAssociation *pNewAnim; + CAnimBlendClumpData *pAnimBlendClumpData; + + debug("Give cutscene anim %s\n", animName); + /*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::SetHeadAnim(const char*, CObject* pObject) +{ + return nil; +} + +void +CCutsceneMgr::StartCutscene() +{ + ms_cutscenePlayStatus = CUTSCENE_STARTED; + if (bCamLoaded) { + TheCamera.SetWideScreenOn(); + CHud::SetHelpMessage(nil, true); + } +} + +void +CCutsceneMgr::SetupCutsceneToStart(void) +{ + if (bCamLoaded) { + TheCamera.SetCamCutSceneOffSet(ms_cutsceneOffset); + TheCamera.TakeControlWithSpline(JUMP_CUT); + TheCamera.SetWideScreenOn(); + CHud::SetHelpMessage(nil, true); + } + + ms_cutsceneOffset.z += 1.0f; + + 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_cutsceneTimer = 0.0f; + ms_running = true; + mCutsceneSkipFadeTime = 0; + mCutsceneSkipFading = 0; +} + +void +CCutsceneMgr::FinishCutscene() +{ + if (bCamLoaded) { + ms_cutsceneTimer = TheCamera.GetCutSceneFinishTime() * 0.001f; + TheCamera.FinishCutscene(); + } + + FindPlayerPed()->bIsVisible = true; + CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false); +} + +uint32 +CCutsceneMgr::GetCutsceneTimeInMilleseconds(void) +{ + return 1000.0f * ms_cutsceneTimer; +} + +bool CCutsceneMgr::HasCutsceneFinished(void) +{ + return !bCamLoaded || TheCamera.GetPositionAlongSpline() == 1.0f; +} + +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::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::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::HideRequestedObjects(void) +{ + int num = ms_iNumHiddenEntities; + ms_iNumHiddenEntities = 0; + + for (int i = 0; i < num; i++) { + int id; + if (CModelInfo::GetModelInfo(ms_crToHideItems[i].name, &id)) { + CVector pos(ms_crToHideItems[i].x, ms_crToHideItems[i].y, ms_crToHideItems[i].z); + int16 foundEntities; + CEntity* pEntities[32]; + CWorld::FindObjectsOfTypeInRange(id, pos, 1.5f, true, &foundEntities, 32, pEntities, true, false, false, true, true); + for (int j = 0; i < foundEntities; j++) { + if (pEntities[j]->bIsVisible) { + ms_pHiddenEntities[ms_iNumHiddenEntities] = pEntities[j]; + ms_pHiddenEntities[ms_iNumHiddenEntities]->RegisterReference(&ms_pHiddenEntities[ms_iNumHiddenEntities]); + ms_pHiddenEntities[ms_iNumHiddenEntities]->bIsVisible = false; + ms_iNumHiddenEntities++; + } + } + } + } +} + +bool +CCutsceneMgr::PresubBodge() +{ + return true; +} + +void +CCutsceneMgr::LoadCutsceneData_loading() +{ + for (int i = 0; i < ms_numLoadObjectNames; i++) { + int mi = ms_iModelIndex[i]; + if (mi >= MI_CUTOBJ01 && mi <= MI_CUTOBJ10) { + if (CStreaming::ms_aInfoForModel[mi].m_loadState != STREAMSTATE_LOADED) + return; + } + } + + if (!LoadCutsceneData_postload()) + return; + + CCutsceneObject* cutsceneObject; + for (int i = 0; i < ms_numLoadObjectNames; i++) { + if (!ms_bRepeatObject[i]) + cutsceneObject = CreateCutsceneObject(ms_iModelIndex[i]); + if (ms_cLoadAnimName[i][0] != '\0') + SetCutsceneAnim(ms_cLoadAnimName[i], cutsceneObject); + } + + for (int i = 0; i < ms_numAttachObjectToBones; i++) { + int objectId = ms_iAttachObjectToBone[i].objectId; + int attachToId = ms_iAttachObjectToBone[i].attachToId; + int bone = ms_iAttachObjectToBone[i].boneId; + AttachObjectToBone(ms_pCutsceneObjects[objectId], ms_pCutsceneObjects[attachToId], bone); + } +} + +bool +CCutsceneMgr::LoadCutsceneData_postload(bool b) +{ + RwStream *stream = nil; + uint32 size; + uint32 offset; + + bool result; + + CMessages::ClearThisBigPrintNow(0); + CPopulation::PedDensityMultiplier = 0.0f; + CCarCtrl::CarDensityMultiplier = 0.0f; + CStreaming::ms_disableStreaming = false; + if (b) + { + sprintf(gString, "%s.IFP", ms_cutsceneName); + result = false; + ms_animLoaded = false; + RwStreamClose(stream, nil); // umm... + sprintf(gString, "%s.DAT", ms_cutsceneName); + bCamLoaded = false; + } else { + + stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "ANIM\\CUTS.IMG"); + sprintf(gString, "%s.IFP", ms_cutsceneName); + if (stream) { + if (ms_pCutsceneDir->FindItem(gString, offset, size)) + { + CStreaming::MakeSpaceFor(size << 11); + CStreaming::ImGonnaUseStreamingMemory(); + RwStreamSkip(stream, offset << 11); + CAnimManager::LoadAnimFile(stream, true, ms_aUncompressedCutsceneAnims); + ms_cutsceneAssociations.CreateAssociations(ms_cutsceneName, ms_cLoadAnimName[0], ms_cLoadObjectName[0], NAMELENGTH); + CStreaming::IHaveUsedStreamingMemory(); + ms_animLoaded = true; + } + else + { + ms_animLoaded = false; + } + RwStreamClose(stream, nil); + + int file = CFileMgr::OpenFile("ANIM\\CUTS.IMG", "rb"); + sprintf(gString, "%s.DAT", ms_cutsceneName); + if (file) { + if (ms_pCutsceneDir->FindItem(gString, offset, size)) + { + CStreaming::ImGonnaUseStreamingMemory(); + CFileMgr::Seek(file, offset << 11, 0); + TheCamera.LoadPathSplines(file); + CStreaming::IHaveUsedStreamingMemory(); + bCamLoaded = true; + } + else + { + bCamLoaded = false; + } + result = true; + CFileMgr::CloseFile(file); + } + else + { + bCamLoaded = false; + result = true; + } + } + else + { + result = false; + ms_animLoaded = false; + RwStreamClose(stream, nil); + sprintf(gString, "%s.DAT", ms_cutsceneName); + bCamLoaded = false; + } + } + ms_cutsceneLoadStatus = CUTSCENE_LOADED; + ms_cutsceneTimer = 0.0f; + FindPlayerPed()->m_pWanted->ClearQdCrimes(); + return result; +} + +void +CCutsceneMgr::LoadCutsceneData_overlay(const char *szCutsceneName) +{ + CTimer::Suspend(); + ms_cutsceneProcessing = true; + ms_wasCutsceneSkipped = false; + if (!bModelsRemovedForCutscene) + CStreaming::RemoveCurrentZonesModels(); + + ms_pCutsceneDir->numEntries = 0; + ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR"); + + CStreaming::RemoveUnusedModelsInLoadedList(); + CGame::DrasticTidyUpMemory(true); + + strcpy(ms_cutsceneName, szCutsceneName); + + LoadCutsceneData_preload(); + CTimer::Resume(); +} + +void +CCutsceneMgr::LoadCutsceneData_preload(void) +{ + uint32 size; + uint32 offset; + CPlayerPed* pPlayerPed; + if (CGeneral::faststricmp(ms_cutsceneName, "finale")) { + DMAudio.ChangeMusicMode(MUSICMODE_CUTSCENE); + int trackId = FindCutsceneAudioTrackId(ms_cutsceneName); + if (trackId != -1) { + printf("Start preload audio %s\n", ms_cutsceneName); + DMAudio.PreloadCutSceneMusic(trackId); + printf("End preload audio %s\n", ms_cutsceneName); + } + } + + for (int i = MI_CUTOBJ01; i <= MI_CUTOBJ10; i++) { + if (CModelInfo::GetModelInfo(i)->GetNumRefs() <= 0) { + if (CStreaming::ms_aInfoForModel[i].m_loadState == STREAMSTATE_LOADED) { + CStreaming::RemoveModel(i); + CModelInfo::GetModelInfo(i)->SetModelName("&*%"); + } + } + } + + m_PrevExtraColour = CTimeCycle::m_ExtraColour; + m_PrevExtraColourOn = CTimeCycle::m_bExtraColourOn != 0; + m_fPrevPedDensity = CPopulation::PedDensityMultiplier; + m_fPrevCarDensity = CCarCtrl::CarDensityMultiplier; + ms_cutsceneOffset = CVector(0.0f, 0.0f, 0.0f); + ms_numTextOutput = 0; + ms_currTextOutput = 0; + ms_numLoadObjectNames = 0; + ms_numUncompressedCutsceneAnims = 0; + ms_numAttachObjectToBones = 0; + ms_iNumHiddenEntities = 0; + bCamFading = false; + ms_iNumParticleEffects = 0; + + for (int i = 0; i < NUM_CUTS_UNCOMPRESSED_ANIMS; i++) + ms_aUncompressedCutsceneAnims[i][0] = '\0'; + + memset(ms_iModelIndex, 0, sizeof(ms_iModelIndex)); + CRubbish::SetVisibility(false); + + 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); + + sprintf(gString, "%s.CUT", ms_cutsceneName); + if (!ms_pCutsceneDir->FindItem(gString, offset, size)) { + LoadCutsceneData_postload(); + return; + } + + size <<= 11; + offset <<= 11; + + char *cutsBuf = new char[size]; + + RwStream* stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "ANIM\\CUTS.IMG"); + + if (stream) { + RwStreamSkip(stream, offset); + RwStreamRead(stream, cutsBuf, size); + RwStreamClose(stream, nil); + } + + enum + { + CUT_NONE = 0, + CUT_INFO, + CUT_MODEL, + CUT_TEXT, + CUT_UNCOMPRESS, + CUT_ATTACH, + CUT_REMOVE, + CUT_PARTICLE_EFFECT, + CUT_EXTRA_COLOR, + }; + + int cutSection = CUT_NONE; + bool bExtraColSet = false; + + char line[1024]; + const char *pCurLine = cutsBuf; + + while (true) + { + pCurLine = GetNextLine(pCurLine, line, sizeof(line)); + if (pCurLine) { + if (line[0] == '\0') + break; + + if (strcmp(line, "end") == 0) { + cutSection = CUT_NONE; + continue; + } + + switch (cutSection) + { + case CUT_NONE: + if (strcmp(line, "info") == 0) + cutSection = CUT_INFO; + if (strcmp(line, "model") == 0) + cutSection = CUT_MODEL; + if (strcmp(line, "text") == 0) + cutSection = CUT_TEXT; + if (strcmp(line, "uncompress") == 0) + cutSection = CUT_UNCOMPRESS; + if (strcmp(line, "attach") == 0) + cutSection = CUT_ATTACH; + if (strcmp(line, "remove") == 0) + cutSection = CUT_REMOVE; + if (strcmp(line, "peffect") == 0) + cutSection = CUT_PARTICLE_EFFECT; + if (strcmp(line, "extracol") == 0) + cutSection = CUT_EXTRA_COLOR; + break; + case CUT_INFO: + { + if (strncmp(line, "offset", 6) == 0) { + float x, y, z; + sscanf(line+7, "%f %f %f", &x, &y, &z); + FindPlayerPed(); // called for some sa check in here + ms_cutsceneOffset = CVector(x, y, z); + } + break; + } + case CUT_MODEL: + { + char objectName[NAMELENGTH]; + char animName[NAMELENGTH]; + + int num; // unused + sscanf(strtok(line, " ,"), "%d", &num); + strcpy(objectName, strtok(nil, " ,")); + char* pAnimName = strtok(0, " ,"); + strlwr(objectName); + + bool bUsedFirstTime = true; + if (pAnimName) { + do { + strcpy(animName, pAnimName); + strlwr(animName); + strcpy(ms_cLoadObjectName[ms_numLoadObjectNames], objectName); + strcpy(ms_cLoadAnimName[ms_numLoadObjectNames], animName); + if (bUsedFirstTime) { + bUsedFirstTime = false; + ms_iModelIndex[ms_numLoadObjectNames] = CUTMODEL_SIMPLE; + ms_bRepeatObject[ms_numLoadObjectNames] = false; + } else { + ms_bRepeatObject[ms_numLoadObjectNames] = true; + ms_iModelIndex[ms_numLoadObjectNames] = CUTMODEL_REPEATED; + } + ms_numLoadObjectNames++; + pAnimName = strtok(0, " ,"); + } while (pAnimName); + } + break; + } + case CUT_TEXT: + { + int iTextStartTime, iTextDuration; + char cTextOutput[8]; + sscanf(line, "%d,%d,%s", &iTextStartTime, &iTextDuration, cTextOutput); + for (size_t i = 0; i < strlen(cTextOutput); i++) + cTextOutput[i] = toupper(cTextOutput[i]); + + memcpy(ms_cTextOutput[ms_numTextOutput], cTextOutput, strlen(cTextOutput)+1); + ms_iTextStartTime[ms_numTextOutput] = iTextStartTime; + ms_iTextDuration[ms_numTextOutput] = iTextDuration; + ms_numTextOutput++; + break; + } + case CUT_UNCOMPRESS: + LoadAnimationUncompressed(strtok(line, " ,")); + break; + case CUT_ATTACH: + { + int attachToId, objectId, bone; + sscanf(line, "%d,%d,%d", &attachToId, &objectId, &bone); + ms_iAttachObjectToBone[ms_numAttachObjectToBones].attachToId = attachToId; + ms_iAttachObjectToBone[ms_numAttachObjectToBones].objectId = objectId; + ms_iAttachObjectToBone[ms_numAttachObjectToBones].boneId = bone; + ms_numAttachObjectToBones++; + break; + } + case CUT_REMOVE: + { + float x, y, z; + char name[NAMELENGTH]; + sscanf(line, "%f,%f,%f,%s", &x, &y, &z, name); + ms_crToHideItems[ms_iNumHiddenEntities].x = x; + ms_crToHideItems[ms_iNumHiddenEntities].y = y; + ms_crToHideItems[ms_iNumHiddenEntities].z = z; + strcpy(ms_crToHideItems[ms_iNumHiddenEntities].name, name); + ms_iNumHiddenEntities++; + break; + } + case CUT_PARTICLE_EFFECT: + { + char name[NAMELENGTH]; + char name2[NAMELENGTH]; + + int iTime; + int unk1; + int unk2; + float x; + float y; + float z; + float unkX; + float unkY; + float unkZ; + + memset(name, 0, NAMELENGTH); + memset(name2, 0, NAMELENGTH); + + strncpy(name, strtok(line, ","), NAMELENGTH-1); + iTime = atoi(strtok(0, ",")); + unk1 = atoi(strtok(0, ",")); + unk2 = atoi(strtok(0, ",")); + strncpy(name, strtok(line, ","), NAMELENGTH-1); + x = strtod(strtok(0, ","), nil); + y = strtod(strtok(0, ","), nil); + z = strtod(strtok(0, ","), nil); + unkX = strtod(strtok(0, ","), nil); + unkY = strtod(strtok(0, ","), nil); + unkZ = strtod(strtok(0, ","), nil); + + ms_pParticleEffects[ms_iNumParticleEffects].bPlayed = false; + ms_pParticleEffects[ms_iNumParticleEffects].iTime = iTime; + ms_pParticleEffects[ms_iNumParticleEffects].unk1 = unk1; + ms_pParticleEffects[ms_iNumParticleEffects].unk2 = unk2; + strcpy(CCutsceneMgr::ms_pParticleEffects[ms_iNumParticleEffects].name2, name2); + ms_pParticleEffects[ms_iNumParticleEffects].unk10 = false; + ms_pParticleEffects[ms_iNumParticleEffects].x = x; + ms_pParticleEffects[ms_iNumParticleEffects].y = y; + ms_pParticleEffects[ms_iNumParticleEffects].z = z; + ms_pParticleEffects[ms_iNumParticleEffects].unkX = unkX; + ms_pParticleEffects[ms_iNumParticleEffects].unkY = unkY; + ms_pParticleEffects[ms_iNumParticleEffects].unkZ = unkZ; + ms_pParticleEffects[ms_iNumParticleEffects].unk11 = false; + strcpy(CCutsceneMgr::ms_pParticleEffects[ms_iNumParticleEffects].name, name); + ms_iNumParticleEffects++; + break; + } + case CUT_EXTRA_COLOR: + if (!bExtraColSet) { + int colorId; + sscanf(line, "%d", &colorId); + if (colorId == 0) + bExtraColSet = false; + else { + CTimeCycle::StartExtraColour(colorId - 1, false); + bExtraColSet = true; + } + } + break; + default: + break; + }; + + } + else + { + delete[]cutsBuf; + + // add manually inserted objects + for (int i = 0; i < ms_numAppendObjectNames; i++) { + strcpy(ms_cLoadObjectName[ms_numLoadObjectNames], ms_cAppendObjectName[i]); + strcpy(ms_cLoadAnimName[ms_numLoadObjectNames], ms_cAppendAnimName[i]); + ms_iModelIndex[ms_numLoadObjectNames] = CUTMODEL_SIMPLE; + ms_numLoadObjectNames++; + } + ms_numAppendObjectNames = 0; + + int specialId = 0; + for (int i = 0; i < ms_numLoadObjectNames; i++) + { + if (strcasecmp(ms_cLoadObjectName[i], "csplay") == 0) { + ms_iModelIndex[i] = CUTMODEL_PLAYER; + continue; + } else if (ms_iModelIndex[i] == CUTMODEL_SIMPLE) { + int id; + if (CModelInfo::GetModelInfo(ms_cLoadObjectName[i], &id)) { + ms_iModelIndex[i] = id; + CStreaming::RequestModel(id, STREAMFLAGS_SCRIPTOWNED | STREAMFLAGS_DEPENDENCY | STREAMFLAGS_PRIORITY); + } else { + CStreaming::RequestSpecialModel(specialId + MI_CUTOBJ01, ms_cLoadObjectName[i], STREAMFLAGS_SCRIPTOWNED | STREAMFLAGS_DEPENDENCY | STREAMFLAGS_PRIORITY); + ms_iModelIndex[i] = specialId + MI_CUTOBJ01; + specialId++; + // skip if id is busy + while (CStreaming::ms_aInfoForModel[specialId + MI_CUTOBJ01].m_loadState == STREAMSTATE_LOADED) + specialId++; + } + } + else if (ms_iModelIndex[i] == CUTMODEL_REPEATED && i != 0) + ms_iModelIndex[i] = ms_iModelIndex[i - 1]; + } + + CStreaming::LoadAllRequestedModels(true); + ms_cutsceneLoadStatus = CUTSCENE_LOADING; + return; + } + } + + delete[]cutsBuf; + LoadCutsceneData_postload(true); +} + +void +CCutsceneMgr::DeleteCutsceneData_overlay(void) +{ + if (ms_cutsceneLoadStatus == CUTSCENE_NOT_LOADED) return; + CTimer::Suspend(); + CPopulation::PedDensityMultiplier = m_fPrevPedDensity; + CCarCtrl::CarDensityMultiplier = m_fPrevCarDensity; + if (m_PrevExtraColourOn) + CTimeCycle::StartExtraColour(m_PrevExtraColour, false); + else + CTimeCycle::StopExtraColour(m_PrevExtraColourOn); + + for (uint32 i = 0; i < ms_iNumHiddenEntities; i++) { + if (ms_pHiddenEntities[i]) { + ms_pHiddenEntities[i]->CleanUpOldReference(&ms_pHiddenEntities[i]); + ms_pHiddenEntities[i]->bIsVisible = true; + } + } + + ms_iNumHiddenEntities = 0; + ms_iNumParticleEffects = 0; + CMessages::ClearMessages(); + CRubbish::SetVisibility(true); + + ms_cutsceneProcessing = false; + ms_useLodMultiplier = false; + ms_useCutsceneShadows = false; + + ms_numCutsceneObjs--; + while (ms_numCutsceneObjs >= 0) { + CWorld::Remove(ms_pCutsceneObjects[ms_numCutsceneObjs]); + ms_pCutsceneObjects[ms_numCutsceneObjs]->DeleteRwObject(); + delete ms_pCutsceneObjects[ms_numCutsceneObjs]; + ms_pCutsceneObjects[ms_numCutsceneObjs] = nil; + ms_numCutsceneObjs--; + } + ms_numCutsceneObjs = 0; + + if (ms_animLoaded) + CAnimManager::RemoveLastAnimFile(); + + ms_animLoaded = false; + ms_cutsceneAssociations.DestroyAssociations(); + + ms_aUncompressedCutsceneAnims[0][0] = '\0'; + ms_numUncompressedCutsceneAnims = 0; + + if (bCamLoaded) { + TheCamera.RestoreWithJumpCut(); + TheCamera.SetWideScreenOff(); + TheCamera.DeleteCutSceneCamDataMemory(); + } + ms_cutsceneLoadStatus = CUTSCENE_NOT_LOADED; + ms_running = 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 (bModelsRemovedForCutscene) { + CStreaming::LoadInitialPeds(); + CStreaming::LoadInitialWeapons(); + CStreaming::LoadInitialVehicles(); + bModelsRemovedForCutscene = 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; + } + + for (int i = 0; i < ms_numLoadObjectNames; i++) + CStreaming::SetMissionDoesntRequireModel(ms_iModelIndex[i]); + + CStreaming::SetMissionDoesntRequireModel(MI_COP); + CStreaming::StreamZoneModels(FindPlayerCoors()); + CTimer::Resume(); +} + +void +CCutsceneMgr::Update_overlay(void) +{ + if (ms_cutsceneLoadStatus == CUTSCENE_LOADING) { + debug("Loading Cutscene...\n"); + CTimer::Suspend(); + LoadCutsceneData_loading(); + CTimer::Resume(); + return; + } + + if (ms_cutsceneLoadStatus != CUTSCENE_LOADED) { + debug("Cutscene Not Loaded!\n"); + return; + } + + switch (ms_cutscenePlayStatus) { + case CUTSCENE_STARTED: + SetupCutsceneToStart(); + HideRequestedObjects(); + ms_cutscenePlayStatus++; + break; + case CUTSCENE_PLAYING_2: + case CUTSCENE_PLAYING_3: + ms_cutscenePlayStatus++; + break; + case CUTSCENE_PLAYING_4: + ms_cutscenePlayStatus = CUTSCENE_PLAYING_0; + if (CGeneral::faststricmp(ms_cutsceneName, "finale")) + DMAudio.PlayPreloadedCutSceneMusic(); + break; + default: + break; + } + + if (!ms_running) return; + + ms_cutsceneTimer += CTimer::GetTimeStepNonClippedInSeconds(); + uint32 cutsceneTimeInMS = GetCutsceneTimeInMilleseconds(); + + if (ms_currTextOutput < ms_numTextOutput && cutsceneTimeInMS > ms_iTextStartTime[ms_currTextOutput]) { + CMessages::AddMessageJumpQ(TheText.Get(ms_cTextOutput[ms_currTextOutput]), ms_iTextDuration[ms_currTextOutput], 1); + ms_currTextOutput++; + } + + for (int i = 0; i < ms_numCutsceneObjs; i++) { + int modelId = ms_pCutsceneObjects[i]->GetModelIndex(); + if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ10) + UpdateCutsceneObjectBoundingBox(ms_pCutsceneObjects[i]->GetClump(), modelId); + } + + if (!bCamLoaded) return; + + if (CGeneral::faststricmp(ms_cutsceneName, "finale") && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FLYBY && ms_cutsceneLoadStatus == CUTSCENE_LOADED) { + if (TheCamera.GetCutSceneFinishTime() < cutsceneTimeInMS + 1000) { + if (!bCamFading) { + bCamFading = true; + TheCamera.Fade(1.0f, FADE_OUT); + } + } + if (mCutsceneSkipFading) { + mCutsceneSkipFadeTime -= CTimer::GetTimeStepInMilliseconds(); + if (mCutsceneSkipFadeTime < 0) { + CHud::m_BigMessage[1][0] = '\0'; + ms_wasCutsceneSkipped = true; + FinishCutscene(); + mCutsceneSkipFading = false; + mCutsceneSkipFadeTime = 0; + } + } + else if (IsCutsceneSkipButtonBeingPressed() && PresubBodge()){ + mCutsceneSkipFading = true; + mCutsceneSkipFadeTime = 1000; + TheCamera.Fade(1.0f, FADE_OUT); + } + } +}
\ No newline at end of file diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index c692a51b..cd341eac 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -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; diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 098b2fc3..2a16dc14 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -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; } diff --git a/src/audio/audio_enums.h b/src/audio/audio_enums.h index 91fcec49..b2fb627c 100644 --- a/src/audio/audio_enums.h +++ b/src/audio/audio_enums.h @@ -12,8 +12,8 @@ enum eRadioStation EMOTION, WAVE, USERTRACK, - NUM_RADIOS = 10, - POLICE_RADIO = 10, + NUM_RADIOS = 11, + POLICE_RADIO = 11, //TAXI_RADIO, RADIO_OFF, }; @@ -38,1230 +38,72 @@ enum ePlayerMood enum eStreamedSounds { - STREAMED_SOUND_RADIO_WILD, + STREAMED_SOUND_RADIO_HEAD, + STREAMED_SOUND_RADIO_DOUBLE, + STREAMED_SOUND_RADIO_KJAH, + STREAMED_SOUND_RADIO_RISE, + STREAMED_SOUND_RADIO_LIPS, + STREAMED_SOUND_RADIO_MUNDO, + STREAMED_SOUND_RADIO_MSX, STREAMED_SOUND_RADIO_FLASH, - STREAMED_SOUND_RADIO_KCHAT, - STREAMED_SOUND_RADIO_FEVER, - STREAMED_SOUND_RADIO_VROCK, - STREAMED_SOUND_RADIO_VCPR, - STREAMED_SOUND_RADIO_ESPANTOSO, - STREAMED_SOUND_RADIO_EMOTION, - STREAMED_SOUND_RADIO_WAVE, + STREAMED_SOUND_RADIO_LCJ, + STREAMED_SOUND_RADIO_LCFR, STREAMED_SOUND_RADIO_MP3_PLAYER, STREAMED_SOUND_CITY_AMBIENT, STREAMED_SOUND_WATER_AMBIENT, - STREAMED_SOUND_BEACH_AMBIENT, - STREAMED_SOUND_HAVANA_CITY_AMBIENT, - STREAMED_SOUND_HAVANA_WATER_AMBIENT, - STREAMED_SOUND_HAVANA_BEACH_AMBIENT, - STREAMED_SOUND_MALL_AMBIENT, - STREAMED_SOUND_STRIPCLUB_AMBIENT, - STREAMED_SOUND_MALIBU_AMBIENT, - STREAMED_SOUND_HOTEL_AMBIENT, - STREAMED_SOUND_DIRTRING_AMBIENT, - STREAMED_SOUND_LAW4RIOT_AMBIENT, - STREAMED_SOUND_AMBSIL_AMBIENT, + STREAMED_SOUND_SAWMILL, + STREAMED_SOUND_HAVANA_CITY_AMBIENT, // CITY + STREAMED_SOUND_HAVANA_WATER_AMBIENT, // WATER + STREAMED_SOUND_HAVANA_BEACH_AMBIENT, // WATER + STREAMED_SOUND_MALL_AMBIENT, // CITY + STREAMED_SOUND_STRIPCLUB_AMBIENT, // CITY + STREAMED_SOUND_MALIBU_AMBIENT, // CITY + STREAMED_SOUND_HOTEL_AMBIENT, // CITY + STREAMED_SOUND_DIRTRING_AMBIENT, // CITY + STREAMED_SOUND_LAW4RIOT_AMBIENT, // CITY + STREAMED_SOUND_AMBSIL_AMBIENT, // CITY STREAMED_SOUND_RADIO_POLICE, STREAMED_SOUND_RADIO_TAXI, - STREAMED_SOUND_ANNOUNCE_BRIDGE_CLOSED, - STREAMED_SOUND_ANNOUNCE_BRIDGE_OPEN, - STREAMED_SOUND_CUTSCENE_ASS_1, - STREAMED_SOUND_CUTSCENE_ASS_2, - STREAMED_SOUND_CUTSCENE_BANK_1, - STREAMED_SOUND_CUTSCENE_BANK_2A, - STREAMED_SOUND_CUTSCENE_BANK_2B, - STREAMED_SOUND_CUTSCENE_BANK_3A, - STREAMED_SOUND_CUTSCENE_BANK_3B, - STREAMED_SOUND_CUTSCENE_BANK_4, - STREAMED_SOUND_CUTSCENE_BIKE_1, - STREAMED_SOUND_CUTSCENE_BIKE_2, - STREAMED_SOUND_CUTSCENE_BIKE_3, - STREAMED_SOUND_CUTSCENE_BUD_1, - STREAMED_SOUND_CUTSCENE_BUD_2, - STREAMED_SOUND_CUTSCENE_BUD_3, - STREAMED_SOUND_CUTSCENE_CAP_1, - STREAMED_SOUND_CUTSCENE_CAR_1, - STREAMED_SOUND_CUTSCENE_CNT_1A, - STREAMED_SOUND_CUTSCENE_CNT_1B, - STREAMED_SOUND_CUTSCENE_CNT_2, - STREAMED_SOUND_CUTSCENE_COK_1, - STREAMED_SOUND_CUTSCENE_COK_2A, - STREAMED_SOUND_CUTSCENE_COK_2B, - STREAMED_SOUND_CUTSCENE_COK_3, - STREAMED_SOUND_CUTSCENE_COK_4A, - STREAMED_SOUND_CUTSCENE_COK_4A2, - STREAMED_SOUND_CUTSCENE_COK_4B, - STREAMED_SOUND_CUTSCENE_COL_1, - STREAMED_SOUND_CUTSCENE_COL_2, - STREAMED_SOUND_CUTSCENE_COL_3A, - STREAMED_SOUND_CUTSCENE_COL_4A, - STREAMED_SOUND_CUTSCENE_COL_5A, - STREAMED_SOUND_CUTSCENE_COL_5B, - STREAMED_SOUND_CUTSCENE_CUB_1, - STREAMED_SOUND_CUTSCENE_CUB_2, - STREAMED_SOUND_CUTSCENE_CUB_3, - STREAMED_SOUND_CUTSCENE_CUB_4, - STREAMED_SOUND_CUTSCENE_DRUG_1, - STREAMED_SOUND_CUTSCENE_FIN, - STREAMED_SOUND_CUTSCENE_FIN2, + STREAMED_SOUND_NEWS_A, + STREAMED_SOUND_NEWS_B, + STREAMED_SOUND_NEWS_C, + STREAMED_SOUND_NEWS_D, + STREAMED_SOUND_NEWS_E, + STREAMED_SOUND_NEWS_F, + STREAMED_SOUND_NEWS_G, + STREAMED_SOUND_NEWS_H, + STREAMED_SOUND_NEWS_I, + STREAMED_SOUND_NEWS_J, + STREAMED_SOUND_NEWS_K, + STREAMED_SOUND_NEWS_L, + STREAMED_SOUND_NEWS_M, + STREAMED_SOUND_NEWS_N, + STREAMED_SOUND_CUTSCENE_BIKER, + STREAMED_SOUND_CUTSCENE_BONEVOY, + STREAMED_SOUND_CUTSCENE_CAMPAIN, + STREAMED_SOUND_CUTSCENE_CASHCHP, + STREAMED_SOUND_CUTSCENE_CONTBAN, + STREAMED_SOUND_CUTSCENE_CRAZY69, + STREAMED_SOUND_CUTSCENE_CUTTEST, + STREAMED_SOUND_CUTSCENE_DEADLY, + STREAMED_SOUND_CUTSCENE_DONPROB, + STREAMED_SOUND_CUTSCENE_DRIVNMR, + STREAMED_SOUND_CUTSCENE_ELECTON, + STREAMED_SOUND_CUTSCENE_FINAL, + STREAMED_SOUND_CUTSCENE_FINAL_2, + STREAMED_SOUND_CUTSCENE_HOMSWET, + STREAMED_SOUND_CUTSCENE_HOTWHEL, + STREAMED_SOUND_CUTSCENE_KIDNAPP, + STREAMED_SOUND_CUTSCENE_LANDGRB, + STREAMED_SOUND_CUTSCENE_MORGUE, + STREAMED_SOUND_CUTSCENE_OVERDOS, + STREAMED_SOUND_CUTSCENE_RUFJUST, + STREAMED_SOUND_CUTSCENE_SAYONAR, + STREAMED_SOUND_CUTSCENE_SICILAN, + STREAMED_SOUND_CUTSCENE_THEOFER, + STREAMED_SOUND_CUTSCENE_INTRO, STREAMED_SOUND_CUTSCENE_FINALE, - STREAMED_SOUND_CUTSCENE_HAT_1, - STREAMED_SOUND_CUTSCENE_HAT_2, - STREAMED_SOUND_CUTSCENE_HAT_3, - STREAMED_SOUND_CUTSCENE_ICE_1, - STREAMED_SOUND_CUTSCENE_INT_A, - STREAMED_SOUND_CUTSCENE_INT_B, - STREAMED_SOUND_CUTSCENE_INT_D, - STREAMED_SOUND_CUTSCENE_INT_M, - STREAMED_SOUND_CUTSCENE_LAW_1A, - STREAMED_SOUND_CUTSCENE_LAW_1B, - STREAMED_SOUND_CUTSCENE_LAW_2A, - STREAMED_SOUND_CUTSCENE_LAW_2B, - STREAMED_SOUND_CUTSCENE_LAW_2C, - STREAMED_SOUND_CUTSCENE_LAW_3, - STREAMED_SOUND_CUTSCENE_LAW_4, - STREAMED_SOUND_CUTSCENE_PHIL_1, - STREAMED_SOUND_CUTSCENE_PHIL_2, - STREAMED_SOUND_CUTSCENE_PORN_1, - STREAMED_SOUND_CUTSCENE_PORN_2, - STREAMED_SOUND_CUTSCENE_PORN_3, - STREAMED_SOUND_CUTSCENE_PORN_4, - STREAMED_SOUND_CUTSCENE_RESC_1A, - STREAMED_SOUND_CUTSCENE_ROK_1, - STREAMED_SOUND_CUTSCENE_ROK_2, - STREAMED_SOUND_CUTSCENE_ROK_3A, - STREAMED_SOUND_CUTSCENE_STRIPA, - STREAMED_SOUND_CUTSCENE_TAX_1, - STREAMED_SOUND_CUTSCENE_TEX_1, - STREAMED_SOUND_CUTSCENE_TEX_2, - STREAMED_SOUND_CUTSCENE_TEX_3, - STREAMED_SOUND_CUTSCENE_GLIGHT, - STREAMED_SOUND_CUTSCENE_FIST, - STREAMED_SOUND_CUTSCENE_ELBURRO1_PH1, - STREAMED_SOUND_CUTSCENE_ELBURRO2_PH2, STREAMED_SOUND_MISSION_COMPLETED, - STREAMED_SOUND_MISSION_COMPLETED4, - STREAMED_SOUND_MISSION_MOBR1, - STREAMED_SOUND_MISSION_PAGER, - STREAMED_SOUND_MISSION_CARREV, - STREAMED_SOUND_MISSION_BIKEREV, - STREAMED_SOUND_MISSION_LIFTOP, - STREAMED_SOUND_MISSION_LIFTCL, - STREAMED_SOUND_MISSION_LIFTRUN, - STREAMED_SOUND_MISSION_LIFTBEL, - STREAMED_SOUND_MISSION_INLIFT, - STREAMED_SOUND_MISSION_SFX_01, - STREAMED_SOUND_MISSION_SFX_02, - STREAMED_SOUND_MISSION_CAMERAL, - STREAMED_SOUND_MISSION_CAMERAR, - STREAMED_SOUND_MISSION_CHEER1, - STREAMED_SOUND_MISSION_CHEER2, - STREAMED_SOUND_MISSION_CHEER3, - STREAMED_SOUND_MISSION_CHEER4, - STREAMED_SOUND_MISSION_OOH1, - STREAMED_SOUND_MISSION_OOH2, - STREAMED_SOUND_MISSION_RACE1, - STREAMED_SOUND_MISSION_RACE2, - STREAMED_SOUND_MISSION_RACE3, - STREAMED_SOUND_MISSION_RACE4, - STREAMED_SOUND_MISSION_RACE5, - STREAMED_SOUND_MISSION_RACE6, - STREAMED_SOUND_MISSION_RACE7, - STREAMED_SOUND_MISSION_RACE8, - STREAMED_SOUND_MISSION_RACE9, - STREAMED_SOUND_MISSION_RACE10, - STREAMED_SOUND_MISSION_RACE11, - STREAMED_SOUND_MISSION_RACE12, - STREAMED_SOUND_MISSION_RACE13, - STREAMED_SOUND_MISSION_RACE14, - STREAMED_SOUND_MISSION_RACE15, - STREAMED_SOUND_MISSION_HOT1, - STREAMED_SOUND_MISSION_HOT2, - STREAMED_SOUND_MISSION_HOT3, - STREAMED_SOUND_MISSION_HOT4, - STREAMED_SOUND_MISSION_HOT5, - STREAMED_SOUND_MISSION_HOT6, - STREAMED_SOUND_MISSION_HOT7, - STREAMED_SOUND_MISSION_HOT8, - STREAMED_SOUND_MISSION_HOT9, - STREAMED_SOUND_MISSION_HOT10, - STREAMED_SOUND_MISSION_HOT11, - STREAMED_SOUND_MISSION_HOT12, - STREAMED_SOUND_MISSION_HOT13, - STREAMED_SOUND_MISSION_HOT14, - STREAMED_SOUND_MISSION_HOT15, - STREAMED_SOUND_MISSION_LANSTP1, - STREAMED_SOUND_MISSION_LANSTP2, - STREAMED_SOUND_MISSION_LANAMU1, - STREAMED_SOUND_MISSION_LANAMU2, - STREAMED_SOUND_MISSION_AIRHORNL, - STREAMED_SOUND_MISSION_AIRHORNR, - STREAMED_SOUND_MISSION_SNIPSCRL, - STREAMED_SOUND_MISSION_SNIPSHORT, - STREAMED_SOUND_MISSION_BLOWROOF, - STREAMED_SOUND_MISSION_ASS_1, - STREAMED_SOUND_MISSION_ASS_2, - STREAMED_SOUND_MISSION_ASS_3, - STREAMED_SOUND_MISSION_ASS_4, - STREAMED_SOUND_MISSION_ASS_5, - STREAMED_SOUND_MISSION_ASS_6, - STREAMED_SOUND_MISSION_ASS_7, - STREAMED_SOUND_MISSION_ASS_8, - STREAMED_SOUND_MISSION_ASS_9, - STREAMED_SOUND_MISSION_ASS_10, - STREAMED_SOUND_MISSION_ASS_11, - STREAMED_SOUND_MISSION_ASS_12, - STREAMED_SOUND_MISSION_ASS_13, - STREAMED_SOUND_MISSION_ASS_14, - STREAMED_SOUND_MISSION_BIKE1_1, - STREAMED_SOUND_MISSION_BIKE1_2, - STREAMED_SOUND_MISSION_BIKE1_3, - STREAMED_SOUND_MISSION_BNK1_1, - STREAMED_SOUND_MISSION_BNK1_2, - STREAMED_SOUND_MISSION_BNK1_3, - STREAMED_SOUND_MISSION_BNK1_4, - STREAMED_SOUND_MISSION_BNK1_5, - STREAMED_SOUND_MISSION_BNK1_6, - STREAMED_SOUND_MISSION_BNK1_7, - STREAMED_SOUND_MISSION_BNK1_8, - STREAMED_SOUND_MISSION_BNK1_10, - STREAMED_SOUND_MISSION_BNK1_11, - STREAMED_SOUND_MISSION_BNK1_12, - STREAMED_SOUND_MISSION_BNK1_13, - STREAMED_SOUND_MISSION_BNK1_14, - STREAMED_SOUND_MISSION_BNK2_1, - STREAMED_SOUND_MISSION_BNK2_2, - STREAMED_SOUND_MISSION_BNK2_3, - STREAMED_SOUND_MISSION_BNK2_4, - STREAMED_SOUND_MISSION_BNK2_5, - STREAMED_SOUND_MISSION_BNK2_6, - STREAMED_SOUND_MISSION_BNK2_7, - STREAMED_SOUND_MISSION_BNK2_8, - STREAMED_SOUND_MISSION_BNK2_9, - STREAMED_SOUND_MISSION_BNK3_1, - STREAMED_SOUND_MISSION_BNK3_2, - STREAMED_SOUND_MISSION_BNK3_3A, - STREAMED_SOUND_MISSION_BNK3_3B, - STREAMED_SOUND_MISSION_BNK3_3C, - STREAMED_SOUND_MISSION_BNK3_4A, - STREAMED_SOUND_MISSION_BNK3_4B, - STREAMED_SOUND_MISSION_BNK3_4C, - STREAMED_SOUND_MISSION_BNK4_1, - STREAMED_SOUND_MISSION_BNK4_2, - STREAMED_SOUND_MISSION_BNK4_3A, - STREAMED_SOUND_MISSION_BNK4_3B, - STREAMED_SOUND_MISSION_BNK4_3C, - STREAMED_SOUND_MISSION_BNK4_3D, - STREAMED_SOUND_MISSION_BNK4_3E, - STREAMED_SOUND_MISSION_BNK4_3F, - STREAMED_SOUND_MISSION_BNK4_3G, - STREAMED_SOUND_MISSION_BNK4_3H, - STREAMED_SOUND_MISSION_BNK4_3I, - STREAMED_SOUND_MISSION_BNK4_3J, - STREAMED_SOUND_MISSION_BNK4_3K, - STREAMED_SOUND_MISSION_BNK4_3M, - STREAMED_SOUND_MISSION_BNK4_3O, - STREAMED_SOUND_MISSION_BNK4_3P, - STREAMED_SOUND_MISSION_BNK4_3Q, - STREAMED_SOUND_MISSION_BNK4_3R, - STREAMED_SOUND_MISSION_BNK4_3S, - STREAMED_SOUND_MISSION_BNK4_3T, - STREAMED_SOUND_MISSION_BNK4_3U, - STREAMED_SOUND_MISSION_BNK4_3V, - STREAMED_SOUND_MISSION_BNK4_4A, - STREAMED_SOUND_MISSION_BNK4_4B, - STREAMED_SOUND_MISSION_BNK4_5, - STREAMED_SOUND_MISSION_BNK4_6, - STREAMED_SOUND_MISSION_BNK4_7, - STREAMED_SOUND_MISSION_BNK4_8, - STREAMED_SOUND_MISSION_BNK4_9, - STREAMED_SOUND_MISSION_BNK4_10, - STREAMED_SOUND_MISSION_BNK4_11, - STREAMED_SOUND_MISSION_BK4_12A, - STREAMED_SOUND_MISSION_BK4_12B, - STREAMED_SOUND_MISSION_BK4_12C, - STREAMED_SOUND_MISSION_BNK4_13, - STREAMED_SOUND_MISSION_BK4_14A, - STREAMED_SOUND_MISSION_BK4_14B, - STREAMED_SOUND_MISSION_BNK4_15, - STREAMED_SOUND_MISSION_BNK4_16, - STREAMED_SOUND_MISSION_BNK4_17, - STREAMED_SOUND_MISSION_BNK4_18, - STREAMED_SOUND_MISSION_BK4_19A, - STREAMED_SOUND_MISSION_BK4_19B, - STREAMED_SOUND_MISSION_BK4_20A, - STREAMED_SOUND_MISSION_BK4_20B, - STREAMED_SOUND_MISSION_BNK4_21, - STREAMED_SOUND_MISSION_BNK422A, - STREAMED_SOUND_MISSION_BNK422B, - STREAMED_SOUND_MISSION_BK4_23A, - STREAMED_SOUND_MISSION_BK4_23B, - STREAMED_SOUND_MISSION_BK4_23C, - STREAMED_SOUND_MISSION_BK4_23D, - STREAMED_SOUND_MISSION_BK4_24A, - STREAMED_SOUND_MISSION_BK4_24B, - STREAMED_SOUND_MISSION_BNK4_25, - STREAMED_SOUND_MISSION_BNK4_26, - STREAMED_SOUND_MISSION_BNK4_27, - STREAMED_SOUND_MISSION_BNK4_28, - STREAMED_SOUND_MISSION_BNK4_29, - STREAMED_SOUND_MISSION_BNK4_30, - STREAMED_SOUND_MISSION_BK4_31A, - STREAMED_SOUND_MISSION_BK4_31B, - STREAMED_SOUND_MISSION_BNK4_32, - STREAMED_SOUND_MISSION_BK4_34A, - STREAMED_SOUND_MISSION_BK4_34B, - STREAMED_SOUND_MISSION_BK4_35A, - STREAMED_SOUND_MISSION_BK4_35B, - STREAMED_SOUND_MISSION_BNK4_36, - STREAMED_SOUND_MISSION_BNK4_37, - STREAMED_SOUND_MISSION_BNK4_38, - STREAMED_SOUND_MISSION_BNK4_39, - STREAMED_SOUND_MISSION_BK4_40A, - STREAMED_SOUND_MISSION_BK4_40B, - STREAMED_SOUND_MISSION_BNK4_41, - STREAMED_SOUND_MISSION_BNK4_42, - STREAMED_SOUND_MISSION_BNK4_43, - STREAMED_SOUND_MISSION_BNK4_44, - STREAMED_SOUND_MISSION_BNK4_45, - STREAMED_SOUND_MISSION_BNK4_46, - STREAMED_SOUND_MISSION_BNK4_47, - STREAMED_SOUND_MISSION_BNK4_48, - STREAMED_SOUND_MISSION_BNK4_49, - STREAMED_SOUND_MISSION_BNK450A, - STREAMED_SOUND_MISSION_BNK450B, - STREAMED_SOUND_MISSION_BNK4_51, - STREAMED_SOUND_MISSION_BNK4_94, - STREAMED_SOUND_MISSION_BNK4_95, - STREAMED_SOUND_MISSION_BNK4_96, - STREAMED_SOUND_MISSION_BNK4_97, - STREAMED_SOUND_MISSION_BNK4_98, - STREAMED_SOUND_MISSION_BNK4_99, - STREAMED_SOUND_MISSION_BUD1_1, - STREAMED_SOUND_MISSION_BUD1_2, - STREAMED_SOUND_MISSION_BUD1_3, - STREAMED_SOUND_MISSION_BUD1_4, - STREAMED_SOUND_MISSION_BUD1_5, - STREAMED_SOUND_MISSION_BUD1_9, - STREAMED_SOUND_MISSION_BUD1_10, - STREAMED_SOUND_MISSION_BUD2_1, - STREAMED_SOUND_MISSION_BUD2_2, - STREAMED_SOUND_MISSION_BUD2_3, - STREAMED_SOUND_MISSION_BUD2_4, - STREAMED_SOUND_MISSION_BUD2_5, - STREAMED_SOUND_MISSION_BUD2_6, - STREAMED_SOUND_MISSION_BUD2_7, - STREAMED_SOUND_MISSION_BUD3_1, - STREAMED_SOUND_MISSION_BUD3_1A, - STREAMED_SOUND_MISSION_BUD3_1B, - STREAMED_SOUND_MISSION_BUD3_1C, - STREAMED_SOUND_MISSION_BUD3_2, - STREAMED_SOUND_MISSION_BUD3_3, - STREAMED_SOUND_MISSION_BUD3_4, - STREAMED_SOUND_MISSION_BUD3_5, - STREAMED_SOUND_MISSION_BUD3_6, - STREAMED_SOUND_MISSION_BUD3_7, - STREAMED_SOUND_MISSION_BUD3_8A, - STREAMED_SOUND_MISSION_BUD3_8B, - STREAMED_SOUND_MISSION_BUD3_8C, - STREAMED_SOUND_MISSION_BUD3_9A, - STREAMED_SOUND_MISSION_BUD3_9B, - STREAMED_SOUND_MISSION_BUD3_9C, - STREAMED_SOUND_MISSION_CAP1_2, - STREAMED_SOUND_MISSION_CAP1_3, - STREAMED_SOUND_MISSION_CAP1_4, - STREAMED_SOUND_MISSION_CAP1_5, - STREAMED_SOUND_MISSION_CAP1_6, - STREAMED_SOUND_MISSION_CAP1_7, - STREAMED_SOUND_MISSION_CAP1_8, - STREAMED_SOUND_MISSION_CAP1_9, - STREAMED_SOUND_MISSION_CAP1_10, - STREAMED_SOUND_MISSION_CAP1_11, - STREAMED_SOUND_MISSION_CAP1_12, - STREAMED_SOUND_MISSION_CNT1_1, - STREAMED_SOUND_MISSION_CNT1_2, - STREAMED_SOUND_MISSION_CNT1_3, - STREAMED_SOUND_MISSION_CNT1_4, - STREAMED_SOUND_MISSION_CNT1_5, - STREAMED_SOUND_MISSION_CNT2_1, - STREAMED_SOUND_MISSION_CNT2_2, - STREAMED_SOUND_MISSION_CNT2_3, - STREAMED_SOUND_MISSION_CNT2_4, - STREAMED_SOUND_MISSION_COK1_1, - STREAMED_SOUND_MISSION_COK1_2, - STREAMED_SOUND_MISSION_COK1_3, - STREAMED_SOUND_MISSION_COK1_4, - STREAMED_SOUND_MISSION_COK1_5, - STREAMED_SOUND_MISSION_COK1_6, - STREAMED_SOUND_MISSION_COK2_1, - STREAMED_SOUND_MISSION_COK2_2, - STREAMED_SOUND_MISSION_COK2_3, - STREAMED_SOUND_MISSION_COK2_4, - STREAMED_SOUND_MISSION_COK2_5, - STREAMED_SOUND_MISSION_COK2_6, - STREAMED_SOUND_MISSION_COK2_7A, - STREAMED_SOUND_MISSION_COK2_7B, - STREAMED_SOUND_MISSION_COK2_7C, - STREAMED_SOUND_MISSION_COK2_8A, - STREAMED_SOUND_MISSION_COK2_8B, - STREAMED_SOUND_MISSION_COK2_8C, - STREAMED_SOUND_MISSION_COK2_8D, - STREAMED_SOUND_MISSION_COK2_9, - STREAMED_SOUND_MISSION_COK210A, - STREAMED_SOUND_MISSION_COK210B, - STREAMED_SOUND_MISSION_COK210C, - STREAMED_SOUND_MISSION_COK212A, - STREAMED_SOUND_MISSION_COK212B, - STREAMED_SOUND_MISSION_COK2_13, - STREAMED_SOUND_MISSION_COK2_14, - STREAMED_SOUND_MISSION_COK2_15, - STREAMED_SOUND_MISSION_COK2_16, - STREAMED_SOUND_MISSION_COK2_20, - STREAMED_SOUND_MISSION_COK2_21, - STREAMED_SOUND_MISSION_COK2_22, - STREAMED_SOUND_MISSION_COK3_1, - STREAMED_SOUND_MISSION_COK3_2, - STREAMED_SOUND_MISSION_COK3_3, - STREAMED_SOUND_MISSION_COK3_4, - STREAMED_SOUND_MISSION_COK4_1, - STREAMED_SOUND_MISSION_COK4_2, - STREAMED_SOUND_MISSION_COK4_3, - STREAMED_SOUND_MISSION_COK4_4, - STREAMED_SOUND_MISSION_COK4_5, - STREAMED_SOUND_MISSION_COK4_6, - STREAMED_SOUND_MISSION_COK4_7, - STREAMED_SOUND_MISSION_COK4_8, - STREAMED_SOUND_MISSION_COK4_9, - STREAMED_SOUND_MISSION_COK4_9A, - STREAMED_SOUND_MISSION_COK4_10, - STREAMED_SOUND_MISSION_COK4_11, - STREAMED_SOUND_MISSION_COK4_12, - STREAMED_SOUND_MISSION_COK4_13, - STREAMED_SOUND_MISSION_COK4_14, - STREAMED_SOUND_MISSION_COK4_15, - STREAMED_SOUND_MISSION_COK4_16, - STREAMED_SOUND_MISSION_COK4_17, - STREAMED_SOUND_MISSION_COK4_18, - STREAMED_SOUND_MISSION_COK4_19, - STREAMED_SOUND_MISSION_COK4_20, - STREAMED_SOUND_MISSION_COK4_21, - STREAMED_SOUND_MISSION_COK4_22, - STREAMED_SOUND_MISSION_COK4_23, - STREAMED_SOUND_MISSION_COK4_24, - STREAMED_SOUND_MISSION_COK4_25, - STREAMED_SOUND_MISSION_COK4_26, - STREAMED_SOUND_MISSION_COK4_27, - STREAMED_SOUND_MISSION_COL1_1, - STREAMED_SOUND_MISSION_COL1_2, - STREAMED_SOUND_MISSION_COL1_3, - STREAMED_SOUND_MISSION_COL1_4, - STREAMED_SOUND_MISSION_COL1_5, - STREAMED_SOUND_MISSION_COL1_6, - STREAMED_SOUND_MISSION_COL1_7, - STREAMED_SOUND_MISSION_COL1_8, - STREAMED_SOUND_MISSION_COL2_1, - STREAMED_SOUND_MISSION_COL2_2, - STREAMED_SOUND_MISSION_COL2_3, - STREAMED_SOUND_MISSION_COL2_4, - STREAMED_SOUND_MISSION_COL2_5, - STREAMED_SOUND_MISSION_COL2_6A, - STREAMED_SOUND_MISSION_COL2_7, - STREAMED_SOUND_MISSION_COL2_8, - STREAMED_SOUND_MISSION_COL2_9, - STREAMED_SOUND_MISSION_COL2_10, - STREAMED_SOUND_MISSION_COL2_11, - STREAMED_SOUND_MISSION_COL2_12, - STREAMED_SOUND_MISSION_COL2_13, - STREAMED_SOUND_MISSION_COL2_14, - STREAMED_SOUND_MISSION_COL2_15, - STREAMED_SOUND_MISSION_COL2_16, - STREAMED_SOUND_MISSION_COL3_1, - STREAMED_SOUND_MISSION_COL3_2, - STREAMED_SOUND_MISSION_COL3_2A, - STREAMED_SOUND_MISSION_COL3_2B, - STREAMED_SOUND_MISSION_COL3_3, - STREAMED_SOUND_MISSION_COL3_4, - STREAMED_SOUND_MISSION_COL3_5, - STREAMED_SOUND_MISSION_COL3_6, - STREAMED_SOUND_MISSION_COL3_7, - STREAMED_SOUND_MISSION_COL3_8, - STREAMED_SOUND_MISSION_COL3_9, - STREAMED_SOUND_MISSION_COL3_10, - STREAMED_SOUND_MISSION_COL3_11, - STREAMED_SOUND_MISSION_COL3_12, - STREAMED_SOUND_MISSION_COL3_13, - STREAMED_SOUND_MISSION_COL3_14, - STREAMED_SOUND_MISSION_COL3_15, - STREAMED_SOUND_MISSION_COL3_16, - STREAMED_SOUND_MISSION_COL3_17, - STREAMED_SOUND_MISSION_COL3_18, - STREAMED_SOUND_MISSION_COL3_19, - STREAMED_SOUND_MISSION_COL3_20, - STREAMED_SOUND_MISSION_COL3_21, - STREAMED_SOUND_MISSION_COL3_23, - STREAMED_SOUND_MISSION_COL3_24, - STREAMED_SOUND_MISSION_COL3_25, - STREAMED_SOUND_MISSION_COL4_1, - STREAMED_SOUND_MISSION_COL4_2, - STREAMED_SOUND_MISSION_COL4_3, - STREAMED_SOUND_MISSION_COL4_4, - STREAMED_SOUND_MISSION_COL4_5, - STREAMED_SOUND_MISSION_COL4_6, - STREAMED_SOUND_MISSION_COL4_7, - STREAMED_SOUND_MISSION_COL4_8, - STREAMED_SOUND_MISSION_COL4_9, - STREAMED_SOUND_MISSION_COL4_10, - STREAMED_SOUND_MISSION_COL4_11, - STREAMED_SOUND_MISSION_COL4_12, - STREAMED_SOUND_MISSION_COL4_13, - STREAMED_SOUND_MISSION_COL4_14, - STREAMED_SOUND_MISSION_COL4_15, - STREAMED_SOUND_MISSION_COL4_16, - STREAMED_SOUND_MISSION_COL4_17, - STREAMED_SOUND_MISSION_COL4_18, - STREAMED_SOUND_MISSION_COL4_19, - STREAMED_SOUND_MISSION_COL4_20, - STREAMED_SOUND_MISSION_COL4_21, - STREAMED_SOUND_MISSION_COL4_22, - STREAMED_SOUND_MISSION_COL4_23, - STREAMED_SOUND_MISSION_COL4_24, - STREAMED_SOUND_MISSION_COL4_25, - STREAMED_SOUND_MISSION_COL4_26, - STREAMED_SOUND_MISSION_COL5_1, - STREAMED_SOUND_MISSION_COL5_2, - STREAMED_SOUND_MISSION_COL5_3, - STREAMED_SOUND_MISSION_COL5_4, - STREAMED_SOUND_MISSION_COL5_5, - STREAMED_SOUND_MISSION_COL5_6, - STREAMED_SOUND_MISSION_COL5_7, - STREAMED_SOUND_MISSION_COL5_8, - STREAMED_SOUND_MISSION_COL5_9, - STREAMED_SOUND_MISSION_COL5_10, - STREAMED_SOUND_MISSION_COL5_11, - STREAMED_SOUND_MISSION_COL5_12, - STREAMED_SOUND_MISSION_COL5_13, - STREAMED_SOUND_MISSION_COL5_14, - STREAMED_SOUND_MISSION_COL5_15, - STREAMED_SOUND_MISSION_COL5_16, - STREAMED_SOUND_MISSION_COL5_17, - STREAMED_SOUND_MISSION_COL5_18, - STREAMED_SOUND_MISSION_COL5_19, - STREAMED_SOUND_MISSION_COL5_20, - STREAMED_SOUND_MISSION_COL5_21, - STREAMED_SOUND_MISSION_COL5_22, - STREAMED_SOUND_MISSION_CUB1_1, - STREAMED_SOUND_MISSION_CUB1_2, - STREAMED_SOUND_MISSION_CUB1_3, - STREAMED_SOUND_MISSION_CUB1_4, - STREAMED_SOUND_MISSION_CUB1_5, - STREAMED_SOUND_MISSION_CUB1_6, - STREAMED_SOUND_MISSION_CUB1_7, - STREAMED_SOUND_MISSION_CUB1_8, - STREAMED_SOUND_MISSION_CUB1_9, - STREAMED_SOUND_MISSION_CUB1_10, - STREAMED_SOUND_MISSION_CUB2_1, - STREAMED_SOUND_MISSION_CUB2_2, - STREAMED_SOUND_MISSION_CUB2_3A, - STREAMED_SOUND_MISSION_CUB2_3B, - STREAMED_SOUND_MISSION_CUB2_3C, - STREAMED_SOUND_MISSION_CUB2_4A, - STREAMED_SOUND_MISSION_CUB2_5, - STREAMED_SOUND_MISSION_CUB2_6, - STREAMED_SOUND_MISSION_CUB2_7, - STREAMED_SOUND_MISSION_CUB2_8, - STREAMED_SOUND_MISSION_CUB2_9, - STREAMED_SOUND_MISSION_CUB2_10, - STREAMED_SOUND_MISSION_CUB2_11, - STREAMED_SOUND_MISSION_CUB3_1, - STREAMED_SOUND_MISSION_CUB3_2, - STREAMED_SOUND_MISSION_CUB3_3, - STREAMED_SOUND_MISSION_CUB3_4, - STREAMED_SOUND_MISSION_CUB4_1, - STREAMED_SOUND_MISSION_CUB4_2, - STREAMED_SOUND_MISSION_CUB4_3, - STREAMED_SOUND_MISSION_CUB4_4, - STREAMED_SOUND_MISSION_CUB4_5, - STREAMED_SOUND_MISSION_CUB4_5A, - STREAMED_SOUND_MISSION_CUB4_6, - STREAMED_SOUND_MISSION_CUB4_7, - STREAMED_SOUND_MISSION_CUB4_8, - STREAMED_SOUND_MISSION_CUB4_9, - STREAMED_SOUND_MISSION_CUB4_10, - STREAMED_SOUND_MISSION_CUB4_11, - STREAMED_SOUND_MISSION_CUB4_12, - STREAMED_SOUND_MISSION_CUB4_13, - STREAMED_SOUND_MISSION_CUB4_14, - STREAMED_SOUND_MISSION_CUB4_15, - STREAMED_SOUND_MISSION_CUB4_16, - STREAMED_SOUND_MISSION_GOLF_1, - STREAMED_SOUND_MISSION_GOLF_2, - STREAMED_SOUND_MISSION_GOLF_3, - STREAMED_SOUND_MISSION_BAR_1, - STREAMED_SOUND_MISSION_BAR_2, - STREAMED_SOUND_MISSION_BAR_3, - STREAMED_SOUND_MISSION_BAR_4, - STREAMED_SOUND_MISSION_BAR_5, - STREAMED_SOUND_MISSION_BAR_6, - STREAMED_SOUND_MISSION_BAR_7, - STREAMED_SOUND_MISSION_BAR_8, - STREAMED_SOUND_MISSION_STRIP_1, - STREAMED_SOUND_MISSION_STRIP_2, - STREAMED_SOUND_MISSION_STRIP_3, - STREAMED_SOUND_MISSION_STRIP_4, - STREAMED_SOUND_MISSION_STRIP_5, - STREAMED_SOUND_MISSION_STRIP_6, - STREAMED_SOUND_MISSION_STRIP_7, - STREAMED_SOUND_MISSION_STRIP_8, - STREAMED_SOUND_MISSION_STRIP_9, - STREAMED_SOUND_MISSION_STAR_1, - STREAMED_SOUND_MISSION_STAR_2, - STREAMED_SOUND_MISSION_STAR_3, - STREAMED_SOUND_MISSION_STAR_4, - STREAMED_SOUND_MISSION_FIN_1A, - STREAMED_SOUND_MISSION_FIN_1B, - STREAMED_SOUND_MISSION_FIN_1C, - STREAMED_SOUND_MISSION_FIN_2B, - STREAMED_SOUND_MISSION_FIN_2C, - STREAMED_SOUND_MISSION_FIN_3, - STREAMED_SOUND_MISSION_FIN_4, - STREAMED_SOUND_MISSION_FIN_5, - STREAMED_SOUND_MISSION_FIN_6, - STREAMED_SOUND_MISSION_FIN_10, - STREAMED_SOUND_MISSION_FIN_11A, - STREAMED_SOUND_MISSION_FIN_11B, - STREAMED_SOUND_MISSION_FIN_12A, - STREAMED_SOUND_MISSION_FIN_12B, - STREAMED_SOUND_MISSION_FIN_12C, - STREAMED_SOUND_MISSION_FIN_13, - STREAMED_SOUND_MISSION_FINKILL, - STREAMED_SOUND_MISSION_LAW1_1, - STREAMED_SOUND_MISSION_LAW1_2, - STREAMED_SOUND_MISSION_LAW1_3, - STREAMED_SOUND_MISSION_LAW1_4, - STREAMED_SOUND_MISSION_LAW1_5, - STREAMED_SOUND_MISSION_LAW1_6, - STREAMED_SOUND_MISSION_LAW1_7, - STREAMED_SOUND_MISSION_LAW1_8, - STREAMED_SOUND_MISSION_LAW1_9, - STREAMED_SOUND_MISSION_LAW1_10, - STREAMED_SOUND_MISSION_LAW2_1, - STREAMED_SOUND_MISSION_LAW2_2, - STREAMED_SOUND_MISSION_LAW2_3, - STREAMED_SOUND_MISSION_LAW2_4, - STREAMED_SOUND_MISSION_LAW2_5, - STREAMED_SOUND_MISSION_LAW2_6, - STREAMED_SOUND_MISSION_LAW2_7, - STREAMED_SOUND_MISSION_LAW2_8, - STREAMED_SOUND_MISSION_LAW2_9, - STREAMED_SOUND_MISSION_LAW2_10, - STREAMED_SOUND_MISSION_LAW3_1, - STREAMED_SOUND_MISSION_LAW3_2, - STREAMED_SOUND_MISSION_LAW3_3, - STREAMED_SOUND_MISSION_LAW3_4, - STREAMED_SOUND_MISSION_LAW3_5, - STREAMED_SOUND_MISSION_LAW3_6, - STREAMED_SOUND_MISSION_LAW3_10, - STREAMED_SOUND_MISSION_LAW3_11, - STREAMED_SOUND_MISSION_LAW3_12, - STREAMED_SOUND_MISSION_LAW3_13, - STREAMED_SOUND_MISSION_LAW3_14, - STREAMED_SOUND_MISSION_LAW3_16, - STREAMED_SOUND_MISSION_LAW3_17, - STREAMED_SOUND_MISSION_LAW3_18, - STREAMED_SOUND_MISSION_LAW3_19, - STREAMED_SOUND_MISSION_LAW3_20, - STREAMED_SOUND_MISSION_LAW3_21, - STREAMED_SOUND_MISSION_LAW3_22, - STREAMED_SOUND_MISSION_LAW3_23, - STREAMED_SOUND_MISSION_LAW3_24, - STREAMED_SOUND_MISSION_LAW3_25, - STREAMED_SOUND_MISSION_LAW4_1A, - STREAMED_SOUND_MISSION_LAW4_1B, - STREAMED_SOUND_MISSION_LAW4_1C, - STREAMED_SOUND_MISSION_LAW4_1D, - STREAMED_SOUND_MISSION_LAW4_10, - STREAMED_SOUND_MISSION_LAW4_3, - STREAMED_SOUND_MISSION_LAW4_4, - STREAMED_SOUND_MISSION_LAW4_5, - STREAMED_SOUND_MISSION_LAW4_6, - STREAMED_SOUND_MISSION_LAW4_7, - STREAMED_SOUND_MISSION_LAW4_8, - STREAMED_SOUND_MISSION_LAW4_9, - STREAMED_SOUND_MISSION_PHIL1_2, - STREAMED_SOUND_MISSION_PHIL1_3, - STREAMED_SOUND_MISSION_PHIL2_1, - STREAMED_SOUND_MISSION_PHIL2_2, - STREAMED_SOUND_MISSION_PHIL2_3, - STREAMED_SOUND_MISSION_PHIL2_4, - STREAMED_SOUND_MISSION_PHIL2_5, - STREAMED_SOUND_MISSION_PHIL2_6, - STREAMED_SOUND_MISSION_PHIL2_7, - STREAMED_SOUND_MISSION_PHIL2_8, - STREAMED_SOUND_MISSION_PHIL2_9, - STREAMED_SOUND_MISSION_PHIL210, - STREAMED_SOUND_MISSION_PHIL211, - STREAMED_SOUND_MISSION_PORN1_1, - STREAMED_SOUND_MISSION_PORN1_2, - STREAMED_SOUND_MISSION_PORN1_3, - STREAMED_SOUND_MISSION_PRN1_3A, - STREAMED_SOUND_MISSION_PORN1_4, - STREAMED_SOUND_MISSION_PORN1_5, - STREAMED_SOUND_MISSION_PORN1_6, - STREAMED_SOUND_MISSION_PORN1_7, - STREAMED_SOUND_MISSION_PORN1_8, - STREAMED_SOUND_MISSION_PORN1_9, - STREAMED_SOUND_MISSION_PRN1_10, - STREAMED_SOUND_MISSION_PRN1_11, - STREAMED_SOUND_MISSION_PRN1_12, - STREAMED_SOUND_MISSION_PRN1_13, - STREAMED_SOUND_MISSION_PRN1_14, - STREAMED_SOUND_MISSION_PRN1_15, - STREAMED_SOUND_MISSION_PRN1_16, - STREAMED_SOUND_MISSION_PRN1_17, - STREAMED_SOUND_MISSION_PRN1_18, - STREAMED_SOUND_MISSION_PRN1_19, - STREAMED_SOUND_MISSION_PRN1_20, - STREAMED_SOUND_MISSION_PRN1_21, - STREAMED_SOUND_MISSION_PORN3_1, - STREAMED_SOUND_MISSION_PORN3_2, - STREAMED_SOUND_MISSION_PORN3_3, - STREAMED_SOUND_MISSION_PORN3_4, - STREAMED_SOUND_MISSION_PSYCH_1, - STREAMED_SOUND_MISSION_PSYCH_2, - STREAMED_SOUND_MISSION_ROK2_01, - STREAMED_SOUND_MISSION_ROK3_1, - STREAMED_SOUND_MISSION_ROK3_2, - STREAMED_SOUND_MISSION_ROK3_3, - STREAMED_SOUND_MISSION_ROK3_4, - STREAMED_SOUND_MISSION_ROK3_5, - STREAMED_SOUND_MISSION_ROK3_6, - STREAMED_SOUND_MISSION_ROK3_7, - STREAMED_SOUND_MISSION_ROK3_8, - STREAMED_SOUND_MISSION_ROK3_9, - STREAMED_SOUND_MISSION_ROK3_10, - STREAMED_SOUND_MISSION_ROK3_11, - STREAMED_SOUND_MISSION_ROK3_12, - STREAMED_SOUND_MISSION_ROK3_13, - STREAMED_SOUND_MISSION_ROK3_14, - STREAMED_SOUND_MISSION_ROK3_15, - STREAMED_SOUND_MISSION_ROK3_16, - STREAMED_SOUND_MISSION_ROK3_17, - STREAMED_SOUND_MISSION_ROK3_18, - STREAMED_SOUND_MISSION_ROK3_19, - STREAMED_SOUND_MISSION_ROK3_20, - STREAMED_SOUND_MISSION_ROK3_21, - STREAMED_SOUND_MISSION_ROK3_22, - STREAMED_SOUND_MISSION_ROK3_23, - STREAMED_SOUND_MISSION_ROK3_24, - STREAMED_SOUND_MISSION_ROK3_25, - STREAMED_SOUND_MISSION_ROK3_26, - STREAMED_SOUND_MISSION_ROK3_27, - STREAMED_SOUND_MISSION_ROK3_62, - STREAMED_SOUND_MISSION_ROK3_63, - STREAMED_SOUND_MISSION_ROK3_64, - STREAMED_SOUND_MISSION_ROK3_65, - STREAMED_SOUND_MISSION_ROK3_66, - STREAMED_SOUND_MISSION_ROK3_67, - STREAMED_SOUND_MISSION_ROK3_68, - STREAMED_SOUND_MISSION_ROK3_69, - STREAMED_SOUND_MISSION_ROK3_70, - STREAMED_SOUND_MISSION_ROK3_71, - STREAMED_SOUND_MISSION_ROK3_73, - STREAMED_SOUND_MISSION_RESC_1, - STREAMED_SOUND_MISSION_RESC_2, - STREAMED_SOUND_MISSION_RESC_3, - STREAMED_SOUND_MISSION_RESC_4, - STREAMED_SOUND_MISSION_RESC_5, - STREAMED_SOUND_MISSION_RESC_6, - STREAMED_SOUND_MISSION_RESC_7, - STREAMED_SOUND_MISSION_RESC_8, - STREAMED_SOUND_MISSION_RESC_9, - STREAMED_SOUND_MISSION_RESC_10, - STREAMED_SOUND_MISSION_ROK1_1A, - STREAMED_SOUND_MISSION_ROK1_1B, - STREAMED_SOUND_MISSION_ROK1_5, - STREAMED_SOUND_MISSION_ROK1_6, - STREAMED_SOUND_MISSION_ROK1_7, - STREAMED_SOUND_MISSION_ROK1_8, - STREAMED_SOUND_MISSION_ROK1_9, - STREAMED_SOUND_MISSION_TAX1_1, - STREAMED_SOUND_MISSION_TAX1_2, - STREAMED_SOUND_MISSION_TAX1_3, - STREAMED_SOUND_MISSION_TAX1_4, - STREAMED_SOUND_MISSION_TAX1_5, - STREAMED_SOUND_MISSION_TAX2_1, - STREAMED_SOUND_MISSION_TAX2_2, - STREAMED_SOUND_MISSION_TAX2_3, - STREAMED_SOUND_MISSION_TAX2_4, - STREAMED_SOUND_MISSION_TAX2_5, - STREAMED_SOUND_MISSION_TAX2_6, - STREAMED_SOUND_MISSION_TAX2_7, - STREAMED_SOUND_MISSION_TAX3_1, - STREAMED_SOUND_MISSION_TAX3_2, - STREAMED_SOUND_MISSION_TAX3_3, - STREAMED_SOUND_MISSION_TAX3_4, - STREAMED_SOUND_MISSION_TAX3_5, - STREAMED_SOUND_MISSION_TEX1_1, - STREAMED_SOUND_MISSION_TEX1_2, - STREAMED_SOUND_MISSION_TEX1_3, - STREAMED_SOUND_MISSION_TEX1_4, - STREAMED_SOUND_MISSION_TEX1_5, - STREAMED_SOUND_MISSION_TEX1_6, - STREAMED_SOUND_MISSION_TEX2_1, - STREAMED_SOUND_MISSION_TEX3_1, - STREAMED_SOUND_MISSION_TEX3_2, - STREAMED_SOUND_MISSION_TEX3_3, - STREAMED_SOUND_MISSION_TEX3_4, - STREAMED_SOUND_MISSION_TEX3_5, - STREAMED_SOUND_MISSION_TEX3_6, - STREAMED_SOUND_MISSION_TEX3_7, - STREAMED_SOUND_MISSION_TEX3_8, - STREAMED_SOUND_MISSION_HAT_1A, - STREAMED_SOUND_MISSION_INTRO1, - STREAMED_SOUND_MISSION_INTRO2, - STREAMED_SOUND_MISSION_INTRO3, - STREAMED_SOUND_MISSION_INTRO4, - STREAMED_SOUND_MISSION_MOB_01A, - STREAMED_SOUND_MISSION_MOB_01B, - STREAMED_SOUND_MISSION_MOB_01C, - STREAMED_SOUND_MISSION_MOB_02A, - STREAMED_SOUND_MISSION_MOB_02B, - STREAMED_SOUND_MISSION_MOB_02C, - STREAMED_SOUND_MISSION_MOB_03A, - STREAMED_SOUND_MISSION_MOB_03B, - STREAMED_SOUND_MISSION_MOB_03C, - STREAMED_SOUND_MISSION_MOB_03D, - STREAMED_SOUND_MISSION_MOB_03E, - STREAMED_SOUND_MISSION_SHARK_1, - STREAMED_SOUND_MISSION_SHARK_2, - STREAMED_SOUND_MISSION_SHARK_3, - STREAMED_SOUND_MISSION_SHARK_4, - STREAMED_SOUND_MISSION_SHARK_5, - STREAMED_SOUND_MISSION_MOB_04A, - STREAMED_SOUND_MISSION_MOB_04B, - STREAMED_SOUND_MISSION_MOB_04C, - STREAMED_SOUND_MISSION_MOB_04D, - STREAMED_SOUND_MISSION_MOB_05A, - STREAMED_SOUND_MISSION_MOB_05B, - STREAMED_SOUND_MISSION_MOB_05C, - STREAMED_SOUND_MISSION_MOB_05D, - STREAMED_SOUND_MISSION_MOB_06A, - STREAMED_SOUND_MISSION_MOB_06B, - STREAMED_SOUND_MISSION_MOB_06C, - STREAMED_SOUND_MISSION_MOB_07A, - STREAMED_SOUND_MISSION_MOB_07B, - STREAMED_SOUND_MISSION_MOB_08A, - STREAMED_SOUND_MISSION_MOB_08B, - STREAMED_SOUND_MISSION_MOB_08C, - STREAMED_SOUND_MISSION_MOB_08D, - STREAMED_SOUND_MISSION_MOB_08E, - STREAMED_SOUND_MISSION_MOB_08F, - STREAMED_SOUND_MISSION_MOB_08G, - STREAMED_SOUND_MISSION_MOB_09A, - STREAMED_SOUND_MISSION_MOB_09B, - STREAMED_SOUND_MISSION_MOB_09C, - STREAMED_SOUND_MISSION_MOB_09D, - STREAMED_SOUND_MISSION_MOB_09E, - STREAMED_SOUND_MISSION_MOB_09F, - STREAMED_SOUND_MISSION_MOB_10A, - STREAMED_SOUND_MISSION_MOB_10B, - STREAMED_SOUND_MISSION_MOB_10C, - STREAMED_SOUND_MISSION_MOB_10D, - STREAMED_SOUND_MISSION_MOB_10E, - STREAMED_SOUND_MISSION_MOB_11A, - STREAMED_SOUND_MISSION_MOB_11B, - STREAMED_SOUND_MISSION_MOB_11C, - STREAMED_SOUND_MISSION_MOB_11D, - STREAMED_SOUND_MISSION_MOB_11E, - STREAMED_SOUND_MISSION_MOB_11F, - STREAMED_SOUND_MISSION_MOB_14A, - STREAMED_SOUND_MISSION_MOB_14B, - STREAMED_SOUND_MISSION_MOB_14C, - STREAMED_SOUND_MISSION_MOB_14D, - STREAMED_SOUND_MISSION_MOB_14E, - STREAMED_SOUND_MISSION_MOB_14F, - STREAMED_SOUND_MISSION_MOB_14G, - STREAMED_SOUND_MISSION_MOB_14H, - STREAMED_SOUND_MISSION_MOB_16A, - STREAMED_SOUND_MISSION_MOB_16B, - STREAMED_SOUND_MISSION_MOB_16C, - STREAMED_SOUND_MISSION_MOB_16D, - STREAMED_SOUND_MISSION_MOB_16E, - STREAMED_SOUND_MISSION_MOB_16F, - STREAMED_SOUND_MISSION_MOB_16G, - STREAMED_SOUND_MISSION_MOB_17A, - STREAMED_SOUND_MISSION_MOB_17B, - STREAMED_SOUND_MISSION_MOB_17C, - STREAMED_SOUND_MISSION_MOB_17D, - STREAMED_SOUND_MISSION_MOB_17E, - STREAMED_SOUND_MISSION_MOB_17G, - STREAMED_SOUND_MISSION_MOB_17H, - STREAMED_SOUND_MISSION_MOB_17I, - STREAMED_SOUND_MISSION_MOB_17J, - STREAMED_SOUND_MISSION_MOB_17K, - STREAMED_SOUND_MISSION_MOB_17L, - STREAMED_SOUND_MISSION_MOB_18A, - STREAMED_SOUND_MISSION_MOB_18B, - STREAMED_SOUND_MISSION_MOB_18C, - STREAMED_SOUND_MISSION_MOB_18D, - STREAMED_SOUND_MISSION_MOB_18E, - STREAMED_SOUND_MISSION_MOB_18F, - STREAMED_SOUND_MISSION_MOB_18G, - STREAMED_SOUND_MISSION_MOB_20A, - STREAMED_SOUND_MISSION_MOB_20B, - STREAMED_SOUND_MISSION_MOB_20C, - STREAMED_SOUND_MISSION_MOB_20D, - STREAMED_SOUND_MISSION_MOB_20E, - STREAMED_SOUND_MISSION_MOB_24A, - STREAMED_SOUND_MISSION_MOB_24B, - STREAMED_SOUND_MISSION_MOB_24C, - STREAMED_SOUND_MISSION_MOB_24D, - STREAMED_SOUND_MISSION_MOB_24E, - STREAMED_SOUND_MISSION_MOB_24F, - STREAMED_SOUND_MISSION_MOB_24G, - STREAMED_SOUND_MISSION_MOB_24H, - STREAMED_SOUND_MISSION_MOB_25A, - STREAMED_SOUND_MISSION_MOB_25B, - STREAMED_SOUND_MISSION_MOB_25C, - STREAMED_SOUND_MISSION_MOB_25D, - STREAMED_SOUND_MISSION_MOB_26A, - STREAMED_SOUND_MISSION_MOB_26B, - STREAMED_SOUND_MISSION_MOB_26C, - STREAMED_SOUND_MISSION_MOB_26D, - STREAMED_SOUND_MISSION_MOB_26E, - STREAMED_SOUND_MISSION_MOB_29A, - STREAMED_SOUND_MISSION_MOB_29B, - STREAMED_SOUND_MISSION_MOB_29C, - STREAMED_SOUND_MISSION_MOB_29D, - STREAMED_SOUND_MISSION_MOB_29E, - STREAMED_SOUND_MISSION_MOB_29F, - STREAMED_SOUND_MISSION_MOB_29G, - STREAMED_SOUND_MISSION_MOB_30A, - STREAMED_SOUND_MISSION_MOB_30B, - STREAMED_SOUND_MISSION_MOB_30C, - STREAMED_SOUND_MISSION_MOB_30D, - STREAMED_SOUND_MISSION_MOB_30E, - STREAMED_SOUND_MISSION_MOB_30F, - STREAMED_SOUND_MISSION_MOB_33A, - STREAMED_SOUND_MISSION_MOB_33B, - STREAMED_SOUND_MISSION_MOB_33C, - STREAMED_SOUND_MISSION_MOB_33D, - STREAMED_SOUND_MISSION_MOB_34A, - STREAMED_SOUND_MISSION_MOB_34B, - STREAMED_SOUND_MISSION_MOB_34C, - STREAMED_SOUND_MISSION_MOB_34D, - STREAMED_SOUND_MISSION_MOB_35A, - STREAMED_SOUND_MISSION_MOB_35B, - STREAMED_SOUND_MISSION_MOB_35C, - STREAMED_SOUND_MISSION_MOB_35D, - STREAMED_SOUND_MISSION_MOB_36A, - STREAMED_SOUND_MISSION_MOB_36B, - STREAMED_SOUND_MISSION_MOB_36C, - STREAMED_SOUND_MISSION_MOB_40A, - STREAMED_SOUND_MISSION_MOB_40B, - STREAMED_SOUND_MISSION_MOB_40C, - STREAMED_SOUND_MISSION_MOB_40D, - STREAMED_SOUND_MISSION_MOB_40E, - STREAMED_SOUND_MISSION_MOB_40F, - STREAMED_SOUND_MISSION_MOB_40G, - STREAMED_SOUND_MISSION_MOB_40H, - STREAMED_SOUND_MISSION_MOB_40I, - STREAMED_SOUND_MISSION_MOB_41A, - STREAMED_SOUND_MISSION_MOB_41B, - STREAMED_SOUND_MISSION_MOB_41C, - STREAMED_SOUND_MISSION_MOB_41D, - STREAMED_SOUND_MISSION_MOB_41E, - STREAMED_SOUND_MISSION_MOB_41F, - STREAMED_SOUND_MISSION_MOB_41G, - STREAMED_SOUND_MISSION_MOB_41H, - STREAMED_SOUND_MISSION_MOB_42A, - STREAMED_SOUND_MISSION_MOB_42B, - STREAMED_SOUND_MISSION_MOB_42C, - STREAMED_SOUND_MISSION_MOB_42D, - STREAMED_SOUND_MISSION_MOB_42E, - STREAMED_SOUND_MISSION_MOB_43A, - STREAMED_SOUND_MISSION_MOB_43B, - STREAMED_SOUND_MISSION_MOB_43C, - STREAMED_SOUND_MISSION_MOB_43D, - STREAMED_SOUND_MISSION_MOB_43E, - STREAMED_SOUND_MISSION_MOB_43F, - STREAMED_SOUND_MISSION_MOB_43G, - STREAMED_SOUND_MISSION_MOB_43H, - STREAMED_SOUND_MISSION_MOB_45A, - STREAMED_SOUND_MISSION_MOB_45B, - STREAMED_SOUND_MISSION_MOB_45C, - STREAMED_SOUND_MISSION_MOB_45D, - STREAMED_SOUND_MISSION_MOB_45E, - STREAMED_SOUND_MISSION_MOB_45F, - STREAMED_SOUND_MISSION_MOB_45G, - STREAMED_SOUND_MISSION_MOB_45H, - STREAMED_SOUND_MISSION_MOB_45I, - STREAMED_SOUND_MISSION_MOB_45J, - STREAMED_SOUND_MISSION_MOB_45K, - STREAMED_SOUND_MISSION_MOB_45L, - STREAMED_SOUND_MISSION_MOB_45M, - STREAMED_SOUND_MISSION_MOB_45N, - STREAMED_SOUND_MISSION_MOB_46A, - STREAMED_SOUND_MISSION_MOB_46B, - STREAMED_SOUND_MISSION_MOB_46C, - STREAMED_SOUND_MISSION_MOB_46D, - STREAMED_SOUND_MISSION_MOB_46E, - STREAMED_SOUND_MISSION_MOB_46F, - STREAMED_SOUND_MISSION_MOB_46G, - STREAMED_SOUND_MISSION_MOB_46H, - STREAMED_SOUND_MISSION_MOB_47A, - STREAMED_SOUND_MISSION_MOB_52A, - STREAMED_SOUND_MISSION_MOB_52B, - STREAMED_SOUND_MISSION_MOB_52C, - STREAMED_SOUND_MISSION_MOB_52D, - STREAMED_SOUND_MISSION_MOB_52E, - STREAMED_SOUND_MISSION_MOB_52F, - STREAMED_SOUND_MISSION_MOB_52G, - STREAMED_SOUND_MISSION_MOB_52H, - STREAMED_SOUND_MISSION_MOB_54A, - STREAMED_SOUND_MISSION_MOB_54B, - STREAMED_SOUND_MISSION_MOB_54C, - STREAMED_SOUND_MISSION_MOB_54D, - STREAMED_SOUND_MISSION_MOB_54E, - STREAMED_SOUND_MISSION_MOB_55A, - STREAMED_SOUND_MISSION_MOB_55B, - STREAMED_SOUND_MISSION_MOB_55C, - STREAMED_SOUND_MISSION_MOB_55D, - STREAMED_SOUND_MISSION_MOB_55E, - STREAMED_SOUND_MISSION_MOB_55F, - STREAMED_SOUND_MISSION_MOB_56A, - STREAMED_SOUND_MISSION_MOB_56B, - STREAMED_SOUND_MISSION_MOB_56C, - STREAMED_SOUND_MISSION_MOB_56D, - STREAMED_SOUND_MISSION_MOB_56E, - STREAMED_SOUND_MISSION_MOB_56F, - STREAMED_SOUND_MISSION_MOB_57A, - STREAMED_SOUND_MISSION_MOB_57B, - STREAMED_SOUND_MISSION_MOB_57C, - STREAMED_SOUND_MISSION_MOB_57D, - STREAMED_SOUND_MISSION_MOB_57E, - STREAMED_SOUND_MISSION_MOB_58A, - STREAMED_SOUND_MISSION_MOB_58B, - STREAMED_SOUND_MISSION_MOB_58C, - STREAMED_SOUND_MISSION_MOB_58D, - STREAMED_SOUND_MISSION_MOB_58E, - STREAMED_SOUND_MISSION_MOB_58F, - STREAMED_SOUND_MISSION_MOB_58G, - STREAMED_SOUND_MISSION_MOB_61A, - STREAMED_SOUND_MISSION_MOB_61B, - STREAMED_SOUND_MISSION_MOB_62A, - STREAMED_SOUND_MISSION_MOB_62B, - STREAMED_SOUND_MISSION_MOB_62C, - STREAMED_SOUND_MISSION_MOB_62D, - STREAMED_SOUND_MISSION_MOB_63A, - STREAMED_SOUND_MISSION_MOB_63B, - STREAMED_SOUND_MISSION_MOB_63C, - STREAMED_SOUND_MISSION_MOB_63D, - STREAMED_SOUND_MISSION_MOB_63E, - STREAMED_SOUND_MISSION_MOB_63F, - STREAMED_SOUND_MISSION_MOB_63G, - STREAMED_SOUND_MISSION_MOB_63H, - STREAMED_SOUND_MISSION_MOB_63I, - STREAMED_SOUND_MISSION_MOB_63J, - STREAMED_SOUND_MISSION_MOB_66A, - STREAMED_SOUND_MISSION_MOB_66B, - STREAMED_SOUND_MISSION_MOB_68A, - STREAMED_SOUND_MISSION_MOB_68B, - STREAMED_SOUND_MISSION_MOB_68C, - STREAMED_SOUND_MISSION_MOB_68D, - STREAMED_SOUND_MISSION_MOB_70A, - STREAMED_SOUND_MISSION_MOB_70B, - STREAMED_SOUND_MISSION_MOB_71A, - STREAMED_SOUND_MISSION_MOB_71B, - STREAMED_SOUND_MISSION_MOB_71C, - STREAMED_SOUND_MISSION_MOB_71D, - STREAMED_SOUND_MISSION_MOB_71E, - STREAMED_SOUND_MISSION_MOB_71F, - STREAMED_SOUND_MISSION_MOB_71G, - STREAMED_SOUND_MISSION_MOB_71H, - STREAMED_SOUND_MISSION_MOB_71I, - STREAMED_SOUND_MISSION_MOB_71J, - STREAMED_SOUND_MISSION_MOB_71K, - STREAMED_SOUND_MISSION_MOB_71L, - STREAMED_SOUND_MISSION_MOB_71M, - STREAMED_SOUND_MISSION_MOB_71N, - STREAMED_SOUND_MISSION_MOB_72A, - STREAMED_SOUND_MISSION_MOB_72B, - STREAMED_SOUND_MISSION_MOB_72C, - STREAMED_SOUND_MISSION_MOB_72D, - STREAMED_SOUND_MISSION_MOB_72E, - STREAMED_SOUND_MISSION_MOB_72F, - STREAMED_SOUND_MISSION_MOB_72G, - STREAMED_SOUND_MISSION_MOB_73A, - STREAMED_SOUND_MISSION_MOB_73C, - STREAMED_SOUND_MISSION_MOB_73D, - STREAMED_SOUND_MISSION_MOB_73F, - STREAMED_SOUND_MISSION_MOB_73G, - STREAMED_SOUND_MISSION_MOB_73I, - STREAMED_SOUND_MISSION_MOB_95A, - STREAMED_SOUND_MISSION_MOB_96A, - STREAMED_SOUND_MISSION_MOB_98A, - STREAMED_SOUND_MISSION_MOB_99A, - STREAMED_SOUND_MISSION_JOB1_1B, - STREAMED_SOUND_MISSION_JOB1_1C, - STREAMED_SOUND_MISSION_JOB1_1D, - STREAMED_SOUND_MISSION_JOB2_1B, - STREAMED_SOUND_MISSION_JOB2_2, - STREAMED_SOUND_MISSION_JOB2_3, - STREAMED_SOUND_MISSION_JOB2_4, - STREAMED_SOUND_MISSION_JOB2_5, - STREAMED_SOUND_MISSION_JOB2_6, - STREAMED_SOUND_MISSION_JOB2_7, - STREAMED_SOUND_MISSION_JOB2_8, - STREAMED_SOUND_MISSION_JOB2_9, - STREAMED_SOUND_MISSION_JOB3_1, - STREAMED_SOUND_MISSION_JOB3_2, - STREAMED_SOUND_MISSION_JOB3_3, - STREAMED_SOUND_MISSION_JOB4_1, - STREAMED_SOUND_MISSION_JOB4_2, - STREAMED_SOUND_MISSION_JOB4_3, - STREAMED_SOUND_MISSION_JOB5_1, - STREAMED_SOUND_MISSION_JOB5_2, - STREAMED_SOUND_MISSION_JOB5_3, - STREAMED_SOUND_MISSION_BJM1_20, - STREAMED_SOUND_MISSION_BJM1_4, - STREAMED_SOUND_MISSION_BJM1_5, - STREAMED_SOUND_MISSION_MERC_39, - STREAMED_SOUND_MISSION_MONO_1, - STREAMED_SOUND_MISSION_MONO_2, - STREAMED_SOUND_MISSION_MONO_3, - STREAMED_SOUND_MISSION_MONO_4, - STREAMED_SOUND_MISSION_MONO_5, - STREAMED_SOUND_MISSION_MONO_6, - STREAMED_SOUND_MISSION_MONO_7, - STREAMED_SOUND_MISSION_MONO_8, - STREAMED_SOUND_MISSION_MONO_9, - STREAMED_SOUND_MISSION_MONO10, - STREAMED_SOUND_MISSION_MONO11, - STREAMED_SOUND_MISSION_MONO12, - STREAMED_SOUND_MISSION_MONO13, - STREAMED_SOUND_MISSION_MONO14, - STREAMED_SOUND_MISSION_MONO15, - STREAMED_SOUND_MISSION_MONO16, - STREAMED_SOUND_MISSION_FUD_01, - STREAMED_SOUND_MISSION_FUD_02, - STREAMED_SOUND_MISSION_FUD_03, - STREAMED_SOUND_MISSION_FUD_04, - STREAMED_SOUND_MISSION_FUD_05, - STREAMED_SOUND_MISSION_FUD_06, - STREAMED_SOUND_MISSION_FUD_07, - STREAMED_SOUND_MISSION_FUD_08, - STREAMED_SOUND_MISSION_FUD_09, - STREAMED_SOUND_MISSION_FUD_10, - STREAMED_SOUND_MISSION_FUD_11, - STREAMED_SOUND_MISSION_FUD_12, - STREAMED_SOUND_MISSION_FUD_13, - STREAMED_SOUND_MISSION_FUD_14, - STREAMED_SOUND_MISSION_FUD_15, - STREAMED_SOUND_MISSION_FUD_16, - STREAMED_SOUND_MISSION_FUD_17, - STREAMED_SOUND_MISSION_FUD_18, - STREAMED_SOUND_MISSION_FUD_19, - STREAMED_SOUND_MISSION_FUD_20, - STREAMED_SOUND_MISSION_BURG_01, - STREAMED_SOUND_MISSION_BURG_02, - STREAMED_SOUND_MISSION_BURG_03, - STREAMED_SOUND_MISSION_BURG_04, - STREAMED_SOUND_MISSION_BURG_05, - STREAMED_SOUND_MISSION_BURG_06, - STREAMED_SOUND_MISSION_BURG_07, - STREAMED_SOUND_MISSION_BURG_08, - STREAMED_SOUND_MISSION_BURG_09, - STREAMED_SOUND_MISSION_BURG_10, - STREAMED_SOUND_MISSION_BURG_11, - STREAMED_SOUND_MISSION_BURG_12, - STREAMED_SOUND_MISSION_CRUST01, - STREAMED_SOUND_MISSION_CRUST02, - STREAMED_SOUND_MISSION_CRUST03, - STREAMED_SOUND_MISSION_CRUST04, - STREAMED_SOUND_MISSION_CRUST05, - STREAMED_SOUND_MISSION_CRUST06, - STREAMED_SOUND_MISSION_CRUST07, - STREAMED_SOUND_MISSION_CRUST08, - STREAMED_SOUND_MISSION_CRUST09, - STREAMED_SOUND_MISSION_BAND_01, - STREAMED_SOUND_MISSION_BAND_02, - STREAMED_SOUND_MISSION_BAND_03, - STREAMED_SOUND_MISSION_BAND_04, - STREAMED_SOUND_MISSION_BAND_05, - STREAMED_SOUND_MISSION_BAND_06, - STREAMED_SOUND_MISSION_BAND_07, - STREAMED_SOUND_MISSION_BAND_08, - STREAMED_SOUND_MISSION_SHAFT01, - STREAMED_SOUND_MISSION_SHAFT02, - STREAMED_SOUND_MISSION_SHAFT03, - STREAMED_SOUND_MISSION_SHAFT04, - STREAMED_SOUND_MISSION_SHAFT05, - STREAMED_SOUND_MISSION_SHAFT06, - STREAMED_SOUND_MISSION_SHAFT07, - STREAMED_SOUND_MISSION_SHAFT08, - STREAMED_SOUND_MISSION_PISS_01, - STREAMED_SOUND_MISSION_PISS_02, - STREAMED_SOUND_MISSION_PISS_03, - STREAMED_SOUND_MISSION_PISS_04, - STREAMED_SOUND_MISSION_PISS_05, - STREAMED_SOUND_MISSION_PISS_06, - STREAMED_SOUND_MISSION_PISS_07, - STREAMED_SOUND_MISSION_PISS_08, - STREAMED_SOUND_MISSION_PISS_09, - STREAMED_SOUND_MISSION_PISS_10, - STREAMED_SOUND_MISSION_PISS_11, - STREAMED_SOUND_MISSION_PISS_12, - STREAMED_SOUND_MISSION_PISS_13, - STREAMED_SOUND_MISSION_PISS_14, - STREAMED_SOUND_MISSION_PISS_15, - STREAMED_SOUND_MISSION_PISS_16, - STREAMED_SOUND_MISSION_PISS_17, - STREAMED_SOUND_MISSION_PISS_18, - STREAMED_SOUND_MISSION_PISS_19, - STREAMED_SOUND_MISSION_GIMME01, - STREAMED_SOUND_MISSION_GIMME02, - STREAMED_SOUND_MISSION_GIMME03, - STREAMED_SOUND_MISSION_GIMME04, - STREAMED_SOUND_MISSION_GIMME05, - STREAMED_SOUND_MISSION_GIMME06, - STREAMED_SOUND_MISSION_GIMME07, - STREAMED_SOUND_MISSION_GIMME08, - STREAMED_SOUND_MISSION_GIMME09, - STREAMED_SOUND_MISSION_GIMME10, - STREAMED_SOUND_MISSION_GIMME11, - STREAMED_SOUND_MISSION_GIMME12, - STREAMED_SOUND_MISSION_GIMME13, - STREAMED_SOUND_MISSION_GIMME14, - STREAMED_SOUND_MISSION_GIMME15, - STREAMED_SOUND_MISSION_BUST_01, - STREAMED_SOUND_MISSION_BUST_02, - STREAMED_SOUND_MISSION_BUST_03, - STREAMED_SOUND_MISSION_BUST_04, - STREAMED_SOUND_MISSION_BUST_05, - STREAMED_SOUND_MISSION_BUST_06, - STREAMED_SOUND_MISSION_BUST_07, - STREAMED_SOUND_MISSION_BUST_08, - STREAMED_SOUND_MISSION_BUST_09, - STREAMED_SOUND_MISSION_BUST_10, - STREAMED_SOUND_MISSION_BUST_11, - STREAMED_SOUND_MISSION_BUST_12, - STREAMED_SOUND_MISSION_BUST_13, - STREAMED_SOUND_MISSION_BUST_14, - STREAMED_SOUND_MISSION_BUST_15, - STREAMED_SOUND_MISSION_BUST_16, - STREAMED_SOUND_MISSION_BUST_17, - STREAMED_SOUND_MISSION_BUST_18, - STREAMED_SOUND_MISSION_BUST_19, - STREAMED_SOUND_MISSION_BUST_20, - STREAMED_SOUND_MISSION_BUST_21, - STREAMED_SOUND_MISSION_BUST_22, - STREAMED_SOUND_MISSION_BUST_23, - STREAMED_SOUND_MISSION_BUST_24, - STREAMED_SOUND_MISSION_BUST_25, - STREAMED_SOUND_MISSION_BUST_26, - STREAMED_SOUND_MISSION_BUST_27, - STREAMED_SOUND_MISSION_BUST_28, TOTAL_STREAMED_SOUNDS, NO_TRACK, }; diff --git a/src/audio/sampman.h b/src/audio/sampman.h index 2db29244..7597eafb 100644 --- a/src/audio/sampman.h +++ b/src/audio/sampman.h @@ -278,109 +278,72 @@ static char StreamedNameTable[][25] = { #elif defined(PS2_AUDIO_PATHS) static char StreamedNameTable[][40] = { - "AUDIO\\MUSIC\\WILD.VB", + "AUDIO\\MUSIC\\HEAD.VB", + "AUDIO\\MUSIC\\DOUBLE.VB", + "AUDIO\\MUSIC\\KJAH.VB", + "AUDIO\\MUSIC\\RISE.VB", + "AUDIO\\MUSIC\\LIPS.VB", + "AUDIO\\MUSIC\\MUNDO.VB", + "AUDIO\\MUSIC\\MSX.VB", "AUDIO\\MUSIC\\FLASH.VB", - "AUDIO\\MUSIC\\KCHAT.VB", // 16 khz - "AUDIO\\MUSIC\\FEVER.VB", - "AUDIO\\MUSIC\\VROCK.VB", - "AUDIO\\MUSIC\\VCPR.VB", // 16 khz - "AUDIO\\MUSIC\\ESPANT.VB", - "AUDIO\\MUSIC\\EMOTION.VB", - "AUDIO\\MUSIC\\WAVE.VB", - "AUDIO\\MUSIC\\MISCOM.VB", + "AUDIO\\MUSIC\\LCJ.VB", + "AUDIO\\MUSIC\\LCFR.VB", + "AUDIO\\MUSIC\\MISCOM2.VB", "AUDIO\\MUSIC\\CITY.VB", "AUDIO\\MUSIC\\WATER.VB", - "AUDIO\\MUSIC\\BEACHAMB.VB", - "AUDIO\\MUSIC\\HCITY.VB", - "AUDIO\\MUSIC\\HWATER.VB", - "AUDIO\\MUSIC\\HBEACH.VB", - "AUDIO\\MUSIC\\MALLAMB.VB", - "AUDIO\\MUSIC\\STRIP.VB", - "AUDIO\\MUSIC\\MALIBU.VB", - "AUDIO\\MUSIC\\HOTEL.VB", - "AUDIO\\MUSIC\\DIRTRING.VB", - "AUDIO\\MUSIC\\LAW4RIOT.VB", - "AUDIO\\MUSIC\\AMBSIL.VB", - "AUDIO\\MUSIC\\POLICE.VB", // 16 khz + "AUDIO\\MUSIC\\SAWMILL.VB", + "AUDIO\\MUSIC\\CITY.VB", + "AUDIO\\MUSIC\\WATER.VB", + "AUDIO\\MUSIC\\WATER.VB", + "AUDIO\\MUSIC\\CITY.VB", + "AUDIO\\MUSIC\\CITY.VB", + "AUDIO\\MUSIC\\CITY.VB", + "AUDIO\\MUSIC\\CITY.VB", + "AUDIO\\MUSIC\\CITY.VB", + "AUDIO\\MUSIC\\CITY.VB", + "AUDIO\\MUSIC\\CITY.VB", + "AUDIO\\MUSIC\\POLICE.VB", "AUDIO\\MUSIC\\TAXI.VB", - "AUDIO\\MUSIC\\BCLOSED.VB", - "AUDIO\\MUSIC\\BOPEN.VB", - "AUDIO\\CUTSCENE\\ASS\\ASS_1.VB", - "AUDIO\\CUTSCENE\\ASS\\ASS_2.VB", - "AUDIO\\CUTSCENE\\BANK\\BANK_1.VB", - "AUDIO\\CUTSCENE\\BANK\\BANK_2A.VB", - "AUDIO\\CUTSCENE\\BANK\\BANK_2B.VB", - "AUDIO\\CUTSCENE\\BANK\\BANK_3A.VB", - "AUDIO\\CUTSCENE\\BANK\\BANK_3B.VB", - "AUDIO\\CUTSCENE\\BANK\\BANK_4.VB", - "AUDIO\\CUTSCENE\\BIKE\\BIKE_1.VB", - "AUDIO\\CUTSCENE\\BIKE\\BIKE_2.VB", - "AUDIO\\CUTSCENE\\BIKE\\BIKE_3.VB", - "AUDIO\\CUTSCENE\\BUD\\BUD_1.VB", - "AUDIO\\CUTSCENE\\BUD\\BUD_2.VB", - "AUDIO\\CUTSCENE\\BUD\\BUD_3.VB", - "AUDIO\\CUTSCENE\\CAP\\CAP_1.VB", - "AUDIO\\CUTSCENE\\CAR\\CAR_1.VB", - "AUDIO\\CUTSCENE\\CNT\\CNT_1A.VB", - "AUDIO\\CUTSCENE\\CNT\\CNT_1B.VB", - "AUDIO\\CUTSCENE\\CNT\\CNT_2.VB", - "AUDIO\\CUTSCENE\\COK\\COK_1.VB", - "AUDIO\\CUTSCENE\\COK\\COK_2A.VB", - "AUDIO\\CUTSCENE\\COK\\COK_2B.VB", - "AUDIO\\CUTSCENE\\COK\\COK_3.VB", - "AUDIO\\CUTSCENE\\COK\\COK_4A.VB", - "AUDIO\\CUTSCENE\\COK\\COK_4A2.VB", - "AUDIO\\CUTSCENE\\COK\\COK_4B.VB", - "AUDIO\\CUTSCENE\\COL\\COL_1.VB", - "AUDIO\\CUTSCENE\\COL\\COL_2.VB", - "AUDIO\\CUTSCENE\\COL\\COL_3A.VB", - "AUDIO\\CUTSCENE\\COL\\COL_4A.VB", - "AUDIO\\CUTSCENE\\COL\\COL_5A.VB", - "AUDIO\\CUTSCENE\\COL\\COL_5B.VB", - "AUDIO\\CUTSCENE\\CUB\\CUB_1.VB", - "AUDIO\\CUTSCENE\\CUB\\CUB_2.VB", - "AUDIO\\CUTSCENE\\CUB\\CUB_3.VB", - "AUDIO\\CUTSCENE\\CUB\\CUB_4.VB", - "AUDIO\\CUTSCENE\\DRUG\\DRUG_1.VB", - "AUDIO\\CUTSCENE\\FIN\\FIN.VB", - "AUDIO\\CUTSCENE\\FIN\\FIN2.VB", - "AUDIO\\CUTSCENE\\FINALE\\FINALE.VB", - "AUDIO\\CUTSCENE\\HAT\\HAT_1.VB", - "AUDIO\\CUTSCENE\\HAT\\HAT_2.VB", - "AUDIO\\CUTSCENE\\HAT\\HAT_3.VB", - "AUDIO\\CUTSCENE\\ICE\\ICE_1.VB", - "AUDIO\\CUTSCENE\\INT\\INT_A.VB", - "AUDIO\\CUTSCENE\\INT\\INT_B.VB", - "AUDIO\\CUTSCENE\\INT\\INT_D.VB", - "AUDIO\\CUTSCENE\\INT\\INT_M.VB", - "AUDIO\\CUTSCENE\\LAW\\LAW_1A.VB", - "AUDIO\\CUTSCENE\\LAW\\LAW_1B.VB", - "AUDIO\\CUTSCENE\\LAW\\LAW_2A.VB", - "AUDIO\\CUTSCENE\\LAW\\LAW_2B.VB", - "AUDIO\\CUTSCENE\\LAW\\LAW_2C.VB", - "AUDIO\\CUTSCENE\\LAW\\LAW_3.VB", - "AUDIO\\CUTSCENE\\LAW\\LAW_4.VB", - "AUDIO\\CUTSCENE\\PHIL\\PHIL_1.VB", - "AUDIO\\CUTSCENE\\PHIL\\PHIL_2.VB", - "AUDIO\\CUTSCENE\\PORN\\PORN_1.VB", - "AUDIO\\CUTSCENE\\PORN\\PORN_2.VB", - "AUDIO\\CUTSCENE\\PORN\\PORN_3.VB", - "AUDIO\\CUTSCENE\\PORN\\PORN_4.VB", - "AUDIO\\CUTSCENE\\RESC\\RESC_1A.VB", - "AUDIO\\CUTSCENE\\ROK\\ROK_1.VB", - "AUDIO\\CUTSCENE\\ROK\\ROK_2.VB", - "AUDIO\\CUTSCENE\\ROK\\ROK_3A.VB", - "AUDIO\\CUTSCENE\\STRIPA\\STRIPA.VB", - "AUDIO\\CUTSCENE\\TAX\\TAX_1.VB", - "AUDIO\\CUTSCENE\\TEX\\TEX_1.VB", - "AUDIO\\CUTSCENE\\TEX\\TEX_2.VB", - "AUDIO\\CUTSCENE\\TEX\\TEX_3.VB", - "AUDIO\\MUSIC\\GLIGHT.VB", - "AUDIO\\MUSIC\\FIST.VB", - "AUDIO\\MUSIC\\MISCOM.VB", - "AUDIO\\MUSIC\\MISCOM.VB", - "AUDIO\\MUSIC\\MISCOM.VB", - "AUDIO\\MUSIC\\MISCOM.VB", + "AUDIO\\NEWS\\NEWS_A.VB", + "AUDIO\\NEWS\\NEWS_B.VB", + "AUDIO\\NEWS\\NEWS_C.VB", + "AUDIO\\NEWS\\NEWS_D.VB", + "AUDIO\\NEWS\\NEWS_E.VB", + "AUDIO\\NEWS\\NEWS_F.VB", + "AUDIO\\NEWS\\NEWS_G.VB", + "AUDIO\\NEWS\\NEWS_H.VB", + "AUDIO\\NEWS\\NEWS_I.VB", + "AUDIO\\NEWS\\NEWS_J.VB", + "AUDIO\\NEWS\\NEWS_K.VB", + "AUDIO\\NEWS\\NEWS_L.VB", + "AUDIO\\NEWS\\NEWS_M.VB", + "AUDIO\\NEWS\\NEWS_N.VB", + "AUDIO\\CUTSCENE\\BIKER.VB", + "AUDIO\\CUTSCENE\\BONEVOY.VB", + "AUDIO\\CUTSCENE\\CAMPAIN.VB", + "AUDIO\\CUTSCENE\\CASHCHP.VB", + "AUDIO\\CUTSCENE\\CONTBAN.VB", + "AUDIO\\CUTSCENE\\CRAZY69.VB", + "AUDIO\\CUTSCENE\\CRAZY69.VB", + "AUDIO\\CUTSCENE\\DEADLY.VB", + "AUDIO\\CUTSCENE\\DONPROB.VB", + "AUDIO\\CUTSCENE\\DRIVNMR.VB", + "AUDIO\\CUTSCENE\\ELECTON.VB", + "AUDIO\\CUTSCENE\\FINAL.VB", + "AUDIO\\CUTSCENE\\FINAL_2.VB", + "AUDIO\\CUTSCENE\\HOMSWET.VB", + "AUDIO\\CUTSCENE\\HOTWHEL.VB", + "AUDIO\\CUTSCENE\\KIDNAPP.VB", + "AUDIO\\CUTSCENE\\LANDGRB.VB", + "AUDIO\\CUTSCENE\\MORGUE.VB", + "AUDIO\\CUTSCENE\\OVERDOS.VB", + "AUDIO\\CUTSCENE\\RUFJUST.VB", + "AUDIO\\CUTSCENE\\SAYONAR.VB", + "AUDIO\\CUTSCENE\\SICILAN.VB", + "AUDIO\\CUTSCENE\\THEOFER.VB", + "AUDIO\\CUTSCENE\\INTRO.VB", + "AUDIO\\MUSIC\\FINALE.VB", + "AUDIO\\MUSIC\\MISCOM2.VB" #else static char StreamedNameTable[][25] = { @@ -488,1125 +451,5 @@ static char StreamedNameTable[][25] = "AUDIO\\MISCOM.MP3", "AUDIO\\MISCOM.MP3", #endif - "AUDIO\\MOBR1.WAV", - "AUDIO\\PAGER.WAV", - "AUDIO\\CARREV.WAV", - "AUDIO\\BIKEREV.WAV", - "AUDIO\\LIFTOP.WAV", - "AUDIO\\LIFTCL.WAV", - "AUDIO\\LIFTRUN.WAV", - "AUDIO\\LIFTBEL.WAV", - "AUDIO\\INLIFT.WAV", - "AUDIO\\SFX_01.WAV", - "AUDIO\\SFX_02.WAV", - "AUDIO\\CAMERAL.WAV", - "AUDIO\\CAMERAR.WAV", - "AUDIO\\CHEER1.WAV", - "AUDIO\\CHEER2.WAV", - "AUDIO\\CHEER3.WAV", - "AUDIO\\CHEER4.WAV", - "AUDIO\\OOH1.WAV", - "AUDIO\\OOH2.WAV", - "AUDIO\\RACE1.WAV", - "AUDIO\\RACE2.WAV", - "AUDIO\\RACE3.WAV", - "AUDIO\\RACE4.WAV", - "AUDIO\\RACE5.WAV", - "AUDIO\\RACE6.WAV", - "AUDIO\\RACE7.WAV", - "AUDIO\\RACE8.WAV", - "AUDIO\\RACE9.WAV", - "AUDIO\\RACE10.WAV", - "AUDIO\\RACE11.WAV", - "AUDIO\\RACE12.WAV", - "AUDIO\\RACE13.WAV", - "AUDIO\\RACE14.WAV", - "AUDIO\\RACE15.WAV", - "AUDIO\\HOT1.WAV", - "AUDIO\\HOT2.WAV", - "AUDIO\\HOT3.WAV", - "AUDIO\\HOT4.WAV", - "AUDIO\\HOT5.WAV", - "AUDIO\\HOT6.WAV", - "AUDIO\\HOT7.WAV", - "AUDIO\\HOT8.WAV", - "AUDIO\\HOT9.WAV", - "AUDIO\\HOT10.WAV", - "AUDIO\\HOT11.WAV", - "AUDIO\\HOT12.WAV", - "AUDIO\\HOT13.WAV", - "AUDIO\\HOT14.WAV", - "AUDIO\\HOT15.WAV", - "AUDIO\\LANSTP1.WAV", - "AUDIO\\LANSTP2.WAV", - "AUDIO\\LANAMU1.WAV", - "AUDIO\\LANAMU2.WAV", - "AUDIO\\AIRHORNL.WAV", - "AUDIO\\AIRHORNR.WAV", - "AUDIO\\SNIPSCRL.WAV", - "AUDIO\\SNIPSHORT.WAV", - "AUDIO\\BLOWROOF.WAV", - "AUDIO\\ASS_1.WAV", - "AUDIO\\ASS_2.WAV", - "AUDIO\\ASS_3.WAV", - "AUDIO\\ASS_4.WAV", - "AUDIO\\ASS_5.WAV", - "AUDIO\\ASS_6.WAV", - "AUDIO\\ASS_7.WAV", - "AUDIO\\ASS_8.WAV", - "AUDIO\\ASS_9.WAV", - "AUDIO\\ASS_10.WAV", - "AUDIO\\ASS_11.WAV", - "AUDIO\\ASS_12.WAV", - "AUDIO\\ASS_13.WAV", - "AUDIO\\ASS_14.WAV", - "AUDIO\\BIKE1_1.WAV", - "AUDIO\\BIKE1_2.WAV", - "AUDIO\\BIKE1_3.WAV", - "AUDIO\\BNK1_1.WAV", - "AUDIO\\BNK1_2.WAV", - "AUDIO\\BNK1_3.WAV", - "AUDIO\\BNK1_4.WAV", - "AUDIO\\BNK1_5.WAV", - "AUDIO\\BNK1_6.WAV", - "AUDIO\\BNK1_7.WAV", - "AUDIO\\BNK1_8.WAV", - "AUDIO\\BNK1_10.WAV", - "AUDIO\\BNK1_11.WAV", - "AUDIO\\BNK1_12.WAV", - "AUDIO\\BNK1_13.WAV", - "AUDIO\\BNK1_14.WAV", - "AUDIO\\BNK2_1.WAV", - "AUDIO\\BNK2_2.WAV", - "AUDIO\\BNK2_3.WAV", - "AUDIO\\BNK2_4.WAV", - "AUDIO\\BNK2_5.WAV", - "AUDIO\\BNK2_6.WAV", - "AUDIO\\BNK2_7.WAV", - "AUDIO\\BNK2_8.WAV", - "AUDIO\\BNK2_9.WAV", - "AUDIO\\BNK3_1.WAV", - "AUDIO\\BNK3_2.WAV", - "AUDIO\\BNK3_3A.WAV", - "AUDIO\\BNK3_3B.WAV", - "AUDIO\\BNK3_3C.WAV", - "AUDIO\\BNK3_4A.WAV", - "AUDIO\\BNK3_4B.WAV", - "AUDIO\\BNK3_4C.WAV", - "AUDIO\\BNK4_1.WAV", - "AUDIO\\BNK4_2.WAV", - "AUDIO\\BNK4_3A.WAV", - "AUDIO\\BNK4_3B.WAV", - "AUDIO\\BNK4_3C.WAV", - "AUDIO\\BNK4_3D.WAV", - "AUDIO\\BNK4_3E.WAV", - "AUDIO\\BNK4_3F.WAV", - "AUDIO\\BNK4_3G.WAV", - "AUDIO\\BNK4_3H.WAV", - "AUDIO\\BNK4_3I.WAV", - "AUDIO\\BNK4_3J.WAV", - "AUDIO\\BNK4_3K.WAV", - "AUDIO\\BNK4_3M.WAV", - "AUDIO\\BNK4_3O.WAV", - "AUDIO\\BNK4_3P.WAV", - "AUDIO\\BNK4_3Q.WAV", - "AUDIO\\BNK4_3R.WAV", - "AUDIO\\BNK4_3S.WAV", - "AUDIO\\BNK4_3T.WAV", - "AUDIO\\BNK4_3U.WAV", - "AUDIO\\BNK4_3V.WAV", - "AUDIO\\BNK4_4A.WAV", - "AUDIO\\BNK4_4B.WAV", - "AUDIO\\BNK4_5.WAV", - "AUDIO\\BNK4_6.WAV", - "AUDIO\\BNK4_7.WAV", - "AUDIO\\BNK4_8.WAV", - "AUDIO\\BNK4_9.WAV", - "AUDIO\\BNK4_10.WAV", - "AUDIO\\BNK4_11.WAV", - "AUDIO\\BK4_12A.WAV", - "AUDIO\\BK4_12B.WAV", - "AUDIO\\BK4_12C.WAV", - "AUDIO\\BNK4_13.WAV", - "AUDIO\\BK4_14A.WAV", - "AUDIO\\BK4_14B.WAV", - "AUDIO\\BNK4_15.WAV", - "AUDIO\\BNK4_16.WAV", - "AUDIO\\BNK4_17.WAV", - "AUDIO\\BNK4_18.WAV", - "AUDIO\\BK4_19A.WAV", - "AUDIO\\BK4_19B.WAV", - "AUDIO\\BK4_20A.WAV", - "AUDIO\\BK4_20B.WAV", - "AUDIO\\BNK4_21.WAV", - "AUDIO\\BNK422A.WAV", - "AUDIO\\BNK422B.WAV", - "AUDIO\\BK4_23A.WAV", - "AUDIO\\BK4_23B.WAV", - "AUDIO\\BK4_23C.WAV", - "AUDIO\\BK4_23D.WAV", - "AUDIO\\BK4_24A.WAV", - "AUDIO\\BK4_24B.WAV", - "AUDIO\\BNK4_25.WAV", - "AUDIO\\BNK4_26.WAV", - "AUDIO\\BNK4_27.WAV", - "AUDIO\\BNK4_28.WAV", - "AUDIO\\BNK4_29.WAV", - "AUDIO\\BNK4_30.WAV", - "AUDIO\\BK4_31A.WAV", - "AUDIO\\BK4_31B.WAV", - "AUDIO\\BNK4_32.WAV", - "AUDIO\\BK4_34A.WAV", - "AUDIO\\BK4_34B.WAV", - "AUDIO\\BK4_35A.WAV", - "AUDIO\\BK4_35B.WAV", - "AUDIO\\BNK4_36.WAV", - "AUDIO\\BNK4_37.WAV", - "AUDIO\\BNK4_38.WAV", - "AUDIO\\BNK4_39.WAV", - "AUDIO\\BK4_40A.WAV", - "AUDIO\\BK4_40B.WAV", - "AUDIO\\BNK4_41.WAV", - "AUDIO\\BNK4_42.WAV", - "AUDIO\\BNK4_43.WAV", - "AUDIO\\BNK4_44.WAV", - "AUDIO\\BNK4_45.WAV", - "AUDIO\\BNK4_46.WAV", - "AUDIO\\BNK4_47.WAV", - "AUDIO\\BNK4_48.WAV", - "AUDIO\\BNK4_49.WAV", - "AUDIO\\BNK450A.WAV", - "AUDIO\\BNK450B.WAV", - "AUDIO\\BNK4_51.WAV", - "AUDIO\\BNK4_94.WAV", - "AUDIO\\BNK4_95.WAV", - "AUDIO\\BNK4_96.WAV", - "AUDIO\\BNK4_97.WAV", - "AUDIO\\BNK4_98.WAV", - "AUDIO\\BNK4_99.WAV", - "AUDIO\\BUD1_1.WAV", - "AUDIO\\BUD1_2.WAV", - "AUDIO\\BUD1_3.WAV", - "AUDIO\\BUD1_4.WAV", - "AUDIO\\BUD1_5.WAV", - "AUDIO\\BUD1_9.WAV", - "AUDIO\\BUD1_10.WAV", - "AUDIO\\BUD2_1.WAV", - "AUDIO\\BUD2_2.WAV", - "AUDIO\\BUD2_3.WAV", - "AUDIO\\BUD2_4.WAV", - "AUDIO\\BUD2_5.WAV", - "AUDIO\\BUD2_6.WAV", - "AUDIO\\BUD2_7.WAV", - "AUDIO\\BUD3_1.WAV", - "AUDIO\\BUD3_1A.WAV", - "AUDIO\\BUD3_1B.WAV", - "AUDIO\\BUD3_1C.WAV", - "AUDIO\\BUD3_2.WAV", - "AUDIO\\BUD3_3.WAV", - "AUDIO\\BUD3_4.WAV", - "AUDIO\\BUD3_5.WAV", - "AUDIO\\BUD3_6.WAV", - "AUDIO\\BUD3_7.WAV", - "AUDIO\\BUD3_8A.WAV", - "AUDIO\\BUD3_8B.WAV", - "AUDIO\\BUD3_8C.WAV", - "AUDIO\\BUD3_9A.WAV", - "AUDIO\\BUD3_9B.WAV", - "AUDIO\\BUD3_9C.WAV", - "AUDIO\\CAP1_2.WAV", - "AUDIO\\CAP1_3.WAV", - "AUDIO\\CAP1_4.WAV", - "AUDIO\\CAP1_5.WAV", - "AUDIO\\CAP1_6.WAV", - "AUDIO\\CAP1_7.WAV", - "AUDIO\\CAP1_8.WAV", - "AUDIO\\CAP1_9.WAV", - "AUDIO\\CAP1_10.WAV", - "AUDIO\\CAP1_11.WAV", - "AUDIO\\CAP1_12.WAV", - "AUDIO\\CNT1_1.WAV", - "AUDIO\\CNT1_2.WAV", - "AUDIO\\CNT1_3.WAV", - "AUDIO\\CNT1_4.WAV", - "AUDIO\\CNT1_5.WAV", - "AUDIO\\CNT2_1.WAV", - "AUDIO\\CNT2_2.WAV", - "AUDIO\\CNT2_3.WAV", - "AUDIO\\CNT2_4.WAV", - "AUDIO\\COK1_1.WAV", - "AUDIO\\COK1_2.WAV", - "AUDIO\\COK1_3.WAV", - "AUDIO\\COK1_4.WAV", - "AUDIO\\COK1_5.WAV", - "AUDIO\\COK1_6.WAV", - "AUDIO\\COK2_1.WAV", - "AUDIO\\COK2_2.WAV", - "AUDIO\\COK2_3.WAV", - "AUDIO\\COK2_4.WAV", - "AUDIO\\COK2_5.WAV", - "AUDIO\\COK2_6.WAV", - "AUDIO\\COK2_7A.WAV", - "AUDIO\\COK2_7B.WAV", - "AUDIO\\COK2_7C.WAV", - "AUDIO\\COK2_8A.WAV", - "AUDIO\\COK2_8B.WAV", - "AUDIO\\COK2_8C.WAV", - "AUDIO\\COK2_8D.WAV", - "AUDIO\\COK2_9.WAV", - "AUDIO\\COK210A.WAV", - "AUDIO\\COK210B.WAV", - "AUDIO\\COK210C.WAV", - "AUDIO\\COK212A.WAV", - "AUDIO\\COK212B.WAV", - "AUDIO\\COK2_13.WAV", - "AUDIO\\COK2_14.WAV", - "AUDIO\\COK2_15.WAV", - "AUDIO\\COK2_16.WAV", - "AUDIO\\COK2_20.WAV", - "AUDIO\\COK2_21.WAV", - "AUDIO\\COK2_2.WAV", // this is probably a typo of COK2_22 - "AUDIO\\COK3_1.WAV", - "AUDIO\\COK3_2.WAV", - "AUDIO\\COK3_3.WAV", - "AUDIO\\COK3_4.WAV", - "AUDIO\\COK4_1.WAV", - "AUDIO\\COK4_2.WAV", - "AUDIO\\COK4_3.WAV", - "AUDIO\\COK4_4.WAV", - "AUDIO\\COK4_5.WAV", - "AUDIO\\COK4_6.WAV", - "AUDIO\\COK4_7.WAV", - "AUDIO\\COK4_8.WAV", - "AUDIO\\COK4_9.WAV", - "AUDIO\\COK4_9A.WAV", - "AUDIO\\COK4_10.WAV", - "AUDIO\\COK4_11.WAV", - "AUDIO\\COK4_12.WAV", - "AUDIO\\COK4_13.WAV", - "AUDIO\\COK4_14.WAV", - "AUDIO\\COK4_15.WAV", - "AUDIO\\COK4_16.WAV", - "AUDIO\\COK4_17.WAV", - "AUDIO\\COK4_18.WAV", - "AUDIO\\COK4_19.WAV", - "AUDIO\\COK4_20.WAV", - "AUDIO\\COK4_21.WAV", - "AUDIO\\COK4_22.WAV", - "AUDIO\\COK4_23.WAV", - "AUDIO\\COK4_24.WAV", - "AUDIO\\COK4_25.WAV", - "AUDIO\\COK4_26.WAV", - "AUDIO\\COK4_27.WAV", - "AUDIO\\COL1_1.WAV", - "AUDIO\\COL1_2.WAV", - "AUDIO\\COL1_3.WAV", - "AUDIO\\COL1_4.WAV", - "AUDIO\\COL1_5.WAV", - "AUDIO\\COL1_6.WAV", - "AUDIO\\COL1_7.WAV", - "AUDIO\\COL1_8.WAV", - "AUDIO\\COL2_1.WAV", - "AUDIO\\COL2_2.WAV", - "AUDIO\\COL2_3.WAV", - "AUDIO\\COL2_4.WAV", - "AUDIO\\COL2_5.WAV", - "AUDIO\\COL2_6A.WAV", - "AUDIO\\COL2_7.WAV", - "AUDIO\\COL2_8.WAV", - "AUDIO\\COL2_9.WAV", - "AUDIO\\COL2_10.WAV", - "AUDIO\\COL2_11.WAV", - "AUDIO\\COL2_12.WAV", - "AUDIO\\COL2_13.WAV", - "AUDIO\\COL2_14.WAV", - "AUDIO\\COL2_15.WAV", - "AUDIO\\COL2_16.WAV", - "AUDIO\\COL3_1.WAV", - "AUDIO\\COL3_2.WAV", - "AUDIO\\COL3_2A.WAV", - "AUDIO\\COL3_2B.WAV", - "AUDIO\\COL3_3.WAV", - "AUDIO\\COL3_4.WAV", - "AUDIO\\COL3_5.WAV", - "AUDIO\\COL3_6.WAV", - "AUDIO\\COL3_7.WAV", - "AUDIO\\COL3_8.WAV", - "AUDIO\\COL3_9.WAV", - "AUDIO\\COL3_10.WAV", - "AUDIO\\COL3_11.WAV", - "AUDIO\\COL3_12.WAV", - "AUDIO\\COL3_13.WAV", - "AUDIO\\COL3_14.WAV", - "AUDIO\\COL3_15.WAV", - "AUDIO\\COL3_16.WAV", - "AUDIO\\COL3_17.WAV", - "AUDIO\\COL3_18.WAV", - "AUDIO\\COL3_19.WAV", - "AUDIO\\COL3_20.WAV", - "AUDIO\\COL3_21.WAV", - "AUDIO\\COL3_23.WAV", - "AUDIO\\COL3_24.WAV", - "AUDIO\\COL3_25.WAV", - "AUDIO\\COL4_1.WAV", - "AUDIO\\COL4_2.WAV", - "AUDIO\\COL4_3.WAV", - "AUDIO\\COL4_4.WAV", - "AUDIO\\COL4_5.WAV", - "AUDIO\\COL4_6.WAV", - "AUDIO\\COL4_7.WAV", - "AUDIO\\COL4_8.WAV", - "AUDIO\\COL4_9.WAV", - "AUDIO\\COL4_10.WAV", - "AUDIO\\COL4_11.WAV", - "AUDIO\\COL4_12.WAV", - "AUDIO\\COL4_13.WAV", - "AUDIO\\COL4_14.WAV", - "AUDIO\\COL4_15.WAV", - "AUDIO\\COL4_16.WAV", - "AUDIO\\COL4_17.WAV", - "AUDIO\\COL4_18.WAV", - "AUDIO\\COL4_19.WAV", - "AUDIO\\COL4_20.WAV", - "AUDIO\\COL4_21.WAV", - "AUDIO\\COL4_22.WAV", - "AUDIO\\COL4_23.WAV", - "AUDIO\\COL4_24.WAV", - "AUDIO\\COL4_25.WAV", - "AUDIO\\COL4_26.WAV", - "AUDIO\\COL5_1.WAV", - "AUDIO\\COL5_2.WAV", - "AUDIO\\COL5_3.WAV", - "AUDIO\\COL5_4.WAV", - "AUDIO\\COL5_5.WAV", - "AUDIO\\COL5_6.WAV", - "AUDIO\\COL5_7.WAV", - "AUDIO\\COL5_8.WAV", - "AUDIO\\COL5_9.WAV", - "AUDIO\\COL5_10.WAV", - "AUDIO\\COL5_11.WAV", - "AUDIO\\COL5_12.WAV", - "AUDIO\\COL5_13.WAV", - "AUDIO\\COL5_14.WAV", - "AUDIO\\COL5_15.WAV", - "AUDIO\\COL5_16.WAV", - "AUDIO\\COL5_17.WAV", - "AUDIO\\COL5_18.WAV", - "AUDIO\\COL5_19.WAV", - "AUDIO\\COL5_20.WAV", - "AUDIO\\COL5_21.WAV", - "AUDIO\\COL5_22.WAV", - "AUDIO\\CUB1_1.WAV", - "AUDIO\\CUB1_2.WAV", - "AUDIO\\CUB1_3.WAV", - "AUDIO\\CUB1_4.WAV", - "AUDIO\\CUB1_5.WAV", - "AUDIO\\CUB1_6.WAV", - "AUDIO\\CUB1_7.WAV", - "AUDIO\\CUB1_8.WAV", - "AUDIO\\CUB1_9.WAV", - "AUDIO\\CUB1_10.WAV", - "AUDIO\\CUB2_1.WAV", - "AUDIO\\CUB2_2.WAV", - "AUDIO\\CUB2_3A.WAV", - "AUDIO\\CUB2_3B.WAV", - "AUDIO\\CUB2_3C.WAV", - "AUDIO\\CUB2_4A.WAV", - "AUDIO\\CUB2_5.WAV", - "AUDIO\\CUB2_6.WAV", - "AUDIO\\CUB2_7.WAV", - "AUDIO\\CUB2_8.WAV", - "AUDIO\\CUB2_9.WAV", - "AUDIO\\CUB2_10.WAV", - "AUDIO\\CUB2_11.WAV", - "AUDIO\\CUB3_1.WAV", - "AUDIO\\CUB3_2.WAV", - "AUDIO\\CUB3_3.WAV", - "AUDIO\\CUB3_4.WAV", - "AUDIO\\CUB4_1.WAV", - "AUDIO\\CUB4_2.WAV", - "AUDIO\\CUB4_3.WAV", - "AUDIO\\CUB4_4.WAV", - "AUDIO\\CUB4_5.WAV", - "AUDIO\\CUB4_5A.WAV", - "AUDIO\\CUB4_6.WAV", - "AUDIO\\CUB4_7.WAV", - "AUDIO\\CUB4_8.WAV", - "AUDIO\\CUB4_9.WAV", - "AUDIO\\CUB4_10.WAV", - "AUDIO\\CUB4_11.WAV", - "AUDIO\\CUB4_12.WAV", - "AUDIO\\CUB4_13.WAV", - "AUDIO\\CUB4_14.WAV", - "AUDIO\\CUB4_15.WAV", - "AUDIO\\CUB4_16.WAV", - "AUDIO\\GOLF_1.WAV", - "AUDIO\\GOLF_2.WAV", - "AUDIO\\GOLF_3.WAV", - "AUDIO\\BAR_1.WAV", - "AUDIO\\BAR_2.WAV", - "AUDIO\\BAR_3.WAV", - "AUDIO\\BAR_4.WAV", - "AUDIO\\BAR_5.WAV", - "AUDIO\\BAR_6.WAV", - "AUDIO\\BAR_7.WAV", - "AUDIO\\BAR_8.WAV", - "AUDIO\\STRIP_1.WAV", - "AUDIO\\STRIP_2.WAV", - "AUDIO\\STRIP_3.WAV", - "AUDIO\\STRIP_4.WAV", - "AUDIO\\STRIP_5.WAV", - "AUDIO\\STRIP_6.WAV", - "AUDIO\\STRIP_7.WAV", - "AUDIO\\STRIP_8.WAV", - "AUDIO\\STRIP_9.WAV", - "AUDIO\\STAR_1.WAV", - "AUDIO\\STAR_2.WAV", - "AUDIO\\STAR_3.WAV", - "AUDIO\\STAR_4.WAV", - "AUDIO\\FIN_1A.WAV", - "AUDIO\\FIN_1B.WAV", - "AUDIO\\FIN_1C.WAV", - "AUDIO\\FIN_2B.WAV", - "AUDIO\\FIN_2C.WAV", - "AUDIO\\FIN_3.WAV", - "AUDIO\\FIN_4.WAV", - "AUDIO\\FIN_5.WAV", - "AUDIO\\FIN_6.WAV", - "AUDIO\\FIN_10.WAV", - "AUDIO\\FIN_11A.WAV", - "AUDIO\\FIN_11B.WAV", - "AUDIO\\FIN_12A.WAV", - "AUDIO\\FIN_12B.WAV", - "AUDIO\\FIN_12C.WAV", - "AUDIO\\FIN_13.WAV", - "AUDIO\\FINKILL.WAV", - "AUDIO\\LAW1_1.WAV", - "AUDIO\\LAW1_2.WAV", - "AUDIO\\LAW1_3.WAV", - "AUDIO\\LAW1_4.WAV", - "AUDIO\\LAW1_5.WAV", - "AUDIO\\LAW1_6.WAV", - "AUDIO\\LAW1_7.WAV", - "AUDIO\\LAW1_8.WAV", - "AUDIO\\LAW1_9.WAV", - "AUDIO\\LAW1_10.WAV", - "AUDIO\\LAW2_1.WAV", - "AUDIO\\LAW2_2.WAV", - "AUDIO\\LAW2_3.WAV", - "AUDIO\\LAW2_4.WAV", - "AUDIO\\LAW2_5.WAV", - "AUDIO\\LAW2_6.WAV", - "AUDIO\\LAW2_7.WAV", - "AUDIO\\LAW2_8.WAV", - "AUDIO\\LAW2_9.WAV", - "AUDIO\\LAW2_10.WAV", - "AUDIO\\LAW3_1.WAV", - "AUDIO\\LAW3_2.WAV", - "AUDIO\\LAW3_3.WAV", - "AUDIO\\LAW3_4.WAV", - "AUDIO\\LAW3_5.WAV", - "AUDIO\\LAW3_6.WAV", - "AUDIO\\LAW3_10.WAV", - "AUDIO\\LAW3_11.WAV", - "AUDIO\\LAW3_12.WAV", - "AUDIO\\LAW3_13.WAV", - "AUDIO\\LAW3_14.WAV", - "AUDIO\\LAW3_16.WAV", - "AUDIO\\LAW3_17.WAV", - "AUDIO\\LAW3_18.WAV", - "AUDIO\\LAW3_19.WAV", - "AUDIO\\LAW3_20.WAV", - "AUDIO\\LAW3_21.WAV", - "AUDIO\\LAW3_22.WAV", - "AUDIO\\LAW3_23.WAV", - "AUDIO\\LAW3_24.WAV", - "AUDIO\\LAW3_25.WAV", - "AUDIO\\LAW4_1A.WAV", - "AUDIO\\LAW4_1B.WAV", - "AUDIO\\LAW4_1C.WAV", - "AUDIO\\LAW4_1D.WAV", - "AUDIO\\LAW4_10.WAV", - "AUDIO\\LAW4_3.WAV", - "AUDIO\\LAW4_4.WAV", - "AUDIO\\LAW4_5.WAV", - "AUDIO\\LAW4_6.WAV", - "AUDIO\\LAW4_7.WAV", - "AUDIO\\LAW4_8.WAV", - "AUDIO\\LAW4_9.WAV", - "AUDIO\\PHIL1_2.WAV", - "AUDIO\\PHIL1_3.WAV", - "AUDIO\\PHIL2_1.WAV", - "AUDIO\\PHIL2_2.WAV", - "AUDIO\\PHIL2_3.WAV", - "AUDIO\\PHIL2_4.WAV", - "AUDIO\\PHIL2_5.WAV", - "AUDIO\\PHIL2_6.WAV", - "AUDIO\\PHIL2_7.WAV", - "AUDIO\\PHIL2_8.WAV", - "AUDIO\\PHIL2_9.WAV", - "AUDIO\\PHIL210.WAV", - "AUDIO\\PHIL211.WAV", - "AUDIO\\PORN1_1.WAV", - "AUDIO\\PORN1_2.WAV", - "AUDIO\\PORN1_3.WAV", - "AUDIO\\PRN1_3A.WAV", - "AUDIO\\PORN1_4.WAV", - "AUDIO\\PORN1_5.WAV", - "AUDIO\\PORN1_6.WAV", - "AUDIO\\PORN1_7.WAV", - "AUDIO\\PORN1_8.WAV", - "AUDIO\\PORN1_9.WAV", - "AUDIO\\PRN1_10.WAV", - "AUDIO\\PRN1_11.WAV", - "AUDIO\\PRN1_12.WAV", - "AUDIO\\PRN1_13.WAV", - "AUDIO\\PRN1_14.WAV", - "AUDIO\\PRN1_15.WAV", - "AUDIO\\PRN1_16.WAV", - "AUDIO\\PRN1_17.WAV", - "AUDIO\\PRN1_18.WAV", - "AUDIO\\PRN1_19.WAV", - "AUDIO\\PRN1_20.WAV", - "AUDIO\\PRN1_21.WAV", - "AUDIO\\PORN3_1.WAV", - "AUDIO\\PORN3_2.WAV", - "AUDIO\\PORN3_3.WAV", - "AUDIO\\PORN3_4.WAV", - "AUDIO\\PSYCH_1.WAV", - "AUDIO\\PSYCH_2.WAV", - "AUDIO\\ROK2_01.WAV", - "AUDIO\\ROK3_1.WAV", - "AUDIO\\ROK3_2.WAV", - "AUDIO\\ROK3_3.WAV", - "AUDIO\\ROK3_4.WAV", - "AUDIO\\ROK3_5.WAV", - "AUDIO\\ROK3_6.WAV", - "AUDIO\\ROK3_7.WAV", - "AUDIO\\ROK3_8.WAV", - "AUDIO\\ROK3_9.WAV", - "AUDIO\\ROK3_10.WAV", - "AUDIO\\ROK3_11.WAV", - "AUDIO\\ROK3_12.WAV", - "AUDIO\\ROK3_13.WAV", - "AUDIO\\ROK3_14.WAV", - "AUDIO\\ROK3_15.WAV", - "AUDIO\\ROK3_16.WAV", - "AUDIO\\ROK3_17.WAV", - "AUDIO\\ROK3_18.WAV", - "AUDIO\\ROK3_19.WAV", - "AUDIO\\ROK3_20.WAV", - "AUDIO\\ROK3_21.WAV", - "AUDIO\\ROK3_22.WAV", - "AUDIO\\ROK3_23.WAV", - "AUDIO\\ROK3_24.WAV", - "AUDIO\\ROK3_25.WAV", - "AUDIO\\ROK3_26.WAV", - "AUDIO\\ROK3_27.WAV", - "AUDIO\\ROK3_62.WAV", - "AUDIO\\ROK3_63.WAV", - "AUDIO\\ROK3_64.WAV", - "AUDIO\\ROK3_65.WAV", - "AUDIO\\ROK3_66.WAV", - "AUDIO\\ROK3_67.WAV", - "AUDIO\\ROK3_68.WAV", - "AUDIO\\ROK3_69.WAV", - "AUDIO\\ROK3_70.WAV", - "AUDIO\\ROK3_71.WAV", - "AUDIO\\ROK3_73.WAV", - "AUDIO\\RESC_1.WAV", - "AUDIO\\RESC_2.WAV", - "AUDIO\\RESC_3.WAV", - "AUDIO\\RESC_4.WAV", - "AUDIO\\RESC_5.WAV", - "AUDIO\\RESC_6.WAV", - "AUDIO\\RESC_7.WAV", - "AUDIO\\RESC_8.WAV", - "AUDIO\\RESC_9.WAV", - "AUDIO\\RESC_10.WAV", - "AUDIO\\ROK1_1A.WAV", - "AUDIO\\ROK1_1B.WAV", - "AUDIO\\ROK1_5.WAV", - "AUDIO\\ROK1_6.WAV", - "AUDIO\\ROK1_7.WAV", - "AUDIO\\ROK1_8.WAV", - "AUDIO\\ROK1_9.WAV", - "AUDIO\\TAX1_1.WAV", - "AUDIO\\TAX1_2.WAV", - "AUDIO\\TAX1_3.WAV", - "AUDIO\\TAX1_4.WAV", - "AUDIO\\TAX1_5.WAV", - "AUDIO\\TAX2_1.WAV", - "AUDIO\\TAX2_2.WAV", - "AUDIO\\TAX2_3.WAV", - "AUDIO\\TAX2_4.WAV", - "AUDIO\\TAX2_5.WAV", - "AUDIO\\TAX2_6.WAV", - "AUDIO\\TAX2_7.WAV", - "AUDIO\\TAX3_1.WAV", - "AUDIO\\TAX3_2.WAV", - "AUDIO\\TAX3_3.WAV", - "AUDIO\\TAX3_4.WAV", - "AUDIO\\TAX3_5.WAV", - "AUDIO\\TEX1_1.WAV", - "AUDIO\\TEX1_2.WAV", - "AUDIO\\TEX1_3.WAV", - "AUDIO\\TEX1_4.WAV", - "AUDIO\\TEX1_5.WAV", - "AUDIO\\TEX1_6.WAV", - "AUDIO\\TEX2_1.WAV", - "AUDIO\\TEX3_1.WAV", - "AUDIO\\TEX3_2.WAV", - "AUDIO\\TEX3_3.WAV", - "AUDIO\\TEX3_4.WAV", - "AUDIO\\TEX3_5.WAV", - "AUDIO\\TEX3_6.WAV", - "AUDIO\\TEX3_7.WAV", - "AUDIO\\TEX3_8.WAV", - "AUDIO\\HAT_1A.WAV", - "AUDIO\\INTRO1.WAV", - "AUDIO\\INTRO2.WAV", - "AUDIO\\INTRO3.WAV", - "AUDIO\\INTRO4.WAV", - "AUDIO\\MOB_01A.WAV", - "AUDIO\\MOB_01B.WAV", - "AUDIO\\MOB_01C.WAV", - "AUDIO\\MOB_02A.WAV", - "AUDIO\\MOB_02B.WAV", - "AUDIO\\MOB_02C.WAV", - "AUDIO\\MOB_03A.WAV", - "AUDIO\\MOB_03B.WAV", - "AUDIO\\MOB_03C.WAV", - "AUDIO\\MOB_03D.WAV", - "AUDIO\\MOB_03E.WAV", - "AUDIO\\SHARK_1.WAV", - "AUDIO\\SHARK_2.WAV", - "AUDIO\\SHARK_3.WAV", - "AUDIO\\SHARK_4.WAV", - "AUDIO\\SHARK_5.WAV", - "AUDIO\\MOB_04A.WAV", - "AUDIO\\MOB_04B.WAV", - "AUDIO\\MOB_04C.WAV", - "AUDIO\\MOB_04D.WAV", - "AUDIO\\MOB_05A.WAV", - "AUDIO\\MOB_05B.WAV", - "AUDIO\\MOB_05C.WAV", - "AUDIO\\MOB_05D.WAV", - "AUDIO\\MOB_06A.WAV", - "AUDIO\\MOB_06B.WAV", - "AUDIO\\MOB_06C.WAV", - "AUDIO\\MOB_07A.WAV", - "AUDIO\\MOB_07B.WAV", - "AUDIO\\MOB_08A.WAV", - "AUDIO\\MOB_08B.WAV", - "AUDIO\\MOB_08C.WAV", - "AUDIO\\MOB_08D.WAV", - "AUDIO\\MOB_08E.WAV", - "AUDIO\\MOB_08F.WAV", - "AUDIO\\MOB_08G.WAV", - "AUDIO\\MOB_09A.WAV", - "AUDIO\\MOB_09B.WAV", - "AUDIO\\MOB_09C.WAV", - "AUDIO\\MOB_09D.WAV", - "AUDIO\\MOB_09E.WAV", - "AUDIO\\MOB_09F.WAV", - "AUDIO\\MOB_10A.WAV", - "AUDIO\\MOB_10B.WAV", - "AUDIO\\MOB_10C.WAV", - "AUDIO\\MOB_10D.WAV", - "AUDIO\\MOB_10E.WAV", - "AUDIO\\MOB_11A.WAV", - "AUDIO\\MOB_11B.WAV", - "AUDIO\\MOB_11C.WAV", - "AUDIO\\MOB_11D.WAV", - "AUDIO\\MOB_11E.WAV", - "AUDIO\\MOB_11F.WAV", - "AUDIO\\MOB_14A.WAV", - "AUDIO\\MOB_14B.WAV", - "AUDIO\\MOB_14C.WAV", - "AUDIO\\MOB_14D.WAV", - "AUDIO\\MOB_14E.WAV", - "AUDIO\\MOB_14F.WAV", - "AUDIO\\MOB_14G.WAV", - "AUDIO\\MOB_14H.WAV", - "AUDIO\\MOB_16A.WAV", - "AUDIO\\MOB_16B.WAV", - "AUDIO\\MOB_16C.WAV", - "AUDIO\\MOB_16D.WAV", - "AUDIO\\MOB_16E.WAV", - "AUDIO\\MOB_16F.WAV", - "AUDIO\\MOB_16G.WAV", - "AUDIO\\MOB_17A.WAV", - "AUDIO\\MOB_17B.WAV", - "AUDIO\\MOB_17C.WAV", - "AUDIO\\MOB_17D.WAV", - "AUDIO\\MOB_17E.WAV", - "AUDIO\\MOB_17G.WAV", - "AUDIO\\MOB_17H.WAV", - "AUDIO\\MOB_17I.WAV", - "AUDIO\\MOB_17J.WAV", - "AUDIO\\MOB_17K.WAV", - "AUDIO\\MOB_17L.WAV", - "AUDIO\\MOB_18A.WAV", - "AUDIO\\MOB_18B.WAV", - "AUDIO\\MOB_18C.WAV", - "AUDIO\\MOB_18D.WAV", - "AUDIO\\MOB_18E.WAV", - "AUDIO\\MOB_18F.WAV", - "AUDIO\\MOB_18G.WAV", - "AUDIO\\MOB_20A.WAV", - "AUDIO\\MOB_20B.WAV", - "AUDIO\\MOB_20C.WAV", - "AUDIO\\MOB_20D.WAV", - "AUDIO\\MOB_20E.WAV", - "AUDIO\\MOB_24A.WAV", - "AUDIO\\MOB_24B.WAV", - "AUDIO\\MOB_24C.WAV", - "AUDIO\\MOB_24D.WAV", - "AUDIO\\MOB_24E.WAV", - "AUDIO\\MOB_24F.WAV", - "AUDIO\\MOB_24G.WAV", - "AUDIO\\MOB_24H.WAV", - "AUDIO\\MOB_25A.WAV", - "AUDIO\\MOB_25B.WAV", - "AUDIO\\MOB_25C.WAV", - "AUDIO\\MOB_25D.WAV", - "AUDIO\\MOB_26A.WAV", - "AUDIO\\MOB_26B.WAV", - "AUDIO\\MOB_26C.WAV", - "AUDIO\\MOB_26D.WAV", - "AUDIO\\MOB_26E.WAV", - "AUDIO\\MOB_29A.WAV", - "AUDIO\\MOB_29B.WAV", - "AUDIO\\MOB_29C.WAV", - "AUDIO\\MOB_29D.WAV", - "AUDIO\\MOB_29E.WAV", - "AUDIO\\MOB_29F.WAV", - "AUDIO\\MOB_29G.WAV", - "AUDIO\\MOB_30A.WAV", - "AUDIO\\MOB_30B.WAV", - "AUDIO\\MOB_30C.WAV", - "AUDIO\\MOB_30D.WAV", - "AUDIO\\MOB_30E.WAV", - "AUDIO\\MOB_30F.WAV", - "AUDIO\\MOB_33A.WAV", - "AUDIO\\MOB_33B.WAV", - "AUDIO\\MOB_33C.WAV", - "AUDIO\\MOB_33D.WAV", - "AUDIO\\MOB_34A.WAV", - "AUDIO\\MOB_34B.WAV", - "AUDIO\\MOB_34C.WAV", - "AUDIO\\MOB_34D.WAV", - "AUDIO\\MOB_35A.WAV", - "AUDIO\\MOB_35B.WAV", - "AUDIO\\MOB_35C.WAV", - "AUDIO\\MOB_35D.WAV", - "AUDIO\\MOB_36A.WAV", - "AUDIO\\MOB_36B.WAV", - "AUDIO\\MOB_36C.WAV", - "AUDIO\\MOB_40A.WAV", - "AUDIO\\MOB_40B.WAV", - "AUDIO\\MOB_40C.WAV", - "AUDIO\\MOB_40D.WAV", - "AUDIO\\MOB_40E.WAV", - "AUDIO\\MOB_40F.WAV", - "AUDIO\\MOB_40G.WAV", - "AUDIO\\MOB_40H.WAV", - "AUDIO\\MOB_40I.WAV", - "AUDIO\\MOB_41A.WAV", - "AUDIO\\MOB_41B.WAV", - "AUDIO\\MOB_41C.WAV", - "AUDIO\\MOB_41D.WAV", - "AUDIO\\MOB_41E.WAV", - "AUDIO\\MOB_41F.WAV", - "AUDIO\\MOB_41G.WAV", - "AUDIO\\MOB_41H.WAV", - "AUDIO\\MOB_42A.WAV", - "AUDIO\\MOB_42B.WAV", - "AUDIO\\MOB_42C.WAV", - "AUDIO\\MOB_42D.WAV", - "AUDIO\\MOB_42E.WAV", - "AUDIO\\MOB_43A.WAV", - "AUDIO\\MOB_43B.WAV", - "AUDIO\\MOB_43C.WAV", - "AUDIO\\MOB_43D.WAV", - "AUDIO\\MOB_43E.WAV", - "AUDIO\\MOB_43F.WAV", - "AUDIO\\MOB_43G.WAV", - "AUDIO\\MOB_43H.WAV", - "AUDIO\\MOB_45A.WAV", - "AUDIO\\MOB_45B.WAV", - "AUDIO\\MOB_45C.WAV", - "AUDIO\\MOB_45D.WAV", - "AUDIO\\MOB_45E.WAV", - "AUDIO\\MOB_45F.WAV", - "AUDIO\\MOB_45G.WAV", - "AUDIO\\MOB_45H.WAV", - "AUDIO\\MOB_45I.WAV", - "AUDIO\\MOB_45J.WAV", - "AUDIO\\MOB_45K.WAV", - "AUDIO\\MOB_45L.WAV", - "AUDIO\\MOB_45M.WAV", - "AUDIO\\MOB_45N.WAV", - "AUDIO\\MOB_46A.WAV", - "AUDIO\\MOB_46B.WAV", - "AUDIO\\MOB_46C.WAV", - "AUDIO\\MOB_46D.WAV", - "AUDIO\\MOB_46E.WAV", - "AUDIO\\MOB_46F.WAV", - "AUDIO\\MOB_46G.WAV", - "AUDIO\\MOB_46H.WAV", - "AUDIO\\MOB_47A.WAV", - "AUDIO\\MOB_52A.WAV", - "AUDIO\\MOB_52B.WAV", - "AUDIO\\MOB_52C.WAV", - "AUDIO\\MOB_52D.WAV", - "AUDIO\\MOB_52E.WAV", - "AUDIO\\MOB_52F.WAV", - "AUDIO\\MOB_52G.WAV", - "AUDIO\\MOB_52H.WAV", - "AUDIO\\MOB_54A.WAV", - "AUDIO\\MOB_54B.WAV", - "AUDIO\\MOB_54C.WAV", - "AUDIO\\MOB_54D.WAV", - "AUDIO\\MOB_54E.WAV", - "AUDIO\\MOB_55A.WAV", - "AUDIO\\MOB_55B.WAV", - "AUDIO\\MOB_55C.WAV", - "AUDIO\\MOB_55D.WAV", - "AUDIO\\MOB_55E.WAV", - "AUDIO\\MOB_55F.WAV", - "AUDIO\\MOB_56A.WAV", - "AUDIO\\MOB_56B.WAV", - "AUDIO\\MOB_56C.WAV", - "AUDIO\\MOB_56D.WAV", - "AUDIO\\MOB_56E.WAV", - "AUDIO\\MOB_56F.WAV", - "AUDIO\\MOB_57A.WAV", - "AUDIO\\MOB_57B.WAV", - "AUDIO\\MOB_57C.WAV", - "AUDIO\\MOB_57D.WAV", - "AUDIO\\MOB_57E.WAV", - "AUDIO\\MOB_58A.WAV", - "AUDIO\\MOB_58B.WAV", - "AUDIO\\MOB_58C.WAV", - "AUDIO\\MOB_58D.WAV", - "AUDIO\\MOB_58E.WAV", - "AUDIO\\MOB_58F.WAV", - "AUDIO\\MOB_58G.WAV", - "AUDIO\\MOB_61A.WAV", - "AUDIO\\MOB_61B.WAV", - "AUDIO\\MOB_62A.WAV", - "AUDIO\\MOB_62B.WAV", - "AUDIO\\MOB_62C.WAV", - "AUDIO\\MOB_62D.WAV", - "AUDIO\\MOB_63A.WAV", - "AUDIO\\MOB_63B.WAV", - "AUDIO\\MOB_63C.WAV", - "AUDIO\\MOB_63D.WAV", - "AUDIO\\MOB_63E.WAV", - "AUDIO\\MOB_63F.WAV", - "AUDIO\\MOB_63G.WAV", - "AUDIO\\MOB_63H.WAV", - "AUDIO\\MOB_63I.WAV", - "AUDIO\\MOB_63J.WAV", - "AUDIO\\MOB_66A.WAV", - "AUDIO\\MOB_66B.WAV", - "AUDIO\\MOB_68A.WAV", - "AUDIO\\MOB_68B.WAV", - "AUDIO\\MOB_68C.WAV", - "AUDIO\\MOB_68D.WAV", - "AUDIO\\MOB_70A.WAV", - "AUDIO\\MOB_70B.WAV", - "AUDIO\\MOB_71A.WAV", - "AUDIO\\MOB_71B.WAV", - "AUDIO\\MOB_71C.WAV", - "AUDIO\\MOB_71D.WAV", - "AUDIO\\MOB_71E.WAV", - "AUDIO\\MOB_71F.WAV", - "AUDIO\\MOB_71G.WAV", - "AUDIO\\MOB_71H.WAV", - "AUDIO\\MOB_71I.WAV", - "AUDIO\\MOB_71J.WAV", - "AUDIO\\MOB_71K.WAV", - "AUDIO\\MOB_71L.WAV", - "AUDIO\\MOB_71M.WAV", - "AUDIO\\MOB_71N.WAV", - "AUDIO\\MOB_72A.WAV", - "AUDIO\\MOB_72B.WAV", - "AUDIO\\MOB_72C.WAV", - "AUDIO\\MOB_72D.WAV", - "AUDIO\\MOB_72E.WAV", - "AUDIO\\MOB_72F.WAV", - "AUDIO\\MOB_72G.WAV", - "AUDIO\\MOB_73A.WAV", - "AUDIO\\MOB_73C.WAV", - "AUDIO\\MOB_73D.WAV", - "AUDIO\\MOB_73F.WAV", - "AUDIO\\MOB_73G.WAV", - "AUDIO\\MOB_73I.WAV", - "AUDIO\\MOB_95A.WAV", - "AUDIO\\MOB_96A.WAV", - "AUDIO\\MOB_98A.WAV", - "AUDIO\\MOB_99A.WAV", - "AUDIO\\JOB1_1B.WAV", - "AUDIO\\JOB1_1C.WAV", - "AUDIO\\JOB1_1D.WAV", - "AUDIO\\JOB2_1B.WAV", - "AUDIO\\JOB2_2.WAV", - "AUDIO\\JOB2_3.WAV", - "AUDIO\\JOB2_4.WAV", - "AUDIO\\JOB2_5.WAV", - "AUDIO\\JOB2_6.WAV", - "AUDIO\\JOB2_7.WAV", - "AUDIO\\JOB2_8.WAV", - "AUDIO\\JOB2_9.WAV", - "AUDIO\\JOB3_1.WAV", - "AUDIO\\JOB3_2.WAV", - "AUDIO\\JOB3_3.WAV", - "AUDIO\\JOB4_1.WAV", - "AUDIO\\JOB4_2.WAV", - "AUDIO\\JOB4_3.WAV", - "AUDIO\\JOB5_1.WAV", - "AUDIO\\JOB5_2.WAV", - "AUDIO\\JOB5_3.WAV", - "AUDIO\\BJM1_20.WAV", - "AUDIO\\BJM1_4.WAV", - "AUDIO\\BJM1_5.WAV", - "AUDIO\\MERC_39.WAV", - "AUDIO\\MONO_1.WAV", - "AUDIO\\MONO_2.WAV", - "AUDIO\\MONO_3.WAV", - "AUDIO\\MONO_4.WAV", - "AUDIO\\MONO_5.WAV", - "AUDIO\\MONO_6.WAV", - "AUDIO\\MONO_7.WAV", - "AUDIO\\MONO_8.WAV", - "AUDIO\\MONO_9.WAV", - "AUDIO\\MONO10.WAV", - "AUDIO\\MONO11.WAV", - "AUDIO\\MONO12.WAV", - "AUDIO\\MONO13.WAV", - "AUDIO\\MONO14.WAV", - "AUDIO\\MONO15.WAV", - "AUDIO\\MONO16.WAV", - "AUDIO\\FUD_01.WAV", - "AUDIO\\FUD_02.WAV", - "AUDIO\\FUD_03.WAV", - "AUDIO\\FUD_04.WAV", - "AUDIO\\FUD_05.WAV", - "AUDIO\\FUD_06.WAV", - "AUDIO\\FUD_07.WAV", - "AUDIO\\FUD_08.WAV", - "AUDIO\\FUD_09.WAV", - "AUDIO\\FUD_10.WAV", - "AUDIO\\FUD_11.WAV", - "AUDIO\\FUD_12.WAV", - "AUDIO\\FUD_13.WAV", - "AUDIO\\FUD_14.WAV", - "AUDIO\\FUD_15.WAV", - "AUDIO\\FUD_16.WAV", - "AUDIO\\FUD_17.WAV", - "AUDIO\\FUD_18.WAV", - "AUDIO\\FUD_19.WAV", - "AUDIO\\FUD_20.WAV", - "AUDIO\\BURG_01.WAV", - "AUDIO\\BURG_02.WAV", - "AUDIO\\BURG_03.WAV", - "AUDIO\\BURG_04.WAV", - "AUDIO\\BURG_05.WAV", - "AUDIO\\BURG_06.WAV", - "AUDIO\\BURG_07.WAV", - "AUDIO\\BURG_08.WAV", - "AUDIO\\BURG_09.WAV", - "AUDIO\\BURG_10.WAV", - "AUDIO\\BURG_11.WAV", - "AUDIO\\BURG_12.WAV", - "AUDIO\\CRUST01.WAV", - "AUDIO\\CRUST02.WAV", - "AUDIO\\CRUST03.WAV", - "AUDIO\\CRUST04.WAV", - "AUDIO\\CRUST05.WAV", - "AUDIO\\CRUST06.WAV", - "AUDIO\\CRUST07.WAV", - "AUDIO\\CRUST08.WAV", - "AUDIO\\CRUST09.WAV", - "AUDIO\\BAND_01.WAV", - "AUDIO\\BAND_02.WAV", - "AUDIO\\BAND_03.WAV", - "AUDIO\\BAND_04.WAV", - "AUDIO\\BAND_05.WAV", - "AUDIO\\BAND_06.WAV", - "AUDIO\\BAND_07.WAV", - "AUDIO\\BAND_08.WAV", - "AUDIO\\SHAFT01.WAV", - "AUDIO\\SHAFT02.WAV", - "AUDIO\\SHAFT03.WAV", - "AUDIO\\SHAFT04.WAV", - "AUDIO\\SHAFT05.WAV", - "AUDIO\\SHAFT06.WAV", - "AUDIO\\SHAFT07.WAV", - "AUDIO\\SHAFT08.WAV", - "AUDIO\\PISS_01.WAV", - "AUDIO\\PISS_02.WAV", - "AUDIO\\PISS_03.WAV", - "AUDIO\\PISS_04.WAV", - "AUDIO\\PISS_05.WAV", - "AUDIO\\PISS_06.WAV", - "AUDIO\\PISS_07.WAV", - "AUDIO\\PISS_08.WAV", - "AUDIO\\PISS_09.WAV", - "AUDIO\\PISS_10.WAV", - "AUDIO\\PISS_11.WAV", - "AUDIO\\PISS_12.WAV", - "AUDIO\\PISS_13.WAV", - "AUDIO\\PISS_14.WAV", - "AUDIO\\PISS_15.WAV", - "AUDIO\\PISS_16.WAV", - "AUDIO\\PISS_17.WAV", - "AUDIO\\PISS_18.WAV", - "AUDIO\\PISS_19.WAV", - "AUDIO\\GIMME01.WAV", - "AUDIO\\GIMME02.WAV", - "AUDIO\\GIMME03.WAV", - "AUDIO\\GIMME04.WAV", - "AUDIO\\GIMME05.WAV", - "AUDIO\\GIMME06.WAV", - "AUDIO\\GIMME07.WAV", - "AUDIO\\GIMME08.WAV", - "AUDIO\\GIMME09.WAV", - "AUDIO\\GIMME10.WAV", - "AUDIO\\GIMME11.WAV", - "AUDIO\\GIMME12.WAV", - "AUDIO\\GIMME13.WAV", - "AUDIO\\GIMME14.WAV", - "AUDIO\\GIMME15.WAV", - "AUDIO\\BUST_01.WAV", - "AUDIO\\BUST_02.WAV", - "AUDIO\\BUST_03.WAV", - "AUDIO\\BUST_04.WAV", - "AUDIO\\BUST_05.WAV", - "AUDIO\\BUST_06.WAV", - "AUDIO\\BUST_07.WAV", - "AUDIO\\BUST_08.WAV", - "AUDIO\\BUST_09.WAV", - "AUDIO\\BUST_10.WAV", - "AUDIO\\BUST_11.WAV", - "AUDIO\\BUST_12.WAV", - "AUDIO\\BUST_13.WAV", - "AUDIO\\BUST_14.WAV", - "AUDIO\\BUST_15.WAV", - "AUDIO\\BUST_16.WAV", - "AUDIO\\BUST_17.WAV", - "AUDIO\\BUST_18.WAV", - "AUDIO\\BUST_19.WAV", - "AUDIO\\BUST_20.WAV", - "AUDIO\\BUST_21.WAV", - "AUDIO\\BUST_22.WAV", - "AUDIO\\BUST_23.WAV", - "AUDIO\\BUST_24.WAV", - "AUDIO\\BUST_25.WAV", - "AUDIO\\BUST_26.WAV", - "AUDIO\\BUST_27.WAV", - "AUDIO\\BUST_28.WAV", + };
\ No newline at end of file diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index 2a4286eb..78de4e6b 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -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); diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index ce6458e6..ef070825 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -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) diff --git a/src/collision/ColModel.cpp b/src/collision/ColModel.cpp index d2e01f50..49847dbd 100644 --- a/src/collision/ColModel.cpp +++ b/src/collision/ColModel.cpp @@ -24,7 +24,6 @@ CColModel::CColModel(void) CColModel::~CColModel(void) { RemoveCollisionVolumes(); - RemoveTrianglePlanes(); } void* diff --git a/src/collision/ColStore.h b/src/collision/ColStore.h index 8e2a3a70..e0da92ca 100644 --- a/src/collision/ColStore.h +++ b/src/collision/ColStore.h @@ -33,6 +33,7 @@ public: static void RequestCollision(const CVector2D &pos); static void EnsureCollisionIsInMemory(const CVector2D &pos); static bool HasCollisionLoaded(const CVector2D &pos); + static bool HasCollisionLoaded(eLevelName level) { return true; }; // TODO static ColDef *GetSlot(int slot) { assert(slot >= 0); diff --git a/src/collision/TempColModels.cpp b/src/collision/TempColModels.cpp index f8b26450..55058bde 100644 --- a/src/collision/TempColModels.cpp +++ b/src/collision/TempColModels.cpp @@ -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; diff --git a/src/collision/TempColModels.h b/src/collision/TempColModels.h index 0c936d6f..457315b6 100644 --- a/src/collision/TempColModels.h +++ b/src/collision/TempColModels.h @@ -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; diff --git a/src/control/CarAI.cpp b/src/control/CarAI.cpp index e7f3a546..06438e0a 100644 --- a/src/control/CarAI.cpp +++ b/src/control/CarAI.cpp @@ -4,6 +4,7 @@ #include "Accident.h" #include "AutoPilot.h" +#include "Bridge.h" #include "CarCtrl.h" #include "General.h" #include "HandlingMgr.h" @@ -74,6 +75,18 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle) case STATUS_PLAYER_DISABLED: break; case STATUS_SIMPLE: + { + if (pVehicle->m_pCurGroundEntity && CBridge::ThisIsABridgeObjectMovingUp(pVehicle->m_pCurGroundEntity->GetModelIndex())) + pVehicle->SetStatus(STATUS_PHYSICS); + CColPoint colPoint; + CEntity* pEntity; + if ((pVehicle->m_randomSeed & 0x3F) == (CTimer::GetFrameCounter() & 0x3F) && + !CWorld::ProcessVerticalLine(pVehicle->GetPosition(), -2.0f, colPoint, pEntity, true, false, false, false, true, false, nil)) { + debug("FLOATING CAR TURNED INTO PHYSICS CAR!\n"); + pVehicle->SetStatus(STATUS_PHYSICS); + } + } + // fallthough case STATUS_PHYSICS: switch (pVehicle->AutoPilot.m_nCarMission) { case MISSION_RAMPLAYER_FARAWAY: diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 1023f2a3..faee574c 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -11,6 +11,7 @@ #include "Cranes.h" #include "Curves.h" #include "CutsceneMgr.h" +#include "Frontend.h" #include "Gangs.h" #include "Game.h" #include "Garages.h" @@ -76,10 +77,11 @@ #define DISTANCE_BETWEEN_CAR_AND_DEAD_PED (6.0f) #define PROBABILITY_OF_PASSENGER_IN_VEHICLE (0.125f) -#define ONSCREEN_DESPAWN_RANGE (120.0f) -#define MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN (100.0f) -#define REQUEST_ONSCREEN_DISTANCE ((ONSCREEN_DESPAWN_RANGE + MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN) / 2) -#define OFFSCREEN_DESPAWN_RANGE (40.0f) +#define ONSCREEN_DESPAWN_RANGE (190.0f) +#define MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN (130.0f) +#define REQUEST_ONSCREEN_DISTANCE (140.0f) +#define OFFSCREEN_DESPAWN_RANGE (60.0f) +#define MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN (40.0f) #define EXTENDED_RANGE_DESPAWN_MULTIPLIER (1.5f) //--MIAMI: file done @@ -95,7 +97,7 @@ int32 CCarCtrl::NumRandomCars; int32 CCarCtrl::NumParkedCars; int32 CCarCtrl::NumPermanentCars; int8 CCarCtrl::CountDownToCarsAtStart; -int32 CCarCtrl::MaxNumberOfCarsInUse = 12; +int32 CCarCtrl::MaxNumberOfCarsInUse = 30; uint32 CCarCtrl::LastTimeLawEnforcerCreated; uint32 CCarCtrl::LastTimeFireTruckCreated; uint32 CCarCtrl::LastTimeAmbulanceCreated; @@ -161,14 +163,19 @@ CCarCtrl::GenerateOneRandomCar() carClass = COPS; carModel = ChoosePoliceCarModel(); }else{ - carModel = ChooseModel(&zone, &carClass); - if (carModel == -1 || (carClass == COPS && pWanted->m_nWantedLevel >= 1)) - /* All cop spawns with wanted level are handled by condition above. */ - /* In particular it means that cop cars never spawn if player has wanted level of 1. */ - return; + for (int i = 0; i < 5; i++) { + carModel = ChooseModel(&zone, &carClass); + if (carModel == -1) + return; + if (!(carClass == COPS && pWanted->m_nWantedLevel >= 1)) + /* All cop spawns with wanted level are handled by condition above. */ + /* In particular it means that cop cars never spawn if player has wanted level of 1. */ + break; + } } float frontX, frontY; float preferredDistance, angleLimit; + float requestMultiplier = 1.0f; bool invertAngleLimitTest; CVector spawnPosition; int32 curNodeId, nextNodeId; @@ -188,11 +195,14 @@ CCarCtrl::GenerateOneRandomCar() angleLimit = -1.0f; bTopDownCamera = true; invertAngleLimitTest = true; - preferredDistance = OFFSCREEN_DESPAWN_RANGE + 15.0f; + preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN + 15.0f; /* BUG: testForCollision not initialized in original game. */ testForCollision = false; }else if (!pPlayerVehicle){ /* Player is not in vehicle. */ + requestMultiplier = 13.0f / 20.0f; + if (FrontEndMenuManager.m_PrefsUseWideScreen) // TODO(LCS): static + requestMultiplier *= 4.0f / 3.0f; testForCollision = true; frontX = TheCamera.CamFrontXNorm; frontY = TheCamera.CamFrontYNorm; @@ -202,95 +212,105 @@ CCarCtrl::GenerateOneRandomCar() /* Forward to his current direction (camera direction). */ angleLimit = 0.707f; /* 45 degrees */ invertAngleLimitTest = true; - preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier; + preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier; break; case 1: /* Spawn a vehicle close to player to his side. */ /* Kinda not within camera angle. */ angleLimit = 0.707f; /* 45 degrees */ invertAngleLimitTest = false; - preferredDistance = OFFSCREEN_DESPAWN_RANGE; + preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN; break; } - }else if (fPlayerVehicleSpeed > 0.4f){ /* 72 km/h */ + } + else { + requestMultiplier = 13.0f / 20.0f; + if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON && !FrontEndMenuManager.m_PrefsUseWideScreen) + requestMultiplier *= 0.9f; + if (FrontEndMenuManager.m_PrefsUseWideScreen) // TODO(LCS): static + requestMultiplier *= 4.0f / 3.0f; + if (fPlayerVehicleSpeed > 0.4f) { /* 72 km/h */ /* Player is moving fast in vehicle */ /* Prefer spawning vehicles very far away from him. */ - frontX = vecPlayerVehicleSpeed.x / fPlayerVehicleSpeed; - frontY = vecPlayerVehicleSpeed.y / fPlayerVehicleSpeed; - testForCollision = false; - switch (CTimer::GetFrameCounter() & 3) { - case 0: - case 1: - /* Spawn a vehicle in a very narrow gap in front of a player */ - angleLimit = 0.85f; /* approx 30 degrees */ - invertAngleLimitTest = true; - preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier; - break; - case 2: - /* Spawn a vehicle relatively far away from player. */ - /* Forward to his current direction (camera direction). */ - angleLimit = 0.707f; /* 45 degrees */ - invertAngleLimitTest = true; - preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier; - break; - case 3: - /* Spawn a vehicle close to player to his side. */ - /* Kinda not within camera angle. */ - angleLimit = 0.707f; /* 45 degrees */ - invertAngleLimitTest = false; - preferredDistance = OFFSCREEN_DESPAWN_RANGE; - break; + frontX = vecPlayerVehicleSpeed.x / fPlayerVehicleSpeed; + frontY = vecPlayerVehicleSpeed.y / fPlayerVehicleSpeed; + testForCollision = false; + switch (CTimer::GetFrameCounter() & 3) { + case 0: + case 1: + /* Spawn a vehicle in a very narrow gap in front of a player */ + angleLimit = 0.85f; /* approx 30 degrees */ + invertAngleLimitTest = true; + preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier; + break; + case 2: + /* Spawn a vehicle relatively far away from player. */ + /* Forward to his current direction (camera direction). */ + angleLimit = 0.707f; /* 45 degrees */ + invertAngleLimitTest = true; + preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier; + break; + case 3: + /* Spawn a vehicle close to player to his side. */ + /* Kinda not within camera angle. */ + angleLimit = 0.707f; /* 45 degrees */ + invertAngleLimitTest = false; + preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN; + break; + } } - }else if (fPlayerVehicleSpeed > 0.1f){ /* 18 km/h */ - /* Player is moving moderately fast in vehicle */ - /* Spawn more vehicles to player's side. */ - frontX = vecPlayerVehicleSpeed.x / fPlayerVehicleSpeed; - frontY = vecPlayerVehicleSpeed.y / fPlayerVehicleSpeed; - testForCollision = false; - switch (CTimer::GetFrameCounter() & 3) { - case 0: - /* Spawn a vehicle in a very narrow gap in front of a player */ - angleLimit = 0.85f; /* approx 30 degrees */ - invertAngleLimitTest = true; - preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier; - break; - case 1: - /* Spawn a vehicle relatively far away from player. */ - /* Forward to his current direction (camera direction). */ - angleLimit = 0.707f; /* 45 degrees */ - invertAngleLimitTest = true; - preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier; - break; - case 2: - case 3: - /* Spawn a vehicle close to player to his side. */ - /* Kinda not within camera angle. */ - angleLimit = 0.707f; /* 45 degrees */ - invertAngleLimitTest = false; - preferredDistance = OFFSCREEN_DESPAWN_RANGE; - break; + else if (fPlayerVehicleSpeed > 0.1f) { /* 18 km/h */ + /* Player is moving moderately fast in vehicle */ + /* Spawn more vehicles to player's side. */ + frontX = vecPlayerVehicleSpeed.x / fPlayerVehicleSpeed; + frontY = vecPlayerVehicleSpeed.y / fPlayerVehicleSpeed; + testForCollision = false; + switch (CTimer::GetFrameCounter() & 3) { + case 0: + /* Spawn a vehicle in a very narrow gap in front of a player */ + angleLimit = 0.85f; /* approx 30 degrees */ + invertAngleLimitTest = true; + preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier; + break; + case 1: + /* Spawn a vehicle relatively far away from player. */ + /* Forward to his current direction (camera direction). */ + angleLimit = 0.707f; /* 45 degrees */ + invertAngleLimitTest = true; + preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier; + break; + case 2: + case 3: + /* Spawn a vehicle close to player to his side. */ + /* Kinda not within camera angle. */ + angleLimit = 0.707f; /* 45 degrees */ + invertAngleLimitTest = false; + preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN; + break; + } } - }else{ - /* Player is in vehicle but moving very slow. */ - /* Then use camera direction instead of vehicle direction. */ - testForCollision = true; - frontX = TheCamera.CamFrontXNorm; - frontY = TheCamera.CamFrontYNorm; - switch (CTimer::GetFrameCounter() & 1) { - case 0: - /* Spawn a vehicle relatively far away from player. */ - /* Forward to his current direction (camera direction). */ - angleLimit = 0.707f; /* 45 degrees */ - invertAngleLimitTest = true; - preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier; - break; - case 1: - /* Spawn a vehicle close to player to his side. */ - /* Kinda not within camera angle. */ - angleLimit = 0.707f; /* 45 degrees */ - invertAngleLimitTest = false; - preferredDistance = OFFSCREEN_DESPAWN_RANGE; - break; + else { + /* Player is in vehicle but moving very slow. */ + /* Then use camera direction instead of vehicle direction. */ + testForCollision = true; + frontX = TheCamera.CamFrontXNorm; + frontY = TheCamera.CamFrontYNorm; + switch (CTimer::GetFrameCounter() & 1) { + case 0: + /* Spawn a vehicle relatively far away from player. */ + /* Forward to his current direction (camera direction). */ + angleLimit = 0.707f; /* 45 degrees */ + invertAngleLimitTest = true; + preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier; + break; + case 1: + /* Spawn a vehicle close to player to his side. */ + /* Kinda not within camera angle. */ + angleLimit = 0.707f; /* 45 degrees */ + invertAngleLimitTest = false; + preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN; + break; + } } } if (!ThePaths.GenerateCarCreationCoors(vecTargetPos.x, vecTargetPos.y, frontX, frontY, @@ -300,6 +320,8 @@ CCarCtrl::GenerateOneRandomCar() CPathNode* pCurNode = &ThePaths.m_pathNodes[curNodeId]; CPathNode* pNextNode = &ThePaths.m_pathNodes[nextNodeId]; bool bBoatGenerated = false; + if (!OkToCreateVehicleAtThisPosition(spawnPosition)) + return; if ((CGeneral::GetRandomNumber() & 0xF) > Min(pCurNode->spawnRate, pNextNode->spawnRate)) return; if (pCurNode->bWaterPath) { @@ -599,12 +621,12 @@ CCarCtrl::GenerateOneRandomCar() return; } }else{ - if ((vecTargetPos - pVehicle->GetPosition()).Magnitude2D() > TheCamera.GenerationDistMultiplier * (pVehicle->bExtendedRange ? EXTENDED_RANGE_DESPAWN_MULTIPLIER : 1.0f) * ONSCREEN_DESPAWN_RANGE || - (vecTargetPos - pVehicle->GetPosition()).Magnitude2D() < TheCamera.GenerationDistMultiplier * MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN) { + if ((vecTargetPos - pVehicle->GetPosition()).Magnitude2D() > TheCamera.GenerationDistMultiplier * requestMultiplier * (pVehicle->bExtendedRange ? EXTENDED_RANGE_DESPAWN_MULTIPLIER : 1.0f) * ONSCREEN_DESPAWN_RANGE || + (vecTargetPos - pVehicle->GetPosition()).Magnitude2D() < TheCamera.GenerationDistMultiplier * requestMultiplier * MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN) { delete pVehicle; return; } - if ((TheCamera.GetPosition() - pVehicle->GetPosition()).Magnitude2D() < 82.5f * TheCamera.GenerationDistMultiplier || bTopDownCamera) { + if ((TheCamera.GetPosition() - pVehicle->GetPosition()).Magnitude2D() < 105.0f * requestMultiplier * TheCamera.GenerationDistMultiplier || bTopDownCamera) { delete pVehicle; return; } @@ -654,13 +676,13 @@ CCarCtrl::GenerateOneRandomCar() int nMadDrivers; switch (pVehicle->GetVehicleAppearance()) { case VEHICLE_APPEARANCE_BIKE: - nMadDrivers = 30; + nMadDrivers = 20; break; case VEHICLE_APPEARANCE_BOAT: nMadDrivers = 40; break; default: - nMadDrivers = 6; + nMadDrivers = 3; break; } if ((CGeneral::GetRandomNumber() & 0x7F) < nMadDrivers || bMadDriversCheat) { @@ -719,12 +741,6 @@ CCarCtrl::GenerateOneRandomCar() } } -bool -CCarCtrl::BoatWithTallMast(int32 mi) -{ - return mi == MI_RIO || mi == MI_TROPIC || mi == MI_MARQUIS; -} - int32 CCarCtrl::ChooseBoatModel(int32 rating) { @@ -944,6 +960,7 @@ CCarCtrl::RemoveCarsIfThePoolGetsFull(void) } } if (pClosestVehicle) { + debug(":::::::::::\'Nearest removed\' cause pools was full -> NumRandomCars %d\n", NumRandomCars); CWorld::Remove(pClosestVehicle); delete pClosestVehicle; } @@ -966,7 +983,10 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle) return; } float distanceToPlayer = (pVehicle->GetPosition() - vecPlayerPos).Magnitude2D(); - float threshold = OFFSCREEN_DESPAWN_RANGE; + float despawnMultiplier = 1.0f; + if (FindPlayerVehicle() && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON && !FrontEndMenuManager.m_PrefsUseWideScreen) + despawnMultiplier = 0.75f; + float threshold = OFFSCREEN_DESPAWN_RANGE * despawnMultiplier; if (pVehicle->GetIsOnScreen() || TheCamera.Cams[TheCamera.ActiveCam].LookingLeft || TheCamera.Cams[TheCamera.ActiveCam].LookingRight || @@ -979,7 +999,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle) pVehicle->bIsCarParkVehicle || CTimer::GetTimeInMilliseconds() < pVehicle->m_nSetPieceExtendedRangeTime ){ - threshold = ONSCREEN_DESPAWN_RANGE * TheCamera.GenerationDistMultiplier; + threshold = ONSCREEN_DESPAWN_RANGE * despawnMultiplier * TheCamera.GenerationDistMultiplier; } if (TheCamera.GetForward().z < -0.9f) threshold = 70.0f; @@ -1572,7 +1592,7 @@ void CCarCtrl::WeaveForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle, float if (pVehicle->AutoPilot.m_nCarMission == MISSION_RAMCAR_CLOSE && pOtherEntity == pVehicle->AutoPilot.m_pTargetCar) return; CVector2D vecDiff = pOtherCar->GetPosition() - pVehicle->GetPosition(); - float angleBetweenVehicles = CGeneral::GetATanOfXY(vecDiff.x, vecDiff.y); + float angleBetweenVehicles = GetATanOfXY(vecDiff.x, vecDiff.y); float distance = vecDiff.Magnitude(); if (distance < 1.0f) return; @@ -1582,7 +1602,7 @@ void CCarCtrl::WeaveForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle, float return; CVector2D forward = pVehicle->GetForward(); forward.Normalise(); - float forwardAngle = CGeneral::GetATanOfXY(forward.x, forward.y); + float forwardAngle = GetATanOfXY(forward.x, forward.y); float angleDiff = angleBetweenVehicles - forwardAngle; float lenProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.y * sin(angleDiff)); float widthProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.x * cos(angleDiff)); @@ -1591,16 +1611,12 @@ void CCarCtrl::WeaveForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle, float diffToLeftAngle = ABS(diffToLeftAngle); float angleToWeave = lengthToEvade / 2; if (diffToLeftAngle < angleToWeave){ - *pAngleToWeaveLeft = angleBetweenVehicles - angleToWeave; - while (*pAngleToWeaveLeft < -PI) - *pAngleToWeaveLeft += TWOPI; + *pAngleToWeaveLeft = LimitRadianAngle(angleBetweenVehicles - angleToWeave); } float diffToRightAngle = LimitRadianAngle(angleBetweenVehicles - *pAngleToWeaveRight); diffToRightAngle = ABS(diffToRightAngle); if (diffToRightAngle < angleToWeave){ - *pAngleToWeaveRight = angleBetweenVehicles + angleToWeave; - while (*pAngleToWeaveRight > PI) - *pAngleToWeaveRight -= TWOPI; + *pAngleToWeaveRight = LimitRadianAngle(angleBetweenVehicles + angleToWeave); } } @@ -1632,23 +1648,19 @@ void CCarCtrl::WeaveForPed(CEntity* pOtherEntity, CVehicle* pVehicle, float* pAn return; CPed* pPed = (CPed*)pOtherEntity; CVector2D vecDiff = pPed->GetPosition() - pVehicle->GetPosition(); - float angleBetweenVehicleAndPed = CGeneral::GetATanOfXY(vecDiff.x, vecDiff.y); + float angleBetweenVehicleAndPed = GetATanOfXY(vecDiff.x, vecDiff.y); float distance = vecDiff.Magnitude(); float lengthToEvade = (WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x + PED_WIDTH_TO_WEAVE) / distance; float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicleAndPed - *pAngleToWeaveLeft); diffToLeftAngle = ABS(diffToLeftAngle); float angleToWeave = lengthToEvade / 2; if (diffToLeftAngle < angleToWeave) { - *pAngleToWeaveLeft = angleBetweenVehicleAndPed - angleToWeave; - while (*pAngleToWeaveLeft < -PI) - *pAngleToWeaveLeft += TWOPI; + *pAngleToWeaveLeft = LimitRadianAngle(angleBetweenVehicleAndPed - angleToWeave); } float diffToRightAngle = LimitRadianAngle(angleBetweenVehicleAndPed - *pAngleToWeaveRight); diffToRightAngle = ABS(diffToRightAngle); if (diffToRightAngle < angleToWeave) { - *pAngleToWeaveRight = angleBetweenVehicleAndPed + angleToWeave; - while (*pAngleToWeaveRight > PI) - *pAngleToWeaveRight -= TWOPI; + *pAngleToWeaveRight = LimitRadianAngle(angleBetweenVehicleAndPed + angleToWeave); } } @@ -1704,23 +1716,19 @@ void CCarCtrl::WeaveForObject(CEntity* pOtherEntity, CVehicle* pVehicle, float* rightCoef * pObject->GetRight() + forwardCoef * pObject->GetForward() - pVehicle->GetPosition(); - float angleBetweenVehicleAndObject = CGeneral::GetATanOfXY(vecDiff.x, vecDiff.y); + float angleBetweenVehicleAndObject = GetATanOfXY(vecDiff.x, vecDiff.y); float distance = vecDiff.Magnitude(); float lengthToEvade = (WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x + OBJECT_WIDTH_TO_WEAVE) / distance; float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicleAndObject - *pAngleToWeaveLeft); diffToLeftAngle = ABS(diffToLeftAngle); float angleToWeave = lengthToEvade / 2; if (diffToLeftAngle < angleToWeave) { - *pAngleToWeaveLeft = angleBetweenVehicleAndObject - angleToWeave; - while (*pAngleToWeaveLeft < -PI) - *pAngleToWeaveLeft += TWOPI; + *pAngleToWeaveLeft = LimitRadianAngle(angleBetweenVehicleAndObject - angleToWeave); } float diffToRightAngle = LimitRadianAngle(angleBetweenVehicleAndObject - *pAngleToWeaveRight); diffToRightAngle = ABS(diffToRightAngle); if (diffToRightAngle < angleToWeave) { - *pAngleToWeaveRight = angleBetweenVehicleAndObject + angleToWeave; - while (*pAngleToWeaveRight > PI) - *pAngleToWeaveRight -= TWOPI; + *pAngleToWeaveRight = LimitRadianAngle(angleBetweenVehicleAndObject + angleToWeave); } } @@ -1762,7 +1770,7 @@ bool CCarCtrl::PickNextNodeAccordingStrategy(CVehicle* pVehicle) void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle) { if (pVehicle->m_nRouteSeed) - CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed); + CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed++); int32 prevNode = pVehicle->AutoPilot.m_nCurrentRouteNode; int32 curNode = pVehicle->AutoPilot.m_nNextRouteNode; uint8 totalLinks = ThePaths.m_pathNodes[curNode].numLinks; @@ -1848,13 +1856,15 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle) pNextPathNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nNextRouteNode]; if ((!pNextPathNode->bDisabled || pPrevPathNode->bDisabled) && (!pNextPathNode->bBetweenLevels || pPrevPathNode->bBetweenLevels || !pVehicle->AutoPilot.m_bStayInCurrentLevel)) - /* Nice way to exit loop but this will fail because this is used for indexing! */ - nextLink = 1000; + break; } } - if (nextLink < 999) + if (nextLink >= totalLinks) { /* If everything else failed, turn vehicle around */ + nextLink = 0; + debug("Couldn\'t find ANYTHING. Just go back from where we came.\n"); pVehicle->AutoPilot.m_nNextRouteNode = prevNode; + } } pNextPathNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nNextRouteNode]; pNextLink = &ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[nextLink + pCurPathNode->firstLink]]; @@ -1967,7 +1977,7 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t #endif { if (pVehicle->m_nRouteSeed) - CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed); + CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed++); int prevNode = pVehicle->AutoPilot.m_nCurrentRouteNode; int curNode = pVehicle->AutoPilot.m_nNextRouteNode; CPathNode* pPrevNode = &ThePaths.m_pathNodes[prevNode]; @@ -1987,7 +1997,7 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t int nextLink; if (numNodes != 1 && numNodes != 2 || pTargetNode[0] == pCurNode){ if (numNodes != 2 || pTargetNode[1] == pCurNode) { - float currentAngle = CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y); + float currentAngle = GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y); nextLink = 0; float lowestAngleChange = 10.0f; int numLinks = pCurNode->numLinks; @@ -1997,7 +2007,7 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t if (conNode == prevNode && i > 1) continue; CPathNode* pTestNode = &ThePaths.m_pathNodes[conNode]; - float angle = CGeneral::GetATanOfXY(pTestNode->GetX() - pCurNode->GetX(), pTestNode->GetY() - pCurNode->GetY()); + float angle = GetATanOfXY(pTestNode->GetX() - pCurNode->GetX(), pTestNode->GetY() - pCurNode->GetY()); angle = LimitRadianAngle(angle - currentAngle); angle = ABS(angle); if (angle < lowestAngleChange) { @@ -2415,6 +2425,16 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe *pHandbrake = true; return; case MISSION_CRUISE: + if (CTrafficLights::ShouldCarStopForBridge(pVehicle)) { + *pAccel = 0.0f; + *pBrake = 1.0f; + *pHandbrake = true; +#ifdef FIX_BUGS + *pSwerve = 0.0f; +#endif + break; + } + // fallthough case MISSION_RAMPLAYER_FARAWAY: case MISSION_BLOCKPLAYER_FARAWAY: case MISSION_GOTOCOORDS: @@ -2485,11 +2505,19 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe *pHandbrake = false; return; case MISSION_RAMCAR_CLOSE: + if (!pVehicle->AutoPilot.m_pTargetCar) { + debug("NO TARGET VEHICLE FOR MISSION_RAMCAR_CLOSE\n"); + return; + } SteerAICarWithPhysicsHeadingForTarget(pVehicle, pVehicle->AutoPilot.m_pTargetCar, pVehicle->AutoPilot.m_pTargetCar->GetPosition().x, pVehicle->AutoPilot.m_pTargetCar->GetPosition().y, pSwerve, pAccel, pBrake, pHandbrake); return; case MISSION_BLOCKCAR_CLOSE: + if (!pVehicle->AutoPilot.m_pTargetCar) { + debug("NO TARGET VEHICLE FOR MISSION_BLOCKCAR_CLOSE\n"); + return; + } SteerAICarWithPhysicsTryingToBlockTarget(pVehicle, pVehicle->AutoPilot.m_pTargetCar->GetPosition().x, pVehicle->AutoPilot.m_pTargetCar->GetPosition().y, @@ -2498,6 +2526,9 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe pSwerve, pAccel, pBrake, pHandbrake); return; case MISSION_BLOCKCAR_HANDBRAKESTOP: + if (!pVehicle->AutoPilot.m_pTargetCar) { + return; + } SteerAICarWithPhysicsTryingToBlockTarget_Stop(pVehicle, pVehicle->AutoPilot.m_pTargetCar->GetPosition().x, pVehicle->AutoPilot.m_pTargetCar->GetPosition().y, @@ -2575,8 +2606,8 @@ void CCarCtrl::SteerAIBoatWithPhysicsHeadingForTarget(CVehicle* pVehicle, float { CVector2D forward = pVehicle->GetForward(); forward.Normalise(); - float angleToTarget = CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y); - float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y); + float angleToTarget = GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y); + float angleForward = GetATanOfXY(forward.x, forward.y); float steerAngle = LimitRadianAngle(angleToTarget - angleForward); steerAngle = clamp(steerAngle, -DEFAULT_MAX_STEER_ANGLE, DEFAULT_MAX_STEER_ANGLE); #ifdef FIX_BUGS @@ -2607,8 +2638,8 @@ void CCarCtrl::SteerAIBoatWithPhysicsAttackingPlayer(CVehicle* pVehicle, float* CVector2D forward = pVehicle->GetForward(); forward.Normalise(); CVector2D vecToProjection = FindPlayerCoors() + FindPlayerSpeed() * projection * GAME_SPEED_TO_CARAI_SPEED; - float angleToTarget = CGeneral::GetATanOfXY(vecToProjection.x - pVehicle->GetPosition().x, vecToProjection.y - pVehicle->GetPosition().y); - float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y); + float angleToTarget = GetATanOfXY(vecToProjection.x - pVehicle->GetPosition().x, vecToProjection.y - pVehicle->GetPosition().y); + float angleForward = GetATanOfXY(forward.x, forward.y); float steerAngle = LimitRadianAngle(angleToTarget - angleForward); #ifdef FIX_BUGS float speedTarget = pVehicle->AutoPilot.GetCruiseSpeed(); @@ -2696,7 +2727,7 @@ void CCarCtrl::SteerAIHeliTowardsTargetCoors(CAutomobile* pHeli) if (distanceToTarget < 8.0f && pHeli->m_fHeliOrientation < 0.0f) ZTurnSpeedTarget = 0.0f; else { - float fAngleTarget = CGeneral::GetATanOfXY(vecToTarget.x, vecToTarget.y) + PI; + float fAngleTarget = GetATanOfXY(vecToTarget.x, vecToTarget.y) + PI; if (pHeli->m_fHeliOrientation >= 0.0f) fAngleTarget = pHeli->m_fHeliOrientation; fAngleTarget -= pHeli->m_fOrientation; @@ -2739,7 +2770,7 @@ void CCarCtrl::SteerAIPlaneTowardsTargetCoors(CAutomobile* pPlane) CVector2D vecToTarget = pPlane->AutoPilot.m_vecDestinationCoors - pPlane->GetPosition(); float fForwardZ = (pPlane->AutoPilot.m_vecDestinationCoors.z - pPlane->GetPosition().z) / vecToTarget.Magnitude(); fForwardZ = clamp(fForwardZ, -0.3f, 0.3f); - float angle = CGeneral::GetATanOfXY(vecToTarget.x, vecToTarget.y); + float angle = GetATanOfXY(vecToTarget.x, vecToTarget.y); while (angle > TWOPI) angle -= TWOPI; float difference = LimitRadianAngle(angle - pPlane->m_fOrientation); @@ -2836,8 +2867,8 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv projectedPosition.y = positionOnCurrentLinkIncludingLane.y; } CVector2D distanceToProjectedPosition = projectedPosition - pVehicle->GetPosition(); - float angleCurrentLink = CGeneral::GetATanOfXY(distanceToProjectedPosition.x, distanceToProjectedPosition.y); - float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y); + float angleCurrentLink = GetATanOfXY(distanceToProjectedPosition.x, distanceToProjectedPosition.y); + float angleForward = GetATanOfXY(forward.x, forward.y); if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_AVOID_CARS) angleCurrentLink = FindAngleToWeaveThroughTraffic(pVehicle, nil, angleCurrentLink, angleForward); float steerAngle = LimitRadianAngle(angleCurrentLink - angleForward); @@ -2882,11 +2913,11 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv pCurrentLink->GetY() - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x); trajectory -= pVehicle->GetPosition(); float speedAngleMultiplier = FindSpeedMultiplier( - CGeneral::GetATanOfXY(trajectory.x, trajectory.y) - angleForward, + GetATanOfXY(trajectory.x, trajectory.y) - angleForward, MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT); float tmpWideMultiplier = FindSpeedMultiplier( - CGeneral::GetATanOfXY(currentPathLinkForward.x, currentPathLinkForward.y) - - CGeneral::GetATanOfXY(nextPathLinkForwardX, nextPathLinkForwardY), + GetATanOfXY(currentPathLinkForward.x, currentPathLinkForward.y) - + GetATanOfXY(nextPathLinkForwardX, nextPathLinkForwardY), MIN_ANGLE_FOR_SPEED_LIMITING_BETWEEN_NODES, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT); float speedNodesMultiplier; if (scalarDistanceToNextNode > DISTANCE_TO_NEXT_NODE_TO_CONSIDER_SLOWING_DOWN || pVehicle->AutoPilot.m_nCruiseSpeed < 12) @@ -2920,8 +2951,8 @@ void CCarCtrl::SteerAICarWithPhysicsHeadingForTarget(CVehicle* pVehicle, CPhysic *pHandbrake = false; CVector2D forward = pVehicle->GetForward(); forward.Normalise(); - float angleToTarget = CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y); - float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y); + float angleToTarget = GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y); + float angleForward = GetATanOfXY(forward.x, forward.y); if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_AVOID_CARS) angleToTarget = FindAngleToWeaveThroughTraffic(pVehicle, pTarget, angleToTarget, angleForward); float steerAngle = LimitRadianAngle(angleToTarget - angleForward); @@ -2930,7 +2961,7 @@ void CCarCtrl::SteerAICarWithPhysicsHeadingForTarget(CVehicle* pVehicle, CPhysic *pHandbrake = true; float maxAngle = FindMaxSteerAngle(pVehicle); steerAngle = Min(maxAngle, Max(-maxAngle, steerAngle)); - float speedMultiplier = FindSpeedMultiplier(angleToTarget - angleForward, + float speedMultiplier = FindSpeedMultiplier(CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y) - angleForward, MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT); float speedTarget = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier; float currentSpeed = pVehicle->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_CARAI_SPEED; @@ -3127,7 +3158,7 @@ bool CCarCtrl::JoinCarWithRoadSystemGotoCoors(CVehicle* pVehicle, CVector vecTar void CCarCtrl::FindLinksToGoWithTheseNodes(CVehicle* pVehicle) { if (pVehicle->m_nRouteSeed) - CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed); + CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed++); int nextLink; CPathNode* pCurNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nCurrentRouteNode]; for (nextLink = 0; nextLink < 12; nextLink++) @@ -3169,10 +3200,12 @@ void CCarCtrl::GenerateEmergencyServicesCar(void) return; if (CGame::IsInInterior()) return; + if (TheCamera.m_WideScreenOn) // TODO(LCS): verify + return; if (NumFiretrucksOnDuty + NumAmbulancesOnDuty + NumParkedCars + NumMissionCars + NumLawEnforcerCars + NumRandomCars > MaxNumberOfCarsInUse) return; - if (NumAmbulancesOnDuty == 0){ + if (NumAmbulancesOnDuty == 0 /* TODO(LCS): && gbEmergencyVehiclesEnabled */){ if (gAccidentManager.CountActiveAccidents() < 2){ if (CStreaming::HasModelLoaded(MI_AMBULAN)) CStreaming::SetModelIsDeletable(MI_MEDIC); @@ -3191,7 +3224,7 @@ void CCarCtrl::GenerateEmergencyServicesCar(void) } } } - if (NumFiretrucksOnDuty == 0){ + if (NumFiretrucksOnDuty == 0 /* TODO(LCS): && gbEmergencyVehiclesEnabled */){ if (gFireManager.GetTotalActiveFires() < 3){ if (CStreaming::HasModelLoaded(MI_FIRETRUCK)) CStreaming::SetModelIsDeletable(MI_FIREMAN); @@ -3348,6 +3381,17 @@ bool CCarCtrl::MapCouldMoveInThisArea(float x, float y) #endif } +bool +CCarCtrl::BoatWithTallMast(int32 mi) +{ + return mi == MI_RIO || mi == MI_TROPIC || mi == MI_MARQUIS; +} + +bool CCarCtrl::OkToCreateVehicleAtThisPosition(const CVector& pos) +{ + return true; +} + float CCarCtrl::FindSpeedMultiplierWithSpeedFromNodes(int8 type) { switch (type) @@ -3357,3 +3401,8 @@ float CCarCtrl::FindSpeedMultiplierWithSpeedFromNodes(int8 type) } return 1.0f; } + +void CCarCtrl::RenderDebugInfo(CVehicle*) +{ + //TODO(LCS) +} diff --git a/src/control/CarCtrl.h b/src/control/CarCtrl.h index 5efbe275..fcb7929b 100644 --- a/src/control/CarCtrl.h +++ b/src/control/CarCtrl.h @@ -1,6 +1,7 @@ #pragma once #include "PathFind.h" #include "Boat.h" +#include "General.h" #include "Vehicle.h" #define GAME_SPEED_TO_METERS_PER_SECOND 50.0f @@ -130,6 +131,10 @@ public: static void SteerAIBoatWithPhysicsAttackingPlayer(CVehicle*, float*, float*, float*, bool*); static void SteerAICarBlockingPlayerForwardAndBack(CVehicle*, float*, float*, float*, bool*); + static bool OkToCreateVehicleAtThisPosition(const CVector&); + static void RenderDebugInfo(CVehicle*); + static float GetATanOfXY(float x, float y) { float t = CGeneral::GetATanOfXY(x, y); if (t < 0.0f) t += TWOPI; return t; } + static float GetPositionAlongCurrentCurve(CVehicle* pVehicle) { uint32 timeInCurve = CTimer::GetTimeInMilliseconds() - pVehicle->AutoPilot.m_nTimeEnteredCurve; @@ -138,11 +143,7 @@ public: static float LimitRadianAngle(float angle) { - while (angle < -PI) - angle += TWOPI; - while (angle > PI) - angle -= TWOPI; - return angle; + return CGeneral::LimitRadianAngle(angle); } static bool bMadDriversCheat; diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 89377db5..f083ecb5 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -1494,9 +1494,9 @@ void CGarage::BuildRotatedDoorMatrix(CEntity * pDoor, float fPosition) void CGarage::UpdateCrusherAngle() { RefreshDoorPointers(false); - m_pDoor2->GetMatrix().SetRotateXOnly(TWOPI - m_fDoorPos); - m_pDoor2->GetMatrix().UpdateRW(); - m_pDoor2->UpdateRwFrame(); + //m_pDoor2->GetMatrix().SetRotateXOnly(TWOPI - m_fDoorPos); TODO + //m_pDoor2->GetMatrix().UpdateRW(); + //m_pDoor2->UpdateRwFrame(); } void CGarage::UpdateCrusherShake(float X, float Y) diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 3470e475..5186a8d2 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -1186,7 +1186,9 @@ CPickups::DoPickUpEffects(CEntity *entity) CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, - 0.0f); + 0.0f, + false, + -0.5f); } } @@ -1253,7 +1255,7 @@ CPickups::DoCollectableEffects(CEntity *entity) int32 color = (MAXDIST - dist) * (0.5f * s + 0.5f) / MAXDIST * 255.0f; CShadows::StoreStaticShadow((uintptr)entity, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, 2.0f, 0.0f, 0.0f, -2.0f, 0, color, color, color, 4.0f, 1.0f, 40.0f, false, 0.0f); - CCoronas::RegisterCorona((uintptr)entity, color, color, color, 255, pos, 0.6f, 40.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); + CCoronas::RegisterCorona((uintptr)entity, color, color, color, 255, pos, 0.6f, 40.0f, CCoronas::TYPE_HEX, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); } entity->GetMatrix().SetRotateZOnly((float)(CTimer::GetTimeInMilliseconds() & 0xFFF) * DEGTORAD(360.0f / 0x1000)); diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp index 20f09cb4..c793e027 100644 --- a/src/control/SceneEdit.cpp +++ b/src/control/SceneEdit.cpp @@ -331,7 +331,7 @@ void CSceneEdit::Draw(void) #ifdef FIX_BUGS CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(COMMAND_NAME_Y + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr); #else - CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr); + CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT, wstr); #endif if (nCommandDrawn == m_nCurrentCommand) CFont::SetColor(CRGBA(156, 91, 40, 255)); @@ -340,7 +340,7 @@ void CSceneEdit::Draw(void) #ifdef FIX_BUGS CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT), SCREEN_SCALE_Y(COMMAND_NAME_Y + i * COMMAND_NAME_HEIGHT), wstr); #else - CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT), wstr); + CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT, wstr); #endif } } diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 735c2c6f..038eff6d 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -49,18 +49,20 @@ #include "Timecycle.h" #include "TxdStore.h" #include "Bike.h" +#include "memoryManager.h" #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT #include <stdarg.h> #endif -//--MIAMI: file done +//--LCS: file done except TODOs and command table -uint8 CTheScripts::ScriptSpace[SIZE_SCRIPT_SPACE]; +uint8* CTheScripts::ScriptSpace; CRunningScript CTheScripts::ScriptsArray[MAX_NUM_SCRIPTS]; intro_text_line CTheScripts::IntroTextLines[MAX_NUM_INTRO_TEXT_LINES]; intro_script_rectangle CTheScripts::IntroRectangles[MAX_NUM_INTRO_RECTANGLES]; CSprite2d CTheScripts::ScriptSprites[MAX_NUM_SCRIPT_SRPITES]; script_sphere_struct CTheScripts::ScriptSphereArray[MAX_NUM_SCRIPT_SPHERES]; +tCollectiveData CTheScripts::CollectiveArray[MAX_NUM_COLLECTIVES]; tUsedObject CTheScripts::UsedObjectArray[MAX_NUM_USED_OBJECTS]; int32 CTheScripts::MultiScriptArray[MAX_NUM_MISSION_SCRIPTS]; tBuildingSwap CTheScripts::BuildingSwapArray[MAX_NUM_BUILDING_SWAPS]; @@ -96,10 +98,16 @@ uint32 CTheScripts::LastMissionPassedTime; uint16 CTheScripts::NumberOfExclusiveMissionScripts; bool CTheScripts::bPlayerHasMetDebbieHarry; bool CTheScripts::bPlayerIsInTheStatium; -#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) -int16 CTheScripts::CardStack[CARDS_IN_DECK * MAX_DECKS]; -int16 CTheScripts::CardStackPosition; -#endif +int CTheScripts::AllowedCollision[MAX_ALLOWED_COLLISIONS]; +bool CTheScripts::FSDestroyedFlag; +short* CTheScripts::SavedVarIndices; +int CTheScripts::NumSaveVars; +int gScriptsFile = -1; +int CTheScripts::NextProcessId = 1; +bool CTheScripts::InTheScripts; +CRunningScript* pCurrent; +uint16 CTheScripts::NumTrueGlobals; +uint16 CTheScripts::MostGlobals; #ifdef MISSION_REPLAY @@ -225,7 +233,7 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_GOSUB, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_RETURN, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_LINE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_CREATE_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CREATE_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), REGISTER_COMMAND(COMMAND_GET_PLAYER_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""), REGISTER_COMMAND(COMMAND_SET_PLAYER_COORDINATES, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_IS_PLAYER_IN_AREA_2D, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_BOOL,), OUTPUT_ARGUMENTS(), true, -1, ""), @@ -284,16 +292,16 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_SET_LVAR_INT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="), REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), - REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), - REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"), REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), - REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), - REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"), - REGISTER_COMMAND(COMMAND_ABS_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), - REGISTER_COMMAND(COMMAND_ABS_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), - REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), - REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), + REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"), + REGISTER_COMMAND(COMMAND_ABS_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), + REGISTER_COMMAND(COMMAND_ABS_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), + REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), + REGISTER_COMMAND(COMMAND_ABS_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"), REGISTER_COMMAND(COMMAND_GENERATE_RANDOM_FLOAT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT,), false, -1, ""), REGISTER_COMMAND(COMMAND_GENERATE_RANDOM_INT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT,), false, -1, ""), REGISTER_COMMAND(COMMAND_CREATE_CHAR, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(ARGTYPE_PED_HANDLE,), false, -1, ""), @@ -356,6 +364,11 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_WHILE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_WHILENOT, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_ENDWHILE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_214, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_215, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_216, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_217, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_218, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_ANDOR, INPUT_ARGUMENTS(ARGTYPE_ANDOR,), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_LAUNCH_MISSION, INPUT_ARGUMENTS(ARGTYPE_LABEL,), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_MISSION_HAS_FINISHED, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), @@ -922,8 +935,8 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_PRINT_WITH_6_NUMBERS_NOW, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_PRINT_WITH_6_NUMBERS_SOON, INPUT_ARGUMENTS(ARGTYPE_STRING, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_SET_CHAR_OBJ_FOLLOW_CHAR_IN_FORMATION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_PLAYER_MADE_PROGRESS, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_SET_PROGRESS_TOTAL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_PLAYER_MADE_PROGRESS, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_PROGRESS_TOTAL, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_REGISTER_JUMP_DISTANCE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_REGISTER_JUMP_HEIGHT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_REGISTER_JUMP_FLIPS, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), @@ -1578,39 +1591,222 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_REGISTER_FIRE_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_IS_AUSTRALIAN_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), REGISTER_COMMAND(COMMAND_DISARM_CAR_BOMB, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), -#if (defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT) REGISTER_COMMAND(COMMAND_IS_JAPANESE_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), -#elif (!defined GTA_PS2) - REGISTER_COMMAND(COMMAND_SET_ONSCREEN_COUNTER_FLASH_WHEN_FIRST_DISPLAYED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), -#endif -#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) - REGISTER_COMMAND(COMMAND_SHUFFLE_CARD_DECKS, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_FETCH_NEXT_CARD, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""), - REGISTER_COMMAND(COMMAND_GET_OBJECT_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), false, -1, ""), - REGISTER_COMMAND(COMMAND_IS_DEBUG_CAMERA_ON, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), - REGISTER_COMMAND(COMMAND_ADD_TO_OBJECT_ROTATION_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_SET_OBJECT_ROTATION_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_IS_OBJECT_STATIC, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""), - REGISTER_COMMAND(COMMAND_GET_ANGLE_BETWEEN_2D_VECTORS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ), false, -1, ""), - REGISTER_COMMAND(COMMAND_DO_2D_RECTANGLES_COLLIDE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), true, -1, ""), - REGISTER_COMMAND(COMMAND_GET_OBJECT_ROTATION_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), false, -1, ""), - REGISTER_COMMAND(COMMAND_ADD_VELOCITY_RELATIVE_TO_OBJECT_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_GET_OBJECT_SPEED, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ), false, -1, ""), -#endif -#if (defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT) - REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_START, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_END, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_CUTSCENE_SCROLL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), -#elif (defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) - REGISTER_COMMAND(COMMAND_IS_MISSION_SKIP, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""), - REGISTER_COMMAND(COMMAND_SET_IN_AMMUNATION, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_DO_SAVE_GAME, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_IS_RETRY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""), - REGISTER_COMMAND(COMMAND_DUMMY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_START, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_END, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_CUTSCENE_SCROLL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), -#endif + REGISTER_COMMAND(COMMAND_1442, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1443, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1444, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1445, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1446, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1447, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1448, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1449, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1450, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1451, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1452, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1453, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_CALL, INPUT_ARGUMENTS(ARGTYPE_FUNCTION, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_NOTCALL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1456, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1457, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1458, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1459, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1460, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1461, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1462, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1463, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1464, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1465, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1466, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1467, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1468, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1469, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1470, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1471, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1472, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1473, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1474, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1475, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1476, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1477, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1478, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1479, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1480, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1481, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1482, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1483, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1484, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1485, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1486, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1487, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1488, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1489, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1490, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1491, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1492, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1493, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1494, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1495, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1496, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1497, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1498, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1499, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1500, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1501, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1502, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1503, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1504, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1505, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1506, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1507, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1508, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1509, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1510, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1511, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1512, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1513, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1514, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1515, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1516, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1517, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1518, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1519, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1520, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1521, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1522, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1523, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1524, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1525, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1526, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1527, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1528, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1529, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1530, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1531, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1532, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1533, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1534, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1535, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1536, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1537, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1538, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1539, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1540, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1541, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1542, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1543, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1544, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1545, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1546, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1547, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1548, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1549, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1550, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1551, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1552, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1553, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1554, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1555, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1556, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1557, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1558, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1559, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1560, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_1561, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1562, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1563, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1564, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1565, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1566, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1567, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1568, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1569, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), + REGISTER_COMMAND(COMMAND_1570, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1571, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1572, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1573, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1574, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1575, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1576, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1577, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1578, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1579, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1580, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1581, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1582, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1583, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1584, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1585, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1586, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1587, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1588, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1589, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1590, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1591, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1592, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1593, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1594, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1595, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1596, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1597, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1598, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1599, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1600, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1601, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1602, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1603, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1604, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1605, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1606, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1607, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1608, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1609, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1610, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1611, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1612, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1613, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1614, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1615, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1616, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1617, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1618, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1619, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1620, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1621, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1622, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1623, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1624, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1625, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1626, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1627, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1628, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1629, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1630, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1631, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1632, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1633, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1634, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1635, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1636, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1637, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1638, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1639, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1640, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1641, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1642, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1643, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1644, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1645, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1646, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1647, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1648, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1649, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1650, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1651, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1652, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1653, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1654, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1655, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_1656, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), }; #undef REGISTER_COMMAND #undef INPUT_ARGUMENTS @@ -1683,6 +1879,23 @@ cleanup_entity_struct* CMissionCleanup::FindFree() return nil; } +void SleepThisPed(cleanup_entity_struct* pCleanup, CPed* pPed) +{ + printf("*** SLEEPING PED %i %i\n", pCleanup->id, pPed->GetModelIndex()); + if (!pPed->GetIsStatic()) + pPed->RemoveFromMovingList(); + pPed->bIsStaticWaitingForCollision = true; +} + +void WakeThisPed(cleanup_entity_struct* pCleanup, CPed* pPed) +{ + printf("*** WAKING UP PED %i %i\n", pCleanup->id, pPed->GetModelIndex()); + pPed->bIsStaticWaitingForCollision = false; + if (!pPed->bIsStatic) + pPed->AddToMovingList(); + +} + void CMissionCleanup::AddEntityToList(int32 id, uint8 type) { cleanup_entity_struct* pNew = FindFree(); @@ -1752,46 +1965,100 @@ void CMissionCleanup::CheckIfCollisionHasLoadedForMissionObjects() { CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(m_sEntities[i].id); if (pVehicle) { - if (pVehicle->bIsStaticWaitingForCollision) { - if (CColStore::HasCollisionLoaded(pVehicle->GetPosition())) { - pVehicle->bIsStaticWaitingForCollision = false; + eLevelName level = CTheZones::GetLevelFromPosition(&pVehicle->GetPosition()); + if (level == LEVEL_GENERIC) + level = CGame::currLevel; + if (!CColStore::HasCollisionLoaded(level)) { + if (!pVehicle->bIsStaticWaitingForCollision) { + if (!pVehicle->IsHeli() && !pVehicle->IsPlane() && pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI && + pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT && pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE) { + printf("*** SLEEPING VEHICLE %i %i\n", m_sEntities[i].id, pVehicle->GetModelIndex()); if (!pVehicle->GetIsStatic()) - pVehicle->AddToMovingList(); + pVehicle->RemoveFromMovingList(); + pVehicle->bIsStaticWaitingForCollision = true; + } } } - } - break; - } - case CLEANUP_CHAR: - { - CPed* pPed = CPools::GetPedPool()->GetAt(m_sEntities[i].id); - if (pPed) { - if (pPed->bIsStaticWaitingForCollision) { - if (CColStore::HasCollisionLoaded(pPed->GetPosition())) { - pPed->bIsStaticWaitingForCollision = false; - if (!pPed->GetIsStatic()) - pPed->AddToMovingList(); + else { + if (pVehicle->bIsStaticWaitingForCollision) { + printf("*** WAKING UP VEHICLE %i %i\n", m_sEntities[i].id, pVehicle->GetModelIndex()); + pVehicle->bIsStaticWaitingForCollision = false; + if (!pVehicle->bIsStatic) + pVehicle->AddToMovingList(); } } } - break; } + break; case CLEANUP_OBJECT: - { CObject* pObject = CPools::GetObjectPool()->GetAt(m_sEntities[i].id); if (pObject) { - if (pObject->bIsStaticWaitingForCollision) { - if (CColStore::HasCollisionLoaded(pObject->GetPosition())) { - pObject->bIsStaticWaitingForCollision = false; + eLevelName level = CTheZones::GetLevelFromPosition(&pObject->GetPosition()); + if (level == LEVEL_GENERIC) + level = CGame::currLevel; + if (!CColStore::HasCollisionLoaded(level)) { + if (!pObject->bIsStaticWaitingForCollision) { if (!pObject->GetIsStatic()) + pObject->RemoveFromMovingList(); + pObject->bIsStaticWaitingForCollision = true; + } + } + else { + if (pObject->bIsStaticWaitingForCollision) { + pObject->bIsStaticWaitingForCollision = false; + if (!pObject->bIsStatic) pObject->AddToMovingList(); } } } - break; } - default: - break; + } + for (int i = 0; i < MAX_CLEANUP; i++) { + switch (m_sEntities[i].type) { + case CLEANUP_CHAR: + { + CPed* pPed = CPools::GetPedPool()->GetAt(m_sEntities[i].id); + if (pPed) { + eLevelName level = CTheZones::GetLevelFromPosition(&pPed->GetPosition()); + if (level == LEVEL_GENERIC) + level = CGame::currLevel; + if (!pPed->bIsStaticWaitingForCollision) { + if (pPed->bInVehicle) { + if (pPed->m_pMyVehicle->GetIsStatic()) { + SleepThisPed(&m_sEntities[i], pPed); + continue; + } + } + if (!CColStore::HasCollisionLoaded(level)) { + if (pPed->bInVehicle && pPed->m_pMyVehicle->GetIsStatic() || + pPed->m_attachedTo && pPed->m_attachedTo->GetIsStatic()) + SleepThisPed(&m_sEntities[i], pPed); + } + } + else { + if (!pPed->bInVehicle) { + if (CColStore::HasCollisionLoaded(level)) { + if (!(pPed->bInVehicle && pPed->m_pMyVehicle->GetIsStatic() || + pPed->m_attachedTo && pPed->m_attachedTo->GetIsStatic())) + WakeThisPed(&m_sEntities[i], pPed); + } + } + else { + if (!pPed->m_pMyVehicle->GetIsStatic()) { + WakeThisPed(&m_sEntities[i], pPed); + continue; + } + if (CColStore::HasCollisionLoaded(level)) { + if (!(pPed->bInVehicle && pPed->m_pMyVehicle->GetIsStatic() || + pPed->m_attachedTo && pPed->m_attachedTo->GetIsStatic())) + WakeThisPed(&m_sEntities[i], pPed); + } + } + } + + } + } + break; } } } @@ -1803,6 +2070,8 @@ void CMissionCleanup::Process() CCarCtrl::CarDensityMultiplier = 1.0f; CPed::nThreatReactionRangeMultiplier = 1; CPed::nEnterCarRangeMultiplier = 1; + for (int i = 0; i < MAX_ALLOWED_COLLISIONS; i++) + CTheScripts::AllowedCollision[i] = 0; FindPlayerPed()->m_pWanted->m_fCrimeSensitivity = 1.0f; CRoadBlocks::ClearScriptRoadBlocks(); CRouteNode::Initialise(); @@ -1810,20 +2079,19 @@ void CMissionCleanup::Process() TheCamera.Restore(); TheCamera.SetWideScreenOff(); CSpecialFX::bLiftCam = false; - CSpecialFX::bVideoCam = false; - CTimeCycle::StopExtraColour(0); + // TODO(LCS): CHud::m_ClockEventWarningMinutes = 0; + // TODO(LCS): CHud::m_ClockEventFlashTimer = 0; + CTimeCycle::StopExtraColour(0); // TODO: thiscall for (int i = 0; i < MISSION_AUDIO_SLOTS; i++) DMAudio.ClearMissionAudio(i); CWeather::ReleaseWeather(); for (int i = 0; i < NUM_OF_SPECIAL_CHARS; i++) CStreaming::SetMissionDoesntRequireSpecialChar(i); - for (int i = 0; i < NUM_OF_CUTSCENE_OBJECTS; i++) - CStreaming::SetMissionDoesntRequireModel(MI_CUTOBJ01 + i); CStreaming::ms_disableStreaming = false; - CHud::m_ItemToFlash = -1; - CHud::SetHelpMessage(nil, false); + if (CHud::m_ItemToFlash != ITEM_ARMOUR && CHud::m_ItemToFlash != ITEM_HEALTH) + CHud::m_ItemToFlash = -1; + CHud::SetHelpMessage(nil, false); // nil, false, false, true TODO(LCS) CUserDisplay::OnscnTimer.m_bDisabled = false; - CTheScripts::RemoveScriptTextureDictionary(); CWorld::Players[0].m_pPed->m_pWanted->m_bIgnoredByCops = false; CWorld::Players[0].m_pPed->m_pWanted->m_bIgnoredByEveryone = false; CWorld::Players[0].MakePlayerSafe(false); @@ -1831,10 +2099,11 @@ void CMissionCleanup::Process() CWorld::Players[0].m_pPed->m_nDrunkCountdown = 0; CPad::GetPad(0)->SetDrunkInputDelay(0); CWorld::Players[0].m_bDriveByAllowed = true; + CPad::GetPad(0)->unk_B4 = 1.0f; + CPad::GetPad(0)->unk_B8 = 0.5f; DMAudio.ShutUpPlayerTalking(0); CVehicle::bDisableRemoteDetonation = false; CVehicle::bDisableRemoteDetonationOnContact = false; - CGameLogic::ClearShortCut(); CTheScripts::RiotIntensity = 0; CTheScripts::StoreVehicleIndex = -1; CTheScripts::StoreVehicleWasRandom = true; @@ -1872,6 +2141,10 @@ void CMissionCleanup::Process() m_sEntities[i].type = CLEANUP_UNUSED; m_nCount--; } + for (int i = 1; i < NUMSTREAMINFO; i++) { + if (CStreaming::IsScriptOwnedModel(i)) + CStreaming::SetMissionDoesntRequireModel(i); + } } /* NB: CUpsideDownCarCheck is not used by actual script at all @@ -1894,7 +2167,7 @@ bool CUpsideDownCarCheck::IsCarUpsideDown(int32 id) bool CUpsideDownCarCheck::IsCarUpsideDown(CVehicle* pVehicle) { - assert(pVehicle); + script_assert(pVehicle); return pVehicle->GetUp().z <= UPSIDEDOWN_UP_THRESHOLD && pVehicle->GetMoveSpeed().Magnitude() < UPSIDEDOWN_MOVE_SPEED_THRESHOLD && pVehicle->GetTurnSpeed().Magnitude() < UPSIDEDOWN_TURN_SPEED_THRESHOLD; @@ -2033,109 +2306,157 @@ bool CStuckCarCheck::HasCarBeenStuckForAWhile(int32 id) return false; } -void CRunningScript::CollectParameters(uint32* pIp, int16 total) +void CRunningScript::CollectParameters(uint32* pIp, int16 total, int* pParameters) { - for (int16 i = 0; i < total; i++){ - uint16 varIndex; + while (total--){ switch (CTheScripts::Read1ByteFromScript(pIp)) { - case ARGUMENT_INT32: - case ARGUMENT_FLOAT: - ScriptParams[i] = CTheScripts::Read4BytesFromScript(pIp); + case ARGUMENT_END: + return; + case ARGUMENT_INT_ZERO: + *pParameters = 0; + break; + case ARGUMENT_FLOAT_ZERO: + *pParameters = 0; + break; + case ARGUMENT_FLOAT_1BYTE: + *pParameters = (uint32)(uint8)CTheScripts::Read1ByteFromScript(pIp) << 24; break; - case ARGUMENT_GLOBALVAR: - varIndex = CTheScripts::Read2BytesFromScript(pIp); - script_assert(varIndex >= 8 && varIndex < CTheScripts::GetSizeOfVariableSpace()); - ScriptParams[i] = *((int32*)&CTheScripts::ScriptSpace[varIndex]); + case ARGUMENT_FLOAT_2BYTES: + *pParameters = (uint32)(uint16)CTheScripts::Read2BytesFromScript(pIp) << 16; break; - case ARGUMENT_LOCALVAR: - varIndex = CTheScripts::Read2BytesFromScript(pIp); - script_assert(varIndex >= 0 && varIndex < ARRAY_SIZE(m_anLocalVariables)); - ScriptParams[i] = m_anLocalVariables[varIndex]; + case ARGUMENT_FLOAT_3BYTES: + *pParameters = (uint32)(uint8)CTheScripts::Read1ByteFromScript(pIp) << 8; + *pParameters |= (uint32)(uint16)CTheScripts::Read2BytesFromScript(pIp) << 16; + break; + case ARGUMENT_INT32: + case ARGUMENT_FLOAT: + *pParameters = CTheScripts::Read4BytesFromScript(pIp); break; case ARGUMENT_INT8: - ScriptParams[i] = CTheScripts::Read1ByteFromScript(pIp); + *pParameters = CTheScripts::Read1ByteFromScript(pIp); break; case ARGUMENT_INT16: - ScriptParams[i] = CTheScripts::Read2BytesFromScript(pIp); + *pParameters = CTheScripts::Read2BytesFromScript(pIp); break; default: - script_assert(0); + *pIp -= 1; + *pParameters = *GetPointerToScriptVariable(pIp, 0); break; } + pParameters++; } } #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT -int CRunningScript::CollectParameterForDebug(char* buf, bool& var) +int32* GetPointerToScriptVariableForDebug(CRunningScript* pScript, uint32* pIp, char* buf) { - uint16 varIndex; char tmpstr[24]; + uint8 type = CTheScripts::Read1ByteFromScript(pIp); + if (type >= ARGUMENT_GLOBAL_ARRAY) { + uint8 index_in_block = CTheScripts::Read1ByteFromScript(pIp); + uint8 index_id = CTheScripts::Read1ByteFromScript(pIp); + uint8 size = CTheScripts::Read1ByteFromScript(pIp); + script_assert(size > 0); + script_assert(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id] < size); + uint8 index = Min(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id], size - 1); + sprintf(tmpstr, " $%d[%d@ (%d)]", ((int)(type - ARGUMENT_GLOBAL_ARRAY) << 8) + index_in_block, index_id, pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id]); + strcat(buf, tmpstr); + return (int32*)&CTheScripts::ScriptSpace[4 * (((int)(type - ARGUMENT_GLOBAL_ARRAY) << 8) + index + index_in_block)]; + } + else if (type >= ARGUMENT_GLOBAL) { + uint8 index_in_block = CTheScripts::Read1ByteFromScript(pIp); + sprintf(tmpstr, " $%d", ((int)(type - ARGUMENT_GLOBAL) << 8) + index_in_block); + strcat(buf, tmpstr); + return (int32*)&CTheScripts::ScriptSpace[4 * (((int)(type - ARGUMENT_GLOBAL) << 8) + index_in_block)]; + } + else if (type >= ARGUMENT_LOCAL_ARRAY) { + uint8 index_id = CTheScripts::Read1ByteFromScript(pIp); + uint8 size = CTheScripts::Read1ByteFromScript(pIp); + script_assert(size > 0); + script_assert(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id] < size); + uint8 index = Min(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id], size - 1); + sprintf(tmpstr, " %d@[%d@ (%d)]", (type - ARGUMENT_LOCAL_ARRAY), index_id, pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id]); + strcat(buf, tmpstr); + return &pScript->m_anLocalVariables[pScript->m_nLocalsPointer + (type - ARGUMENT_LOCAL_ARRAY) + index]; + } + else if (type >= ARGUMENT_LOCAL) { + sprintf(tmpstr, " %d@", (type - ARGUMENT_LOCAL)); + strcat(buf, tmpstr); + return &pScript->m_anLocalVariables[pScript->m_nLocalsPointer + (type - ARGUMENT_LOCAL)]; + } + else if (type >= ARGUMENT_TIMER) { + sprintf(tmpstr, " TIMER%d@", (type - ARGUMENT_TIMER)); + strcat(buf, tmpstr); + return &pScript->m_anLocalVariables[NUM_LOCAL_VARS + 8 + (type - ARGUMENT_TIMER)]; // why 8? + } + script_assert(false && "wrong type for variable"); + return nil; +} + +int CRunningScript::CollectParameterForDebug(char* buf, bool& var) +{ var = false; + int tmp; switch (CTheScripts::Read1ByteFromScript(&m_nIp)) { + case ARGUMENT_END: + return 0; // TODO(LCS) + case ARGUMENT_INT_ZERO: + return 0; + case ARGUMENT_FLOAT_ZERO: + return 0; + case ARGUMENT_FLOAT_1BYTE: + return (uint32)(uint8)CTheScripts::Read1ByteFromScript(&m_nIp) << 24; + case ARGUMENT_FLOAT_2BYTES: + return (uint32)(uint16)CTheScripts::Read2BytesFromScript(&m_nIp) << 16; + case ARGUMENT_FLOAT_3BYTES: + tmp = (uint32)(uint8)CTheScripts::Read1ByteFromScript(&m_nIp) << 8; + tmp |= (uint32)(uint16)CTheScripts::Read2BytesFromScript(&m_nIp) << 16; + return tmp; case ARGUMENT_INT32: case ARGUMENT_FLOAT: return CTheScripts::Read4BytesFromScript(&m_nIp); - case ARGUMENT_GLOBALVAR: - varIndex = CTheScripts::Read2BytesFromScript(&m_nIp); - script_assert(varIndex >= 8 && varIndex < CTheScripts::GetSizeOfVariableSpace()); - var = true; - sprintf(tmpstr, " $%d", varIndex / 4); - strcat(buf, tmpstr); - return *((int32*)&CTheScripts::ScriptSpace[varIndex]); - case ARGUMENT_LOCALVAR: - varIndex = CTheScripts::Read2BytesFromScript(&m_nIp); - script_assert(varIndex >= 0 && varIndex < ARRAY_SIZE(m_anLocalVariables)); - var = true; - sprintf(tmpstr, " %d@", varIndex); - strcat(buf, tmpstr); - return m_anLocalVariables[varIndex]; case ARGUMENT_INT8: return CTheScripts::Read1ByteFromScript(&m_nIp); case ARGUMENT_INT16: return CTheScripts::Read2BytesFromScript(&m_nIp); default: - PrintToLog("%s - script assertion failed in CollectParameterForDebug", buf); - script_assert(0); - break; + var = true; + --m_nIp; + return *GetPointerToScriptVariableForDebug(this, &m_nIp, buf); } return 0; } void CRunningScript::GetStoredParameterForDebug(char* buf) { - uint16 varIndex; - char tmpstr[24]; - switch (CTheScripts::Read1ByteFromScript(&m_nIp)) { - case ARGUMENT_GLOBALVAR: - varIndex = CTheScripts::Read2BytesFromScript(&m_nIp); - sprintf(tmpstr, " $%d", varIndex / 4); - strcat(buf, tmpstr); - break; - case ARGUMENT_LOCALVAR: - varIndex = CTheScripts::Read2BytesFromScript(&m_nIp); - sprintf(tmpstr, " %d@", varIndex); - strcat(buf, tmpstr); - break; - default: - PrintToLog("%s - script_assertion failed in GetStoredParameterForDebug", buf); - script_assert(0); - } + GetPointerToScriptVariableForDebug(this, &m_nIp, buf); } #endif int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip) { uint32* pIp = &ip; + int tmp; switch (CTheScripts::Read1ByteFromScript(pIp)) { + case ARGUMENT_END: + return 0; // TODO(LCS) + case ARGUMENT_INT_ZERO: + return 0; + case ARGUMENT_FLOAT_ZERO: + return 0; + case ARGUMENT_FLOAT_1BYTE: + return (uint32)(uint8)CTheScripts::Read1ByteFromScript(pIp) << 24; + case ARGUMENT_FLOAT_2BYTES: + return (uint32)(uint16)CTheScripts::Read2BytesFromScript(pIp) << 16; + case ARGUMENT_FLOAT_3BYTES: + tmp = (uint32)(uint8)CTheScripts::Read1ByteFromScript(pIp) << 8; + tmp |= (uint32)(uint16)CTheScripts::Read2BytesFromScript(pIp) << 16; + return tmp; case ARGUMENT_INT32: return CTheScripts::Read4BytesFromScript(pIp); - case ARGUMENT_GLOBALVAR: - return *((int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(pIp)]); - case ARGUMENT_LOCALVAR: - return m_anLocalVariables[CTheScripts::Read2BytesFromScript(pIp)]; case ARGUMENT_INT8: return CTheScripts::Read1ByteFromScript(pIp); case ARGUMENT_INT16: @@ -2143,7 +2464,8 @@ int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip) case ARGUMENT_FLOAT: return CTheScripts::Read4BytesFromScript(pIp); default: - script_assert(0); + (*pIp)--; + return *GetPointerToScriptVariable(pIp, 0); } return -1; } @@ -2151,38 +2473,61 @@ int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip) void CRunningScript::StoreParameters(uint32* pIp, int16 number) { for (int16 i = 0; i < number; i++){ - switch (CTheScripts::Read1ByteFromScript(pIp)) { - case ARGUMENT_GLOBALVAR: - *(int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(pIp)] = ScriptParams[i]; - break; - case ARGUMENT_LOCALVAR: - m_anLocalVariables[CTheScripts::Read2BytesFromScript(pIp)] = ScriptParams[i]; - break; - default: - script_assert(0); - } + *GetPointerToScriptVariable(pIp, 0) = ScriptParams[i]; } } +int32* GetPointerToScriptVariable(CRunningScript* pScript, uint32* pIp) +{ + uint8 type = CTheScripts::Read1ByteFromScript(pIp); + if (type >= ARGUMENT_GLOBAL_ARRAY) { + uint8 index_in_block = CTheScripts::Read1ByteFromScript(pIp); + uint8 index_id = CTheScripts::Read1ByteFromScript(pIp); + uint8 size = CTheScripts::Read1ByteFromScript(pIp); + script_assert(size > 0); + script_assert(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id] < size); + uint8 index = Min(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id], size - 1); + return (int32*)&CTheScripts::ScriptSpace[4 * (((int)(type - ARGUMENT_GLOBAL_ARRAY) << 8) + index + index_in_block)]; + } + else if (type >= ARGUMENT_GLOBAL) { + uint8 index_in_block = CTheScripts::Read1ByteFromScript(pIp); + return (int32*)&CTheScripts::ScriptSpace[4 * (((int)(type - ARGUMENT_GLOBAL) << 8) + index_in_block)]; + } + else if (type >= ARGUMENT_LOCAL_ARRAY) { + uint8 index_id = CTheScripts::Read1ByteFromScript(pIp); + uint8 size = CTheScripts::Read1ByteFromScript(pIp); + script_assert(size > 0); + script_assert(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id] < size); + uint8 index = Min(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id], size - 1); + return &pScript->m_anLocalVariables[pScript->m_nLocalsPointer + (type - ARGUMENT_LOCAL_ARRAY) + index]; + } + else if (type >= ARGUMENT_LOCAL) { + return &pScript->m_anLocalVariables[pScript->m_nLocalsPointer + (type - ARGUMENT_LOCAL)]; + } + else if (type >= ARGUMENT_TIMER) { + return &pScript->m_anLocalVariables[NUM_LOCAL_VARS + 8 + (type - ARGUMENT_TIMER)]; + } + script_assert(false && "wrong type for variable"); + return nil; +} + int32 *CRunningScript::GetPointerToScriptVariable(uint32* pIp, int16 type) { - switch (CTheScripts::Read1ByteFromScript(pIp)) - { - case ARGUMENT_GLOBALVAR: - script_assert(type == VAR_GLOBAL); - return (int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(pIp)]; - case ARGUMENT_LOCALVAR: - script_assert(type == VAR_LOCAL); - return &m_anLocalVariables[CTheScripts::Read2BytesFromScript(pIp)]; - default: - script_assert(0); + return ::GetPointerToScriptVariable(this, pIp); +} + +int CTheScripts::GetSaveVarIndex(int var) +{ + for (int i = 0; i < NumSaveVars; i++) { + if (SavedVarIndices[i] == var) + return i; } - return nil; + return -1; } void CRunningScript::Init() { - strcpy(m_abScriptName, "noname"); + sprintf(m_abScriptName, "id%02i", m_nId); next = prev = nil; SetIP(0); for (int i = 0; i < MAX_STACK_DEPTH; i++) @@ -2193,13 +2538,28 @@ void CRunningScript::Init() m_bCondResult = false; m_bIsMissionScript = false; m_bSkipWakeTime = false; - for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++) + for (int i = 0; i < NUM_LOCAL_VARS + 8 + NUM_TIMERS; i++) m_anLocalVariables[i] = 0; m_nAndOrState = 0; m_bNotFlag = false; m_bDeatharrestEnabled = true; m_bDeatharrestExecuted = false; m_bMissionFlag = false; + m_nLocalsPointer = 0; +} + +void CTheScripts::Shutdown() +{ + if (gScriptsFile != -1) { + CFileMgr::CloseFile(gScriptsFile); + gScriptsFile = -1; + } + if (ScriptSpace) { + base::cMainMemoryManager::Instance()->Free(ScriptSpace); + ScriptSpace = nil; + FSDestroyedFlag = false; + OnAMissionFlag = 0; + } } #ifdef USE_DEBUG_SCRIPT_LOADER @@ -2229,10 +2589,10 @@ int open_script() } #endif -void CTheScripts::Init() +bool CTheScripts::Init(bool loaddata) { - for (int i = 0; i < SIZE_SCRIPT_SPACE; i++) - ScriptSpace[i] = 0; + bool retval = false; + printf("CTheScripts::Init\n"); pActiveScripts = pIdleScripts = nil; for (int i = 0; i < MAX_NUM_SCRIPTS; i++){ ScriptsArray[i].Init(); @@ -2241,25 +2601,38 @@ void CTheScripts::Init() MissionCleanUp.Init(); UpsideDownCars.Init(); StuckCars.Init(); - CFileMgr::SetDir("data"); -#ifdef USE_DEBUG_SCRIPT_LOADER - int mainf = open_script(); -#else - int mainf = CFileMgr::OpenFile("main.scm", "rb"); -#endif - CFileMgr::Read(mainf, (char*)ScriptSpace, SIZE_MAIN_SCRIPT); - CFileMgr::CloseFile(mainf); - CFileMgr::SetDir(""); StoreVehicleIndex = -1; StoreVehicleWasRandom = true; OnAMissionFlag = 0; LastMissionPassedTime = (uint32)-1; + for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { + CollectiveArray[i].colIndex = -1; + CollectiveArray[i].pedIndex = 0; + } + NextFreeCollectiveIndex = 0; LastRandomPedId = -1; for (int i = 0; i < MAX_NUM_USED_OBJECTS; i++){ memset(&UsedObjectArray[i].name, 0, sizeof(UsedObjectArray[i].name)); UsedObjectArray[i].index = 0; } NumberOfUsedObjects = 0; + if (ScriptSpace) + Shutdown(); + CFileMgr::SetDir("DATA"); +#ifdef USE_DEBUG_SCRIPT_LOADER + int mainf = open_script(); +#else + int mainf = CFileMgr::OpenFile("main.scm", "rb"); +#endif + CFileMgr::Read(mainf, (char*)&MainScriptSize, sizeof(MainScriptSize)); + int nLargestMissionSize = 0; + CFileMgr::Read(mainf, (char*)&nLargestMissionSize, sizeof(nLargestMissionSize)); + // some cSmallHeap shit - TODO + ScriptSpace = (uint8*)base::cMainMemoryManager::Instance()->Allocate(MainScriptSize + nLargestMissionSize); + memset(ScriptSpace, 0, MainScriptSize + nLargestMissionSize); + CFileMgr::Read(mainf, (char*)ScriptSpace, MainScriptSize); + gScriptsFile = mainf; + CFileMgr::SetDir(""); ReadObjectNamesFromScript(); UpdateObjectIndices(); bAlreadyRunningAMissionScript = false; @@ -2269,11 +2642,10 @@ void CTheScripts::Init() NumberOfExclusiveMissionScripts = 0; NumberOfMissionScripts = 0; LargestMissionScriptSize = 0; - MainScriptSize = 0; ReadMultiScriptFileOffsetsFromScript(); FailCurrentMission = 0; DbgFlag = false; - NumScriptDebugLines = 0; + //NumScriptDebugLines = 0; RiotIntensity = 0; bPlayerHasMetDebbieHarry = false; bPlayerIsInTheStatium = false; @@ -2297,7 +2669,7 @@ void CTheScripts::Init() IntroRectangles[i].m_sColor = CRGBA(255, 255, 255, 255); } NumberOfIntroRectanglesThisFrame = 0; - RemoveScriptTextureDictionary(); + //RemoveScriptTextureDictionary(); // TODO(LCS) - probably not needed for (int i = 0; i < MAX_NUM_BUILDING_SWAPS; i++){ BuildingSwapArray[i].m_pBuilding = nil; BuildingSwapArray[i].m_nNewModel = -1; @@ -2305,6 +2677,12 @@ void CTheScripts::Init() } for (int i = 0; i < MAX_NUM_INVISIBILITY_SETTINGS; i++) InvisibilitySettingArray[i] = nil; + if (loaddata) { + printf("loaddata = true\n"); + //retval = GenericLoad(); // TODO + } + for (int i = 0; i < MAX_ALLOWED_COLLISIONS; i++) + AllowedCollision[i] = 0; #if defined USE_ADVANCED_SCRIPT_DEBUG_OUTPUT && SCRIPT_LOG_FILE_LEVEL == 2 CFileMgr::SetDirMyDocuments(); @@ -2315,8 +2693,10 @@ void CTheScripts::Init() PrintToLog(init_msg); CFileMgr::SetDir(""); #endif + return retval; } +/* void CTheScripts::RemoveScriptTextureDictionary() { for (int i = 0; i < ARRAY_SIZE(CTheScripts::ScriptSprites); i++) @@ -2325,6 +2705,7 @@ void CTheScripts::RemoveScriptTextureDictionary() if (slot != -1) CTxdStore::RemoveTxd(slot); } +*/ void CRunningScript::RemoveScriptFromList(CRunningScript** ppScript) { @@ -2350,6 +2731,7 @@ CRunningScript* CTheScripts::StartNewScript(uint32 ip) CRunningScript* pNew = pIdleScripts; script_assert(pNew); pNew->RemoveScriptFromList(&pIdleScripts); + pNew->m_nId = NextProcessId++; pNew->Init(); pNew->SetIP(ip); pNew->AddScriptToList(&pActiveScripts); @@ -2361,6 +2743,8 @@ void CTheScripts::Process() { if (CReplay::IsPlayingBack()) return; + if (!ScriptSpace) + return; CommandsExecuted = 0; ScriptsUpdated = 0; float timeStep = CTimer::GetTimeStepInMilliseconds(); @@ -2383,6 +2767,8 @@ void CTheScripts::Process() UseTextCommands = 0; } + // TODO: mCoronas + #ifdef MISSION_REPLAY static uint32 TimeToWaitTill; switch (AllowMissionReplay) { @@ -2432,6 +2818,7 @@ void CTheScripts::Process() #endif CRunningScript* script = pActiveScripts; + InTheScripts = true; while (script != nil){ CRunningScript* next = script->GetNext(); ++ScriptsUpdated; @@ -2466,6 +2853,7 @@ void CRunningScript::Process() #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT PrintToLog("\n\nProcessing script %s (id %d)\n\n", m_abScriptName, this - CTheScripts::ScriptsArray); #endif + pCurrent = this; if (m_bIsMissionScript) DoDeatharrestCheck(); if (m_bMissionFlag && CTheScripts::FailCurrentMission == 1 && m_nStackPointer == 1) @@ -2498,32 +2886,57 @@ int8 CRunningScript::ProcessOneCommand() #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT char commandInfo[1024]; uint32 ip = m_nIp; + uint8 nInputParams; + uint8 nOutputParameters; + uint8 nLocalsOffset; if (command < ARRAY_SIZE(commands)) { script_assert(commands[command].id == command); - sprintf(commandInfo, m_nIp >= SIZE_MAIN_SCRIPT ? "M<%5d> " : "<%6d> ", m_nIp >= SIZE_MAIN_SCRIPT ? m_nIp - SIZE_MAIN_SCRIPT : m_nIp); + sprintf(commandInfo, m_nIp >= CTheScripts::MainScriptSize ? "M<%5d> " : "<%6d> ", m_nIp >= CTheScripts::MainScriptSize ? m_nIp - CTheScripts::MainScriptSize : m_nIp); if (m_bNotFlag) strcat(commandInfo, "NOT "); if (commands[command].position == -1) strcat(commandInfo, commands[command].name + sizeof("COMMAND_") - 1); - for (int i = 0; commands[command].input[i] != ARGTYPE_NONE; i++) { + if (commands[command].input[0] == ARGTYPE_FUNCTION) { char tmp[32]; bool var = false; - int value; - switch (commands[command].input[i]) { - case ARGTYPE_INT: - case ARGTYPE_PED_HANDLE: - case ARGTYPE_VEHICLE_HANDLE: - case ARGTYPE_OBJECT_HANDLE: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%d)" : " %d", value); break; - case ARGTYPE_FLOAT: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%.3f)" : " %.3f", *(float*)&value); break; - case ARGTYPE_STRING: sprintf(tmp, " '%s'", (const char*)&CTheScripts::ScriptSpace[m_nIp]); m_nIp += KEY_LENGTH_IN_SCRIPT; break; - case ARGTYPE_LABEL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value)); break; - case ARGTYPE_BOOL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s)" : " %s", value ? "TRUE" : "FALSE"); break; - case ARGTYPE_ANDOR: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, " %d %ss", (value + 1) % 10, value / 10 == 0 ? "AND" : "OR"); break; - default: script_assert(0); - } + nInputParams = CTheScripts::Read1ByteFromScript(&m_nIp); + nOutputParameters = CTheScripts::Read1ByteFromScript(&m_nIp); + nLocalsOffset = CTheScripts::Read1ByteFromScript(&m_nIp); + int value = CollectParameterForDebug(commandInfo, var); + sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value)); strcat(commandInfo, tmp); - if (commands[command].position == i) - strcat(commandInfo, commands[command].name_override); + strcat(commandInfo, "{"); + for (int i = 0; i < nInputParams; i++) { + if (i != 0) + strcat(commandInfo, ", "); + value = CollectParameterForDebug(commandInfo, var); + sprintf(tmp, var ? "(%d)" : "%d", value); + strcat(commandInfo, tmp); + + } + strcat(commandInfo, "}"); + } + else { + for (int i = 0; commands[command].input[i] != ARGTYPE_NONE; i++) { + char tmp[32]; + bool var = false; + int value; + switch (commands[command].input[i]) { + case ARGTYPE_INT: + case ARGTYPE_PED_HANDLE: + case ARGTYPE_VEHICLE_HANDLE: + case ARGTYPE_OBJECT_HANDLE: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%d)" : " %d", value); break; + case ARGTYPE_FLOAT: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%.3f)" : " %.3f", *(float*)&value); break; + case ARGTYPE_STRING: sprintf(tmp, " '%s'", (const char*)&CTheScripts::ScriptSpace[m_nIp]); m_nIp += KEY_LENGTH_IN_SCRIPT; break; + case ARGTYPE_LABEL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value)); break; + case ARGTYPE_BOOL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s)" : " %s", value ? "TRUE" : "FALSE"); break; + case ARGTYPE_ANDOR: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, " %d %ss", (value + 1) % 10, value / 10 == 0 ? "AND" : "OR"); break; + default: script_assert(0); + } + strcat(commandInfo, tmp); + if (commands[command].position == i) + strcat(commandInfo, commands[command].name_override); + } } uint32 t = m_nIp; m_nIp = ip; @@ -2534,32 +2947,36 @@ int8 CRunningScript::ProcessOneCommand() retval = ProcessCommands0To99(command); else if (command < 200) retval = ProcessCommands100To199(command); - else if (command < 300) + else if (command < 305) retval = ProcessCommands200To299(command); - else if (command < 400) + else if (command < 405) retval = ProcessCommands300To399(command); - else if (command < 500) + else if (command < 505) retval = ProcessCommands400To499(command); - else if (command < 600) + else if (command < 605) retval = ProcessCommands500To599(command); - else if (command < 700) + else if (command < 705) retval = ProcessCommands600To699(command); - else if (command < 800) + else if (command < 805) retval = ProcessCommands700To799(command); - else if (command < 900) + else if (command < 905) retval = ProcessCommands800To899(command); - else if (command < 1000) + else if (command < 1005) retval = ProcessCommands900To999(command); - else if (command < 1100) + else if (command < 1105) retval = ProcessCommands1000To1099(command); - else if (command < 1200) + else if (command < 1205) retval = ProcessCommands1100To1199(command); - else if (command < 1300) + else if (command < 1305) retval = ProcessCommands1200To1299(command); - else if (command < 1400) + else if (command < 1405) retval = ProcessCommands1300To1399(command); - else if (command < 1500) + else if (command < 1497) retval = ProcessCommands1400To1499(command); + else if (command < 1600) + retval = ProcessCommands1500To1599(command); + else if (command < 1700) + retval = ProcessCommands1600To1699(command); #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT if (command < ARRAY_SIZE(commands)) { if (commands[command].cond || commands[command].output[0] != ARGTYPE_NONE) { @@ -2569,15 +2986,17 @@ int8 CRunningScript::ProcessOneCommand() uint32 t = m_nIp; m_nIp = ip; ip = t; - for (int i = 0; commands[command].output[i] != ARGTYPE_NONE; i++) { - char tmp[32]; - switch (commands[command].output[i]) { - case ARGTYPE_INT: - case ARGTYPE_PED_HANDLE: - case ARGTYPE_VEHICLE_HANDLE: - case ARGTYPE_OBJECT_HANDLE: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%d)", ScriptParams[i]); strcat(commandInfo, tmp); break; - case ARGTYPE_FLOAT: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%8.3f)", *(float*)&ScriptParams[i]); strcat(commandInfo, tmp); break; - default: script_assert(0 && "Script only returns INTs and FLOATs"); + if (commands[command].input[0] != ARGTYPE_FUNCTION) { + for (int i = 0; commands[command].output[i] != ARGTYPE_NONE; i++) { + char tmp[32]; + switch (commands[command].output[i]) { + case ARGTYPE_INT: + case ARGTYPE_PED_HANDLE: + case ARGTYPE_VEHICLE_HANDLE: + case ARGTYPE_OBJECT_HANDLE: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%d)", ScriptParams[i]); strcat(commandInfo, tmp); break; + case ARGTYPE_FLOAT: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%8.3f)", *(float*)&ScriptParams[i]); strcat(commandInfo, tmp); break; + default: script_assert(0 && "Script only returns INTs and FLOATs"); + } } } m_nIp = ip; @@ -2606,16 +3025,18 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) float *fScriptVar1; int *nScriptVar1; switch (command) { + /* case COMMAND_NOP: return 0; + */ case COMMAND_WAIT: CollectParameters(&m_nIp, 1); - m_nWakeTime = CTimer::GetTimeInMilliseconds() + ScriptParams[0]; + m_nWakeTime = CTimer::GetTimeInMilliseconds() + GET_INTEGER_PARAM(0); m_bSkipWakeTime = false; return 1; case COMMAND_GOTO: CollectParameters(&m_nIp, 1); - SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]); + SetIP(GET_INTEGER_PARAM(0) >= 0 ? GET_INTEGER_PARAM(0) : CTheScripts::MainScriptSize - GET_INTEGER_PARAM(0)); /* Known issue: GOTO to 0. It might have been "better" to use > instead of >= */ /* simply because it never makes sense to jump to start of the script */ /* but jumping to start of a custom mission is an issue for simple mission-like scripts */ @@ -2624,174 +3045,174 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) return 0; case COMMAND_SHAKE_CAM: CollectParameters(&m_nIp, 1); - CamShakeNoPos(&TheCamera, ScriptParams[0] / 1000.0f); + CamShakeNoPos(&TheCamera, GET_INTEGER_PARAM(0) / 1000.0f); return 0; case COMMAND_SET_VAR_INT: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - *ptr = ScriptParams[0]; + *ptr = GET_INTEGER_PARAM(0); return 0; } case COMMAND_SET_VAR_FLOAT: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - *(float*)ptr = *(float*)&ScriptParams[0]; + *(float*)ptr = GET_FLOAT_PARAM(0); return 0; } case COMMAND_SET_LVAR_INT: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - *ptr = ScriptParams[0]; + *ptr = GET_INTEGER_PARAM(0); return 0; } case COMMAND_SET_LVAR_FLOAT: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - *(float*)ptr = *(float*)&ScriptParams[0]; + *(float*)ptr = GET_FLOAT_PARAM(0); return 0; } case COMMAND_ADD_VAL_TO_INT_VAR: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - *ptr += ScriptParams[0]; + *ptr += GET_INTEGER_PARAM(0); return 0; } case COMMAND_ADD_VAL_TO_FLOAT_VAR: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - *(float*)ptr += *(float*)&ScriptParams[0]; + *(float*)ptr += GET_FLOAT_PARAM(0); return 0; } case COMMAND_ADD_VAL_TO_INT_LVAR: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - *ptr += ScriptParams[0]; + *ptr += GET_INTEGER_PARAM(0); return 0; } case COMMAND_ADD_VAL_TO_FLOAT_LVAR: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - *(float*)ptr += *(float*)&ScriptParams[0]; + *(float*)ptr += GET_FLOAT_PARAM(0); return 0; } case COMMAND_SUB_VAL_FROM_INT_VAR: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - *ptr -= ScriptParams[0]; + *ptr -= GET_INTEGER_PARAM(0); return 0; } case COMMAND_SUB_VAL_FROM_FLOAT_VAR: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - *(float*)ptr -= *(float*)&ScriptParams[0]; + *(float*)ptr -= GET_FLOAT_PARAM(0); return 0; } case COMMAND_SUB_VAL_FROM_INT_LVAR: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - *ptr -= ScriptParams[0]; + *ptr -= GET_INTEGER_PARAM(0); return 0; } case COMMAND_SUB_VAL_FROM_FLOAT_LVAR: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - *(float*)ptr -= *(float*)&ScriptParams[0]; + *(float*)ptr -= GET_FLOAT_PARAM(0); return 0; } case COMMAND_MULT_INT_VAR_BY_VAL: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - *ptr *= ScriptParams[0]; + *ptr *= GET_INTEGER_PARAM(0); return 0; } case COMMAND_MULT_FLOAT_VAR_BY_VAL: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - *(float*)ptr *= *(float*)&ScriptParams[0]; + *(float*)ptr *= GET_FLOAT_PARAM(0); return 0; } case COMMAND_MULT_INT_LVAR_BY_VAL: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - *ptr *= ScriptParams[0]; + *ptr *= GET_INTEGER_PARAM(0); return 0; } case COMMAND_MULT_FLOAT_LVAR_BY_VAL: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - *(float*)ptr *= *(float*)&ScriptParams[0]; + *(float*)ptr *= GET_FLOAT_PARAM(0); return 0; } case COMMAND_DIV_INT_VAR_BY_VAL: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - *ptr /= ScriptParams[0]; + *ptr /= GET_INTEGER_PARAM(0); return 0; } case COMMAND_DIV_FLOAT_VAR_BY_VAL: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - *(float*)ptr /= *(float*)&ScriptParams[0]; + *(float*)ptr /= GET_FLOAT_PARAM(0); return 0; } case COMMAND_DIV_INT_LVAR_BY_VAL: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - *ptr /= ScriptParams[0]; + *ptr /= GET_INTEGER_PARAM(0); return 0; } case COMMAND_DIV_FLOAT_LVAR_BY_VAL: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - *(float*)ptr /= *(float*)&ScriptParams[0]; + *(float*)ptr /= GET_FLOAT_PARAM(0); return 0; } case COMMAND_IS_INT_VAR_GREATER_THAN_NUMBER: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - UpdateCompareFlag(*ptr > ScriptParams[0]); + UpdateCompareFlag(*ptr > GET_INTEGER_PARAM(0)); return 0; } case COMMAND_IS_INT_LVAR_GREATER_THAN_NUMBER: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - UpdateCompareFlag(*ptr > ScriptParams[0]); + UpdateCompareFlag(*ptr > GET_INTEGER_PARAM(0)); return 0; } case COMMAND_IS_NUMBER_GREATER_THAN_INT_VAR: { CollectParameters(&m_nIp, 1); int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); - UpdateCompareFlag(ScriptParams[0] > *ptr); + UpdateCompareFlag(GET_INTEGER_PARAM(0) > *ptr); return 0; } case COMMAND_IS_NUMBER_GREATER_THAN_INT_LVAR: { CollectParameters(&m_nIp, 1); int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); - UpdateCompareFlag(ScriptParams[0] > *ptr); + UpdateCompareFlag(GET_INTEGER_PARAM(0) > *ptr); return 0; } case COMMAND_IS_INT_VAR_GREATER_THAN_INT_VAR: @@ -2826,28 +3247,28 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - UpdateCompareFlag(*(float*)ptr > *(float*)&ScriptParams[0]); + UpdateCompareFlag(*(float*)ptr > GET_FLOAT_PARAM(0)); return 0; } case COMMAND_IS_FLOAT_LVAR_GREATER_THAN_NUMBER: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - UpdateCompareFlag(*(float*)ptr > *(float*)&ScriptParams[0]); + UpdateCompareFlag(*(float*)ptr > GET_FLOAT_PARAM(0)); return 0; } case COMMAND_IS_NUMBER_GREATER_THAN_FLOAT_VAR: { CollectParameters(&m_nIp, 1); int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); - UpdateCompareFlag(*(float*)&ScriptParams[0] > *(float*)ptr); + UpdateCompareFlag(GET_FLOAT_PARAM(0) > *(float*)ptr); return 0; } case COMMAND_IS_NUMBER_GREATER_THAN_FLOAT_LVAR: { CollectParameters(&m_nIp, 1); int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); - UpdateCompareFlag(*(float*)&ScriptParams[0] > *(float*)ptr); + UpdateCompareFlag(GET_FLOAT_PARAM(0) > *(float*)ptr); return 0; } case COMMAND_IS_FLOAT_VAR_GREATER_THAN_FLOAT_VAR: @@ -2882,28 +3303,28 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - UpdateCompareFlag(*ptr >= ScriptParams[0]); + UpdateCompareFlag(*ptr >= GET_INTEGER_PARAM(0)); return 0; } case COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_NUMBER: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - UpdateCompareFlag(*ptr >= ScriptParams[0]); + UpdateCompareFlag(*ptr >= GET_INTEGER_PARAM(0)); return 0; } case COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_INT_VAR: { CollectParameters(&m_nIp, 1); int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); - UpdateCompareFlag(ScriptParams[0] >= *ptr); + UpdateCompareFlag(GET_INTEGER_PARAM(0) >= *ptr); return 0; } case COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_INT_LVAR: { CollectParameters(&m_nIp, 1); int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); - UpdateCompareFlag(ScriptParams[0] >= *ptr); + UpdateCompareFlag(GET_INTEGER_PARAM(0) >= *ptr); return 0; } case COMMAND_IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_VAR: @@ -2938,28 +3359,28 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - UpdateCompareFlag(*(float*)ptr >= *(float*)&ScriptParams[0]); + UpdateCompareFlag(*(float*)ptr >= GET_FLOAT_PARAM(0)); return 0; } case COMMAND_IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_NUMBER: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - UpdateCompareFlag(*(float*)ptr >= *(float*)&ScriptParams[0]); + UpdateCompareFlag(*(float*)ptr >= GET_FLOAT_PARAM(0)); return 0; } case COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_VAR: { CollectParameters(&m_nIp, 1); int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); - UpdateCompareFlag(*(float*)&ScriptParams[0] >= *(float*)ptr); + UpdateCompareFlag(GET_FLOAT_PARAM(0) >= *(float*)ptr); return 0; } case COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_LVAR: { CollectParameters(&m_nIp, 1); int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); - UpdateCompareFlag(*(float*)&ScriptParams[0] >= *(float*)ptr); + UpdateCompareFlag(GET_FLOAT_PARAM(0) >= *(float*)ptr); return 0; } case COMMAND_IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_VAR: @@ -2994,14 +3415,14 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - UpdateCompareFlag(*ptr == ScriptParams[0]); + UpdateCompareFlag(*ptr == GET_INTEGER_PARAM(0)); return 0; } case COMMAND_IS_INT_LVAR_EQUAL_TO_NUMBER: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - UpdateCompareFlag(*ptr == ScriptParams[0]); + UpdateCompareFlag(*ptr == GET_INTEGER_PARAM(0)); return 0; } case COMMAND_IS_INT_VAR_EQUAL_TO_INT_VAR: @@ -3034,14 +3455,14 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - UpdateCompareFlag(*(float*)ptr == *(float*)&ScriptParams[0]); + UpdateCompareFlag(*(float*)ptr == GET_FLOAT_PARAM(0)); return 0; } case COMMAND_IS_FLOAT_LVAR_EQUAL_TO_NUMBER: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - UpdateCompareFlag(*(float*)ptr == *(float*)&ScriptParams[0]); + UpdateCompareFlag(*(float*)ptr == GET_FLOAT_PARAM(0)); return 0; } case COMMAND_IS_FLOAT_VAR_EQUAL_TO_FLOAT_VAR: @@ -3070,17 +3491,15 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) //case COMMAND_IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_VAR: //case COMMAND_IS_FLOAT_LVAR_NOT_EQUAL_TO_FLOAT_LVAR: //case COMMAND_IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_LVAR: - /* case COMMAND_GOTO_IF_TRUE: CollectParameters(&m_nIp, 1); if (m_bCondResult) - SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]); + SetIP(GET_INTEGER_PARAM(0) >= 0 ? GET_INTEGER_PARAM(0) : CTheScripts::MainScriptSize - GET_INTEGER_PARAM(0)); return 0; - */ case COMMAND_GOTO_IF_FALSE: CollectParameters(&m_nIp, 1); if (!m_bCondResult) - SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]); + SetIP(GET_INTEGER_PARAM(0) >= 0 ? GET_INTEGER_PARAM(0) : CTheScripts::MainScriptSize - GET_INTEGER_PARAM(0)); /* Check COMMAND_GOTO note. */ return 0; case COMMAND_TERMINATE_THIS_SCRIPT: @@ -3106,47 +3525,19 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) case COMMAND_START_NEW_SCRIPT: { CollectParameters(&m_nIp, 1); - script_assert(ScriptParams[0] >= 0); - CRunningScript* pNew = CTheScripts::StartNewScript(ScriptParams[0]); - m_bIsActive = true; - int8 type = CTheScripts::Read1ByteFromScript(&m_nIp); - float tmp; - for (int i = 0; type != ARGUMENT_END; type = CTheScripts::Read1ByteFromScript(&m_nIp), i++) { - switch (type) { - case ARGUMENT_INT32: - pNew->m_anLocalVariables[i] = CTheScripts::Read4BytesFromScript(&m_nIp); - break; - case ARGUMENT_GLOBALVAR: - pNew->m_anLocalVariables[i] = *(int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(&m_nIp)]; - break; - case ARGUMENT_LOCALVAR: - pNew->m_anLocalVariables[i] = m_anLocalVariables[CTheScripts::Read2BytesFromScript(&m_nIp)]; - break; - case ARGUMENT_INT8: - pNew->m_anLocalVariables[i] = CTheScripts::Read1ByteFromScript(&m_nIp); - break; - case ARGUMENT_INT16: - pNew->m_anLocalVariables[i] = CTheScripts::Read2BytesFromScript(&m_nIp); - break; - case ARGUMENT_FLOAT: - tmp = CTheScripts::ReadFloatFromScript(&m_nIp); - pNew->m_anLocalVariables[i] = *(int32*)&tmp; - break; - default: - break; - } - } + script_assert(GET_INTEGER_PARAM(0) >= 0); + CRunningScript* pNew = CTheScripts::StartNewScript(GET_INTEGER_PARAM(0)); + CollectParameters(&m_nIp, NUM_LOCAL_VARS, pNew->m_anLocalVariables); return 0; } case COMMAND_GOSUB: CollectParameters(&m_nIp, 1); script_assert(m_nStackPointer < MAX_STACK_DEPTH); m_anStack[m_nStackPointer++] = m_nIp; - SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]); + SetIP(GET_INTEGER_PARAM(0) >= 0 ? GET_INTEGER_PARAM(0) : CTheScripts::MainScriptSize - GET_INTEGER_PARAM(0)); return 0; case COMMAND_RETURN: - script_assert(m_nStackPointer > 0); /* No more SSU */ - SetIP(m_anStack[--m_nStackPointer]); + ReturnFromGosubOrFunction(); return 0; case COMMAND_LINE: CollectParameters(&m_nIp, 6); @@ -3155,7 +3546,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) case COMMAND_CREATE_PLAYER: { CollectParameters(&m_nIp, 4); - int32 index = ScriptParams[0]; + int32 index = GET_INTEGER_PARAM(0); script_assert(index < NUMPLAYERS); printf("&&&&&&&&&&&&&Creating player: %d\n", index); if (!CStreaming::HasModelLoaded(MI_PLAYER)) { @@ -3165,14 +3556,14 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) CPlayerPed::SetupPlayerPed(index); CWorld::Players[index].m_pPed->CharCreatedBy = MISSION_CHAR; CPlayerPed::DeactivatePlayerPed(index); - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z += CWorld::Players[index].m_pPed->GetDistanceFromCentreOfMassToBaseOfModel(); CWorld::Players[index].m_pPed->SetPosition(pos); CTheScripts::ClearSpaceForMissionEntity(pos, CWorld::Players[index].m_pPed); CPlayerPed::ReactivatePlayerPed(index); - ScriptParams[0] = index; + SET_INTEGER_PARAM(0, index); StoreParameters(&m_nIp, 1); return 0; } @@ -3180,23 +3571,23 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) { CVector pos; CollectParameters(&m_nIp, 1); - if (CWorld::Players[ScriptParams[0]].m_pPed->bInVehicle) - pos = CWorld::Players[ScriptParams[0]].m_pPed->m_pMyVehicle->GetPosition(); + if (CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->bInVehicle && CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->m_pMyVehicle) + pos = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->m_pMyVehicle->GetPosition(); else - pos = CWorld::Players[ScriptParams[0]].m_pPed->GetPosition(); - *(CVector*)&ScriptParams[0] = pos; + pos = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->GetPosition(); + SET_VECTOR_PARAM(0, pos); StoreParameters(&m_nIp, 3); return 0; } case COMMAND_SET_PLAYER_COORDINATES: { CollectParameters(&m_nIp, 4); - CVector pos = *(CVector*)&ScriptParams[1]; - int index = ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(1); + int index = GET_INTEGER_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CPlayerPed* ped = CWorld::Players[index].m_pPed; - if (ped->bInVehicle) { + if (ped->bInVehicle && ped->m_pMyVehicle) { pos.z += ped->m_pMyVehicle->GetDistanceFromCentreOfMassToBaseOfModel(); ped->m_pMyVehicle->Teleport(pos); // removed dumb stuff that was present here CTheScripts::ClearSpaceForMissionEntity(pos, ped->m_pMyVehicle); @@ -3244,39 +3635,43 @@ int8 CRunningScript::ProcessCommands0To99(int32 command) case COMMAND_IS_PLAYER_IN_AREA_2D: { CollectParameters(&m_nIp, 6); - CPlayerPed* ped = CWorld::Players[ScriptParams[0]].m_pPed; - float x1 = *(float*)&ScriptParams[1]; - float y1 = *(float*)&ScriptParams[2]; - float x2 = *(float*)&ScriptParams[3]; - float y2 = *(float*)&ScriptParams[4]; + CPlayerPed* ped = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; + float x1 = GET_FLOAT_PARAM(1); + float y1 = GET_FLOAT_PARAM(2); + float x2 = GET_FLOAT_PARAM(3); + float y2 = GET_FLOAT_PARAM(4); if (!ped->bInVehicle) UpdateCompareFlag(ped->IsWithinArea(x1, y1, x2, y2)); else UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, x2, y2)); - if (ScriptParams[5]) + if (GET_INTEGER_PARAM(5)) CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT); + /* if (CTheScripts::DbgFlag) CTheScripts::DrawDebugSquare(x1, y1, x2, y2); + */ return 0; } case COMMAND_IS_PLAYER_IN_AREA_3D: { CollectParameters(&m_nIp, 8); - CPlayerPed* ped = CWorld::Players[ScriptParams[0]].m_pPed; - float x1 = *(float*)&ScriptParams[1]; - float y1 = *(float*)&ScriptParams[2]; - float z1 = *(float*)&ScriptParams[3]; - float x2 = *(float*)&ScriptParams[4]; - float y2 = *(float*)&ScriptParams[5]; - float z2 = *(float*)&ScriptParams[6]; + CPlayerPed* ped = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; + float x1 = GET_FLOAT_PARAM(1); + float y1 = GET_FLOAT_PARAM(2); + float z1 = GET_FLOAT_PARAM(3); + float x2 = GET_FLOAT_PARAM(4); + float y2 = GET_FLOAT_PARAM(5); + float z2 = GET_FLOAT_PARAM(6); if (ped->bInVehicle) UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2)); else UpdateCompareFlag(ped->IsWithinArea(x1, y1, z1, x2, y2, z2)); - if (ScriptParams[7]) + if (GET_INTEGER_PARAM(7)) CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2); + /* if (CTheScripts::DbgFlag) CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2); + */ return 0; } case COMMAND_ADD_INT_VAR_TO_INT_VAR: @@ -3423,33 +3818,25 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - *(float*)ptr += CTimer::GetTimeStep() * *(float*)&ScriptParams[0]; + *(float*)ptr += CTimer::GetTimeStep() * GET_FLOAT_PARAM(0); return 0; } case COMMAND_ADD_TIMED_VAL_TO_FLOAT_LVAR: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - *(float*)ptr += CTimer::GetTimeStep() * *(float*)&ScriptParams[0]; + *(float*)ptr += CTimer::GetTimeStep() * GET_FLOAT_PARAM(0); return 0; } case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_VAR: fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; -#ifdef FIX_BUGS case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR: -#else - case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR: -#endif fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; -#ifdef FIX_BUGS case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR: -#else - case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR: -#endif fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; @@ -3461,33 +3848,25 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); CollectParameters(&m_nIp, 1); - *(float*)ptr -= CTimer::GetTimeStep() * *(float*)&ScriptParams[0]; + *(float*)ptr -= CTimer::GetTimeStep() * GET_FLOAT_PARAM(0); return 0; } case COMMAND_SUB_TIMED_VAL_FROM_FLOAT_LVAR: { int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); CollectParameters(&m_nIp, 1); - *(float*)ptr -= CTimer::GetTimeStep() * *(float*)&ScriptParams[0]; + *(float*)ptr -= CTimer::GetTimeStep() * GET_FLOAT_PARAM(0); return 0; } case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_VAR: fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; -#ifdef FIX_BUGS // in SA it was fixed by reversing their order in enum case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR: -#else - case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR: -#endif fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); *fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); return 0; -#ifdef FIX_BUGS case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR: -#else - case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR: -#endif fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL); *fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL); return 0; @@ -3636,46 +4015,46 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) case COMMAND_CREATE_CHAR: { CollectParameters(&m_nIp, 5); - switch (ScriptParams[1]) { + switch (GET_INTEGER_PARAM(1)) { case MI_COP: - if (ScriptParams[0] == PEDTYPE_COP) - ScriptParams[1] = COP_STREET; + if (GET_INTEGER_PARAM(0) == PEDTYPE_COP) + SET_INTEGER_PARAM(1, COP_STREET); break; case MI_SWAT: - if (ScriptParams[0] == PEDTYPE_COP) - ScriptParams[1] = COP_SWAT; + if (GET_INTEGER_PARAM(0) == PEDTYPE_COP) + SET_INTEGER_PARAM(1, COP_SWAT); break; case MI_FBI: - if (ScriptParams[0] == PEDTYPE_COP) - ScriptParams[1] = COP_FBI; + if (GET_INTEGER_PARAM(0) == PEDTYPE_COP) + SET_INTEGER_PARAM(1, COP_FBI); break; case MI_ARMY: - if (ScriptParams[0] == PEDTYPE_COP) - ScriptParams[1] = COP_ARMY; + if (GET_INTEGER_PARAM(0) == PEDTYPE_COP) + SET_INTEGER_PARAM(1, COP_ARMY); break; case MI_MEDIC: - if (ScriptParams[0] == PEDTYPE_EMERGENCY) - ScriptParams[1] = PEDTYPE_EMERGENCY; + if (GET_INTEGER_PARAM(0) == PEDTYPE_EMERGENCY) + SET_INTEGER_PARAM(1, PEDTYPE_EMERGENCY); break; case MI_FIREMAN: - if (ScriptParams[0] == PEDTYPE_FIREMAN) - ScriptParams[1] = PEDTYPE_FIREMAN; + if (GET_INTEGER_PARAM(0) == PEDTYPE_FIREMAN) + SET_INTEGER_PARAM(1, PEDTYPE_FIREMAN); break; default: break; } CPed* ped; - if (ScriptParams[0] == PEDTYPE_COP) - ped = new CCopPed((eCopType)ScriptParams[1]); - else if (ScriptParams[0] == PEDTYPE_EMERGENCY || ScriptParams[0] == PEDTYPE_FIREMAN) - ped = new CEmergencyPed(ScriptParams[1]); + if (GET_INTEGER_PARAM(0) == PEDTYPE_COP) + ped = new CCopPed((eCopType)GET_INTEGER_PARAM(1)); + else if (GET_INTEGER_PARAM(0) == PEDTYPE_EMERGENCY || GET_INTEGER_PARAM(0) == PEDTYPE_FIREMAN) + ped = new CEmergencyPed(GET_INTEGER_PARAM(1)); else - ped = new CCivilianPed((ePedType)ScriptParams[0], ScriptParams[1]); + ped = new CCivilianPed((ePedType)GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); ped->CharCreatedBy = MISSION_CHAR; ped->bRespondsToThreats = false; ped->bAllowMedicsToReviveMe = false; ped->bIsPlayerFriend = false; - CVector pos = *(CVector*)&ScriptParams[2]; + CVector pos = GET_VECTOR_PARAM(2); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z += 1.0f; @@ -3687,29 +4066,29 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) CWorld::Add(ped); ped->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pos); CPopulation::ms_nTotalMissionPeds++; - ScriptParams[0] = CPools::GetPedPool()->GetIndex(ped); + SET_INTEGER_PARAM(0, CPools::GetPedPool()->GetIndex(ped)); StoreParameters(&m_nIp, 1); if (m_bIsMissionScript) - CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR); + CTheScripts::MissionCleanUp.AddEntityToList(GET_INTEGER_PARAM(0), CLEANUP_CHAR); return 0; } case COMMAND_DELETE_CHAR: { CollectParameters(&m_nIp, 1); - CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); CTheScripts::RemoveThisPed(ped); if (m_bIsMissionScript) - CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR); + CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_CHAR); return 0; } case COMMAND_CHAR_WANDER_DIR: { CollectParameters(&m_nIp, 2); - CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(ped); ped->ClearAll(); - int8 path = ScriptParams[1]; - if (ScriptParams[1] < 0 || ScriptParams[1] > 7) + int8 path = GET_INTEGER_PARAM(1); + if (GET_INTEGER_PARAM(1) < 0 || GET_INTEGER_PARAM(1) > 7) // Max number GetRandomNumberInRange returns is max-1 #ifdef FIX_BUGS path = CGeneral::GetRandomNumberInRange(0, 8); @@ -3724,19 +4103,19 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) case COMMAND_CHAR_FOLLOW_PATH: { CollectParameters(&m_nIp, 6); - CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(ped); if (ped->GetPedState() == PED_ATTACK || ped->GetPedState() == PED_FIGHT || !ped->IsPedInControl()) return 0; - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - float radius = *(float*)&ScriptParams[4]; + float radius = GET_FLOAT_PARAM(4); eMoveState state; - switch (ScriptParams[5]) { + switch (GET_INTEGER_PARAM(5)) { case 0: state = PEDMOVE_WALK; break; case 1: state = PEDMOVE_RUN; break; - default: assert(0); + default: state = PEDMOVE_WALK; break; } ped->ClearAll(); ped->m_pathNodeTimer = 0; @@ -3746,7 +4125,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) case COMMAND_CHAR_SET_IDLE: { CollectParameters(&m_nIp, 1); - CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(ped); ped->bScriptObjectiveCompleted = false; ped->SetObjective(OBJECTIVE_WAIT_ON_FOOT); @@ -3755,7 +4134,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) case COMMAND_GET_CHAR_COORDINATES: { CollectParameters(&m_nIp, 1); - CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(ped); CVehicle* vehicle; CVector pos; @@ -3768,21 +4147,21 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) pos = vehicle->GetPosition(); else pos = ped->GetPosition(); - *(CVector*)&ScriptParams[0] = pos; + SET_VECTOR_PARAM(0, pos); StoreParameters(&m_nIp, 3); return 0; } case COMMAND_SET_CHAR_COORDINATES: { CollectParameters(&m_nIp, 4); - CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(ped); CVehicle* vehicle; if (ped->bInVehicle) vehicle = ped->m_pMyVehicle; else vehicle = nil; - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); // removed dumb stuff again @@ -3805,72 +4184,74 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) } return 0; } - /* case COMMAND_IS_CHAR_STILL_ALIVE: { CollectParameters(&m_nIp, 1); - CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); - UpdateCompareFlag(ped && ped->GetPedState() != PED_DEAD && ped->GetPedState() != PED_DIE); + CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); + UpdateCompareFlag(ped && !ped->DyingOrDead()); return 0; } - */ case COMMAND_IS_CHAR_IN_AREA_2D: { CollectParameters(&m_nIp, 6); - CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(ped); CVehicle* vehicle; if (ped->bInVehicle) vehicle = ped->m_pMyVehicle; else vehicle = nil; - float x1 = *(float*)&ScriptParams[1]; - float y1 = *(float*)&ScriptParams[2]; - float x2 = *(float*)&ScriptParams[3]; - float y2 = *(float*)&ScriptParams[4]; + float x1 = GET_FLOAT_PARAM(1); + float y1 = GET_FLOAT_PARAM(2); + float x2 = GET_FLOAT_PARAM(3); + float y2 = GET_FLOAT_PARAM(4); if (vehicle) UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, x2, y2)); else UpdateCompareFlag(ped->IsWithinArea(x1, y1, x2, y2)); - if (ScriptParams[5]) + if (GET_INTEGER_PARAM(5)) CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT); + /* if (CTheScripts::DbgFlag) CTheScripts::DrawDebugSquare(x1, y1, x2, y2); + */ return 0; } case COMMAND_IS_CHAR_IN_AREA_3D: { CollectParameters(&m_nIp, 8); - CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(ped); CVehicle* vehicle; if (ped->bInVehicle) vehicle = ped->m_pMyVehicle; else vehicle = nil; - float x1 = *(float*)&ScriptParams[1]; - float y1 = *(float*)&ScriptParams[2]; - float z1 = *(float*)&ScriptParams[3]; - float x2 = *(float*)&ScriptParams[4]; - float y2 = *(float*)&ScriptParams[5]; - float z2 = *(float*)&ScriptParams[6]; + float x1 = GET_FLOAT_PARAM(1); + float y1 = GET_FLOAT_PARAM(2); + float z1 = GET_FLOAT_PARAM(3); + float x2 = GET_FLOAT_PARAM(4); + float y2 = GET_FLOAT_PARAM(5); + float z2 = GET_FLOAT_PARAM(6); if (vehicle) UpdateCompareFlag(ped->m_pMyVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2)); else UpdateCompareFlag(ped->IsWithinArea(x1, y1, z1, x2, y2, z2)); - if (ScriptParams[7]) + if (GET_INTEGER_PARAM(7)) CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2); + /* if (CTheScripts::DbgFlag) CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2); + */ return 0; } case COMMAND_CREATE_CAR: { CollectParameters(&m_nIp, 4); int32 handle; - if (CModelInfo::IsBoatModel(ScriptParams[0])) { - CBoat* boat = new CBoat(ScriptParams[0], MISSION_VEHICLE); - CVector pos = *(CVector*)&ScriptParams[1]; + if (CModelInfo::IsBoatModel(GET_INTEGER_PARAM(0))) { + CBoat* boat = new CBoat(GET_INTEGER_PARAM(0), MISSION_VEHICLE); + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z += boat->GetDistanceFromCentreOfMassToBaseOfModel(); @@ -3889,13 +4270,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) else { CVehicle* car; - if (!CModelInfo::IsBikeModel(ScriptParams[0])) - car = new CAutomobile(ScriptParams[0], MISSION_VEHICLE); + if (!CModelInfo::IsBikeModel(GET_INTEGER_PARAM(0))) + car = new CAutomobile(GET_INTEGER_PARAM(0), MISSION_VEHICLE); else { - car = new CBike(ScriptParams[0], MISSION_VEHICLE); + car = new CBike(GET_INTEGER_PARAM(0), MISSION_VEHICLE); ((CBike*)(car))->bIsStanding = true; } - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel(); @@ -3910,14 +4291,14 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) car->AutoPilot.m_nCruiseSpeed = car->AutoPilot.m_fMaxTrafficSpeed = 9.0f; car->AutoPilot.m_nCurrentLane = car->AutoPilot.m_nNextLane = 0; car->bEngineOn = false; - car->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pos); + car->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pos); // TODO: gpTheZones car->bHasBeenOwnedByPlayer = true; if (m_bIsMissionScript) car->bIsStaticWaitingForCollision = true; CWorld::Add(car); handle = CPools::GetVehiclePool()->GetIndex(car); } - ScriptParams[0] = handle; + SET_INTEGER_PARAM(0, handle); StoreParameters(&m_nIp, 1); if (m_bIsMissionScript) CTheScripts::MissionCleanUp.AddEntityToList(handle, CLEANUP_CAR); @@ -3926,25 +4307,26 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) case COMMAND_DELETE_CAR: { CollectParameters(&m_nIp, 1); - CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); if (car) { CWorld::Remove(car); CWorld::RemoveReferencesToDeletedObject(car); delete car; } if (m_bIsMissionScript) - CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR); + CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_CAR); return 0; } case COMMAND_CAR_GOTO_COORDINATES: { CollectParameters(&m_nIp, 4); - CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(car); - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel(); + uint8 nOldMission = car->AutoPilot.m_nCarMission; if (CCarCtrl::JoinCarWithRoadSystemGotoCoors(car, pos, false)) car->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT; else @@ -3952,13 +4334,14 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) car->SetStatus(STATUS_PHYSICS); car->bEngineOn = true; car->AutoPilot.m_nCruiseSpeed = Max(1, car->AutoPilot.m_nCruiseSpeed); - car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); + if (nOldMission != car->AutoPilot.m_nCarMission) + car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); return 0; } case COMMAND_CAR_WANDER_RANDOMLY: { CollectParameters(&m_nIp, 1); - CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(car); CCarCtrl::JoinCarWithRoadSystem(car); car->AutoPilot.m_nCarMission = MISSION_CRUISE; @@ -3970,7 +4353,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) case COMMAND_CAR_SET_IDLE: { CollectParameters(&m_nIp, 1); - CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(car); car->AutoPilot.m_nCarMission = MISSION_NONE; return 0; @@ -3978,18 +4361,18 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) case COMMAND_GET_CAR_COORDINATES: { CollectParameters(&m_nIp, 1); - CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(car); - *(CVector*)&ScriptParams[0] = car->GetPosition(); + SET_VECTOR_PARAM(0, car->GetPosition()); StoreParameters(&m_nIp, 3); return 0; } case COMMAND_SET_CAR_COORDINATES: { CollectParameters(&m_nIp, 4); - CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(car); - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel(); @@ -4035,80 +4418,84 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) } return 0; } - /* case COMMAND_IS_CAR_STILL_ALIVE: { CollectParameters(&m_nIp, 1); - CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); UpdateCompareFlag(car && car->GetStatus() != STATUS_WRECKED && (car->IsBoat() || !car->bIsInWater)); return 0; } - */ case COMMAND_SET_CAR_CRUISE_SPEED: { CollectParameters(&m_nIp, 2); - CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(car); #if defined MISSION_REPLAY && defined SIMPLIER_MISSIONS - car->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[1]; + car->AutoPilot.m_nCruiseSpeed = GET_FLOAT_PARAM(1); if (missionRetryScriptIndex == 40 && car->GetModelIndex() == MI_CHEETAH) // Turismo car->AutoPilot.m_nCruiseSpeed = 8 * car->AutoPilot.m_nCruiseSpeed / 10; car->AutoPilot.m_nCruiseSpeed = Min(car->AutoPilot.m_nCruiseSpeed, 60.0f * car->pHandling->Transmission.fMaxCruiseVelocity); #else - car->AutoPilot.m_nCruiseSpeed = Min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fMaxCruiseVelocity); + car->AutoPilot.m_nCruiseSpeed = Min(GET_FLOAT_PARAM(1), 60.0f * car->pHandling->Transmission.fMaxCruiseVelocity); #endif return 0; } case COMMAND_SET_CAR_DRIVING_STYLE: { CollectParameters(&m_nIp, 2); - CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(car); - car->AutoPilot.m_nDrivingStyle = (uint8)ScriptParams[1]; + car->AutoPilot.m_nDrivingStyle = (uint8)GET_INTEGER_PARAM(1); return 0; } case COMMAND_SET_CAR_MISSION: { CollectParameters(&m_nIp, 2); - CVehicle* car = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* car = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(car); - car->AutoPilot.m_nCarMission = (uint8)ScriptParams[1]; - car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); + if ((uint8)GET_INTEGER_PARAM(1) != car->AutoPilot.m_nCarMission) { + car->AutoPilot.m_nCarMission = (uint8)GET_INTEGER_PARAM(1); + car->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); + } car->bEngineOn = true; return 0; } case COMMAND_IS_CAR_IN_AREA_2D: { CollectParameters(&m_nIp, 6); - CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(vehicle); - float x1 = *(float*)&ScriptParams[1]; - float y1 = *(float*)&ScriptParams[2]; - float x2 = *(float*)&ScriptParams[3]; - float y2 = *(float*)&ScriptParams[4]; + float x1 = GET_FLOAT_PARAM(1); + float y1 = GET_FLOAT_PARAM(2); + float x2 = GET_FLOAT_PARAM(3); + float y2 = GET_FLOAT_PARAM(4); UpdateCompareFlag(vehicle->IsWithinArea(x1, y1, x2, y2)); - if (ScriptParams[5]) + if (GET_INTEGER_PARAM(5)) CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT); + /* if (CTheScripts::DbgFlag) CTheScripts::DrawDebugSquare(x1, y1, x2, y2); + */ return 0; } case COMMAND_IS_CAR_IN_AREA_3D: { CollectParameters(&m_nIp, 8); - CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* vehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(vehicle); - float x1 = *(float*)&ScriptParams[1]; - float y1 = *(float*)&ScriptParams[2]; - float z1 = *(float*)&ScriptParams[3]; - float x2 = *(float*)&ScriptParams[4]; - float y2 = *(float*)&ScriptParams[5]; - float z2 = *(float*)&ScriptParams[6]; + float x1 = GET_FLOAT_PARAM(1); + float y1 = GET_FLOAT_PARAM(2); + float z1 = GET_FLOAT_PARAM(3); + float x2 = GET_FLOAT_PARAM(4); + float y2 = GET_FLOAT_PARAM(5); + float z2 = GET_FLOAT_PARAM(6); UpdateCompareFlag(vehicle->IsWithinArea(x1, y1, z1, x2, y2, z2)); - if (ScriptParams[7]) + if (GET_INTEGER_PARAM(7)) CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2); + /* if (CTheScripts::DbgFlag) CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2); + */ return 0; } case COMMAND_SPECIAL_0: @@ -4129,72 +4516,72 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) AllowMissionReplay = 1; #endif CollectParameters(&m_nIp, 2); - CMessages::AddBigMessage(key, ScriptParams[0], ScriptParams[1] - 1); + CMessages::AddBigMessage(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1) - 1); return 0; } case COMMAND_PRINT: { wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 2); - CMessages::AddMessage(key, ScriptParams[0], ScriptParams[1]); + CMessages::AddMessage(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; } case COMMAND_PRINT_NOW: { wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 2); - CMessages::AddMessageJumpQ(key, ScriptParams[0], ScriptParams[1]); + CMessages::AddMessageJumpQ(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; } - /* case COMMAND_PRINT_SOON: { wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 2); - CMessages::AddMessageSoon(key, ScriptParams[0], ScriptParams[1]); + CMessages::AddMessageSoon(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; } - */ case COMMAND_CLEAR_PRINTS: CMessages::ClearMessages(); return 0; case COMMAND_GET_TIME_OF_DAY: - ScriptParams[0] = CClock::GetHours(); - ScriptParams[1] = CClock::GetMinutes(); + SET_INTEGER_PARAM(0, CClock::GetHours()); + SET_INTEGER_PARAM(1, CClock::GetMinutes()); StoreParameters(&m_nIp, 2); return 0; case COMMAND_SET_TIME_OF_DAY: CollectParameters(&m_nIp, 2); - CClock::SetGameClock(ScriptParams[0], ScriptParams[1]); + CClock::SetGameClock(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; case COMMAND_GET_MINUTES_TO_TIME_OF_DAY: CollectParameters(&m_nIp, 2); - ScriptParams[0] = CClock::GetGameClockMinutesUntil(ScriptParams[0], ScriptParams[1]); + SET_INTEGER_PARAM(0, CClock::GetGameClockMinutesUntil(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1))); StoreParameters(&m_nIp, 1); return 0; case COMMAND_IS_POINT_ON_SCREEN: { CollectParameters(&m_nIp, 4); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= -100) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - UpdateCompareFlag(TheCamera.IsSphereVisible(pos, *(float*)&ScriptParams[3])); + UpdateCompareFlag(TheCamera.IsSphereVisible(pos, GET_FLOAT_PARAM(3))); return 0; } + /* case COMMAND_DEBUG_ON: CTheScripts::DbgFlag = true; return 0; case COMMAND_DEBUG_OFF: CTheScripts::DbgFlag = false; return 0; - /* + */ case COMMAND_RETURN_TRUE: UpdateCompareFlag(true); + ReturnFromGosubOrFunction(); return 0; case COMMAND_RETURN_FALSE: UpdateCompareFlag(false); + ReturnFromGosubOrFunction(); return 0; - */ //case COMMAND_VAR_INT: default: script_assert(0); @@ -4221,10 +4608,15 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) case COMMAND_WHILE: case COMMAND_WHILENOT: case COMMAND_ENDWHILE: + case COMMAND_214: + case COMMAND_215: + case COMMAND_216: + case COMMAND_217: + case COMMAND_218: */ case COMMAND_ANDOR: CollectParameters(&m_nIp, 1); - m_nAndOrState = ScriptParams[0]; + m_nAndOrState = GET_INTEGER_PARAM(0); if (m_nAndOrState == ANDOR_NONE){ m_bCondResult = false; // pointless }else if (m_nAndOrState >= ANDS_1 && m_nAndOrState <= ANDS_8){ @@ -4240,7 +4632,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) case COMMAND_LAUNCH_MISSION: { CollectParameters(&m_nIp, 1); - CRunningScript* pNew = CTheScripts::StartNewScript(ScriptParams[0]); + CRunningScript* pNew = CTheScripts::StartNewScript(GET_INTEGER_PARAM(0)); pNew->m_bIsMissionScript = true; return 0; } @@ -4254,7 +4646,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) case COMMAND_STORE_CAR_CHAR_IS_IN: { CollectParameters(&m_nIp, 1); - CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* ped = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(ped); CVehicle* pCurrent = nil; if (ped->bInVehicle) { @@ -4299,14 +4691,14 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) break; } } - ScriptParams[0] = CTheScripts::StoreVehicleIndex; + SET_INTEGER_PARAM(0, CTheScripts::StoreVehicleIndex); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_STORE_CAR_PLAYER_IS_IN: { CollectParameters(&m_nIp, 1); - CPed* ped = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* ped = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(ped); if (!ped->bInVehicle) return 0; // No value written to output variable @@ -4350,15 +4742,15 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) break; } } - ScriptParams[0] = CTheScripts::StoreVehicleIndex; + SET_INTEGER_PARAM(0, CTheScripts::StoreVehicleIndex); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_IS_CHAR_IN_CAR: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - CVehicle* pCheckedVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); + CVehicle* pCheckedVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); CVehicle* pActualVehicle = pPed->bInVehicle ? pPed->m_pMyVehicle : nil; UpdateCompareFlag(pActualVehicle && pActualVehicle == pCheckedVehicle); return 0; @@ -4366,51 +4758,51 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) case COMMAND_IS_PLAYER_IN_CAR: { CollectParameters(&m_nIp, 2); - CVehicle* pCheckedVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CVehicle* pCheckedVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle == pCheckedVehicle); return 0; } case COMMAND_IS_CHAR_IN_MODEL: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); CVehicle* pActualVehicle = pPed->bInVehicle ? pPed->m_pMyVehicle : nil; - UpdateCompareFlag(pActualVehicle && pActualVehicle->GetModelIndex() == ScriptParams[1]); + UpdateCompareFlag(pActualVehicle && pActualVehicle->GetModelIndex() == GET_INTEGER_PARAM(1)); return 0; } case COMMAND_IS_PLAYER_IN_MODEL: { CollectParameters(&m_nIp, 2); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetModelIndex() == ScriptParams[1]); + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; + UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->GetModelIndex() == GET_INTEGER_PARAM(1)); return 0; } case COMMAND_IS_CHAR_IN_ANY_CAR: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle); return 0; } case COMMAND_IS_PLAYER_IN_ANY_CAR: { CollectParameters(&m_nIp, 1); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle); return 0; } case COMMAND_IS_BUTTON_PRESSED: { CollectParameters(&m_nIp, 2); - UpdateCompareFlag(GetPadState(ScriptParams[0], ScriptParams[1]) != 0); + UpdateCompareFlag(GetPadState(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)) != 0); return 0; } /* case COMMAND_GET_PAD_STATE: { CollectParameters(&m_nIp, 1); - ScriptParams[0] = GetPadState(ScriptParams[0], ScriptParams[1]); + SET_INTEGER_PARAM(0, GetPadState(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1))); StoreParameters(&m_nIp, 1); return 0; } @@ -4470,10 +4862,10 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) case COMMAND_CREATE_OBJECT: { CollectParameters(&m_nIp, 4); - int mi = ScriptParams[0] >= 0 ? ScriptParams[0] : CTheScripts::UsedObjectArray[-ScriptParams[0]].index; + int mi = GET_INTEGER_PARAM(0) >= 0 ? GET_INTEGER_PARAM(0) : CTheScripts::UsedObjectArray[-GET_INTEGER_PARAM(0)].index; CObject* pObj = new CObject(mi, false); pObj->ObjectCreatedBy = MISSION_OBJECT; - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z += pObj->GetDistanceFromCentreOfMassToBaseOfModel(); @@ -4481,73 +4873,70 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) pObj->SetOrientation(0.0f, 0.0f, 0.0f); pObj->GetMatrix().UpdateRW(); pObj->UpdateRwFrame(); - CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo(mi); - if (pModelInfo->IsBuilding() && ((CSimpleModelInfo*)pModelInfo)->m_isBigBuilding) - pObj->SetupBigBuilding(); CTheScripts::ClearSpaceForMissionEntity(pos, pObj); CWorld::Add(pObj); - ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj); + SET_INTEGER_PARAM(0, CPools::GetObjectPool()->GetIndex(pObj)); StoreParameters(&m_nIp, 1); if (m_bIsMissionScript) - CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT); + CTheScripts::MissionCleanUp.AddEntityToList(GET_INTEGER_PARAM(0), CLEANUP_OBJECT); return 0; } case COMMAND_DELETE_OBJECT: { CollectParameters(&m_nIp, 1); - CObject* pObj = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject* pObj = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); if (pObj){ CWorld::Remove(pObj); CWorld::RemoveReferencesToDeletedObject(pObj); delete pObj; } if (m_bIsMissionScript) - CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT); + CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_OBJECT); return 0; } case COMMAND_ADD_SCORE: CollectParameters(&m_nIp, 2); - CWorld::Players[ScriptParams[0]].m_nMoney += ScriptParams[1]; - if (CWorld::Players[ScriptParams[0]].m_nMoney < 0) - CWorld::Players[ScriptParams[0]].m_nMoney = 0; + CWorld::Players[GET_INTEGER_PARAM(0)].m_nMoney += GET_INTEGER_PARAM(1); + if (CWorld::Players[GET_INTEGER_PARAM(0)].m_nMoney < 0) + CWorld::Players[GET_INTEGER_PARAM(0)].m_nMoney = 0; return 0; case COMMAND_IS_SCORE_GREATER: CollectParameters(&m_nIp, 2); - UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_nMoney > ScriptParams[1]); + UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_nMoney > GET_INTEGER_PARAM(1)); return 0; case COMMAND_STORE_SCORE: CollectParameters(&m_nIp, 1); - ScriptParams[0] = CWorld::Players[ScriptParams[0]].m_nMoney; + SET_INTEGER_PARAM(0, CWorld::Players[GET_INTEGER_PARAM(0)].m_nMoney); StoreParameters(&m_nIp, 1); return 0; case COMMAND_GIVE_REMOTE_CONTROLLED_CAR_TO_PLAYER: { CollectParameters(&m_nIp, 5); - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - CRemote::GivePlayerRemoteControlledCar(pos.x, pos.y, pos.z, DEGTORAD(*(float*)&ScriptParams[4]), MI_RCBANDIT); + CRemote::GivePlayerRemoteControlledCar(pos.x, pos.y, pos.z, DEGTORAD(GET_FLOAT_PARAM(4)), MI_RCBANDIT); return 0; } case COMMAND_ALTER_WANTED_LEVEL: CollectParameters(&m_nIp, 2); - CWorld::Players[ScriptParams[0]].m_pPed->SetWantedLevel(ScriptParams[1]); + CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->SetWantedLevel(GET_INTEGER_PARAM(1)); return 0; case COMMAND_ALTER_WANTED_LEVEL_NO_DROP: CollectParameters(&m_nIp, 2); - CWorld::Players[ScriptParams[0]].m_pPed->SetWantedLevelNoDrop(ScriptParams[1]); + CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->SetWantedLevelNoDrop(GET_INTEGER_PARAM(1)); return 0; case COMMAND_IS_WANTED_LEVEL_GREATER: CollectParameters(&m_nIp, 2); - UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_pPed->m_pWanted->m_nWantedLevel > ScriptParams[1]); + UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->m_pWanted->m_nWantedLevel > GET_INTEGER_PARAM(1)); return 0; case COMMAND_CLEAR_WANTED_LEVEL: CollectParameters(&m_nIp, 1); - CWorld::Players[ScriptParams[0]].m_pPed->SetWantedLevel(0); + CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->SetWantedLevel(0); return 0; case COMMAND_SET_DEATHARREST_STATE: CollectParameters(&m_nIp, 1); - m_bDeatharrestEnabled = (ScriptParams[0] == 1); + m_bDeatharrestEnabled = (GET_INTEGER_PARAM(0) == 1); return 0; case COMMAND_HAS_DEATHARREST_BEEN_EXECUTED: UpdateCompareFlag(m_bDeatharrestExecuted); @@ -4556,51 +4945,54 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) case COMMAND_ADD_AMMO_TO_PLAYER: { CollectParameters(&m_nIp, 3); - CWorld::Players[ScriptParams[0]].m_pPed->GrantAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]); + CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->GrantAmmo((eWeaponType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)); return 0; } */ case COMMAND_ADD_AMMO_TO_CHAR: { CollectParameters(&m_nIp, 3); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - pPed->GrantAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]); + pPed->GrantAmmo((eWeaponType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)); return 0; } //case COMMAND_ADD_AMMO_TO_CAR: - //case COMMAND_IS_PLAYER_STILL_ALIVE: + case COMMAND_IS_PLAYER_STILL_ALIVE: + CollectParameters(&m_nIp, 1); + UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_WBState != WBSTATE_WASTED); + return 0; case COMMAND_IS_PLAYER_DEAD: CollectParameters(&m_nIp, 1); - UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_WBState == WBSTATE_WASTED); + UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_WBState == WBSTATE_WASTED); return 0; case COMMAND_IS_CHAR_DEAD: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - UpdateCompareFlag(!pPed || pPed->DyingOrDead()); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); + UpdateCompareFlag(!pPed || pPed->DyingOrDead() || pPed->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE); return 0; } case COMMAND_IS_CAR_DEAD: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); UpdateCompareFlag(!pVehicle || pVehicle->GetStatus() == STATUS_WRECKED || pVehicle->bIsDrowning); return 0; } case COMMAND_SET_CHAR_THREAT_SEARCH: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - pPed->m_fearFlags |= ScriptParams[1]; + pPed->m_fearFlags |= GET_INTEGER_PARAM(1); return 0; } //case COMMAND_SET_CHAR_THREAT_REACTION: case COMMAND_SET_CHAR_OBJ_NO_OBJ: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); pPed->bScriptObjectiveCompleted = false; pPed->ClearObjective(); @@ -4613,7 +5005,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) case COMMAND_IS_PLAYER_IN_ZONE: { CollectParameters(&m_nIp, 1); - CPlayerInfo* pPlayer = &CWorld::Players[ScriptParams[0]]; + CPlayerInfo* pPlayer = &CWorld::Players[GET_INTEGER_PARAM(0)]; char label[12]; CTheScripts::ReadTextLabelFromScript(&m_nIp, label); int zoneToCheck = CTheZones::FindZoneByLabelAndReturnIndex(label, ZONE_DEFAULT); @@ -4626,15 +5018,15 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) } case COMMAND_IS_PLAYER_PRESSING_HORN: CollectParameters(&m_nIp, 1); - UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_pPed->GetPedState() == PED_DRIVING && - CPad::GetPad(ScriptParams[0])->GetHorn()); + UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed->GetPedState() == PED_DRIVING && + CPad::GetPad(GET_INTEGER_PARAM(0))->GetHorn()); return 0; case COMMAND_HAS_CHAR_SPOTTED_PLAYER: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - UpdateCompareFlag(pPed->OurPedCanSeeThisOne(CWorld::Players[ScriptParams[1]].m_pPed)); + UpdateCompareFlag(pPed->OurPedCanSeeThisOne(CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed)); return 0; } //case COMMAND_ORDER_CHAR_TO_BACKDOOR: @@ -4642,7 +5034,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) case COMMAND_IS_CHAR_OBJECTIVE_PASSED: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); UpdateCompareFlag(pPed->bScriptObjectiveCompleted); return 0; @@ -4654,43 +5046,43 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) case COMMAND_CREATE_CHAR_INSIDE_CAR: { CollectParameters(&m_nIp, 3); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - switch (ScriptParams[2]) { + switch (GET_INTEGER_PARAM(2)) { case MI_COP: - if (ScriptParams[1] == PEDTYPE_COP) - ScriptParams[2] = COP_STREET; + if (GET_INTEGER_PARAM(1) == PEDTYPE_COP) + SET_INTEGER_PARAM(2, COP_STREET); break; case MI_SWAT: - if (ScriptParams[1] == PEDTYPE_COP) - ScriptParams[2] = COP_SWAT; + if (GET_INTEGER_PARAM(1) == PEDTYPE_COP) + SET_INTEGER_PARAM(2, COP_SWAT); break; case MI_FBI: - if (ScriptParams[1] == PEDTYPE_COP) - ScriptParams[2] = COP_FBI; + if (GET_INTEGER_PARAM(1) == PEDTYPE_COP) + SET_INTEGER_PARAM(2, COP_FBI); break; case MI_ARMY: - if (ScriptParams[1] == PEDTYPE_COP) - ScriptParams[2] = COP_ARMY; + if (GET_INTEGER_PARAM(1) == PEDTYPE_COP) + SET_INTEGER_PARAM(2, COP_ARMY); break; case MI_MEDIC: - if (ScriptParams[1] == PEDTYPE_EMERGENCY) - ScriptParams[2] = PEDTYPE_EMERGENCY; + if (GET_INTEGER_PARAM(1) == PEDTYPE_EMERGENCY) + SET_INTEGER_PARAM(2, PEDTYPE_EMERGENCY); break; case MI_FIREMAN: - if (ScriptParams[1] == PEDTYPE_FIREMAN) - ScriptParams[2] = PEDTYPE_FIREMAN; + if (GET_INTEGER_PARAM(1) == PEDTYPE_FIREMAN) + SET_INTEGER_PARAM(2, PEDTYPE_FIREMAN); break; default: break; } CPed* pPed; - if (ScriptParams[1] == PEDTYPE_COP) - pPed = new CCopPed((eCopType)ScriptParams[2]); - else if (ScriptParams[1] == PEDTYPE_EMERGENCY || ScriptParams[1] == PEDTYPE_FIREMAN) - pPed = new CEmergencyPed(ScriptParams[2]); + if (GET_INTEGER_PARAM(1) == PEDTYPE_COP) + pPed = new CCopPed((eCopType)GET_INTEGER_PARAM(2)); + else if (GET_INTEGER_PARAM(1) == PEDTYPE_EMERGENCY || GET_INTEGER_PARAM(1) == PEDTYPE_FIREMAN) + pPed = new CEmergencyPed(GET_INTEGER_PARAM(2)); else - pPed = new CCivilianPed((ePedType)ScriptParams[1], ScriptParams[2]); + pPed = new CCivilianPed((ePedType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)); pPed->CharCreatedBy = MISSION_CHAR; pPed->bRespondsToThreats = false; pPed->bAllowMedicsToReviveMe = false; @@ -4700,7 +5092,6 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) pPed->SetPosition(pVehicle->GetPosition()); pPed->SetOrientation(0.0f, 0.0f, 0.0f); pPed->SetPedState(PED_DRIVING); - CPopulation::ms_nTotalMissionPeds++; script_assert(!pVehicle->pDriver); pVehicle->pDriver = pPed; pVehicle->pDriver->RegisterReference((CEntity**)&pVehicle->pDriver); @@ -4715,17 +5106,18 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) pPed->AddInCarAnims(pVehicle, true); pPed->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pPed->GetPosition()); CWorld::Add(pPed); - ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed); + CPopulation::ms_nTotalMissionPeds++; + SET_INTEGER_PARAM(0, CPools::GetPedPool()->GetIndex(pPed)); StoreParameters(&m_nIp, 1); if (m_bIsMissionScript) - CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR); + CTheScripts::MissionCleanUp.AddEntityToList(GET_INTEGER_PARAM(0), CLEANUP_CHAR); return 0; } case COMMAND_WARP_PLAYER_FROM_CAR_TO_COORD: { CollectParameters(&m_nIp, 4); - CVector pos = *(CVector*)&ScriptParams[1]; - CPlayerInfo* pPlayer = &CWorld::Players[ScriptParams[0]]; + CVector pos = GET_VECTOR_PARAM(1); + CPlayerInfo* pPlayer = &CWorld::Players[GET_INTEGER_PARAM(0)]; if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); if (pPlayer->m_pPed->bInVehicle){ @@ -4768,6 +5160,24 @@ int8 CRunningScript::ProcessCommands200To299(int32 command) return -1; } +void CRunningScript::ReturnFromGosubOrFunction() +{ + uint32 val = m_nIp = m_anStack[--m_nStackPointer]; + if (!(m_nIp & BIT(STACKVALUE_IS_FUNCTION_CALL_BIT))) + return; + if (m_nIp & BIT(STACKVALUE_INVERT_RETURN_BIT)) + m_bCondResult = !m_bCondResult; + m_nIp = m_nIp & STACKVALUE_IP_MASK; + uint8 nInputParameters = CTheScripts::Read1ByteFromScript(&m_nIp); + uint8 nOutputParameters = CTheScripts::Read1ByteFromScript(&m_nIp); + uint8 nLocalsOffset = CTheScripts::Read1ByteFromScript(&m_nIp); + for (int i = 0; i < nOutputParameters; i++) + ScriptParams[i] = m_anLocalVariables[m_nLocalsPointer + nInputParameters]; + m_nIp += val >> STACKVALUE_IP_PARAMS_OFFSET; + m_nLocalsPointer -= nLocalsOffset; + StoreParameters(&m_nIp, nOutputParameters); +} + #ifdef MISSION_REPLAY bool CRunningScript::CanAllowMissionReplay() @@ -4848,9 +5258,9 @@ CTheScripts::SwitchToMission(int32 mission) int handle = CFileMgr::OpenFile("data\\main.scm", "rb"); #endif CFileMgr::Seek(handle, offset, 0); - CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[SIZE_MAIN_SCRIPT], SIZE_MISSION_SCRIPT); + CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], CTheScripts::MainScriptSize); CFileMgr::CloseFile(handle); - CRunningScript* pMissionScript = CTheScripts::StartNewScript(SIZE_MAIN_SCRIPT); + CRunningScript* pMissionScript = CTheScripts::StartNewScript(CTheScripts::MainScriptSize); CTimer::Resume(); pMissionScript->m_bIsMissionScript = true; pMissionScript->m_bMissionFlag = true; diff --git a/src/control/Script.h b/src/control/Script.h index aafc681c..60902563 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -30,9 +30,9 @@ void FlushLog(); #define UPSIDEDOWN_TURN_SPEED_THRESHOLD (0.02f) #define UPSIDEDOWN_TIMER_THRESHOLD (1000) -#define SPHERE_MARKER_R (252) -#define SPHERE_MARKER_G (138) -#define SPHERE_MARKER_B (242) +#define SPHERE_MARKER_R (255) +#define SPHERE_MARKER_G (255) +#define SPHERE_MARKER_B (128) #define SPHERE_MARKER_A (228) #define SPHERE_MARKER_PULSE_PERIOD 2048 #define SPHERE_MARKER_PULSE_FRACTION 0.1f @@ -47,7 +47,15 @@ void FlushLog(); #define KEY_LENGTH_IN_SCRIPT (8) -//#define GTA_SCRIPT_COLLECTIVE +#define GET_INTEGER_PARAM(i) (ScriptParams[i]) +#define GET_FLOAT_PARAM(i) (*(float*)&ScriptParams[i]) +#define GET_VECTOR_PARAM(i) (CVector(GET_FLOAT_PARAM(i), GET_FLOAT_PARAM(i+1), GET_FLOAT_PARAM(i+2))) + +#define SET_INTEGER_PARAM(i, x) ScriptParams[i] = x +#define SET_FLOAT_PARAM(i, x) *(float*)&ScriptParams[i] = x +#define SET_VECTOR_PARAM(i, v) { *(float*)&ScriptParams[i] = (v).x; *(float*)&ScriptParams[i+1] = (v).y; *(float*)&ScriptParams[i+2] = (v).z; } + +#define GTA_SCRIPT_COLLECTIVE struct intro_script_rectangle { @@ -215,15 +223,33 @@ public: }; enum { + MAX_STACK_DEPTH = 16, + NUM_LOCAL_VARS = 96, + NUM_TIMERS = 2, + NUM_GLOBAL_SLOTS = 26 +}; + +enum { ARGUMENT_END = 0, + ARGUMENT_INT_ZERO, + ARGUMENT_FLOAT_ZERO, + ARGUMENT_FLOAT_1BYTE, + ARGUMENT_FLOAT_2BYTES, + ARGUMENT_FLOAT_3BYTES, ARGUMENT_INT32, - ARGUMENT_GLOBALVAR, - ARGUMENT_LOCALVAR, ARGUMENT_INT8, ARGUMENT_INT16, - ARGUMENT_FLOAT + ARGUMENT_FLOAT, + ARGUMENT_TIMER, + ARGUMENT_LOCAL = ARGUMENT_TIMER + NUM_TIMERS, + ARGUMENT_LOCAL_ARRAY = ARGUMENT_LOCAL + NUM_LOCAL_VARS, + ARGUMENT_GLOBAL = ARGUMENT_LOCAL_ARRAY + NUM_LOCAL_VARS, + ARGUMENT_GLOBAL_ARRAY = ARGUMENT_GLOBAL + NUM_GLOBAL_SLOTS, + MAX_ARGUMENT = ARGUMENT_GLOBAL_ARRAY + NUM_GLOBAL_SLOTS }; +static_assert(MAX_ARGUMENT <= 256, "MAX_ARGUMENT must be less or equal to 256"); + struct tCollectiveData { int32 colIndex; @@ -254,37 +280,30 @@ enum { }; enum { -#ifdef PS2 - SIZE_MAIN_SCRIPT = 205512, -#else - SIZE_MAIN_SCRIPT = 225512, -#endif - SIZE_MISSION_SCRIPT = 35000, - SIZE_SCRIPT_SPACE = SIZE_MAIN_SCRIPT + SIZE_MISSION_SCRIPT -}; - -enum { MAX_NUM_SCRIPTS = 128, MAX_NUM_INTRO_TEXT_LINES = 48, MAX_NUM_INTRO_RECTANGLES = 16, MAX_NUM_SCRIPT_SRPITES = 16, MAX_NUM_SCRIPT_SPHERES = 16, - MAX_NUM_USED_OBJECTS = 220, - MAX_NUM_MISSION_SCRIPTS = 120, - MAX_NUM_BUILDING_SWAPS = 25, - MAX_NUM_INVISIBILITY_SETTINGS = 20, - MAX_NUM_STORED_LINES = 1024 + MAX_NUM_COLLECTIVES = 32, + MAX_NUM_USED_OBJECTS = 305, + MAX_NUM_MISSION_SCRIPTS = 150, + MAX_NUM_BUILDING_SWAPS = 80, + MAX_NUM_INVISIBILITY_SETTINGS = 52, + MAX_NUM_STORED_LINES = 1024, + MAX_ALLOWED_COLLISIONS = 2 }; class CTheScripts { public: - static uint8 ScriptSpace[SIZE_SCRIPT_SPACE]; + static uint8* ScriptSpace; static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS]; static intro_text_line IntroTextLines[MAX_NUM_INTRO_TEXT_LINES]; static intro_script_rectangle IntroRectangles[MAX_NUM_INTRO_RECTANGLES]; static CSprite2d ScriptSprites[MAX_NUM_SCRIPT_SRPITES]; static script_sphere_struct ScriptSphereArray[MAX_NUM_SCRIPT_SPHERES]; + static tCollectiveData CollectiveArray[MAX_NUM_COLLECTIVES]; static tUsedObject UsedObjectArray[MAX_NUM_USED_OBJECTS]; static int32 MultiScriptArray[MAX_NUM_MISSION_SCRIPTS]; static tBuildingSwap BuildingSwapArray[MAX_NUM_BUILDING_SWAPS]; @@ -316,20 +335,22 @@ public: static uint16 ScriptsUpdated; static uint32 LastMissionPassedTime; static uint16 NumberOfExclusiveMissionScripts; -#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) -#define CARDS_IN_SUIT (13) -#define NUM_SUITS (4) -#define MAX_DECKS (6) -#define CARDS_IN_DECK (CARDS_IN_SUIT * NUM_SUITS) -#define CARDS_IN_STACK (CARDS_IN_DECK * MAX_DECKS) - static int16 CardStack[CARDS_IN_STACK]; - static int16 CardStackPosition; -#endif + static bool bPlayerIsInTheStatium; static uint8 RiotIntensity; static bool bPlayerHasMetDebbieHarry; - static void Init(); + static int AllowedCollision[MAX_ALLOWED_COLLISIONS]; + static short* SavedVarIndices; + static int NumSaveVars; + static bool FSDestroyedFlag; + static int NextProcessId; + static bool InTheScripts; + static CRunningScript* pCurrent; + static uint16 NumTrueGlobals; + static uint16 MostGlobals; + + static bool Init(bool loaddata = false); static void Process(); static CRunningScript* StartTestScript(); @@ -420,6 +441,9 @@ public: static void SwitchToMission(int32 mission); #endif + static int GetSaveVarIndex(int); + static void Shutdown(void); + #ifdef GTA_SCRIPT_COLLECTIVE static void AdvanceCollectiveIndex() { @@ -441,12 +465,9 @@ public: }; +extern int ScriptParams[32]; -enum { - MAX_STACK_DEPTH = 6, - NUM_LOCAL_VARS = 16, - NUM_TIMERS = 2 -}; +VALIDATE_SIZE(uStackReturnValue, 4); class CRunningScript { @@ -470,14 +491,25 @@ class CRunningScript ORS_8 }; + enum { + STACKVALUE_IP_BITS = 22, + STACKVALUE_INVERT_RETURN_BIT = STACKVALUE_IP_BITS, + STACKVALUE_IS_FUNCTION_CALL_BIT, + STACKVALUE_IP_PARAMS_OFFSET, + + STACKVALUE_IP_MASK = ((1 << STACKVALUE_IP_BITS) - 1) + }; + public: CRunningScript* next; CRunningScript* prev; + int m_nId; char m_abScriptName[8]; uint32 m_nIp; uint32 m_anStack[MAX_STACK_DEPTH]; uint16 m_nStackPointer; - int32 m_anLocalVariables[NUM_LOCAL_VARS + NUM_TIMERS]; + int32 m_anLocalVariables[NUM_LOCAL_VARS + 8 + NUM_TIMERS]; // TODO(LCS): figure out why 106 + int32 m_nLocalsPointer; bool m_bIsActive; bool m_bCondResult; bool m_bIsMissionScript; @@ -497,8 +529,8 @@ public: void Load(uint8*& buf); void UpdateTimers(float timeStep) { - m_anLocalVariables[NUM_LOCAL_VARS] += timeStep; - m_anLocalVariables[NUM_LOCAL_VARS + 1] += timeStep; + for (int i = 0; i < NUM_TIMERS; i++) + m_anLocalVariables[NUM_LOCAL_VARS + 8 + i] += timeStep; } void Init(); @@ -509,7 +541,7 @@ public: static const uint32 nSaveStructSize; - void CollectParameters(uint32*, int16); + void CollectParameters(uint32*, int16, int* pParams = (int*)&ScriptParams); int32 CollectNextParameterWithoutIncreasingPC(uint32); int32* GetPointerToScriptVariable(uint32*, int16); void StoreParameters(uint32*, int16); @@ -534,6 +566,8 @@ public: int8 ProcessCommands1200To1299(int32); int8 ProcessCommands1300To1399(int32); int8 ProcessCommands1400To1499(int32); + int8 ProcessCommands1500To1599(int32); + int8 ProcessCommands1600To1699(int32); void LocatePlayerCommand(int32, uint32*); void LocatePlayerCharCommand(int32, uint32*); @@ -571,11 +605,11 @@ public: float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; } bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal); - - bool CheckDamagedWeaponType(int32 actual, int32 type); - + bool CheckDamagedWeaponType(int32 actual, int32 type); static bool ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami); + void ReturnFromGosubOrFunction(); + }; #ifdef USE_DEBUG_SCRIPT_LOADER @@ -600,3 +634,6 @@ void RetryMission(int, int); #ifdef USE_DEBUG_SCRIPT_LOADER extern int scriptToLoad; #endif + +extern int gScriptsFile; + diff --git a/src/control/Script2.cpp b/src/control/Script2.cpp index a94bf907..5cac2bfd 100644 --- a/src/control/Script2.cpp +++ b/src/control/Script2.cpp @@ -28,6 +28,8 @@ #include "World.h" #include "Zones.h" +// LCS: file done except TODOs + int8 CRunningScript::ProcessCommands300To399(int32 command) { switch (command) { @@ -35,12 +37,10 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) //case COMMAND_SET_PLAYER_INVINCIBLE: //case COMMAND_SET_CHAR_GRAPHIC_TYPE: //case COMMAND_SET_PLAYER_GRAPHIC_TYPE: - /* case COMMAND_HAS_PLAYER_BEEN_ARRESTED: CollectParameters(&m_nIp, 1); - UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_WBState == WBSTATE_BUSTED); + UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_WBState == WBSTATE_BUSTED); return 0; - */ //case COMMAND_STOP_CHAR_DRIVING: //case COMMAND_KILL_CHAR: //case COMMAND_SET_FAVOURITE_CAR_MODEL_FOR_CHAR: @@ -49,25 +49,25 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_CHANGE_CAR_LOCK: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - pVehicle->m_nDoorLock = (eCarLock)ScriptParams[1]; + pVehicle->m_nDoorLock = (eCarLock)GET_INTEGER_PARAM(1); return 0; } case COMMAND_SHAKE_CAM_WITH_POINT: CollectParameters(&m_nIp, 4); - TheCamera.CamShake(ScriptParams[0] / 1000.0f, - *(float*)&ScriptParams[1], - *(float*)&ScriptParams[2], - *(float*)&ScriptParams[3]); + TheCamera.CamShake(GET_INTEGER_PARAM(0) / 1000.0f, + GET_FLOAT_PARAM(1), + GET_FLOAT_PARAM(2), + GET_FLOAT_PARAM(3)); return 0; */ case COMMAND_IS_CAR_MODEL: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - UpdateCompareFlag(pVehicle->GetModelIndex() == ScriptParams[1]); + UpdateCompareFlag(pVehicle->GetModelIndex() == GET_INTEGER_PARAM(1)); return 0; } //case COMMAND_IS_CAR_REMAP: @@ -77,15 +77,15 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_IS_CAR_DEAD_IN_AREA_2D: { CollectParameters(&m_nIp, 6); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - float x1 = *(float*)&ScriptParams[1]; - float y1 = *(float*)&ScriptParams[2]; - float x2 = *(float*)&ScriptParams[3]; - float y2 = *(float*)&ScriptParams[4]; + float x1 = GET_FLOAT_PARAM(1); + float y1 = GET_FLOAT_PARAM(2); + float x2 = GET_FLOAT_PARAM(3); + float y2 = GET_FLOAT_PARAM(4); UpdateCompareFlag(pVehicle->GetStatus() == STATUS_WRECKED && pVehicle->IsWithinArea(x1, y1, x2, y2)); - if (ScriptParams[5]) + if (GET_INTEGER_PARAM(5)) CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT); if (CTheScripts::DbgFlag) CTheScripts::DrawDebugSquare(x1, y1, x2, y2); @@ -94,17 +94,17 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_IS_CAR_DEAD_IN_AREA_3D: { CollectParameters(&m_nIp, 8); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - float x1 = *(float*)&ScriptParams[1]; - float y1 = *(float*)&ScriptParams[2]; - float z1 = *(float*)&ScriptParams[3]; - float x2 = *(float*)&ScriptParams[4]; - float y2 = *(float*)&ScriptParams[5]; - float z2 = *(float*)&ScriptParams[6]; + float x1 = GET_FLOAT_PARAM(1); + float y1 = GET_FLOAT_PARAM(2); + float z1 = GET_FLOAT_PARAM(3); + float x2 = GET_FLOAT_PARAM(4); + float y2 = GET_FLOAT_PARAM(5); + float z2 = GET_FLOAT_PARAM(6); UpdateCompareFlag(pVehicle->GetStatus() == STATUS_WRECKED && pVehicle->IsWithinArea(x1, y1, z1, x2, y2, z2)); - if (ScriptParams[7]) + if (GET_INTEGER_PARAM(7)) CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, (z1 + z2) / 2); if (CTheScripts::DbgFlag) CTheScripts::DrawDebugCube(x1, y1, z1, x2, y2, z2); @@ -121,38 +121,45 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) //case COMMAND_SET_CAR_FLAMEPROOF: //case COMMAND_SET_CAR_ROCKETPROOF: //case COMMAND_IS_CARBOMB_ACTIVE: - //case COMMAND_GIVE_CAR_ALARM: + case COMMAND_GIVE_CAR_ALARM: + { + CollectParameters(&m_nIp, 1); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pVehicle); + pVehicle->m_nAlarmState = -1; + return 0; + } //case COMMAND_PUT_CAR_ON_TRAILER: - /* case COMMAND_IS_CAR_CRUSHED: CollectParameters(&m_nIp, 1); - UpdateCompareFlag(CGarages::HasCarBeenCrushed(ScriptParams[0])); + UpdateCompareFlag(CGarages::HasCarBeenCrushed(GET_INTEGER_PARAM(0))); return 0; - */ - //case COMMAND_CREATE_GANG_CAR: + //case COMMAND_CREATE_GANG_CAR: case COMMAND_CREATE_CAR_GENERATOR: { CollectParameters(&m_nIp, 12); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z > MAP_Z_LOW_LIMIT) pos.z += 0.015f; - ScriptParams[0] = CTheCarGenerators::CreateCarGenerator( - pos.x, pos.y, pos.z, *(float*)&ScriptParams[3], - ScriptParams[4], ScriptParams[5], ScriptParams[6], ScriptParams[7], - ScriptParams[8], ScriptParams[9], ScriptParams[10], ScriptParams[11]); + SET_INTEGER_PARAM(0, CTheCarGenerators::CreateCarGenerator( + pos.x, pos.y, pos.z, GET_FLOAT_PARAM(3), + GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), + GET_INTEGER_PARAM(8), GET_INTEGER_PARAM(9), GET_INTEGER_PARAM(10), GET_INTEGER_PARAM(11))); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_SWITCH_CAR_GENERATOR: { CollectParameters(&m_nIp, 2); - CCarGenerator* pCarGen = &CTheCarGenerators::CarGeneratorArray[ScriptParams[0]]; - if (ScriptParams[1] == 0){ + CCarGenerator* pCarGen = &CTheCarGenerators::CarGeneratorArray[GET_INTEGER_PARAM(0)]; + if (GET_INTEGER_PARAM(1) == 0) { pCarGen->SwitchOff(); - }else if (ScriptParams[1] <= 100){ + } + else if (GET_INTEGER_PARAM(1) <= 100) { pCarGen->SwitchOn(); - pCarGen->SetUsesRemaining(ScriptParams[1]); - }else{ + pCarGen->SetUsesRemaining(GET_INTEGER_PARAM(1)); + } + else { pCarGen->SwitchOn(); } return 0; @@ -162,40 +169,34 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 3); - CUserDisplay::Pager.AddMessage(text, ScriptParams[0], ScriptParams[1], ScriptParams[2]); + CUserDisplay::Pager.AddMessage(text, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)); return 0; } */ case COMMAND_DISPLAY_ONSCREEN_TIMER: { - script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR); - m_nIp++; - uint16 offset = CTheScripts::Read2BytesFromScript(&m_nIp); + uint16 offset = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace; CollectParameters(&m_nIp, 1); - CUserDisplay::OnscnTimer.AddClock(offset, nil, ScriptParams[0] != 0); + CUserDisplay::OnscnTimer.AddClock(offset, nil, GET_INTEGER_PARAM(0) != 0); return 0; } case COMMAND_CLEAR_ONSCREEN_TIMER: { - script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR); - m_nIp++; - CUserDisplay::OnscnTimer.ClearClock((uint16)CTheScripts::Read2BytesFromScript(&m_nIp)); + uint16 offset = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace; + CUserDisplay::OnscnTimer.ClearClock(offset); return 0; } case COMMAND_DISPLAY_ONSCREEN_COUNTER: { - script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR); - m_nIp++; - int16 counter = CTheScripts::Read2BytesFromScript(&m_nIp); + uint16 counter = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace; CollectParameters(&m_nIp, 1); - CUserDisplay::OnscnTimer.AddCounter(counter, ScriptParams[0], nil, 0); + CUserDisplay::OnscnTimer.AddCounter(counter, GET_INTEGER_PARAM(0), nil, 0); return 0; } case COMMAND_CLEAR_ONSCREEN_COUNTER: { - script_assert(CTheScripts::ScriptSpace[m_nIp] == ARGUMENT_GLOBALVAR); - m_nIp++; - CUserDisplay::OnscnTimer.ClearCounter((uint16)CTheScripts::Read2BytesFromScript(&m_nIp)); + uint16 counter = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace; + CUserDisplay::OnscnTimer.ClearCounter(counter); return 0; } case COMMAND_SET_ZONE_CAR_INFO: @@ -219,7 +220,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) return 0; } while (zone >= 0) { - CTheZones::SetZoneCarInfo(zone, ScriptParams[0], ScriptParams[1], ScriptParams[11], gangDensities); + CTheZones::SetZoneCarInfo(zone, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(11), gangDensities); zone = CTheZones::FindNextZoneByLabelAndReturnIndex(label, ZONE_INFO); } return 0; @@ -228,7 +229,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_IS_CHAR_IN_ZONE: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); char label[12]; CTheScripts::ReadTextLabelFromScript(&m_nIp, label); @@ -239,39 +240,70 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) UpdateCompareFlag(CTheZones::PointLiesWithinZone(&pos, CTheZones::GetNavigationZone(zone))); return 0; } - //case COMMAND_SET_CAR_DENSITY: - //case COMMAND_SET_PED_DENSITY: + case COMMAND_SET_CAR_DENSITY: + { + char label[12]; + CTheScripts::ReadTextLabelFromScript(&m_nIp, label); + int16 zone = CTheZones::FindZoneByLabelAndReturnIndex(label, ZONE_INFO); + m_nIp += 8; + CollectParameters(&m_nIp, 2); + if (zone < 0) { + debug("Couldn't find zone - %s\n", label); + return 0; + } + while (zone >= 0) { + CTheZones::SetCarDensity(zone, ScriptParams[0], ScriptParams[1]); + zone = CTheZones::FindNextZoneByLabelAndReturnIndex(label, ZONE_INFO); + } + return 0; + } + case COMMAND_SET_PED_DENSITY: + { + char label[12]; + CTheScripts::ReadTextLabelFromScript(&m_nIp, label); + int16 zone = CTheZones::FindZoneByLabelAndReturnIndex(label, ZONE_INFO); + m_nIp += KEY_LENGTH_IN_SCRIPT; + CollectParameters(&m_nIp, 2); + if (zone < 0) { + debug("Couldn't find zone - %s\n", label); + return 0; + } + while (zone >= 0) { + CTheZones::SetPedDensity(zone, ScriptParams[0], ScriptParams[1]); + zone = CTheZones::FindNextZoneByLabelAndReturnIndex(label, ZONE_INFO); + } + return 0; + } case COMMAND_POINT_CAMERA_AT_PLAYER: { CollectParameters(&m_nIp, 3); - // ScriptParams[0] is unused. - TheCamera.TakeControl(nil, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT); + TheCamera.TakeControl(nil, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), CAMCONTROL_SCRIPT); return 0; } case COMMAND_POINT_CAMERA_AT_CAR: { CollectParameters(&m_nIp, 3); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); if (pVehicle) - TheCamera.TakeControl(pVehicle, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT); + TheCamera.TakeControl(pVehicle, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), CAMCONTROL_SCRIPT); return 0; } case COMMAND_POINT_CAMERA_AT_CHAR: { CollectParameters(&m_nIp, 3); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); if (pPed) - TheCamera.TakeControl(pPed, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT); + TheCamera.TakeControl(pPed, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), CAMCONTROL_SCRIPT); return 0; } case COMMAND_RESTORE_CAMERA: TheCamera.Restore(); return 0; - /* - case COMMAND_SHAKE_PAD: - CPad::GetPad(ScriptParams[0])->StartShake(ScriptParams[1], ScriptParams[2]); - return 0; - */ + /* + case COMMAND_SHAKE_PAD: + CPad::GetPad(GET_INTEGER_PARAM(0))->StartShake(GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)); + return 0; + */ case COMMAND_SET_ZONE_PED_INFO: { char label[12]; @@ -284,61 +316,61 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) return 0; } while (zone >= 0) { - CTheZones::SetZonePedInfo(zone, ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], - ScriptParams[4], ScriptParams[5], ScriptParams[6], ScriptParams[7], ScriptParams[8], ScriptParams[9], ScriptParams[10], ScriptParams[11]); + CTheZones::SetZonePedInfo(zone, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), + GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), GET_INTEGER_PARAM(8), GET_INTEGER_PARAM(9), GET_INTEGER_PARAM(10), GET_INTEGER_PARAM(11)); zone = CTheZones::FindNextZoneByLabelAndReturnIndex(label, ZONE_INFO); } return 0; } case COMMAND_SET_TIME_SCALE: CollectParameters(&m_nIp, 1); - CTimer::SetTimeScale(*(float*)&ScriptParams[0]); - return 0; - /* - case COMMAND_IS_CAR_IN_AIR: - { - CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - script_assert(pVehicle && pVehicle->IsCar()); - CAutomobile* pCar = (CAutomobile*)pVehicle; - UpdateCompareFlag(pCar->GetAllWheelsOffGround()); - return 0; - } - */ + CTimer::SetTimeScale(GET_FLOAT_PARAM(0)); + return 0; + /* + case COMMAND_IS_CAR_IN_AIR: + { + CollectParameters(&m_nIp, 1); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + script_assert(pVehicle && pVehicle->IsCar()); + CAutomobile* pCar = (CAutomobile*)pVehicle; + UpdateCompareFlag(pCar->GetAllWheelsOffGround()); + return 0; + } + */ case COMMAND_SET_FIXED_CAMERA_POSITION: { CollectParameters(&m_nIp, 6); TheCamera.SetCamPositionForFixedMode( - CVector(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1], *(float*)&ScriptParams[2]), - CVector(*(float*)&ScriptParams[3], *(float*)&ScriptParams[4], *(float*)&ScriptParams[5])); + CVector(GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1), GET_FLOAT_PARAM(2)), + CVector(GET_FLOAT_PARAM(3), GET_FLOAT_PARAM(4), GET_FLOAT_PARAM(5))); return 0; } case COMMAND_POINT_CAMERA_AT_POINT: { CollectParameters(&m_nIp, 4); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - TheCamera.TakeControlNoEntity(pos, ScriptParams[3], CAMCONTROL_SCRIPT); + TheCamera.TakeControlNoEntity(pos, GET_INTEGER_PARAM(3), CAMCONTROL_SCRIPT); return 0; } case COMMAND_ADD_BLIP_FOR_CAR_OLD: { CollectParameters(&m_nIp, 3); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - ScriptParams[0] = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]); + SET_INTEGER_PARAM(0, CRadar::SetEntityBlip(BLIP_CAR, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), (eBlipDisplay)GET_INTEGER_PARAM(2))); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_ADD_BLIP_FOR_CHAR_OLD: { CollectParameters(&m_nIp, 3); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - ScriptParams[0] = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]); + SET_INTEGER_PARAM(0, CRadar::SetEntityBlip(BLIP_CHAR, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), (eBlipDisplay)GET_INTEGER_PARAM(2))); StoreParameters(&m_nIp, 1); return 0; } @@ -346,57 +378,61 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_ADD_BLIP_FOR_OBJECT_OLD: { CollectParameters(&m_nIp, 3); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pObject); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - ScriptParams[0] = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], ScriptParams[1], (eBlipDisplay)ScriptParams[2]); + SET_INTEGER_PARAM(0, CRadar::SetEntityBlip(BLIP_OBJECT, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), (eBlipDisplay)GET_INTEGER_PARAM(2))); StoreParameters(&m_nIp, 1); return 0; } */ case COMMAND_REMOVE_BLIP: CollectParameters(&m_nIp, 1); - CRadar::ClearBlip(ScriptParams[0]); + CRadar::ClearBlip(GET_INTEGER_PARAM(0)); return 0; case COMMAND_CHANGE_BLIP_COLOUR: CollectParameters(&m_nIp, 2); - CRadar::ChangeBlipColour(ScriptParams[0], ScriptParams[1]); + CRadar::ChangeBlipColour(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; case COMMAND_DIM_BLIP: CollectParameters(&m_nIp, 2); - CRadar::ChangeBlipBrightness(ScriptParams[0], ScriptParams[1]); + CRadar::ChangeBlipBrightness(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; case COMMAND_ADD_BLIP_FOR_COORD_OLD: { CollectParameters(&m_nIp, 5); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - ScriptParams[0] = CRadar::SetCoordBlip(BLIP_COORD, pos, ScriptParams[3], (eBlipDisplay)ScriptParams[4]); + SET_INTEGER_PARAM(0, CRadar::SetCoordBlip(BLIP_COORD, pos, GET_INTEGER_PARAM(3), (eBlipDisplay)GET_INTEGER_PARAM(4))); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_CHANGE_BLIP_SCALE: CollectParameters(&m_nIp, 2); - CRadar::ChangeBlipScale(ScriptParams[0], ScriptParams[1]); + CRadar::ChangeBlipScale(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; case COMMAND_SET_FADING_COLOUR: CollectParameters(&m_nIp, 3); - TheCamera.SetFadeColour(ScriptParams[0], ScriptParams[1], ScriptParams[2]); + TheCamera.SetFadeColour(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)); return 0; case COMMAND_DO_FADE: + { + // unknown empty call on PS2, not mobile CollectParameters(&m_nIp, 2); - TheCamera.Fade(ScriptParams[0] / 1000.0f, ScriptParams[1]); + float fFadeTime = GET_INTEGER_PARAM(0); + TheCamera.Fade(fFadeTime > 2 ? fFadeTime / 1000.0f : 0.0f, GET_INTEGER_PARAM(1)); return 0; + } case COMMAND_GET_FADING_STATUS: UpdateCompareFlag(TheCamera.GetFading()); return 0; case COMMAND_ADD_HOSPITAL_RESTART: { CollectParameters(&m_nIp, 4); - CVector pos = *(CVector*)&ScriptParams[0]; - float angle = *(float*)&ScriptParams[3]; + CVector pos = GET_VECTOR_PARAM(0); + float angle = GET_FLOAT_PARAM(3); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CRestart::AddHospitalRestartPoint(pos, angle); @@ -405,8 +441,8 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_ADD_POLICE_RESTART: { CollectParameters(&m_nIp, 4); - CVector pos = *(CVector*)&ScriptParams[0]; - float angle = *(float*)&ScriptParams[3]; + CVector pos = GET_VECTOR_PARAM(0); + float angle = GET_FLOAT_PARAM(3); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CRestart::AddPoliceRestartPoint(pos, angle); @@ -415,8 +451,8 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_OVERRIDE_NEXT_RESTART: { CollectParameters(&m_nIp, 4); - CVector pos = *(CVector*)&ScriptParams[0]; - float angle = *(float*)&ScriptParams[3]; + CVector pos = GET_VECTOR_PARAM(0); + float angle = GET_FLOAT_PARAM(3); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CRestart::OverrideNextRestart(pos, angle); @@ -426,9 +462,9 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_DRAW_SHADOW: { CollectParameters(&m_nIp, 10); - CVector pos = *(CVector*)&ScriptParams[1]; - float angle = *(float*)&ScriptParams[4]; - float length = *(float*)&ScriptParams[5]; + CVector pos = GET_VECTOR_PARAM(1); + float angle = GET_FLOAT_PARAM(4); + float length = GET_FLOAT_PARAM(5); float x, y; if (angle != 0.0f){ y = cos(angle) * length; @@ -441,40 +477,40 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) float frontY = y; float sideX = y; float sideY = x; - CShadows::StoreShadowToBeRendered(ScriptParams[0], &pos, frontX, frontY, sideX, sideY, - ScriptParams[6], ScriptParams[7], ScriptParams[8], ScriptParams[9]); + CShadows::StoreShadowToBeRendered(GET_INTEGER_PARAM(0), &pos, frontX, frontY, sideX, sideY, + GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), GET_INTEGER_PARAM(8), GET_INTEGER_PARAM(9)); return 0; } */ case COMMAND_GET_PLAYER_HEADING: { CollectParameters(&m_nIp, 1); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; float angle = pPed->bInVehicle ? pPed->m_pMyVehicle->GetForward().Heading() : pPed->GetForward().Heading(); angle = RADTODEG(angle); if (angle < 0.0f) angle += 360.0f; if (angle > 360.0f) angle -= 360.0f; - *(float*)&ScriptParams[0] = angle; + SET_FLOAT_PARAM(0, angle); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_SET_PLAYER_HEADING: { CollectParameters(&m_nIp, 2); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); if (pPed->bInVehicle) return 0; - pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]); - pPed->SetHeading(DEGTORAD(*(float*)&ScriptParams[1])); + pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(GET_FLOAT_PARAM(1)); + pPed->SetHeading(DEGTORAD(GET_FLOAT_PARAM(1))); return 0; } case COMMAND_GET_CHAR_HEADING: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); float angle = pPed->bInVehicle ? pPed->m_pMyVehicle->GetForward().Heading() : pPed->GetForward().Heading(); angle = RADTODEG(angle); @@ -482,25 +518,25 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) angle += 360.0f; if (angle > 360.0f) angle -= 360.0f; - *(float*)&ScriptParams[0] = angle; + SET_FLOAT_PARAM(0, angle); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_SET_CHAR_HEADING: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); if (pPed->bInVehicle) return 0; - pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(*(float*)&ScriptParams[1]); - pPed->SetHeading(DEGTORAD(*(float*)&ScriptParams[1])); + pPed->m_fRotationDest = pPed->m_fRotationCur = DEGTORAD(GET_FLOAT_PARAM(1)); + pPed->SetHeading(DEGTORAD(GET_FLOAT_PARAM(1))); return 0; } case COMMAND_GET_CAR_HEADING: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); float angle = pVehicle->GetForward().Heading(); angle = RADTODEG(angle); @@ -508,22 +544,22 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) angle += 360.0f; if (angle > 360.0f) angle -= 360.0f; - *(float*)&ScriptParams[0] = angle; + SET_FLOAT_PARAM(0, angle); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_SET_CAR_HEADING: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - pVehicle->SetHeading(DEGTORAD(*(float*)&ScriptParams[1])); + pVehicle->SetHeading(DEGTORAD(GET_FLOAT_PARAM(1))); return 0; } case COMMAND_GET_OBJECT_HEADING: { CollectParameters(&m_nIp, 1); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pObject); float angle = pObject->GetForward().Heading(); angle = RADTODEG(angle); @@ -531,39 +567,39 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) angle += 360.0f; if (angle > 360.0f) angle -= 360.0f; - *(float*)&ScriptParams[0] = angle; + SET_FLOAT_PARAM(0, angle); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_SET_OBJECT_HEADING: { CollectParameters(&m_nIp, 2); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pObject); CWorld::Remove(pObject); - pObject->SetHeading(DEGTORAD(*(float*)&ScriptParams[1])); + pObject->SetHeading(DEGTORAD(GET_FLOAT_PARAM(1))); pObject->GetMatrix().UpdateRW(); pObject->UpdateRwFrame(); CWorld::Add(pObject); return 0; } - /* case COMMAND_IS_PLAYER_TOUCHING_OBJECT: { CollectParameters(&m_nIp, 2); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]); + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(1)); script_assert(pObject); CPhysical* pEntityToTest = pPed->bInVehicle ? (CPhysical*)pPed->m_pMyVehicle : pPed; UpdateCompareFlag(pEntityToTest->GetHasCollidedWith(pObject)); return 0; } + /* case COMMAND_IS_CHAR_TOUCHING_OBJECT: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(1)); script_assert(pObject); CPhysical* pEntityToTest = pPed->bInVehicle ? (CPhysical*)pPed->m_pMyVehicle : pPed; UpdateCompareFlag(pEntityToTest->GetHasCollidedWith(pObject)); @@ -573,121 +609,119 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_SET_PLAYER_AMMO: { CollectParameters(&m_nIp, 3); - CWorld::Players[0].m_pPed->SetAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]); + CWorld::Players[0].m_pPed->SetAmmo((eWeaponType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)); return 0; } - /* case COMMAND_SET_CHAR_AMMO: { CollectParameters(&m_nIp, 3); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - pPed->SetAmmo((eWeaponType)ScriptParams[1], ScriptParams[2]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); + pPed->SetAmmo((eWeaponType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)); return 0; } - */ //case COMMAND_SET_CAR_AMMO: //case COMMAND_LOAD_CAMERA_SPLINE: //case COMMAND_MOVE_CAMERA_ALONG_SPLINE: //case COMMAND_GET_CAMERA_POSITION_ALONG_SPLINE: case COMMAND_DECLARE_MISSION_FLAG: - CTheScripts::OnAMissionFlag = (uint16)CTheScripts::Read2BytesFromScript(&++m_nIp); + CTheScripts::OnAMissionFlag = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace; return 0; case COMMAND_DECLARE_MISSION_FLAG_FOR_CONTACT: return 0; - //case COMMAND_DECLARE_BASE_BRIEF_ID_FOR_CONTACT: + //case COMMAND_DECLARE_BASE_BRIEF_ID_FOR_CONTACT: case COMMAND_IS_PLAYER_HEALTH_GREATER: { CollectParameters(&m_nIp, 2); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - UpdateCompareFlag(pPed->m_fHealth > ScriptParams[1]); + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; + UpdateCompareFlag(pPed->m_fHealth > GET_INTEGER_PARAM(1)); return 0; } case COMMAND_IS_CHAR_HEALTH_GREATER: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - UpdateCompareFlag(pPed->m_fHealth > ScriptParams[1]); + UpdateCompareFlag(pPed->m_fHealth > GET_INTEGER_PARAM(1)); return 0; } case COMMAND_IS_CAR_HEALTH_GREATER: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - UpdateCompareFlag(pVehicle->m_fHealth > ScriptParams[1]); + UpdateCompareFlag(pVehicle->m_fHealth > GET_INTEGER_PARAM(1)); return 0; } case COMMAND_ADD_BLIP_FOR_CAR: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - int handle = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], 0, BLIP_DISPLAY_BOTH); + int handle = CRadar::SetEntityBlip(BLIP_CAR, GET_INTEGER_PARAM(0), 0, BLIP_DISPLAY_BOTH); CRadar::ChangeBlipScale(handle, 3); - ScriptParams[0] = handle; + SET_INTEGER_PARAM(0, handle); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_ADD_BLIP_FOR_CHAR: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - int handle = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], 1, BLIP_DISPLAY_BOTH); + int handle = CRadar::SetEntityBlip(BLIP_CHAR, GET_INTEGER_PARAM(0), 1, BLIP_DISPLAY_BOTH); CRadar::ChangeBlipScale(handle, 3); - ScriptParams[0] = handle; + SET_INTEGER_PARAM(0, handle); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_ADD_BLIP_FOR_OBJECT: { CollectParameters(&m_nIp, 1); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pObject); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - int handle = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], 6, BLIP_DISPLAY_BOTH); + int handle = CRadar::SetEntityBlip(BLIP_OBJECT, GET_INTEGER_PARAM(0), 6, BLIP_DISPLAY_BOTH); CRadar::ChangeBlipScale(handle, 3); - ScriptParams[0] = handle; + SET_INTEGER_PARAM(0, handle); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_ADD_BLIP_FOR_CONTACT_POINT: { CollectParameters(&m_nIp, 3); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); int handle = CRadar::SetCoordBlip(BLIP_CONTACT_POINT, pos, 2, BLIP_DISPLAY_BOTH); CRadar::ChangeBlipScale(handle, 3); - ScriptParams[0] = handle; + SET_INTEGER_PARAM(0, handle); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_ADD_BLIP_FOR_COORD: { CollectParameters(&m_nIp, 3); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); int handle = CRadar::SetCoordBlip(BLIP_COORD, pos, 5, BLIP_DISPLAY_BOTH); CRadar::ChangeBlipScale(handle, 3); - ScriptParams[0] = handle; + SET_INTEGER_PARAM(0, handle); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_CHANGE_BLIP_DISPLAY: CollectParameters(&m_nIp, 2); - CRadar::ChangeBlipDisplay(ScriptParams[0], (eBlipDisplay)ScriptParams[1]); + CRadar::ChangeBlipDisplay(GET_INTEGER_PARAM(0), (eBlipDisplay)GET_INTEGER_PARAM(1)); return 0; case COMMAND_ADD_ONE_OFF_SOUND: { CollectParameters(&m_nIp, 4); - switch (ScriptParams[3]) { + switch (GET_INTEGER_PARAM(3)) { case SCRIPT_SOUND_PART_MISSION_COMPLETE: DMAudio.PlayFrontEndSound(SOUND_PART_MISSION_COMPLETE, 0); return 0; @@ -712,14 +746,20 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case SCRIPT_SOUND_IMRAN_ARM_BOMB: DMAudio.PlayFrontEndSound(SOUND_AMMUNATION_IMRAN_ARM_BOMB, 0); return 0; + case 0x46: // TODO + DMAudio.PlayFrontEndSound(0xC4, 0); + return 0; + case 0x47: // TODO + DMAudio.PlayFrontEndSound(0xCD, 0); + return 0; default: break; } - if (!DMAudio.IsAudioInitialised()) + if (!DMAudio.IsAudioInitialised()) // LCS doesn't have it. Why? return 0; cAudioScriptObject* obj = new cAudioScriptObject(); - obj->Posn = *(CVector*)&ScriptParams[0]; - obj->AudioId = ScriptParams[3]; + obj->Posn = GET_VECTOR_PARAM(0); + obj->AudioId = GET_INTEGER_PARAM(3); obj->AudioEntity = AEHANDLE_NONE; DMAudio.CreateOneShotScriptObject(obj); return 0; @@ -727,23 +767,23 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_ADD_CONTINUOUS_SOUND: { CollectParameters(&m_nIp, 4); - if (DMAudio.IsAudioInitialised()) { + if (DMAudio.IsAudioInitialised()) { // LCS doesn't have it. Why? cAudioScriptObject* obj = new cAudioScriptObject(); - obj->Posn = *(CVector*)&ScriptParams[0]; - obj->AudioId = ScriptParams[3]; + obj->Posn = GET_VECTOR_PARAM(0); + obj->AudioId = GET_INTEGER_PARAM(3); obj->AudioEntity = DMAudio.CreateLoopingScriptObject(obj); - ScriptParams[0] = CPools::GetAudioScriptObjectPool()->GetIndex(obj); + SET_INTEGER_PARAM(0, CPools::GetAudioScriptObjectPool()->GetIndex(obj)); } else - ScriptParams[0] = -1; + SET_INTEGER_PARAM(0, -1); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_REMOVE_SOUND: { CollectParameters(&m_nIp, 1); - cAudioScriptObject* obj = CPools::GetAudioScriptObjectPool()->GetAt(ScriptParams[0]); - if (!obj){ + cAudioScriptObject* obj = CPools::GetAudioScriptObjectPool()->GetAt(GET_INTEGER_PARAM(0)); + if (!obj) { debug("REMOVE_SOUND - Sound doesn't exist\n"); return 0; } @@ -754,9 +794,9 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) case COMMAND_IS_CAR_STUCK_ON_ROOF: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - UpdateCompareFlag(CTheScripts::UpsideDownCars.HasCarBeenUpsideDownForAWhile(ScriptParams[0])); + UpdateCompareFlag(CTheScripts::UpsideDownCars.HasCarBeenUpsideDownForAWhile(GET_INTEGER_PARAM(0))); return 0; } default: @@ -771,22 +811,22 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_ADD_UPSIDEDOWN_CAR_CHECK: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - CTheScripts::UpsideDownCars.AddCarToCheck(ScriptParams[0]); + CTheScripts::UpsideDownCars.AddCarToCheck(GET_INTEGER_PARAM(0)); return 0; } case COMMAND_REMOVE_UPSIDEDOWN_CAR_CHECK: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - CTheScripts::UpsideDownCars.RemoveCarFromCheck(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + CTheScripts::UpsideDownCars.RemoveCarFromCheck(GET_INTEGER_PARAM(0)); return 0; } case COMMAND_SET_CHAR_OBJ_WAIT_ON_FOOT: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_WAIT_ON_FOOT); @@ -795,7 +835,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_FLEE_ON_FOOT_TILL_SAFE: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE); @@ -804,32 +844,31 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_GUARD_SPOT: { CollectParameters(&m_nIp, 4); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_GUARD_SPOT, pos); return 0; } - /* case COMMAND_SET_CHAR_OBJ_GUARD_AREA: { CollectParameters(&m_nIp, 5); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - float infX = *(float*)&ScriptParams[1]; - float infY = *(float*)&ScriptParams[2]; - float supX = *(float*)&ScriptParams[3]; - float supY = *(float*)&ScriptParams[4]; - if (infX > supX){ - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[1]; + float infX = GET_FLOAT_PARAM(1); + float infY = GET_FLOAT_PARAM(2); + float supX = GET_FLOAT_PARAM(3); + float supY = GET_FLOAT_PARAM(4); + if (infX > supX) { + infX = GET_FLOAT_PARAM(3); + supX = GET_FLOAT_PARAM(1); } if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[2]; + infY = GET_FLOAT_PARAM(4); + supY = GET_FLOAT_PARAM(2); } CVector pos; pos.x = (infX + supX) / 2; @@ -843,13 +882,12 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_WAIT_IN_CAR: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_WAIT_IN_CAR); return 0; } - */ case COMMAND_IS_PLAYER_IN_AREA_ON_FOOT_2D: case COMMAND_IS_PLAYER_IN_AREA_IN_CAR_2D: case COMMAND_IS_PLAYER_STOPPED_IN_AREA_2D: @@ -887,17 +925,17 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_GIVE_WEAPON_TO_PLAYER: { CollectParameters(&m_nIp, 3); - CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPlayerPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); - pPed->m_nSelectedWepSlot = pPed->GiveWeapon((eWeaponType)ScriptParams[1], ScriptParams[2]); + pPed->m_nSelectedWepSlot = pPed->GiveWeapon((eWeaponType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)); return 0; } case COMMAND_GIVE_WEAPON_TO_CHAR: { CollectParameters(&m_nIp, 3); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - pPed->SetCurrentWeapon(pPed->GiveWeapon((eWeaponType)ScriptParams[1], ScriptParams[2])); + pPed->SetCurrentWeapon(pPed->GiveWeapon((eWeaponType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2))); if (pPed->bInVehicle && pPed->m_pMyVehicle) pPed->RemoveWeaponModel(CWeaponInfo::GetWeaponInfo(pPed->m_weapons[pPed->m_currentWeapon].m_eWeaponType)->m_nModelId); return 0; @@ -906,23 +944,35 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_PLAYER_CONTROL: { CollectParameters(&m_nIp, 2); - CPlayerInfo* pPlayer = &CWorld::Players[ScriptParams[0]]; - if (ScriptParams[1]){ + CPlayerInfo* pPlayer = &CWorld::Players[GET_INTEGER_PARAM(0)]; + if (FindPlayerPed()) { + if (FindPlayerPed()->GetPedState() != PED_JUMP) { + FindPlayerPed()->bIsLanding = false; + FindPlayerPed()->bIsInTheAir = false; + } + FindPlayerPed()->RestoreHeadingRate(); + } + if (GET_INTEGER_PARAM(1)) { pPlayer->MakePlayerSafe(false); - if (strcmp(m_abScriptName, "serg1") == 0) // Four Iron - pPlayer->m_pPed->ClearFollowPath(); - }else{ + if (FindPlayerPed()->GetStatus() != PED_DRIVING && !FindPlayerPed()->m_attachedTo) { + // FindPlayerPed()->SetIdleAndResetAnim(); // TODO! + } + } + else { pPlayer->MakePlayerSafe(true); + if (FindPlayerPed()->GetPedState() > PED_STATES_NO_AI && FindPlayerPed()->GetPedState() != PED_DRIVING && TheCamera.GetScreenFadeStatus() == FADE_2) { + // FindPlayerPed()->SetIdleAndResetAnim(); // TODO! + } } return 0; } case COMMAND_FORCE_WEATHER: CollectParameters(&m_nIp, 1); - CWeather::ForceWeather(ScriptParams[0]); + CWeather::ForceWeather(GET_INTEGER_PARAM(0)); return 0; case COMMAND_FORCE_WEATHER_NOW: CollectParameters(&m_nIp, 1); - CWeather::ForceWeatherNow(ScriptParams[0]); + CWeather::ForceWeatherNow(GET_INTEGER_PARAM(0)); return 0; case COMMAND_RELEASE_WEATHER: CWeather::ReleaseWeather(); @@ -930,9 +980,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CURRENT_PLAYER_WEAPON: { CollectParameters(&m_nIp, 2); - CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; - for (int i = 0; i < TOTAL_WEAPON_SLOTS; i++){ - if (pPed->m_weapons[i].m_eWeaponType == ScriptParams[1]) + CPlayerPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; + for (int i = 0; i < TOTAL_WEAPON_SLOTS; i++) { + if (pPed->m_weapons[i].m_eWeaponType == GET_INTEGER_PARAM(1)) pPed->m_nSelectedWepSlot = i; } return 0; @@ -940,9 +990,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CURRENT_CHAR_WEAPON: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); for (int i = 0; i < TOTAL_WEAPON_SLOTS; i++) { - if (pPed->m_weapons[i].m_eWeaponType == ScriptParams[1]) + if (pPed->m_weapons[i].m_eWeaponType == GET_INTEGER_PARAM(1)) pPed->SetCurrentWeapon(i); } return 0; @@ -951,18 +1001,18 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_GET_OBJECT_COORDINATES: { CollectParameters(&m_nIp, 1); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pObject); - *(CVector*)&ScriptParams[0] = pObject->GetPosition(); + SET_VECTOR_PARAM(0, pObject->GetPosition()); StoreParameters(&m_nIp, 3); return 0; } case COMMAND_SET_OBJECT_COORDINATES: { CollectParameters(&m_nIp, 4); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pObject); - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pObject->Teleport(pos); @@ -970,13 +1020,13 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) return 0; } case COMMAND_GET_GAME_TIMER: - ScriptParams[0] = CTimer::GetTimeInMilliseconds(); + SET_INTEGER_PARAM(0, CTimer::GetTimeInMilliseconds()); StoreParameters(&m_nIp, 1); return 0; case COMMAND_TURN_CHAR_TO_FACE_COORD: { CollectParameters(&m_nIp, 4); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); CVehicle* pVehicle; CVector pos; @@ -988,11 +1038,11 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pos = pVehicle->GetPosition(); else pos = pPed->GetPosition(); - float heading = CGeneral::GetATanOfXY(pos.x - *(float*)&ScriptParams[1], pos.y - *(float*)&ScriptParams[2]); + float heading = CGeneral::GetATanOfXY(pos.x - GET_FLOAT_PARAM(1), pos.y - GET_FLOAT_PARAM(2)); heading += HALFPI; if (heading > TWOPI) heading -= TWOPI; - if (!pVehicle){ + if (!pVehicle) { pPed->m_fRotationCur = heading; pPed->m_fRotationDest = heading; pPed->SetHeading(heading); @@ -1002,7 +1052,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_TURN_PLAYER_TO_FACE_COORD: { CollectParameters(&m_nIp, 4); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); CVehicle* pVehicle; CVector pos; @@ -1014,7 +1064,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pos = pVehicle->GetPosition(); else pos = pPed->GetPosition(); - float heading = CGeneral::GetATanOfXY(pos.x - *(float*)&ScriptParams[1], pos.y - *(float*)&ScriptParams[2]); + float heading = CGeneral::GetATanOfXY(pos.x - GET_FLOAT_PARAM(1), pos.y - GET_FLOAT_PARAM(2)); heading += HALFPI; if (heading > TWOPI) heading -= TWOPI; @@ -1028,16 +1078,16 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_STORE_WANTED_LEVEL: { CollectParameters(&m_nIp, 1); - CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPlayerPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); - ScriptParams[0] = pPed->m_pWanted->m_nWantedLevel; + SET_INTEGER_PARAM(0, pPed->m_pWanted->m_nWantedLevel); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_IS_CAR_STOPPED: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); UpdateCompareFlag(CTheScripts::IsVehicleStopped(pVehicle)); return 0; @@ -1045,94 +1095,94 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_MARK_CHAR_AS_NO_LONGER_NEEDED: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); CTheScripts::CleanUpThisPed(pPed); if (m_bIsMissionScript) - CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR); + CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_CHAR); return 0; } case COMMAND_MARK_CAR_AS_NO_LONGER_NEEDED: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); CTheScripts::CleanUpThisVehicle(pVehicle); if (m_bIsMissionScript) - CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR); + CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_CAR); return 0; } case COMMAND_MARK_OBJECT_AS_NO_LONGER_NEEDED: { CollectParameters(&m_nIp, 1); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); CTheScripts::CleanUpThisObject(pObject); if (m_bIsMissionScript) - CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT); + CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_OBJECT); return 0; } case COMMAND_DONT_REMOVE_CHAR: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR); + CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_CHAR); return 0; } case COMMAND_DONT_REMOVE_CAR: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR); + CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_CAR); return 0; } case COMMAND_DONT_REMOVE_OBJECT: { CollectParameters(&m_nIp, 1); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pObject); - CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT); + CTheScripts::MissionCleanUp.RemoveEntityFromList(GET_INTEGER_PARAM(0), CLEANUP_OBJECT); return 0; } case COMMAND_CREATE_CHAR_AS_PASSENGER: { CollectParameters(&m_nIp, 4); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - switch (ScriptParams[2]) { + switch (GET_INTEGER_PARAM(2)) { case MI_COP: - if (ScriptParams[1] == PEDTYPE_COP) - ScriptParams[2] = COP_STREET; + if (GET_INTEGER_PARAM(1) == PEDTYPE_COP) + SET_INTEGER_PARAM(2, COP_STREET); break; case MI_SWAT: - if (ScriptParams[1] == PEDTYPE_COP) - ScriptParams[2] = COP_SWAT; + if (GET_INTEGER_PARAM(1) == PEDTYPE_COP) + SET_INTEGER_PARAM(2, COP_SWAT); break; case MI_FBI: - if (ScriptParams[1] == PEDTYPE_COP) - ScriptParams[2] = COP_FBI; + if (GET_INTEGER_PARAM(1) == PEDTYPE_COP) + SET_INTEGER_PARAM(2, COP_FBI); break; case MI_ARMY: - if (ScriptParams[1] == PEDTYPE_COP) - ScriptParams[2] = COP_ARMY; + if (GET_INTEGER_PARAM(1) == PEDTYPE_COP) + SET_INTEGER_PARAM(2, COP_ARMY); break; case MI_MEDIC: - if (ScriptParams[1] == PEDTYPE_EMERGENCY) - ScriptParams[2] = PEDTYPE_EMERGENCY; + if (GET_INTEGER_PARAM(1) == PEDTYPE_EMERGENCY) + SET_INTEGER_PARAM(2, PEDTYPE_EMERGENCY); break; case MI_FIREMAN: - if (ScriptParams[1] == PEDTYPE_FIREMAN) - ScriptParams[2] = PEDTYPE_FIREMAN; + if (GET_INTEGER_PARAM(1) == PEDTYPE_FIREMAN) + SET_INTEGER_PARAM(2, PEDTYPE_FIREMAN); break; default: break; } CPed* pPed; - if (ScriptParams[1] == PEDTYPE_COP) - pPed = new CCopPed((eCopType)ScriptParams[2]); - else if (ScriptParams[1] == PEDTYPE_EMERGENCY || ScriptParams[1] == PEDTYPE_FIREMAN) - pPed = new CEmergencyPed(ScriptParams[2]); + if (GET_INTEGER_PARAM(1) == PEDTYPE_COP) + pPed = new CCopPed((eCopType)GET_INTEGER_PARAM(2)); + else if (GET_INTEGER_PARAM(1) == PEDTYPE_EMERGENCY || GET_INTEGER_PARAM(1) == PEDTYPE_FIREMAN) + pPed = new CEmergencyPed(GET_INTEGER_PARAM(2)); else - pPed = new CCivilianPed((ePedType)ScriptParams[1], ScriptParams[2]); + pPed = new CCivilianPed((ePedType)GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)); pPed->CharCreatedBy = MISSION_CHAR; pPed->bRespondsToThreats = false; pPed->bAllowMedicsToReviveMe = false; @@ -1143,8 +1193,8 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pPed->SetOrientation(0.0f, 0.0f, 0.0f); CPopulation::ms_nTotalMissionPeds++; CWorld::Add(pPed); - if (ScriptParams[3] >= 0) - pVehicle->AddPassenger(pPed, ScriptParams[3]); + if (GET_INTEGER_PARAM(3) >= 0) + pVehicle->AddPassenger(pPed, GET_INTEGER_PARAM(3)); else pVehicle->AddPassenger(pPed); pPed->m_pMyVehicle = pVehicle; @@ -1154,18 +1204,18 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pPed->bUsesCollision = false; pPed->AddInCarAnims(pVehicle, false); pPed->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pPed->GetPosition()); - ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed); + SET_INTEGER_PARAM(0, CPools::GetPedPool()->GetIndex(pPed)); StoreParameters(&m_nIp, 1); if (m_bIsMissionScript) - CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR); + CTheScripts::MissionCleanUp.AddEntityToList(GET_INTEGER_PARAM(0), CLEANUP_CHAR); return 0; } case COMMAND_SET_CHAR_OBJ_KILL_CHAR_ON_FOOT: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CPed* pTarget = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, pTarget); return 0; @@ -1173,9 +1223,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_KILL_PLAYER_ON_FOOT: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed; + CPed* pTarget = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed; pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, pTarget); return 0; @@ -1183,9 +1233,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_KILL_CHAR_ANY_MEANS: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CPed* pTarget = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_KILL_CHAR_ANY_MEANS, pTarget); return 0; @@ -1193,9 +1243,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_KILL_PLAYER_ANY_MEANS: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed; + CPed* pTarget = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed; pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_KILL_CHAR_ANY_MEANS, pTarget); return 0; @@ -1204,9 +1254,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_FLEE_CHAR_ON_FOOT_TILL_SAFE: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CPed* pTarget = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pTarget); return 0; @@ -1215,9 +1265,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_FLEE_PLAYER_ON_FOOT_TILL_SAFE: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed; + CPed* pTarget = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed; pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pTarget); return 0; @@ -1225,9 +1275,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_FLEE_CHAR_ON_FOOT_ALWAYS: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CPed* pTarget = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pTarget); return 0; @@ -1235,9 +1285,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_FLEE_PLAYER_ON_FOOT_ALWAYS: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed; + CPed* pTarget = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed; pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pTarget); return 0; @@ -1245,9 +1295,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_GOTO_CHAR_ON_FOOT: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CPed* pTarget = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT, pTarget); return 0; @@ -1255,9 +1305,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_GOTO_PLAYER_ON_FOOT: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed; + CPed* pTarget = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed; pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_GOTO_CHAR_ON_FOOT, pTarget); return 0; @@ -1265,9 +1315,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_LEAVE_CAR: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_LEAVE_CAR, pVehicle); return 0; @@ -1275,9 +1325,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_ENTER_CAR_AS_PASSENGER: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, pVehicle); return 0; @@ -1285,9 +1335,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_ENTER_CAR_AS_DRIVER: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle); return 0; @@ -1297,9 +1347,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_DESTROY_OBJECT: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_DESTROY_OBJECT, pVehicle); return 0; @@ -1307,30 +1357,29 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_DESTROY_CAR: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_DESTROY_CAR, pVehicle); return 0; } - /* case COMMAND_SET_CHAR_OBJ_GOTO_AREA_ON_FOOT: { CollectParameters(&m_nIp, 5); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - float infX = *(float*)&ScriptParams[1]; - float infY = *(float*)&ScriptParams[2]; - float supX = *(float*)&ScriptParams[3]; - float supY = *(float*)&ScriptParams[4]; + float infX = GET_FLOAT_PARAM(1); + float infY = GET_FLOAT_PARAM(2); + float supX = GET_FLOAT_PARAM(3); + float supY = GET_FLOAT_PARAM(4); if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[1]; + infX = GET_FLOAT_PARAM(3); + supX = GET_FLOAT_PARAM(1); } if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[2]; + infY = GET_FLOAT_PARAM(4); + supY = GET_FLOAT_PARAM(2); } CVector pos; pos.x = (infX + supX) / 2; @@ -1341,32 +1390,31 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) pPed->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, pos, radius); return 0; } - */ //case COMMAND_SET_CHAR_OBJ_GOTO_AREA_IN_CAR: //case COMMAND_SET_CHAR_OBJ_FOLLOW_CAR_ON_FOOT_WITH_OFFSET: //case COMMAND_SET_CHAR_OBJ_GUARD_ATTACK: case COMMAND_SET_CHAR_AS_LEADER: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CPed* pTarget = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CPed* pTarget = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); pPed->SetObjective(OBJECTIVE_SET_LEADER, pTarget); return 0; } case COMMAND_SET_PLAYER_AS_LEADER: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CPed* pTarget = CWorld::Players[ScriptParams[1]].m_pPed; + CPed* pTarget = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed; pPed->SetObjective(OBJECTIVE_SET_LEADER, pTarget); return 0; } case COMMAND_LEAVE_GROUP: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); pPed->ClearLeader(); return 0; @@ -1374,60 +1422,66 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SET_CHAR_OBJ_FOLLOW_ROUTE: { CollectParameters(&m_nIp, 3); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); pPed->bScriptObjectiveCompleted = false; - pPed->SetObjective(OBJECTIVE_FOLLOW_ROUTE, ScriptParams[1], ScriptParams[2]); + pPed->SetObjective(OBJECTIVE_FOLLOW_ROUTE, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)); return 0; } case COMMAND_ADD_ROUTE_POINT: { CollectParameters(&m_nIp, 4); - CRouteNode::AddRoutePoint(ScriptParams[0], *(CVector*)&ScriptParams[1]); + CRouteNode::AddRoutePoint(GET_INTEGER_PARAM(0), GET_VECTOR_PARAM(1)); return 0; } case COMMAND_PRINT_WITH_NUMBER_BIG: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 3); - CMessages::AddBigMessageWithNumber(text, ScriptParams[1], ScriptParams[2] - 1, ScriptParams[0], -1, -1, -1, -1, -1); + CMessages::AddBigMessageWithNumber(text, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2) - 1, GET_INTEGER_PARAM(0), -1, -1, -1, -1, -1); return 0; } case COMMAND_PRINT_WITH_NUMBER: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 3); - CMessages::AddMessageWithNumber(text, ScriptParams[1], ScriptParams[2], ScriptParams[0], -1, -1, -1, -1, -1); + CMessages::AddMessageWithNumber(text, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(0), -1, -1, -1, -1, -1); return 0; } case COMMAND_PRINT_WITH_NUMBER_NOW: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 3); - CMessages::AddMessageJumpQWithNumber(text, ScriptParams[1], ScriptParams[2], ScriptParams[0], -1, -1, -1, -1, -1); + CMessages::AddMessageJumpQWithNumber(text, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(0), -1, -1, -1, -1, -1); + return 0; + } + case COMMAND_PRINT_WITH_NUMBER_SOON: + { + wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 3); + CMessages::AddMessageSoonWithNumber(text, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(0), -1, -1, -1, -1, -1); return 0; } - //case COMMAND_PRINT_WITH_NUMBER_SOON: case COMMAND_SWITCH_ROADS_ON: { CollectParameters(&m_nIp, 6); - float infX = *(float*)&ScriptParams[0]; - float infY = *(float*)&ScriptParams[1]; - float infZ = *(float*)&ScriptParams[2]; - float supX = *(float*)&ScriptParams[3]; - float supY = *(float*)&ScriptParams[4]; - float supZ = *(float*)&ScriptParams[5]; - if (infX > supX){ - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[0]; + float infX = GET_FLOAT_PARAM(0); + float infY = GET_FLOAT_PARAM(1); + float infZ = GET_FLOAT_PARAM(2); + float supX = GET_FLOAT_PARAM(3); + float supY = GET_FLOAT_PARAM(4); + float supZ = GET_FLOAT_PARAM(5); + if (infX > supX) { + infX = GET_FLOAT_PARAM(3); + supX = GET_FLOAT_PARAM(0); } - if (infY > supY){ - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[1]; + if (infY > supY) { + infY = GET_FLOAT_PARAM(4); + supY = GET_FLOAT_PARAM(1); } - if (infZ > supZ){ - infZ = *(float*)&ScriptParams[5]; - supZ = *(float*)&ScriptParams[2]; + if (infZ > supZ) { + infZ = GET_FLOAT_PARAM(5); + supZ = GET_FLOAT_PARAM(2); } ThePaths.SwitchRoadsOffInArea(infX, supX, infY, supY, infZ, supZ, false); return 0; @@ -1435,23 +1489,23 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_SWITCH_ROADS_OFF: { CollectParameters(&m_nIp, 6); - float infX = *(float*)&ScriptParams[0]; - float infY = *(float*)&ScriptParams[1]; - float infZ = *(float*)&ScriptParams[2]; - float supX = *(float*)&ScriptParams[3]; - float supY = *(float*)&ScriptParams[4]; - float supZ = *(float*)&ScriptParams[5]; + float infX = GET_FLOAT_PARAM(0); + float infY = GET_FLOAT_PARAM(1); + float infZ = GET_FLOAT_PARAM(2); + float supX = GET_FLOAT_PARAM(3); + float supY = GET_FLOAT_PARAM(4); + float supZ = GET_FLOAT_PARAM(5); if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[0]; + infX = GET_FLOAT_PARAM(3); + supX = GET_FLOAT_PARAM(0); } if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[1]; + infY = GET_FLOAT_PARAM(4); + supY = GET_FLOAT_PARAM(1); } if (infZ > supZ) { - infZ = *(float*)&ScriptParams[5]; - supZ = *(float*)&ScriptParams[2]; + infZ = GET_FLOAT_PARAM(5); + supZ = GET_FLOAT_PARAM(2); } ThePaths.SwitchRoadsOffInArea(infX, supX, infY, supY, infZ, supZ, true); return 0; @@ -1459,85 +1513,83 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_GET_NUMBER_OF_PASSENGERS: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - ScriptParams[0] = pVehicle->m_nNumPassengers; + SET_INTEGER_PARAM(0, pVehicle->m_nNumPassengers); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_GET_MAXIMUM_NUMBER_OF_PASSENGERS: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - ScriptParams[0] = pVehicle->m_nNumMaxPassengers; + SET_INTEGER_PARAM(0, pVehicle->m_nNumMaxPassengers); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_SET_CAR_DENSITY_MULTIPLIER: { CollectParameters(&m_nIp, 1); - CCarCtrl::CarDensityMultiplier = *(float*)&ScriptParams[0]; + CCarCtrl::CarDensityMultiplier = GET_FLOAT_PARAM(0); return 0; } case COMMAND_SET_CAR_HEAVY: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - if (ScriptParams[1] != 0) { + if (GET_INTEGER_PARAM(1) != 0) { pVehicle->bIsHeavy = true; - pVehicle->m_fMass = 3.0f * pVehicle->pHandling->fMass; - pVehicle->m_fTurnMass = 5.0f * pVehicle->pHandling->fTurnMass; + pVehicle->m_fMass = 3.0f * pVehicle->pHandling->fMass; // TODO: tHandlingData::GetMass() + pVehicle->m_fTurnMass = 5.0f * pVehicle->pHandling->fTurnMass; // TODO: tHandlingData::GetTurnMass() } else { pVehicle->bIsHeavy = false; - pVehicle->m_fMass = pVehicle->pHandling->fMass; - pVehicle->m_fTurnMass = pVehicle->pHandling->fTurnMass; + pVehicle->m_fMass = pVehicle->pHandling->fMass; // TODO: tHandlingData::GetMass() + pVehicle->m_fTurnMass = pVehicle->pHandling->fTurnMass; // TODO: tHandlingData::GetTurnMass() } return 0; } case COMMAND_CLEAR_CHAR_THREAT_SEARCH: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); pPed->m_fearFlags = 0; return 0; } - /* case COMMAND_ACTIVATE_CRANE: { CollectParameters(&m_nIp, 10); - float infX = *(float*)&ScriptParams[2]; - float infY = *(float*)&ScriptParams[3]; - float supX = *(float*)&ScriptParams[4]; - float supY = *(float*)&ScriptParams[5]; + float infX = GET_FLOAT_PARAM(2); + float infY = GET_FLOAT_PARAM(3); + float supX = GET_FLOAT_PARAM(4); + float supY = GET_FLOAT_PARAM(5); if (infX > supX) { - infX = *(float*)&ScriptParams[4]; - supX = *(float*)&ScriptParams[2]; + infX = GET_FLOAT_PARAM(4); + supX = GET_FLOAT_PARAM(2); } if (infY > supY) { - infY = *(float*)&ScriptParams[5]; - supY = *(float*)&ScriptParams[3]; + infY = GET_FLOAT_PARAM(5); + supY = GET_FLOAT_PARAM(3); } CCranes::ActivateCrane(infX, supX, infY, supY, - *(float*)&ScriptParams[6], *(float*)&ScriptParams[7], *(float*)&ScriptParams[8], - DEGTORAD(*(float*)&ScriptParams[9]), false, false, - *(float*)&ScriptParams[0], *(float*)&ScriptParams[1]); + GET_FLOAT_PARAM(6), GET_FLOAT_PARAM(7), GET_FLOAT_PARAM(8), + DEGTORAD(GET_FLOAT_PARAM(9)), false, false, + GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1)); return 0; } case COMMAND_DEACTIVATE_CRANE: { CollectParameters(&m_nIp, 2); - CCranes::DeActivateCrane(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]); + CCranes::DeActivateCrane(GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1)); return 0; } - */ case COMMAND_SET_MAX_WANTED_LEVEL: { CollectParameters(&m_nIp, 1); - CWanted::SetMaximumWantedLevel(ScriptParams[0]); + CWanted::SetMaximumWantedLevel(GET_INTEGER_PARAM(0)); return 0; } //case COMMAND_SAVE_VAR_INT: @@ -1545,7 +1597,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command) case COMMAND_IS_CAR_IN_AIR_PROPER: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); UpdateCompareFlag(pVehicle->m_nCollisionRecords == 0); return 0; diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp index 7476d8de..88df935f 100644 --- a/src/control/Script3.cpp +++ b/src/control/Script3.cpp @@ -6,6 +6,7 @@ #include "Boat.h" #include "CarCtrl.h" #include "Clock.h" +#include "ColStore.h" #include "Coronas.h" #include "Cranes.h" #include "CutsceneMgr.h" @@ -41,17 +42,17 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_IS_CAR_UPSIDEDOWN: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - UpdateCompareFlag(pVehicle->GetUp().z <= -0.97f); + UpdateCompareFlag(pVehicle->GetUp().z <= UPSIDEDOWN_UP_THRESHOLD); return 0; } case COMMAND_GET_PLAYER_CHAR: { CollectParameters(&m_nIp, 1); - CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPlayerPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); - ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed); + SET_INTEGER_PARAM(0, CPools::GetPedPool()->GetIndex(pPed)); StoreParameters(&m_nIp, 1); return 0; } @@ -61,9 +62,9 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_SET_POLICE_IGNORE_PLAYER: { CollectParameters(&m_nIp, 2); - CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPlayerPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); - if (ScriptParams[1]) { + if (GET_INTEGER_PARAM(1)) { pPed->m_pWanted->m_bIgnoredByCops = true; CWorld::StopAllLawEnforcersInTheirTracks(); } @@ -77,8 +78,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 4); - CUserDisplay::Pager.AddMessageWithNumber(text, ScriptParams[0], -1, -1, -1, -1, -1, - ScriptParams[1], ScriptParams[2], ScriptParams[3]); + CUserDisplay::Pager.AddMessageWithNumber(text, GET_INTEGER_PARAM(0), -1, -1, -1, -1, -1, + GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3)); return 0; } */ @@ -86,21 +87,21 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 8); - CDarkel::StartFrenzy((eWeaponType)ScriptParams[0], ScriptParams[1], ScriptParams[2], - ScriptParams[3], text, ScriptParams[4], ScriptParams[5], - ScriptParams[6], ScriptParams[7] != 0, false); + CDarkel::StartFrenzy((eWeaponType)GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), + GET_INTEGER_PARAM(3), text, GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5), + GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7) != 0, false); return 0; } case COMMAND_READ_KILL_FRENZY_STATUS: { - ScriptParams[0] = CDarkel::ReadStatus(); + SET_INTEGER_PARAM(0, CDarkel::ReadStatus()); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_SQRT: { CollectParameters(&m_nIp, 1); - *(float*)&ScriptParams[0] = Sqrt(*(float*)&ScriptParams[0]); + SET_FLOAT_PARAM(0, Sqrt(GET_FLOAT_PARAM(0))); StoreParameters(&m_nIp, 1); return 0; } @@ -122,39 +123,40 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) return 0; case COMMAND_GENERATE_RANDOM_FLOAT_IN_RANGE: CollectParameters(&m_nIp, 2); - *(float*)&ScriptParams[0] = CGeneral::GetRandomNumberInRange(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]); + SET_FLOAT_PARAM(0, CGeneral::GetRandomNumberInRange(GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1))); StoreParameters(&m_nIp, 1); return 0; case COMMAND_GENERATE_RANDOM_INT_IN_RANGE: CollectParameters(&m_nIp, 2); - ScriptParams[0] = CGeneral::GetRandomNumberInRange(ScriptParams[0], ScriptParams[1]); + SET_INTEGER_PARAM(0, CGeneral::GetRandomNumberInRange(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1))); StoreParameters(&m_nIp, 1); return 0; case COMMAND_LOCK_CAR_DOORS: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - pVehicle->m_nDoorLock = (eCarLock)ScriptParams[1]; + pVehicle->m_nDoorLock = (eCarLock)GET_INTEGER_PARAM(1); return 0; } case COMMAND_EXPLODE_CAR: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); + pVehicle->bCanBeDamaged = true; pVehicle->BlowUpCar(nil); return 0; } case COMMAND_ADD_EXPLOSION: CollectParameters(&m_nIp, 4); - CExplosion::AddExplosion(nil, nil, (eExplosionType)ScriptParams[3], *(CVector*)&ScriptParams[0], 0, true); + CExplosion::AddExplosion(nil, nil, (eExplosionType)GET_INTEGER_PARAM(3), GET_VECTOR_PARAM(0), 0, true); // last argument is 0 (default? - TODO) return 0; case COMMAND_IS_CAR_UPRIGHT: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); UpdateCompareFlag(pVehicle->GetUp().z >= 0.0f); return 0; @@ -162,8 +164,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_TURN_CHAR_TO_FACE_CHAR: { CollectParameters(&m_nIp, 2); - CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CPed* pSourcePed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); + CPed* pTargetPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); CVehicle* pVehicle = pSourcePed->bInVehicle ? pSourcePed->m_pMyVehicle : nil; CVector2D sourcePos = pSourcePed->bInVehicle ? pVehicle->GetPosition() : pSourcePed->GetPosition(); CVector2D targetPos = pTargetPed->bInVehicle ? pTargetPed->m_pMyVehicle->GetPosition() : pTargetPed->GetPosition(); @@ -180,8 +182,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_TURN_CHAR_TO_FACE_PLAYER: { CollectParameters(&m_nIp, 2); - CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - CPed* pTargetPed = CWorld::Players[ScriptParams[1]].m_pPed; + CPed* pSourcePed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); + CPed* pTargetPed = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed; CVehicle* pVehicle = pSourcePed->bInVehicle ? pSourcePed->m_pMyVehicle : nil; CVector2D sourcePos = pSourcePed->bInVehicle ? pVehicle->GetPosition() : pSourcePed->GetPosition(); CVector2D targetPos = pTargetPed->bInVehicle ? pTargetPed->m_pMyVehicle->GetPosition() : pTargetPed->GetPosition(); @@ -198,8 +200,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_TURN_PLAYER_TO_FACE_CHAR: { CollectParameters(&m_nIp, 2); - CPed* pSourcePed = CWorld::Players[ScriptParams[0]].m_pPed; - CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CPed* pSourcePed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; + CPed* pTargetPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); CVehicle* pVehicle = pSourcePed->bInVehicle ? pSourcePed->m_pMyVehicle : nil; CVector2D sourcePos = pSourcePed->bInVehicle ? pVehicle->GetPosition() : pSourcePed->GetPosition(); CVector2D targetPos = pTargetPed->bInVehicle ? pTargetPed->m_pMyVehicle->GetPosition() : pTargetPed->GetPosition(); @@ -216,11 +218,11 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_SET_CHAR_OBJ_GOTO_COORD_ON_FOOT: { CollectParameters(&m_nIp, 3); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); CVector target; - target.x = *(float*)&ScriptParams[1]; - target.y = *(float*)&ScriptParams[2]; + target.x = GET_FLOAT_PARAM(1); + target.y = GET_FLOAT_PARAM(2); target.z = CWorld::FindGroundZForCoord(target.x, target.y); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, target); @@ -230,63 +232,61 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_CREATE_PICKUP: { CollectParameters(&m_nIp, 5); - int16 model = ScriptParams[0]; + int16 model = GET_INTEGER_PARAM(0); if (model < 0) model = CTheScripts::UsedObjectArray[-model].index; - CVector pos = *(CVector*)&ScriptParams[2]; + CVector pos = GET_VECTOR_PARAM(2); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET; CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - ScriptParams[0] = CPickups::GenerateNewOne(pos, model, ScriptParams[1], 0); + SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, model, GET_INTEGER_PARAM(1), 0)); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_HAS_PICKUP_BEEN_COLLECTED: CollectParameters(&m_nIp, 1); - UpdateCompareFlag(CPickups::IsPickUpPickedUp(ScriptParams[0]) != 0); + UpdateCompareFlag(CPickups::IsPickUpPickedUp(GET_INTEGER_PARAM(0)) != 0); return 0; case COMMAND_REMOVE_PICKUP: CollectParameters(&m_nIp, 1); - CPickups::RemovePickUp(ScriptParams[0]); + CPickups::RemovePickUp(GET_INTEGER_PARAM(0)); return 0; case COMMAND_SET_TAXI_LIGHTS: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); - ((CAutomobile*)pVehicle)->SetTaxiLight(ScriptParams[1] != 0); + ((CAutomobile*)pVehicle)->SetTaxiLight(GET_INTEGER_PARAM(1) != 0); return 0; } case COMMAND_PRINT_BIG_Q: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 2); - CMessages::AddBigMessageQ(text, ScriptParams[0], ScriptParams[1] - 1); + CMessages::AddBigMessageQ(text, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1) - 1); return 0; } - /* case COMMAND_PRINT_WITH_NUMBER_BIG_Q: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 3); - CMessages::AddBigMessageWithNumberQ(text, ScriptParams[1], ScriptParams[2] - 1, - ScriptParams[0], -1, -1, -1, -1, -1); + CMessages::AddBigMessageWithNumberQ(text, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2) - 1, + GET_INTEGER_PARAM(0), -1, -1, -1, -1, -1); return 0; } - */ case COMMAND_SET_GARAGE: { CollectParameters(&m_nIp, 9); - float infX = *(float*)&ScriptParams[0]; - float infY = *(float*)&ScriptParams[1]; - float infZ = *(float*)&ScriptParams[2]; - float X2 = *(float*)&ScriptParams[3]; - float Y2 = *(float*)&ScriptParams[4]; - float supX = *(float*)&ScriptParams[5]; - float supY = *(float*)&ScriptParams[6]; - float supZ = *(float*)&ScriptParams[7]; - ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, ScriptParams[8], 0); + float infX = GET_FLOAT_PARAM(0); + float infY = GET_FLOAT_PARAM(1); + float infZ = GET_FLOAT_PARAM(2); + float X2 = GET_FLOAT_PARAM(3); + float Y2 = GET_FLOAT_PARAM(4); + float supX = GET_FLOAT_PARAM(5); + float supY = GET_FLOAT_PARAM(6); + float supZ = GET_FLOAT_PARAM(7); + SET_INTEGER_PARAM(0, CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, GET_INTEGER_PARAM(8), 0)); StoreParameters(&m_nIp, 1); return 0; } @@ -294,15 +294,15 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_SET_GARAGE_WITH_CAR_MODEL: { CollectParameters(&m_nIp, 10); - float infX = *(float*)&ScriptParams[0]; - float infY = *(float*)&ScriptParams[1]; - float infZ = *(float*)&ScriptParams[2]; - float X2 = *(float*)&ScriptParams[3]; - float Y2 = *(float*)&ScriptParams[4]; - float supX = *(float*)&ScriptParams[5]; - float supY = *(float*)&ScriptParams[6]; - float supZ = *(float*)&ScriptParams[7]; - ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, ScriptParams[8], ScriptParams[9]); + float infX = GET_FLOAT_PARAM(0); + float infY = GET_FLOAT_PARAM(1); + float infZ = GET_FLOAT_PARAM(2); + float X2 = GET_FLOAT_PARAM(3); + float Y2 = GET_FLOAT_PARAM(4); + float supX = GET_FLOAT_PARAM(5); + float supY = GET_FLOAT_PARAM(6); + float supZ = GET_FLOAT_PARAM(7); + SET_INTEGER_PARAM(0, CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, GET_INTEGER_PARAM(8), GET_INTEGER_PARAM(9))); StoreParameters(&m_nIp, 1); return 0; } @@ -311,34 +311,34 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 2); CVehicle* pTarget; - if (ScriptParams[1] >= 0) { - pTarget = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); + if (GET_INTEGER_PARAM(1) >= 0) { + pTarget = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); script_assert(pTarget); } else { pTarget = nil; } - CGarages::SetTargetCarForMissonGarage(ScriptParams[0], pTarget); + CGarages::SetTargetCarForMissonGarage(GET_INTEGER_PARAM(0), pTarget); return 0; } case COMMAND_IS_CAR_IN_MISSION_GARAGE: CollectParameters(&m_nIp, 1); - UpdateCompareFlag(CGarages::HasCarBeenDroppedOffYet(ScriptParams[0])); + UpdateCompareFlag(CGarages::HasCarBeenDroppedOffYet(GET_INTEGER_PARAM(0))); return 0; -/* case COMMAND_SET_FREE_BOMBS: CollectParameters(&m_nIp, 1); - CGarages::SetFreeBombs(ScriptParams[0] != 0); + CGarages::SetFreeBombs(GET_INTEGER_PARAM(0) != 0); return 0; + /* case COMMAND_SET_POWERPOINT: { CollectParameters(&m_nIp, 7); - float f1 = *(float*)&ScriptParams[0]; - float f2 = *(float*)&ScriptParams[1]; - float f3 = *(float*)&ScriptParams[2]; - float f4 = *(float*)&ScriptParams[3]; - float f5 = *(float*)&ScriptParams[4]; - float f6 = *(float*)&ScriptParams[5]; + float f1 = GET_FLOAT_PARAM(0); + float f2 = GET_FLOAT_PARAM(1); + float f3 = GET_FLOAT_PARAM(2); + float f4 = GET_FLOAT_PARAM(3); + float f5 = GET_FLOAT_PARAM(4); + float f6 = GET_FLOAT_PARAM(5); float temp; if (f1 > f4) { @@ -359,43 +359,43 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) f6 = temp; } - CPowerPoints::GenerateNewOne(f1, f2, f3, f4, f5, f6, *(uint8*)&ScriptParams[6]); + CPowerPoints::GenerateNewOne(f1, f2, f3, f4, f5, f6, *(uint8*)&GET_INTEGER_PARAM(6)); return 0; } case COMMAND_SET_ALL_TAXI_LIGHTS: CollectParameters(&m_nIp, 1); - CAutomobile::SetAllTaxiLights(ScriptParams[0] != 0); + CAutomobile::SetAllTaxiLights(GET_INTEGER_PARAM(0) != 0); return 0; + */ case COMMAND_IS_CAR_ARMED_WITH_ANY_BOMB: { CollectParameters(&m_nIp, 1); - CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pCar); script_assert(pCar->m_vehType == VEHICLE_TYPE_CAR); UpdateCompareFlag(pCar->m_bombType != 0); //TODO: enum return 0; } - */ case COMMAND_APPLY_BRAKES_TO_PLAYERS_CAR: CollectParameters(&m_nIp, 2); - CPad::GetPad(ScriptParams[0])->bApplyBrakes = (ScriptParams[1] != 0); + CPad::GetPad(GET_INTEGER_PARAM(0))->bApplyBrakes = (GET_INTEGER_PARAM(1) != 0); return 0; case COMMAND_SET_PLAYER_HEALTH: { CollectParameters(&m_nIp, 2); - CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPlayerPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); - pPed->m_fHealth = Min(ScriptParams[1], CWorld::Players[ScriptParams[0]].m_nMaxHealth); + pPed->m_fHealth = Min(GET_INTEGER_PARAM(1), CWorld::Players[GET_INTEGER_PARAM(0)].m_nMaxHealth); return 0; } case COMMAND_SET_CHAR_HEALTH: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - if (ScriptParams[1]) { - pPed->m_fHealth = ScriptParams[1]; + if (GET_INTEGER_PARAM(1)) { + pPed->m_fHealth = GET_INTEGER_PARAM(1); } else if (pPed->bInVehicle) { pPed->SetDead(); @@ -403,86 +403,84 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) pPed->FlagToDestroyWhenNextProcessed(); } else { - pPed->SetDie(); + pPed->SetDie(); // last argument = 13 (default? TODO) } return 0; } case COMMAND_SET_CAR_HEALTH: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - pVehicle->m_fHealth = ScriptParams[1]; + pVehicle->m_fHealth = GET_INTEGER_PARAM(1); return 0; } case COMMAND_GET_PLAYER_HEALTH: { CollectParameters(&m_nIp, 1); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); - ScriptParams[0] = pPed->m_fHealth; + SET_INTEGER_PARAM(0, pPed->m_fHealth); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_GET_CHAR_HEALTH: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - ScriptParams[0] = pPed->m_fHealth; + SET_INTEGER_PARAM(0, pPed->m_fHealth); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_GET_CAR_HEALTH: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - ScriptParams[0] = pVehicle->m_fHealth; + SET_INTEGER_PARAM(0, pVehicle->m_fHealth); StoreParameters(&m_nIp, 1); return 0; } - /* case COMMAND_IS_CAR_ARMED_WITH_BOMB: { CollectParameters(&m_nIp, 2); - CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CAutomobile* pCar = (CAutomobile*)CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pCar); script_assert(pCar->m_vehType == VEHICLE_TYPE_CAR); - UpdateCompareFlag(pCar->m_bombType == ScriptParams[1]); + UpdateCompareFlag(pCar->m_bombType == GET_INTEGER_PARAM(1)); return 0; } - */ case COMMAND_CHANGE_CAR_COLOUR: { CollectParameters(&m_nIp, 3); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); - if (ScriptParams[1] >= 256 || ScriptParams[2] >= 256) + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); + if (GET_INTEGER_PARAM(1) >= 256 || GET_INTEGER_PARAM(2) >= 256) debug("CHANGE_CAR_COLOUR - Colours must be less than %d", 256); - pVehicle->m_currentColour1 = ScriptParams[1]; - pVehicle->m_currentColour2 = ScriptParams[2]; + pVehicle->m_currentColour1 = GET_INTEGER_PARAM(1); + pVehicle->m_currentColour2 = GET_INTEGER_PARAM(2); return 0; } case COMMAND_SWITCH_PED_ROADS_ON: { CollectParameters(&m_nIp, 6); - float infX = *(float*)&ScriptParams[0]; - float infY = *(float*)&ScriptParams[1]; - float infZ = *(float*)&ScriptParams[2]; - float supX = *(float*)&ScriptParams[3]; - float supY = *(float*)&ScriptParams[4]; - float supZ = *(float*)&ScriptParams[5]; + float infX = GET_FLOAT_PARAM(0); + float infY = GET_FLOAT_PARAM(1); + float infZ = GET_FLOAT_PARAM(2); + float supX = GET_FLOAT_PARAM(3); + float supY = GET_FLOAT_PARAM(4); + float supZ = GET_FLOAT_PARAM(5); if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[0]; + infX = GET_FLOAT_PARAM(3); + supX = GET_FLOAT_PARAM(0); } if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[1]; + infY = GET_FLOAT_PARAM(4); + supY = GET_FLOAT_PARAM(1); } if (infZ > supZ) { - infZ = *(float*)&ScriptParams[5]; - supZ = *(float*)&ScriptParams[2]; + infZ = GET_FLOAT_PARAM(5); + supZ = GET_FLOAT_PARAM(2); } ThePaths.SwitchPedRoadsOffInArea(infX, supX, infY, supY, infZ, supZ, false); return 0; @@ -490,23 +488,23 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_SWITCH_PED_ROADS_OFF: { CollectParameters(&m_nIp, 6); - float infX = *(float*)&ScriptParams[0]; - float infY = *(float*)&ScriptParams[1]; - float infZ = *(float*)&ScriptParams[2]; - float supX = *(float*)&ScriptParams[3]; - float supY = *(float*)&ScriptParams[4]; - float supZ = *(float*)&ScriptParams[5]; + float infX = GET_FLOAT_PARAM(0); + float infY = GET_FLOAT_PARAM(1); + float infZ = GET_FLOAT_PARAM(2); + float supX = GET_FLOAT_PARAM(3); + float supY = GET_FLOAT_PARAM(4); + float supZ = GET_FLOAT_PARAM(5); if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[0]; + infX = GET_FLOAT_PARAM(3); + supX = GET_FLOAT_PARAM(0); } if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[1]; + infY = GET_FLOAT_PARAM(4); + supY = GET_FLOAT_PARAM(1); } if (infZ > supZ) { - infZ = *(float*)&ScriptParams[5]; - supZ = *(float*)&ScriptParams[2]; + infZ = GET_FLOAT_PARAM(5); + supZ = GET_FLOAT_PARAM(2); } ThePaths.SwitchPedRoadsOffInArea(infX, supX, infY, supY, infZ, supZ, true); return 0; @@ -514,20 +512,20 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_CHAR_LOOK_AT_CHAR_ALWAYS: { CollectParameters(&m_nIp, 2); - CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pSourcePed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pSourcePed); - CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CPed* pTargetPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); script_assert(pTargetPed); - pSourcePed->SetLookFlag(pTargetPed, true); + pSourcePed->SetLookFlag(pTargetPed, true, true); pSourcePed->SetLookTimer(60000); return 0; } case COMMAND_CHAR_LOOK_AT_PLAYER_ALWAYS: { CollectParameters(&m_nIp, 2); - CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pSourcePed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pSourcePed); - CPed* pTargetPed = CWorld::Players[ScriptParams[1]].m_pPed; + CPed* pTargetPed = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed; script_assert(pTargetPed); pSourcePed->SetLookFlag(pTargetPed, true); pSourcePed->SetLookTimer(60000); @@ -536,9 +534,9 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_PLAYER_LOOK_AT_CHAR_ALWAYS: { CollectParameters(&m_nIp, 2); - CPed* pSourcePed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pSourcePed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pSourcePed); - CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CPed* pTargetPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); script_assert(pTargetPed); pSourcePed->SetLookFlag(pTargetPed, true); pSourcePed->SetLookTimer(60000); @@ -547,7 +545,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_STOP_CHAR_LOOKING: { CollectParameters(&m_nIp, 1); - CPed* pSourcePed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pSourcePed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pSourcePed); pSourcePed->ClearLookFlag(); pSourcePed->bKeepTryingToLook = false; @@ -558,7 +556,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_STOP_PLAYER_LOOKING: { CollectParameters(&m_nIp, 1); - CPed* pSourcePed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pSourcePed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pSourcePed); pSourcePed->ClearLookFlag(); pSourcePed->bKeepTryingToLook = false; @@ -569,7 +567,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) /* case COMMAND_SWITCH_HELICOPTER: CollectParameters(&m_nIp, 1); - CHeli::ActivateHeli(ScriptParams[0] != 0); + CHeli::ActivateHeli(GET_INTEGER_PARAM(0) != 0); return 0; */ //case COMMAND_SET_GANG_ATTITUDE: @@ -577,33 +575,33 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) //case COMMAND_SET_GANG_PLAYER_ATTITUDE: case COMMAND_SET_GANG_PED_MODELS: CollectParameters(&m_nIp, 3); - CGangs::SetGangPedModels(ScriptParams[0], ScriptParams[1], ScriptParams[2]); + CGangs::SetGangPedModels(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)); return 0; case COMMAND_SET_GANG_CAR_MODEL: CollectParameters(&m_nIp, 2); - CGangs::SetGangVehicleModel(ScriptParams[0], ScriptParams[1]); + CGangs::SetGangVehicleModel(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; case COMMAND_SET_GANG_WEAPONS: CollectParameters(&m_nIp, 3); - CGangs::SetGangWeapons(ScriptParams[0], (eWeaponType)ScriptParams[1], (eWeaponType)ScriptParams[2]); + CGangs::SetGangWeapons(GET_INTEGER_PARAM(0), (eWeaponType)GET_INTEGER_PARAM(1), (eWeaponType)GET_INTEGER_PARAM(2)); return 0; /* case COMMAND_SET_CHAR_OBJ_RUN_TO_AREA: { CollectParameters(&m_nIp, 5); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - float infX = *(float*)&ScriptParams[1]; - float infY = *(float*)&ScriptParams[2]; - float supX = *(float*)&ScriptParams[3]; - float supY = *(float*)&ScriptParams[4]; + float infX = GET_FLOAT_PARAM(1); + float infY = GET_FLOAT_PARAM(2); + float supX = GET_FLOAT_PARAM(3); + float supY = GET_FLOAT_PARAM(4); if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[1]; + infX = GET_FLOAT_PARAM(3); + supX = GET_FLOAT_PARAM(1); } if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[2]; + infY = GET_FLOAT_PARAM(4); + supY = GET_FLOAT_PARAM(2); } CVector pos; pos.x = (infX + supX) / 2; @@ -618,11 +616,11 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_SET_CHAR_OBJ_RUN_TO_COORD: { CollectParameters(&m_nIp, 3); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); CVector pos; - pos.x = *(float*)&ScriptParams[1]; - pos.y = *(float*)&ScriptParams[2]; + pos.x = GET_FLOAT_PARAM(1); + pos.y = GET_FLOAT_PARAM(2); pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_RUN_TO_AREA, pos); @@ -632,9 +630,9 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_IS_PLAYER_TOUCHING_OBJECT_ON_FOOT: { CollectParameters(&m_nIp, 2); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(1)); bool isTouching = false; if (pPed->bInVehicle) isTouching = false; @@ -646,9 +644,9 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_IS_CHAR_TOUCHING_OBJECT_ON_FOOT: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[1]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(1)); bool isTouching = false; if (pPed->InVehicle()) isTouching = false; @@ -665,110 +663,115 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) strncpy(name, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++) name[i] = tolower(name[i]); - CStreaming::RequestSpecialChar(ScriptParams[0] - 1, name, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_SCRIPTOWNED); + CStreaming::RequestSpecialChar(GET_INTEGER_PARAM(0) - 1, name, STREAMFLAGS_DEPENDENCY | (m_bIsMissionScript ? STREAMFLAGS_SCRIPTOWNED : STREAMFLAGS_AMBIENT_SCRIPT_OWNED)); m_nIp += KEY_LENGTH_IN_SCRIPT; return 0; } case COMMAND_HAS_SPECIAL_CHARACTER_LOADED: { CollectParameters(&m_nIp, 1); - UpdateCompareFlag(CStreaming::HasSpecialCharLoaded(ScriptParams[0] - 1)); + UpdateCompareFlag(CStreaming::HasSpecialCharLoaded(GET_INTEGER_PARAM(0) - 1)); return 0; } /* case COMMAND_FLASH_CAR: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - pVehicle->bHasBlip = (ScriptParams[1] != 0); + pVehicle->bHasBlip = (GET_INTEGER_PARAM(1) != 0); return 0; } case COMMAND_FLASH_CHAR: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - pPed->bHasBlip = (ScriptParams[1] != 0); + pPed->bHasBlip = (GET_INTEGER_PARAM(1) != 0); return 0; } case COMMAND_FLASH_OBJECT: { CollectParameters(&m_nIp, 2); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pObject); - pObject->bHasBlip = (ScriptParams[1] != 0); + pObject->bHasBlip = (GET_INTEGER_PARAM(1) != 0); return 0; } */ case COMMAND_IS_PLAYER_IN_REMOTE_MODE: CollectParameters(&m_nIp, 1); - UpdateCompareFlag(CWorld::Players[ScriptParams[0]].IsPlayerInRemoteMode()); + UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].IsPlayerInRemoteMode()); return 0; - /* case COMMAND_ARM_CAR_WITH_BOMB: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); script_assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); - ((CAutomobile*)pVehicle)->m_bombType = ScriptParams[1]; + ((CAutomobile*)pVehicle)->m_bombType = GET_INTEGER_PARAM(1); ((CAutomobile*)pVehicle)->m_pBombRigger = FindPlayerPed(); return 0; } - */ case COMMAND_SET_CHAR_PERSONALITY: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - pPed->SetPedStats((ePedStats)ScriptParams[1]); + pPed->SetPedStats((ePedStats)GET_INTEGER_PARAM(1)); return 0; } case COMMAND_SET_CUTSCENE_OFFSET: CollectParameters(&m_nIp, 3); - CCutsceneMgr::SetCutsceneOffset(*(CVector*)&ScriptParams[0]); + CCutsceneMgr::SetCutsceneOffset(GET_VECTOR_PARAM(0)); return 0; case COMMAND_SET_ANIM_GROUP_FOR_CHAR: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - pPed->m_animGroup = (AssocGroupId)ScriptParams[1]; + pPed->m_animGroup = (AssocGroupId)GET_INTEGER_PARAM(1); + pPed->b1A1_20 = false; return 0; } /* case COMMAND_SET_ANIM_GROUP_FOR_PLAYER: { CollectParameters(&m_nIp, 2); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); - pPed->m_animGroup = (AssocGroupId)ScriptParams[1]; + pPed->m_animGroup = (AssocGroupId)GET_INTEGER_PARAM(1); return 0; } */ case COMMAND_REQUEST_MODEL: { CollectParameters(&m_nIp, 1); - int model = ScriptParams[0]; + int model = GET_INTEGER_PARAM(0); if (model < 0) model = CTheScripts::UsedObjectArray[-model].index; - CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_NOFADE | STREAMFLAGS_SCRIPTOWNED); + CStreaming::RequestModel(model, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_NOFADE | (m_bIsMissionScript ? STREAMFLAGS_SCRIPTOWNED : STREAMFLAGS_AMBIENT_SCRIPT_OWNED)); + if (model == MI_MINIGUN) +#ifdef FIX_BUGS + CStreaming::RequestModel(MI_MINIGUN2, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_NOFADE | (m_bIsMissionScript ? STREAMFLAGS_SCRIPTOWNED : STREAMFLAGS_AMBIENT_SCRIPT_OWNED)); +#else + CStreaming::RequestModel(MI_MINIGUN2, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_NOFADE | STREAMFLAGS_SCRIPTOWNED); +#endif return 0; } case COMMAND_HAS_MODEL_LOADED: { CollectParameters(&m_nIp, 1); - int model = ScriptParams[0]; + int model = GET_INTEGER_PARAM(0); if (model < 0) model = CTheScripts::UsedObjectArray[-model].index; - UpdateCompareFlag(CStreaming::HasModelLoaded(model)); + UpdateCompareFlag(CStreaming::HasModelLoaded(model)/* || cWorldStream::Instance()->pDynamic(model, 0) */); // TODO return 0; } case COMMAND_MARK_MODEL_AS_NO_LONGER_NEEDED: { CollectParameters(&m_nIp, 1); - int model = ScriptParams[0]; + int model = GET_INTEGER_PARAM(0); if (model < 0) model = CTheScripts::UsedObjectArray[-model].index; CStreaming::SetMissionDoesntRequireModel(model); @@ -777,7 +780,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) case COMMAND_GRAB_PHONE: { CollectParameters(&m_nIp, 2); - ScriptParams[0] = gPhoneInfo.GrabPhone(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]); + SET_INTEGER_PARAM(0, gPhoneInfo.GrabPhone(GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1))); StoreParameters(&m_nIp, 1); return 0; } @@ -786,80 +789,85 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) { CollectParameters(&m_nIp, 1); wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); - gPhoneInfo.SetPhoneMessage_Repeatedly(ScriptParams[0], text, nil, nil, nil, nil, nil); + gPhoneInfo.SetPhoneMessage_Repeatedly(GET_INTEGER_PARAM(0), text, nil, nil, nil, nil, nil); return 0; } case COMMAND_SET_PHONE_MESSAGE: { CollectParameters(&m_nIp, 1); wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); - gPhoneInfo.SetPhoneMessage_JustOnce(ScriptParams[0], text, nil, nil, nil, nil, nil); + gPhoneInfo.SetPhoneMessage_JustOnce(GET_INTEGER_PARAM(0), text, nil, nil, nil, nil, nil); return 0; } case COMMAND_HAS_PHONE_DISPLAYED_MESSAGE: { CollectParameters(&m_nIp, 1); - UpdateCompareFlag(gPhoneInfo.HasMessageBeenDisplayed(ScriptParams[0])); + UpdateCompareFlag(gPhoneInfo.HasMessageBeenDisplayed(GET_INTEGER_PARAM(0))); return 0; } */ case COMMAND_TURN_PHONE_OFF: { CollectParameters(&m_nIp, 1); - gPhoneInfo.SetPhoneMessage_JustOnce(ScriptParams[0], nil, nil, nil, nil, nil, nil); + gPhoneInfo.SetPhoneMessage_JustOnce(GET_INTEGER_PARAM(0), nil, nil, nil, nil, nil, nil); return 0; } case COMMAND_DRAW_CORONA: { + uint32 ip = m_nIp; + int32* ptr = GetPointerToScriptVariable(&ip, 0); CollectParameters(&m_nIp, 9); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - CCoronas::RegisterCorona((uintptr)this + m_nIp, ScriptParams[6], ScriptParams[7], ScriptParams[8], - 255, pos, *(float*)&ScriptParams[3], 150.0f, ScriptParams[4], ScriptParams[5], 1, 0, 0, 0.0f); + CCoronas::RegisterCorona((uintptr)ptr, GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), GET_INTEGER_PARAM(8), + 255, pos, -GET_FLOAT_PARAM(3), 450.0f, GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5), 1, 0, 0, 0.0f); return 0; } + /* case COMMAND_DRAW_LIGHT: { CollectParameters(&m_nIp, 6); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); CVector unused(0.0f, 0.0f, 0.0f); - CPointLights::AddLight(0, *(CVector*)&ScriptParams[0], CVector(0.0f, 0.0f, 0.0f), 12.0f, - ScriptParams[3] / 255.0f, ScriptParams[4] / 255.0f, ScriptParams[5] / 255.0f, 0, true); + CPointLights::AddLight(0, GET_VECTOR_PARAM(0), CVector(0.0f, 0.0f, 0.0f), 12.0f, + GET_INTEGER_PARAM(3) / 255.0f, GET_INTEGER_PARAM(4) / 255.0f, GET_INTEGER_PARAM(5) / 255.0f, 0, true); return 0; } - //case COMMAND_STORE_WEATHER: - //case COMMAND_RESTORE_WEATHER: + */ + case COMMAND_STORE_WEATHER: + CWeather::StoreWeatherState(); + return 0; + case COMMAND_RESTORE_WEATHER: + CWeather::RestoreWeatherState(); case COMMAND_STORE_CLOCK: CClock::StoreClock(); return 0; case COMMAND_RESTORE_CLOCK: CClock::RestoreClock(); return 0; - /* case COMMAND_RESTART_CRITICAL_MISSION: { CollectParameters(&m_nIp, 4); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - CRestart::OverrideNextRestart(pos, *(float*)&ScriptParams[3]); + CRestart::OverrideNextRestart(pos, GET_FLOAT_PARAM(3)); if (CWorld::Players[CWorld::PlayerInFocus].m_WBState != WBSTATE_PLAYING) printf("RESTART_CRITICAL_MISSION - Player state is not PLAYING\n"); CWorld::Players[CWorld::PlayerInFocus].PlayerFailedCriticalMission(); return 0; } - */ case COMMAND_IS_PLAYER_PLAYING: { CollectParameters(&m_nIp, 1); - UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_WBState == WBSTATE_PLAYING); + UpdateCompareFlag(CWorld::Players[GET_INTEGER_PARAM(0)].m_WBState == WBSTATE_PLAYING); return 0; } #ifdef GTA_SCRIPT_COLLECTIVE case COMMAND_SET_COLL_OBJ_NO_OBJ: CollectParameters(&m_nIp, 1); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_NONE); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_NONE); return 0; #endif default: @@ -874,134 +882,134 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) #ifdef GTA_SCRIPT_COLLECTIVE case COMMAND_SET_COLL_OBJ_WAIT_ON_FOOT: CollectParameters(&m_nIp, 1); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_WAIT_ON_FOOT); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_WAIT_ON_FOOT); return 0; case COMMAND_SET_COLL_OBJ_FLEE_ON_FOOT_TILL_SAFE: CollectParameters(&m_nIp, 1); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE); return 0; case COMMAND_SET_COLL_OBJ_GUARD_SPOT: { CollectParameters(&m_nIp, 4); - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GUARD_AREA, pos); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_GUARD_AREA, pos); return 0; } case COMMAND_SET_COLL_OBJ_GUARD_AREA: { CollectParameters(&m_nIp, 5); - float infX = *(float*)&ScriptParams[1]; - float supX = *(float*)&ScriptParams[3]; + float infX = GET_FLOAT_PARAM(1); + float supX = GET_FLOAT_PARAM(3); if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[1]; + infX = GET_FLOAT_PARAM(3); + supX = GET_FLOAT_PARAM(1); } - float infY = *(float*)&ScriptParams[2]; - float supY = *(float*)&ScriptParams[4]; + float infY = GET_FLOAT_PARAM(2); + float supY = GET_FLOAT_PARAM(4); if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[2]; + infY = GET_FLOAT_PARAM(4); + supY = GET_FLOAT_PARAM(2); } CVector pos; pos.x = (infX + supX) / 2; pos.y = (infY + supY) / 2; pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); float radius = Max(pos.x - infX, pos.y - infY); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GUARD_AREA, pos, radius); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_GUARD_AREA, pos, radius); return 0; } case COMMAND_SET_COLL_OBJ_WAIT_IN_CAR: CollectParameters(&m_nIp, 1); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_WAIT_IN_CAR); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_WAIT_IN_CAR); return 0; case COMMAND_SET_COLL_OBJ_KILL_CHAR_ON_FOOT: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ON_FOOT, pPed); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_KILL_CHAR_ON_FOOT, pPed); return 0; } case COMMAND_SET_COLL_OBJ_KILL_PLAYER_ON_FOOT: { CollectParameters(&m_nIp, 2); - CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed; - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ON_FOOT, pPed); + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed; + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_KILL_CHAR_ON_FOOT, pPed); return 0; } case COMMAND_SET_COLL_OBJ_KILL_CHAR_ANY_MEANS: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ANY_MEANS, pPed); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_KILL_CHAR_ANY_MEANS, pPed); return 0; } case COMMAND_SET_COLL_OBJ_KILL_PLAYER_ANY_MEANS: { CollectParameters(&m_nIp, 2); - CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed; - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_KILL_CHAR_ANY_MEANS, pPed); + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed; + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_KILL_CHAR_ANY_MEANS, pPed); return 0; } case COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_TILL_SAFE: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pPed); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pPed); return 0; } case COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_TILL_SAFE: { CollectParameters(&m_nIp, 2); - CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed; - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pPed); + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed; + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, pPed); return 0; } case COMMAND_SET_COLL_OBJ_FLEE_CHAR_ON_FOOT_ALWAYS: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pPed); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pPed); return 0; } case COMMAND_SET_COLL_OBJ_FLEE_PLAYER_ON_FOOT_ALWAYS: { CollectParameters(&m_nIp, 2); - CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed; - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pPed); + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed; + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, pPed); return 0; } case COMMAND_SET_COLL_OBJ_GOTO_CHAR_ON_FOOT: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_CHAR_ON_FOOT, pPed); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_GOTO_CHAR_ON_FOOT, pPed); return 0; } case COMMAND_SET_COLL_OBJ_GOTO_PLAYER_ON_FOOT: { CollectParameters(&m_nIp, 2); - CPed* pPed = CWorld::Players[ScriptParams[1]].m_pPed; - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_CHAR_ON_FOOT, pPed); + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(1)].m_pPed; + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_GOTO_CHAR_ON_FOOT, pPed); return 0; } case COMMAND_SET_COLL_OBJ_LEAVE_CAR: CollectParameters(&m_nIp, 1); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_LEAVE_CAR); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_LEAVE_CAR); return 0; case COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_PASSENGER: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_ENTER_CAR_AS_PASSENGER, pVehicle); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_ENTER_CAR_AS_PASSENGER, pVehicle); return 0; } case COMMAND_SET_COLL_OBJ_ENTER_CAR_AS_DRIVER: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_ENTER_CAR_AS_DRIVER, pVehicle); return 0; } /* @@ -1012,31 +1020,31 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) case COMMAND_SET_COLL_OBJ_DESTROY_CAR: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_DESTROY_CAR, pVehicle); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1)); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_DESTROY_CAR, pVehicle); return 0; } case COMMAND_SET_COLL_OBJ_GOTO_AREA_ON_FOOT: { CollectParameters(&m_nIp, 5); - float infX = *(float*)&ScriptParams[1]; - float supX = *(float*)&ScriptParams[3]; + float infX = GET_FLOAT_PARAM(1); + float supX = GET_FLOAT_PARAM(3); if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[1]; + infX = GET_FLOAT_PARAM(3); + supX = GET_FLOAT_PARAM(1); } - float infY = *(float*)&ScriptParams[2]; - float supY = *(float*)&ScriptParams[4]; + float infY = GET_FLOAT_PARAM(2); + float supY = GET_FLOAT_PARAM(4); if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[2]; + infY = GET_FLOAT_PARAM(4); + supY = GET_FLOAT_PARAM(2); } CVector pos; pos.x = (infX + supX) / 2; pos.y = (infY + supY) / 2; pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); float radius = Max(pos.x - infX, pos.y - infY); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_AREA_ON_FOOT, pos, radius); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_GOTO_AREA_ON_FOOT, pos, radius); return 0; } /* @@ -1046,66 +1054,66 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) */ case COMMAND_SET_COLL_OBJ_FOLLOW_ROUTE: CollectParameters(&m_nIp, 3); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_FOLLOW_ROUTE, ScriptParams[1], ScriptParams[2]); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_FOLLOW_ROUTE, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2)); return 0; case COMMAND_SET_COLL_OBJ_GOTO_COORD_ON_FOOT: { CollectParameters(&m_nIp, 3); - CVector pos(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2], CWorld::FindGroundZForCoord(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2])); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_AREA_ON_FOOT, pos); + CVector pos(GET_FLOAT_PARAM(1), GET_FLOAT_PARAM(2), CWorld::FindGroundZForCoord(GET_FLOAT_PARAM(1), GET_FLOAT_PARAM(2))); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_GOTO_AREA_ON_FOOT, pos); return 0; } //case COMMAND_SET_COLL_OBJ_GOTO_COORD_IN_CAR: case COMMAND_SET_COLL_OBJ_RUN_TO_AREA: { CollectParameters(&m_nIp, 5); - float infX = *(float*)&ScriptParams[1]; - float supX = *(float*)&ScriptParams[3]; + float infX = GET_FLOAT_PARAM(1); + float supX = GET_FLOAT_PARAM(3); if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[1]; + infX = GET_FLOAT_PARAM(3); + supX = GET_FLOAT_PARAM(1); } - float infY = *(float*)&ScriptParams[2]; - float supY = *(float*)&ScriptParams[4]; + float infY = GET_FLOAT_PARAM(2); + float supY = GET_FLOAT_PARAM(4); if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[2]; + infY = GET_FLOAT_PARAM(4); + supY = GET_FLOAT_PARAM(2); } CVector pos; pos.x = (infX + supX) / 2; pos.y = (infY + supY) / 2; pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); float radius = Max(pos.x - infX, pos.y - infY); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_RUN_TO_AREA, pos, radius); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_RUN_TO_AREA, pos, radius); return 0; } case COMMAND_SET_COLL_OBJ_RUN_TO_COORD: { CollectParameters(&m_nIp, 3); - CVector pos(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2], CWorld::FindGroundZForCoord(*(float*)&ScriptParams[1], *(float*)&ScriptParams[2])); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_RUN_TO_AREA, pos); + CVector pos(GET_FLOAT_PARAM(1), GET_FLOAT_PARAM(2), CWorld::FindGroundZForCoord(GET_FLOAT_PARAM(1), GET_FLOAT_PARAM(2))); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_RUN_TO_AREA, pos); return 0; } case COMMAND_ADD_PEDS_IN_AREA_TO_COLL: { CollectParameters(&m_nIp, 3); - float X = *(float*)&ScriptParams[0]; - float Y = *(float*)&ScriptParams[1]; + float X = GET_FLOAT_PARAM(0); + float Y = GET_FLOAT_PARAM(1); float Z = CWorld::FindGroundZForCoord(X, Y); - float radius = *(float*)&ScriptParams[2]; - ScriptParams[0] = CTheScripts::AddPedsInAreaToCollective(X, Y, Z, radius); + float radius = GET_FLOAT_PARAM(2); + SET_INTEGER_PARAM(0, CTheScripts::AddPedsInAreaToCollective(X, Y, Z, radius)); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_ADD_PEDS_IN_VEHICLE_TO_COLL: CollectParameters(&m_nIp, 1); - ScriptParams[0] = CTheScripts::AddPedsInVehicleToCollective(ScriptParams[0]); + SET_INTEGER_PARAM(0, CTheScripts::AddPedsInVehicleToCollective(GET_INTEGER_PARAM(0))); StoreParameters(&m_nIp, 1); return 0; case COMMAND_CLEAR_COLL: CollectParameters(&m_nIp, 1); for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { - if (CTheScripts::CollectiveArray[i].colIndex == ScriptParams[0]) { + if (CTheScripts::CollectiveArray[i].colIndex == GET_INTEGER_PARAM(0)) { CTheScripts::CollectiveArray[i].colIndex = -1; CTheScripts::CollectiveArray[i].pedIndex = 0; } @@ -1174,7 +1182,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) total++; } } - ScriptParams[0] = total; + SET_INTEGER_PARAM(0, total); StoreParameters(&m_nIp, 1); return 0; } @@ -1182,72 +1190,73 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) case COMMAND_SET_CHAR_HEED_THREATS: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - pPed->bRespondsToThreats = (ScriptParams[1] != 0); + pPed->bRespondsToThreats = (GET_INTEGER_PARAM(1) != 0); return 0; } case COMMAND_SET_PLAYER_HEED_THREATS: { CollectParameters(&m_nIp, 2); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); - pPed->bRespondsToThreats = (ScriptParams[1] != 0); + pPed->bRespondsToThreats = (GET_INTEGER_PARAM(1) != 0); return 0; } case COMMAND_GET_CONTROLLER_MODE: #if defined(GTA_PC) && !defined(DETECT_PAD_INPUT_SWITCH) - ScriptParams[0] = 0; + SET_INTEGER_PARAM(0, 0); #else - ScriptParams[0] = CPad::IsAffectedByController ? CPad::GetPad(0)->Mode : 0; + SET_INTEGER_PARAM(0, CPad::IsAffectedByController ? CPad::GetPad(0)->Mode : 0); #endif StoreParameters(&m_nIp, 1); return 0; case COMMAND_SET_CAN_RESPRAY_CAR: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); //assert(pVehicle->m_vehType == VEHICLE_TYPE_CAR); // they DO call this for bikes, we don't really want to destroy the structure... #ifdef FIX_BUGS if (pVehicle->m_vehType == VEHICLE_TYPE_CAR) #endif - ((CAutomobile*)pVehicle)->bFixedColour = (ScriptParams[1] == 0); + ((CAutomobile*)pVehicle)->bFixedColour = (GET_INTEGER_PARAM(1) == 0); return 0; } - /* case COMMAND_IS_TAXI: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); UpdateCompareFlag(pVehicle->IsTaxi()); return 0; } - */ case COMMAND_UNLOAD_SPECIAL_CHARACTER: CollectParameters(&m_nIp, 1); - CStreaming::SetMissionDoesntRequireSpecialChar(ScriptParams[0] - 1); + if (m_bIsMissionScript) + CStreaming::SetMissionDoesntRequireSpecialChar(GET_INTEGER_PARAM(0) - 1); + //else + // CStreaming::SetAmbientMissionDoesntRequireSpecialChar(GET_INTEGER_PARAM(0) - 1); // TODO return 0; case COMMAND_RESET_NUM_OF_MODELS_KILLED_BY_PLAYER: CDarkel::ResetModelsKilledByPlayer(); return 0; case COMMAND_GET_NUM_OF_MODELS_KILLED_BY_PLAYER: CollectParameters(&m_nIp, 1); - ScriptParams[0] = CDarkel::QueryModelsKilledByPlayer(ScriptParams[0]); + SET_INTEGER_PARAM(0, CDarkel::QueryModelsKilledByPlayer(GET_INTEGER_PARAM(0))); StoreParameters(&m_nIp, 1); return 0; /* case COMMAND_ACTIVATE_GARAGE: CollectParameters(&m_nIp, 1); - CGarages::ActivateGarage(ScriptParams[0]); + CGarages::ActivateGarage(GET_INTEGER_PARAM(0)); return 0; case COMMAND_SWITCH_TAXI_TIMER: { CollectParameters(&m_nIp, 1); - if (ScriptParams[0] != 0){ + if (GET_INTEGER_PARAM(0) != 0){ CWorld::Players[CWorld::PlayerInFocus].m_nUnusedTaxiTimer = CTimer::GetTimeInMilliseconds(); CWorld::Players[CWorld::PlayerInFocus].m_bUnusedTaxiThing = true; }else{ @@ -1259,10 +1268,10 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) case COMMAND_CREATE_OBJECT_NO_OFFSET: { CollectParameters(&m_nIp, 4); - int mi = ScriptParams[0] >= 0 ? ScriptParams[0] : CTheScripts::UsedObjectArray[-ScriptParams[0]].index; + int mi = GET_INTEGER_PARAM(0) >= 0 ? GET_INTEGER_PARAM(0) : CTheScripts::UsedObjectArray[-GET_INTEGER_PARAM(0)].index; CObject* pObj = new CObject(mi, false); ; pObj->ObjectCreatedBy = MISSION_OBJECT; - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pObj->SetPosition(pos); @@ -1274,37 +1283,37 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) pObj->SetupBigBuilding(); CTheScripts::ClearSpaceForMissionEntity(pos, pObj); CWorld::Add(pObj); - ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj); + SET_INTEGER_PARAM(0, CPools::GetObjectPool()->GetIndex(pObj)); StoreParameters(&m_nIp, 1); if (m_bIsMissionScript) - CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT); + CTheScripts::MissionCleanUp.AddEntityToList(GET_INTEGER_PARAM(0), CLEANUP_OBJECT); return 0; } - /* case COMMAND_IS_BOAT: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - UpdateCompareFlag(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); + UpdateCompareFlag(pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT); return 0; } + /* case COMMAND_SET_CHAR_OBJ_GOTO_AREA_ANY_MEANS: { CollectParameters(&m_nIp, 5); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - float infX = *(float*)&ScriptParams[1]; - float infY = *(float*)&ScriptParams[2]; - float supX = *(float*)&ScriptParams[3]; - float supY = *(float*)&ScriptParams[4]; + float infX = GET_FLOAT_PARAM(1); + float infY = GET_FLOAT_PARAM(2); + float supX = GET_FLOAT_PARAM(3); + float supY = GET_FLOAT_PARAM(4); if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[1]; + infX = GET_FLOAT_PARAM(3); + supX = GET_FLOAT_PARAM(1); } if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[2]; + infY = GET_FLOAT_PARAM(4); + supY = GET_FLOAT_PARAM(2); } CVector pos; pos.x = (infX + supX) / 2; @@ -1315,105 +1324,107 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) pPed->SetObjective(OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius); return 0; } - */ #ifdef GTA_SCRIPT_COLLECTIVE case COMMAND_SET_COLL_OBJ_GOTO_AREA_ANY_MEANS: { CollectParameters(&m_nIp, 5); - float infX = *(float*)&ScriptParams[1]; - float supX = *(float*)&ScriptParams[3]; + float infX = GET_FLOAT_PARAM(1); + float supX = GET_FLOAT_PARAM(3); if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[1]; + infX = GET_FLOAT_PARAM(3); + supX = GET_FLOAT_PARAM(1); } - float infY = *(float*)&ScriptParams[2]; - float supY = *(float*)&ScriptParams[4]; + float infY = GET_FLOAT_PARAM(2); + float supY = GET_FLOAT_PARAM(4); if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[2]; + infY = GET_FLOAT_PARAM(4); + supY = GET_FLOAT_PARAM(2); } CVector pos; pos.x = (infX + supX) / 2; pos.y = (infY + supY) / 2; pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); float radius = Max(pos.x - infX, pos.y - infY); - CTheScripts::SetObjectiveForAllPedsInCollective(ScriptParams[0], OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius); + CTheScripts::SetObjectiveForAllPedsInCollective(GET_INTEGER_PARAM(0), OBJECTIVE_GOTO_AREA_ANY_MEANS, pos, radius); return 0; } #endif +*/ case COMMAND_IS_PLAYER_STOPPED: { CollectParameters(&m_nIp, 1); - CPlayerInfo* pPlayer = &CWorld::Players[ScriptParams[0]]; + CPlayerInfo* pPlayer = &CWorld::Players[GET_INTEGER_PARAM(0)]; UpdateCompareFlag(CTheScripts::IsPlayerStopped(pPlayer)); return 0; } - /* case COMMAND_IS_CHAR_STOPPED: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); UpdateCompareFlag(CTheScripts::IsPedStopped(pPed)); return 0; } case COMMAND_MESSAGE_WAIT: CollectParameters(&m_nIp, 2); - m_nWakeTime = CTimer::GetTimeInMilliseconds() + ScriptParams[0]; - if (ScriptParams[1] != 0) + m_nWakeTime = CTimer::GetTimeInMilliseconds() + GET_INTEGER_PARAM(0); + if (GET_INTEGER_PARAM(1) != 0) m_bSkipWakeTime = true; return 1; + /* case COMMAND_ADD_PARTICLE_EFFECT: { CollectParameters(&m_nIp, 5); - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - CParticleObject::AddObject(ScriptParams[0], pos, ScriptParams[4] != 0); + CParticleObject::AddObject(GET_INTEGER_PARAM(0), pos, GET_INTEGER_PARAM(4) != 0); return 0; } */ case COMMAND_SWITCH_WIDESCREEN: CollectParameters(&m_nIp, 1); - if (ScriptParams[0] != 0) + if (GET_INTEGER_PARAM(0) != 0) TheCamera.SetWideScreenOn(); - else + else { + // TODO: unknown field TheCamera.SetWideScreenOff(); + } return 0; /* case COMMAND_ADD_SPRITE_BLIP_FOR_CAR: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - int id = CRadar::SetEntityBlip(BLIP_CAR, ScriptParams[0], 0, BLIP_DISPLAY_BOTH); - CRadar::SetBlipSprite(id, ScriptParams[1]); - ScriptParams[0] = id; + int id = CRadar::SetEntityBlip(BLIP_CAR, GET_INTEGER_PARAM(0), 0, BLIP_DISPLAY_BOTH); + CRadar::SetBlipSprite(id, GET_INTEGER_PARAM(1)); + SET_INTEGER_PARAM(0, id); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_ADD_SPRITE_BLIP_FOR_CHAR: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - int id = CRadar::SetEntityBlip(BLIP_CHAR, ScriptParams[0], 1, BLIP_DISPLAY_BOTH); - CRadar::SetBlipSprite(id, ScriptParams[1]); - ScriptParams[0] = id; + int id = CRadar::SetEntityBlip(BLIP_CHAR, GET_INTEGER_PARAM(0), 1, BLIP_DISPLAY_BOTH); + CRadar::SetBlipSprite(id, GET_INTEGER_PARAM(1)); + SET_INTEGER_PARAM(0, id); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_ADD_SPRITE_BLIP_FOR_OBJECT: { CollectParameters(&m_nIp, 2); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pObject); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - int id = CRadar::SetEntityBlip(BLIP_OBJECT, ScriptParams[0], 6, BLIP_DISPLAY_BOTH); - CRadar::SetBlipSprite(id, ScriptParams[1]); - ScriptParams[0] = id; + int id = CRadar::SetEntityBlip(BLIP_OBJECT, GET_INTEGER_PARAM(0), 6, BLIP_DISPLAY_BOTH); + CRadar::SetBlipSprite(id, GET_INTEGER_PARAM(1)); + SET_INTEGER_PARAM(0, id); StoreParameters(&m_nIp, 1); return 0; } @@ -1421,67 +1432,67 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) case COMMAND_ADD_SPRITE_BLIP_FOR_CONTACT_POINT: { CollectParameters(&m_nIp, 4); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); int id = CRadar::SetCoordBlip(BLIP_CONTACT_POINT, pos, 2, BLIP_DISPLAY_BOTH); - CRadar::SetBlipSprite(id, ScriptParams[3]); - ScriptParams[0] = id; + CRadar::SetBlipSprite(id, GET_INTEGER_PARAM(3)); + SET_INTEGER_PARAM(0, id); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_ADD_SPRITE_BLIP_FOR_COORD: { CollectParameters(&m_nIp, 4); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - int id = CRadar::SetCoordBlip(BLIP_COORD, pos, 5, BLIP_DISPLAY_BOTH); - CRadar::SetBlipSprite(id, ScriptParams[3]); - ScriptParams[0] = id; + int id = CRadar::SetCoordBlip(BLIP_COORD, pos, 4, BLIP_DISPLAY_BOTH); + CRadar::SetBlipSprite(id, GET_INTEGER_PARAM(3)); + SET_INTEGER_PARAM(0, id); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_SET_CHAR_ONLY_DAMAGED_BY_PLAYER: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - pPed->bOnlyDamagedByPlayer = (ScriptParams[1] != 0); + pPed->bOnlyDamagedByPlayer = (GET_INTEGER_PARAM(1) != 0); return 0; } case COMMAND_SET_CAR_ONLY_DAMAGED_BY_PLAYER: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - pVehicle->bOnlyDamagedByPlayer = (ScriptParams[1] != 0); + pVehicle->bOnlyDamagedByPlayer = (GET_INTEGER_PARAM(1) != 0); return 0; } case COMMAND_SET_CHAR_PROOFS: { CollectParameters(&m_nIp, 6); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - pPed->bBulletProof = (ScriptParams[1] != 0); - pPed->bFireProof = (ScriptParams[2] != 0); - pPed->bExplosionProof = (ScriptParams[3] != 0); - pPed->bCollisionProof = (ScriptParams[4] != 0); - pPed->bMeleeProof = (ScriptParams[5] != 0); + pPed->bBulletProof = (GET_INTEGER_PARAM(1) != 0); + pPed->bFireProof = (GET_INTEGER_PARAM(2) != 0); + pPed->bExplosionProof = (GET_INTEGER_PARAM(3) != 0); + pPed->bCollisionProof = (GET_INTEGER_PARAM(4) != 0); + pPed->bMeleeProof = (GET_INTEGER_PARAM(5) != 0); return 0; } case COMMAND_SET_CAR_PROOFS: { CollectParameters(&m_nIp, 6); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - pVehicle->bBulletProof = (ScriptParams[1] != 0); - pVehicle->bFireProof = (ScriptParams[2] != 0); - pVehicle->bExplosionProof = (ScriptParams[3] != 0); - pVehicle->bCollisionProof = (ScriptParams[4] != 0); - pVehicle->bMeleeProof = (ScriptParams[5] != 0); + pVehicle->bBulletProof = (GET_INTEGER_PARAM(1) != 0); + pVehicle->bFireProof = (GET_INTEGER_PARAM(2) != 0); + pVehicle->bExplosionProof = (GET_INTEGER_PARAM(3) != 0); + pVehicle->bCollisionProof = (GET_INTEGER_PARAM(4) != 0); + pVehicle->bMeleeProof = (GET_INTEGER_PARAM(5) != 0); return 0; } case COMMAND_IS_PLAYER_IN_ANGLED_AREA_2D: @@ -1501,16 +1512,16 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) /* case COMMAND_DEACTIVATE_GARAGE: CollectParameters(&m_nIp, 1); - CGarages::DeActivateGarage(ScriptParams[0]); + CGarages::DeActivateGarage(GET_INTEGER_PARAM(0)); return 0; case COMMAND_GET_NUMBER_OF_CARS_COLLECTED_BY_GARAGE: CollectParameters(&m_nIp, 1); - ScriptParams[0] = CGarages::QueryCarsCollected(ScriptParams[0]); + SET_INTEGER_PARAM(0, CGarages::QueryCarsCollected(GET_INTEGER_PARAM(0))); StoreParameters(&m_nIp, 1); return 0; case COMMAND_HAS_CAR_BEEN_TAKEN_TO_GARAGE: CollectParameters(&m_nIp, 2); - UpdateCompareFlag(CGarages::HasThisCarBeenCollected(ScriptParams[0], ScriptParams[1] - 1)); + UpdateCompareFlag(CGarages::HasThisCarBeenCollected(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1) - 1)); return 0; */ default: @@ -1525,54 +1536,55 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) /* case COMMAND_SET_SWAT_REQUIRED: CollectParameters(&m_nIp, 1); - FindPlayerPed()->m_pWanted->m_bSwatRequired = (ScriptParams[0] != 0); + FindPlayerPed()->m_pWanted->m_bSwatRequired = (GET_INTEGER_PARAM(0) != 0); return 0; case COMMAND_SET_FBI_REQUIRED: CollectParameters(&m_nIp, 1); - FindPlayerPed()->m_pWanted->m_bFbiRequired = (ScriptParams[0] != 0); + FindPlayerPed()->m_pWanted->m_bFbiRequired = (GET_INTEGER_PARAM(0) != 0); return 0; case COMMAND_SET_ARMY_REQUIRED: CollectParameters(&m_nIp, 1); - FindPlayerPed()->m_pWanted->m_bArmyRequired = (ScriptParams[0] != 0); + FindPlayerPed()->m_pWanted->m_bArmyRequired = (GET_INTEGER_PARAM(0) != 0); return 0; */ case COMMAND_IS_CAR_IN_WATER: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); UpdateCompareFlag(pVehicle && pVehicle->bIsInWater); return 0; } case COMMAND_GET_CLOSEST_CHAR_NODE: { CollectParameters(&m_nIp, 3); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 1, 999999.9f, true)]; - *(CVector*)&ScriptParams[0] = pNode->GetPosition(); + CPathNode* pNode = &ThePaths.m_pathNodes[ThePaths.FindNodeClosestToCoors(pos, 1, 800.0f, true)]; + SET_VECTOR_PARAM(0, pNode->GetPosition()); StoreParameters(&m_nIp, 3); return 0; } case COMMAND_GET_CLOSEST_CAR_NODE: { CollectParameters(&m_nIp, 3); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - *(CVector*)&ScriptParams[0] = ThePaths.FindNodeCoorsForScript(ThePaths.FindNodeClosestToCoors(pos, 0, 999999.9f, true, true)); + SET_VECTOR_PARAM(0, ThePaths.FindNodeCoorsForScript(ThePaths.FindNodeClosestToCoors(pos, 0, 800.0f, true, true))); StoreParameters(&m_nIp, 3); return 0; } case COMMAND_CAR_GOTO_COORDINATES_ACCURATE: { CollectParameters(&m_nIp, 4); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z += pVehicle->GetDistanceFromCentreOfMassToBaseOfModel(); + uint8 nOldMission = pVehicle->AutoPilot.m_nCarMission; if (CCarCtrl::JoinCarWithRoadSystemGotoCoors(pVehicle, pos, false)) pVehicle->AutoPilot.m_nCarMission = MISSION_GOTO_COORDS_STRAIGHT_ACCURATE; else @@ -1580,19 +1592,20 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) pVehicle->SetStatus(STATUS_PHYSICS); pVehicle->bEngineOn = true; pVehicle->AutoPilot.m_nCruiseSpeed = Max(1, pVehicle->AutoPilot.m_nCruiseSpeed); - pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); + if (nOldMission != pVehicle->AutoPilot.m_nCarMission) + pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds(); return 0; } /* case COMMAND_START_PACMAN_RACE: CollectParameters(&m_nIp, 1); - CPacManPickups::StartPacManRace(ScriptParams[0]); + CPacManPickups::StartPacManRace(GET_INTEGER_PARAM(0)); return 0; case COMMAND_START_PACMAN_RECORD: CPacManPickups::StartPacManRecord(); return 0; case COMMAND_GET_NUMBER_OF_POWER_PILLS_EATEN: - ScriptParams[0] = CPacManPickups::QueryPowerPillsEatenInRace(); + SET_INTEGER_PARAM(0, CPacManPickups::QueryPowerPillsEatenInRace()); StoreParameters(&m_nIp, 1); return 0; case COMMAND_CLEAR_PACMAN: @@ -1601,14 +1614,14 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_START_PACMAN_SCRAMBLE: { CollectParameters(&m_nIp, 5); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - CPacManPickups::StartPacManScramble(pos, *(float*)&ScriptParams[3], ScriptParams[4]); + CPacManPickups::StartPacManScramble(pos, GET_FLOAT_PARAM(3), GET_INTEGER_PARAM(4)); return 0; } case COMMAND_GET_NUMBER_OF_POWER_PILLS_CARRIED: - ScriptParams[0] = CPacManPickups::QueryPowerPillsCarriedByPlayer(); + SET_INTEGER_PARAM(0, CPacManPickups::QueryPowerPillsCarriedByPlayer()); StoreParameters(&m_nIp, 1); return 0; case COMMAND_CLEAR_NUMBER_OF_POWER_PILLS_CARRIED: @@ -1618,7 +1631,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_IS_CAR_ON_SCREEN: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); UpdateCompareFlag(TheCamera.IsSphereVisible(pVehicle->GetBoundCentre(), pVehicle->GetBoundRadius())); return 0; @@ -1626,7 +1639,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_IS_CHAR_ON_SCREEN: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); UpdateCompareFlag(TheCamera.IsSphereVisible(pPed->GetBoundCentre(), pPed->GetBoundRadius())); return 0; @@ -1634,67 +1647,65 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_IS_OBJECT_ON_SCREEN: { CollectParameters(&m_nIp, 1); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pObject); UpdateCompareFlag(TheCamera.IsSphereVisible(pObject->GetBoundCentre(), pObject->GetBoundRadius())); return 0; } - /* case COMMAND_GOSUB_FILE: { CollectParameters(&m_nIp, 2); script_assert(m_nStackPointer < MAX_STACK_DEPTH); m_anStack[m_nStackPointer++] = m_nIp; - SetIP(ScriptParams[0]); - // ScriptParams[1] == filename + SetIP(GET_INTEGER_PARAM(0)); + // GET_INTEGER_PARAM(1) == filename return 0; } - */ case COMMAND_GET_GROUND_Z_FOR_3D_COORD: { CollectParameters(&m_nIp, 3); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); bool success; - *(float*)&ScriptParams[0] = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z, &success); + SET_FLOAT_PARAM(0, CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z, &success)); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_START_SCRIPT_FIRE: { CollectParameters(&m_nIp, 3); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); - ScriptParams[0] = gFireManager.StartScriptFire(pos, nil, 0.8f, 1); + SET_INTEGER_PARAM(0, gFireManager.StartScriptFire(pos, nil, 0.8f, 1)); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_IS_SCRIPT_FIRE_EXTINGUISHED: CollectParameters(&m_nIp, 1); - UpdateCompareFlag(gFireManager.IsScriptFireExtinguish(ScriptParams[0])); + UpdateCompareFlag(gFireManager.IsScriptFireExtinguish(GET_INTEGER_PARAM(0))); return 0; case COMMAND_REMOVE_SCRIPT_FIRE: CollectParameters(&m_nIp, 1); - gFireManager.RemoveScriptFire(ScriptParams[0]); + gFireManager.RemoveScriptFire(GET_INTEGER_PARAM(0)); return 0; /* case COMMAND_SET_COMEDY_CONTROLS: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - pVehicle->bComedyControls = (ScriptParams[1] != 0); + pVehicle->bComedyControls = (GET_INTEGER_PARAM(1) != 0); return 0; } */ case COMMAND_BOAT_GOTO_COORDS: { CollectParameters(&m_nIp, 4); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); script_assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); CBoat* pBoat = (CBoat*)pVehicle; - CVector pos = *(CVector*)&ScriptParams[1]; + CVector pos = GET_VECTOR_PARAM(1); if (pos.z <= MAP_Z_LOW_LIMIT) CWaterLevel::GetWaterLevel(pos.x, pos.y, pos.z, &pos.z, false); pBoat->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_ASTHECROWSWIMS; @@ -1707,7 +1718,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_BOAT_STOP: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); script_assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); CBoat* pBoat = (CBoat*)pVehicle; @@ -1720,14 +1731,14 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_IS_PLAYER_SHOOTING_IN_AREA: { CollectParameters(&m_nIp, 6); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); - float x1 = *(float*)&ScriptParams[1]; - float y1 = *(float*)&ScriptParams[2]; - float x2 = *(float*)&ScriptParams[3]; - float y2 = *(float*)&ScriptParams[4]; + float x1 = GET_FLOAT_PARAM(1); + float y1 = GET_FLOAT_PARAM(2); + float x2 = GET_FLOAT_PARAM(3); + float y2 = GET_FLOAT_PARAM(4); UpdateCompareFlag(pPed->bIsShooting && pPed->IsWithinArea(x1, y1, x2, y2)); - if (ScriptParams[5]) + if (GET_INTEGER_PARAM(5)) CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT); if (CTheScripts::DbgFlag) CTheScripts::DrawDebugSquare(x1, y1, x2, y2); @@ -1736,14 +1747,14 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_IS_CHAR_SHOOTING_IN_AREA: { CollectParameters(&m_nIp, 6); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - float x1 = *(float*)&ScriptParams[1]; - float y1 = *(float*)&ScriptParams[2]; - float x2 = *(float*)&ScriptParams[3]; - float y2 = *(float*)&ScriptParams[4]; + float x1 = GET_FLOAT_PARAM(1); + float y1 = GET_FLOAT_PARAM(2); + float x2 = GET_FLOAT_PARAM(3); + float y2 = GET_FLOAT_PARAM(4); UpdateCompareFlag(pPed->bIsShooting && pPed->IsWithinArea(x1, y1, x2, y2)); - if (ScriptParams[5]) + if (GET_INTEGER_PARAM(5)) CTheScripts::HighlightImportantArea((uintptr)this + m_nIp, x1, y1, x2, y2, MAP_Z_LOW_LIMIT); if (CTheScripts::DbgFlag) CTheScripts::DrawDebugSquare(x1, y1, x2, y2); @@ -1752,17 +1763,17 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_IS_CURRENT_PLAYER_WEAPON: { CollectParameters(&m_nIp, 2); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); - UpdateCompareFlag(ScriptParams[1] == pPed->GetWeapon()->m_eWeaponType); + UpdateCompareFlag(GET_INTEGER_PARAM(1) == pPed->GetWeapon()->m_eWeaponType); return 0; } case COMMAND_IS_CURRENT_CHAR_WEAPON: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - UpdateCompareFlag(ScriptParams[1] == pPed->GetWeapon()->m_eWeaponType); + UpdateCompareFlag(GET_INTEGER_PARAM(1) == pPed->GetWeapon()->m_eWeaponType); return 0; } /* @@ -1772,7 +1783,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_ADD_POWER_PILL: { CollectParameters(&m_nIp, 3); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); CPacManPickups::GenerateOnePMPickUp(pos); @@ -1782,23 +1793,22 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_SET_BOAT_CRUISE_SPEED: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); script_assert(pVehicle->m_vehType == VEHICLE_TYPE_BOAT); CBoat* pBoat = (CBoat*)pVehicle; - pBoat->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[1]; + pBoat->AutoPilot.m_nCruiseSpeed = GET_FLOAT_PARAM(1); return 0; } - /* case COMMAND_GET_RANDOM_CHAR_IN_AREA: { - CollectParameters(&m_nIp, 4); + CollectParameters(&m_nIp, 7); int ped_handle = -1; CVector pos = FindPlayerCoors(); - float x1 = *(float*)&ScriptParams[0]; - float y1 = *(float*)&ScriptParams[1]; - float x2 = *(float*)&ScriptParams[2]; - float y2 = *(float*)&ScriptParams[3]; + float x1 = GET_FLOAT_PARAM(0); + float y1 = GET_FLOAT_PARAM(1); + float x2 = GET_FLOAT_PARAM(2); + float y2 = GET_FLOAT_PARAM(3); int i = CPools::GetPedPool()->GetSize(); while (--i && ped_handle == -1){ CPed* pPed = CPools::GetPedPool()->GetSlot(i); @@ -1814,9 +1824,9 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) continue; if (pPed->bFadeOut) continue; -// if (pPed->GetModelIndex() == MI_SCUM_WOM || pPed->GetModelIndex() == MI_SCUM_MAN) -// continue; - if (!ThisIsAValidRandomPed(pPed->m_nPedType)) + if (pPed->m_nWaitState != WAITSTATE_FALSE) + continue; + if (!ThisIsAValidRandomPed(pPed->m_nPedType, GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7))) continue; if (pPed->bIsLeader || pPed->m_leader) continue; @@ -1834,11 +1844,10 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) if (m_bIsMissionScript) CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR); } - ScriptParams[0] = ped_handle; + SET_INTEGER_PARAM(0, ped_handle); StoreParameters(&m_nIp, 1); return 0; } - */ case COMMAND_GET_RANDOM_CHAR_IN_ZONE: { char zone[KEY_LENGTH_IN_SCRIPT]; @@ -1867,7 +1876,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) continue; if (pPed->m_nWaitState != WAITSTATE_FALSE) continue; - if (!ThisIsAValidRandomPed(pPed->m_nPedType, ScriptParams[0], ScriptParams[1], ScriptParams[2])) + if (!ThisIsAValidRandomPed(pPed->m_nPedType, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2))) continue; if (pPed->bIsLeader || pPed->m_leader) continue; @@ -1889,14 +1898,14 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) if (m_bIsMissionScript) CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR); } - ScriptParams[0] = ped_handle; + SET_INTEGER_PARAM(0, ped_handle); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_IS_PLAYER_IN_TAXI: { CollectParameters(&m_nIp, 1); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle->IsTaxi()); return 0; @@ -1904,7 +1913,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_IS_PLAYER_SHOOTING: { CollectParameters(&m_nIp, 1); - CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed; script_assert(pPed); UpdateCompareFlag(pPed->bIsShooting); return 0; @@ -1912,7 +1921,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_IS_CHAR_SHOOTING: { CollectParameters(&m_nIp, 1); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); UpdateCompareFlag(pPed->bIsShooting); return 0; @@ -1920,28 +1929,28 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_CREATE_MONEY_PICKUP: { CollectParameters(&m_nIp, 4); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET; CPickups::GetActualPickupIndex(CollectNextParameterWithoutIncreasingPC(m_nIp)); - ScriptParams[0] = CPickups::GenerateNewOne(pos, MI_MONEY, PICKUP_MONEY, ScriptParams[3]); + SET_INTEGER_PARAM(0, CPickups::GenerateNewOne(pos, MI_MONEY, PICKUP_MONEY, GET_INTEGER_PARAM(3))); // MI_MONEY -> gpModelIndices[...] StoreParameters(&m_nIp, 1); return 0; } case COMMAND_SET_CHAR_ACCURACY: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - pPed->m_wepAccuracy = ScriptParams[1]; + pPed->m_wepAccuracy = GET_INTEGER_PARAM(1) * 1.25f; return 0; } case COMMAND_GET_CAR_SPEED: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - *(float*)&ScriptParams[0] = pVehicle->GetSpeed().Magnitude() * GAME_SPEED_TO_METERS_PER_SECOND; + SET_FLOAT_PARAM(0, pVehicle->GetSpeed().Magnitude() * GAME_SPEED_TO_METERS_PER_SECOND); StoreParameters(&m_nIp, 1); return 0; } @@ -1949,15 +1958,17 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { char name[KEY_LENGTH_IN_SCRIPT]; strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); + // unknown call FUN_29df68(name) on PS2 m_nIp += KEY_LENGTH_IN_SCRIPT; + CColStore::RemoveAllCollision(); CCutsceneMgr::LoadCutsceneData(name); return 0; } case COMMAND_CREATE_CUTSCENE_OBJECT: { CollectParameters(&m_nIp, 1); - CCutsceneObject* pCutObj = CCutsceneMgr::CreateCutsceneObject(ScriptParams[0]); - ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pCutObj); + CCutsceneObject* pCutObj = CCutsceneMgr::CreateCutsceneObject(GET_INTEGER_PARAM(0)); + SET_INTEGER_PARAM(0, CPools::GetObjectPool()->GetIndex(pCutObj)); StoreParameters(&m_nIp, 1); return 0; } @@ -1965,7 +1976,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { CollectParameters(&m_nIp, 1); char name[KEY_LENGTH_IN_SCRIPT]; - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); + CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pObject); strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); m_nIp += KEY_LENGTH_IN_SCRIPT; @@ -1973,16 +1984,23 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) return 0; } case COMMAND_START_CUTSCENE: - CCutsceneMgr::ms_cutsceneLoadStatus = 1; + CCutsceneMgr::StartCutscene(); return 0; case COMMAND_GET_CUTSCENE_TIME: - ScriptParams[0] = CCutsceneMgr::GetCutsceneTimeInMilleseconds(); + SET_INTEGER_PARAM(0, CCutsceneMgr::GetCutsceneTimeInMilleseconds()); StoreParameters(&m_nIp, 1); return 0; case COMMAND_HAS_CUTSCENE_FINISHED: - UpdateCompareFlag(CCutsceneMgr::HasCutsceneFinished()); + { + bool bFinished = CCutsceneMgr::HasCutsceneFinished(); + if (bFinished) + printf("cutscene has now finished\n"); + UpdateCompareFlag(bFinished); return 0; + } case COMMAND_CLEAR_CUTSCENE: + // unknown call on PS2 FUN_29DFA0(); + printf("clear cutscene\n"); CCutsceneMgr::DeleteCutsceneData(); return 0; case COMMAND_RESTORE_CAMERA_JUMPCUT: @@ -1991,37 +2009,37 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_CREATE_COLLECTABLE1: { CollectParameters(&m_nIp, 3); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET; - CPickups::GenerateNewOne(pos, MI_COLLECTABLE1, PICKUP_COLLECTABLE1, 0); + CPickups::GenerateNewOne(pos, MI_COLLECTABLE1, PICKUP_COLLECTABLE1, 0); // TODO: gpModelIndices return 0; } case COMMAND_SET_COLLECTABLE1_TOTAL: CollectParameters(&m_nIp, 1); - CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages = ScriptParams[0]; + CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages = GET_INTEGER_PARAM(0); return 0; /* case COMMAND_IS_PROJECTILE_IN_AREA: { CollectParameters(&m_nIp, 6); - float infX = *(float*)&ScriptParams[0]; - float infY = *(float*)&ScriptParams[1]; - float infZ = *(float*)&ScriptParams[2]; - float supX = *(float*)&ScriptParams[3]; - float supY = *(float*)&ScriptParams[4]; - float supZ = *(float*)&ScriptParams[5]; + float infX = GET_FLOAT_PARAM(0); + float infY = GET_FLOAT_PARAM(1); + float infZ = GET_FLOAT_PARAM(2); + float supX = GET_FLOAT_PARAM(3); + float supY = GET_FLOAT_PARAM(4); + float supZ = GET_FLOAT_PARAM(5); if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[0]; + infX = GET_FLOAT_PARAM(3); + supX = GET_FLOAT_PARAM(0); } if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[1]; + infY = GET_FLOAT_PARAM(4); + supY = GET_FLOAT_PARAM(1); } if (infZ > supZ) { - infZ = *(float*)&ScriptParams[5]; - supZ = *(float*)&ScriptParams[2]; + infZ = GET_FLOAT_PARAM(5); + supZ = GET_FLOAT_PARAM(2); } UpdateCompareFlag(CProjectileInfo::IsProjectileInRange(infX, supX, infY, supY, infZ, supZ, false)); if (CTheScripts::DbgFlag) @@ -2031,23 +2049,23 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_DESTROY_PROJECTILES_IN_AREA: { CollectParameters(&m_nIp, 6); - float infX = *(float*)&ScriptParams[0]; - float infY = *(float*)&ScriptParams[1]; - float infZ = *(float*)&ScriptParams[2]; - float supX = *(float*)&ScriptParams[3]; - float supY = *(float*)&ScriptParams[4]; - float supZ = *(float*)&ScriptParams[5]; + float infX = GET_FLOAT_PARAM(0); + float infY = GET_FLOAT_PARAM(1); + float infZ = GET_FLOAT_PARAM(2); + float supX = GET_FLOAT_PARAM(3); + float supY = GET_FLOAT_PARAM(4); + float supZ = GET_FLOAT_PARAM(5); if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[0]; + infX = GET_FLOAT_PARAM(3); + supX = GET_FLOAT_PARAM(0); } if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[1]; + infY = GET_FLOAT_PARAM(4); + supY = GET_FLOAT_PARAM(1); } if (infZ > supZ) { - infZ = *(float*)&ScriptParams[5]; - supZ = *(float*)&ScriptParams[2]; + infZ = GET_FLOAT_PARAM(5); + supZ = GET_FLOAT_PARAM(2); } UpdateCompareFlag(CProjectileInfo::IsProjectileInRange(infX, supX, infY, supY, infZ, supZ, true)); if (CTheScripts::DbgFlag) @@ -2057,7 +2075,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_DROP_MINE: { CollectParameters(&m_nIp, 3); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET; CPickups::GenerateNewOne(pos, MI_CARMINE, PICKUP_MINE_INACTIVE, 0); @@ -2066,7 +2084,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_DROP_NAUTICAL_MINE: { CollectParameters(&m_nIp, 3); - CVector pos = *(CVector*)&ScriptParams[0]; + CVector pos = GET_VECTOR_PARAM(0); if (pos.z <= MAP_Z_LOW_LIMIT) pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y) + PICKUP_PLACEMENT_OFFSET; CPickups::GenerateNewOne(pos, MI_NAUTICALMINE, PICKUP_MINE_INACTIVE, 0); @@ -2076,9 +2094,9 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_IS_CHAR_MODEL: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - UpdateCompareFlag(ScriptParams[1] == pPed->GetModelIndex()); + UpdateCompareFlag(GET_INTEGER_PARAM(1) == pPed->GetModelIndex()); return 0; } case COMMAND_LOAD_SPECIAL_MODEL: @@ -2088,7 +2106,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) strncpy(name, (const char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT); for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++) name[i] = tolower(name[i]); - CStreaming::RequestSpecialModel(ScriptParams[0], name, STREAMFLAGS_DEPENDENCY | STREAMFLAGS_SCRIPTOWNED); + CStreaming::RequestSpecialModel(GET_INTEGER_PARAM(0), name, STREAMFLAGS_DEPENDENCY | (m_bIsMissionScript ? STREAMFLAGS_SCRIPTOWNED : STREAMFLAGS_AMBIENT_SCRIPT_OWNED)); m_nIp += KEY_LENGTH_IN_SCRIPT; return 0; } @@ -2096,102 +2114,98 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) //case COMMAND_SET_CUTSCENE_HEAD_ANIM: case COMMAND_SIN: CollectParameters(&m_nIp, 1); - *(float*)&ScriptParams[0] = Sin(DEGTORAD(*(float*)&ScriptParams[0])); + SET_FLOAT_PARAM(0, Sin(DEGTORAD(GET_FLOAT_PARAM(0)))); StoreParameters(&m_nIp, 1); return 0; case COMMAND_COS: CollectParameters(&m_nIp, 1); - *(float*)&ScriptParams[0] = Cos(DEGTORAD(*(float*)&ScriptParams[0])); + SET_FLOAT_PARAM(0, Cos(DEGTORAD(GET_FLOAT_PARAM(0)))); StoreParameters(&m_nIp, 1); return 0; case COMMAND_GET_CAR_FORWARD_X: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); float forwardX = pVehicle->GetForward().x / pVehicle->GetForward().Magnitude2D(); - *(float*)&ScriptParams[0] = forwardX; + SET_FLOAT_PARAM(0, forwardX); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_GET_CAR_FORWARD_Y: { CollectParameters(&m_nIp, 1); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); float forwardY = pVehicle->GetForward().y / pVehicle->GetForward().Magnitude2D(); - *(float*)&ScriptParams[0] = forwardY; + SET_FLOAT_PARAM(0, forwardY); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_CHANGE_GARAGE_TYPE: CollectParameters(&m_nIp, 2); - CGarages::ChangeGarageType(ScriptParams[0], ScriptParams[1], 0); + CGarages::ChangeGarageType(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), 0); return 0; - /* case COMMAND_ACTIVATE_CRUSHER_CRANE: { CollectParameters(&m_nIp, 10); - float infX = *(float*)&ScriptParams[2]; - float infY = *(float*)&ScriptParams[3]; - float supX = *(float*)&ScriptParams[4]; - float supY = *(float*)&ScriptParams[5]; + float infX = GET_FLOAT_PARAM(2); + float infY = GET_FLOAT_PARAM(3); + float supX = GET_FLOAT_PARAM(4); + float supY = GET_FLOAT_PARAM(5); if (infX > supX) { - infX = *(float*)&ScriptParams[4]; - supX = *(float*)&ScriptParams[2]; + infX = GET_FLOAT_PARAM(4); + supX = GET_FLOAT_PARAM(2); } if (infY > supY) { - infY = *(float*)&ScriptParams[5]; - supY = *(float*)&ScriptParams[3]; + infY = GET_FLOAT_PARAM(5); + supY = GET_FLOAT_PARAM(3); } CCranes::ActivateCrane(infX, supX, infY, supY, - *(float*)&ScriptParams[6], *(float*)&ScriptParams[7], *(float*)&ScriptParams[8], - DEGTORAD(*(float*)&ScriptParams[9]), true, false, - *(float*)&ScriptParams[0], *(float*)&ScriptParams[1]); + GET_FLOAT_PARAM(6), GET_FLOAT_PARAM(7), GET_FLOAT_PARAM(8), + DEGTORAD(GET_FLOAT_PARAM(9)), true, false, + GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1)); return 0; } case COMMAND_PRINT_WITH_2_NUMBERS: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 4); - CMessages::AddMessageWithNumber(text, ScriptParams[2], ScriptParams[3], ScriptParams[0], ScriptParams[1], -1, -1, -1, -1); + CMessages::AddMessageWithNumber(text, GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), -1, -1, -1, -1); return 0; } - */ case COMMAND_PRINT_WITH_2_NUMBERS_NOW: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 4); - CMessages::AddMessageJumpQWithNumber(text, ScriptParams[2], ScriptParams[3], ScriptParams[0], ScriptParams[1], -1, -1, -1, -1); + CMessages::AddMessageJumpQWithNumber(text, GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), -1, -1, -1, -1); return 0; } - /* case COMMAND_PRINT_WITH_2_NUMBERS_SOON: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 4); - CMessages::AddMessageSoonWithNumber(text, ScriptParams[2], ScriptParams[3], ScriptParams[0], ScriptParams[1], -1, -1, -1, -1); + CMessages::AddMessageSoonWithNumber(text, GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), -1, -1, -1, -1); return 0; } - */ case COMMAND_PRINT_WITH_3_NUMBERS: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 5); - CMessages::AddMessageWithNumber(text, ScriptParams[3], ScriptParams[4], ScriptParams[0], ScriptParams[1], ScriptParams[2], -1, -1, -1); + CMessages::AddMessageWithNumber(text, GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), -1, -1, -1); return 0; } - /* case COMMAND_PRINT_WITH_3_NUMBERS_NOW: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 5); - CMessages::AddMessageJumpQWithNumber(text, ScriptParams[3], ScriptParams[4], ScriptParams[0], ScriptParams[1], ScriptParams[2], -1, -1, -1); + CMessages::AddMessageJumpQWithNumber(text, GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), -1, -1, -1); return 0; } + /* case COMMAND_PRINT_WITH_3_NUMBERS_SOON: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 5); - CMessages::AddMessageSoonWithNumber(text, ScriptParams[3], ScriptParams[4], ScriptParams[0], ScriptParams[1], ScriptParams[2], -1, -1, -1); + CMessages::AddMessageSoonWithNumber(text, GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), -1, -1, -1); return 0; } */ @@ -2199,7 +2213,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 6); - CMessages::AddMessageWithNumber(text, ScriptParams[4], ScriptParams[5], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], -1, -1); + CMessages::AddMessageWithNumber(text, GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), -1, -1); return 0; } /* @@ -2207,35 +2221,35 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 6); - CMessages::AddMessageJumpQWithNumber(text, ScriptParams[4], ScriptParams[5], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], -1, -1); + CMessages::AddMessageJumpQWithNumber(text, GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), -1, -1); return 0; } case COMMAND_PRINT_WITH_4_NUMBERS_SOON: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 6); - CMessages::AddMessageSoonWithNumber(text, ScriptParams[4], ScriptParams[5], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], -1, -1); + CMessages::AddMessageSoonWithNumber(text, GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), -1, -1); return 0; } case COMMAND_PRINT_WITH_5_NUMBERS: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 7); - CMessages::AddMessageWithNumber(text, ScriptParams[5], ScriptParams[6], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], -1); + CMessages::AddMessageWithNumber(text, GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), -1); return 0; } case COMMAND_PRINT_WITH_5_NUMBERS_NOW: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 7); - CMessages::AddMessageJumpQWithNumber(text, ScriptParams[5], ScriptParams[6], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], -1); + CMessages::AddMessageJumpQWithNumber(text, GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), -1); return 0; } case COMMAND_PRINT_WITH_5_NUMBERS_SOON: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 7); - CMessages::AddMessageSoonWithNumber(text, ScriptParams[5], ScriptParams[6], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], -1); + CMessages::AddMessageSoonWithNumber(text, GET_INTEGER_PARAM(5), GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), -1); return 0; } */ @@ -2243,7 +2257,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 8); - CMessages::AddMessageWithNumber(text, ScriptParams[6], ScriptParams[7], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], ScriptParams[5]); + CMessages::AddMessageWithNumber(text, GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5)); return 0; } /* @@ -2251,71 +2265,69 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 8); - CMessages::AddMessageJumpQWithNumber(text, ScriptParams[6], ScriptParams[7], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], ScriptParams[5]); + CMessages::AddMessageJumpQWithNumber(text, GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5)); return 0; } case COMMAND_PRINT_WITH_6_NUMBERS_SOON: { wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); CollectParameters(&m_nIp, 8); - CMessages::AddMessageSoonWithNumber(text, ScriptParams[6], ScriptParams[7], ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3], ScriptParams[4], ScriptParams[5]); + CMessages::AddMessageSoonWithNumber(text, GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(4), GET_INTEGER_PARAM(5)); return 0; } + */ case COMMAND_SET_CHAR_OBJ_FOLLOW_CHAR_IN_FORMATION: { CollectParameters(&m_nIp, 3); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CPed* pTargetPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); pPed->bScriptObjectiveCompleted = false; pPed->SetObjective(OBJECTIVE_FOLLOW_CHAR_IN_FORMATION, pTargetPed); - pPed->SetFormation((eFormation)ScriptParams[2]); + pPed->SetFormation((eFormation)GET_INTEGER_PARAM(2)); return 0; } - */ case COMMAND_PLAYER_MADE_PROGRESS: CollectParameters(&m_nIp, 1); - CStats::ProgressMade += ScriptParams[0]; + CStats::ProgressMade += GET_INTEGER_PARAM(0); return 0; case COMMAND_SET_PROGRESS_TOTAL: CollectParameters(&m_nIp, 1); - CStats::TotalProgressInGame = ScriptParams[0]; - if (CGame::germanGame) - CStats::TotalProgressInGame -= 2; + CStats::TotalProgressInGame = GET_INTEGER_PARAM(0); return 0; case COMMAND_REGISTER_JUMP_DISTANCE: CollectParameters(&m_nIp, 1); - CStats::MaximumJumpDistance = Max(CStats::MaximumJumpDistance, *(float*)&ScriptParams[0]); + CStats::MaximumJumpDistance = Max(CStats::MaximumJumpDistance, GET_FLOAT_PARAM(0)); return 0; case COMMAND_REGISTER_JUMP_HEIGHT: CollectParameters(&m_nIp, 1); - CStats::MaximumJumpHeight = Max(CStats::MaximumJumpHeight, *(float*)&ScriptParams[0]); + CStats::MaximumJumpHeight = Max(CStats::MaximumJumpHeight, GET_FLOAT_PARAM(0)); return 0; case COMMAND_REGISTER_JUMP_FLIPS: CollectParameters(&m_nIp, 1); - CStats::MaximumJumpFlips = Max(CStats::MaximumJumpFlips, ScriptParams[0]); + CStats::MaximumJumpFlips = Max(CStats::MaximumJumpFlips, GET_INTEGER_PARAM(0)); return 0; case COMMAND_REGISTER_JUMP_SPINS: CollectParameters(&m_nIp, 1); - CStats::MaximumJumpSpins = Max(CStats::MaximumJumpSpins, ScriptParams[0]); + CStats::MaximumJumpSpins = Max(CStats::MaximumJumpSpins, GET_INTEGER_PARAM(0)); return 0; case COMMAND_REGISTER_JUMP_STUNT: CollectParameters(&m_nIp, 1); - CStats::BestStuntJump = Max(CStats::BestStuntJump, ScriptParams[0]); + CStats::BestStuntJump = Max(CStats::BestStuntJump, GET_INTEGER_PARAM(0)); return 0; case COMMAND_REGISTER_UNIQUE_JUMP_FOUND: ++CStats::NumberOfUniqueJumpsFound; return 0; case COMMAND_SET_UNIQUE_JUMPS_TOTAL: CollectParameters(&m_nIp, 1); - CStats::TotalNumberOfUniqueJumps = ScriptParams[0]; + CStats::TotalNumberOfUniqueJumps = GET_INTEGER_PARAM(0); return 0; case COMMAND_REGISTER_PASSENGER_DROPPED_OFF_TAXI: ++CStats::PassengersDroppedOffWithTaxi; return 0; case COMMAND_REGISTER_MONEY_MADE_TAXI: CollectParameters(&m_nIp, 1); - CStats::MoneyMadeWithTaxi += ScriptParams[0]; + CStats::MoneyMadeWithTaxi += GET_INTEGER_PARAM(0); return 0; case COMMAND_REGISTER_MISSION_GIVEN: ++CStats::MissionsGiven; @@ -2335,9 +2347,9 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_SET_CHAR_RUNNING: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pPed); - pPed->bIsRunning = (ScriptParams[1] != 0); + pPed->bIsRunning = (GET_INTEGER_PARAM(1) != 0); return 0; } case COMMAND_REMOVE_ALL_SCRIPT_FIRES: @@ -2347,32 +2359,32 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_IS_FIRST_CAR_COLOUR: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - UpdateCompareFlag(pVehicle->m_currentColour1 == ScriptParams[1]); + UpdateCompareFlag(pVehicle->m_currentColour1 == GET_INTEGER_PARAM(1)); return 0; } case COMMAND_IS_SECOND_CAR_COLOUR: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - UpdateCompareFlag(pVehicle->m_currentColour2 == ScriptParams[1]); + UpdateCompareFlag(pVehicle->m_currentColour2 == GET_INTEGER_PARAM(1)); return 0; } */ case COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_WEAPON: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); bool result = false; if (!pPed) printf("HAS_CHAR_BEEN_DAMAGED_BY_WEAPON - Character doesn't exist\n"); else { - if (ScriptParams[1] == WEAPONTYPE_ANYMELEE || ScriptParams[1] == WEAPONTYPE_ANYWEAPON) - result = CheckDamagedWeaponType(pPed->m_lastWepDam, ScriptParams[1]); + if (GET_INTEGER_PARAM(1) == WEAPONTYPE_ANYMELEE || GET_INTEGER_PARAM(1) == WEAPONTYPE_ANYWEAPON) + result = CheckDamagedWeaponType(pPed->m_lastWepDam, GET_INTEGER_PARAM(1)); else - result = ScriptParams[1] == pPed->m_lastWepDam; + result = GET_INTEGER_PARAM(1) == pPed->m_lastWepDam; } UpdateCompareFlag(result); return 0; @@ -2380,15 +2392,15 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_WEAPON: { CollectParameters(&m_nIp, 2); - CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); bool result = false; if (!pVehicle) printf("HAS_CAR_BEEN_DAMAGED_BY_WEAPON - Vehicle doesn't exist\n"); else { - if (ScriptParams[1] == WEAPONTYPE_ANYMELEE || ScriptParams[1] == WEAPONTYPE_ANYWEAPON) - result = CheckDamagedWeaponType(pVehicle->m_nLastWeaponDamage, ScriptParams[1]); + if (GET_INTEGER_PARAM(1) == WEAPONTYPE_ANYMELEE || GET_INTEGER_PARAM(1) == WEAPONTYPE_ANYWEAPON) + result = CheckDamagedWeaponType(pVehicle->m_nLastWeaponDamage, GET_INTEGER_PARAM(1)); else - result = ScriptParams[1] == pVehicle->m_nLastWeaponDamage; + result = GET_INTEGER_PARAM(1) == pVehicle->m_nLastWeaponDamage; } UpdateCompareFlag(result); return 0; @@ -2396,11 +2408,11 @@ int8 CRunningScript::ProcessCommands700To799(int32 command) case COMMAND_IS_CHAR_IN_CHARS_GROUP: { CollectParameters(&m_nIp, 2); - CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); - CPed* pLeader = CPools::GetPedPool()->GetAt(ScriptParams[1]); + CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0)); + CPed* pLeader = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(1)); script_assert(pPed); script_assert(pLeader); - UpdateCompareFlag(pPed->m_leader == pLeader); + UpdateCompareFlag(pPed->m_leader == pLeader && !pPed->bWaitForLeaderToComeCloser); return 0; } default: diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index a8658532..1337605f 100644 --- a/src/control/Script4.cpp +++ b/src/control/Script4.cpp @@ -106,7 +106,10 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) printf("Couldn't find zone - %s\n", zone); return 0; } - CTheZones::SetPedGroup(zone_id, ScriptParams[0], ScriptParams[1]); + while (zone_id >= 0) { + CTheZones::SetPedGroup(zone_id, ScriptParams[0], ScriptParams[1]); + zone_id = CTheZones::FindNextZoneByLabelAndReturnIndex(zone, ZONE_INFO); + } return 0; } case COMMAND_START_CAR_FIRE: @@ -954,7 +957,10 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) pPed->WarpPedIntoCar(pVehicle); return 0; } - //case COMMAND_SWITCH_CAR_RADIO: + case COMMAND_SWITCH_CAR_RADIO: + CollectParameters(&m_nIp, 1); + DMAudio.ChangeMusicMode(ScriptParams[0]); + return 0; //case COMMAND_SET_AUDIO_STREAM: case COMMAND_PRINT_WITH_2_NUMBERS_BIG: { @@ -1354,11 +1360,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CTxdStore::AddRef(slot); return 0; } + /* case COMMAND_REMOVE_TEXTURE_DICTIONARY: { CTheScripts::RemoveScriptTextureDictionary(); return 0; } + */ case COMMAND_SET_OBJECT_DYNAMIC: { CollectParameters(&m_nIp, 2); @@ -1418,7 +1426,6 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) pVehicle->m_bSirenOrAlarm = ScriptParams[1] != 0; return 0; } - /* case COMMAND_SWITCH_PED_ROADS_ON_ANGLED: { CollectParameters(&m_nIp, 7); @@ -1441,7 +1448,6 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) ThePaths.SwitchRoadsInAngledArea(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1], *(float*)&ScriptParams[2], *(float*)&ScriptParams[3], *(float*)&ScriptParams[4], *(float*)&ScriptParams[5], *(float*)&ScriptParams[6], 1, 0); return 0; - */ case COMMAND_SET_CAR_WATERTIGHT: { CollectParameters(&m_nIp, 2); @@ -1781,7 +1787,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) */ case COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_STRING: { - script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); + //script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); uint16 var = CTheScripts::Read2BytesFromScript(&m_nIp); CollectParameters(&m_nIp, 1); wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ??? @@ -1792,7 +1798,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) } case COMMAND_DISPLAY_ONSCREEN_COUNTER_WITH_STRING: { - script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); + //script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); uint16 var = CTheScripts::Read2BytesFromScript(&m_nIp); CollectParameters(&m_nIp, 1); wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ??? @@ -1967,12 +1973,10 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) CWorld::Add(car); return 0; } - /* case COMMAND_IS_COLLISION_IN_MEMORY: CollectParameters(&m_nIp, 1); UpdateCompareFlag(CCollision::ms_collisionInMemory == ScriptParams[0]); return 0; - */ case COMMAND_SET_WANTED_MULTIPLIER: CollectParameters(&m_nIp, 1); FindPlayerPed()->m_pWanted->m_fCrimeSensitivity = *(float*)&ScriptParams[0]; @@ -2042,7 +2046,8 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case COMMAND_HAS_MISSION_AUDIO_LOADED: { CollectParameters(&m_nIp, 1); - UpdateCompareFlag(DMAudio.GetMissionAudioLoadingStatus(ScriptParams[0] - 1) == 1); + //UpdateCompareFlag(DMAudio.GetMissionAudioLoadingStatus(ScriptParams[0] - 1) == 1); + UpdateCompareFlag(true); // TODO return 0; } case COMMAND_PLAY_MISSION_AUDIO: @@ -2052,7 +2057,8 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case COMMAND_HAS_MISSION_AUDIO_FINISHED: { CollectParameters(&m_nIp, 1); - UpdateCompareFlag(DMAudio.IsMissionAudioSampleFinished(ScriptParams[0] - 1)); + //UpdateCompareFlag(DMAudio.IsMissionAudioSampleFinished(ScriptParams[0] - 1)); // TODO + UpdateCompareFlag(true); return 0; } case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING: diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp index f970cf89..c0e3ecad 100644 --- a/src/control/Script5.cpp +++ b/src/control/Script5.cpp @@ -2531,7 +2531,7 @@ int CTheScripts::FindFreeSlotInCollectiveArray() void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, int16 p1, int16 p2) { for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { - if (CollectiveArray[i].colIndex = colIndex) { + if (CollectiveArray[i].colIndex == colIndex) { CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); if (pPed == nil) { CollectiveArray[i].colIndex = -1; @@ -2548,7 +2548,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1, float p2) { for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { - if (CollectiveArray[i].colIndex = colIndex) { + if (CollectiveArray[i].colIndex == colIndex) { CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); if (pPed == nil) { CollectiveArray[i].colIndex = -1; @@ -2565,7 +2565,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1) { for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { - if (CollectiveArray[i].colIndex = colIndex) { + if (CollectiveArray[i].colIndex == colIndex) { CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); if (pPed == nil) { CollectiveArray[i].colIndex = -1; @@ -2582,7 +2582,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, void* p1) { for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { - if (CollectiveArray[i].colIndex = colIndex) { + if (CollectiveArray[i].colIndex == colIndex) { CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); if (pPed == nil) { CollectiveArray[i].colIndex = -1; @@ -2599,7 +2599,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective) { for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) { - if (CollectiveArray[i].colIndex = colIndex) { + if (CollectiveArray[i].colIndex == colIndex) { CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex); if (pPed == nil) { CollectiveArray[i].colIndex = -1; @@ -2740,6 +2740,9 @@ void CTheScripts::ReadObjectNamesFromScript() { int32 varSpace = GetSizeOfVariableSpace(); uint32 ip = varSpace + 8; + NumSaveVars = Read4BytesFromScript(&ip); + SavedVarIndices = (short*)&ScriptParams[ip]; + ip += 2 * NumSaveVars; NumberOfUsedObjects = Read2BytesFromScript(&ip); ip += 2; for (uint16 i = 0; i < NumberOfUsedObjects; i++) { @@ -2751,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 } } @@ -2784,7 +2773,8 @@ void CTheScripts::ReadMultiScriptFileOffsetsFromScript() uint32 ip = varSpace + 3; int32 objectSize = Read4BytesFromScript(&ip); ip = objectSize + 8; - MainScriptSize = Read4BytesFromScript(&ip); + NumTrueGlobals = Read2BytesFromScript(&ip); + MostGlobals = Read2BytesFromScript(&ip); LargestMissionScriptSize = Read4BytesFromScript(&ip); NumberOfMissionScripts = Read2BytesFromScript(&ip); NumberOfExclusiveMissionScripts = Read2BytesFromScript(&ip); diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp index 76780941..02427eed 100644 --- a/src/control/Script6.cpp +++ b/src/control/Script6.cpp @@ -83,7 +83,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { switch (command) { //case COMMAND_FLASH_RADAR_BLIP: - /* case COMMAND_IS_CHAR_IN_CONTROL: { CollectParameters(&m_nIp, 1); @@ -91,7 +90,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) UpdateCompareFlag(pPed->IsPedInControl()); return 0; } - */ case COMMAND_SET_GENERATE_CARS_AROUND_CAMERA: CollectParameters(&m_nIp, 1); CCarCtrl::bCarsGeneratedAroundCamera = (ScriptParams[0] != 0); @@ -374,32 +372,30 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) { CollectParameters(&m_nIp, 1); - if (CTheScripts::NumberOfExclusiveMissionScripts > 0 && ScriptParams[0] <= UINT16_MAX - 2) - return 0; + if (CTheScripts::NumberOfExclusiveMissionScripts > 0) { + if (ScriptParams[0] < UINT16_MAX - 1) + return 0; + ScriptParams[0] = UINT16_MAX - ScriptParams[0]; + } #ifdef MISSION_REPLAY missionRetryScriptIndex = ScriptParams[0]; if (missionRetryScriptIndex == 19) CStats::LastMissionPassedName[0] = '\0'; #endif CTimer::Suspend(); - int offset = CTheScripts::MultiScriptArray[ScriptParams[0]]; -#ifdef USE_DEBUG_SCRIPT_LOADER - CFileMgr::ChangeDir("\\data\\"); - int handle = CFileMgr::OpenFile(scriptfile, "rb"); - CFileMgr::ChangeDir("\\"); -#else - CFileMgr::ChangeDir("\\"); - int handle = CFileMgr::OpenFile("data\\main.scm", "rb"); -#endif - CFileMgr::Seek(handle, offset, 0); - CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[SIZE_MAIN_SCRIPT], SIZE_MISSION_SCRIPT); - CFileMgr::CloseFile(handle); - CRunningScript* pMissionScript = CTheScripts::StartNewScript(SIZE_MAIN_SCRIPT); + int offset = CTheScripts::MultiScriptArray[ScriptParams[0]] + 8; + int size = CTheScripts::MultiScriptArray[ScriptParams[0] + 1] - CTheScripts::MultiScriptArray[ScriptParams[0]]; + if (size <= 0) + size = CTheScripts::LargestMissionScriptSize; + CFileMgr::Seek(gScriptsFile, offset, 0); + CFileMgr::Read(gScriptsFile, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], size); // TODO + CRunningScript* pMissionScript = CTheScripts::StartNewScript(CTheScripts::MainScriptSize); CTimer::Resume(); pMissionScript->m_bIsMissionScript = true; pMissionScript->m_bMissionFlag = true; CTheScripts::bAlreadyRunningAMissionScript = true; - CGameLogic::ClearShortCut(); + memset(&CTheScripts::ScriptSpace[CTheScripts::NumTrueGlobals * 4 + 8], 0, CTheScripts::MostGlobals * 4); + pMissionScript->Process(); return 0; } case COMMAND_SET_OBJECT_DRAW_LAST: @@ -527,7 +523,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) StoreParameters(&m_nIp, 1); return 0; } - /* case COMMAND_MARK_ROADS_BETWEEN_LEVELS: { CollectParameters(&m_nIp, 6); @@ -576,7 +571,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) ThePaths.PedMarkRoadsBetweenLevelsInArea(infX, supX, infY, supY, infZ, supZ); return 0; } - */ case COMMAND_SET_CAR_AVOID_LEVEL_TRANSITIONS: { CollectParameters(&m_nIp, 2); diff --git a/src/control/Script7.cpp b/src/control/Script7.cpp index 5a70fd28..b3f16106 100644 --- a/src/control/Script7.cpp +++ b/src/control/Script7.cpp @@ -540,7 +540,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) case COMMAND_DISPLAY_NTH_ONSCREEN_COUNTER_WITH_STRING: { char onscreen_str[12]; - script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); + //script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); uint16 var = CTheScripts::Read2BytesFromScript(&m_nIp); CollectParameters(&m_nIp, 2); wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ??? @@ -816,7 +816,12 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) //case COMMAND_HAS_CHAR_BEEN_DAMAGED_BY_CAR: //case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_CHAR: //case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_CAR: - //case COMMAND_GET_RADIO_CHANNEL: + case COMMAND_GET_RADIO_CHANNEL: + { + // TODO + ScriptParams[0] = -1; + StoreParameters(&m_nIp, 1); + } //case COMMAND_DISPLAY_TEXT_WITH_3_NUMBERS: //case COMMAND_IS_CAR_DROWNING_IN_WATER: case COMMAND_IS_CHAR_DROWNING_IN_WATER: @@ -1013,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: @@ -1327,7 +1332,19 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command) CollectParameters(&m_nIp, 1); UpdateCompareFlag(CPools::GetPedPool()->GetAt(ScriptParams[0]) != 0); return 0; - //case COMMAND_DOES_VEHICLE_EXIST: + case COMMAND_DOES_VEHICLE_EXIST: + { + // TODO + CollectParameters(&m_nIp, 1); + CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]); + bool bExist = false; + if (pVehicle) { + int index = CPools::GetVehiclePool()->GetJustIndex_NoFreeAssert(pVehicle); + bExist = (index >= 0 && index <= NUMVEHICLES); // TODO: FIX_BUGS + } + UpdateCompareFlag(bExist); + return 0; + } //case COMMAND_ADD_SHORT_RANGE_BLIP_FOR_CONTACT_POINT: case COMMAND_ADD_SHORT_RANGE_SPRITE_BLIP_FOR_CONTACT_POINT: { diff --git a/src/control/Script8.cpp b/src/control/Script8.cpp index 74552b23..2f52b150 100644 --- a/src/control/Script8.cpp +++ b/src/control/Script8.cpp @@ -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: @@ -384,7 +384,6 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) } return 0; } -#if (defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT) case COMMAND_IS_JAPANESE_GAME: #ifdef MORE_LANGUAGES UpdateCompareFlag(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_JAPANESE); @@ -394,218 +393,728 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command) UpdateCompareFlag(false); #endif return 0; -#elif (!defined GTA_PS2) - case COMMAND_SET_ONSCREEN_COUNTER_FLASH_WHEN_FIRST_DISPLAYED: - script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); - uint16 var = CTheScripts::Read2BytesFromScript(&m_nIp); + case COMMAND_1442: + script_assert(false); + return 0; + case COMMAND_1443: + script_assert(false); + return 0; + case COMMAND_1444: + script_assert(false); + return 0; + case COMMAND_1445: + script_assert(false); + return 0; + case COMMAND_1446: + script_assert(false); + return 0; + case COMMAND_1447: + script_assert(false); + return 0; + case COMMAND_1448: + script_assert(false); + return 0; + case COMMAND_1449: + script_assert(false); + return 0; + case COMMAND_1450: + script_assert(false); + return 0; + case COMMAND_1451: CollectParameters(&m_nIp, 1); - //CUserDisplay::OnscnTimer.SetCounterFlashWhenFirstDisplayed(var, ScriptParams[0]); - break; -#endif -#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) - case COMMAND_SHUFFLE_CARD_DECKS: + // TODO (GET_PAD_BUTTON_STATE) + ScriptParams[0] = 0; + StoreParameters(&m_nIp, 1); + return 0; + case COMMAND_1452: + script_assert(false); + return 0; + case COMMAND_1453: + script_assert(false); + return 0; + case COMMAND_CALL: + case COMMAND_NOTCALL: { + m_anStack[m_nStackPointer++] = m_nIp | BIT(STACKVALUE_IS_FUNCTION_CALL_BIT) | ((command == COMMAND_NOTCALL) ? BIT(STACKVALUE_INVERT_RETURN_BIT) : 0); + uint8 nInputParams = CTheScripts::Read1ByteFromScript(&m_nIp); + uint8 nOutputParameters = CTheScripts::Read1ByteFromScript(&m_nIp); + uint8 nLocalsOffset = CTheScripts::Read1ByteFromScript(&m_nIp); + uint32 nIPBeforeParameters = m_nIp; CollectParameters(&m_nIp, 1); - script_assert(ScriptParams[0] >= 0 && ScriptParams[0] <= 6); - for (int i = 0; i < CARDS_IN_STACK; i++) - CTheScripts::CardStack[i] = 0; - int16 seq[CARDS_IN_STACK]; - for (int i = 0; i < MAX_DECKS * CARDS_IN_DECK; i++) - seq[i] = i; - int cards_left = CARDS_IN_DECK * ScriptParams[0]; - for (int k = 1; k < CARDS_IN_DECK + 1; k++) { - for (int deck = 0; deck < ScriptParams[0]; deck++) { - int index = CGeneral::GetRandomNumberInRange(0, cards_left); - CTheScripts::CardStack[seq[index]] = k; - for (int l = index; l < cards_left; l++) { - if (l + 1 < CARDS_IN_STACK) - seq[l] = seq[l + 1]; - else - seq[l] = 0; - } - --cards_left; - } - } - CTheScripts::CardStackPosition = 0; + if (nInputParams) + CollectParameters(&m_nIp, nInputParams, &m_anLocalVariables[m_nLocalsPointer + nLocalsOffset]); + m_nLocalsPointer += nLocalsOffset; + m_anStack[m_nStackPointer - 1] |= (m_nIp - nIPBeforeParameters) << STACKVALUE_IP_PARAMS_OFFSET; + if (ScriptParams[0] < 0) + m_nIp = CTheScripts::MainScriptSize - ScriptParams[0]; + else + m_nIp = ScriptParams[0]; return 0; } - case COMMAND_FETCH_NEXT_CARD: - { - if (CTheScripts::CardStack[CTheScripts::CardStackPosition] == 0) - CTheScripts::CardStackPosition = 0; - ScriptParams[0] = CTheScripts::CardStack[CTheScripts::CardStackPosition++]; - if (CTheScripts::CardStackPosition == CARDS_IN_DECK * MAX_DECKS) - CTheScripts::CardStackPosition = 0; - StoreParameters(&m_nIp, 1); + case COMMAND_1456: + script_assert(false); + return 0; + case COMMAND_1457: + script_assert(false); + return 0; + case COMMAND_1458: + script_assert(false); + return 0; + case COMMAND_1459: + script_assert(false); + return 0; + case COMMAND_1460: + script_assert(false); + return 0; + case COMMAND_1461: + script_assert(false); + return 0; + case COMMAND_1462: + script_assert(false); + return 0; + case COMMAND_1463: + script_assert(false); + return 0; + case COMMAND_1464: + script_assert(false); + return 0; + case COMMAND_1465: + script_assert(false); + return 0; + case COMMAND_1466: + script_assert(false); + return 0; + case COMMAND_1467: + script_assert(false); + return 0; + case COMMAND_1468: + script_assert(false); + return 0; + case COMMAND_1469: + script_assert(false); + return 0; + case COMMAND_1470: + script_assert(false); return 0; + case COMMAND_1471: + script_assert(false); + return 0; + case COMMAND_1472: + script_assert(false); + return 0; + case COMMAND_1473: + script_assert(false); + return 0; + case COMMAND_1474: + script_assert(false); + return 0; + case COMMAND_1475: + script_assert(false); + return 0; + case COMMAND_1476: + script_assert(false); + return 0; + case COMMAND_1477: + script_assert(false); + return 0; + case COMMAND_1478: + script_assert(false); + return 0; + case COMMAND_1479: + CollectParameters(&m_nIp, 2); + // TODO (SET_CHAR_ONLY_ENTER_BACK_DOOR) + return 0; + case COMMAND_1480: + script_assert(false); + return 0; + case COMMAND_1481: + script_assert(false); + return 0; + case COMMAND_1482: + script_assert(false); + return 0; + case COMMAND_1483: + script_assert(false); + return 0; + case COMMAND_1484: + script_assert(false); + return 0; + case COMMAND_1485: + script_assert(false); + return 0; + case COMMAND_1486: + script_assert(false); + return 0; + case COMMAND_1487: + script_assert(false); + return 0; + case COMMAND_1488: + script_assert(false); + return 0; + case COMMAND_1489: + script_assert(false); + return 0; + case COMMAND_1490: + script_assert(false); + return 0; + case COMMAND_1491: + script_assert(false); + return 0; + case COMMAND_1492: + script_assert(false); + return 0; + case COMMAND_1493: + script_assert(false); + return 0; + case COMMAND_1494: + script_assert(false); + return 0; + case COMMAND_1495: + script_assert(false); + return 0; + case COMMAND_1496: + script_assert(false); + return 0; + case COMMAND_1497: + script_assert(false); + return 0; + case COMMAND_1498: + script_assert(false); + return 0; + case COMMAND_1499: + script_assert(false); + return 0; + default: + script_assert(0); } - case COMMAND_GET_OBJECT_VELOCITY: - { + return -1; +} + +int8 CRunningScript::ProcessCommands1500To1599(int32 command) +{ + switch (command) { + case COMMAND_1500: + script_assert(false); + return 0; + case COMMAND_1501: + script_assert(false); + return 0; + case COMMAND_1502: + script_assert(false); + return 0; + case COMMAND_1503: + script_assert(false); + return 0; + case COMMAND_1504: + script_assert(false); + return 0; + case COMMAND_1505: + script_assert(false); + return 0; + case COMMAND_1506: + script_assert(false); + return 0; + case COMMAND_1507: + script_assert(false); + return 0; + case COMMAND_1508: + script_assert(false); + return 0; + case COMMAND_1509: + script_assert(false); + return 0; + case COMMAND_1510: + script_assert(false); + return 0; + case COMMAND_1511: + script_assert(false); + return 0; + case COMMAND_1512: + script_assert(false); + return 0; + case COMMAND_1513: + script_assert(false); + return 0; + case COMMAND_1514: + script_assert(false); + return 0; + case COMMAND_1515: + script_assert(false); + return 0; + case COMMAND_1516: + script_assert(false); + return 0; + case COMMAND_1517: + script_assert(false); + return 0; + case COMMAND_1518: + // TODO (?) + UpdateCompareFlag(true); + return 0; + case COMMAND_1519: CollectParameters(&m_nIp, 1); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - *(CVector*)&ScriptParams[0] = GAME_SPEED_TO_METERS_PER_SECOND * pObject->GetMoveSpeed(); - StoreParameters(&m_nIp, 3); + // TODO (SET_NUMBER_USJ_FOUND?) return 0; - } - case COMMAND_IS_DEBUG_CAMERA_ON: - UpdateCompareFlag(TheCamera.WorldViewerBeingUsed); + case COMMAND_1520: + CollectParameters(&m_nIp, 1); + // TODO (SET_TOTAL_HIDDEN_PACKAGES?) return 0; - case COMMAND_ADD_TO_OBJECT_ROTATION_VELOCITY: - { - CollectParameters(&m_nIp, 4); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - CVector newSpeed = pObject->GetTurnSpeed() + *(CVector*)&ScriptParams[1] / GAME_SPEED_TO_METERS_PER_SECOND; - if (pObject->bIsStatic) { - pObject->SetIsStatic(false); - pObject->AddToMovingList(); - } - pObject->SetTurnSpeed(newSpeed.x, newSpeed.y, newSpeed.z); + case COMMAND_1521: + script_assert(false); return 0; - } - case COMMAND_SET_OBJECT_ROTATION_VELOCITY: - { - CollectParameters(&m_nIp, 4); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - CVector newSpeed = *(CVector*)&ScriptParams[1] / GAME_SPEED_TO_METERS_PER_SECOND; - if (pObject->bIsStatic) { - pObject->SetIsStatic(false); - pObject->AddToMovingList(); - } - pObject->SetTurnSpeed(newSpeed.x, newSpeed.y, newSpeed.z); + case COMMAND_1522: + script_assert(false); return 0; - } - case COMMAND_IS_OBJECT_STATIC: - { + case COMMAND_1523: + script_assert(false); + return 0; + case COMMAND_1524: + script_assert(false); + return 0; + case COMMAND_1525: + script_assert(false); + return 0; + case COMMAND_1526: + script_assert(false); + return 0; + case COMMAND_1527: + script_assert(false); + return 0; + case COMMAND_1528: + script_assert(false); + return 0; + case COMMAND_1529: + script_assert(false); + return 0; + case COMMAND_1530: + script_assert(false); + return 0; + case COMMAND_1531: + script_assert(false); + return 0; + case COMMAND_1532: + script_assert(false); + return 0; + case COMMAND_1533: + script_assert(false); + return 0; + case COMMAND_1534: + script_assert(false); + return 0; + case COMMAND_1535: + script_assert(false); + return 0; + case COMMAND_1536: + script_assert(false); + return 0; + case COMMAND_1537: + script_assert(false); + return 0; + case COMMAND_1538: + script_assert(false); + return 0; + case COMMAND_1539: + //TODO (REGISTER_OUTFIT_CHANGE) + return 0; + case COMMAND_1540: + script_assert(false); + return 0; + case COMMAND_1541: + script_assert(false); + return 0; + case COMMAND_1542: + script_assert(false); + return 0; + case COMMAND_1543: + script_assert(false); + return 0; + case COMMAND_1544: + script_assert(false); + return 0; + case COMMAND_1545: + script_assert(false); + return 0; + case COMMAND_1546: + script_assert(false); + return 0; + case COMMAND_1547: + script_assert(false); + return 0; + case COMMAND_1548: + // TODO (GET_ONFOOT_CAMERA_MODE) + ScriptParams[0] = 0; + StoreParameters(&m_nIp, 1); + return 0; + case COMMAND_1549: CollectParameters(&m_nIp, 1); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - UpdateCompareFlag(pObject->GetIsStatic()); + // TODO (SET_ONFOOT_CAMERA_MODE?) return 0; - } - case COMMAND_GET_ANGLE_BETWEEN_2D_VECTORS: + case COMMAND_1550: + script_assert(false); + return 0; + case COMMAND_1551: + script_assert(false); + return 0; + case COMMAND_1552: + script_assert(false); + return 0; + case COMMAND_1553: + script_assert(false); + return 0; + case COMMAND_1554: + script_assert(false); + return 0; + case COMMAND_1555: + CollectParameters(&m_nIp, 1); + // TODO (FREEZE_ONFOOT_CAMERA_MODE?) + return 0; + case COMMAND_1556: + script_assert(false); + return 0; + case COMMAND_1557: + script_assert(false); + return 0; + case COMMAND_1558: + UpdateCompareFlag(false); + // TODO + return 0; + case COMMAND_1559: + script_assert(false); + return 0; + case COMMAND_1560: + // TODO (IS_E3_BUILD?) + UpdateCompareFlag(false); + return 0; + case COMMAND_1561: + // TODO (check, SET_FS_DESTROYED_FLAG) + CTheScripts::FSDestroyedFlag = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace; + return 0; + case COMMAND_1562: + script_assert(false); + return 0; + case COMMAND_1563: + script_assert(false); + return 0; + case COMMAND_1564: + script_assert(false); + return 0; + case COMMAND_1565: + script_assert(false); + return 0; + case COMMAND_1566: + script_assert(false); + return 0; + case COMMAND_1567: + CollectParameters(&m_nIp, 1); + // TODO (BUILD_WORLD_GEOMETRY) + return 0; + case COMMAND_1568: + script_assert(false); + return 0; + case COMMAND_1569: + // TODO (IS_MULTIPLAYER_ACTIVE?) + UpdateCompareFlag(false); + return 0; + case COMMAND_1570: + script_assert(false); + return 0; + case COMMAND_1571: + script_assert(false); + return 0; + case COMMAND_1572: + script_assert(false); + return 0; + case COMMAND_1573: + script_assert(false); + return 0; + case COMMAND_1574: + script_assert(false); + return 0; + case COMMAND_1575: + script_assert(false); + return 0; + case COMMAND_1576: + script_assert(false); + return 0; + case COMMAND_1577: + script_assert(false); + return 0; + case COMMAND_1578: + script_assert(false); + return 0; + case COMMAND_1579: + script_assert(false); + return 0; + case COMMAND_1580: + script_assert(false); + return 0; + case COMMAND_1581: { - CollectParameters(&m_nIp, 4); - CVector2D v1 = *(CVector2D*)&ScriptParams[0]; - CVector2D v2 = *(CVector2D*)&ScriptParams[2]; - float c = DotProduct2D(v1, v2) / (v1.Magnitude() * v2.Magnitude()); -#ifdef FIX_BUGS // command is a SA leftover where it was fixed to this - *(float*)&ScriptParams[0] = RADTODEG(Acos(c)); -#else - *(float*)&ScriptParams[0] = Acos(c); -#endif + // TODO (SET_HELP_MESSAGE?) + wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); return 0; } - case COMMAND_DO_2D_RECTANGLES_COLLIDE: - { - CollectParameters(&m_nIp, 8); - float infX1 = *(float*)&ScriptParams[0] - *(float*)&ScriptParams[2] * 0.5; // NB: not float - float supX1 = *(float*)&ScriptParams[0] + *(float*)&ScriptParams[2] * 0.5; - float infX2 = *(float*)&ScriptParams[4] - *(float*)&ScriptParams[6] * 0.5; - float supX2 = *(float*)&ScriptParams[4] + *(float*)&ScriptParams[6] * 0.5; - float infY1 = *(float*)&ScriptParams[1] - *(float*)&ScriptParams[3] * 0.5; - float supY1 = *(float*)&ScriptParams[1] + *(float*)&ScriptParams[3] * 0.5; - float infY2 = *(float*)&ScriptParams[5] - *(float*)&ScriptParams[7] * 0.5; - float supY2 = *(float*)&ScriptParams[5] + *(float*)&ScriptParams[7] * 0.5; - bool collide = true; - if (infY2 > supY1) - collide = false; - if (infY1 > supY2) - collide = false; - if (infX2 > supX1) - collide = false; - if (infX1 > supX2) - collide = false; - UpdateCompareFlag(collide); + case COMMAND_1582: + script_assert(false); + return 0; + case COMMAND_1583: + script_assert(false); + return 0; + case COMMAND_1584: + script_assert(false); + return 0; + case COMMAND_1585: + script_assert(false); + return 0; + case COMMAND_1586: + script_assert(false); return 0; + case COMMAND_1587: + script_assert(false); + return 0; + case COMMAND_1588: + script_assert(false); + return 0; + case COMMAND_1589: + CollectParameters(&m_nIp, 2); + // TODO (SWAP_BUILDING?) + return 0; + case COMMAND_1590: + script_assert(false); + return 0; + case COMMAND_1591: + script_assert(false); + return 0; + case COMMAND_1592: + script_assert(false); + return 0; + case COMMAND_1593: + script_assert(false); + return 0; + case COMMAND_1594: + script_assert(false); + return 0; + case COMMAND_1595: + script_assert(false); + return 0; + case COMMAND_1596: + script_assert(false); + return 0; + case COMMAND_1597: + script_assert(false); + return 0; + case COMMAND_1598: + script_assert(false); + return 0; + case COMMAND_1599: + script_assert(false); + return 0; + default: + script_assert(0); } - case COMMAND_GET_OBJECT_ROTATION_VELOCITY: - { + return -1; +} + +int8 CRunningScript::ProcessCommands1600To1699(int32 command) +{ + switch (command) { + case COMMAND_1600: + script_assert(false); + return 0; + case COMMAND_1601: + script_assert(false); + return 0; + case COMMAND_1602: + script_assert(false); + return 0; + case COMMAND_1603: + script_assert(false); + return 0; + case COMMAND_1604: + script_assert(false); + return 0; + case COMMAND_1605: + script_assert(false); + return 0; + case COMMAND_1606: + script_assert(false); + return 0; + case COMMAND_1607: CollectParameters(&m_nIp, 1); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - *(CVector*)&ScriptParams[0] = pObject->GetTurnSpeed() * GAME_SPEED_TO_METERS_PER_SECOND; - StoreParameters(&m_nIp, 3); + // TODO (SET_TOTAL_CARS_FOR_EXPORT) + return 0; + case COMMAND_1608: + script_assert(false); + return 0; + case COMMAND_1609: + script_assert(false); + return 0; + case COMMAND_1610: + script_assert(false); + return 0; + case COMMAND_1611: + script_assert(false); + return 0; + case COMMAND_1612: + script_assert(false); + return 0; + case COMMAND_1613: + script_assert(false); + return 0; + case COMMAND_1614: + script_assert(false); + return 0; + case COMMAND_1615: + // TODO (GET_DEVELOPER_FLAG?) + UpdateCompareFlag(false); + return 0; + case COMMAND_1616: + // TODO (SET_DEVELOPER_FLAG) + return 0; + case COMMAND_1617: + script_assert(false); + return 0; + case COMMAND_1618: + script_assert(false); + return 0; + case COMMAND_1619: + script_assert(false); + return 0; + case COMMAND_1620: + script_assert(false); + return 0; + case COMMAND_1621: + { + wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp); + CollectParameters(&m_nIp, 2); + // TODO (SET_SUBTITLE_TEXT) return 0; } - case COMMAND_ADD_VELOCITY_RELATIVE_TO_OBJECT_VELOCITY: + case COMMAND_1622: + script_assert(false); + return 0; + case COMMAND_1623: + script_assert(false); + return 0; + case COMMAND_1624: + script_assert(false); + return 0; + case COMMAND_1625: + script_assert(false); + return 0; + case COMMAND_1626: + script_assert(false); + return 0; + case COMMAND_1627: + script_assert(false); + return 0; + case COMMAND_1628: + script_assert(false); + return 0; + case COMMAND_1629: + script_assert(false); + return 0; + case COMMAND_1630: + script_assert(false); + return 0; + case COMMAND_1631: + script_assert(false); + return 0; + case COMMAND_1632: + script_assert(false); + return 0; + case COMMAND_1633: + script_assert(false); + return 0; + case COMMAND_1634: + script_assert(false); + return 0; + case COMMAND_1635: { - CollectParameters(&m_nIp, 4); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - CVector vecAddition = *(CVector*)&ScriptParams[1] * CTimer::GetTimeStep() / GAME_SPEED_TO_METERS_PER_SECOND; - if (!pObject->bIsStatic) { - CVector vecCurrSpeed = pObject->GetSpeed(); - vecCurrSpeed.Normalise(); - if (vecCurrSpeed.z != 1.0) { // NB: not float! - CVector vx = CrossProduct(vecCurrSpeed, CVector(0.0f, 0.0f, 1.0f)); - vx.Normalise(); - CVector vz = CrossProduct(vx, vecCurrSpeed); - vz.Normalise(); - CVector vecNewSpeed = pObject->GetSpeed() + vecAddition.x * vx + vecAddition.y * vecCurrSpeed + vecAddition.z * vecCurrSpeed; - if (pObject->bIsStatic) { - pObject->SetIsStatic(false); - pObject->AddToMovingList(); - } - pObject->SetMoveSpeed(vecNewSpeed); - } - } + char tmp[12]; // TODO + CTheScripts::ReadTextLabelFromScript(&m_nIp, tmp); + m_nIp += KEY_LENGTH_IN_SCRIPT; + // TODO (CHANGE_STORED_PLAYER_OUTFIT?) return 0; } - case COMMAND_GET_OBJECT_SPEED: + case COMMAND_1636: + script_assert(false); + return 0; + case COMMAND_1637: + script_assert(false); + return 0; + case COMMAND_1638: + script_assert(false); + return 0; + case COMMAND_1639: + script_assert(false); + return 0; + case COMMAND_1640: + CollectParameters(&m_nIp, 2); + // TODO (LOCK_GARAGE?) + return 0; + case COMMAND_1641: + // TODO + UpdateCompareFlag(true); + return 0; + case COMMAND_1642: + script_assert(false); + return 0; + case COMMAND_1643: + script_assert(false); + return 0; + case COMMAND_1644: + script_assert(false); + return 0; + case COMMAND_1645: { CollectParameters(&m_nIp, 1); - CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]); - *(float*)&ScriptParams[0] = pObject->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_METERS_PER_SECOND; + // TODO (GET_STORED_WEAPON?) + CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; + script_assert(pPed); + ScriptParams[0] = pPed->m_storedWeapon; StoreParameters(&m_nIp, 1); return 0; } -#endif -#if (defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) - case COMMAND_IS_MISSION_SKIP: -#ifdef MISSION_REPLAY - ScriptParams[0] = MissionSkipLevel; -#else - ScriptParams[0] = 0; -#endif - StoreParameters(&m_nIp, 1); - return 0; - case COMMAND_SET_IN_AMMUNATION: + case COMMAND_1646: CollectParameters(&m_nIp, 1); -#ifdef MISSION_REPLAY - IsInAmmunation = ScriptParams[0]; -#endif + // TODO (DISABLE_PAUSE_MENU?) return 0; - case COMMAND_DO_SAVE_GAME: + case COMMAND_1647: CollectParameters(&m_nIp, 1); -#ifdef MISSION_REPLAY - SaveGameForPause(ScriptParams[0]); -#endif + // TODO (IS_CHANNEL_PLAYING?) + UpdateCompareFlag(false); return 0; - case COMMAND_IS_RETRY: -#ifdef MISSION_REPLAY - if (strcmp(m_abScriptName, "porno4") != 0) - ScriptParams[0] = AllowMissionReplay; -#ifdef FIX_BUGS - else - ScriptParams[0] = gbTryingPorn4Again; -#else - else if (gbTryingPorn4Again) - ScriptParams[0] = 1; -#endif -#else - ScriptParams[0] = 0; -#endif - StoreParameters(&m_nIp, 1); + case COMMAND_1648: + CollectParameters(&m_nIp, 3); + // TODO (SET_CLOCK_EVENT_WARNING); return 0; - case COMMAND_DUMMY: + case COMMAND_1649: + CollectParameters(&m_nIp, 3); + // TODO (SET_EXTRA_COLOUR_DIRECTION) return 0; -#endif -#if (defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) - // it is unknown what these commands do but they don't take parameters - case COMMAND_MARK_CUTSCENE_START: + case COMMAND_1650: + script_assert(false); return 0; - case COMMAND_MARK_CUTSCENE_END: + case COMMAND_1651: + script_assert(false); return 0; - case COMMAND_CUTSCENE_SCROLL: + case COMMAND_1652: + script_assert(false); + return 0; + case COMMAND_1653: + script_assert(false); + return 0; + case COMMAND_1654: + script_assert(false); + return 0; + case COMMAND_1655: + script_assert(false); + return 0; + case COMMAND_1656: + CollectParameters(&m_nIp, 2); + // TODO (?) return 0; -#endif default: script_assert(0); } diff --git a/src/control/ScriptCommands.h b/src/control/ScriptCommands.h index 9863e852..105fa82f 100644 --- a/src/control/ScriptCommands.h +++ b/src/control/ScriptCommands.h @@ -215,6 +215,11 @@ enum { COMMAND_WHILE, COMMAND_WHILENOT, COMMAND_ENDWHILE, + COMMAND_214, + COMMAND_215, + COMMAND_216, + COMMAND_217, + COMMAND_218, COMMAND_ANDOR, COMMAND_LAUNCH_MISSION, COMMAND_MISSION_HAS_FINISHED, @@ -1437,39 +1442,222 @@ enum { COMMAND_REGISTER_FIRE_LEVEL, COMMAND_IS_AUSTRALIAN_GAME, COMMAND_DISARM_CAR_BOMB, -#if (defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT) COMMAND_IS_JAPANESE_GAME, -#elif (!defined GTA_PS2) - COMMAND_SET_ONSCREEN_COUNTER_FLASH_WHEN_FIRST_DISPLAYED, -#endif -#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) - COMMAND_SHUFFLE_CARD_DECKS, - COMMAND_FETCH_NEXT_CARD, - COMMAND_GET_OBJECT_VELOCITY, - COMMAND_IS_DEBUG_CAMERA_ON, - COMMAND_ADD_TO_OBJECT_ROTATION_VELOCITY, - COMMAND_SET_OBJECT_ROTATION_VELOCITY, - COMMAND_IS_OBJECT_STATIC, - COMMAND_GET_ANGLE_BETWEEN_2D_VECTORS, - COMMAND_DO_2D_RECTANGLES_COLLIDE, - COMMAND_GET_OBJECT_ROTATION_VELOCITY, - COMMAND_ADD_VELOCITY_RELATIVE_TO_OBJECT_VELOCITY, - COMMAND_GET_OBJECT_SPEED, -#endif -#if (defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT) - COMMAND_MARK_CUTSCENE_START, - COMMAND_MARK_CUTSCENE_END, - COMMAND_CUTSCENE_SCROLL, -#elif (defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) - COMMAND_IS_MISSION_SKIP, - COMMAND_SET_IN_AMMUNATION, - COMMAND_DO_SAVE_GAME, - COMMAND_IS_RETRY, - COMMAND_DUMMY, - COMMAND_MARK_CUTSCENE_START, - COMMAND_MARK_CUTSCENE_END, - COMMAND_CUTSCENE_SCROLL, -#endif + COMMAND_1442, + COMMAND_1443, + COMMAND_1444, + COMMAND_1445, + COMMAND_1446, + COMMAND_1447, + COMMAND_1448, + COMMAND_1449, + COMMAND_1450, + COMMAND_1451, + COMMAND_1452, + COMMAND_1453, + COMMAND_CALL, + COMMAND_NOTCALL, + COMMAND_1456, + COMMAND_1457, + COMMAND_1458, + COMMAND_1459, + COMMAND_1460, + COMMAND_1461, + COMMAND_1462, + COMMAND_1463, + COMMAND_1464, + COMMAND_1465, + COMMAND_1466, + COMMAND_1467, + COMMAND_1468, + COMMAND_1469, + COMMAND_1470, + COMMAND_1471, + COMMAND_1472, + COMMAND_1473, + COMMAND_1474, + COMMAND_1475, + COMMAND_1476, + COMMAND_1477, + COMMAND_1478, + COMMAND_1479, + COMMAND_1480, + COMMAND_1481, + COMMAND_1482, + COMMAND_1483, + COMMAND_1484, + COMMAND_1485, + COMMAND_1486, + COMMAND_1487, + COMMAND_1488, + COMMAND_1489, + COMMAND_1490, + COMMAND_1491, + COMMAND_1492, + COMMAND_1493, + COMMAND_1494, + COMMAND_1495, + COMMAND_1496, + COMMAND_1497, + COMMAND_1498, + COMMAND_1499, + COMMAND_1500, + COMMAND_1501, + COMMAND_1502, + COMMAND_1503, + COMMAND_1504, + COMMAND_1505, + COMMAND_1506, + COMMAND_1507, + COMMAND_1508, + COMMAND_1509, + COMMAND_1510, + COMMAND_1511, + COMMAND_1512, + COMMAND_1513, + COMMAND_1514, + COMMAND_1515, + COMMAND_1516, + COMMAND_1517, + COMMAND_1518, + COMMAND_1519, + COMMAND_1520, + COMMAND_1521, + COMMAND_1522, + COMMAND_1523, + COMMAND_1524, + COMMAND_1525, + COMMAND_1526, + COMMAND_1527, + COMMAND_1528, + COMMAND_1529, + COMMAND_1530, + COMMAND_1531, + COMMAND_1532, + COMMAND_1533, + COMMAND_1534, + COMMAND_1535, + COMMAND_1536, + COMMAND_1537, + COMMAND_1538, + COMMAND_1539, + COMMAND_1540, + COMMAND_1541, + COMMAND_1542, + COMMAND_1543, + COMMAND_1544, + COMMAND_1545, + COMMAND_1546, + COMMAND_1547, + COMMAND_1548, + COMMAND_1549, + COMMAND_1550, + COMMAND_1551, + COMMAND_1552, + COMMAND_1553, + COMMAND_1554, + COMMAND_1555, + COMMAND_1556, + COMMAND_1557, + COMMAND_1558, + COMMAND_1559, + COMMAND_1560, + COMMAND_1561, + COMMAND_1562, + COMMAND_1563, + COMMAND_1564, + COMMAND_1565, + COMMAND_1566, + COMMAND_1567, + COMMAND_1568, + COMMAND_1569, + COMMAND_1570, + COMMAND_1571, + COMMAND_1572, + COMMAND_1573, + COMMAND_1574, + COMMAND_1575, + COMMAND_1576, + COMMAND_1577, + COMMAND_1578, + COMMAND_1579, + COMMAND_1580, + COMMAND_1581, + COMMAND_1582, + COMMAND_1583, + COMMAND_1584, + COMMAND_1585, + COMMAND_1586, + COMMAND_1587, + COMMAND_1588, + COMMAND_1589, + COMMAND_1590, + COMMAND_1591, + COMMAND_1592, + COMMAND_1593, + COMMAND_1594, + COMMAND_1595, + COMMAND_1596, + COMMAND_1597, + COMMAND_1598, + COMMAND_1599, + COMMAND_1600, + COMMAND_1601, + COMMAND_1602, + COMMAND_1603, + COMMAND_1604, + COMMAND_1605, + COMMAND_1606, + COMMAND_1607, + COMMAND_1608, + COMMAND_1609, + COMMAND_1610, + COMMAND_1611, + COMMAND_1612, + COMMAND_1613, + COMMAND_1614, + COMMAND_1615, + COMMAND_1616, + COMMAND_1617, + COMMAND_1618, + COMMAND_1619, + COMMAND_1620, + COMMAND_1621, + COMMAND_1622, + COMMAND_1623, + COMMAND_1624, + COMMAND_1625, + COMMAND_1626, + COMMAND_1627, + COMMAND_1628, + COMMAND_1629, + COMMAND_1630, + COMMAND_1631, + COMMAND_1632, + COMMAND_1633, + COMMAND_1634, + COMMAND_1635, + COMMAND_1636, + COMMAND_1637, + COMMAND_1638, + COMMAND_1639, + COMMAND_1640, + COMMAND_1641, + COMMAND_1642, + COMMAND_1643, + COMMAND_1644, + COMMAND_1645, + COMMAND_1646, + COMMAND_1647, + COMMAND_1648, + COMMAND_1649, + COMMAND_1650, + COMMAND_1651, + COMMAND_1652, + COMMAND_1653, + COMMAND_1654, + COMMAND_1655, + COMMAND_1656, #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT LAST_SCRIPT_COMMAND #endif @@ -1488,7 +1676,9 @@ enum eScriptArgument ARGTYPE_PED_HANDLE, ARGTYPE_VEHICLE_HANDLE, ARGTYPE_OBJECT_HANDLE, - ARGTYPE_ANDOR + ARGTYPE_ANDOR, + ARGTYPE_LIST, + ARGTYPE_FUNCTION }; struct tScriptCommandData diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index d4188299..581e219a 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -123,6 +123,7 @@ CCam::Process(void) else TargetOrientation = CGeneral::GetATanOfXY(CamTargetEntity->GetForward().x, CamTargetEntity->GetForward().y); +/* LCS: removed CVector Fwd(0.0f, 0.0f, 0.0f); Fwd.x = CamTargetEntity->GetForward().x; Fwd.y = CamTargetEntity->GetForward().y; @@ -140,6 +141,9 @@ CCam::Process(void) else TargetSpeedVar = -Min(Sqrt(SQR(FwdSpeedX) + SQR(FwdSpeedY))/1.8f, 0.5f); SpeedVar = 0.895f*SpeedVar + 0.105*TargetSpeedVar; +*/ + SpeedVar = 0.0f; + TargetSpeedVar = 0.0f; }else{ if(CamTargetEntity == FindPlayerPed()){ // Some fancy smoothing of player position and speed @@ -3947,11 +3951,11 @@ CCam::Process_Debug(const CVector&, float, float, float) } // stay inside sectors - while(CWorld::GetSectorX(Source.x) > 75.0f) + while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f) Source.x -= 1.0f; while(CWorld::GetSectorX(Source.x) < 5.0f) Source.x += 1.0f; - while(CWorld::GetSectorY(Source.y) > 75.0f) + while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f) Source.y -= 1.0f; while(CWorld::GetSectorY(Source.y) < 5.0f) Source.y += 1.0f; @@ -4018,11 +4022,11 @@ CCam::Process_Debug(const CVector&, float, float, float) } // stay inside sectors - while(CWorld::GetSectorX(Source.x) > 75.0f) + while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f) Source.x -= 1.0f; while(CWorld::GetSectorX(Source.x) < 5.0f) Source.x += 1.0f; - while(CWorld::GetSectorY(Source.y) > 75.0f) + while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f) Source.y -= 1.0f; while(CWorld::GetSectorY(Source.y) < 5.0f) Source.y += 1.0f; @@ -4099,11 +4103,11 @@ CCam::Process_Editor(const CVector&, float, float, float) } // stay inside sectors - while(CWorld::GetSectorX(Source.x) > 75.0f) + while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f) Source.x -= 1.0f; while(CWorld::GetSectorX(Source.x) < 5.0f) Source.x += 1.0f; - while(CWorld::GetSectorY(Source.y) > 75.0f) + while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f) Source.y -= 1.0f; while(CWorld::GetSectorY(Source.y) < 5.0f) Source.y += 1.0f; diff --git a/src/core/Clock.cpp b/src/core/Clock.cpp index b391e508..b0f0b34f 100644 --- a/src/core/Clock.cpp +++ b/src/core/Clock.cpp @@ -20,6 +20,7 @@ uint16 CClock::ms_Stored_nGameClockSeconds; uint32 CClock::ms_nMillisecondsPerGameMinute; uint32 CClock::ms_nLastClockTick; bool CClock::ms_bClockHasBeenStored; +float CClock::ms_EnvMapTimeMultiplicator; #ifndef MASTER bool gbFreezeTime; @@ -35,6 +36,7 @@ CClock::Initialise(uint32 scale) ms_nMillisecondsPerGameMinute = scale; ms_nLastClockTick = CTimer::GetTimeInMilliseconds(); ms_bClockHasBeenStored = false; + ms_EnvMapTimeMultiplicator = 1.0f; debug("CClock ready\n"); #ifndef MASTER VarConsole.Add("Time (hour of day)", &ms_nGameClockHours, 1, 0, 23, true); @@ -136,3 +138,10 @@ CClock::RestoreClock(void) ms_nGameClockMinutes = ms_Stored_nGameClockMinutes; ms_nGameClockSeconds = ms_Stored_nGameClockSeconds; } + +void +CClock::CalcEnvMapTimeMultiplicator(void) +{ + float nightness = Abs(ms_nGameClockHours/24.0f - 0.5f); + ms_EnvMapTimeMultiplicator = SQR(1.0f - nightness);; +} diff --git a/src/core/Clock.h b/src/core/Clock.h index a611cd50..808e61f4 100644 --- a/src/core/Clock.h +++ b/src/core/Clock.h @@ -12,6 +12,7 @@ public: static uint32 ms_nMillisecondsPerGameMinute; static uint32 ms_nLastClockTick; static bool ms_bClockHasBeenStored; + static float ms_EnvMapTimeMultiplicator; static void Initialise(uint32 scale); static void Update(void); @@ -21,6 +22,8 @@ public: static void StoreClock(void); static void RestoreClock(void); + static void CalcEnvMapTimeMultiplicator(void); + static uint8 GetHours(void) { return ms_nGameClockHours; } static uint8 GetMinutes(void) { return ms_nGameClockMinutes; } static int16 GetSeconds(void) { return ms_nGameClockSeconds; } diff --git a/src/core/FrontEndControls.cpp b/src/core/FrontEndControls.cpp index 68992e16..18f6b3b2 100644 --- a/src/core/FrontEndControls.cpp +++ b/src/core/FrontEndControls.cpp @@ -7,7 +7,7 @@ #include "FrontEndControls.h" #define X SCREEN_SCALE_X -#define Y(x) SCREEN_SCALE_Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(DEFAULT_SCREEN_HEIGHT_PAL))) +#define Y(x) SCREEN_SCALE_Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(SCREEN_HEIGHT_PAL))) void CPlaceableShText::Draw(float x, float y) diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 11488aec..62e2e65f 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3,6 +3,7 @@ #include <dinput.h> #endif +#define FORCE_PC_SCALING #define WITHWINDOWS #include "common.h" #ifndef PS2_MENU @@ -58,6 +59,19 @@ const CRGBA RADIO_SELECTOR_COLOR = SLIDEROFF_COLOR; const CRGBA INACTIVE_RADIO_COLOR(100, 100, 255, 100); const CRGBA SCROLLBAR_COLOR = LABEL_COLOR; +#if 0 +// Mobile +#define DEFAULT_BRIGHTNESS 0x150 +#define MIN_BRIGHTNESS 180 +#define MAX_BRIGHTNESS 700 +#else +// PS2 +// 8 bars (32 step) +#define DEFAULT_BRIGHTNESS 0x120 +#define MIN_BRIGHTNESS 0x80 +#define MAX_BRIGHTNESS 0x180 +#endif + #define MAP_MIN_SIZE 162.f #define MAP_SIZE_TO_ALLOW_X_MOVE 297.f @@ -465,7 +479,7 @@ CMenuManager::CMenuManager() m_PrefsMusicVolume = 49; m_PrefsRadioStation = 0; m_PrefsStereoMono = 1; - m_PrefsBrightness = 256; + m_PrefsBrightness = DEFAULT_BRIGHTNESS; m_PrefsLOD = CRenderer::ms_lodDistScale; m_KeyPressedCode = -1; m_bFrontEnd_ReloadObrTxtGxt = false; @@ -674,8 +688,8 @@ CMenuManager::CheckSliderMovement(int value) { switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) { case MENUACTION_BRIGHTNESS: - m_PrefsBrightness += value * 24.19f; - m_PrefsBrightness = clamp(m_PrefsBrightness, 0, 384); + m_PrefsBrightness += value * 32.0f; + m_PrefsBrightness = clamp(m_PrefsBrightness, MIN_BRIGHTNESS, MAX_BRIGHTNESS); break; case MENUACTION_DRAWDIST: if(value > 0) @@ -1464,7 +1478,7 @@ CMenuManager::DrawStandardMenus(bool activeScreen) int lastActiveBarX; switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) { case MENUACTION_BRIGHTNESS: - ProcessSlider(m_PrefsBrightness / 384.0f, 70.0f, HOVEROPTION_INCREASE_BRIGHTNESS, HOVEROPTION_DECREASE_BRIGHTNESS, SCREEN_WIDTH, true); + ProcessSlider((float)(m_PrefsBrightness - MIN_BRIGHTNESS) / (MAX_BRIGHTNESS - MIN_BRIGHTNESS), 70.0f, HOVEROPTION_INCREASE_BRIGHTNESS, HOVEROPTION_DECREASE_BRIGHTNESS, SCREEN_WIDTH, true); break; case MENUACTION_DRAWDIST: ProcessSlider((m_PrefsLOD - 0.925f) / 0.875f, 99.0f, HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST, SCREEN_WIDTH, true); @@ -4736,7 +4750,7 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); SaveSettings(); } else if (m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { - m_PrefsBrightness = 256; + m_PrefsBrightness = DEFAULT_BRIGHTNESS; m_PrefsLOD = 1.2f; #ifdef LEGACY_MENU_OPTIONS m_PrefsVsync = true; diff --git a/src/core/Frontend_PS2.cpp b/src/core/Frontend_PS2.cpp index 1ccb658b..c0fcc652 100644 --- a/src/core/Frontend_PS2.cpp +++ b/src/core/Frontend_PS2.cpp @@ -43,7 +43,7 @@ void DoRWStuffEndOfFrame(void); #define X SCREEN_SCALE_X #define Y SCREEN_SCALE_Y -#define YF(x) Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(DEFAULT_SCREEN_HEIGHT_PAL))) +#define YF(x) Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(SCREEN_HEIGHT_PAL))) //#define X(x) ((x)/640.0f*SCRW) //#define Y(y) ((y)/448.0f*SCRH) diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 636eed42..c5154bd4 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -901,7 +901,7 @@ void CGame::Process(void) if (!CReplay::IsPlayingBack()) CCranes::UpdateCranes(); CClouds::Update(); - CMovingThings::Update(); + //CMovingThings::Update(); // TODO CWaterCannons::Update(); CUserDisplay::Process(); CReplay::Update(); diff --git a/src/core/Game.h b/src/core/Game.h index 69d71700..dd14278a 100644 --- a/src/core/Game.h +++ b/src/core/Game.h @@ -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; } diff --git a/src/core/IniFile.cpp b/src/core/IniFile.cpp index f7e2bfdd..870e9a71 100644 --- a/src/core/IniFile.cpp +++ b/src/core/IniFile.cpp @@ -10,7 +10,7 @@ // --MIAMI: file done float CIniFile::PedNumberMultiplier = 0.6f; -float CIniFile::CarNumberMultiplier = 0.6f; +float CIniFile::CarNumberMultiplier = 0.8f; void CIniFile::LoadIniFile() { @@ -27,5 +27,5 @@ void CIniFile::LoadIniFile() } CPopulation::MaxNumberOfPedsInUse = 25.0f * PedNumberMultiplier; CPopulation::MaxNumberOfPedsInUseInterior = 40.0f * PedNumberMultiplier; - CCarCtrl::MaxNumberOfCarsInUse = 12.0f * CarNumberMultiplier; + CCarCtrl::MaxNumberOfCarsInUse = 30.0f * CarNumberMultiplier; }
\ No newline at end of file diff --git a/src/core/KeyGen.cpp b/src/core/KeyGen.cpp index c54e390c..c95ab4b1 100644 --- a/src/core/KeyGen.cpp +++ b/src/core/KeyGen.cpp @@ -1,10 +1,6 @@ #include "common.h" #include "KeyGen.h" -#if defined _WIN32 && !defined __MINGW32__ -#include "ctype.h" -#else -#include <cwctype> -#endif +#include <ctype.h> uint32 CKeyGen::keyTable[256] = { diff --git a/src/core/Pad.h b/src/core/Pad.h index 9f9f81b6..3a4f54b3 100644 --- a/src/core/Pad.h +++ b/src/core/Pad.h @@ -164,6 +164,8 @@ public: int32 LastTimeTouched; int32 AverageWeapon; int32 AverageEntries; + float unk_B4; + float unk_B8; #ifdef DETECT_PAD_INPUT_SWITCH static bool IsAffectedByController; diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index 77ddfdb1..7289175d 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -132,7 +132,7 @@ CPlayerInfo::Process(void) CAutomobile *car = (CAutomobile*)m_pPed->m_pMyVehicle; if (car->m_nWheelsOnGround < 3) - m_nTimeNotFullyOnGround += CTimer::GetTimeInMilliseconds(); + m_nTimeNotFullyOnGround += CTimer::GetTimeStepInMilliseconds(); else m_nTimeNotFullyOnGround = 0; diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 8fe900ae..d9802acc 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -104,6 +104,11 @@ CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = { &RadioVCPRSprite, &RadioEspantosoSprite, &RadioEmotionSprite, + &RadioWaveSprite, // tmp hack + &RadioWaveSprite, + &RadioWaveSprite, + &RadioWaveSprite, + &RadioWaveSprite, &RadioWaveSprite }; @@ -1689,6 +1694,7 @@ CRadar::DrawLegend(int32 x, int32 y, int32 sprite) text = TheText.Get("LG_34"); break; default: + text = TheText.Get("LG_34"); // tmp hack break; } CFont::PrintString(SCREEN_SCALE_X(20.f) + x, SCREEN_SCALE_Y(3.0f) + y, text); diff --git a/src/core/Radar.h b/src/core/Radar.h index 8f2e7069..6e0f36f8 100644 --- a/src/core/Radar.h +++ b/src/core/Radar.h @@ -16,9 +16,9 @@ #define OBJECTBLIP_MARKER_COLOR_B 242 #define OBJECTBLIP_MARKER_COLOR_A 255 -#define COORDBLIP_MARKER_COLOR_R 252 -#define COORDBLIP_MARKER_COLOR_G 138 -#define COORDBLIP_MARKER_COLOR_B 242 +#define COORDBLIP_MARKER_COLOR_R 255 +#define COORDBLIP_MARKER_COLOR_G 255 +#define COORDBLIP_MARKER_COLOR_B 128 #define COORDBLIP_MARKER_COLOR_A 228 #define NUM_MAP_LEGENDS 75 @@ -92,6 +92,11 @@ enum eRadarSprite RADAR_SPRITE_RADIO_ESPANTOSO, RADAR_SPRITE_RADIO_EMOTION, RADAR_SPRITE_RADIO_WAVE, + RADAR_SPRITE_40, // tmp + RADAR_SPRITE_41, + RADAR_SPRITE_42, + RADAR_SPRITE_43, + RADAR_SPRITE_44, RADAR_SPRITE_COUNT }; @@ -156,8 +161,28 @@ struct sRadarTraceSave // Values for screen space #define RADAR_LEFT (40.0f) #define RADAR_BOTTOM (40.0f) + +#ifdef FIX_RADAR +/* + The values are from an early screenshot taken before R* broke radar + #define RADAR_WIDTH (82.0f) + #define RADAR_HEIGHT (82.0f) +*/ +#define RADAR_WIDTH ((CDraw::ms_bFixRadar) ? (82.0f) : (94.0f)) +#define RADAR_HEIGHT ((CDraw::ms_bFixRadar) ? (82.0f) : (76.0f)) +#else +/* + broken since forever, someone tried to fix size for 640x512(PAL) + http://aap.rockstarvision.com/pics/gta3/ps2screens/gta3_interface.jpg + but failed: + http://aap.rockstarvision.com/pics/gta3/artwork/gta3_artwork_16.jpg + most likely the guy used something like this: + int y = 82 * (640.0/512.0)/(640.0/480.0); + int x = y * (640.0/512.0); +*/ #define RADAR_WIDTH (94.0f) #define RADAR_HEIGHT (76.0f) +#endif class CRadar { diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 3a6fdc2a..4198dd84 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -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); @@ -1151,12 +1146,9 @@ CStreaming::RemoveModel(int32 id) void CStreaming::RemoveUnusedBuildings(eLevelName level) { - if(level != LEVEL_INDUSTRIAL) - RemoveBuildings(LEVEL_INDUSTRIAL); - if(level != LEVEL_COMMERCIAL) - RemoveBuildings(LEVEL_COMMERCIAL); - if(level != LEVEL_SUBURBAN) - RemoveBuildings(LEVEL_SUBURBAN); + for(int i = LEVEL_INDUSTRIAL; i < NUM_LEVELS; i++) + if(level != i) + RemoveBuildings((eLevelName)i); } void @@ -1279,12 +1271,9 @@ CStreaming::RemoveUnusedBigBuildings(eLevelName level) { ISLAND_LOADING_IS(LOW) { - if(level != LEVEL_INDUSTRIAL) - RemoveBigBuildings(LEVEL_INDUSTRIAL); - if(level != LEVEL_COMMERCIAL) - RemoveBigBuildings(LEVEL_COMMERCIAL); - if(level != LEVEL_SUBURBAN) - RemoveBigBuildings(LEVEL_SUBURBAN); + for(int i = LEVEL_INDUSTRIAL; i < NUM_LEVELS; i++) + if(level != i) + RemoveBuildings((eLevelName)i); } RemoveIslandsNotUsed(level); } @@ -1324,8 +1313,11 @@ CStreaming::RemoveIslandsNotUsed(eLevelName level) } #ifdef NO_ISLAND_LOADING if(FrontEndMenuManager.m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_HIGH) { - DeleteIsland(pIslandLODmainlandEntity); - DeleteIsland(pIslandLODbeachEntity); + DeleteIsland(pIslandLODindustEntity); + DeleteIsland(pIslandLODcomIndEntity); + DeleteIsland(pIslandLODcomSubEntity); + DeleteIsland(pIslandLODsubIndEntity); + DeleteIsland(pIslandLODsubComEntity); } else #endif switch(level){ diff --git a/src/core/Streaming.h b/src/core/Streaming.h index a67384f6..66262721 100644 --- a/src/core/Streaming.h +++ b/src/core/Streaming.h @@ -17,6 +17,8 @@ enum StreamFlags STREAMFLAGS_PRIORITY = 0x08, STREAMFLAGS_NOFADE = 0x10, STREAMFLAGS_20 = 0x20, // TODO(MIAMI): what's this + STREAMFLAGS_40 = 0x40, // TODO(LCS): what's this + STREAMFLAGS_AMBIENT_SCRIPT_OWNED = 0x80, STREAMFLAGS_CANT_REMOVE = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED, STREAMFLAGS_KEEP_IN_MEMORY = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED|STREAMFLAGS_DEPENDENCY, @@ -123,6 +125,7 @@ public: static bool HasColLoaded(int32 id) { return HasModelLoaded(id+STREAM_OFFSET_COL); } static bool HasAnimLoaded(int32 id) { return HasModelLoaded(id+STREAM_OFFSET_ANIM); } static bool CanRemoveModel(int32 id) { return (ms_aInfoForModel[id].m_flags & STREAMFLAGS_CANT_REMOVE) == 0; } + static bool IsScriptOwnedModel(int32 id) { return (ms_aInfoForModel[id].m_flags & STREAMFLAGS_SCRIPTOWNED); } static bool CanRemoveTxd(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_TXD); } static bool CanRemoveCol(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_COL); } static bool CanRemoveAnim(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_ANIM); } @@ -213,3 +216,10 @@ public: static void PrintStreamingBufferState(); }; + +// LCS(TODO): put them into CStreaming::mspInst +extern int32 islandLODindust; +extern int32 islandLODcomInd; +extern int32 islandLODcomSub; +extern int32 islandLODsubInd; +extern int32 islandLODsubCom; diff --git a/src/core/Wanted.h b/src/core/Wanted.h index 057b5407..f2da23e3 100644 --- a/src/core/Wanted.h +++ b/src/core/Wanted.h @@ -41,6 +41,7 @@ public: int32 NumOfHelisRequired(); void SetWantedLevel(int32); void SetWantedLevelNoDrop(int32 level); + int32 GetWantedLevel() { return m_nWantedLevel; } void CheatWantedLevel(int32 level); void RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare); void RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare); diff --git a/src/core/common.h b/src/core/common.h index ed95f6d3..ace15ee1 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -93,6 +93,7 @@ typedef ptrdiff_t ssize_t; #include "config.h" #include "memoryManager.h" +#include "relocatableChunk.h" #include <rphanim.h> #include <rpskin.h> @@ -124,17 +125,43 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w) #include "skeleton.h" #include "Draw.h" -#define DEFAULT_SCREEN_WIDTH (640) -#define DEFAULT_SCREEN_HEIGHT (448) -#define DEFAULT_SCREEN_HEIGHT_PAL (512) -#define DEFAULT_SCREEN_HEIGHT_NTSC (448) +#if defined(PROPER_SCALING) + #ifdef FORCE_PC_SCALING + #define DEFAULT_SCREEN_WIDTH (640) + #define DEFAULT_SCREEN_HEIGHT (448) + #else + #define DEFAULT_SCREEN_WIDTH (640) + #define DEFAULT_SCREEN_HEIGHT (480) + #endif +#elif defined(GTA_PS2) + #define DEFAULT_SCREEN_WIDTH (640) + #define DEFAULT_SCREEN_HEIGHT (480) +#else //elif defined(GTA_PC) + #define DEFAULT_SCREEN_WIDTH (640) + #define DEFAULT_SCREEN_HEIGHT (448) +#endif + #define DEFAULT_ASPECT_RATIO (4.0f/3.0f) #define DEFAULT_VIEWWINDOW (0.7f) // game uses maximumWidth/Height, but this probably won't work // with RW windowed mode -#define SCREEN_WIDTH ((float)RsGlobal.width) +#ifdef GTA_PS2 + #ifdef GTA_PAL + #define SCREEN_WIDTH ((float)640) + #define SCREEN_HEIGHT ((float)512) + #else + #define SCREEN_WIDTH ((float)640) + #define SCREEN_HEIGHT ((float)448) + #endif +#else +#define SCREEN_WIDTH ((float)RsGlobal.width) #define SCREEN_HEIGHT ((float)RsGlobal.height) +#endif + +#define SCREEN_HEIGHT_PAL ((float)512) +#define SCREEN_HEIGHT_NTSC ((float)448) + #define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio()) #define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetScaledFOV() * 0.5f))) @@ -152,8 +179,13 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w) #ifdef ASPECT_RATIO_SCALE #define SCREEN_SCALE_AR(a) ((a) * DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO) -extern float ScaleAndCenterX(float x); -#define SCALE_AND_CENTER_X(x) ScaleAndCenterX(x) +#define SCALE_AND_CENTER_X(x) ((SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH) ? (x) : (SCREEN_WIDTH - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)) / 2 + SCREEN_SCALE_X((x))) +#ifdef PROPER_SCALING + #ifndef FORCE_PC_SCALING + #undef SCREEN_SCALE_Y + #define SCREEN_SCALE_Y(a) CDraw::ScaleY(SCREEN_STRETCH_Y(a)) + #endif +#endif #else #define SCREEN_SCALE_AR(a) (a) #define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x) diff --git a/src/core/config.h b/src/core/config.h index 4aaeb3c1..225863f3 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -97,7 +97,7 @@ enum Config { NUMPACMANPICKUPS = 256, NUMEVENTS = 64, - NUM_CARGENS = 185, + NUM_CARGENS = 500, NUM_PATH_NODES_IN_AUTOPILOT = 8, @@ -136,7 +136,7 @@ enum Config { NUM_GARAGE_STORED_CARS = 4, - NUM_CRANES = 8, + NUM_CRANES = 11, NUM_ESCALATORS = 22, NUM_WATER_CREATURES = 8, @@ -254,6 +254,7 @@ enum Config { // Rendering/display #define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios +#define PROPER_SCALING // use original DEFAULT_SCREEN_WIDTH/DEFAULT_SCREEN_HEIGHT from PS2 instead of PC(R* changed HEIGHT here to make radar look better, but broke other hud elements aspect ratio). #define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) #define USE_TXD_CDIMAGE // generate and load textures from txd.img #define PS2_ALPHA_TEST // emulate ps2 alpha test @@ -268,6 +269,8 @@ enum Config { #define NEW_RENDERER // leeds-like world rendering, needs librw #endif +#define FIX_SPRITES // fix sprites aspect ratio(moon, coronas, particle etc) + #ifndef EXTENDED_COLOURFILTER #undef SCREEN_DROPLETS // we need the backbuffer for this effect #endif @@ -298,6 +301,8 @@ enum Config { // Hud, frontend and radar #define PC_MENU +#define FIX_RADAR // use radar size from early version before R* broke it + #ifndef PC_MENU # define PS2_MENU //# define PS2_MENU_USEALLPAGEICONS @@ -366,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 diff --git a/src/core/main.cpp b/src/core/main.cpp index 41a99991..e6d83608 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -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; @@ -124,7 +128,7 @@ bool gbPrintMemoryUsage; #endif #ifdef NEW_RENDERER -bool gbNewRenderer; +bool gbNewRenderer = true; #endif #ifdef FIX_BUGS // need to clear stencil for mblur fx. no idea why it works in the original game @@ -1143,10 +1147,10 @@ MattRenderScene(void) /// CWorld::AdvanceCurrentScanCode(); // CMattRenderer::ResetRenderStates /// CRenderer::ClearForFrame(); // before ConstructRenderList - // CClock::CalcEnvMapTimeMultiplicator + CClock::CalcEnvMapTimeMultiplicator(); RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE); CWaterLevel::RenderWater(); // actually CMattRenderer::RenderWater - // CClock::ms_EnvMapTimeMultiplicator = 1.0f; + CClock::ms_EnvMapTimeMultiplicator = 1.0f; // cWorldStream::ClearDynamics /// CRenderer::ConstructRenderList(); // before PreRender if(gbRenderWorld0) @@ -1159,6 +1163,8 @@ if(gbRenderWorld1) if(gbRenderRoads) CRenderer::RenderRoads(); + CRenderer::GenerateEnvironmentMap(); // should be after static shadows, but that's weird + CRenderer::RenderPeds(); // not sure where to put these since LCS has no underwater entities @@ -1172,7 +1178,7 @@ if(gbRenderWater) if(gbRenderEverythingBarRoads) CRenderer::RenderEverythingBarRoads(); - // get env map here? + // seam fixer // moved this: // CRenderer::RenderFadingInEntities(); } @@ -1195,7 +1201,6 @@ void RenderEffects_new(void) { CShadows::RenderStaticShadows(); - // CRenderer::GenerateEnvironmentMap CShadows::RenderStoredShadows(); CSkidmarks::Render(); CRubbish::Render(); diff --git a/src/core/main.h b/src/core/main.h index 9b76a947..0f9ceb08 100644 --- a/src/core/main.h +++ b/src/core/main.h @@ -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); diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 3a5488d1..efb6ec3b 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -220,6 +220,16 @@ void LoadINISettings() CustomPipes::GlossMult = CheckAndReadIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult); #endif gBackfaceCulling = CheckAndReadIniInt("Rendering", "BackfaceCulling", gBackfaceCulling); + +#ifdef PROPER_SCALING + CDraw::ms_bProperScaling = CheckAndReadIniInt("Draw", "ProperScaling", CDraw::ms_bProperScaling); +#endif +#ifdef FIX_RADAR + CDraw::ms_bFixRadar = CheckAndReadIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar); +#endif +#ifdef FIX_SPRITES + CDraw::ms_bFixSprites = CheckAndReadIniInt("Draw", "FixSprites", CDraw::ms_bFixSprites); +#endif } void SaveINISettings() @@ -259,6 +269,16 @@ void SaveINISettings() #endif CheckAndSaveIniInt("Rendering", "BackfaceCulling", gBackfaceCulling, changed); +#ifdef PROPER_SCALING + CheckAndSaveIniInt("Draw", "ProperScaling", CDraw::ms_bProperScaling, changed); +#endif +#ifdef FIX_RADAR + CheckAndSaveIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar, changed); +#endif +#ifdef FIX_SPRITES + CheckAndSaveIniInt("Draw", "FixSprites", CDraw::ms_bFixSprites, changed); +#endif + if (changed) cfg.write_file("reLCS.ini"); } @@ -420,17 +440,15 @@ SwitchToMission(void) #endif static const char *carnames[] = { - "landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "rio", "firetruk", "trash", "stretch", "manana", - "infernus", "voodoo", "pony", "mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", "washing", - "bobcat", "mrwhoop", "bfinject", "hunter", "police", "enforcer", "securica", "banshee", "predator", "bus", - "rhino", "barracks", "cuban", "chopper", "angel", "coach", "cabbie", "stallion", "rumpo", "rcbandit", "romero", - "packer", "sentxs", "admiral", "squalo", "seaspar", "pizzaboy", "gangbur", "airtrain", "deaddodo", "speeder", - "reefer", "tropic", "flatbed", "yankee", "caddy", "zebra", "topfun", "skimmer", "pcj600", "faggio", "freeway", - "rcbaron", "rcraider", "glendale", "oceanic", "sanchez", "sparrow", "patriot", "lovefist", "coastg", "dinghy", - "hermes", "sabre", "sabretur", "pheonix", "walton", "regina", "comet", "deluxo", "burrito", "spand", "marquis", - "baggage", "kaufman", "maverick", "vcnmav", "rancher", "fbiranch", "virgo", "greenwoo", "jetmax", "hotring", - "sandking", "blistac", "polmav", "boxville", "benson", "mesa", "rcgoblin", "hotrina", "hotrinb", - "bloodra", "bloodrb", "vicechee" + "spider", "landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "patriot", "firetruk", "trash", "stretch", + "manana", "infernus", "blista", "pony", "mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", + "kuruma", "bobcat", "mrwhoop", "bfinject", "hearse", "police", "enforcer", "securica", "banshee", "bus", "rhino", + "barracks", "dodo", "coach", "cabbie", "stallion", "rumpo", "rcbandit", "bellyup", "mrwongs", "mafia", "yardie", + "yakuza", "diablos", "columb", "hoods", "panlant", "flatbed", "yankee", "borgnine", "toyz", "campvan", "ballot", + "shelby", "pontiac", "esprit", "ammotruk", "hotrod", "Sindacco_Car", "Forelli_Car", "ferry", "ghost", "speeder", + "reefer", "predator", "train", "escape", "chopper", "airtrain", "deaddodo", "angel", "pizzaboy", "noodleboy", + "pcj600", "faggio", "freeway", "angel2", "sanchez2", "sanchez", "rcgoblin", "rcraider", "hunter", "maverick", + "polmav", "vcnmav" }; static CTweakVar** TweakVarsList; @@ -563,7 +581,7 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Cheats", "Pickup chicks", PickUpChicksCheat); static int spawnCarId = MI_LANDSTAL; - e = DebugMenuAddVar("Spawn", "Spawn Car ID", &spawnCarId, nil, 1, MI_LANDSTAL, MI_VICECHEE, carnames); + e = DebugMenuAddVar("Spawn", "Spawn Car ID", &spawnCarId, nil, 1, MI_SPIDER, MI_VCNMAV, carnames); DebugMenuEntrySetWrap(e, true); DebugMenuAddCmd("Spawn", "Spawn Car", [](){ if(spawnCarId == MI_CHOPPER || @@ -578,22 +596,19 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Spawn", "Spawn Stinger", [](){ SpawnCar(MI_STINGER); }); DebugMenuAddCmd("Spawn", "Spawn Infernus", [](){ SpawnCar(MI_INFERNUS); }); DebugMenuAddCmd("Spawn", "Spawn Cheetah", [](){ SpawnCar(MI_CHEETAH); }); - DebugMenuAddCmd("Spawn", "Spawn Phoenix", [](){ SpawnCar(MI_PHEONIX); }); + DebugMenuAddCmd("Spawn", "Spawn Esprit", [](){ SpawnCar(MI_ESPRIT); }); DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); }); DebugMenuAddCmd("Spawn", "Spawn Esperanto", [](){ SpawnCar(MI_ESPERANT); }); DebugMenuAddCmd("Spawn", "Spawn Stallion", [](){ SpawnCar(MI_STALLION); }); - DebugMenuAddCmd("Spawn", "Spawn Admiral", [](){ SpawnCar(MI_ADMIRAL); }); - DebugMenuAddCmd("Spawn", "Spawn Washington", [](){ SpawnCar(MI_WASHING); }); + DebugMenuAddCmd("Spawn", "Spawn Mafia", [](){ SpawnCar(MI_MAFIA); }); + DebugMenuAddCmd("Spawn", "Spawn Kuruma", [](){ SpawnCar(MI_KURUMA); }); DebugMenuAddCmd("Spawn", "Spawn Taxi", [](){ SpawnCar(MI_TAXI); }); DebugMenuAddCmd("Spawn", "Spawn Police", [](){ SpawnCar(MI_POLICE); }); DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); }); - DebugMenuAddCmd("Spawn", "Spawn Cuban", [](){ SpawnCar(MI_CUBAN); }); - DebugMenuAddCmd("Spawn", "Spawn Voodoo", [](){ SpawnCar(MI_VOODOO); }); + DebugMenuAddCmd("Spawn", "Spawn Diablo", [](){ SpawnCar(MI_DIABLOS); }); + DebugMenuAddCmd("Spawn", "Spawn Yardie", [](){ SpawnCar(MI_YARDIE); }); DebugMenuAddCmd("Spawn", "Spawn BF injection", [](){ SpawnCar(MI_BFINJECT); }); DebugMenuAddCmd("Spawn", "Spawn Maverick", [](){ SpawnCar(MI_MAVERICK); }); - DebugMenuAddCmd("Spawn", "Spawn VCN Maverick", [](){ SpawnCar(MI_VCNMAV); }); - DebugMenuAddCmd("Spawn", "Spawn Sparrow", [](){ SpawnCar(MI_SPARROW); }); - DebugMenuAddCmd("Spawn", "Spawn Sea Sparrow", [](){ SpawnCar(MI_SEASPAR); }); DebugMenuAddCmd("Spawn", "Spawn Hunter", [](){ SpawnCar(MI_HUNTER); }); DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); }); DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); }); @@ -601,10 +616,9 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Spawn", "Spawn PCJ 600", [](){ SpawnCar(MI_PCJ600); }); DebugMenuAddCmd("Spawn", "Spawn Faggio", [](){ SpawnCar(MI_FAGGIO); }); DebugMenuAddCmd("Spawn", "Spawn Freeway", [](){ SpawnCar(MI_FREEWAY); }); - DebugMenuAddCmd("Spawn", "Spawn Squalo", [](){ SpawnCar(MI_SQUALO); }); - DebugMenuAddCmd("Spawn", "Spawn Skimmer", [](){ SpawnCar(MI_SKIMMER); }); DebugMenuAddVarBool8("Render", "Draw hud", &CHud::m_Wants_To_Draw_Hud, nil); + DebugMenuAddVar("Render", "Brightness", &FrontEndMenuManager.m_PrefsBrightness, nil, 16, 0, 700, nil); DebugMenuAddVarBool8("Render", "Backface Culling", &gBackfaceCulling, nil); DebugMenuAddVarBool8("Render", "PS2 Alpha test Emu", &gPS2alphaTest, nil); DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil); @@ -635,8 +649,8 @@ extern bool gbRenderWorld2; #endif #ifdef EXTENDED_COLOURFILTER - static const char *filternames[] = { "None", "Simple", "Normal", "Mobile" }; - e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_MOBILE, filternames); + static const char *filternames[] = { "None", "PS2" }; + e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_NORMAL, filternames); DebugMenuEntrySetWrap(e, true); DebugMenuAddVar("Render", "Intensity", &CPostFX::Intensity, nil, 0.05f, 0, 10.0f); DebugMenuAddVarBool8("Render", "Blur", &CPostFX::BlurOn, nil); @@ -647,18 +661,25 @@ extern bool gbRenderWorld2; DebugMenuAddVarBool8("Render", "Occlusion debug", &bDispayOccDebugStuff, nil); #endif #ifdef EXTENDED_PIPELINES - static const char *vehpipenames[] = { "MatFX", "Neo" }; + static const char *worldpipenames[] = { "PS2", "Mobile" }; + e = DebugMenuAddVar("Render", "World Rendering", &CustomPipes::WorldPipeSwitch, nil, + 1, CustomPipes::WORLDPIPE_PS2, CustomPipes::WORLDPIPE_MOBILE, worldpipenames); + DebugMenuEntrySetWrap(e, true); + static const char *vehpipenames[] = { "PS2", "Mobile", "Neo" }; e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil, - 1, CustomPipes::VEHICLEPIPE_MATFX, CustomPipes::VEHICLEPIPE_NEO, vehpipenames); + 1, CustomPipes::VEHICLEPIPE_PS2, CustomPipes::VEHICLEPIPE_MOBILE, vehpipenames); DebugMenuEntrySetWrap(e, true); - DebugMenuAddVar("Render", "Neo Vehicle Shininess", &CustomPipes::VehicleShininess, nil, 0.1f, 0, 1.0f); - DebugMenuAddVar("Render", "Neo Vehicle Specularity", &CustomPipes::VehicleSpecularity, nil, 0.1f, 0, 1.0f); + DebugMenuAddVarBool8("Render", "Glass Cars cheat", &CustomPipes::gGlassCarsCheat, nil); +extern bool gbRenderDebugEnvMap; + DebugMenuAddVarBool8("Render", "Show Env map", &gbRenderDebugEnvMap, nil); +// DebugMenuAddVar("Render", "Neo Vehicle Shininess", &CustomPipes::VehicleShininess, nil, 0.1f, 0, 1.0f); +// DebugMenuAddVar("Render", "Neo Vehicle Specularity", &CustomPipes::VehicleSpecularity, nil, 0.1f, 0, 1.0f); DebugMenuAddVarBool8("Render", "Neo Ped Rim light enable", &CustomPipes::RimlightEnable, nil); DebugMenuAddVar("Render", "Mult", &CustomPipes::RimlightMult, nil, 0.1f, 0, 1.0f); - DebugMenuAddVarBool8("Render", "Neo World Lightmaps enable", &CustomPipes::LightmapEnable, nil); - DebugMenuAddVar("Render", "Mult", &CustomPipes::LightmapMult, nil, 0.1f, 0, 1.0f); - DebugMenuAddVarBool8("Render", "Neo Road Gloss enable", &CustomPipes::GlossEnable, nil); - DebugMenuAddVar("Render", "Mult", &CustomPipes::GlossMult, nil, 0.1f, 0, 1.0f); +// DebugMenuAddVarBool8("Render", "Neo World Lightmaps enable", &CustomPipes::LightmapEnable, nil); +// DebugMenuAddVar("Render", "Mult", &CustomPipes::LightmapMult, nil, 0.1f, 0, 1.0f); +// DebugMenuAddVarBool8("Render", "Neo Road Gloss enable", &CustomPipes::GlossEnable, nil); +// DebugMenuAddVar("Render", "Mult", &CustomPipes::GlossMult, nil, 0.1f, 0, 1.0f); #endif DebugMenuAddVarBool8("Render", "Show Ped Paths", &gbShowPedPaths, nil); DebugMenuAddVarBool8("Render", "Show Car Paths", &gbShowCarPaths, nil); @@ -671,6 +692,16 @@ extern bool gbRenderWorld2; DebugMenuAddVarBool8("Render", "Don't render Vehicles", &gbDontRenderVehicles, nil); DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil); DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil); + +#ifdef PROPER_SCALING + DebugMenuAddVarBool8("Draw", "Proper Scaling", &CDraw::ms_bProperScaling, nil); +#endif +#ifdef FIX_RADAR + DebugMenuAddVarBool8("Draw", "Fix Radar", &CDraw::ms_bFixRadar, nil); +#endif +#ifdef FIX_SPRITES + DebugMenuAddVarBool8("Draw", "Fix Sprites", &CDraw::ms_bFixSprites, nil); +#endif #ifndef FINAL DebugMenuAddVarBool8("Debug", "Print Memory Usage", &gbPrintMemoryUsage, nil); diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index 862d2562..921da7df 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -4,6 +4,7 @@ #include "RwHelper.h" #include "ModelIndices.h" #include "Timer.h" +#include "Streaming.h" #include "Entity.h" #include "Object.h" #include "World.h" @@ -623,10 +624,15 @@ CEntity::SetupBigBuilding(void) m_level = CTheZones::GetLevelFromPosition(&GetPosition()); if(mi->m_lodDistances[0] <= 2000.0f) bStreamBIGBuilding = true; - if(mi->m_lodDistances[0] > 2500.0f || mi->m_ignoreDrawDist) + if(m_modelIndex == islandLODindust || + m_modelIndex == islandLODcomInd || + m_modelIndex == islandLODcomSub || + m_modelIndex == islandLODsubInd || + m_modelIndex == islandLODsubCom || + mi->m_lodDistances[0] > 5000.0f || mi->m_ignoreDrawDist) m_level = LEVEL_GENERIC; - else if(m_level == LEVEL_GENERIC) - printf("%s isn't in a level\n", mi->GetModelName()); +// else if(m_level == LEVEL_GENERIC) +// printf("%s isn't in a level\n", mi->GetModelName()); } float WindTabel[] = { diff --git a/src/extras/custompipes.cpp b/src/extras/custompipes.cpp index 2cecf1c0..247aa4b1 100644 --- a/src/extras/custompipes.cpp +++ b/src/extras/custompipes.cpp @@ -46,13 +46,14 @@ CustomMatCopy(void *dst, void *src, int32, int32) rw::TexDictionary *neoTxd; +bool gGlassCarsCheat; bool bRenderingEnvMap; -int32 EnvMapSize = 128; +int32 EnvMapSize = 512; rw::Camera *EnvMapCam; rw::Texture *EnvMapTex; rw::Texture *EnvMaskTex; -static rw::RWDEVICE::Im2DVertex EnvScreenQuad[4]; -static int16 QuadIndices[6] = { 0, 1, 2, 0, 2, 3 }; +rw::RWDEVICE::Im2DVertex EnvScreenQuad[4]; +int16 QuadIndices[6] = { 0, 1, 2, 0, 2, 3 }; static rw::Camera* CreateEnvMapCam(rw::World *world) @@ -341,7 +342,7 @@ ReadTweakValueTable(char *fp, InterpolatedValue &interp) * Neo Vehicle pipe */ -int32 VehiclePipeSwitch = VEHICLEPIPE_MATFX; +int32 VehiclePipeSwitch = VEHICLEPIPE_PS2; float VehicleShininess = 1.0f; float VehicleSpecularity = 1.0f; InterpolatedFloat Fresnel(0.4f); @@ -369,6 +370,7 @@ AttachVehiclePipe(rw::Clump *clump) * Neo World pipe */ +int32 WorldPipeSwitch = 0; bool LightmapEnable; float LightmapMult = 1.0f; InterpolatedFloat WorldLightmapBlend(1.0f); diff --git a/src/extras/custompipes.h b/src/extras/custompipes.h index ca3f0fb4..e83201ff 100644 --- a/src/extras/custompipes.h +++ b/src/extras/custompipes.h @@ -75,16 +75,22 @@ void CustomPipeInit(void); void CustomPipeShutdown(void); void SetTxdFindCallback(void); +extern bool gGlassCarsCheat; extern bool bRenderingEnvMap; extern int32 EnvMapSize; extern rw::Camera *EnvMapCam; extern rw::Texture *EnvMapTex; extern rw::Texture *EnvMaskTex; +extern rw::RWDEVICE::Im2DVertex EnvScreenQuad[4]; +extern int16 QuadIndices[6]; void EnvMapRender(void); enum { - VEHICLEPIPE_MATFX, - VEHICLEPIPE_NEO + VEHICLEPIPE_PS2, + VEHICLEPIPE_MOBILE, + +// maybe later again... + VEHICLEPIPE_NEO = -1 }; extern int32 VehiclePipeSwitch; extern float VehicleShininess; @@ -99,6 +105,11 @@ void DestroyVehiclePipe(void); void AttachVehiclePipe(rw::Atomic *atomic); void AttachVehiclePipe(rw::Clump *clump); +enum { + WORLDPIPE_PS2, + WORLDPIPE_MOBILE +}; +extern int32 WorldPipeSwitch; extern bool LightmapEnable; extern float LightmapMult; extern InterpolatedFloat WorldLightmapBlend; @@ -133,5 +144,12 @@ void AttachRimPipe(rw::Clump *clump); } +namespace WorldRender{ +extern int numBlendInsts[3]; +void AtomicFirstPass(RpAtomic *atomic, int pass); +void AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha); +void RenderBlendPass(int pass); +} + #endif #endif diff --git a/src/extras/custompipes_d3d9.cpp b/src/extras/custompipes_d3d9.cpp index 57f364a3..9a02f874 100644 --- a/src/extras/custompipes_d3d9.cpp +++ b/src/extras/custompipes_d3d9.cpp @@ -4,6 +4,8 @@ #ifdef RW_D3D9 #ifdef EXTENDED_PIPELINES +#include "rpmatfx.h" + #include "main.h" #include "RwHelper.h" #include "Lights.h" @@ -38,17 +40,191 @@ enum { VSLOC_reflProps, VSLOC_specLights, - // Leeds building + // Leeds building, Leeds vehicle mobile VSLOC_emissive = rw::d3d::VSLOC_afterLights, VSLOC_ambient, + VSLOC_viewMat, // only vehicle + + PSLOC_colorscale = 1, - PSLOC_colorscale = 1 + // Leeds vehicle PS2 + VSLOC_texMat = rw::d3d::VSLOC_afterLights, + + PSLOC_shininess = 1, + PSLOC_skyTop, + PSLOC_skyBot }; /* - * Neo Vehicle pipe + * Leeds & Neo Vehicle pipe */ +static void *leedsVehicle_VS; +static void *leedsVehicle_mobile_VS; +static void *leedsVehicle_blend_PS; +static void *leedsVehicle_add_PS; +static void *leedsVehicle_mobile_PS; + +static rw::RawMatrix normal2texcoord_flipU = { + { -0.5f, 0.0f, 0.0f }, 0.0f, + { 0.0f, -0.5f, 0.0f }, 0.0f, + { 0.0f, 0.0f, 1.0f }, 0.0f, + { 0.5f, 0.5f, 0.0f }, 1.0f +}; + +void +uploadEnvMatrix(rw::Frame *frame) +{ + using namespace rw; + Matrix invMat; + if(frame == nil) + frame = engine->currentCamera->getFrame(); + + RawMatrix envMtx, invMtx; + Matrix tmp = *frame->getLTM(); + // Now the weird part: we remove the camera pitch + tmp.at.z = 0.0f; + tmp.at = normalize(tmp.at); + tmp.right.x = -tmp.at.y; + tmp.right.y = tmp.at.x; + tmp.right.z = 0.0f;; + tmp.up.set(0.0f, 0.0f, 1.0f); + tmp.pos.set(0.0f, 0.0f, 0.0f); + tmp.flags = Matrix::TYPEORTHONORMAL; + + Matrix::invert(&invMat, &tmp); + convMatrix(&invMtx, &invMat); + RawMatrix::mult(&envMtx, &invMtx, &normal2texcoord_flipU); + d3d::d3ddevice->SetVertexShaderConstantF(VSLOC_texMat, (float*)&envMtx, 4); +} + +void +leedsVehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) +{ + using namespace rw; + using namespace rw::d3d; + using namespace rw::d3d9; + + int vsBits; + setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride); + setIndices(header->indexBuffer); + setVertexDeclaration(header->vertexDeclaration); + + vsBits = lightingCB_Shader(atomic); + uploadMatrices(atomic->getFrame()->getLTM()); + + setVertexShader(leedsVehicle_VS); + if(gGlassCarsCheat) + setPixelShader(leedsVehicle_blend_PS); + else + setPixelShader(leedsVehicle_add_PS); + + d3d::setTexture(1, EnvMapTex); + uploadEnvMatrix(nil); + + SetRenderState(SRCBLEND, BLENDONE); + + InstanceData *inst = header->inst; + for(rw::uint32 i = 0; i < header->numMeshes; i++){ + Material *m = inst->material; + + SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255); + + float coef = 0.0f; + if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP){ + coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f; + if(gGlassCarsCheat) + coef = 1.0f; + } + d3ddevice->SetPixelShaderConstantF(PSLOC_shininess, (float*)&coef, 1); + + setMaterial(m->color, m->surfaceProps); + + if(m->texture) + d3d::setTexture(0, m->texture); + else + d3d::setTexture(0, gpWhiteTexture); + + drawInst(header, inst); + inst++; + } + + d3d::setTexture(1, nil); + + SetRenderState(SRCBLEND, BLENDSRCALPHA); +} + +void +leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) +{ + using namespace rw; + using namespace rw::d3d; + using namespace rw::d3d9; + + int vsBits; + setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride); + setIndices(header->indexBuffer); + setVertexDeclaration(header->vertexDeclaration); + + vsBits = lightingCB_Shader(atomic); + uploadMatrices(atomic->getFrame()->getLTM()); + + setVertexShader(leedsVehicle_mobile_VS); + setPixelShader(leedsVehicle_mobile_PS); + + RGBAf amb, emiss; + amb.red = CTimeCycle::GetAmbientRed(); + amb.green = CTimeCycle::GetAmbientGreen(); + amb.blue = CTimeCycle::GetAmbientBlue(); + amb.alpha = 1.0f; + emiss = pAmbient->color; + + d3ddevice->SetVertexShaderConstantF(VSLOC_ambient, (float*)&amb, 1); + d3ddevice->SetVertexShaderConstantF(VSLOC_emissive, (float*)&emiss, 1); + + RGBAf skyTop, skyBot; + skyTop.red = CTimeCycle::GetSkyTopRed()/255.0f; + skyTop.green = CTimeCycle::GetSkyTopGreen()/255.0f; + skyTop.blue = CTimeCycle::GetSkyTopBlue()/255.0f; + skyBot.red = CTimeCycle::GetSkyBottomRed()/255.0f; + skyBot.green = CTimeCycle::GetSkyBottomGreen()/255.0f; + skyBot.blue = CTimeCycle::GetSkyBottomBlue()/255.0f; + + d3ddevice->SetPixelShaderConstantF(PSLOC_skyTop, (float*)&skyTop, 1); + d3ddevice->SetPixelShaderConstantF(PSLOC_skyBot, (float*)&skyBot, 1); + + d3ddevice->SetVertexShaderConstantF(VSLOC_viewMat, (float*)&rw::engine->currentCamera->devView, 4); + + d3d::setTexture(1, EnvMapTex); + + InstanceData *inst = header->inst; + for(rw::uint32 i = 0; i < header->numMeshes; i++){ + Material *m = inst->material; + + SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255); + + float coef = 0.0f; + if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP){ + coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f; + if(gGlassCarsCheat) + coef = 1.0f; + } + d3ddevice->SetPixelShaderConstantF(PSLOC_shininess, (float*)&coef, 1); + + setMaterial(m->color, m->surfaceProps); + + if(m->texture) + d3d::setTexture(0, m->texture); + else + d3d::setTexture(0, gpWhiteTexture); + + drawInst(header, inst); + inst++; + } + + d3d::setTexture(1, nil); +} + static void *neoVehicle_VS; static void *neoVehicle_PS; @@ -89,8 +265,13 @@ vehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) using namespace rw::d3d9; // TODO: make this less of a kludge - if(VehiclePipeSwitch == VEHICLEPIPE_MATFX){ - matFXGlobals.pipelines[rw::platform]->render(atomic); + if(VehiclePipeSwitch == VEHICLEPIPE_PS2){ + leedsVehicleRenderCB(atomic, header); + // matFXGlobals.pipelines[rw::platform]->render(atomic); + return; + } + if(VehiclePipeSwitch == VEHICLEPIPE_MOBILE){ + leedsVehicleRenderCB_mobile(atomic, header); return; } @@ -146,15 +327,15 @@ vehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) void CreateVehiclePipe(void) { - if(CFileMgr::LoadFile("neo/carTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0) - printf("Error: couldn't open 'neo/carTweakingTable.dat'\n"); - else{ - char *fp = (char*)work_buff; - fp = ReadTweakValueTable(fp, Fresnel); - fp = ReadTweakValueTable(fp, Power); - fp = ReadTweakValueTable(fp, DiffColor); - fp = ReadTweakValueTable(fp, SpecColor); - } +// if(CFileMgr::LoadFile("neo/carTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0) +// printf("Error: couldn't open 'neo/carTweakingTable.dat'\n"); +// else{ +// char *fp = (char*)work_buff; +// fp = ReadTweakValueTable(fp, Fresnel); +// fp = ReadTweakValueTable(fp, Power); +// fp = ReadTweakValueTable(fp, DiffColor); +// fp = ReadTweakValueTable(fp, SpecColor); +// } #include "shaders/neoVehicle_VS.inc" neoVehicle_VS = rw::d3d::createVertexShader(neoVehicle_VS_cso); @@ -164,6 +345,26 @@ CreateVehiclePipe(void) neoVehicle_PS = rw::d3d::createPixelShader(neoVehicle_PS_cso); assert(neoVehicle_PS); +#include "shaders/leedsVehicle_VS.inc" + leedsVehicle_VS = rw::d3d::createVertexShader(leedsVehicle_VS_cso); + assert(leedsVehicle_VS); + +#include "shaders/leedsVehicle_mobile_VS.inc" + leedsVehicle_mobile_VS = rw::d3d::createVertexShader(leedsVehicle_mobile_VS_cso); + assert(leedsVehicle_mobile_VS); + +#include "shaders/leedsVehicle_blend_PS.inc" + leedsVehicle_blend_PS = rw::d3d::createPixelShader(leedsVehicle_blend_PS_cso); + assert(leedsVehicle_blend_PS); + +#include "shaders/leedsVehicle_add_PS.inc" + leedsVehicle_add_PS = rw::d3d::createPixelShader(leedsVehicle_add_PS_cso); + assert(leedsVehicle_add_PS); + +#include "shaders/leedsVehicle_mobile_PS.inc" + leedsVehicle_mobile_PS = rw::d3d::createPixelShader(leedsVehicle_mobile_PS_cso); + assert(leedsVehicle_mobile_PS); + rw::d3d9::ObjPipeline *pipe = rw::d3d9::ObjPipeline::create(); pipe->instanceCB = rw::d3d9::defaultInstanceCB; @@ -181,6 +382,15 @@ DestroyVehiclePipe(void) rw::d3d::destroyPixelShader(neoVehicle_PS); neoVehicle_PS = nil; + rw::d3d::destroyVertexShader(leedsVehicle_VS); + leedsVehicle_VS = nil; + + rw::d3d::destroyPixelShader(leedsVehicle_blend_PS); + leedsVehicle_blend_PS = nil; + + rw::d3d::destroyPixelShader(leedsVehicle_add_PS); + leedsVehicle_add_PS = nil; + ((rw::d3d9::ObjPipeline*)vehiclePipe)->destroy(); vehiclePipe = nil; } @@ -192,6 +402,7 @@ DestroyVehiclePipe(void) */ static void *leedsBuilding_VS; +static void *leedsBuilding_mobile_VS; static void *scale_PS; static void @@ -201,12 +412,14 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) using namespace rw::d3d; using namespace rw::d3d9; - int vsBits; setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride); setIndices(header->indexBuffer); setVertexDeclaration(header->vertexDeclaration); - setVertexShader(leedsBuilding_VS); + if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE) + setVertexShader(CustomPipes::leedsBuilding_mobile_VS); + else + setVertexShader(CustomPipes::leedsBuilding_VS); setPixelShader(scale_PS); uploadMatrices(atomic->getFrame()->getLTM()); @@ -229,7 +442,7 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) Material *m = inst->material; float cs = 1.0f; - if(m->texture) + if(WorldPipeSwitch == WORLDPIPE_PS2 && m->texture) cs = 255/128.0f; colorscale[0] = colorscale[1] = colorscale[2] = cs; d3ddevice->SetPixelShaderConstantF(PSLOC_colorscale, colorscale, 1); @@ -239,7 +452,7 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) else d3d::setTexture(0, gpWhiteTexture); // actually we don't even render this - setMaterial(m->color, m->surfaceProps, 0.5f); + setMaterial(m->color, m->surfaceProps, WorldPipeSwitch == WORLDPIPE_PS2 ? 0.5f : 1.0f); SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255); @@ -259,6 +472,9 @@ CreateWorldPipe(void) #include "shaders/leedsBuilding_VS.inc" leedsBuilding_VS = rw::d3d::createVertexShader(leedsBuilding_VS_cso); assert(leedsBuilding_VS); +#include "shaders/leedsBuilding_mobile_VS.inc" + leedsBuilding_mobile_VS = rw::d3d::createVertexShader(leedsBuilding_mobile_VS_cso); + assert(leedsBuilding_mobile_VS); #include "shaders/scale_PS.inc" scale_PS = rw::d3d::createPixelShader(scale_PS_cso); assert(scale_PS); @@ -275,6 +491,8 @@ DestroyWorldPipe(void) { rw::d3d::destroyVertexShader(leedsBuilding_VS); leedsBuilding_VS = nil; + rw::d3d::destroyVertexShader(leedsBuilding_mobile_VS); + leedsBuilding_mobile_VS = nil; rw::d3d::destroyPixelShader(scale_PS); scale_PS = nil; @@ -547,5 +765,202 @@ DestroyRimLightPipes(void) } +#ifdef NEW_RENDERER + +namespace WorldRender +{ + +struct BuildingInst +{ + rw::RawMatrix combinedMat; + rw::d3d9::InstanceDataHeader *instHeader; + uint8 fadeAlpha; + bool lighting; +}; +BuildingInst blendInsts[3][2000]; +int numBlendInsts[3]; + +static RwRGBAReal black; + +static void +SetMatrix(BuildingInst *building, rw::Matrix *worldMat) +{ + using namespace rw; + RawMatrix world, worldview; + Camera *cam = engine->currentCamera; + convMatrix(&world, worldMat); + RawMatrix::mult(&worldview, &world, &cam->devView); + RawMatrix::mult(&building->combinedMat, &worldview, &cam->devProj); +} + +static bool +IsTextureTransparent(RwTexture *tex) +{ + if(tex == nil || tex->raster == nil) + return false; + return PLUGINOFFSET(rw::d3d::D3dRaster, tex->raster, rw::d3d::nativeRasterOffset)->hasAlpha; +} + +// Render all opaque meshes and put atomics that needs blending +// into the deferred list. +void +AtomicFirstPass(RpAtomic *atomic, int pass) +{ + using namespace rw; + using namespace rw::d3d; + using namespace rw::d3d9; + + BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; + + atomic->getPipeline()->instance(atomic); + building->instHeader = (d3d9::InstanceDataHeader*)atomic->geometry->instData; + assert(building->instHeader != nil); + assert(building->instHeader->platform == PLATFORM_D3D9); + building->fadeAlpha = 255; + building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); + + bool setupDone = false; + bool defer = false; + SetMatrix(building, atomic->getFrame()->getLTM()); + + float colorscale[4]; + + InstanceData *inst = building->instHeader->inst; + for(rw::uint32 i = 0; i < building->instHeader->numMeshes; i++, inst++){ + Material *m = inst->material; + + if(m->texture == nil) + continue; + + if(inst->vertexAlpha || m->color.alpha != 255 || + IsTextureTransparent(m->texture)){ + defer = true; + continue; + } + + // alright we're rendering this atomic + if(!setupDone){ + setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride); + setIndices(building->instHeader->indexBuffer); + setVertexDeclaration(building->instHeader->vertexDeclaration); + if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE) + setVertexShader(CustomPipes::leedsBuilding_mobile_VS); + else + setVertexShader(CustomPipes::leedsBuilding_VS); + setPixelShader(CustomPipes::scale_PS); + d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4); + + RGBAf amb, emiss; + amb.red = CTimeCycle::GetAmbientRed(); + amb.green = CTimeCycle::GetAmbientGreen(); + amb.blue = CTimeCycle::GetAmbientBlue(); + amb.alpha = 1.0f; + emiss = pAmbient->color; + + d3ddevice->SetVertexShaderConstantF(CustomPipes::VSLOC_ambient, (float*)&amb, 1); + d3ddevice->SetVertexShaderConstantF(CustomPipes::VSLOC_emissive, (float*)&emiss, 1); + + colorscale[3] = 1.0f; + + setupDone = true; + } + + float cs = 1.0f; + if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture) + cs = 255/128.0f; + colorscale[0] = colorscale[1] = colorscale[2] = cs; + d3ddevice->SetPixelShaderConstantF(CustomPipes::PSLOC_colorscale, colorscale, 1); + + d3d::setTexture(0, m->texture); + + setMaterial(m->color, m->surfaceProps, 0.5f); + + drawInst(building->instHeader, inst); + } + if(defer) + numBlendInsts[pass]++; +} + +void +AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha) +{ + using namespace rw; + using namespace rw::d3d; + using namespace rw::d3d9; + + BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; + + atomic->getPipeline()->instance(atomic); + building->instHeader = (d3d9::InstanceDataHeader*)atomic->geometry->instData; + assert(building->instHeader != nil); + assert(building->instHeader->platform == PLATFORM_D3D9); + building->fadeAlpha = fadeAlpha; + building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); + SetMatrix(building, atomic->getFrame()->getLTM()); + numBlendInsts[pass]++; +} + +void +RenderBlendPass(int pass) +{ + using namespace rw; + using namespace rw::d3d; + using namespace rw::d3d9; + + if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE) + setVertexShader(CustomPipes::leedsBuilding_mobile_VS); + else + setVertexShader(CustomPipes::leedsBuilding_VS); + setPixelShader(CustomPipes::scale_PS); + + RGBAf amb, emiss; + amb.red = CTimeCycle::GetAmbientRed(); + amb.green = CTimeCycle::GetAmbientGreen(); + amb.blue = CTimeCycle::GetAmbientBlue(); + amb.alpha = 1.0f; + emiss = pAmbient->color; + + d3ddevice->SetVertexShaderConstantF(CustomPipes::VSLOC_ambient, (float*)&amb, 1); + d3ddevice->SetVertexShaderConstantF(CustomPipes::VSLOC_emissive, (float*)&emiss, 1); + + float colorscale[4]; + colorscale[3] = 1.0f; + + int i; + for(i = 0; i < numBlendInsts[pass]; i++){ + BuildingInst *building = &blendInsts[pass][i]; + + setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride); + setIndices(building->instHeader->indexBuffer); + setVertexDeclaration(building->instHeader->vertexDeclaration); + d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4); + + InstanceData *inst = building->instHeader->inst; + for(rw::uint32 j = 0; j < building->instHeader->numMeshes; j++, inst++){ + Material *m = inst->material; + if(m->texture == nil) + continue; + if(!inst->vertexAlpha && m->color.alpha == 255 && !IsTextureTransparent(m->texture) && building->fadeAlpha == 255) + continue; // already done this one + + float cs = 1.0f; + if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture) + cs = 255/128.0f; + colorscale[0] = colorscale[1] = colorscale[2] = cs; + d3ddevice->SetPixelShaderConstantF(CustomPipes::PSLOC_colorscale, colorscale, 1); + + d3d::setTexture(0, m->texture); + + rw::RGBA color = m->color; + color.alpha = (color.alpha * building->fadeAlpha)/255; + setMaterial(color, m->surfaceProps, 0.5f); + + drawInst(building->instHeader, inst); + } + } +} +} +#endif + #endif #endif diff --git a/src/extras/custompipes_gl.cpp b/src/extras/custompipes_gl.cpp index a222f5e9..eeb62b8d 100644 --- a/src/extras/custompipes_gl.cpp +++ b/src/extras/custompipes_gl.cpp @@ -3,6 +3,8 @@ #ifdef RW_OPENGL #ifdef EXTENDED_PIPELINES +#include "rpmatfx.h" + #include "main.h" #include "RwHelper.h" #include "Lights.h" @@ -37,14 +39,204 @@ static int32 u_amb; static int32 u_emiss; static int32 u_colorscale; +static int32 u_texMatrix; +static int32 u_fxparams; + +static int32 u_skyTop; +static int32 u_skyBot; + #define U(i) currentShader->uniformLocations[i] /* - * Neo Vehicle pipe + * Leeds & Neo Vehicle pipe */ +rw::gl3::Shader *leedsVehicleShader_add; +rw::gl3::Shader *leedsVehicleShader_blend; +rw::gl3::Shader *leedsVehicleShader_mobile; + rw::gl3::Shader *neoVehicleShader; +static rw::RawMatrix normal2texcoord_flipU = { + { -0.5f, 0.0f, 0.0f }, 0.0f, + { 0.0f, -0.5f, 0.0f }, 0.0f, + { 0.0f, 0.0f, 1.0f }, 0.0f, + { 0.5f, 0.5f, 0.0f }, 1.0f +}; + +static void +uploadEnvMatrix(rw::Frame *frame) +{ + using namespace rw; + using namespace rw::gl3; + + Matrix invMat; + if(frame == nil) + frame = engine->currentCamera->getFrame(); + + // cache the matrix across multiple meshes + static RawMatrix envMtx; +// can't do it, frame matrix may change +// if(frame != lastEnvFrame){ +// lastEnvFrame = frame; + { + + Matrix tmp = *frame->getLTM(); + // Now the weird part: we remove the camera pitch + tmp.at.z = 0.0f; + tmp.at = normalize(tmp.at); + tmp.right.x = -tmp.at.y; + tmp.right.y = tmp.at.x; + tmp.right.z = 0.0f;; + tmp.up.set(0.0f, 0.0f, 1.0f); + tmp.pos.set(0.0f, 0.0f, 0.0f); + tmp.flags = Matrix::TYPEORTHONORMAL; + + RawMatrix invMtx; + Matrix::invert(&invMat, &tmp); + convMatrix(&invMtx, &invMat); + RawMatrix::mult(&envMtx, &invMtx, &normal2texcoord_flipU); + } + glUniformMatrix4fv(U(u_texMatrix), 1, GL_FALSE, (float*)&envMtx); +} + +static void +leedsVehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) +{ + using namespace rw; + using namespace rw::gl3; + + Material *m; + + setWorldMatrix(atomic->getFrame()->getLTM()); + lightingCB(atomic); + +#ifdef RW_GL_USE_VAOS + glBindVertexArray(header->vao); +#else + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo); + glBindBuffer(GL_ARRAY_BUFFER, header->vbo); + setAttribPointers(header->attribDesc, header->numAttribs); +#endif + + InstanceData *inst = header->inst; + rw::int32 n = header->numMeshes; + + if(gGlassCarsCheat) + leedsVehicleShader_blend->use(); + else + leedsVehicleShader_add->use(); + + setTexture(1, EnvMapTex); + uploadEnvMatrix(nil); + + SetRenderState(SRCBLEND, BLENDONE); + + while(n--){ + m = inst->material; + + rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF); + + float coef = 0.0f; + if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP){ + coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f; + if(gGlassCarsCheat) + coef = 1.0f; + } + glUniform1f(U(u_fxparams), coef); + + setMaterial(m->color, m->surfaceProps); + + setTexture(0, m->texture); + + drawInst(header, inst); + inst++; + } + + setTexture(1, nil); + + SetRenderState(SRCBLEND, BLENDSRCALPHA); + +#ifndef RW_GL_USE_VAOS + disableAttribPointers(header->attribDesc, header->numAttribs); +#endif +} + +static void +leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) +{ + using namespace rw; + using namespace rw::gl3; + + Material *m; + + setWorldMatrix(atomic->getFrame()->getLTM()); + lightingCB(atomic); + +#ifdef RW_GL_USE_VAOS + glBindVertexArray(header->vao); +#else + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo); + glBindBuffer(GL_ARRAY_BUFFER, header->vbo); + setAttribPointers(header->attribDesc, header->numAttribs); +#endif + + InstanceData *inst = header->inst; + rw::int32 n = header->numMeshes; + + leedsVehicleShader_mobile->use(); + + RGBAf amb, emiss; + amb.red = CTimeCycle::GetAmbientRed(); + amb.green = CTimeCycle::GetAmbientGreen(); + amb.blue = CTimeCycle::GetAmbientBlue(); + amb.alpha = 1.0f; + emiss = pAmbient->color; + + glUniform4fv(U(u_amb), 1, (float*)&amb); + glUniform4fv(U(u_emiss), 1, (float*)&emiss); + + RGBAf skyTop, skyBot; + skyTop.red = CTimeCycle::GetSkyTopRed()/255.0f; + skyTop.green = CTimeCycle::GetSkyTopGreen()/255.0f; + skyTop.blue = CTimeCycle::GetSkyTopBlue()/255.0f; + skyBot.red = CTimeCycle::GetSkyBottomRed()/255.0f; + skyBot.green = CTimeCycle::GetSkyBottomGreen()/255.0f; + skyBot.blue = CTimeCycle::GetSkyBottomBlue()/255.0f; + + glUniform3fv(U(u_skyTop), 1, (float*)&skyTop); + glUniform3fv(U(u_skyBot), 1, (float*)&skyBot); + + setTexture(1, EnvMapTex); + + while(n--){ + m = inst->material; + + rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF); + + float coef = 0.0f; + if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP){ + coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f; + if(gGlassCarsCheat) + coef = 1.0f; + } + glUniform1f(U(u_fxparams), coef); + + setMaterial(m->color, m->surfaceProps); + + setTexture(0, m->texture); + + drawInst(header, inst); + inst++; + } + + setTexture(1, nil); + +#ifndef RW_GL_USE_VAOS + disableAttribPointers(header->attribDesc, header->numAttribs); +#endif +} + static void uploadSpecLights(void) { @@ -84,8 +276,13 @@ vehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) using namespace rw::gl3; // TODO: make this less of a kludge - if(VehiclePipeSwitch == VEHICLEPIPE_MATFX){ - matFXGlobals.pipelines[rw::platform]->render(atomic); + if(VehiclePipeSwitch == VEHICLEPIPE_PS2){ + leedsVehicleRenderCB(atomic, header); +// matFXGlobals.pipelines[rw::platform]->render(atomic); + return; + } + if(VehiclePipeSwitch == VEHICLEPIPE_MOBILE){ + leedsVehicleRenderCB_mobile(atomic, header); return; } @@ -152,15 +349,15 @@ CreateVehiclePipe(void) using namespace rw; using namespace rw::gl3; - if(CFileMgr::LoadFile("neo/carTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0) - printf("Error: couldn't open 'neo/carTweakingTable.dat'\n"); - else{ - char *fp = (char*)work_buff; - fp = ReadTweakValueTable(fp, Fresnel); - fp = ReadTweakValueTable(fp, Power); - fp = ReadTweakValueTable(fp, DiffColor); - fp = ReadTweakValueTable(fp, SpecColor); - } +// if(CFileMgr::LoadFile("neo/carTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0) +// printf("Error: couldn't open 'neo/carTweakingTable.dat'\n"); +// else{ +// char *fp = (char*)work_buff; +// fp = ReadTweakValueTable(fp, Fresnel); +// fp = ReadTweakValueTable(fp, Power); +// fp = ReadTweakValueTable(fp, DiffColor); +// fp = ReadTweakValueTable(fp, SpecColor); +// } { @@ -172,6 +369,28 @@ CreateVehiclePipe(void) assert(neoVehicleShader); } + { +#include "shaders/leedsVehicle_add_gl.inc" +#include "shaders/leedsVehicle_blend_gl.inc" +#include "shaders/leedsVehicle_vs_gl.inc" + const char *vs[] = { shaderDecl, header_vert_src, leedsVehicle_vert_src, nil }; + const char *fs_add[] = { shaderDecl, header_frag_src, leedsVehicle_add_frag_src, nil }; + const char *fs_blend[] = { shaderDecl, header_frag_src, leedsVehicle_blend_frag_src, nil }; + leedsVehicleShader_add = Shader::create(vs, fs_add); + assert(leedsVehicleShader_add); + leedsVehicleShader_blend = Shader::create(vs, fs_blend); + assert(leedsVehicleShader_blend); + } + + { +#include "shaders/leedsVehicle_mobile_fs_gl.inc" +#include "shaders/leedsVehicle_mobile_vs_gl.inc" + const char *vs[] = { shaderDecl, header_vert_src, leedsVehicle_mobile_vert_src, nil }; + const char *fs[] = { shaderDecl, header_frag_src, leedsVehicle_mobile_frag_src, nil }; + leedsVehicleShader_mobile = Shader::create(vs, fs); + assert(leedsVehicleShader_mobile); + } + rw::gl3::ObjPipeline *pipe = rw::gl3::ObjPipeline::create(); pipe->instanceCB = rw::gl3::defaultInstanceCB; @@ -186,6 +405,15 @@ DestroyVehiclePipe(void) neoVehicleShader->destroy(); neoVehicleShader = nil; + leedsVehicleShader_add->destroy(); + leedsVehicleShader_add = nil; + + leedsVehicleShader_blend->destroy(); + leedsVehicleShader_blend = nil; + + leedsVehicleShader_mobile->destroy(); + leedsVehicleShader_mobile = nil; + ((rw::gl3::ObjPipeline*)vehiclePipe)->destroy(); vehiclePipe = nil; } @@ -197,6 +425,7 @@ DestroyVehiclePipe(void) */ rw::gl3::Shader *leedsWorldShader; +rw::gl3::Shader *leedsWorldShader_mobile; static void worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -219,7 +448,10 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) InstanceData *inst = header->inst; rw::int32 n = header->numMeshes; - leedsWorldShader->use(); + if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE) + CustomPipes::leedsWorldShader_mobile->use(); + else + CustomPipes::leedsWorldShader->use(); RGBAf amb, emiss; amb.red = CTimeCycle::GetAmbientRed(); @@ -238,14 +470,14 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) m = inst->material; float cs = 1.0f; - if(m->texture) + if(WorldPipeSwitch == WORLDPIPE_PS2 && m->texture) cs = 255/128.0f; colorscale[0] = colorscale[1] = colorscale[2] = cs; glUniform4fv(U(u_colorscale), 1, colorscale); setTexture(0, m->texture); - setMaterial(m->color, m->surfaceProps); + setMaterial(m->color, m->surfaceProps, 0.5f); rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF); @@ -271,10 +503,14 @@ CreateWorldPipe(void) { #include "shaders/scale_fs_gl.inc" #include "shaders/leedsBuilding_vs_gl.inc" +#include "shaders/leedsBuilding_mobile_vs_gl.inc" const char *vs[] = { shaderDecl, header_vert_src, leedsBuilding_vert_src, nil }; + const char *vs_mobile[] = { shaderDecl, header_vert_src, leedsBuilding_mobile_vert_src, nil }; const char *fs[] = { shaderDecl, header_frag_src, scale_frag_src, nil }; leedsWorldShader = Shader::create(vs, fs); assert(leedsWorldShader); + leedsWorldShader_mobile = Shader::create(vs_mobile, fs); + assert(leedsWorldShader_mobile); } @@ -290,6 +526,8 @@ DestroyWorldPipe(void) { leedsWorldShader->destroy(); leedsWorldShader = nil; + leedsWorldShader_mobile->destroy(); + leedsWorldShader_mobile = nil; ((rw::gl3::ObjPipeline*)worldPipe)->destroy(); worldPipe = nil; @@ -611,10 +849,211 @@ CustomPipeRegisterGL(void) u_amb = rw::gl3::registerUniform("u_amb"); u_emiss = rw::gl3::registerUniform("u_emiss"); u_colorscale = rw::gl3::registerUniform("u_colorscale"); + + u_texMatrix = rw::gl3::registerUniform("u_texMatrix"); + u_fxparams = rw::gl3::registerUniform("u_fxparams"); + + u_skyTop = rw::gl3::registerUniform("u_skyTop"); + u_skyBot = rw::gl3::registerUniform("u_skyBot"); +} + + +} + +#ifdef NEW_RENDERER + +namespace WorldRender +{ + +struct BuildingInst +{ + rw::Matrix matrix; + rw::gl3::InstanceDataHeader *instHeader; + uint8 fadeAlpha; + bool lighting; +}; +BuildingInst blendInsts[3][2000]; +int numBlendInsts[3]; + +static RwRGBAReal black; + +static bool +IsTextureTransparent(RwTexture *tex) +{ + if(tex == nil || tex->raster == nil) + return false; + return PLUGINOFFSET(rw::gl3::Gl3Raster, tex->raster, rw::gl3::nativeRasterOffset)->hasAlpha; +} + +// Render all opaque meshes and put atomics that needs blending +// into the deferred list. +void +AtomicFirstPass(RpAtomic *atomic, int pass) +{ + using namespace rw; + using namespace rw::gl3; + + BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; + + atomic->getPipeline()->instance(atomic); + building->instHeader = (gl3::InstanceDataHeader*)atomic->geometry->instData; + assert(building->instHeader != nil); + assert(building->instHeader->platform == PLATFORM_GL3); + building->fadeAlpha = 255; + building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); + + bool setupDone = false; + bool defer = false; + building->matrix = *atomic->getFrame()->getLTM(); + + float colorscale[4]; + + InstanceData *inst = building->instHeader->inst; + for(rw::uint32 i = 0; i < building->instHeader->numMeshes; i++, inst++){ + Material *m = inst->material; + + if(m->texture == nil) + continue; + + if(inst->vertexAlpha || m->color.alpha != 255 || + IsTextureTransparent(m->texture)){ + defer = true; + continue; + } + + // alright we're rendering this atomic + if(!setupDone){ + if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE) + CustomPipes::leedsWorldShader_mobile->use(); + else + CustomPipes::leedsWorldShader->use(); + setWorldMatrix(&building->matrix); +#ifdef RW_GL_USE_VAOS + glBindVertexArray(building->instHeader->vao); +#else + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo); + glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo); + setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); +#endif + + RGBAf amb, emiss; + amb.red = CTimeCycle::GetAmbientRed(); + amb.green = CTimeCycle::GetAmbientGreen(); + amb.blue = CTimeCycle::GetAmbientBlue(); + amb.alpha = 1.0f; + emiss = pAmbient->color; + + glUniform4fv(U(CustomPipes::u_amb), 1, (float*)&amb); + glUniform4fv(U(CustomPipes::u_emiss), 1, (float*)&emiss); + + colorscale[3] = 1.0f; + + setupDone = true; + } + + setMaterial(m->color, m->surfaceProps, 0.5f); + + float cs = 1.0f; + if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture) + cs = 255/128.0f; + colorscale[0] = colorscale[1] = colorscale[2] = cs; + glUniform4fv(U(CustomPipes::u_colorscale), 1, colorscale); + + setTexture(0, m->texture); + + drawInst(building->instHeader, inst); + } +#ifndef RW_GL_USE_VAOS + disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); +#endif + if(defer) + numBlendInsts[pass]++; } +void +AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha) +{ + using namespace rw; + using namespace rw::gl3; + + BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; + atomic->getPipeline()->instance(atomic); + building->instHeader = (gl3::InstanceDataHeader*)atomic->geometry->instData; + assert(building->instHeader != nil); + assert(building->instHeader->platform == PLATFORM_GL3); + building->fadeAlpha = fadeAlpha; + building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); + building->matrix = *atomic->getFrame()->getLTM(); + numBlendInsts[pass]++; } +void +RenderBlendPass(int pass) +{ + using namespace rw; + using namespace rw::gl3; + + if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE) + CustomPipes::leedsWorldShader_mobile->use(); + else + CustomPipes::leedsWorldShader->use(); + + RGBAf amb, emiss; + amb.red = CTimeCycle::GetAmbientRed(); + amb.green = CTimeCycle::GetAmbientGreen(); + amb.blue = CTimeCycle::GetAmbientBlue(); + amb.alpha = 1.0f; + emiss = pAmbient->color; + + glUniform4fv(U(CustomPipes::u_amb), 1, (float*)&amb); + glUniform4fv(U(CustomPipes::u_emiss), 1, (float*)&emiss); + + float colorscale[4]; + colorscale[3] = 1.0f; + + int i; + for(i = 0; i < numBlendInsts[pass]; i++){ + BuildingInst *building = &blendInsts[pass][i]; + +#ifdef RW_GL_USE_VAOS + glBindVertexArray(building->instHeader->vao); +#else + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo); + glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo); + setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); +#endif + setWorldMatrix(&building->matrix); + + InstanceData *inst = building->instHeader->inst; + for(rw::uint32 j = 0; j < building->instHeader->numMeshes; j++, inst++){ + Material *m = inst->material; + if(m->texture == nil) + continue; + if(!inst->vertexAlpha && m->color.alpha == 255 && !IsTextureTransparent(m->texture) && building->fadeAlpha == 255) + continue; // already done this one + + rw::RGBA color = m->color; + color.alpha = (color.alpha * building->fadeAlpha)/255; + setMaterial(color, m->surfaceProps, 0.5f); + + float cs = 1.0f; + if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture) + cs = 255/128.0f; + colorscale[0] = colorscale[1] = colorscale[2] = cs; + glUniform4fv(U(CustomPipes::u_colorscale), 1, colorscale); + + setTexture(0, m->texture); + + drawInst(building->instHeader, inst); + } +#ifndef RW_GL_USE_VAOS + disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); +#endif + } +} +} +#endif + #endif #endif diff --git a/src/extras/postfx.h b/src/extras/postfx.h index db702bf3..9538f8e1 100644 --- a/src/extras/postfx.h +++ b/src/extras/postfx.h @@ -7,9 +7,13 @@ class CPostFX public: enum { POSTFX_OFF, - POSTFX_SIMPLE, +// POSTFX_SIMPLE, POSTFX_NORMAL, - POSTFX_MOBILE +// POSTFX_MOBILE + + // not so sensible for the moment + POSTFX_SIMPLE = -1, + POSTFX_MOBILE = -2 }; static RwRaster *pFrontBuffer; static RwRaster *pBackBuffer; diff --git a/src/extras/shaders/Makefile b/src/extras/shaders/Makefile index 355d71af..393ab660 100644 --- a/src/extras/shaders/Makefile +++ b/src/extras/shaders/Makefile @@ -4,7 +4,9 @@ all: im2d_gl.inc simple_fs_gl.inc default_UV2_gl.inc \ neoWorldVC_fs_gl.inc neoGloss_vs_gl.inc neoGloss_fs_gl.inc \ neoVehicle_vs_gl.inc neoVehicle_fs_gl.inc \ im2d_UV2_gl.inc screenDroplet_fs_gl.inc \ - leedsBuilding_vs_gl.inc scale_fs_gl.inc + leedsBuilding_vs_gl.inc leedsBuilding_mobile_vs_gl.inc scale_fs_gl.inc \ + leedsVehicle_vs_gl.inc leedsVehicle_add_gl.inc leedsVehicle_blend_gl.inc \ + leedsVehicle_mobile_vs_gl.inc leedsVehicle_mobile_fs_gl.inc im2d_gl.inc: im2d.vert (echo 'const char *im2d_vert_src =';\ @@ -83,7 +85,37 @@ leedsBuilding_vs_gl.inc: leedsBuilding.vert sed 's/..*/"&\\n"/' leedsBuilding.vert;\ echo ';') >leedsBuilding_vs_gl.inc +leedsBuilding_mobile_vs_gl.inc: leedsBuilding_mobile.vert + (echo 'const char *leedsBuilding_mobile_vert_src =';\ + sed 's/..*/"&\\n"/' leedsBuilding_mobile.vert;\ + echo ';') >leedsBuilding_mobile_vs_gl.inc + scale_fs_gl.inc: scale.frag (echo 'const char *scale_frag_src =';\ sed 's/..*/"&\\n"/' scale.frag;\ echo ';') >scale_fs_gl.inc + +leedsVehicle_vs_gl.inc: leedsVehicle.vert + (echo 'const char *leedsVehicle_vert_src =';\ + sed 's/..*/"&\\n"/' leedsVehicle.vert;\ + echo ';') >leedsVehicle_vs_gl.inc + +leedsVehicle_add_gl.inc: leedsVehicle_add.frag + (echo 'const char *leedsVehicle_add_frag_src =';\ + sed 's/..*/"&\\n"/' leedsVehicle_add.frag;\ + echo ';') >leedsVehicle_add_gl.inc + +leedsVehicle_blend_gl.inc: leedsVehicle_blend.frag + (echo 'const char *leedsVehicle_blend_frag_src =';\ + sed 's/..*/"&\\n"/' leedsVehicle_blend.frag;\ + echo ';') >leedsVehicle_blend_gl.inc + +leedsVehicle_mobile_vs_gl.inc: leedsVehicle_mobile.vert + (echo 'const char *leedsVehicle_mobile_vert_src =';\ + sed 's/..*/"&\\n"/' leedsVehicle_mobile.vert;\ + echo ';') >leedsVehicle_mobile_vs_gl.inc + +leedsVehicle_mobile_fs_gl.inc: leedsVehicle_mobile.frag + (echo 'const char *leedsVehicle_mobile_frag_src =';\ + sed 's/..*/"&\\n"/' leedsVehicle_mobile.frag;\ + echo ';') >leedsVehicle_mobile_fs_gl.inc diff --git a/src/extras/shaders/leedsBuilding.vert b/src/extras/shaders/leedsBuilding.vert index 67dd7938..766cd081 100644 --- a/src/extras/shaders/leedsBuilding.vert +++ b/src/extras/shaders/leedsBuilding.vert @@ -1,6 +1,8 @@ uniform vec4 u_amb; uniform vec4 u_emiss; +#define surfEmissive (u_surfProps.w) + VSIN(ATTRIB_POS) vec3 in_pos; VSOUT vec4 v_color; @@ -18,7 +20,7 @@ main(void) v_color = in_color; v_color.rgb *= u_amb.rgb; - v_color.rgb += u_emiss.rgb; + v_color.rgb += u_emiss.rgb*surfEmissive; v_color = clamp(v_color, 0.0, 1.0); v_color.a *= u_matColor.a; diff --git a/src/extras/shaders/leedsBuilding_VS.cso b/src/extras/shaders/leedsBuilding_VS.cso Binary files differindex 1ec92fb1..6720364d 100644 --- a/src/extras/shaders/leedsBuilding_VS.cso +++ b/src/extras/shaders/leedsBuilding_VS.cso diff --git a/src/extras/shaders/leedsBuilding_VS.hlsl b/src/extras/shaders/leedsBuilding_VS.hlsl index dd3592e9..1ed939cc 100644 --- a/src/extras/shaders/leedsBuilding_VS.hlsl +++ b/src/extras/shaders/leedsBuilding_VS.hlsl @@ -1,5 +1,7 @@ #include "standardConstants.h" +#define surfEmissive (surfProps.w) + float4 emissive : register(c41); float4 ambient : register(c42); @@ -8,14 +10,12 @@ struct VS_in float4 Position : POSITION; float3 Normal : NORMAL; float2 TexCoord : TEXCOORD0; - float2 TexCoord1 : TEXCOORD1; float4 Prelight : COLOR0; }; struct VS_out { float4 Position : POSITION; float3 TexCoord0 : TEXCOORD0; // also fog - float2 TexCoord1 : TEXCOORD1; float4 Color : COLOR0; }; @@ -29,11 +29,10 @@ VS_out main(in VS_in input) float3 Normal = mul(normalMat, input.Normal); output.TexCoord0.xy = input.TexCoord; - output.TexCoord1.xy = input.TexCoord1; output.Color = input.Prelight; output.Color.rgb *= ambient.rgb; - output.Color.rgb += emissive.rgb; + output.Color.rgb += emissive.rgb*surfEmissive; output.Color = clamp(output.Color, 0.0, 1.0); output.Color.a *= matCol.a; diff --git a/src/extras/shaders/leedsBuilding_VS.inc b/src/extras/shaders/leedsBuilding_VS.inc index d24f45b0..490a8c01 100644 --- a/src/extras/shaders/leedsBuilding_VS.inc +++ b/src/extras/shaders/leedsBuilding_VS.inc @@ -1,37 +1,40 @@ static unsigned char leedsBuilding_VS_cso[] = { - 0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x42, 0x00, 0x43, 0x54, 0x41, 0x42, - 0x1c, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff, - 0x05, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0xcc, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x2a, 0x00, - 0x01, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x98, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, - 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x29, 0x00, 0x01, 0x00, 0xa6, 0x00, 0x88, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0e, 0x00, - 0x01, 0x00, 0x3a, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc5, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x32, 0x00, - 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x6d, 0x62, 0x69, - 0x65, 0x6e, 0x74, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6d, 0x62, - 0x69, 0x6e, 0x65, 0x64, 0x4d, 0x61, 0x74, 0x00, 0x03, 0x00, 0x03, 0x00, - 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x65, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x76, 0x65, 0x00, 0x66, 0x6f, 0x67, - 0x44, 0x61, 0x74, 0x61, 0x00, 0x6d, 0x61, 0x74, 0x43, 0x6f, 0x6c, 0x00, - 0x76, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, - 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, - 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, - 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, - 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05, - 0x04, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, - 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, - 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, - 0x05, 0x00, 0x01, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, - 0x0a, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, - 0x00, 0x00, 0x07, 0x80, 0x2a, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, - 0x00, 0x00, 0x07, 0x80, 0x03, 0x00, 0xe4, 0x90, 0x00, 0x00, 0xe4, 0x80, - 0x29, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, - 0x03, 0x00, 0xff, 0x90, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, + 0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x4a, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff, + 0x06, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0xea, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x02, 0x00, 0x2a, 0x00, + 0x01, 0x00, 0xaa, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xac, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, + 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x29, 0x00, 0x01, 0x00, 0xa6, 0x00, 0x9c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0e, 0x00, + 0x01, 0x00, 0x3a, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xd9, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x32, 0x00, + 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x0d, 0x00, 0x01, 0x00, 0x36, 0x00, 0x9c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x61, 0x6d, 0x62, 0x69, 0x65, 0x6e, 0x74, 0x00, + 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x65, 0x64, + 0x4d, 0x61, 0x74, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x76, 0x65, 0x00, 0x66, 0x6f, 0x67, 0x44, 0x61, 0x74, 0x61, + 0x00, 0x6d, 0x61, 0x74, 0x43, 0x6f, 0x6c, 0x00, 0x73, 0x75, 0x72, 0x66, + 0x50, 0x72, 0x6f, 0x70, 0x73, 0x00, 0x76, 0x73, 0x5f, 0x32, 0x5f, 0x30, + 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, + 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, + 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, + 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, + 0x31, 0x00, 0xab, 0xab, 0x51, 0x00, 0x00, 0x05, 0x04, 0x00, 0x0f, 0xa0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, + 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, + 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, + 0x02, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0x80, + 0x29, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x0d, 0x00, 0xff, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x90, 0x2a, 0x00, 0xe4, 0xa0, + 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, + 0x02, 0x00, 0xff, 0x90, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x55, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0xd0, 0x00, 0x00, 0xff, 0x80, @@ -50,6 +53,5 @@ static unsigned char leedsBuilding_VS_cso[] = { 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0xe0, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90, - 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00 }; diff --git a/src/extras/shaders/leedsBuilding_mobile.vert b/src/extras/shaders/leedsBuilding_mobile.vert new file mode 100644 index 00000000..f06628ee --- /dev/null +++ b/src/extras/shaders/leedsBuilding_mobile.vert @@ -0,0 +1,52 @@ +uniform vec4 u_amb; +uniform vec4 u_emiss; + +#define surfEmissive (u_surfProps.w) + +#define vertContrast (1.5) +#define vertBrightness (0.25) +#define ambientContrast (1.2) +#define ambientBrightness (0.1) +#define emissiveContrast (1.25) +#define emissiveBrightness (0.05) + + +VSIN(ATTRIB_POS) vec3 in_pos; + +VSOUT vec4 v_color; +VSOUT vec2 v_tex0; +VSOUT float v_fog; + +void +main(void) +{ + vec4 Vertex = u_world * vec4(in_pos, 1.0); + gl_Position = u_proj * u_view * Vertex; + vec3 Normal = mat3(u_world) * in_normal; + + v_tex0 = in_tex0; + + vec4 vertCol = in_color; + vec4 amb = u_amb; + vec4 emiss = u_emiss; + + vertCol.xyz = ((vertCol.xyz - 0.5) * max(vertContrast, 0.0)) + 0.5; + vertCol.xyz += vertBrightness; + vertCol.xyz = max(vertCol.xyz, vec3(0.0,0.0,0.0)); + + amb.xyz = ((amb.xyz - 0.5) * max(ambientContrast, 0.0)) + 0.5; + amb.xyz += ambientBrightness; + amb.xyz = max(amb.xyz, vec3(0.0,0.0,0.0)); + + emiss.xyz = ((emiss.xyz - 0.5) * max(emissiveContrast, 0.0)) + 0.5; + emiss.xyz += emissiveBrightness; + emiss.xyz = max(emiss.xyz, vec3(0.0,0.0,0.0)); + v_color.xyz = emiss.xyz + (vertCol.xyz * amb.xyz); + v_color.w = vertCol.w; + + + v_color = clamp(v_color, 0.0, 1.0); + v_color.a *= u_matColor.a; + + v_fog = DoFog(gl_Position.w); +} diff --git a/src/extras/shaders/leedsBuilding_mobile_VS.cso b/src/extras/shaders/leedsBuilding_mobile_VS.cso Binary files differnew file mode 100644 index 00000000..c3ac2b9b --- /dev/null +++ b/src/extras/shaders/leedsBuilding_mobile_VS.cso diff --git a/src/extras/shaders/leedsBuilding_mobile_VS.hlsl b/src/extras/shaders/leedsBuilding_mobile_VS.hlsl new file mode 100644 index 00000000..23accf64 --- /dev/null +++ b/src/extras/shaders/leedsBuilding_mobile_VS.hlsl @@ -0,0 +1,64 @@ +#include "standardConstants.h" + +#define surfEmissive (surfProps.w) + +#define vertContrast (1.5) +#define vertBrightness (0.25) +#define ambientContrast (1.2) +#define ambientBrightness (0.1) +#define emissiveContrast (1.25) +#define emissiveBrightness (0.05) + +float4 emissive : register(c41); +float4 ambient : register(c42); + +struct VS_in +{ + float4 Position : POSITION; + float3 Normal : NORMAL; + float2 TexCoord : TEXCOORD0; + float4 Prelight : COLOR0; +}; + +struct VS_out { + float4 Position : POSITION; + float3 TexCoord0 : TEXCOORD0; // also fog + float4 Color : COLOR0; +}; + + +VS_out main(in VS_in input) +{ + VS_out output; + + output.Position = mul(combinedMat, input.Position); + float3 Vertex = mul(worldMat, input.Position).xyz; + float3 Normal = mul(normalMat, input.Normal); + + output.TexCoord0.xy = input.TexCoord; + + float4 vertCol = input.Prelight; + float4 amb = ambient; + float4 emiss = emissive; + + vertCol.xyz = ((vertCol.xyz - 0.5) * max(vertContrast, 0.0)) + 0.5; + vertCol.xyz += vertBrightness; + vertCol.xyz = max(vertCol.xyz, float3(0.0,0.0,0.0)); + + amb.xyz = ((amb.xyz - 0.5) * max(ambientContrast, 0.0)) + 0.5; + amb.xyz += ambientBrightness; + amb.xyz = max(amb.xyz, float3(0.0,0.0,0.0)); + + emiss.xyz = ((emiss.xyz - 0.5) * max(emissiveContrast, 0.0)) + 0.5; + emiss.xyz += emissiveBrightness; + emiss.xyz = max(emiss.xyz, float3(0.0,0.0,0.0)); + output.Color.xyz = emiss.xyz + (vertCol.xyz * amb.xyz); + output.Color.w = vertCol.w; + + output.Color = clamp(output.Color, 0.0, 1.0); + output.Color.a *= matCol.a; + + output.TexCoord0.z = clamp((output.Position.w - fogEnd)*fogRange, fogDisable, 1.0); + + return output; +} diff --git a/src/extras/shaders/leedsBuilding_mobile_VS.inc b/src/extras/shaders/leedsBuilding_mobile_VS.inc new file mode 100644 index 00000000..1433ca3f --- /dev/null +++ b/src/extras/shaders/leedsBuilding_mobile_VS.inc @@ -0,0 +1,70 @@ +static unsigned char leedsBuilding_mobile_VS_cso[] = { + 0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x42, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff, + 0x05, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0xcc, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x2a, 0x00, + 0x01, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x98, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, + 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x29, 0x00, 0x01, 0x00, 0xa6, 0x00, 0x88, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0e, 0x00, + 0x01, 0x00, 0x3a, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc5, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x32, 0x00, + 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x6d, 0x62, 0x69, + 0x65, 0x6e, 0x74, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6d, 0x62, + 0x69, 0x6e, 0x65, 0x64, 0x4d, 0x61, 0x74, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x65, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x76, 0x65, 0x00, 0x66, 0x6f, 0x67, + 0x44, 0x61, 0x74, 0x61, 0x00, 0x6d, 0x61, 0x74, 0x43, 0x6f, 0x6c, 0x00, + 0x76, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, + 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, + 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, + 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05, + 0x04, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0xc0, 0x3f, + 0x00, 0x00, 0x40, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, + 0x05, 0x00, 0x0f, 0xa0, 0x9a, 0x99, 0x99, 0x3f, 0x9a, 0x99, 0x19, 0x3f, + 0x00, 0x00, 0xa0, 0x3f, 0xcd, 0xcc, 0x0c, 0x3f, 0x51, 0x00, 0x00, 0x05, + 0x06, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, + 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, + 0x0a, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x02, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x90, 0x04, 0x00, 0x00, 0xa0, + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, + 0x04, 0x00, 0x55, 0xa0, 0x04, 0x00, 0xaa, 0xa0, 0x0b, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xff, 0xa0, + 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x04, 0x00, 0x00, 0xa0, + 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0e, 0x80, 0x01, 0x00, 0x00, 0x80, + 0x2a, 0x00, 0x90, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0e, 0x80, + 0x01, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x55, 0xa0, + 0x0b, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0e, 0x80, 0x01, 0x00, 0xe4, 0x80, + 0x04, 0x00, 0xff, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, + 0x01, 0x00, 0x00, 0x80, 0x29, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x05, 0x00, 0xaa, 0xa0, + 0x05, 0x00, 0xff, 0xa0, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, + 0x02, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xff, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xf9, 0x80, + 0x02, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, + 0x02, 0x00, 0xff, 0x90, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x06, 0x00, 0x00, 0xa0, + 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0xd0, 0x00, 0x00, 0xff, 0x80, + 0x0c, 0x00, 0xff, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0xd0, + 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, + 0x00, 0x00, 0x55, 0x90, 0x01, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, + 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, + 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x03, 0x00, 0xe4, 0xa0, + 0x00, 0x00, 0xff, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, + 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0xff, 0x80, 0x0e, 0x00, 0x55, 0xa1, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0xe4, 0x80, + 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, + 0x0e, 0x00, 0xaa, 0xa0, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, + 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x04, 0xe0, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0xa0, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90, + 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/leedsBuilding_mobile_vs_gl.inc b/src/extras/shaders/leedsBuilding_mobile_vs_gl.inc new file mode 100644 index 00000000..56bb8a80 --- /dev/null +++ b/src/extras/shaders/leedsBuilding_mobile_vs_gl.inc @@ -0,0 +1,54 @@ +const char *leedsBuilding_mobile_vert_src = +"uniform vec4 u_amb;\n" +"uniform vec4 u_emiss;\n" + +"#define surfEmissive (u_surfProps.w)\n" + +"#define vertContrast (1.5)\n" +"#define vertBrightness (0.25)\n" +"#define ambientContrast (1.2)\n" +"#define ambientBrightness (0.1)\n" +"#define emissiveContrast (1.25)\n" +"#define emissiveBrightness (0.05)\n" + + +"VSIN(ATTRIB_POS) vec3 in_pos;\n" + +"VSOUT vec4 v_color;\n" +"VSOUT vec2 v_tex0;\n" +"VSOUT float v_fog;\n" + +"void\n" +"main(void)\n" +"{\n" +" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n" +" gl_Position = u_proj * u_view * Vertex;\n" +" vec3 Normal = mat3(u_world) * in_normal;\n" + +" v_tex0 = in_tex0;\n" + +" vec4 vertCol = in_color;\n" +" vec4 amb = u_amb;\n" +" vec4 emiss = u_emiss;\n" + +" vertCol.xyz = ((vertCol.xyz - 0.5) * max(vertContrast, 0.0)) + 0.5;\n" +" vertCol.xyz += vertBrightness;\n" +" vertCol.xyz = max(vertCol.xyz, vec3(0.0,0.0,0.0));\n" +" \n" +" amb.xyz = ((amb.xyz - 0.5) * max(ambientContrast, 0.0)) + 0.5;\n" +" amb.xyz += ambientBrightness;\n" +" amb.xyz = max(amb.xyz, vec3(0.0,0.0,0.0));\n" +" \n" +" emiss.xyz = ((emiss.xyz - 0.5) * max(emissiveContrast, 0.0)) + 0.5;\n" +" emiss.xyz += emissiveBrightness;\n" +" emiss.xyz = max(emiss.xyz, vec3(0.0,0.0,0.0));\n" +" v_color.xyz = emiss.xyz + (vertCol.xyz * amb.xyz);\n" +" v_color.w = vertCol.w;\n" + + +" v_color = clamp(v_color, 0.0, 1.0);\n" +" v_color.a *= u_matColor.a;\n" + +" v_fog = DoFog(gl_Position.w);\n" +"}\n" +; diff --git a/src/extras/shaders/leedsBuilding_vs_gl.inc b/src/extras/shaders/leedsBuilding_vs_gl.inc index 4e2db0d0..33c5eccc 100644 --- a/src/extras/shaders/leedsBuilding_vs_gl.inc +++ b/src/extras/shaders/leedsBuilding_vs_gl.inc @@ -2,6 +2,8 @@ const char *leedsBuilding_vert_src = "uniform vec4 u_amb;\n" "uniform vec4 u_emiss;\n" +"#define surfEmissive (u_surfProps.w)\n" + "VSIN(ATTRIB_POS) vec3 in_pos;\n" "VSOUT vec4 v_color;\n" @@ -19,7 +21,7 @@ const char *leedsBuilding_vert_src = " v_color = in_color;\n" " v_color.rgb *= u_amb.rgb;\n" -" v_color.rgb += u_emiss.rgb;\n" +" v_color.rgb += u_emiss.rgb*surfEmissive;\n" " v_color = clamp(v_color, 0.0, 1.0);\n" " v_color.a *= u_matColor.a;\n" diff --git a/src/extras/shaders/leedsVehicle.vert b/src/extras/shaders/leedsVehicle.vert new file mode 100644 index 00000000..b93c7ea0 --- /dev/null +++ b/src/extras/shaders/leedsVehicle.vert @@ -0,0 +1,27 @@ +uniform mat4 u_texMatrix; + +VSIN(ATTRIB_POS) vec3 in_pos; + +VSOUT vec4 v_color; +VSOUT vec2 v_tex0; +VSOUT vec2 v_tex1; +VSOUT float v_fog; + +void +main(void) +{ + vec4 Vertex = u_world * vec4(in_pos, 1.0); + gl_Position = u_proj * u_view * Vertex; + vec3 Normal = mat3(u_world) * in_normal; + + v_tex0 = in_tex0; + v_tex1 = (u_texMatrix * vec4(Normal, 1.0)).xy; + + v_color = in_color; + v_color.rgb += u_ambLight.rgb*surfAmbient; + v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse; + v_color = clamp(v_color, 0.0, 1.0); + v_color *= u_matColor; + + v_fog = DoFog(gl_Position.w); +} diff --git a/src/extras/shaders/leedsVehicle_VS.cso b/src/extras/shaders/leedsVehicle_VS.cso Binary files differnew file mode 100644 index 00000000..57db3798 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_VS.cso diff --git a/src/extras/shaders/leedsVehicle_VS.hlsl b/src/extras/shaders/leedsVehicle_VS.hlsl new file mode 100644 index 00000000..eb53313a --- /dev/null +++ b/src/extras/shaders/leedsVehicle_VS.hlsl @@ -0,0 +1,45 @@ +#include "standardConstants.h" + +float4x4 texMat : register(c41); + +struct VS_in +{ + float4 Position : POSITION; + float3 Normal : NORMAL; + float2 TexCoord : TEXCOORD0; + float4 Prelight : COLOR0; +}; + +struct VS_out { + float4 Position : POSITION; + float3 TexCoord0 : TEXCOORD0; // also fog + float2 TexCoord1 : TEXCOORD1; + float4 Color : COLOR0; +}; + + +VS_out main(in VS_in input) +{ + VS_out output; + + output.Position = mul(combinedMat, input.Position); + float3 V = mul(worldMat, input.Position).xyz; + float3 N = mul(normalMat, input.Normal); + + output.TexCoord0.xy = input.TexCoord; + output.TexCoord1 = mul(texMat, float4(N, 1.0)).xy; + + output.Color = input.Prelight; + output.Color.rgb += ambientLight.rgb * surfAmbient; + + int i; + for(i = 0; i < numDirLights; i++) + output.Color.xyz += DoDirLight(lights[i+firstDirLight], N)*surfDiffuse; + // PS2 clamps before material color + output.Color = clamp(output.Color, 0.0, 1.0); + output.Color *= matCol; + + output.TexCoord0.z = clamp((output.Position.w - fogEnd)*fogRange, fogDisable, 1.0); + + return output; +} diff --git a/src/extras/shaders/leedsVehicle_VS.inc b/src/extras/shaders/leedsVehicle_VS.inc new file mode 100644 index 00000000..89527d72 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_VS.inc @@ -0,0 +1,103 @@ +static unsigned char leedsVehicle_VS_cso[] = { + 0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x8d, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff, + 0x0a, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0xf5, 0x01, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0f, 0x00, + 0x01, 0x00, 0x3e, 0x00, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, + 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, + 0x02, 0x00, 0x10, 0x00, 0x01, 0x00, 0x42, 0x00, 0x2c, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00, 0x02, 0x00, 0x0e, 0x00, + 0x01, 0x00, 0x3a, 0x00, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x44, 0x01, 0x00, 0x00, 0x02, 0x00, 0x11, 0x00, 0x18, 0x00, 0x46, 0x00, + 0x90, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, + 0x02, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x32, 0x00, 0xf4, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xa7, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, + 0x03, 0x00, 0x22, 0x00, 0xb4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc4, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0xd4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x01, 0x00, 0x00, + 0x02, 0x00, 0x0d, 0x00, 0x01, 0x00, 0x36, 0x00, 0xf4, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xee, 0x01, 0x00, 0x00, 0x02, 0x00, 0x29, 0x00, + 0x04, 0x00, 0xa6, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x61, 0x6d, 0x62, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x67, 0x68, 0x74, + 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6d, 0x62, + 0x69, 0x6e, 0x65, 0x64, 0x4d, 0x61, 0x74, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x66, 0x69, 0x72, 0x73, 0x74, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x00, 0xab, + 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x67, 0x44, 0x61, 0x74, 0x61, 0x00, + 0x6c, 0x69, 0x67, 0x68, 0x74, 0x73, 0x00, 0x63, 0x6f, 0x6c, 0x6f, 0x72, + 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x00, 0xab, 0x4b, 0x01, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, + 0x64, 0x01, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, 0x6d, 0x01, 0x00, 0x00, + 0x54, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0c, 0x00, + 0x08, 0x00, 0x03, 0x00, 0x78, 0x01, 0x00, 0x00, 0x6d, 0x61, 0x74, 0x43, + 0x6f, 0x6c, 0x00, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x4d, 0x61, 0x74, + 0x00, 0xab, 0xab, 0xab, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x75, 0x6d, 0x44, + 0x69, 0x72, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x73, 0x00, 0xab, 0xab, 0xab, + 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x73, 0x75, 0x72, 0x66, 0x50, 0x72, 0x6f, 0x70, + 0x73, 0x00, 0x74, 0x65, 0x78, 0x4d, 0x61, 0x74, 0x00, 0x76, 0x73, 0x5f, + 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, + 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, + 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, + 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, + 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0xab, 0x51, 0x00, 0x00, 0x05, + 0x04, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, + 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, + 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, + 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, + 0x0a, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0f, 0x90, 0x05, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x55, 0x90, 0x01, 0x00, 0xe4, 0xa0, + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, + 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, + 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, + 0x03, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xff, 0x90, 0x00, 0x00, 0xe4, 0x80, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0xe4, 0x80, + 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0x55, 0x90, + 0x09, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, + 0x08, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x0a, 0x00, 0xe4, 0xa0, + 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, + 0x01, 0x00, 0x01, 0x80, 0x0d, 0x00, 0x00, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x01, 0x00, 0x07, 0x80, 0x0f, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x80, + 0x03, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x07, 0x80, + 0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x08, 0x80, + 0x04, 0x00, 0x00, 0xa0, 0x26, 0x00, 0x00, 0x01, 0x00, 0x00, 0xe4, 0xf0, + 0x02, 0x00, 0x00, 0x03, 0x03, 0x00, 0x01, 0x80, 0x01, 0x00, 0xff, 0x80, + 0x10, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x01, 0x80, + 0x03, 0x00, 0x00, 0x80, 0x04, 0x00, 0x55, 0xa0, 0x2e, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x01, 0xb0, 0x03, 0x00, 0x00, 0x80, 0x08, 0x00, 0x00, 0x04, + 0x03, 0x00, 0x01, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x13, 0x20, 0xe4, 0xa1, + 0x00, 0x00, 0x00, 0xb0, 0x0b, 0x00, 0x00, 0x03, 0x03, 0x00, 0x01, 0x80, + 0x03, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0x04, + 0x03, 0x00, 0x07, 0x80, 0x03, 0x00, 0x00, 0x80, 0x11, 0x20, 0xe4, 0xa0, + 0x00, 0x00, 0x00, 0xb0, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x07, 0x80, + 0x03, 0x00, 0xe4, 0x80, 0x0d, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0xe4, 0x80, + 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x08, 0x80, 0x01, 0x00, 0xff, 0x80, + 0x04, 0x00, 0xaa, 0xa0, 0x27, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, + 0x02, 0x00, 0x08, 0x80, 0x03, 0x00, 0xff, 0x90, 0x0b, 0x00, 0x00, 0x03, + 0x01, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0xa0, + 0x0a, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x80, + 0x04, 0x00, 0xaa, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xd0, + 0x01, 0x00, 0xe4, 0x80, 0x0c, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, + 0x01, 0x00, 0x03, 0x80, 0x00, 0x00, 0x55, 0x80, 0x2a, 0x00, 0xe4, 0xa0, + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x80, 0x29, 0x00, 0xe4, 0xa0, + 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x03, 0x80, 0x2b, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x03, 0xe0, + 0x00, 0x00, 0xe4, 0x80, 0x2c, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0xff, 0x80, 0x0e, 0x00, 0x55, 0xa1, + 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, + 0x0e, 0x00, 0xaa, 0xa0, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, + 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x04, 0xe0, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0xaa, 0xa0, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe0, 0x02, 0x00, 0xe4, 0x90, + 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/leedsVehicle_add.frag b/src/extras/shaders/leedsVehicle_add.frag new file mode 100644 index 00000000..e9bcef74 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_add.frag @@ -0,0 +1,32 @@ +uniform sampler2D tex0; +uniform sampler2D tex1; + +uniform float u_fxparams; + +#define shininess (u_fxparams) + +FSIN vec4 v_color; +FSIN vec2 v_tex0; +FSIN vec2 v_tex1; +FSIN float v_fog; + +void +main(void) +{ + vec4 pass1 = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y)); + vec4 pass2 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y)); + pass2.a *= shininess; + + pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog); + pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog); + + // We simulate drawing this in two passes. + // We premultiply alpha so render state should be one. + vec4 color; + color.rgb = pass1.rgb*pass1.a + pass2.rgb*pass2.a; + color.a = pass1.a; + + DoAlphaTest(color.a); + + FRAGCOLOR(color); +} diff --git a/src/extras/shaders/leedsVehicle_add_PS.cso b/src/extras/shaders/leedsVehicle_add_PS.cso Binary files differnew file mode 100644 index 00000000..11db8b0e --- /dev/null +++ b/src/extras/shaders/leedsVehicle_add_PS.cso diff --git a/src/extras/shaders/leedsVehicle_add_PS.hlsl b/src/extras/shaders/leedsVehicle_add_PS.hlsl new file mode 100644 index 00000000..943926cf --- /dev/null +++ b/src/extras/shaders/leedsVehicle_add_PS.hlsl @@ -0,0 +1,34 @@ +struct VS_out { + float4 Position : POSITION; + float3 TexCoord0 : TEXCOORD0; + float2 TexCoord1 : TEXCOORD1; + float4 Color : COLOR0; +}; + +sampler2D diffTex : register(s0); +sampler2D envTex : register(s1); + +float4 fogColor : register(c0); + +float4 fxparams : register(c1); + +#define shininess (fxparams.x) + +float4 main(VS_out input) : COLOR +{ + float4 pass1 = input.Color*tex2D(diffTex, input.TexCoord0.xy); + float4 pass2 = tex2D(envTex, input.TexCoord1.xy); + pass2.a *= shininess; + + pass1.rgb = lerp(fogColor.rgb, pass1.rgb, input.TexCoord0.z); + pass2.rgb = lerp(float3(0.0, 0.0, 0.0), pass2.rgb, input.TexCoord0.z); + + // We simulate drawing this in two passes. + // First pass with standard blending, second with addition + // We premultiply alpha so render state should be one. + float4 color; + color.rgb = pass1.rgb*pass1.a + pass2.rgb*pass2.a; + color.a = pass1.a; + + return color; +} diff --git a/src/extras/shaders/leedsVehicle_add_PS.inc b/src/extras/shaders/leedsVehicle_add_PS.inc new file mode 100644 index 00000000..dc8378f4 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_add_PS.inc @@ -0,0 +1,44 @@ +static unsigned char leedsVehicle_add_PS_cso[] = { + 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x40, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, + 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0xc1, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x84, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0x00, + 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0xa8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x06, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x64, 0x69, 0x66, 0x66, 0x54, 0x65, 0x78, 0x00, 0x04, 0x00, 0x0c, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x65, 0x6e, 0x76, 0x54, 0x65, 0x78, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x66, 0x6f, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0xab, 0xab, + 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x66, 0x78, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, + 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, + 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, + 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, + 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0xab, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, 0xb0, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xb0, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x01, 0x08, 0x0f, 0xa0, + 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xb0, + 0x01, 0x08, 0xe4, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, + 0x00, 0x00, 0xe4, 0xb0, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0x00, 0xa0, + 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xaa, 0xb0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, + 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, + 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0xa1, 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x08, 0x80, + 0x01, 0x00, 0xff, 0x80, 0x00, 0x00, 0xff, 0x90, 0x04, 0x00, 0x00, 0x04, + 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xaa, 0xb0, 0x01, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x07, 0x80, + 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xff, 0x80, 0x00, 0x00, 0xe4, 0x80, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/leedsVehicle_add_gl.inc b/src/extras/shaders/leedsVehicle_add_gl.inc new file mode 100644 index 00000000..a9835b13 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_add_gl.inc @@ -0,0 +1,34 @@ +const char *leedsVehicle_add_frag_src = +"uniform sampler2D tex0;\n" +"uniform sampler2D tex1;\n" + +"uniform float u_fxparams;\n" + +"#define shininess (u_fxparams)\n" + +"FSIN vec4 v_color;\n" +"FSIN vec2 v_tex0;\n" +"FSIN vec2 v_tex1;\n" +"FSIN float v_fog;\n" + +"void\n" +"main(void)\n" +"{\n" +" vec4 pass1 = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n" +" vec4 pass2 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));\n" +" pass2.a *= shininess;\n" + +" pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);\n" +" pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);\n" + +" // We simulate drawing this in two passes.\n" +" // We premultiply alpha so render state should be one.\n" +" vec4 color;\n" +" color.rgb = pass1.rgb*pass1.a + pass2.rgb*pass2.a;\n" +" color.a = pass1.a;\n" + +" DoAlphaTest(color.a);\n" + +" FRAGCOLOR(color);\n" +"}\n" +; diff --git a/src/extras/shaders/leedsVehicle_blend.frag b/src/extras/shaders/leedsVehicle_blend.frag new file mode 100644 index 00000000..a3fab072 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_blend.frag @@ -0,0 +1,32 @@ +uniform sampler2D tex0; +uniform sampler2D tex1; + +uniform float u_fxparams; + +#define shininess (u_fxparams) + +FSIN vec4 v_color; +FSIN vec2 v_tex0; +FSIN vec2 v_tex1; +FSIN float v_fog; + +void +main(void) +{ + vec4 pass1 = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y)); + vec4 pass2 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y)); + pass2.a *= shininess; + + pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog); + pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog); + + // We simulate drawing this in two passes. + // We premultiply alpha so render state should be one. + vec4 color; + color.rgb = pass1.rgb*pass1.a*(1.0-pass2.a) + pass2.rgb*pass2.a; + color.a = pass1.a*(1.0-pass2.a) + pass2.a; + + DoAlphaTest(color.a); + + FRAGCOLOR(color); +} diff --git a/src/extras/shaders/leedsVehicle_blend_PS.cso b/src/extras/shaders/leedsVehicle_blend_PS.cso Binary files differnew file mode 100644 index 00000000..8d104803 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_blend_PS.cso diff --git a/src/extras/shaders/leedsVehicle_blend_PS.hlsl b/src/extras/shaders/leedsVehicle_blend_PS.hlsl new file mode 100644 index 00000000..e32970b2 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_blend_PS.hlsl @@ -0,0 +1,33 @@ +struct VS_out { + float4 Position : POSITION; + float3 TexCoord0 : TEXCOORD0; + float2 TexCoord1 : TEXCOORD1; + float4 Color : COLOR0; +}; + +sampler2D diffTex : register(s0); +sampler2D envTex : register(s1); + +float4 fogColor : register(c0); + +float4 fxparams : register(c1); + +#define shininess (fxparams.x) + +float4 main(VS_out input) : COLOR +{ + float4 pass1 = input.Color*tex2D(diffTex, input.TexCoord0.xy); + float4 pass2 = tex2D(envTex, input.TexCoord1.xy); + pass2.a *= shininess; + + pass1.rgb = lerp(fogColor.rgb, pass1.rgb, input.TexCoord0.z); + pass2.rgb = lerp(float3(0.0, 0.0, 0.0), pass2.rgb, input.TexCoord0.z); + + // We simulate drawing this in two passes. + // We premultiply alpha so render state should be one. + float4 color; + color.rgb = pass1.rgb*pass1.a*(1.0-pass2.a) + pass2.rgb*pass2.a; + color.a = pass1.a*(1.0-pass2.a) + pass2.a; + + return color; +} diff --git a/src/extras/shaders/leedsVehicle_blend_PS.inc b/src/extras/shaders/leedsVehicle_blend_PS.inc new file mode 100644 index 00000000..94fb000c --- /dev/null +++ b/src/extras/shaders/leedsVehicle_blend_PS.inc @@ -0,0 +1,50 @@ +static unsigned char leedsVehicle_blend_PS_cso[] = { + 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x40, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, + 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0xc1, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x84, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0x00, + 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0xa8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x06, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x64, 0x69, 0x66, 0x66, 0x54, 0x65, 0x78, 0x00, 0x04, 0x00, 0x0c, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x65, 0x6e, 0x76, 0x54, 0x65, 0x78, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x66, 0x6f, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0xab, 0xab, + 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x66, 0x78, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, + 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, + 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, + 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, + 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0xab, + 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, 0xb0, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xb0, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x01, 0x08, 0x0f, 0xa0, + 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, + 0x00, 0x08, 0xe4, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, + 0x01, 0x00, 0xe4, 0xb0, 0x01, 0x08, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x00, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0xa1, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0x80, + 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xff, 0x90, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xaa, 0xb0, 0x00, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, + 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, + 0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xaa, 0xb0, + 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x08, 0x80, 0x01, 0x00, 0xff, 0x80, + 0x01, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, + 0x01, 0x00, 0x00, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x08, 0x80, + 0x01, 0x00, 0xff, 0x80, 0x02, 0x00, 0x00, 0x81, 0x02, 0x00, 0x00, 0xa0, + 0x04, 0x00, 0x00, 0x04, 0x03, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, + 0x01, 0x00, 0xff, 0x80, 0x02, 0x00, 0xff, 0x80, 0x12, 0x00, 0x00, 0x04, + 0x03, 0x00, 0x07, 0x80, 0x02, 0x00, 0xff, 0x80, 0x01, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, + 0x03, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/leedsVehicle_blend_gl.inc b/src/extras/shaders/leedsVehicle_blend_gl.inc new file mode 100644 index 00000000..707afb10 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_blend_gl.inc @@ -0,0 +1,34 @@ +const char *leedsVehicle_blend_frag_src = +"uniform sampler2D tex0;\n" +"uniform sampler2D tex1;\n" + +"uniform float u_fxparams;\n" + +"#define shininess (u_fxparams)\n" + +"FSIN vec4 v_color;\n" +"FSIN vec2 v_tex0;\n" +"FSIN vec2 v_tex1;\n" +"FSIN float v_fog;\n" + +"void\n" +"main(void)\n" +"{\n" +" vec4 pass1 = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n" +" vec4 pass2 = texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));\n" +" pass2.a *= shininess;\n" + +" pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);\n" +" pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);\n" + +" // We simulate drawing this in two passes.\n" +" // We premultiply alpha so render state should be one.\n" +" vec4 color;\n" +" color.rgb = pass1.rgb*pass1.a*(1.0-pass2.a) + pass2.rgb*pass2.a;\n" +" color.a = pass1.a*(1.0-pass2.a) + pass2.a;\n" + +" DoAlphaTest(color.a);\n" + +" FRAGCOLOR(color);\n" +"}\n" +; diff --git a/src/extras/shaders/leedsVehicle_mobile.frag b/src/extras/shaders/leedsVehicle_mobile.frag new file mode 100644 index 00000000..467379dd --- /dev/null +++ b/src/extras/shaders/leedsVehicle_mobile.frag @@ -0,0 +1,76 @@ +uniform sampler2D tex0; +uniform sampler2D tex1; + +uniform float u_fxparams; +uniform vec3 u_skyTop; +uniform vec3 u_skyBot; + +#define shininess (u_fxparams) + +// matfx: +// case 1 normal envmap +// custom1 (4.0, 1.0, 1.0, coef) +// custom2 (0.25, 3.0, 1.0, 1.0) +// case 2 too strong +// custom1 (4.0, 1.0, 2.0, coef) +// custom2 (0.5, 3.0, 1.0, 1.0) +// ???: practically no fresnel +// custom1 (4.0, 1.25, 0.01, coef) +// custom2 (1.0, 2.0, 1.1, 2.0) + +#define power (4.0) + +#define preMult (1.0) +#define postMult (1.0) +#define minRefl (0.25) +#define maxRefl (3.0) +#define minOpacity (1.0) +#define maxOpacity (1.0) + +//#define preMult (1.0) +//#define postMult (2.0) +//#define minRefl (0.5) +//#define maxRefl (3.0) +//#define minOpacity (1.0) +//#define maxOpacity (1.0) + +//#define preMult (1.25) +//#define postMult (0.01) +//#define minRefl (1.0) +//#define maxRefl (2.0) +//#define minOpacity (1.1) +//#define maxOpacity (2.0) + +FSIN vec4 v_color; +FSIN vec2 v_tex0; +FSIN vec2 v_tex1; +FSIN float v_fog; +FSIN vec2 v_reflData; + +#define v_NdotV (v_reflData.x) +#define v_lightingCont (v_reflData.y) + +void +main(void) +{ + vec4 pass1 = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y)); + + vec3 envtex = texture(tex1, v_tex1).rgb; // V flipped + vec3 skyColour = mix(u_skyBot, u_skyTop, envtex.g); + vec3 envOut = mix(envtex.rrr, skyColour, envtex.b); + + float fresnel = mix(shininess, shininess * 2.0, v_NdotV); + fresnel = pow(v_NdotV * preMult, power); + fresnel = clamp(fresnel * postMult, 0.0, 1.0); + float reflectivity = v_lightingCont * mix(minRefl, maxRefl, fresnel)*shininess; + + float opacity = mix(minOpacity, maxOpacity, fresnel)*pass1.a; + vec4 color = pass1 + vec4(reflectivity * envOut, 0.0); + color.a = opacity; + + color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog); + + DoAlphaTest(color.a); + + FRAGCOLOR(color); +} diff --git a/src/extras/shaders/leedsVehicle_mobile.vert b/src/extras/shaders/leedsVehicle_mobile.vert new file mode 100644 index 00000000..b2123fa4 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_mobile.vert @@ -0,0 +1,40 @@ +uniform vec4 u_amb; +uniform vec4 u_emiss; + +VSIN(ATTRIB_POS) vec3 in_pos; + +VSOUT vec4 v_color; +VSOUT vec2 v_tex0; +VSOUT vec2 v_tex1; +VSOUT float v_fog; +VSOUT vec2 v_reflData; + +#define v_NdotV (v_reflData.x) +#define v_lightingCont (v_reflData.y) + +void +main(void) +{ + vec4 Vertex = u_world * vec4(in_pos, 1.0); + gl_Position = u_proj * u_view * Vertex; + vec3 Normal = mat3(u_world) * in_normal; + + v_tex0 = in_tex0; + + vec3 ViewNormal = mat3(u_view) * Normal; + v_tex1 = (ViewNormal.xy + vec2(1.0, 1.0))*0.5; + + v_color = in_color; + vec4 combinedAmbient = mix(u_emiss, u_amb, Normal.z); + v_color.rgb += combinedAmbient.rgb*surfAmbient; + v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse; + v_lightingCont = max(0.5, (v_color.r + v_color.g + v_color.b) / 3.0); + v_color *= u_matColor; + + // for fresnel + vec3 camPos = -u_view[3].xyz * mat3(u_view); + vec3 viewVec = normalize(Vertex.xyz - camPos); + v_NdotV = 1.0 - dot(-Normal.xyz, viewVec.xyz); + + v_fog = DoFog(gl_Position.w); +} diff --git a/src/extras/shaders/leedsVehicle_mobile_PS.cso b/src/extras/shaders/leedsVehicle_mobile_PS.cso Binary files differnew file mode 100644 index 00000000..04ffcf8e --- /dev/null +++ b/src/extras/shaders/leedsVehicle_mobile_PS.cso diff --git a/src/extras/shaders/leedsVehicle_mobile_PS.hlsl b/src/extras/shaders/leedsVehicle_mobile_PS.hlsl new file mode 100644 index 00000000..da09b872 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_mobile_PS.hlsl @@ -0,0 +1,53 @@ +struct VS_out { + float4 Position : POSITION; + float3 TexCoord0 : TEXCOORD0; + float2 TexCoord1 : TEXCOORD1; + float2 ReflData : TEXCOORD2; + float4 Color : COLOR0; +}; + +#define NdotV (input.ReflData.x) +#define lightingCont (input.ReflData.y) + +sampler2D diffTex : register(s0); +sampler2D envTex : register(s1); + +float4 fogColor : register(c0); + +float4 fxparams : register(c1); +float3 skyTop : register(c2); +float3 skyBot : register(c3); + +#define shininess (fxparams.x) + +#define power (4.0) + +#define preMult (1.0) +#define postMult (1.0) +#define minRefl (0.25) +#define maxRefl (3.0) +#define minOpacity (1.0) +#define maxOpacity (1.0) + + +float4 main(VS_out input) : COLOR +{ + float4 pass1 = input.Color*tex2D(diffTex, input.TexCoord0.xy); + + float3 envtex = tex2D(envTex, float2(input.TexCoord1.x, 1.0-input.TexCoord1.y)).rgb; // V flipped + float3 skyColour = lerp(skyBot, skyTop, envtex.g); + float3 envOut = lerp(envtex.rrr, skyColour, envtex.b); + + float fresnel = lerp(shininess, shininess * 2.0, NdotV); + fresnel = pow(NdotV * preMult, power); + fresnel = clamp(fresnel * postMult, 0.0, 1.0); + float reflectivity = lightingCont * lerp(minRefl, maxRefl, fresnel)*shininess; + + float opacity = lerp(minOpacity, maxOpacity, fresnel)*pass1.a; + float4 color = pass1 + float4(reflectivity * envOut, 0.0); + color.a = opacity; + + color.rgb = lerp(fogColor.rgb, color.rgb, input.TexCoord0.z); + + return color; +} diff --git a/src/extras/shaders/leedsVehicle_mobile_PS.inc b/src/extras/shaders/leedsVehicle_mobile_PS.inc new file mode 100644 index 00000000..ab8cc048 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_mobile_PS.inc @@ -0,0 +1,63 @@ +static unsigned char leedsVehicle_mobile_PS_cso[] = { + 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x51, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, + 0x06, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x07, 0x01, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xac, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0x00, + 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0xd0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x06, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe9, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x0e, 0x00, + 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x0a, 0x00, 0xf0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x64, 0x69, 0x66, 0x66, 0x54, 0x65, 0x78, 0x00, + 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x65, 0x6e, 0x76, 0x54, 0x65, 0x78, 0x00, 0xab, + 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, + 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x78, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x00, 0x73, 0x6b, 0x79, 0x42, 0x6f, 0x74, 0x00, + 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x73, 0x6b, 0x79, 0x54, 0x6f, 0x70, 0x00, 0x70, + 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, + 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, + 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, + 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, + 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, + 0x04, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0xbf, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, + 0x05, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x30, 0x40, 0x00, 0x00, 0x80, 0x3e, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, 0xb0, 0x1f, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0xb0, 0x1f, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x03, 0xb0, 0x1f, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x1f, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x90, 0x01, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, 0x00, 0x08, 0xe4, 0xa0, + 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x07, 0x80, 0x03, 0x00, 0xe4, 0xa0, + 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x81, + 0x02, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x03, 0x80, + 0x01, 0x00, 0xe4, 0xb0, 0x04, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0xd2, 0xa0, + 0x42, 0x00, 0x00, 0x03, 0x02, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x80, + 0x01, 0x08, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x07, 0x80, + 0x02, 0x00, 0x55, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, + 0x12, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80, 0x02, 0x00, 0xaa, 0x80, + 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, + 0x03, 0x00, 0x08, 0x80, 0x02, 0x00, 0x00, 0xb0, 0x02, 0x00, 0x00, 0xb0, + 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x18, 0x80, 0x03, 0x00, 0xff, 0x80, + 0x03, 0x00, 0xff, 0x80, 0x04, 0x00, 0x00, 0x04, 0x03, 0x00, 0x08, 0x80, + 0x03, 0x00, 0xff, 0x80, 0x05, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x55, 0xa0, + 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x08, 0x80, 0x03, 0x00, 0xff, 0x80, + 0x02, 0x00, 0x55, 0xb0, 0x05, 0x00, 0x00, 0x03, 0x03, 0x00, 0x08, 0x80, + 0x03, 0x00, 0xff, 0x80, 0x01, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, + 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x07, 0x80, 0x03, 0x00, 0xff, 0x80, + 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x12, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xaa, 0xb0, 0x01, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/leedsVehicle_mobile_VS.cso b/src/extras/shaders/leedsVehicle_mobile_VS.cso Binary files differnew file mode 100644 index 00000000..85796f30 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_mobile_VS.cso diff --git a/src/extras/shaders/leedsVehicle_mobile_VS.hlsl b/src/extras/shaders/leedsVehicle_mobile_VS.hlsl new file mode 100644 index 00000000..3085c5e4 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_mobile_VS.hlsl @@ -0,0 +1,57 @@ +#include "standardConstants.h" + +float4 emissive : register(c41); +float4 ambient : register(c42); +float4x4 viewMat : register(c43); + +struct VS_in +{ + float4 Position : POSITION; + float3 Normal : NORMAL; + float2 TexCoord : TEXCOORD0; + float4 Prelight : COLOR0; +}; + +struct VS_out { + float4 Position : POSITION; + float3 TexCoord0 : TEXCOORD0; // also fog + float2 TexCoord1 : TEXCOORD1; + float2 ReflData : TEXCOORD2; + float4 Color : COLOR0; +}; + +#define NdotV (output.ReflData.x) +#define lightingCont (output.ReflData.y) + +VS_out main(in VS_in input) +{ + VS_out output; + + output.Position = mul(combinedMat, input.Position); + float3 V = mul(worldMat, input.Position).xyz; + float3 N = mul(normalMat, input.Normal); + + output.TexCoord0.xy = input.TexCoord; + + float4 ViewNormal = mul(viewMat, float4(N, 0.0)); + output.TexCoord1 = (ViewNormal.xy + float2(1.0, 1.0))*0.5; + + output.Color = input.Prelight; + float4 combinedAmbient = lerp(emissive, ambient, N.z); + output.Color.rgb += combinedAmbient.rgb * surfAmbient; + + int i; + for(i = 0; i < numDirLights; i++) + output.Color.xyz += DoDirLight(lights[i+firstDirLight], N)*surfDiffuse; + lightingCont = max(0.5, (output.Color.r + output.Color.g + output.Color.b) / 3.0); + output.Color *= matCol; + + // for fresnel + float3 camPos = mul(-viewMat._m03_m13_m23, (float3x3)(viewMat)); + float3 viewVec = normalize(V.xyz - camPos); + NdotV = 1.0 - dot(-N.xyz, viewVec.xyz); + + output.TexCoord0.z = clamp((output.Position.w - fogEnd)*fogRange, fogDisable, 1.0); + + return output; +} diff --git a/src/extras/shaders/leedsVehicle_mobile_VS.inc b/src/extras/shaders/leedsVehicle_mobile_VS.inc new file mode 100644 index 00000000..aa8859b1 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_mobile_VS.inc @@ -0,0 +1,132 @@ +static unsigned char leedsVehicle_mobile_VS_cso[] = { + 0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x99, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0x2e, 0x02, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff, + 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x27, 0x02, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x02, 0x00, 0x2a, 0x00, + 0x01, 0x00, 0xaa, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x24, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, + 0x30, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, + 0x02, 0x00, 0x29, 0x00, 0x01, 0x00, 0xa6, 0x00, 0x14, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x01, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, + 0x01, 0x00, 0x42, 0x00, 0x54, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x64, 0x01, 0x00, 0x00, 0x02, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x3a, 0x00, + 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x01, 0x00, 0x00, + 0x02, 0x00, 0x11, 0x00, 0x18, 0x00, 0x46, 0x00, 0xb8, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc8, 0x01, 0x00, 0x00, 0x02, 0x00, 0x0c, 0x00, + 0x01, 0x00, 0x32, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xcf, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x03, 0x00, 0x22, 0x00, + 0xdc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x01, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x02, 0x00, 0x0d, 0x00, + 0x01, 0x00, 0x36, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x02, 0x00, 0x00, 0x02, 0x00, 0x2b, 0x00, 0x04, 0x00, 0xae, 0x00, + 0x30, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x02, 0x00, 0x00, + 0x02, 0x00, 0x04, 0x00, 0x04, 0x00, 0x12, 0x00, 0x30, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x61, 0x6d, 0x62, 0x69, 0x65, 0x6e, 0x74, 0x00, + 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x65, 0x64, + 0x4d, 0x61, 0x74, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x76, 0x65, 0x00, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4c, 0x69, + 0x67, 0x68, 0x74, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x67, 0x44, + 0x61, 0x74, 0x61, 0x00, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x73, 0x00, 0x63, + 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, + 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x64, 0x69, 0x72, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0xab, 0x73, 0x01, 0x00, 0x00, + 0x7c, 0x01, 0x00, 0x00, 0x8c, 0x01, 0x00, 0x00, 0x7c, 0x01, 0x00, 0x00, + 0x95, 0x01, 0x00, 0x00, 0x7c, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x03, 0x00, 0xa0, 0x01, 0x00, 0x00, + 0x6d, 0x61, 0x74, 0x43, 0x6f, 0x6c, 0x00, 0x6e, 0x6f, 0x72, 0x6d, 0x61, + 0x6c, 0x4d, 0x61, 0x74, 0x00, 0xab, 0xab, 0xab, 0x03, 0x00, 0x03, 0x00, + 0x03, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x6e, 0x75, 0x6d, 0x44, 0x69, 0x72, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x73, + 0x00, 0xab, 0xab, 0xab, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x75, 0x72, 0x66, + 0x50, 0x72, 0x6f, 0x70, 0x73, 0x00, 0x76, 0x69, 0x65, 0x77, 0x4d, 0x61, + 0x74, 0x00, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x4d, 0x61, 0x74, 0x00, 0x76, + 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, + 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, + 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, + 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, + 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, + 0x0b, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x51, 0x00, 0x00, 0x05, + 0x0f, 0x00, 0x0f, 0xa0, 0xab, 0xaa, 0xaa, 0x3e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, + 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, + 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, + 0x0a, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0f, 0x90, 0x05, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x55, 0x90, 0x01, 0x00, 0xe4, 0xa0, + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, + 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, + 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, + 0x03, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xff, 0x90, 0x00, 0x00, 0xe4, 0x80, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0xe4, 0x80, + 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x55, 0x90, + 0x05, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, + 0x04, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x06, 0x00, 0xe4, 0xa0, + 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x07, 0x80, 0x07, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xff, 0x90, + 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x07, 0x80, + 0x2e, 0x00, 0xe4, 0xa0, 0x08, 0x00, 0x00, 0x03, 0x02, 0x00, 0x01, 0x80, + 0x01, 0x00, 0xe4, 0x81, 0x2b, 0x00, 0xe4, 0xa0, 0x08, 0x00, 0x00, 0x03, + 0x02, 0x00, 0x02, 0x80, 0x01, 0x00, 0xe4, 0x81, 0x2c, 0x00, 0xe4, 0xa0, + 0x08, 0x00, 0x00, 0x03, 0x02, 0x00, 0x04, 0x80, 0x01, 0x00, 0xe4, 0x81, + 0x2d, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x81, 0x24, 0x00, 0x00, 0x02, + 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0x55, 0x90, 0x09, 0x00, 0xe4, 0xa0, + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x08, 0x00, 0xe4, 0xa0, + 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x07, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, + 0x00, 0x00, 0xe4, 0x80, 0x08, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x80, + 0x00, 0x00, 0xe4, 0x81, 0x01, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, + 0x01, 0x00, 0x06, 0x80, 0x00, 0x00, 0x55, 0x80, 0x2c, 0x00, 0xd0, 0xa0, + 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x06, 0x80, 0x2b, 0x00, 0xd0, 0xa0, + 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, + 0x01, 0x00, 0x06, 0x80, 0x2d, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0xaa, 0x80, + 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x06, 0x80, + 0x01, 0x00, 0xe4, 0x80, 0x0b, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0x03, + 0x01, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe9, 0x80, 0x0b, 0x00, 0x55, 0xa0, + 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x07, 0x80, 0x29, 0x00, 0xe4, 0xa0, + 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0e, 0x80, 0x02, 0x00, 0x90, 0x81, + 0x2a, 0x00, 0x90, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0e, 0x80, + 0x00, 0x00, 0xaa, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x29, 0x00, 0x90, 0xa0, + 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0e, 0x80, 0x01, 0x00, 0xe4, 0x80, + 0x0d, 0x00, 0x00, 0xa0, 0x03, 0x00, 0x90, 0x90, 0x01, 0x00, 0x00, 0x02, + 0x02, 0x00, 0x07, 0x80, 0x01, 0x00, 0xf9, 0x80, 0x01, 0x00, 0x00, 0x02, + 0x03, 0x00, 0x01, 0x80, 0x0b, 0x00, 0xaa, 0xa0, 0x26, 0x00, 0x00, 0x01, + 0x00, 0x00, 0xe4, 0xf0, 0x02, 0x00, 0x00, 0x03, 0x03, 0x00, 0x02, 0x80, + 0x03, 0x00, 0x00, 0x80, 0x10, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0x03, + 0x03, 0x00, 0x02, 0x80, 0x03, 0x00, 0x55, 0x80, 0x0b, 0x00, 0xff, 0xa0, + 0x2e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0xb0, 0x03, 0x00, 0x55, 0x80, + 0x08, 0x00, 0x00, 0x04, 0x03, 0x00, 0x02, 0x80, 0x00, 0x00, 0xe4, 0x80, + 0x13, 0x20, 0xe4, 0xa1, 0x00, 0x00, 0x00, 0xb0, 0x0b, 0x00, 0x00, 0x03, + 0x03, 0x00, 0x02, 0x80, 0x03, 0x00, 0x55, 0x80, 0x0b, 0x00, 0xaa, 0xa0, + 0x05, 0x00, 0x00, 0x04, 0x03, 0x00, 0x0e, 0x80, 0x03, 0x00, 0x55, 0x80, + 0x11, 0x20, 0x90, 0xa0, 0x00, 0x00, 0x00, 0xb0, 0x04, 0x00, 0x00, 0x04, + 0x02, 0x00, 0x07, 0x80, 0x03, 0x00, 0xf9, 0x80, 0x0d, 0x00, 0xaa, 0xa0, + 0x02, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x03, 0x00, 0x01, 0x80, + 0x03, 0x00, 0x00, 0x80, 0x0b, 0x00, 0x00, 0xa0, 0x27, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x08, 0x80, 0x03, 0x00, 0xff, 0x90, + 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xd0, 0x02, 0x00, 0xe4, 0x80, + 0x0c, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x02, 0x00, 0x01, 0xe0, + 0x01, 0x00, 0x00, 0x81, 0x0b, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x01, 0x80, 0x02, 0x00, 0x55, 0x80, 0x02, 0x00, 0x00, 0x80, + 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x02, 0x00, 0xaa, 0x80, + 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, + 0x00, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0xa0, 0x0b, 0x00, 0x00, 0x03, + 0x02, 0x00, 0x02, 0xe0, 0x00, 0x00, 0x00, 0x80, 0x0b, 0x00, 0x55, 0xa0, + 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0xff, 0x80, + 0x0e, 0x00, 0x55, 0xa1, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, + 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0xaa, 0xa0, 0x0b, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0xff, 0xa0, + 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0xe0, 0x00, 0x00, 0x00, 0x80, + 0x0b, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe0, + 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/leedsVehicle_mobile_fs_gl.inc b/src/extras/shaders/leedsVehicle_mobile_fs_gl.inc new file mode 100644 index 00000000..8098599c --- /dev/null +++ b/src/extras/shaders/leedsVehicle_mobile_fs_gl.inc @@ -0,0 +1,78 @@ +const char *leedsVehicle_mobile_frag_src = +"uniform sampler2D tex0;\n" +"uniform sampler2D tex1;\n" + +"uniform float u_fxparams;\n" +"uniform vec3 u_skyTop;\n" +"uniform vec3 u_skyBot;\n" + +"#define shininess (u_fxparams)\n" + +"// matfx:\n" +"// case 1 normal envmap\n" +"// custom1 (4.0, 1.0, 1.0, coef)\n" +"// custom2 (0.25, 3.0, 1.0, 1.0)\n" +"// case 2 too strong\n" +"// custom1 (4.0, 1.0, 2.0, coef)\n" +"// custom2 (0.5, 3.0, 1.0, 1.0)\n" +"// ???: practically no fresnel\n" +"// custom1 (4.0, 1.25, 0.01, coef)\n" +"// custom2 (1.0, 2.0, 1.1, 2.0)\n" + +"#define power (4.0)\n" + +"#define preMult (1.0)\n" +"#define postMult (1.0)\n" +"#define minRefl (0.25)\n" +"#define maxRefl (3.0)\n" +"#define minOpacity (1.0)\n" +"#define maxOpacity (1.0)\n" + +"//#define preMult (1.0)\n" +"//#define postMult (2.0)\n" +"//#define minRefl (0.5)\n" +"//#define maxRefl (3.0)\n" +"//#define minOpacity (1.0)\n" +"//#define maxOpacity (1.0)\n" + +"//#define preMult (1.25)\n" +"//#define postMult (0.01)\n" +"//#define minRefl (1.0)\n" +"//#define maxRefl (2.0)\n" +"//#define minOpacity (1.1)\n" +"//#define maxOpacity (2.0)\n" + +"FSIN vec4 v_color;\n" +"FSIN vec2 v_tex0;\n" +"FSIN vec2 v_tex1;\n" +"FSIN float v_fog;\n" +"FSIN vec2 v_reflData;\n" + +"#define v_NdotV (v_reflData.x)\n" +"#define v_lightingCont (v_reflData.y)\n" + +"void\n" +"main(void)\n" +"{\n" +" vec4 pass1 = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n" + +" vec3 envtex = texture(tex1, v_tex1).rgb; // V flipped\n" +" vec3 skyColour = mix(u_skyBot, u_skyTop, envtex.g);\n" +" vec3 envOut = mix(envtex.rrr, skyColour, envtex.b);\n" + +" float fresnel = mix(shininess, shininess * 2.0, v_NdotV);\n" +" fresnel = pow(v_NdotV * preMult, power);\n" +" fresnel = clamp(fresnel * postMult, 0.0, 1.0);\n" +" float reflectivity = v_lightingCont * mix(minRefl, maxRefl, fresnel)*shininess;\n" + +" float opacity = mix(minOpacity, maxOpacity, fresnel)*pass1.a;\n" +" vec4 color = pass1 + vec4(reflectivity * envOut, 0.0);\n" +" color.a = opacity;\n" + +" color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog);\n" + +" DoAlphaTest(color.a);\n" + +" FRAGCOLOR(color);\n" +"}\n" +; diff --git a/src/extras/shaders/leedsVehicle_mobile_vs_gl.inc b/src/extras/shaders/leedsVehicle_mobile_vs_gl.inc new file mode 100644 index 00000000..3609e369 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_mobile_vs_gl.inc @@ -0,0 +1,42 @@ +const char *leedsVehicle_mobile_vert_src = +"uniform vec4 u_amb;\n" +"uniform vec4 u_emiss;\n" + +"VSIN(ATTRIB_POS) vec3 in_pos;\n" + +"VSOUT vec4 v_color;\n" +"VSOUT vec2 v_tex0;\n" +"VSOUT vec2 v_tex1;\n" +"VSOUT float v_fog;\n" +"VSOUT vec2 v_reflData;\n" + +"#define v_NdotV (v_reflData.x)\n" +"#define v_lightingCont (v_reflData.y)\n" + +"void\n" +"main(void)\n" +"{\n" +" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n" +" gl_Position = u_proj * u_view * Vertex;\n" +" vec3 Normal = mat3(u_world) * in_normal;\n" + +" v_tex0 = in_tex0;\n" + +" vec3 ViewNormal = mat3(u_view) * Normal;\n" +" v_tex1 = (ViewNormal.xy + vec2(1.0, 1.0))*0.5;\n" + +" v_color = in_color;\n" +" vec4 combinedAmbient = mix(u_emiss, u_amb, Normal.z);\n" +" v_color.rgb += combinedAmbient.rgb*surfAmbient;\n" +" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n" +" v_lightingCont = max(0.5, (v_color.r + v_color.g + v_color.b) / 3.0);\n" +" v_color *= u_matColor;\n" + +" // for fresnel\n" +" vec3 camPos = -u_view[3].xyz * mat3(u_view);\n" +" vec3 viewVec = normalize(Vertex.xyz - camPos);\n" +" v_NdotV = 1.0 - dot(-Normal.xyz, viewVec.xyz);\n" + +" v_fog = DoFog(gl_Position.w);\n" +"}\n" +; diff --git a/src/extras/shaders/leedsVehicle_vs_gl.inc b/src/extras/shaders/leedsVehicle_vs_gl.inc new file mode 100644 index 00000000..eb36b6e9 --- /dev/null +++ b/src/extras/shaders/leedsVehicle_vs_gl.inc @@ -0,0 +1,29 @@ +const char *leedsVehicle_vert_src = +"uniform mat4 u_texMatrix;\n" + +"VSIN(ATTRIB_POS) vec3 in_pos;\n" + +"VSOUT vec4 v_color;\n" +"VSOUT vec2 v_tex0;\n" +"VSOUT vec2 v_tex1;\n" +"VSOUT float v_fog;\n" + +"void\n" +"main(void)\n" +"{\n" +" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n" +" gl_Position = u_proj * u_view * Vertex;\n" +" vec3 Normal = mat3(u_world) * in_normal;\n" + +" v_tex0 = in_tex0;\n" +" v_tex1 = (u_texMatrix * vec4(Normal, 1.0)).xy;\n" + +" v_color = in_color;\n" +" v_color.rgb += u_ambLight.rgb*surfAmbient;\n" +" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n" +" v_color = clamp(v_color, 0.0, 1.0);\n" +" v_color *= u_matColor;\n" + +" v_fog = DoFog(gl_Position.w);\n" +"}\n" +; diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp index 863407b9..7f89c233 100644 --- a/src/fakerw/fake.cpp +++ b/src/fakerw/fake.cpp @@ -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; } diff --git a/src/leeds/base/memoryManager.cpp b/src/leeds/base/memoryManager.cpp index 20604299..57e7d954 100644 --- a/src/leeds/base/memoryManager.cpp +++ b/src/leeds/base/memoryManager.cpp @@ -64,12 +64,12 @@ void* operator new[](size_t size) return base::cMainMemoryManager::Instance()->Allocate(size); } -void operator delete(void* buf) +void operator delete(void* buf) noexcept { base::cMainMemoryManager::Instance()->Free(buf); } -void operator delete[](void* buf) +void operator delete[](void* buf) noexcept { base::cMainMemoryManager::Instance()->Free(buf); }
\ No newline at end of file diff --git a/src/leeds/base/memoryManager.h b/src/leeds/base/memoryManager.h index a4b1beac..91124cd1 100644 --- a/src/leeds/base/memoryManager.h +++ b/src/leeds/base/memoryManager.h @@ -35,5 +35,5 @@ namespace base void* operator new(size_t size); void* operator new[](size_t size); -void operator delete(void* buf); -void operator delete[](void* buf);
\ No newline at end of file +void operator delete(void* buf) noexcept; +void operator delete[](void* buf) noexcept;
\ No newline at end of file diff --git a/src/modelinfo/BaseModelInfo.cpp b/src/modelinfo/BaseModelInfo.cpp index f05be242..d92e4941 100644 --- a/src/modelinfo/BaseModelInfo.cpp +++ b/src/modelinfo/BaseModelInfo.cpp @@ -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); +}
\ No newline at end of file diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h index a4906fc9..b76736c0 100644 --- a/src/modelinfo/BaseModelInfo.h +++ b/src/modelinfo/BaseModelInfo.h @@ -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; } diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index 7c920cbf..792904fc 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -280,7 +280,7 @@ enum MI_PEREN, MI_SENTINEL, MI_PATRIOT, - MI_FIRETRUK, + MI_FIRETRUCK, MI_TRASH, MI_STRETCH, MI_MANANA, @@ -371,7 +371,6 @@ enum MI_BAGGAGE, MI_FBIRANCH, MI_VICECHEE, - MI_FIRETRUCK, MI_RIO, MI_SQUALO, MI_JETMAX, diff --git a/src/modelinfo/ModelInfo.cpp b/src/modelinfo/ModelInfo.cpp index 0a542cf6..02df1be6 100644 --- a/src/modelinfo/ModelInfo.cpp +++ b/src/modelinfo/ModelInfo.cpp @@ -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; diff --git a/src/objects/CutsceneObject.cpp b/src/objects/CutsceneObject.cpp index 8d1be357..01fb038f 100644 --- a/src/objects/CutsceneObject.cpp +++ b/src/objects/CutsceneObject.cpp @@ -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 diff --git a/src/peds/Ped.h b/src/peds/Ped.h index a126fed6..4056898e 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -521,12 +521,23 @@ public: uint32 bCollectBusFare : 1; uint32 bBoughtIceCream : 1; uint32 bDonePositionOutOfCollision : 1; - uint32 bCanAttackPlayerWithCops : 1; + uint32 bCanAttackPlayerWithCops : 1; // 1A1_1 on PS2 + uint32 b1A1_2 : 1; + uint32 b1A1_4 : 1; + uint32 b1A1_8 : 1; + uint32 b1A1_10 : 1; + uint32 b1A1_20 : 1; + +#ifdef KANGAROO_CHEAT // our own flags uint32 m_ped_flagI80 : 1; // KANGAROO_CHEAT define makes use of this as cheat toggle +#endif uint8 m_gangFlags; + uint8 m_unused15D; // these 3 can't be padding but had to actually have been members ... + uint8 m_unused15E; + uint8 m_unused15F; uint8 CharCreatedBy; eObjective m_objective; eObjective m_prevObjective; @@ -567,7 +578,7 @@ public: uint32 m_pathNodeTimer; CPathNode m_pathNodeObjPool[8]; CPathNode* m_pCurPathNode; - char m_nPathDir; + int8 m_nPathDir; CPathNode* m_pLastPathNode; CPathNode* m_pNextPathNode; CVector m_followPathDestPos; @@ -744,6 +755,7 @@ public: void SetObjective(eObjective); void SetObjective(eObjective, int16, int16); void SetObjective(eObjective, CVector); + void SetObjective(eObjective, CVector, float); void SetObjective(eObjective, float, const CVector&); void ClearChat(void); void InformMyGangOfAttack(CEntity*); diff --git a/src/peds/PedAI.cpp b/src/peds/PedAI.cpp index de82524d..244c7b84 100644 --- a/src/peds/PedAI.cpp +++ b/src/peds/PedAI.cpp @@ -370,6 +370,51 @@ CPed::SetObjective(eObjective newObj, void *entity) } } +void +CPed::SetObjective(eObjective newObj, CVector dest, float safeDist) +{ + if (DyingOrDead()) + return; + + if (m_prevObjective != OBJECTIVE_NONE && m_prevObjective == newObj) + return; + + if (m_objective == newObj) { + if (newObj == OBJECTIVE_GOTO_AREA_ANY_MEANS || newObj == OBJECTIVE_GOTO_AREA_ON_FOOT || newObj == OBJECTIVE_RUN_TO_AREA || newObj == OBJECTIVE_SPRINT_TO_AREA) { + if (m_nextRoutePointPos == dest && m_distanceToCountSeekDone == safeDist) + return; + } + else if (newObj == OBJECTIVE_GUARD_SPOT) { + if (m_vecSpotToGuard == dest && m_radiusToGuard == safeDist) + return; + } + } + + ClearPointGunAt(); + SetObjectiveTimer(0); + bObjectiveCompleted = false; + if (IsTemporaryObjective(m_objective)) { + m_prevObjective = newObj; + } + else { + if (m_objective != newObj) + SetStoredObjective(); + + m_objective = newObj; + } + + if (newObj == OBJECTIVE_GUARD_SPOT) { + m_vecSpotToGuard = dest; + m_radiusToGuard = safeDist; + } + else if (newObj == OBJECTIVE_GOTO_AREA_ANY_MEANS || newObj == OBJECTIVE_GOTO_AREA_ON_FOOT || newObj == OBJECTIVE_RUN_TO_AREA || newObj == OBJECTIVE_SPRINT_TO_AREA) { + m_pNextPathNode = nil; + m_nextRoutePointPos = dest; + m_vecSeekPos = m_nextRoutePointPos; + bUsePedNodeSeek = true; + } +} + // --MIAMI: Done // Only used in 01E1: SET_CHAR_OBJ_FOLLOW_ROUTE opcode // IDA fails very badly in here, puts a fake loop and ignores SetFollowRoute call... diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp index 912399c9..507653f6 100644 --- a/src/render/Draw.cpp +++ b/src/render/Draw.cpp @@ -20,6 +20,16 @@ uint8 CDraw::FadeRed; uint8 CDraw::FadeGreen; uint8 CDraw::FadeBlue; +#ifdef PROPER_SCALING +bool CDraw::ms_bProperScaling = true; +#endif +#ifdef FIX_RADAR +bool CDraw::ms_bFixRadar = true; +#endif +#ifdef FIX_SPRITES +bool CDraw::ms_bFixSprites = true; +#endif + float CDraw::CalculateAspectRatio(void) { @@ -75,13 +85,9 @@ CDraw::SetFOV(float fov) ms_fFOV = fov; } -#ifdef ASPECT_RATIO_SCALE -float -ScaleAndCenterX(float x) +#ifdef PROPER_SCALING +float CDraw::ScaleY(float y) { - if (SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH) - return x; - else - return (SCREEN_WIDTH - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)) / 2 + SCREEN_SCALE_X(x); + return ms_bProperScaling ? y : y * ((float)DEFAULT_SCREEN_HEIGHT/SCREEN_HEIGHT_NTSC); } -#endif
\ No newline at end of file +#endif
\ No newline at end of file diff --git a/src/render/Draw.h b/src/render/Draw.h index 2976dc34..1a63c980 100644 --- a/src/render/Draw.h +++ b/src/render/Draw.h @@ -30,6 +30,16 @@ public: static uint8 FadeRed; static uint8 FadeGreen; static uint8 FadeBlue; + +#ifdef PROPER_SCALING + static bool ms_bProperScaling; +#endif +#ifdef FIX_RADAR + static bool ms_bFixRadar; +#endif +#ifdef FIX_SPRITES + static bool ms_bFixSprites; +#endif static void SetNearClipZ(float nearclip) { ms_fNearClipZ = nearclip; } static float GetNearClipZ(void) { return ms_fNearClipZ; } @@ -50,4 +60,7 @@ public: #endif static float GetAspectRatio(void) { return ms_fAspectRatio; } static void SetAspectRatio(float ratio) { ms_fAspectRatio = ratio; } +#ifdef PROPER_SCALING + static float ScaleY(float y); +#endif }; diff --git a/src/render/Font.cpp b/src/render/Font.cpp index 3517031d..6d569591 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -444,7 +444,7 @@ CFont::PrintChar(float x, float y, wchar c) } #endif - if(Details.style == FONT_BANK || Details.style == FONT_STANDARD){ + if(RenderState.style == FONT_BANK || RenderState.style == FONT_STANDARD){ if (bDontPrint) return; if (RenderState.slant == 0.0f) { #ifdef FIX_BUGS @@ -1051,10 +1051,10 @@ CFont::GetCharacterWidth(wchar c) return Size[LanguageSet][Details.style][192]; #else - if (Details.proportional) - return Size[Details.style][c]; + if (RenderState.proportional) + return Size[RenderState.style][c]; else - return Size[Details.style][209]; + return Size[RenderState.style][209]; #endif // MORE_LANGUAGES } diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 1c870fd2..350e8c45 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -28,6 +28,16 @@ // --MIAMI: file done +#if defined(FIX_BUGS) + #define SCREEN_SCALE_X_FIX(a) SCREEN_SCALE_X(a) + #define SCREEN_SCALE_Y_FIX(a) SCREEN_SCALE_Y(a) + #define SCALE_AND_CENTER_X_FIX(a) SCALE_AND_CENTER_X(a) +#else + #define SCREEN_SCALE_X_FIX(a) (a) + #define SCREEN_SCALE_Y_FIX(a) (a) + #define SCALE_AND_CENTER_X_FIX(a) (a) +#endif + // Game has colors inlined in code. // For easier modification we collect them here: CRGBA MONEY_COLOR(0, 207, 133, 255); @@ -81,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; @@ -1052,16 +1062,17 @@ void CHud::Draw() CRadar::DrawMap(); if (FrontEndMenuManager.m_PrefsRadarMode != 1) { CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT)); + + rect.Translate(SCREEN_SCALE_X_FIX(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); + #ifdef FIX_BUGS - rect.Translate(SCREEN_SCALE_X(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); + rect.Grow(SCREEN_SCALE_X(6.0f), SCREEN_SCALE_X(6.0f), SCREEN_SCALE_Y(6.0f), SCREEN_SCALE_Y(6.0f)); #else - rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); -#endif - rect.Grow(6.0f); - rect.Translate(0.0f, 2.0f); +#endif + rect.Translate(SCREEN_SCALE_X_FIX(0.0f), SCREEN_SCALE_Y_FIX(2.0f)); Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255)); - rect.Translate(0.0f, -2.0f); + rect.Translate(SCREEN_SCALE_X_FIX(0.0f), SCREEN_SCALE_Y_FIX(-2.0f)); Sprites[HUD_RADARDISC].Draw(rect, RADARDISC_COLOR); } CRadar::DrawBlips(); diff --git a/src/render/Hud.h b/src/render/Hud.h index a4b9609a..354f2438 100644 --- a/src/render/Hud.h +++ b/src/render/Hud.h @@ -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; diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 660b05fe..5c65eea5 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -2,6 +2,7 @@ #include "common.h" #include "main.h" +#include "General.h" #include "Lights.h" #include "ModelInfo.h" #include "Treadable.h" @@ -20,6 +21,7 @@ #include "ModelIndices.h" #include "Streaming.h" #include "Shadows.h" +#include "Coronas.h" #include "PointLights.h" #include "Occlusion.h" #include "Renderer.h" @@ -40,6 +42,8 @@ bool gbDontRenderPeds; bool gbDontRenderObjects; bool gbDontRenderVehicles; +bool gbRenderDebugEnvMap; + // unused int16 TestCloseThings; int16 TestBigThings; @@ -347,8 +351,6 @@ enum { PASS_BLEND // normal blend }; -static RwRGBAReal black; - static void SetStencilState(int state) { @@ -377,314 +379,6 @@ SetStencilState(int state) } } -#ifdef RW_D3D9 -struct BuildingInst -{ - rw::RawMatrix combinedMat; - rw::d3d9::InstanceDataHeader *instHeader; - uint8 fadeAlpha; - bool lighting; -}; -static BuildingInst blendInsts[3][2000]; -static int numBlendInsts[3]; - -static void -SetMatrix(BuildingInst *building, rw::Matrix *worldMat) -{ - using namespace rw; - RawMatrix world, worldview; - Camera *cam = engine->currentCamera; - convMatrix(&world, worldMat); - RawMatrix::mult(&worldview, &world, &cam->devView); - RawMatrix::mult(&building->combinedMat, &worldview, &cam->devProj); -} - -static bool -IsTextureTransparent(RwTexture *tex) -{ - if(tex == nil || tex->raster == nil) - return false; - return PLUGINOFFSET(rw::d3d::D3dRaster, tex->raster, rw::d3d::nativeRasterOffset)->hasAlpha; -} - -// Render all opaque meshes and put atomics that needs blending -// into the deferred list. -static void -AtomicFirstPass(RpAtomic *atomic, int pass) -{ - using namespace rw; - using namespace rw::d3d; - using namespace rw::d3d9; - - BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; - - atomic->getPipeline()->instance(atomic); - building->instHeader = (d3d9::InstanceDataHeader*)atomic->geometry->instData; - assert(building->instHeader != nil); - assert(building->instHeader->platform == PLATFORM_D3D9); - building->fadeAlpha = 255; - building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); - - bool setupDone = false; - bool defer = false; - SetMatrix(building, atomic->getFrame()->getLTM()); - - InstanceData *inst = building->instHeader->inst; - for(rw::uint32 i = 0; i < building->instHeader->numMeshes; i++, inst++){ - Material *m = inst->material; - - if(inst->vertexAlpha || m->color.alpha != 255 || - IsTextureTransparent(m->texture)){ - defer = true; - continue; - } - - // alright we're rendering this atomic - if(!setupDone){ - setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride); - setIndices(building->instHeader->indexBuffer); - setVertexDeclaration(building->instHeader->vertexDeclaration); - setVertexShader(default_amb_VS); - d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4); - if(building->lighting) - setAmbient(pAmbient->color); - else - setAmbient(black); - setupDone = true; - } - - setMaterial(m->color, m->surfaceProps); - - if(m->texture){ - d3d::setTexture(0, m->texture); - setPixelShader(default_tex_PS); - }else - setPixelShader(default_PS); - - drawInst(building->instHeader, inst); - } - if(defer) - numBlendInsts[pass]++; -} - -static void -AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha) -{ - using namespace rw; - using namespace rw::d3d; - using namespace rw::d3d9; - - BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; - - atomic->getPipeline()->instance(atomic); - building->instHeader = (d3d9::InstanceDataHeader*)atomic->geometry->instData; - assert(building->instHeader != nil); - assert(building->instHeader->platform == PLATFORM_D3D9); - building->fadeAlpha = fadeAlpha; - building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); - SetMatrix(building, atomic->getFrame()->getLTM()); - numBlendInsts[pass]++; -} - -static void -RenderBlendPass(int pass) -{ - using namespace rw; - using namespace rw::d3d; - using namespace rw::d3d9; - - setVertexShader(default_amb_VS); - - int i; - for(i = 0; i < numBlendInsts[pass]; i++){ - BuildingInst *building = &blendInsts[pass][i]; - - setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride); - setIndices(building->instHeader->indexBuffer); - setVertexDeclaration(building->instHeader->vertexDeclaration); - d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4); - if(building->lighting) - setAmbient(pAmbient->color); - else - setAmbient(black); - - InstanceData *inst = building->instHeader->inst; - for(rw::uint32 j = 0; j < building->instHeader->numMeshes; j++, inst++){ - Material *m = inst->material; - if(!inst->vertexAlpha && m->color.alpha == 255 && !IsTextureTransparent(m->texture) && building->fadeAlpha == 255) - continue; // already done this one - - rw::RGBA color = m->color; - color.alpha = (color.alpha * building->fadeAlpha)/255; - setMaterial(color, m->surfaceProps); - - if(m->texture){ - d3d::setTexture(0, m->texture); - setPixelShader(default_tex_PS); - }else - setPixelShader(default_PS); - - drawInst(building->instHeader, inst); - } - } -} -#endif -#ifdef RW_GL3 -struct BuildingInst -{ - rw::Matrix matrix; - rw::gl3::InstanceDataHeader *instHeader; - uint8 fadeAlpha; - bool lighting; -}; -static BuildingInst blendInsts[3][2000]; -static int numBlendInsts[3]; - -static bool -IsTextureTransparent(RwTexture *tex) -{ - if(tex == nil || tex->raster == nil) - return false; - return PLUGINOFFSET(rw::gl3::Gl3Raster, tex->raster, rw::gl3::nativeRasterOffset)->hasAlpha; -} - -// Render all opaque meshes and put atomics that needs blending -// into the deferred list. -static void -AtomicFirstPass(RpAtomic *atomic, int pass) -{ - using namespace rw; - using namespace rw::gl3; - - BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; - - atomic->getPipeline()->instance(atomic); - building->instHeader = (gl3::InstanceDataHeader*)atomic->geometry->instData; - assert(building->instHeader != nil); - assert(building->instHeader->platform == PLATFORM_GL3); - building->fadeAlpha = 255; - building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); - - WorldLights lights; - lights.numAmbients = 1; - lights.numDirectionals = 0; - lights.numLocals = 0; - if(building->lighting) - lights.ambient = pAmbient->color; - else - lights.ambient = black; - - bool setupDone = false; - bool defer = false; - building->matrix = *atomic->getFrame()->getLTM(); - - InstanceData *inst = building->instHeader->inst; - for(rw::uint32 i = 0; i < building->instHeader->numMeshes; i++, inst++){ - Material *m = inst->material; - - if(inst->vertexAlpha || m->color.alpha != 255 || - IsTextureTransparent(m->texture)){ - defer = true; - continue; - } - - // alright we're rendering this atomic - if(!setupDone){ - defaultShader->use(); - setWorldMatrix(&building->matrix); -#ifdef RW_GL_USE_VAOS - glBindVertexArray(building->instHeader->vao); -#else - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo); - glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo); - setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); -#endif - setLights(&lights); - setupDone = true; - } - - setMaterial(m->color, m->surfaceProps); - - setTexture(0, m->texture); - - drawInst(building->instHeader, inst); - } -#ifndef RW_GL_USE_VAOS - disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); -#endif - if(defer) - numBlendInsts[pass]++; -} - -static void -AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha) -{ - using namespace rw; - using namespace rw::gl3; - - BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]]; - - atomic->getPipeline()->instance(atomic); - building->instHeader = (gl3::InstanceDataHeader*)atomic->geometry->instData; - assert(building->instHeader != nil); - assert(building->instHeader->platform == PLATFORM_GL3); - building->fadeAlpha = fadeAlpha; - building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT); - building->matrix = *atomic->getFrame()->getLTM(); - numBlendInsts[pass]++; -} - -static void -RenderBlendPass(int pass) -{ - using namespace rw; - using namespace rw::gl3; - - defaultShader->use(); - WorldLights lights; - lights.numAmbients = 1; - lights.numDirectionals = 0; - lights.numLocals = 0; - - int i; - for(i = 0; i < numBlendInsts[pass]; i++){ - BuildingInst *building = &blendInsts[pass][i]; - -#ifdef RW_GL_USE_VAOS - glBindVertexArray(building->instHeader->vao); -#else - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo); - glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo); - setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); -#endif - setWorldMatrix(&building->matrix); - if(building->lighting) - lights.ambient = pAmbient->color; - else - lights.ambient = black; - setLights(&lights); - - InstanceData *inst = building->instHeader->inst; - for(rw::uint32 j = 0; j < building->instHeader->numMeshes; j++, inst++){ - Material *m = inst->material; - if(!inst->vertexAlpha && m->color.alpha == 255 && !IsTextureTransparent(m->texture) && building->fadeAlpha == 255) - continue; // already done this one - - rw::RGBA color = m->color; - color.alpha = (color.alpha * building->fadeAlpha)/255; - setMaterial(color, m->surfaceProps); - - setTexture(0, m->texture); - - drawInst(building->instHeader, inst); - } -#ifndef RW_GL_USE_VAOS - disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); -#endif - } -} -#endif - void CRenderer::RenderOneBuilding(CEntity *ent, float camdist) { @@ -715,16 +409,16 @@ CRenderer::RenderOneBuilding(CEntity *ent, float camdist) alpha = mi->m_alpha * fadefactor; if(alpha == 255) - AtomicFirstPass(atomic, pass); + WorldRender::AtomicFirstPass(atomic, pass); else{ // not quite sure what this is about, do we have to do that? RpGeometry *geo = RpAtomicGetGeometry(lodatm); if(geo != RpAtomicGetGeometry(atomic)) RpAtomicSetGeometry(atomic, geo, rpATOMICSAMEBOUNDINGSPHERE); - AtomicFullyTransparent(atomic, pass, alpha); + WorldRender::AtomicFullyTransparent(atomic, pass, alpha); } }else - AtomicFirstPass(atomic, pass); + WorldRender::AtomicFirstPass(atomic, pass); ent->bImBeingRendered = false; // TODO: this seems wrong, but do we even need it? } @@ -779,16 +473,16 @@ CRenderer::RenderWorld(int pass) RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE); - RenderBlendPass(PASS_NOZ); + WorldRender::RenderBlendPass(PASS_NOZ); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); break; case 2: // Transparent RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE); - RenderBlendPass(PASS_ADD); + WorldRender::RenderBlendPass(PASS_ADD); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); - RenderBlendPass(PASS_BLEND); + WorldRender::RenderBlendPass(PASS_BLEND); break; } } @@ -872,9 +566,9 @@ CRenderer::ClearForFrame(void) ms_nNoOfInVisibleEntities = 0; gSortedVehiclesAndPeds.Clear(); - numBlendInsts[PASS_NOZ] = 0; - numBlendInsts[PASS_ADD] = 0; - numBlendInsts[PASS_BLEND] = 0; + WorldRender::numBlendInsts[PASS_NOZ] = 0; + WorldRender::numBlendInsts[PASS_ADD] = 0; + WorldRender::numBlendInsts[PASS_BLEND] = 0; } #endif @@ -1952,3 +1646,186 @@ CRenderer::RemoveVehiclePedLights(CEntity *ent, bool reset) SetAmbientColours(); DeActivateDirectional(); } + + +#include "postfx.h" + +static RwIm2DVertex Screen2EnvQuad[4]; +static RwImVertexIndex EnvQuadIndices[6] = { 0, 1, 2, 0, 2, 3 }; + +static void +SetQuadVertices(RwRaster *env, RwRaster *screen, float z) +{ + uint32 width = RwRasterGetWidth(env); + uint32 height = RwRasterGetHeight(env); + + float zero, xmax, ymax; + + zero = -HALFPX; + xmax = width - HALFPX; + ymax = height - HALFPX; + + float recipz = 1.0f/z; + float umax = (float)SCREEN_WIDTH/RwRasterGetWidth(screen); + float vmax = (float)SCREEN_HEIGHT/RwRasterGetHeight(screen); + + RwIm2DVertexSetScreenX(&Screen2EnvQuad[0], zero); + RwIm2DVertexSetScreenY(&Screen2EnvQuad[0], zero); + RwIm2DVertexSetScreenZ(&Screen2EnvQuad[0], RwIm2DGetNearScreenZ()); + RwIm2DVertexSetCameraZ(&Screen2EnvQuad[0], z); + RwIm2DVertexSetRecipCameraZ(&Screen2EnvQuad[0], recipz); + RwIm2DVertexSetU(&Screen2EnvQuad[0], 0.0f, recipz); + RwIm2DVertexSetV(&Screen2EnvQuad[0], 0.0f, recipz); + RwIm2DVertexSetIntRGBA(&Screen2EnvQuad[0], 255, 255, 255, 255); + + RwIm2DVertexSetScreenX(&Screen2EnvQuad[1], zero); + RwIm2DVertexSetScreenY(&Screen2EnvQuad[1], ymax); + RwIm2DVertexSetScreenZ(&Screen2EnvQuad[1], RwIm2DGetNearScreenZ()); + RwIm2DVertexSetCameraZ(&Screen2EnvQuad[1], z); + RwIm2DVertexSetRecipCameraZ(&Screen2EnvQuad[1], recipz); + RwIm2DVertexSetU(&Screen2EnvQuad[1], 0.0f, recipz); + RwIm2DVertexSetV(&Screen2EnvQuad[1], vmax, recipz); + RwIm2DVertexSetIntRGBA(&Screen2EnvQuad[1], 255, 255, 255, 255); + + RwIm2DVertexSetScreenX(&Screen2EnvQuad[2], xmax); + RwIm2DVertexSetScreenY(&Screen2EnvQuad[2], ymax); + RwIm2DVertexSetScreenZ(&Screen2EnvQuad[2], RwIm2DGetNearScreenZ()); + RwIm2DVertexSetCameraZ(&Screen2EnvQuad[2], z); + RwIm2DVertexSetRecipCameraZ(&Screen2EnvQuad[2], recipz); + RwIm2DVertexSetU(&Screen2EnvQuad[2], umax, recipz); + RwIm2DVertexSetV(&Screen2EnvQuad[2], vmax, recipz); + RwIm2DVertexSetIntRGBA(&Screen2EnvQuad[2], 255, 255, 255, 255); + + RwIm2DVertexSetScreenX(&Screen2EnvQuad[3], xmax); + RwIm2DVertexSetScreenY(&Screen2EnvQuad[3], zero); + RwIm2DVertexSetScreenZ(&Screen2EnvQuad[3], RwIm2DGetNearScreenZ()); + RwIm2DVertexSetCameraZ(&Screen2EnvQuad[3], z); + RwIm2DVertexSetRecipCameraZ(&Screen2EnvQuad[3], recipz); + RwIm2DVertexSetU(&Screen2EnvQuad[3], umax, recipz); + RwIm2DVertexSetV(&Screen2EnvQuad[3], 0.0f, recipz); + RwIm2DVertexSetIntRGBA(&Screen2EnvQuad[3], 255, 255, 255, 255); +} + +static RwIm2DVertex coronaVerts[4*4]; +static RwImVertexIndex coronaIndices[6*4]; +static int numCoronaVerts, numCoronaIndices; + +static void +AddCorona(float x, float y, float sz) +{ + float nearz, recipz; + RwIm2DVertex *v; + nearz = RwIm2DGetNearScreenZ(); + float z = RwCameraGetNearClipPlane(RwCameraGetCurrentCamera()); + recipz = 1.0f/z; + + v = &coronaVerts[numCoronaVerts]; + RwIm2DVertexSetScreenX(&v[0], x); + RwIm2DVertexSetScreenY(&v[0], y); + RwIm2DVertexSetScreenZ(&v[0], z); + RwIm2DVertexSetScreenZ(&v[0], nearz); + RwIm2DVertexSetRecipCameraZ(&v[0], recipz); + RwIm2DVertexSetU(&v[0], 0.0f, recipz); + RwIm2DVertexSetV(&v[0], 0.0f, recipz); + RwIm2DVertexSetIntRGBA(&v[0], 255, 255, 255, 255); + + RwIm2DVertexSetScreenX(&v[1], x); + RwIm2DVertexSetScreenY(&v[1], y + sz); + RwIm2DVertexSetScreenZ(&v[1], z); + RwIm2DVertexSetScreenZ(&v[1], nearz); + RwIm2DVertexSetRecipCameraZ(&v[1], recipz); + RwIm2DVertexSetU(&v[1], 0.0f, recipz); + RwIm2DVertexSetV(&v[1], 1.0f, recipz); + RwIm2DVertexSetIntRGBA(&v[1], 255, 255, 255, 255); + + RwIm2DVertexSetScreenX(&v[2], x + sz); + RwIm2DVertexSetScreenY(&v[2], y + sz); + RwIm2DVertexSetScreenZ(&v[2], z); + RwIm2DVertexSetScreenZ(&v[2], nearz); + RwIm2DVertexSetRecipCameraZ(&v[2], recipz); + RwIm2DVertexSetU(&v[2], 1.0f, recipz); + RwIm2DVertexSetV(&v[2], 1.0f, recipz); + RwIm2DVertexSetIntRGBA(&v[2], 255, 255, 255, 255); + + RwIm2DVertexSetScreenX(&v[3], x + sz); + RwIm2DVertexSetScreenY(&v[3], y); + RwIm2DVertexSetScreenZ(&v[3], z); + RwIm2DVertexSetScreenZ(&v[3], nearz); + RwIm2DVertexSetRecipCameraZ(&v[3], recipz); + RwIm2DVertexSetU(&v[3], 1.0f, recipz); + RwIm2DVertexSetV(&v[3], 0.0f, recipz); + RwIm2DVertexSetIntRGBA(&v[3], 255, 255, 255, 255); + + + coronaIndices[numCoronaIndices++] = numCoronaVerts; + coronaIndices[numCoronaIndices++] = numCoronaVerts + 1; + coronaIndices[numCoronaIndices++] = numCoronaVerts + 2; + coronaIndices[numCoronaIndices++] = numCoronaVerts; + coronaIndices[numCoronaIndices++] = numCoronaVerts + 2; + coronaIndices[numCoronaIndices++] = numCoronaVerts + 3; + numCoronaVerts += 4; +} +#include "Debug.h" + +static void +DrawEnvMapCoronas(float heading) +{ + RwRaster *rt = RwTextureGetRaster(CustomPipes::EnvMapTex); + const float BIG = 89.0f * RwRasterGetWidth(rt)/128.0f; + const float SMALL = 38.0f * RwRasterGetHeight(rt)/128.0f; + + float x; + numCoronaVerts = 0; + numCoronaIndices = 0; + x = (heading - PI)/TWOPI;// - 1.0f; + x *= BIG+SMALL; + AddCorona(x, 0.0f, BIG); x += BIG; + AddCorona(x, 12.0f, SMALL); x += SMALL; + AddCorona(x, 0.0f, BIG); x += BIG; + AddCorona(x, 12.0f, SMALL); x += SMALL; + + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE); + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[CCoronas::TYPE_STAR])); + RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, coronaVerts, numCoronaVerts, coronaIndices, numCoronaIndices); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); +} + +void +CRenderer::GenerateEnvironmentMap(void) +{ + // We'll probably do this differently eventually + // re-using all sorts of stuff here... + + CPostFX::GetBackBuffer(Scene.camera); + + RwCameraBeginUpdate(CustomPipes::EnvMapCam); + + // get current scene + SetQuadVertices(RwTextureGetRaster(CustomPipes::EnvMapTex), CPostFX::pBackBuffer, RwCameraGetNearClipPlane(RwCameraGetCurrentCamera())); + RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, CPostFX::pBackBuffer); + RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR); + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); + RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Screen2EnvQuad, 4, EnvQuadIndices, 6); + RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); + + // Draw coronas + if(CustomPipes::VehiclePipeSwitch != CustomPipes::VEHICLEPIPE_MOBILE) + DrawEnvMapCoronas(TheCamera.GetForward().Heading()); + + RwCameraEndUpdate(CustomPipes::EnvMapCam); + + + RwCameraBeginUpdate(Scene.camera); + + if(gbRenderDebugEnvMap){ + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(CustomPipes::EnvMapTex)); + RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, CustomPipes::EnvScreenQuad, 4, (RwImVertexIndex*)CustomPipes::QuadIndices, 6); + } +} diff --git a/src/render/Renderer.h b/src/render/Renderer.h index 9b202098..a4b6b0b8 100644 --- a/src/render/Renderer.h +++ b/src/render/Renderer.h @@ -102,4 +102,6 @@ public: static void RenderTransparentWater(void); // keep-out polys and transparent water #endif static void InsertEntityIntoList(CEntity *ent); + + static void GenerateEnvironmentMap(void); }; diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index 38ddc114..0e4d4fcd 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -46,7 +46,11 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh, // this is used to scale correctly if you zoom in with sniper rifle float fovScale = fov / CDraw::GetFOV(); +#ifdef FIX_SPRITES + *outw = CDraw::ms_bFixSprites ? (fovScale * recip * SCREEN_HEIGHT) : (fovScale * SCREEN_SCALE_AR(recip) * SCREEN_WIDTH); +#else *outw = fovScale * SCREEN_SCALE_AR(recip) * SCREEN_WIDTH; +#endif *outh = fovScale * recip * SCREEN_HEIGHT; return true; diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp index 333801d8..59dcb02a 100644 --- a/src/render/Weather.cpp +++ b/src/render/Weather.cpp @@ -51,6 +51,11 @@ float CWeather::WindClipped; float CWeather::TrafficLightBrightness; bool CWeather::bScriptsForceRain; +bool CWeather::Stored_StateStored; +float CWeather::Stored_InterpolationValue; +int16 CWeather::Stored_OldWeatherType; +int16 CWeather::Stored_NewWeatherType; +float CWeather::Stored_Rain; tRainStreak Streaks[NUM_RAIN_STREAKS]; @@ -649,3 +654,23 @@ void CWeather::RenderRainStreaks(void) TempBufferVerticesStored = 0; TempBufferIndicesStored = 0; } + +void CWeather::StoreWeatherState() +{ + Stored_StateStored = true; + Stored_InterpolationValue = InterpolationValue; + Stored_Rain = Rain; + Stored_NewWeatherType = NewWeatherType; + Stored_OldWeatherType = OldWeatherType; +} + +void CWeather::RestoreWeatherState() +{ +#ifdef FIX_BUGS // it's not used anyway though + Stored_StateStored = false; +#endif + InterpolationValue = Stored_InterpolationValue; + Rain = Stored_Rain; + NewWeatherType = Stored_NewWeatherType; + OldWeatherType = Stored_OldWeatherType; +} diff --git a/src/render/Weather.h b/src/render/Weather.h index ef62ebb6..da88168d 100644 --- a/src/render/Weather.h +++ b/src/render/Weather.h @@ -42,6 +42,11 @@ public: static float TrafficLightBrightness; static bool bScriptsForceRain; + static bool Stored_StateStored; + static float Stored_InterpolationValue; + static int16 Stored_OldWeatherType; + static int16 Stored_NewWeatherType; + static float Stored_Rain; static void RenderRainStreaks(void); static void Update(void); @@ -55,6 +60,9 @@ public: static void AddRain(); static void AddHeatHaze(); static void AddBeastie(); + + static void StoreWeatherState(); + static void RestoreWeatherState(); }; enum { diff --git a/src/skel/skeleton.cpp b/src/skel/skeleton.cpp index 6f6b3744..20ac38ab 100644 --- a/src/skel/skeleton.cpp +++ b/src/skel/skeleton.cpp @@ -399,7 +399,7 @@ RsInitialize(void) */ RwBool result; - RsGlobal.appName = RWSTRING("GTA: Vice City"); + RsGlobal.appName = RWSTRING("GTA: Liberty City Stories"); RsGlobal.maximumWidth = DEFAULT_SCREEN_WIDTH; RsGlobal.maximumHeight = DEFAULT_SCREEN_HEIGHT; RsGlobal.width = DEFAULT_SCREEN_WIDTH; diff --git a/src/text/Messages.cpp b/src/text/Messages.cpp index db0865ae..440746c0 100644 --- a/src/text/Messages.cpp +++ b/src/text/Messages.cpp @@ -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; +}
\ No newline at end of file diff --git a/src/text/Messages.h b/src/text/Messages.h index e8ba1bf7..602a4a08 100644 --- a/src/text/Messages.h +++ b/src/text/Messages.h @@ -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*); diff --git a/src/text/Text.cpp b/src/text/Text.cpp index a11acd26..fd1659dc 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -247,7 +247,7 @@ CText::LoadMissionText(char *MissionTableName) CFileMgr::SetDir("TEXT"); switch (FrontEndMenuManager.m_PrefsLanguage) { case CMenuManager::LANGUAGE_AMERICAN: - sprintf(filename, "AMERICAN.GXT"); + sprintf(filename, "ENGLISH.GXT"); break; case CMenuManager::LANGUAGE_FRENCH: sprintf(filename, "FRENCH.GXT"); diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 64309c39..6f00a2ea 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -288,17 +288,17 @@ CAutomobile::ProcessControl(void) // Improve grip of vehicles in certain cases bool strongGrip1 = false; bool strongGrip2 = false; - if(FindPlayerVehicle() && this != FindPlayerVehicle() && + if(FindPlayerVehicle() && this != FindPlayerVehicle() && FindPlayerPed()->m_pWanted->GetWantedLevel() > 3 && (AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE || - AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_CLOSE)){ - if(FindPlayerSpeed().Magnitude() > 0.3f){ - strongGrip1 = true; - if(FindPlayerSpeed().Magnitude() > 0.4f && - m_vecMoveSpeed.Magnitude() < 0.3f) - strongGrip2 = true; - else if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f) - strongGrip2 = true; - } + AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_CLOSE) && + FindPlayerSpeed().Magnitude() > 0.3f){ + + strongGrip1 = true; + if(FindPlayerSpeed().Magnitude() > 0.4f && + m_vecMoveSpeed.Magnitude() < 0.3f) + strongGrip2 = true; + else if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f) + strongGrip2 = true; }else if(GetModelIndex() == MI_RCBANDIT && GetStatus() != STATUS_PLAYER_REMOTE) strongGrip1 = true; diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp index ab5ab622..bb613617 100644 --- a/src/vehicles/Bike.cpp +++ b/src/vehicles/Bike.cpp @@ -83,7 +83,7 @@ CBike::CBike(int32 id, uint8 CreatedBy) case MI_SANCHEZ: m_bikeAnimType = ASSOCGRP_BIKE_DIRT; break; - default: assert(0 && "invalid bike model ID"); + default: m_bikeAnimType = ASSOCGRP_BIKE_STANDARD; //assert(0 && "invalid bike model ID"); // TODO } m_vehType = VEHICLE_TYPE_BIKE; diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 6ad23f8e..e3bcf096 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -32,15 +32,15 @@ #define INVALID_ORIENTATION (-9999.99f) -float fShapeLength = 0.4f; -float fShapeTime = 0.05f; -float fRangeMult = 0.6f; -float fTimeMult; - float CBoat::MAX_WAKE_LENGTH = 50.0f; float CBoat::MIN_WAKE_INTERVAL = 2.0f; float CBoat::WAKE_LIFETIME = 150.0f; +float fShapeLength = 0.4f; +float fShapeTime = 0.05f; +float fRangeMult = 0.6f; +float fTimeMult = 1.2f/CBoat::WAKE_LIFETIME; + CBoat *CBoat::apFrameWakeGeneratingBoats[4]; const uint32 CBoat::nSaveStructSize = diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp index ffcb80d0..ce254100 100644 --- a/src/vehicles/Cranes.cpp +++ b/src/vehicles/Cranes.cpp @@ -466,7 +466,7 @@ bool CCranes::DoesMilitaryCraneHaveThisOneAlready(uint32 mi) case MI_FIRETRUCK: return (CarsCollectedMilitaryCrane & 1); case MI_AMBULAN: return (CarsCollectedMilitaryCrane & 2); case MI_ENFORCER: return (CarsCollectedMilitaryCrane & 4); - case MI_FBIRANCH: return (CarsCollectedMilitaryCrane & 8); + case (uint32)MI_FBIRANCH: return (CarsCollectedMilitaryCrane & 8); case MI_RHINO: return (CarsCollectedMilitaryCrane & 0x10); case MI_BARRACKS: return (CarsCollectedMilitaryCrane & 0x20); case MI_POLICE: return (CarsCollectedMilitaryCrane & 0x40); @@ -481,7 +481,7 @@ void CCranes::RegisterCarForMilitaryCrane(uint32 mi) case MI_FIRETRUCK: CarsCollectedMilitaryCrane |= 1; break; case MI_AMBULAN: CarsCollectedMilitaryCrane |= 2; break; case MI_ENFORCER: CarsCollectedMilitaryCrane |= 4; break; - case MI_FBIRANCH: CarsCollectedMilitaryCrane |= 8; break; + case (uint32)MI_FBIRANCH: CarsCollectedMilitaryCrane |= 8; break; case MI_RHINO: CarsCollectedMilitaryCrane |= 0x10; break; case MI_BARRACKS: CarsCollectedMilitaryCrane |= 0x20; break; case MI_POLICE: CarsCollectedMilitaryCrane |= 0x40; break; diff --git a/src/vehicles/Door.cpp b/src/vehicles/Door.cpp index c80965aa..72a30339 100644 --- a/src/vehicles/Door.cpp +++ b/src/vehicles/Door.cpp @@ -168,3 +168,58 @@ CTrainDoor::IsClosed(void) { return m_fPosn == RetTranslationWhenClosed(); } + +bool +CFerryDoor::IsInUse(void) +{ + float translationDifference = m_fPrevPosn - m_fPosn; + m_fPrevPosn = m_fPosn; + return Abs(translationDifference) > 0.002f; +} + +float +CFerryDoor::RetTranslationWhenClosed(void) +{ + if(Abs(m_fClosedPosn) < Abs(m_fOpenPosn)) + return m_fClosedPosn; + else + return m_fOpenPosn; +} + +bool +CFerryDoor::IsClosed(void) +{ + return m_fPosn == RetTranslationWhenClosed(); +} + +float +CFerryDoor::RetTranslationWhenOpen(void) +{ + if(Abs(m_fClosedPosn) < Abs(m_fOpenPosn)) + return m_fOpenPosn; + else + return m_fClosedPosn; +} + +bool +CFerryDoor::IsFullyOpen(void) +{ + if(Abs(m_fPosn) < Abs(RetTranslationWhenOpen()) - 0.5f) + return false; + return true; +} + +void +CFerryDoor::Open(float ratio) +{ + float open; + + m_fPrevPosn = m_fPosn; + open = RetTranslationWhenOpen(); + if(ratio < 1.0f){ + m_fPosn = open*ratio; + }else{ + m_nDoorState = DOORST_OPEN; + m_fPosn = open; + } +}
\ No newline at end of file diff --git a/src/vehicles/Door.h b/src/vehicles/Door.h index 567d3263..da5a3de0 100644 --- a/src/vehicles/Door.h +++ b/src/vehicles/Door.h @@ -67,3 +67,22 @@ public: float RetTranslationWhenOpen(void); void Open(float ratio); }; + + +class CFerryDoor { +private: + float m_fClosedPosn; + float m_fOpenPosn; + int8 m_nDirn; + int8 m_nAxis; + int8 m_nDoorState; + float m_fPosn; + float m_fPrevPosn; +public: + bool IsInUse(void); + float RetTranslationWhenClosed(void); + float RetTranslationWhenOpen(void); + bool IsClosed(void); + bool IsFullyOpen(void); + void Open(float ratio); +};
\ No newline at end of file |