diff options
177 files changed, 9552 insertions, 6539 deletions
diff --git a/.github/workflows/reVC_msvc_amd64.yml b/.github/workflows/reLCS_msvc_amd64.yml index 2053a770..012051a9 100644 --- a/.github/workflows/reVC_msvc_amd64.yml +++ b/.github/workflows/reLCS_msvc_amd64.yml @@ -1,4 +1,4 @@ -name: reVC_msvc_amd64 +name: reLCS_msvc_amd64 on: pull_request: @@ -47,19 +47,19 @@ jobs: ./premake5 vs2019 --with-librw --glewdir=${{env.GLEW_BASE}} --glfwdir64=${{env.GLFW_BASE}} - name: Build run: | - msbuild -m build/reVC.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}} + msbuild -m build/reLCS.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}} - name: Pack artifacts run: | - 7z a reVC_${{matrix.buildtype}}_${{matrix.platform}}.zip ./bin/${{matrix.platform}}/${{matrix.buildtype}}/* + 7z a reLCS_${{matrix.buildtype}}_${{matrix.platform}}.zip ./bin/${{matrix.platform}}/${{matrix.buildtype}}/* - name: Upload artifact to actions uses: actions/upload-artifact@v2 with: - name: reVC_${{matrix.buildtype}}_${{matrix.platform}} + name: reLCS_${{matrix.buildtype}}_${{matrix.platform}} path: ./bin/${{matrix.platform}}/${{matrix.buildtype}} # - name: Upload artifact to Bintray # uses: hpcsc/upload-bintray-docker-action@v1 # with: -# repository: reVC +# repository: reLCS # package: ${{matrix.buildtype}}_${{matrix.platform}} # version: 1.0-$(echo ${GITHUB_SHA} # sourcePath: ./bin/${{matrix.platform}}/${{matrix.buildtype}} diff --git a/.github/workflows/reVC_msvc_x86.yml b/.github/workflows/reLCS_msvc_x86.yml index 99079608..bffd545f 100644 --- a/.github/workflows/reVC_msvc_x86.yml +++ b/.github/workflows/reLCS_msvc_x86.yml @@ -1,4 +1,4 @@ -name: reVC_msvc_x86 +name: reLCS_msvc_x86 on: pull_request: @@ -47,19 +47,19 @@ jobs: ./premake5 vs2019 --with-librw --glewdir=${{env.GLEW_BASE}} --glfwdir32=${{env.GLFW_BASE}} - name: Build run: | - msbuild -m build/reVC.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}} + msbuild -m build/reLCS.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}} - name: Pack artifacts run: | - 7z a reVC_${{matrix.buildtype}}_${{matrix.platform}}.zip ./bin/${{matrix.platform}}/${{matrix.buildtype}}/* + 7z a reLCS_${{matrix.buildtype}}_${{matrix.platform}}.zip ./bin/${{matrix.platform}}/${{matrix.buildtype}}/* - name: Upload artifact to actions uses: actions/upload-artifact@v2 with: - name: reVC_${{matrix.buildtype}}_${{matrix.platform}} - path: reVC_${{matrix.buildtype}}_${{matrix.platform}}.zip + name: reLCS_${{matrix.buildtype}}_${{matrix.platform}} + path: reLCS_${{matrix.buildtype}}_${{matrix.platform}}.zip # - name: Upload artifact to Bintray # uses: hpcsc/upload-bintray-docker-action@v1 # with: -# repository: reVC +# repository: reLCS # package: ${{matrix.buildtype}}_${{matrix.platform}} # version: 1.0-$(echo ${GITHUB_SHA} # sourcePath: ./bin/${{matrix.platform}}/${{matrix.buildtype}} @@ -1,21 +1,21 @@ -# reVC -[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FGTAmodding%2Fre3%2Fbadge%3Fref%3Dmiami&style=flat)](https://actions-badge.atrox.dev/GTAmodding/re3/goto?ref=miami) +# reLCS +[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FGTAmodding%2Fre3%2Fbadge%3Fref%3Dlcs&style=flat)](https://actions-badge.atrox.dev/GTAmodding/re3/goto?ref=lcs) <a href="https://discord.gg/aKYAwCx92H"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a> ## Intro -The aim of this project is to reverse GTA Vice City for PC. +The aim of this project is to reverse GTA Liberty City Stories. ## How can I try it? -- reVC requires game assets to work, so you **must** own [a copy of GTA Vice City](https://store.steampowered.com/app/12110/Grand_Theft_Auto_Vice_City/). -- Build reVC or download it from one of the above links (Debug or Release). +- reLCS requires game assets to work. +- Build reLCS or download it from one of the above links (Debug or Release). - (Optional) If you want to use optional features, copy the files in /gamefiles folder to your game root folder. -- Move reVC.exe to GTA VC directory and run it. +- Move reLCS.exe to GTA LCS directory and run it. ## Preparing the environment for building -You may want to point GTA_VC_RE_DIR environment variable to GTA VC root folder if you want executable to be moved there via post-build script. +You may want to point GTA_LCS_RE_DIR environment variable to GTA LCS root folder if you want executable to be moved there via post-build script. - For Linux, proceed: [Building on Linux](https://github.com/GTAmodding/re3/wiki/Building-on-Linux) - For FreeBSD, proceed: [Building on FreeBSD](https://github.com/GTAmodding/re3/wiki/Building-on-FreeBSD) @@ -26,11 +26,11 @@ You may want to point GTA_VC_RE_DIR environment variable to GTA VC root folder i **If you use 64-bit D3D9**: We don't ship 64-bit Dx9 SDK. You need to download it from Microsoft if you don't have it(although it should come pre-installed after some Windows version) -There are various settings at the very bottom of [config.h](https://github.com/GTAmodding/re3/tree/miami/src/core/config.h), you may want to take a look there. i.e. FIX_BUGS define fixes the bugs we've come across. +There are various settings at the very bottom of [config.h](https://github.com/GTAmodding/re3/tree/lcs/src/core/config.h), you may want to take a look there. i.e. FIX_BUGS define fixes the bugs we've come across. > :information_source: **If you choose OpenAL on Windows** You must read [Running OpenAL build on Windows](https://github.com/GTAmodding/re3/wiki/Running-OpenAL-build-on-Windows). -> :information_source: **Did you notice librw?** reVC uses completely homebrew RenderWare-replacement rendering engine; [librw](https://github.com/aap/librw/). librw comes as submodule of reVC, but you also can use LIBRW enviorenment variable to specify path to your own librw. +> :information_source: **Did you notice librw?** reLCS uses completely homebrew RenderWare-replacement rendering engine; [librw](https://github.com/aap/librw/). librw comes as submodule of reLCS, but you also can use LIBRW enviorenment variable to specify path to your own librw. ## Contributing Please read the [Coding Style](https://github.com/GTAmodding/re3/blob/master/CODING_STYLE.md) Document diff --git a/premake5.lua b/premake5.lua index e62ad6be..6c26732c 100644 --- a/premake5.lua +++ b/premake5.lua @@ -63,10 +63,10 @@ function getarch(a) return a end -workspace "reVC" +workspace "reLCS" language "C++" configurations { "Debug", "Release" } - startproject "reVC" + startproject "reLCS" location "build" symbols "Full" staticruntime "off" @@ -230,9 +230,9 @@ local function addSrcFiles( prefix ) return prefix .. "/*cpp", prefix .. "/*.h", prefix .. "/*.c", prefix .. "/*.ico", prefix .. "/*.rc" end -project "reVC" +project "reLCS" kind "WindowedApp" - targetname "reVC" + targetname "reLCS" targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}" defines { "MIAMI" } @@ -246,6 +246,7 @@ project "reVC" files { addSrcFiles("src/control") } files { addSrcFiles("src/core") } files { addSrcFiles("src/entities") } + files { addSrcFiles("src/leeds/base") } files { addSrcFiles("src/math") } files { addSrcFiles("src/modelinfo") } files { addSrcFiles("src/objects") } @@ -270,6 +271,7 @@ project "reVC" includedirs { "src/control" } includedirs { "src/core" } includedirs { "src/entities" } + includedirs { "src/leeds/base" } includedirs { "src/math" } includedirs { "src/modelinfo" } includedirs { "src/objects" } @@ -308,8 +310,8 @@ project "reVC" defines { "AUDIO_OAL" } filter {} - if(os.getenv("GTA_VC_RE_DIR")) then - setpaths("$(GTA_VC_RE_DIR)/", "%(cfg.buildtarget.name)", "") + if(os.getenv("GTA_LCS_RE_DIR")) then + setpaths("$(GTA_LCS_RE_DIR)/", "%(cfg.buildtarget.name)", "") end filter "platforms:win*" 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/AnimManager.cpp b/src/animation/AnimManager.cpp index 607dfe26..d0c8b4cb 100644 --- a/src/animation/AnimManager.cpp +++ b/src/animation/AnimManager.cpp @@ -22,281 +22,373 @@ CAnimBlendAssocGroup *CAnimManager::ms_aAnimAssocGroups; CLinkList<CAnimBlendHierarchy*> CAnimManager::ms_animCache; AnimAssocDesc aStdAnimDescs[] = { - { ANIM_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK }, - { ANIM_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK }, - { ANIM_SPRINT, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK }, - { ANIM_IDLE_STANCE, ASSOC_REPEAT }, - { ANIM_WALK_START, ASSOC_HAS_TRANSLATION }, - { ANIM_RUN_STOP, ASSOC_DELETEFADEDOUT | ASSOC_HAS_TRANSLATION }, - { ANIM_RUN_STOP_R, ASSOC_DELETEFADEDOUT | ASSOC_HAS_TRANSLATION }, - { ANIM_IDLE_CAM, ASSOC_REPEAT | ASSOC_PARTIAL }, - { ANIM_IDLE_HBHB, ASSOC_REPEAT | ASSOC_PARTIAL }, - { ANIM_IDLE_TIRED, ASSOC_REPEAT }, - { ANIM_IDLE_ARMED, ASSOC_REPEAT | ASSOC_PARTIAL }, - { ANIM_IDLE_CHAT, ASSOC_REPEAT | ASSOC_PARTIAL }, - { ANIM_IDLE_TAXI, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_KO_SHOT_FRONT1, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL }, - { ANIM_KO_SHOT_FRONT2, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL }, - { ANIM_KO_SHOT_FRONT3, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL }, - { ANIM_KO_SHOT_FRONT4, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL }, - { ANIM_KO_SHOT_FACE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL }, - { ANIM_KO_SHOT_STOM, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_KO_SHOT_ARML, ASSOC_PARTIAL | ASSOC_FRONTAL }, - { ANIM_KO_SHOT_ARMR, ASSOC_PARTIAL | ASSOC_FRONTAL }, - { ANIM_KO_SHOT_LEGL, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_KO_SHOT_LEGR, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_KD_LEFT, ASSOC_PARTIAL | ASSOC_FRONTAL }, - { ANIM_KD_RIGHT, ASSOC_PARTIAL | ASSOC_FRONTAL }, - { ANIM_KO_SKID_FRONT, ASSOC_PARTIAL }, - { ANIM_KO_SPIN_R, ASSOC_PARTIAL }, - { ANIM_KO_SKID_BACK, ASSOC_PARTIAL | ASSOC_FRONTAL }, - { ANIM_KO_SPIN_L, ASSOC_PARTIAL }, - { ANIM_SHOT_FRONT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK }, - { ANIM_SHOT_LEFT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK }, - { ANIM_SHOT_BACK_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK }, - { ANIM_SHOT_RIGHT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK }, - { ANIM_HIT_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_HIT_LEFT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_HIT_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_HIT_RIGHT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FLOOR_HIT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_HIT_BODYBLOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_HIT_CHEST, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_HIT_HEAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_HIT_WALK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_HIT_WALL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_FLOOR_HIT_F, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_FRONTAL }, - { ANIM_HIT_BEHIND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FIGHT_IDLE, ASSOC_REPEAT }, - { ANIM_FIGHT2_IDLE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FIGHT_SH_F, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_FIGHT_BODYBLOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FIGHT_HEAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FIGHT_KICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FIGHT_KNEE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FIGHT_LHOOK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FIGHT_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FIGHT_ROUNDHOUSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_FIGHT_LONGKICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_FIGHT_PPUNCH, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_NOWALK }, - { ANIM_FIGHT_JAB, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FIGHT_ELBOW_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FIGHT_ELBOW_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FIGHT_BKICK_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FIGHT_BKICK_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_BOMBER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_PUNCH_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FIGHT_PPUNCH2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_KICK_FLOOR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_WEAPON_THROWU, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_FIGHT_SH_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_CAR_JACKED_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_CAR_LJACKED_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_CAR_JACKED_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_CAR_LJACKED_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_CAR_QJACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_QJACKED, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_CAR_ALIGN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_ALIGNHI_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_OPEN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_DOORLOCKED_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_PULLOUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_PULLOUT_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_GETIN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_GETIN_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_CLOSEDOOR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_CLOSEDOOR_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_ROLLDOOR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_ROLLDOOR_LOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_JUMPIN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_GETOUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_GETOUT_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_CLOSE_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_ALIGN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_ALIGNHI_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_OPEN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_DOORLOCKED_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_PULLOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_PULLOUT_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_GETIN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_GETIN_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_CLOSEDOOR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_CLOSEDOOR_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_SHUFFLE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_LSHUFFLE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_SIT, ASSOC_DELETEFADEDOUT}, - { ANIM_CAR_LSIT, ASSOC_DELETEFADEDOUT}, - { ANIM_CAR_SITP, ASSOC_DELETEFADEDOUT}, - { ANIM_CAR_SITPLO, ASSOC_DELETEFADEDOUT}, - { ANIM_DRIVE_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_DRIVE_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_DRIVE_LOW_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_DRIVE_LOW_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_DRIVEBY_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_DRIVEBY_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_DRIVEBY_LOW_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_DRIVEBY_LOW_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_CAR_LB, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_DRIVE_BOAT, ASSOC_DELETEFADEDOUT | ASSOC_DRIVING }, - { ANIM_DRIVE_BOAT_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_DRIVE_BOAT_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_BOAT_LB, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_BIKE_PICKUP_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_BIKE_PICKUP_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_BIKE_PULLUP_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_BIKE_PULLUP_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_BIKE_ELBOW_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_BIKE_ELBOW_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_BIKE_FALL_OFF, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_BIKE_FALL_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_CAR_GETOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_GETOUT_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_CLOSE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_HOOKERTALK, ASSOC_REPEAT | ASSOC_PARTIAL }, - { ANIM_TRAIN_GETIN, ASSOC_PARTIAL }, - { ANIM_TRAIN_GETOUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_CRAWLOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_CRAWLOUT_RHS2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_CAR_ROLLOUT_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION }, - { ANIM_CAR_ROLLOUT_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION }, - { ANIM_GETUP1, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_GETUP2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_GETUP3, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_GETUP_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_JUMP_LAUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_JUMP_GLIDE, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_JUMP_LAND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_FALL_FALL, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_FALL_GLIDE, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_FALL_LAND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_FALL_COLLAPSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_FALL_BACK, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_FALL_FRONT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_FRONTAL }, - { ANIM_EV_STEP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_EV_DIVE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL }, - { ANIM_XPRESS_SCRATCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, - { ANIM_ROAD_CROSS, ASSOC_REPEAT | ASSOC_PARTIAL }, - { ANIM_TURN_180, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_ARREST_GUN, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_DROWN, ASSOC_PARTIAL }, - { ANIM_DUCK_DOWN, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_DUCK_LOW, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_WEAPON_CROUCH, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_RBLOCK_CSHOOT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_HANDSUP, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_HANDSCOWER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_FUCKU, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK }, - { ANIM_PHONE_IN, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_PHONE_OUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_PHONE_TALK, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, - { ANIM_SEAT_DOWN, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_SEAT_UP, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_SEAT_IDLE, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_SEAT_DOWN2, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_ATM, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_ABSEIL, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, + { ANIM_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK }, + { ANIM_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK }, + { ANIM_SPRINT, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK }, + { ANIM_IDLE_STANCE, ASSOC_REPEAT }, + { ANIM_WALK_START, ASSOC_HAS_TRANSLATION }, + { ANIM_RUN_STOP, ASSOC_DELETEFADEDOUT | ASSOC_HAS_TRANSLATION }, + { ANIM_RUN_STOP_R, ASSOC_DELETEFADEDOUT | ASSOC_HAS_TRANSLATION }, + { ANIM_IDLE_CAM, ASSOC_REPEAT | ASSOC_PARTIAL }, + { ANIM_IDLE_HBHB, ASSOC_REPEAT | ASSOC_PARTIAL }, + { ANIM_IDLE_TIRED, ASSOC_REPEAT }, + { ANIM_IDLE_ARMED, ASSOC_REPEAT | ASSOC_PARTIAL }, + { ANIM_IDLE_CHAT, ASSOC_REPEAT | ASSOC_PARTIAL }, + { ANIM_IDLE_TAXI, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_KO_SHOT_FRONT1, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL }, + { ANIM_KO_SHOT_FRONT2, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL }, + { ANIM_KO_SHOT_FRONT3, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL }, + { ANIM_KO_SHOT_FRONT4, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL }, + { ANIM_KO_SHOT_FACE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_KO_SHOT_STOM, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL }, + { ANIM_KO_SHOT_ARML, ASSOC_PARTIAL | ASSOC_FRONTAL }, + { ANIM_KO_SHOT_ARMR, ASSOC_PARTIAL | ASSOC_FRONTAL }, + { ANIM_KO_SHOT_LEGL, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_KO_SHOT_LEGR, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_KD_LEFT, ASSOC_PARTIAL }, + { ANIM_KD_RIGHT, ASSOC_PARTIAL }, + { ANIM_KO_SKID_FRONT, ASSOC_PARTIAL }, + { ANIM_KO_SPIN_R, ASSOC_PARTIAL }, + { ANIM_KO_SKID_BACK, ASSOC_PARTIAL | ASSOC_FRONTAL }, + { ANIM_KO_SPIN_L, ASSOC_PARTIAL }, + { ANIM_SHOT_FRONT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK }, + { ANIM_SHOT_LEFT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK }, + { ANIM_SHOT_BACK_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK }, + { ANIM_SHOT_RIGHT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK }, + { ANIM_HIT_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_HIT_LEFT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_HIT_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_HIT_RIGHT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_FLOOR_HIT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, + { ANIM_HIT_WALL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_FLOOR_HIT_F, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_FRONTAL }, + { ANIM_HIT_BEHIND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_FIGHT_IDLE, ASSOC_REPEAT }, + { ANIM_FIGHT2_IDLE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_FIGHT_SH_F, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_FIGHT_PPUNCH, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_NOWALK }, + { ANIM_L_HOOK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_R_HOOK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_UPPERCUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_HEADBUTT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_FRONTKICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_ROUNDHOUSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_HIT_L_HOOK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_HIT_R_HOOK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_HIT_UPPERCUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_HIT_HEADBUTT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_HIT_FRONTKICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_HIT_RHOUSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_BOMBER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_PUNCH_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_FIGHT_PPUNCH2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_KICK_FLOOR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_WEAPON_THROWU, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_FIGHT_SH_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_CAR_JACKED_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, + { ANIM_CAR_LJACKED_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, + { ANIM_CAR_JACKED_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, + { ANIM_CAR_LJACKED_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, + { ANIM_CAR_QJACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_QJACKED, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, + { ANIM_CAR_ALIGN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_ALIGNHI_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_OPEN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_DOORLOCKED_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_PULLOUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_PULLOUT_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_GETIN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_GETIN_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_CLOSEDOOR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_CLOSEDOOR_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_ROLLDOOR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_ROLLDOOR_LOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_JUMPIN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_GETOUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_GETOUT_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_CLOSE_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_ALIGN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_ALIGNHI_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_OPEN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_DOORLOCKED_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_PULLOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_PULLOUT_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_GETIN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_GETIN_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_CLOSEDOOR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_CLOSEDOOR_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_SHUFFLE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_LSHUFFLE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_SIT, ASSOC_DELETEFADEDOUT }, + { ANIM_CAR_LSIT, ASSOC_DELETEFADEDOUT }, + { ANIM_CAR_SITP, ASSOC_DELETEFADEDOUT }, + { ANIM_CAR_SITPLO, ASSOC_DELETEFADEDOUT }, + { ANIM_DRIVE_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_DRIVE_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_DRIVE_LOW_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_DRIVE_LOW_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_DRIVEBY_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_DRIVEBY_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_DRIVEBY_LOW_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_DRIVEBY_LOW_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_CAR_LB, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_DRIVE_BOAT, ASSOC_DELETEFADEDOUT | ASSOC_DRIVING }, + { ANIM_DRIVE_BOAT_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_DRIVE_BOAT_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_BOAT_LB, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_BIKE_PICKUP_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_BIKE_PICKUP_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_BIKE_PULLUP_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_BIKE_PULLUP_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_BIKE_ELBOW_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_BIKE_ELBOW_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_BIKE_FALL_OFF, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_BIKE_FALL_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_CAR_GETOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_GETOUT_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_CLOSE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_HOOKERTALK, ASSOC_REPEAT | ASSOC_PARTIAL }, + { ANIM_TRAIN_GETIN, ASSOC_DELETEFADEDOUT }, + { ANIM_TRAIN_GETOUT, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE }, + { ANIM_CAR_CRAWLOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_CRAWLOUT_RHS2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CAR_ROLLOUT_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION | ASSOC_FRONTAL }, + { ANIM_CAR_ROLLOUT_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION | ASSOC_FRONTAL }, + { ANIM_GETUP1, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_GETUP2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_GETUP3, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_GETUP_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_JUMP_LAUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_JUMP_GLIDE, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, + { ANIM_JUMP_LAND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_FALL_FALL, ASSOC_DELETEFADEDOUT }, + { ANIM_FALL_GLIDE, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, + { ANIM_FALL_LAND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_FALL_COLLAPSE, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_FALL_BACK, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, + { ANIM_FALL_FRONT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_FRONTAL }, + { ANIM_EV_STEP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_EV_DIVE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL }, + { ANIM_COMMANDO_ROLL, ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL }, + { ANIM_XPRESS_SCRATCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_ROAD_CROSS, ASSOC_REPEAT | ASSOC_PARTIAL }, + { ANIM_TURN_180, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_ARREST_GUN, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_DROWN, ASSOC_PARTIAL }, + { ANIM_DUCK_DOWN, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, + { ANIM_DUCK_LOW, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, + { ANIM_WEAPON_CROUCH, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, + { ANIM_RBLOCK_CSHOOT, ASSOC_RUNNING }, + { ANIM_HANDSUP, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_HANDSCOWER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_FUCKU, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK }, + { ANIM_PHONE_IN, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_PHONE_OUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_PHONE_TALK, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, + { ANIM_SEAT_DOWN, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_SEAT_UP, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_SEAT_IDLE, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_SEAT_DOWN2, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_ATM, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_ABSEIL, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL }, }; AnimAssocDesc aVanAnimDescs[] = { - { ANIM_VAN_OPEN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_VAN_GETIN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_VAN_CLOSE_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_VAN_GETOUT_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_VAN_OPEN, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_VAN_GETIN, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_VAN_CLOSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_VAN_GETOUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_VAN_OPEN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_VAN_GETIN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_VAN_CLOSE_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_VAN_GETOUT_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_VAN_OPEN, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_VAN_GETIN, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_VAN_CLOSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_VAN_GETOUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, }; AnimAssocDesc aCoachAnimDescs[] = { - { ANIM_COACH_OPEN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_COACH_OPEN_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_COACH_IN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_COACH_IN_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_COACH_OUT_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_COACH_OPEN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_COACH_OPEN_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_COACH_IN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_COACH_IN_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_COACH_OUT_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, }; AnimAssocDesc aBikeAnimDescs[] = { - { ANIM_BIKE_RIDE, ASSOC_DELETEFADEDOUT}, - { ANIM_BIKE_STILL, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_BIKE_LEFT, ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_BIKE_RIGHT, ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_BIKE_BACK, ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_BIKE_FWD, ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_BIKE_PUSHES, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_BIKE_JUMPON_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_BIKE_JUMPON_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_BIKE_KICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_BIKE_HIT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_BIKE_GETOFF_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_BIKE_GETOFF_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_BIKE_GETOFF_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, - { ANIM_BIKE_DRIVEBY_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_BIKE_DRIVEBY_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_BIKE_DRIVEBY_FT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, - { ANIM_BIKE_PASSENGER, ASSOC_DELETEFADEDOUT | ASSOC_DRIVING }, + { ANIM_BIKE_RIDE, ASSOC_DELETEFADEDOUT }, + { ANIM_BIKE_STILL, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_BIKE_LEFT, ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_BIKE_RIGHT, ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_BIKE_BACK, ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_BIKE_FWD, ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_BIKE_PUSHES, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_BIKE_JUMPON_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_BIKE_JUMPON_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_BIKE_KICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_BIKE_HIT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_BIKE_GETOFF_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_BIKE_GETOFF_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_BIKE_GETOFF_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_BIKE_DRIVEBY_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_BIKE_DRIVEBY_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_BIKE_DRIVEBY_FT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING }, + { ANIM_BIKE_PASSENGER, ASSOC_DELETEFADEDOUT | ASSOC_DRIVING }, }; AnimAssocDesc aMeleeAnimDescs[] = { - { ANIM_MELEE_ATTACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_MELEE_ATTACK_2ND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_MELEE_ATTACK_START, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK }, - { ANIM_MELEE_IDLE_FIGHTMODE, ASSOC_REPEAT }, - { ANIM_MELEE_ATTACK_FINISH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, + { ANIM_MELEE_ATTACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_MELEE_ATTACK_2ND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_MELEE_ATTACK_START, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK }, + { ANIM_MELEE_IDLE_FIGHTMODE, ASSOC_REPEAT }, + { ANIM_MELEE_ATTACK_FINISH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION }, }; AnimAssocDesc aSwingAnimDescs[] = { - { ANIM_MELEE_ATTACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_MELEE_ATTACK_2ND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_MELEE_ATTACK_START, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_MELEE_IDLE_FIGHTMODE, ASSOC_REPEAT }, - { ANIM_MELEE_ATTACK_FINISH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_MELEE_ATTACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_MELEE_ATTACK_2ND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_MELEE_ATTACK_START, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_MELEE_IDLE_FIGHTMODE, ASSOC_REPEAT }, + { ANIM_MELEE_ATTACK_FINISH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, }; AnimAssocDesc aWeaponAnimDescs[] = { - { ANIM_WEAPON_FIRE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_WEAPON_CROUCHFIRE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_WEAPON_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_WEAPON_CROUCHRELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_WEAPON_SPECIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_WEAPON_FIRE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_WEAPON_CROUCHFIRE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_WEAPON_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_WEAPON_CROUCHRELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, }; AnimAssocDesc aMedicAnimDescs[] = { - { ANIM_CPR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_CPR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, }; AnimAssocDesc aSunbatheAnimDescs[] = { - { ANIM_SUNBATHE, ASSOC_REPEAT | ASSOC_PARTIAL }, - { ANIM_SUNBATHE_DOWN, ASSOC_REPEAT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION }, - { ANIM_SUNBATHE_UP, ASSOC_REPEAT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION }, - { ANIM_SUNBATHE_ESCAPE, ASSOC_REPEAT | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION }, + { ANIM_SUNBATHE, ASSOC_REPEAT | ASSOC_PARTIAL }, + { ANIM_SUNBATHE_DOWN, ASSOC_HAS_X_TRANSLATION | ASSOC_HAS_TRANSLATION | ASSOC_PARTIAL }, + { ANIM_SUNBATHE_UP, ASSOC_HAS_X_TRANSLATION | ASSOC_HAS_TRANSLATION | ASSOC_PARTIAL }, + { ANIM_SUNBATHE_ESCAPE, ASSOC_HAS_X_TRANSLATION | ASSOC_HAS_TRANSLATION | ASSOC_PARTIAL }, }; AnimAssocDesc aPlayerIdleAnimDescs[] = { - { ANIM_IDLE_STRETCH, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_IDLE_TIME, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_IDLE_SHOULDER, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_IDLE_STRETCH_LEG, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_IDLE_STRETCH, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_IDLE_TIME, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_IDLE_SHOULDER, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_IDLE_STRETCH_LEG, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, }; AnimAssocDesc aRiotAnimDescs[] = { - { ANIM_RIOT_ANGRY, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_RIOT_ANGRY_B, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_RIOT_CHANT, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_RIOT_PUNCHES, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_RIOT_SHOUT, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_RIOT_CHALLENGE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_RIOT_FUKU, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_RIOT_ANGRY, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_RIOT_ANGRY_B, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_RIOT_CHANT, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_RIOT_PUNCHES, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_RIOT_SHOUT, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_RIOT_CHALLENGE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_RIOT_FUKU, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, }; AnimAssocDesc aStripAnimDescs[] = { - { ANIM_STRIP_A, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_STRIP_B, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_STRIP_C, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_STRIP_D, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_STRIP_E, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_STRIP_F, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, - { ANIM_STRIP_G, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, -}; -#ifdef PC_PLAYER_CONTROLS + { ANIM_STRIP_A, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_STRIP_B, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_STRIP_C, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_STRIP_D, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_STRIP_E, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_STRIP_F, ASSOC_REPEAT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, + { ANIM_STRIP_G, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL }, +}; AnimAssocDesc aStdAnimDescsSide[] = { - { ANIM_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION | ASSOC_WALK }, - { ANIM_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION | ASSOC_WALK }, - { ANIM_SPRINT, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION | ASSOC_WALK }, - { ANIM_IDLE_STANCE, ASSOC_REPEAT }, - { ANIM_WALK_START, ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION }, + { ANIM_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION | ASSOC_WALK }, + { ANIM_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION | ASSOC_WALK }, + { ANIM_SPRINT, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION | ASSOC_WALK }, + { ANIM_IDLE_STANCE, ASSOC_REPEAT }, + { ANIM_WALK_START, ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION }, +}; +AnimAssocDesc aMPNoteAnimDescs[] = { + { ANIM_MPNOTE, ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_MPNOTE_LOOP, ASSOC_REPEAT | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aCSMiscAnimDescs[] = { + { ANIM_IDLE_LOOK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_IDLE_NO, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_IDLE_YES, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_IDLE_CHAT2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_IDLE_COUGH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_IDLE_GIGGLE_FEMALE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_IDLE_TOUGH_CHAT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_IDLE_CELL_TALK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aDONH2AnimDescs[] = { + { ANIM_DONH2_CAMERA, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aDONH3AnimDescs[] = { + { ANIM_DONH3_HAPPY, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aJDT2AnimDescs[] = { + { ANIM_JDT2_ANXIOUS_TALK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_JDT2_SHRUG, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aJDT4AnimDescs[] = { + { ANIM_JDT4_DILDO_TALK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aJDT5AnimDescs[] = { + { ANIM_JDT5_CALM_DOWN, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_JDT5_POINT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aJDT6AnimDescs[] = { + { ANIM_JDT6_PICKUP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_JDT6_DOORKNOCK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aMAR1AnimDescs[] = { + { ANIM_MAR1_SKIRT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aMAR2AnimDescs[] = { + { ANIM_MAR2_CELL_ANSWER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_MAR2_CELL_END, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_MAR2_CELL_TALK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_MAR2_FOOT_TAP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aMAR3AnimDescs[] = { + { ANIM_MAR3_HOOCHY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_MAR3_NOTE_IDLE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_MAR3_NOTE_PICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aSAL1AnimDescs[] = { + { ANIM_SAL1_BIREFCASE_DOWN, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aSAL2AnimDescs[] = { + { ANIM_SAL2_IDLE_SEATED, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_SAL2_SEAT_TO_STAND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aSAL3AnimDescs[] = { + { ANIM_SAL3_SEATED_TALK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_SAL3_SEATED_IDLE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_SAL3_SIT_DOWN, ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aSAL4AnimDescs[] = { + { ANIM_SAL4_DUSTDOWN, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_SAL4_GIRLRUN, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aSAL6AnimDescs[] = { + { ANIM_SAL6_ANGRY_SEATED, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_SAL6_IDLE_SEATED, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aSAL7AnimDescs[] = { + { ANIM_SAL7_LOOKOUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aVIC2AnimDescs[] = { + { ANIM_VIC2_POINT_ANGRY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aVIC3AnimDescs[] = { + { ANIM_VIC3_WAFT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_VIC3_PICKUP_ROLL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aVIC4AnimDescs[] = { + { ANIM_VIC4_CARRY_BOX, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_VIC4_CELL_LOOK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_VIC4_CRATE_IDLE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aVIC6AnimDescs[] = { + { ANIM_VIC6_CELL_ANGRY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aTouristAnimDescs[] = { + { ANIM_TOURIST3, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_TOURIST2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, + { ANIM_TOURIST1, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aMAC2AnimDescs[] = { + { ANIM_MAC2_PLEAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, +}; +AnimAssocDesc aVIC7AnimDescs[] = { + { ANIM_VIC7_PROD_WITH_FOOT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE }, }; -#endif -char const* aStdAnimations[] = { + +char const *aStdAnimations[] = { "walk_civi", "run_civi", "sprint_panic", @@ -320,8 +412,8 @@ char const* aStdAnimations[] = { "KO_shot_armR", "KO_shot_legl", "KO_shot_legR", - "KD_left", - "KD_right", + "BIKE_fall_off", + "BIKE_fall_off", "KO_skid_front", "KO_spin_R", "KO_skid_back", @@ -335,30 +427,28 @@ char const* aStdAnimations[] = { "HIT_back", "HIT_R", "FLOOR_hit", - "HIT_bodyblow", - "HIT_chest", - "HIT_head", - "HIT_walk", + "HIT_wall", "FLOOR_hit_f", "HIT_behind", "FIGHTIDLE", "FIGHT2IDLE", "FIGHTsh_F", - "FIGHTbodyblow", - "FIGHThead", - "FIGHTkick", - "FIGHTknee", - "FIGHTLhook", - "FIGHTpunch", - "FIGHTrndhse", - "FIGHTlngkck", "FIGHTppunch", - "FIGHTjab", - "FIGHTelbowL", - "FIGHTelbowR", - "FIGHTbkickL", - "FIGHTbkickR", + + "l_hook", + "r_hook", + "uppercut", + "headbutt", + "frontkick", + "roundhouse", + "hit_l_hook", + "hit_r_hook", + "hit_uppercut", + "hit_headbutt", + "hit_frontkick", + "hit_rhouse", + "bomber", "punchR", "FIGHTppunch", @@ -428,12 +518,13 @@ char const* aStdAnimations[] = { "CAR_getoutL_RHS", "CAR_close_RHS", "car_hookertalk", - "idle_stance", - "idle_stance", + + "TRAIN_getin", + "TRAIN_getout", "CAR_crawloutRHS", "CAR_crawloutRHS", "CAR_rollout_LHS", - "CAR_rollout_LHS", + "CAR_rollout_RHS", "Getup", "Getup", "Getup", @@ -449,6 +540,8 @@ char const* aStdAnimations[] = { "FALL_front", "EV_step", "EV_dive", + + "commando_roll", "XPRESSscratch", "roadcross", "TURN_180", @@ -471,7 +564,7 @@ char const* aStdAnimations[] = { "ATM", "abseil", }; -char const* aVanAnimations[] = { +char const *aVanAnimations[] = { "VAN_openL", "VAN_getinL", "VAN_closeL", @@ -481,14 +574,14 @@ char const* aVanAnimations[] = { "VAN_close", "VAN_getout", }; -char const* aCoachAnimations[] = { +char const *aCoachAnimations[] = { "COACH_opnL", - "COACH_opnL", - "COACH_inL", + "COACH_opnR", "COACH_inL", + "COACH_inR", "COACH_outL", }; -char const* aBikesAnimations[] = { +char const *aBikesAnimations[] = { "BIKEs_Ride", "BIKEs_Still", "BIKEs_Left", @@ -508,7 +601,7 @@ char const* aBikesAnimations[] = { "BIKEs_drivebyFT", "BIKEs_passenger", }; -char const* aBikevAnimations[] = { +char const *aBikevAnimations[] = { "BIKEv_Ride", "BIKEv_Still", "BIKEv_Left", @@ -528,7 +621,7 @@ char const* aBikevAnimations[] = { "BIKEv_drivebyFT", "BIKEv_passenger", }; -char const* aBikehAnimations[] = { +char const *aBikehAnimations[] = { "BIKEh_Ride", "BIKEh_Still", "BIKEh_Left", @@ -548,7 +641,7 @@ char const* aBikehAnimations[] = { "BIKEh_drivebyFT", "BIKEh_passenger", }; -char const* aBikedAnimations[] = { +char const *aBikedAnimations[] = { "BIKEd_Ride", "BIKEd_Still", "BIKEd_Left", @@ -568,115 +661,123 @@ char const* aBikedAnimations[] = { "BIKEd_drivebyFT", "BIKEd_passenger", }; -char const* aUnarmedAnimations[] = { +char const *aUnarmedAnimations[] = { "punchR", "KICK_floor", "FIGHTppunch", }; -char const* aScrewdriverAnimations[] = { - "FIGHTbodyblow", - "FIGHTbodyblow", +char const *aScrewdriverAnimations[] = { + "r_hook", + "r_hook", "FIGHTppunch", "FIGHTIDLE", - "FIGHTbodyblow", + "r_hook", }; -char const* aKnifeAnimations[] = { +char const *aKnifeAnimations[] = { "WEAPON_knife_1", "WEAPON_knife_2", "knife_part", "WEAPON_knifeidle", "WEAPON_knife_3", }; -char const* aBaseballbatAnimations[] = { +char const *aBaseballbatAnimations[] = { "WEAPON_bat_h", "WEAPON_bat_v", "BAT_PART", "WEAPON_bat_h", "WEAPON_golfclub", }; -char const* aGolfclubAnimations[] = { +char const *aGolfclubAnimations[] = { "WEAPON_bat_h", "WEAPON_golfclub", "BAT_PART", "WEAPON_bat_h", "WEAPON_bat_v", }; -char const* aChainsawAnimations[] = { +char const *aChainsawAnimations[] = { "WEAPON_csaw", "WEAPON_csawlo", "csaw_part", }; -char const* aPythonAnimations[] = { +char const *aPythonAnimations[] = { "python_fire", "python_crouchfire", "python_reload", "python_crouchreload", }; -char const* aColtAnimations[] = { +char const *aColtAnimations[] = { "colt45_fire", "colt45_crouchfire", "colt45_reload", "colt45_crouchreload", "colt45_cop", }; -char const* aShotgunAnimations[] = { +char const *aShotgunAnimations[] = { "shotgun_fire", "shotgun_crouchfire", }; -char const* aBuddyAnimations[] = { +char const *aBuddyAnimations[] = { "buddy_fire", "buddy_crouchfire", + "buddy_reload", }; -char const* aTecAnimations[] = { +char const *aTecAnimations[] = { "TEC_fire", "TEC_crouchfire", "TEC_reload", "TEC_crouchreload", }; -char const* aUziAnimations[] = { +char const *aUziAnimations[] = { "UZI_fire", "UZI_crouchfire", "UZI_reload", "UZI_crouchreload", }; -char const* aRifleAnimations[] = { +char const *aRifleAnimations[] = { "RIFLE_fire", "RIFLE_crouchfire", "RIFLE_load", "RIFLE_crouchload", }; -char const* aM60Animations[] = { +char const *aM60Animations[] = { "M60_fire", "M60_fire", "M60_reload", }; -char const* aSniperAnimations[] = { - "WEAPON_sniper", +char const *aSniperAnimations[] = { + "sniper_fire", + "sniper_fire", + "sniper_reload", }; -char const* aThrowAnimations[] = { +char const *aThrowAnimations[] = { "WEAPON_throw", "WEAPON_throwu", "WEAPON_start_throw", }; -char const* aFlamethrowerAnimations[] = { +char const *aFlamethrowerAnimations[] = { "FLAME_fire", }; -char const* aMedicAnimations[] = { +char const *aRocketLauncherAnimations[] = { + "rocket_fire", + "rocket_fire", + "rocket_reload", +}; +char const *aMedicAnimations[] = { "CPR", }; -char const* aSunbatheAnimations[] = { +char const *aSunbatheAnimations[] = { "bather", "batherdown", "batherup", "batherscape", }; -char const* aPlayerIdleAnimations[] = { +char const *aPlayerIdleAnimations[] = { "stretch", "time", "shldr", "strleg", }; -char const* aRiotAnimations[] = { +char const *aRiotAnimations[] = { "riot_angry", "riot_angry_b", "riot_chant", @@ -685,7 +786,7 @@ char const* aRiotAnimations[] = { "riot_challenge", "riot_fuku", }; -char const* aStripAnimations[] = { +char const *aStripAnimations[] = { "strip_A", "strip_B", "strip_C", @@ -694,212 +795,287 @@ char const* aStripAnimations[] = { "strip_F", "strip_G", }; -char const* aLanceAnimations[] = { +char const *aLanceAnimations[] = { "lance", }; -char const* aPlayerAnimations[] = { +char const *aPlayerAnimations[] = { "walk_player", "run_player", "SPRINT_civi", "IDLE_STANCE", "walk_start", }; -char const* aPlayerWithRocketAnimations[] = { +char const *aPlayerWithRocketAnimations[] = { "walk_rocket", "run_rocket", - "run_rocket", + "sprint_rocket", "idle_rocket", "walk_start_rocket", }; -char const* aPlayer1ArmedAnimations[] = { +char const *aPlayer1ArmedAnimations[] = { "walk_player", "run_1armed", "SPRINT_civi", "IDLE_STANCE", "walk_start", }; -char const* aPlayer2ArmedAnimations[] = { +char const *aPlayer2ArmedAnimations[] = { "walk_armed", "run_armed", - "run_armed", + "playersprint_armed", "idle_armed", "walk_start_armed", }; -char const* aPlayerBBBatAnimations[] = { - "walk_player", - "run_player", - "run_player", - "IDLE_STANCE", - "walk_start", +char const *aAIChainsawAnimations[] = { + "walk_aicsaw", + "run_aicsaw", + "run_aicsaw", + "IDLE_csaw", + "walk_start_aicsaw", }; -char const* aPlayerChainsawAnimations[] = { +char const *aPlayerChainsawAnimations[] = { "walk_csaw", "run_csaw", - "run_csaw", + "sprint_csaw", "IDLE_csaw", "walk_start_csaw", }; -char const* aShuffleAnimations[] = { +char const *aShuffleAnimations[] = { "WALK_shuffle", "RUN_civi", "SPRINT_civi", "IDLE_STANCE", }; -char const* aOldAnimations[] = { +char const *aOldAnimations[] = { "walk_old", "run_civi", "sprint_civi", "idle_stance", }; -char const* aGang1Animations[] = { +char const *aGang1Animations[] = { "walk_gang1", "run_gang1", "sprint_civi", "idle_stance", }; -char const* aGang2Animations[] = { +char const *aGang2Animations[] = { "walk_gang2", "run_gang1", "sprint_civi", "idle_stance", }; -char const* aFatAnimations[] = { +char const *aFatAnimations[] = { "walk_fat", "run_civi", "woman_runpanic", "idle_stance", }; -char const* aOldFatAnimations[] = { +char const *aOldFatAnimations[] = { "walk_fatold", "run_fatold", "woman_runpanic", "idle_stance", }; -char const* aJoggerAnimations[] = { +char const *aJoggerAnimations[] = { "JOG_maleA", "run_civi", "sprint_civi", "idle_stance", }; -char const* aStdWomanAnimations[] = { +char const *aStdWomanAnimations[] = { "woman_walknorm", "woman_run", "woman_runpanic", "woman_idlestance", }; -char const* aWomanShopAnimations[] = { +char const *aWomanShopAnimations[] = { "woman_walkshop", "woman_run", "woman_run", "woman_idlestance", }; -char const* aBusyWomanAnimations[] = { +char const *aBusyWomanAnimations[] = { "woman_walkbusy", "woman_run", "woman_runpanic", "woman_idlestance", }; -char const* aSexyWomanAnimations[] = { +char const *aSexyWomanAnimations[] = { "woman_walksexy", "woman_run", "woman_runpanic", "woman_idlestance", }; -char const* aFatWomanAnimations[] = { +char const *aFatWomanAnimations[] = { "walk_fat", "woman_run", "woman_runpanic", "woman_idlestance", }; -char const* aOldWomanAnimations[] = { +char const *aOldWomanAnimations[] = { "woman_walkold", "woman_run", "woman_runpanic", "woman_idlestance", }; -char const* aJoggerWomanAnimations[] = { +char const *aJoggerWomanAnimations[] = { "JOG_maleB", "woman_run", "woman_runpanic", "woman_idlestance", }; -char const* aPanicChunkyAnimations[] = { +char const *aPanicChunkyAnimations[] = { "run_fatold", "woman_runpanic", "woman_runpanic", "idle_stance", }; -char const* aSkateAnimations[] = { +char const *aSkateAnimations[] = { "skate_run", "skate_sprint", "skate_sprint", "skate_idle", }; -#ifdef PC_PLAYER_CONTROLS -char const* aPlayerStrafeBackAnimations[] = { +char const *aPlayerStrafeBackAnimations[] = { "walk_back", "run_back", "run_back", "IDLE_STANCE", "walk_start_back", }; -char const* aPlayerStrafeLeftAnimations[] = { +char const *aPlayerStrafeLeftAnimations[] = { "walk_left", "run_left", "run_left", "IDLE_STANCE", "walk_start_left", }; -char const* aPlayerStrafeRightAnimations[] = { +char const *aPlayerStrafeRightAnimations[] = { "walk_right", "run_right", "run_right", "IDLE_STANCE", "walk_start_right", }; -char const* aRocketStrafeBackAnimations[] = { +char const *aRocketStrafeBackAnimations[] = { "walk_rocket_back", "run_rocket_back", "run_rocket_back", "idle_rocket", "walkst_rocket_back", }; -char const* aRocketStrafeLeftAnimations[] = { +char const *aRocketStrafeLeftAnimations[] = { "walk_rocket_left", "run_rocket_left", "run_rocket_left", "idle_rocket", "walkst_rocket_left", }; -char const* aRocketStrafeRightAnimations[] = { +char const *aRocketStrafeRightAnimations[] = { "walk_rocket_right", "run_rocket_right", "run_rocket_right", "idle_rocket", "walkst_rocket_right", }; -char const* aChainsawStrafeBackAnimations[] = { - "walk_csaw_back", - "run_csaw_back", - "run_csaw_back", - "idle_csaw", - "walkst_csaw_back", -}; -char const* aChainsawStrafeLeftAnimations[] = { - "walk_csaw_left", - "run_csaw_left", - "run_csaw_left", - "idle_csaw", - "walkst_csaw_left", -}; -char const* aChainsawStrafeRightAnimations[] = { - "walk_csaw_right", - "run_csaw_right", - "run_csaw_right", - "idle_csaw", - "walkst_csaw_right", +char const *aMPNoteAnimations[] = { + "MPNote", + "MPNoteloop", +}; +char const *aCSMiscAnimations[] = { + "IDLE_look", + "IDLE_no", + "IDLE_yes", + "IDLE_chat2", + "IDLE_cough", + "IDLE_giggle_female", + "IDLE_tough_chat", + "IDLE_cell_talk", +}; +char const *aDONH2Animations[] = { + "DONH2_camera", +}; +char const *aDONH3Animations[] = { + "DONH3_happy", +}; +char const *aJDT2Animations[] = { + "JDT2_anxious_talk", + "JDT2_shrug", +}; +char const *aJDT4Animations[] = { + "JDT4_dildo_talk", +}; +char const *aJDT5Animations[] = { + "JDT5_calm_down", + "JDT5_point", +}; +char const *aJDT6Animations[] = { + "JDT6_pickup", + "JDT6_doorknock", +}; +char const *aMAR1Animations[] = { + "MAR1_skirt", +}; +char const *aMAR2Animations[] = { + "MAR2_cell_answer", + "MAR2_cell_end", + "MAR2_cell_talk", + "MAR2_foot_tap", +}; +char const *aMAR3Animations[] = { + "MAR3_hoochy", + "MAR3_note_idle", + "MAR3_note_pick", +}; +char const *aSAL1Animations[] = { + "SAL1_briefcase_down", +}; +char const *aSAL2Animations[] = { + "SAL2_idle_seated", + "SAL2_seat_to_stand", +}; +char const *aSAL3Animations[] = { + "SAL3_seated_talk", + "SAL3_seated_idle", + "SAL3_sit_down", +}; +char const *aSAL4Animations[] = { + "SAL4_dustdown", + "SAL4_girlrun", +}; +char const *aSAL6Animations[] = { + "SAL6_angry_seated", + "SAL6_idle_seated", +}; +char const *aSAL7Animations[] = { + "SAL7_lookout", +}; +char const *aVIC2Animations[] = { + "VIC2_point_angry", +}; +char const *aVIC3Animations[] = { + "VIC3_waft", + "VIC3_pickup_roll", +}; +char const *aVIC4Animations[] = { + "VIC4_carry_box", + "VIC4_cell_look", + "VIC4_crate_idle", +}; +char const *aVIC6Animations[] = { + "VIC6_cell_angry", +}; +char const *aTouristAnimations[] = { + "tourist3", + "tourist2", + "tourist1", +}; +char const *aMAC2Animations[] = { + "MAC2_plead", +}; +char const *aVIC7Animations[] = { + "VIC7_prod_with_foot", }; -#endif #define awc(a) ARRAY_SIZE(a), a const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_GROUPS] = { @@ -927,6 +1103,7 @@ const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_ { "sniper", "sniper", MI_COP, awc(aSniperAnimations), aWeaponAnimDescs }, { "grenade", "grenade", MI_COP, awc(aThrowAnimations), aWeaponAnimDescs }, { "flame", "flame", MI_COP, awc(aFlamethrowerAnimations), aWeaponAnimDescs }, + { "rocketla", "rocketla", MI_COP, awc(aRocketLauncherAnimations), aWeaponAnimDescs }, { "medic", "medic", MI_COP, awc(aMedicAnimations), aMedicAnimDescs }, { "sunbathe", "sunbathe", MI_COP, 1, aSunbatheAnimations, aSunbatheAnimDescs }, // NB: not using awc here! { "playidles", "playidles", MI_COP, awc(aPlayerIdleAnimations), aPlayerIdleAnimDescs }, @@ -937,7 +1114,8 @@ const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_ { "playerrocket", "ped", MI_COP, awc(aPlayerWithRocketAnimations), aStdAnimDescs }, { "player1armed", "ped", MI_COP, awc(aPlayer1ArmedAnimations), aStdAnimDescs }, { "player2armed", "ped", MI_COP, awc(aPlayer2ArmedAnimations), aStdAnimDescs }, - { "playerBBBat", "ped", MI_COP, awc(aPlayerBBBatAnimations), aStdAnimDescs }, + { "playerBBBat", "ped", MI_COP, awc(aPlayer1ArmedAnimations), aStdAnimDescs }, + { "aicsaw2", "ped", MI_COP, awc(aAIChainsawAnimations), aStdAnimDescs }, { "playercsaw", "ped", MI_COP, awc(aPlayerChainsawAnimations), aStdAnimDescs }, { "shuffle", "ped", MI_COP, awc(aShuffleAnimations), aStdAnimDescs }, { "oldman", "ped", MI_COP, awc(aOldAnimations), aStdAnimDescs }, @@ -955,17 +1133,39 @@ const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_ { "jogwoman", "ped", MI_COP, awc(aJoggerWomanAnimations), aStdAnimDescs }, { "panicchunky", "ped", MI_COP, awc(aPanicChunkyAnimations), aStdAnimDescs }, { "skate", "skate", MI_COP, awc(aSkateAnimations), aStdAnimDescs }, -#ifdef PC_PLAYER_CONTROLS +#ifdef PC_PLAYER_CONTROLS // strangely enabled even on PS2 { "playerback", "ped", MI_COP, awc(aPlayerStrafeBackAnimations), aStdAnimDescs }, { "playerleft", "ped", MI_COP, awc(aPlayerStrafeLeftAnimations), aStdAnimDescsSide }, { "playerright", "ped", MI_COP, awc(aPlayerStrafeRightAnimations), aStdAnimDescsSide }, { "rocketback", "ped", MI_COP, awc(aRocketStrafeBackAnimations), aStdAnimDescs }, { "rocketleft", "ped", MI_COP, awc(aRocketStrafeLeftAnimations), aStdAnimDescsSide }, { "rocketright", "ped", MI_COP, awc(aRocketStrafeRightAnimations), aStdAnimDescsSide }, - { "csawback", "ped", MI_COP, awc(aChainsawStrafeBackAnimations), aStdAnimDescs }, - { "csawleft", "ped", MI_COP, awc(aChainsawStrafeLeftAnimations), aStdAnimDescsSide }, - { "csawright", "ped", MI_COP, awc(aChainsawStrafeRightAnimations), aStdAnimDescsSide }, #endif + + { "MPNote", "MPNote", MI_COP, awc(aMPNoteAnimations), aMPNoteAnimDescs }, + { "CS_MISC", "CS_MISC", MI_COP, awc(aCSMiscAnimations), aCSMiscAnimDescs }, + { "DONH2", "DONH2", MI_COP, awc(aDONH2Animations), aDONH2AnimDescs }, + { "DONH3", "DONH3", MI_COP, awc(aDONH3Animations), aDONH3AnimDescs }, + { "JDT2", "JDT2", MI_COP, awc(aJDT2Animations), aJDT2AnimDescs }, + { "JDT4", "JDT4", MI_COP, awc(aJDT4Animations), aJDT4AnimDescs }, + { "JDT5", "JDT5", MI_COP, awc(aJDT5Animations), aJDT5AnimDescs }, + { "JDT6", "JDT6", MI_COP, awc(aJDT6Animations), aJDT6AnimDescs }, + { "MAR1", "MAR1", MI_COP, awc(aMAR1Animations), aMAR1AnimDescs }, + { "MAR2", "MAR2", MI_COP, awc(aMAR2Animations), aMAR2AnimDescs }, + { "MAR3", "MAR3", MI_COP, awc(aMAR3Animations), aMAR3AnimDescs }, + { "SAL1", "SAL1", MI_COP, awc(aSAL1Animations), aSAL1AnimDescs }, + { "SAL2", "SAL2", MI_COP, awc(aSAL2Animations), aSAL2AnimDescs }, + { "SAL3", "SAL3", MI_COP, awc(aSAL3Animations), aSAL3AnimDescs }, + { "SAL4", "SAL4", MI_COP, awc(aSAL4Animations), aSAL4AnimDescs }, + { "SAL6", "SAL6", MI_COP, awc(aSAL6Animations), aSAL6AnimDescs }, + { "SAL7", "SAL7", MI_COP, awc(aSAL7Animations), aSAL7AnimDescs }, + { "VIC2", "VIC2", MI_COP, awc(aVIC2Animations), aVIC2AnimDescs }, + { "VIC3", "VIC3", MI_COP, awc(aVIC3Animations), aVIC3AnimDescs }, + { "VIC4", "VIC4", MI_COP, awc(aVIC4Animations), aVIC4AnimDescs }, + { "VIC6", "VIC6", MI_COP, awc(aVIC6Animations), aVIC6AnimDescs }, + { "TOURIST", "TOURIST", MI_COP, awc(aTouristAnimations), aTouristAnimDescs }, + { "MAC2", "MAC2", MI_COP, awc(aMAC2Animations), aMAC2AnimDescs }, + { "VIC7", "VIC7", MI_COP, awc(aVIC7Animations), aVIC7AnimDescs }, }; #undef awc diff --git a/src/animation/AnimManager.h b/src/animation/AnimManager.h index 213326b6..9f556b54 100644 --- a/src/animation/AnimManager.h +++ b/src/animation/AnimManager.h @@ -29,6 +29,7 @@ enum AssocGroupId ASSOCGRP_SNIPER, ASSOCGRP_THROW, ASSOCGRP_FLAMETHROWER, + ASSOCGRP_ROCKETLAUNCHER, ASSOCGRP_MEDIC, ASSOCGRP_SUNBATHE, ASSOCGRP_PLAYER_IDLE, @@ -40,6 +41,7 @@ enum AssocGroupId ASSOCGRP_PLAYER1ARMED, ASSOCGRP_PLAYER2ARMED, ASSOCGRP_PLAYERBBBAT, + ASSOCGRP_AICHAINSAW, ASSOCGRP_PLAYERCHAINSAW, ASSOCGRP_SHUFFLE, ASSOCGRP_OLD, @@ -64,11 +66,33 @@ enum AssocGroupId ASSOCGRP_ROCKETBACK, ASSOCGRP_ROCKETLEFT, ASSOCGRP_ROCKETRIGHT, - ASSOCGRP_CHAINSAWBACK, - ASSOCGRP_CHAINSAWLEFT, - ASSOCGRP_CHAINSAWRIGHT, #endif + ASSOCGRP_MPNOTE, + ASSOCGRP_CSMISC, + ASSOCGRP_DONH2, + ASSOCGRP_DONH3, + ASSOCGRP_JDT2, + ASSOCGRP_JDT4, + ASSOCGRP_JDT5, + ASSOCGRP_JDT6, + ASSOCGRP_MAR1, + ASSOCGRP_MAR2, + ASSOCGRP_MAR3, + ASSOCGRP_SAL1, + ASSOCGRP_SAL2, + ASSOCGRP_SAL3, + ASSOCGRP_SAL4, + ASSOCGRP_SAL6, + ASSOCGRP_SAL7, + ASSOCGRP_VIC2, + ASSOCGRP_VIC3, + ASSOCGRP_VIC4, + ASSOCGRP_VIC6, + ASSOCGRP_TOURIST, + ASSOCGRP_MAC2, + ASSOCGRP_VIC7, + NUM_ANIM_ASSOC_GROUPS }; diff --git a/src/animation/AnimationId.h b/src/animation/AnimationId.h index cf8b9fe0..7e3234ab 100644 --- a/src/animation/AnimationId.h +++ b/src/animation/AnimationId.h @@ -40,32 +40,25 @@ enum AnimationId ANIM_HIT_BACK, ANIM_HIT_RIGHT, ANIM_FLOOR_HIT, - ANIM_HIT_BODYBLOW, - ANIM_HIT_CHEST, - ANIM_HIT_HEAD, - ANIM_HIT_WALK, ANIM_HIT_WALL, ANIM_FLOOR_HIT_F, ANIM_HIT_BEHIND, ANIM_FIGHT_IDLE, ANIM_FIGHT2_IDLE, ANIM_FIGHT_SH_F, - ANIM_FIGHT_BODYBLOW, - ANIM_FIGHT_HEAD, - ANIM_FIGHT_KICK, - ANIM_FIGHT_KNEE, - ANIM_FIGHT_LHOOK, - ANIM_FIGHT_PUNCH, - ANIM_FIGHT_ROUNDHOUSE, - ANIM_FIGHT_LONGKICK, ANIM_FIGHT_PPUNCH, - - ANIM_FIGHT_JAB, - ANIM_FIGHT_ELBOW_L, - ANIM_FIGHT_ELBOW_R, - ANIM_FIGHT_BKICK_L, - ANIM_FIGHT_BKICK_R, - + ANIM_L_HOOK, + ANIM_R_HOOK, + ANIM_UPPERCUT, + ANIM_HEADBUTT, + ANIM_FRONTKICK, + ANIM_ROUNDHOUSE, + ANIM_HIT_L_HOOK, + ANIM_HIT_R_HOOK, + ANIM_HIT_UPPERCUT, + ANIM_HIT_HEADBUTT, + ANIM_HIT_FRONTKICK, + ANIM_HIT_RHOUSE, ANIM_BOMBER, ANIM_PUNCH_R, ANIM_FIGHT_PPUNCH2, @@ -164,6 +157,7 @@ enum AnimationId ANIM_EV_STEP, ANIM_EV_DIVE, + ANIM_COMMANDO_ROLL, ANIM_XPRESS_SCRATCH, ANIM_ROAD_CROSS, ANIM_TURN_180, @@ -269,5 +263,66 @@ enum AnimationId ANIM_STRIP_F, ANIM_STRIP_G, + + ANIM_MPNOTE, + ANIM_MPNOTE_LOOP, + + ANIM_IDLE_LOOK, + ANIM_IDLE_NO, + ANIM_IDLE_YES, + ANIM_IDLE_CHAT2, + ANIM_IDLE_COUGH, + ANIM_IDLE_GIGGLE_FEMALE, + ANIM_IDLE_TOUGH_CHAT, + ANIM_IDLE_CELL_TALK, + + ANIM_DONH2_CAMERA, + ANIM_DONH3_HAPPY, + + ANIM_JDT2_ANXIOUS_TALK, + ANIM_JDT2_SHRUG, + ANIM_JDT4_DILDO_TALK, + ANIM_JDT5_CALM_DOWN, + ANIM_JDT5_POINT, + ANIM_JDT6_PICKUP, + ANIM_JDT6_DOORKNOCK, + + ANIM_MAR1_SKIRT, + ANIM_MAR2_CELL_ANSWER, + ANIM_MAR2_CELL_END, + ANIM_MAR2_CELL_TALK, + ANIM_MAR2_FOOT_TAP, + ANIM_MAR3_HOOCHY, + ANIM_MAR3_NOTE_IDLE, + ANIM_MAR3_NOTE_PICK, + + ANIM_SAL1_BIREFCASE_DOWN, + ANIM_SAL2_IDLE_SEATED, + ANIM_SAL2_SEAT_TO_STAND, + ANIM_SAL3_SEATED_TALK, + ANIM_SAL3_SEATED_IDLE, + ANIM_SAL3_SIT_DOWN, + ANIM_SAL4_DUSTDOWN, + ANIM_SAL4_GIRLRUN, + ANIM_SAL6_ANGRY_SEATED, + ANIM_SAL6_IDLE_SEATED, + ANIM_SAL7_LOOKOUT, + + ANIM_VIC2_POINT_ANGRY, + ANIM_VIC3_WAFT, + ANIM_VIC3_PICKUP_ROLL, + ANIM_VIC4_CARRY_BOX, + ANIM_VIC4_CELL_LOOK, + ANIM_VIC4_CRATE_IDLE, + ANIM_VIC6_CELL_ANGRY, + + ANIM_TOURIST3, + ANIM_TOURIST2, + ANIM_TOURIST1, + + ANIM_MAC2_PLEAD, + + ANIM_VIC7_PROD_WITH_FOOT, + NUM_ANIMS };
\ No newline at end of file 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 01b33fa5..cd341eac 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -4363,14 +4363,18 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) if (weaponType == WEAPONTYPE_BRASSKNUCKLE) { CPed* ped = params.m_pPed; uint32 fightMove = ped->m_curFightMove; - if (fightMove == FIGHTMOVE_BACKLEFT || fightMove == FIGHTMOVE_STDPUNCH || fightMove == FIGHTMOVE_PUNCH || + // LCS:removed for now + //if (fightMove == FIGHTMOVE_BACKLEFT || fightMove == FIGHTMOVE_STDPUNCH || fightMove == FIGHTMOVE_PUNCH || + if ( ped->m_nPedState == PED_ATTACK) { CEntity* damageEntity = ped->m_pDamageEntity; if (!damageEntity) m_sQueueSample.m_nSampleIndex = m_anRandomTable[3] % 2 + SFX_HAMMER_HIT_1; else if (damageEntity->GetType() != ENTITY_TYPE_PED) m_sQueueSample.m_nSampleIndex = m_anRandomTable[3] % 2 + SFX_HAMMER_HIT_1; - else if (((CPed*)damageEntity)->m_curFightMove != FIGHTMOVE_HITHEAD) + // LCS:removed for now + //else if (((CPed*)damageEntity)->m_curFightMove != FIGHTMOVE_HITHEAD) + else if(1) m_sQueueSample.m_nSampleIndex = m_anRandomTable[3] % 2 + SFX_HAMMER_HIT_1; else m_sQueueSample.m_nSampleIndex = SFX_HAMMER_HIT_1; @@ -5296,6 +5300,7 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound) case MI_MEDIC: return GetMedicTalkSfx(ped, sound); case MI_FIREMAN: return GetFiremanTalkSfx(ped, sound); case MI_MALE01: return GetDefaultTalkSfx(ped, sound); +/* LCS: removed for now case MI_HFYST: return GetHFYSTTalkSfx(ped, sound); case MI_HFOST: return GetHFOSTTalkSfx(ped, sound); case MI_HMYST: return GetHMYSTTalkSfx(ped, sound); @@ -5384,6 +5389,7 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound) case MI_BKB: return GetBKTalkSfx(ped, sound); case MI_PGA: case MI_PGB: return GetPGTalkSfx(ped, sound); +*/ case MI_VICE1: case MI_VICE2: case MI_VICE3: @@ -7567,7 +7573,8 @@ cAudioManager::GetSGTalkSfx(CPed *ped, int16 sound) case SOUND_PED_CHAT: GetPhrase(sfx, ped->m_lastComment, 1064, 12); break; default: return GetGenericMaleTalkSfx(ped, sound); } - if(ped->GetModelIndex() == MI_SGB) sfx += 93; +// LCS removed for now +// if(ped->GetModelIndex() == MI_SGB) sfx += 93; return sfx; } @@ -9400,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}, @@ -9773,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) @@ -9840,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; } @@ -9940,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]); @@ -9966,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) { @@ -10010,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/AudioManager.h b/src/audio/AudioManager.h index 376a7f60..b5e9b499 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -466,7 +466,7 @@ public: void ProcessScriptObject(int32 id); // done void ProcessSpecial(); // done #ifdef GTA_TRAIN - bool ProcessTrainNoise(cVehicleParams *params); //done(bcs not exists in VC) + bool ProcessTrainNoise(cVehicleParams ¶ms); //done(bcs not exists in VC) #endif void ProcessVehicle(CVehicle *vehicle); // done bool ProcessVehicleDoors(cVehicleParams ¶ms); // done diff --git a/src/audio/AudioSamples.h b/src/audio/AudioSamples.h index a68cf768..159809d0 100644 --- a/src/audio/AudioSamples.h +++ b/src/audio/AudioSamples.h @@ -814,4 +814,8 @@ enum eSfxSample SAMPLEBANK_PED_START = SFX_FOOTSTEP_SAND_4 + 1, SAMPLEBANK_PED_END = 9940, SAMPLEBANK_PED_MAX = SAMPLEBANK_PED_END + 1, + + // LCS: TODO + SFX_TRAIN_FAR = NO_SAMPLE, + SFX_TRAIN_NEAR = NO_SAMPLE, }; diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index acfe09c3..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; } @@ -1295,7 +1295,7 @@ cMusicManager::UsesPoliceRadio(CVehicle *veh) bool cMusicManager::UsesTaxiRadio(CVehicle *veh) { - if (veh->GetModelIndex() != MI_KAUFMAN) return false; + if (veh->GetModelIndex() != MI_CABBIE) return false; return CTheScripts::bPlayerHasMetDebbieHarry; } diff --git a/src/audio/PoliceRadio.cpp b/src/audio/PoliceRadio.cpp index 30fcbde0..07dfb890 100644 --- a/src/audio/PoliceRadio.cpp +++ b/src/audio/PoliceRadio.cpp @@ -546,8 +546,7 @@ cAudioManager::SetupSuspectLastSeenReport() break; case MI_TAXI: case MI_CABBIE: - case MI_ZEBRA: - case MI_KAUFMAN: + case MI_BORGNINE: sample = SFX_POLICE_RADIO_TAXI; break; case MI_BOBCAT: 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/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 6f47db05..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); @@ -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/GameLogic.cpp b/src/control/GameLogic.cpp index e7f7d525..2eea9645 100644 --- a/src/control/GameLogic.cpp +++ b/src/control/GameLogic.cpp @@ -420,7 +420,7 @@ CGameLogic::SetUpShortCut(CVector vStartPos, float fStartAngle, CVector vEndPos, ShortCutStartOrientation = fStartAngle; ShortCutDestination = vEndPos; ShortCutDestinationOrientation = fEndAngle; - CStreaming::RequestModel(MI_KAUFMAN, 0); + CStreaming::RequestModel(MI_CABBIE, 0); } void @@ -452,11 +452,11 @@ CGameLogic::UpdateShortCut() { switch (ShortCutState) { case SHORTCUT_INIT: - if (!CStreaming::HasModelLoaded(MI_KAUFMAN)) { - CStreaming::RequestModel(MI_KAUFMAN, 0); + if (!CStreaming::HasModelLoaded(MI_CABBIE)) { + CStreaming::RequestModel(MI_CABBIE, 0); return; } - pShortCutTaxi = new CAutomobile(MI_KAUFMAN, RANDOM_VEHICLE); + pShortCutTaxi = new CAutomobile(MI_CABBIE, RANDOM_VEHICLE); if (!pShortCutTaxi) return; pShortCutTaxi->SetPosition(ShortCutStart); 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/Replay.cpp b/src/control/Replay.cpp index 37a54999..7adb4999 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -1287,7 +1287,7 @@ void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float ca DMAudio.SetEffectsFadeVol(0); DMAudio.SetMusicFadeVol(0); CEscalators::Shutdown(); - CWaterCreatures::RemoveAll(); + //CWaterCreatures::RemoveAll(); int current; for (current = 0; current < NUM_REPLAYBUFFERS; current++) if (BufferStatus[current] == REPLAYBUFFER_RECORD) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 3566e0a6..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 @@ -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, ""), @@ -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 @@ -2222,17 +2582,17 @@ int open_script() #endif switch (scriptToLoad) { case 0: scriptfile = "main.scm"; break; - case 1: scriptfile = "freeroam_miami.scm"; break; + case 1: scriptfile = "freeroam_lcs.scm"; break; case 2: scriptfile = "main_d.scm"; break; } return CFileMgr::OpenFile(scriptfile, "rb"); } #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]); - pNew->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 aba06d03..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], 450.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,8 +2408,8 @@ 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 && !pPed->bWaitForLeaderToComeCloser); diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index efe35efb..1337605f 100644 --- a/src/control/Script4.cpp +++ b/src/control/Script4.cpp @@ -957,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: { @@ -1357,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); @@ -1421,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); @@ -1444,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); @@ -1784,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]); // ??? @@ -1795,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]); // ??? @@ -1820,6 +1823,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) continue; if (CModelInfo::IsCarModel(model) || CModelInfo::IsBikeModel(model)) { switch (model) { + // TODO(LCS): do it right case MI_LANDSTAL: case MI_LINERUN: case MI_RIO: @@ -1845,13 +1849,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_ANGEL: case MI_COACH: case MI_RCBANDIT: - case MI_ROMERO: - case MI_PACKER: - case MI_SENTXS: + //case MI_ROMERO: + //case MI_PACKER: + //case MI_SENTXS: case MI_SQUALO: case MI_SEASPAR: case MI_PIZZABOY: - case MI_GANGBUR: + //case MI_GANGBUR: case MI_AIRTRAIN: case MI_DEADDODO: case MI_SPEEDER: @@ -1860,44 +1864,44 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_FLATBED: case MI_YANKEE: case MI_CADDY: - case MI_ZEBRA: + //case MI_ZEBRA: case MI_TOPFUN: case MI_SKIMMER: case MI_RCBARON: case MI_RCRAIDER: case MI_SPARROW: case MI_PATRIOT: - case MI_LOVEFIST: + //case MI_LOVEFIST: case MI_COASTG: case MI_DINGHY: - case MI_HERMES: - case MI_SABRETUR: + //case MI_HERMES: + //case MI_SABRETUR: case MI_PHEONIX: - case MI_WALTON: + //case MI_WALTON: case MI_COMET: - case MI_DELUXO: - case MI_BURRITO: - case MI_SPAND: + //case MI_DELUXO: + //case MI_BURRITO: + //case MI_SPAND: case MI_MARQUIS: case MI_BAGGAGE: - case MI_KAUFMAN: + //case MI_KAUFMAN: case MI_MAVERICK: case MI_VCNMAV: - case MI_RANCHER: + //case MI_RANCHER: case MI_FBIRANCH: case MI_JETMAX: - case MI_HOTRING: + //case MI_HOTRING: case MI_SANDKING: - case MI_BLISTAC: + //case MI_BLISTAC: case MI_POLMAV: - case MI_BOXVILLE: - case MI_BENSON: - case MI_MESA: + //case MI_BOXVILLE: + //case MI_BENSON: + //case MI_MESA: case MI_RCGOBLIN: - case MI_HOTRINA: - case MI_HOTRINB: - case MI_BLOODRA: - case MI_BLOODRB: + //case MI_HOTRINA: + //case MI_HOTRINB: + //case MI_BLOODRA: + //case MI_BLOODRB: case MI_VICECHEE: model = -1; break; @@ -1912,23 +1916,23 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) case MI_MOONBEAM: case MI_ESPERANT: case MI_TAXI: - case MI_WASHING: + //case MI_WASHING: case MI_BOBCAT: case MI_BANSHEE: case MI_CABBIE: case MI_STALLION: case MI_RUMPO: - case MI_ADMIRAL: + //case MI_ADMIRAL: case MI_PCJ600: case MI_FAGGIO: case MI_FREEWAY: - case MI_GLENDALE: - case MI_OCEANIC: + //case MI_GLENDALE: + //case MI_OCEANIC: case MI_SANCHEZ: - case MI_SABRE: - case MI_REGINA: - case MI_VIRGO: - case MI_GREENWOO: + //case MI_SABRE: + //case MI_REGINA: + //case MI_VIRGO: + //case MI_GREENWOO: break; default: printf("CREATE_RANDOM_CAR_FOR_CAR_PARK - Unknown car model %d\n", CStreaming::ms_vehiclesLoaded[index]); @@ -1969,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]; @@ -2044,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: @@ -2054,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 b03ff49d..c0e3ecad 100644 --- a/src/control/Script5.cpp +++ b/src/control/Script5.cpp @@ -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 731537ef..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 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/FileLoader.cpp b/src/core/FileLoader.cpp index b8201400..3ea73233 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -846,14 +846,15 @@ CFileLoader::LoadVehicleObject(const char *line) char type[8], handlingId[16], gamename[32], animFile[16], vehclass[12]; uint32 frequency, comprules; int32 level, misc; - float wheelScale; + float wheelScale, normalSplay; CVehicleModelInfo *mi; char *p; - sscanf(line, "%d %s %s %s %s %s %s %s %d %d %x %d %f", + sscanf(line, "%d %s %s %s %s %s %s %s %d %d %x %d %f %f", &id, model, txd, type, handlingId, gamename, animFile, vehclass, - &frequency, &level, &comprules, &misc, &wheelScale); + &frequency, &level, &comprules, &misc, &wheelScale, + &normalSplay); mi = CModelInfo::AddVehicleModel(id); mi->SetModelName(model); @@ -873,6 +874,8 @@ CFileLoader::LoadVehicleObject(const char *line) mi->m_vehicleType = VEHICLE_TYPE_BOAT; }else if(strcmp(type, "train") == 0){ mi->m_vehicleType = VEHICLE_TYPE_TRAIN; + }else if(strcmp(type, "ferry") == 0){ + mi->m_vehicleType = VEHICLE_TYPE_FERRY; }else if(strcmp(type, "heli") == 0){ mi->m_vehicleType = VEHICLE_TYPE_HELI; }else if(strcmp(type, "plane") == 0){ diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index d14f15d4..62e2e65f 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -59,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 @@ -466,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; @@ -675,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) @@ -1465,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); @@ -4737,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/Game.cpp b/src/core/Game.cpp index 8405c2ec..c5154bd4 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -375,7 +375,7 @@ bool CGame::Initialise(const char* datFile) #ifdef USE_TEXTURE_POOL _TexturePoolsUnknown(false); #endif - currLevel = LEVEL_BEACH; + currLevel = LEVEL_INDUSTRIAL; currArea = AREA_MAIN_MAP; PUSH_MEMID(MEMID_TEXTURES); @@ -441,7 +441,7 @@ bool CGame::Initialise(const char* datFile) CdStreamAddImage("MODELS\\GTA3.IMG"); - CFileLoader::LoadLevel("DATA\\DEFAULT.DAT"); +// CFileLoader::LoadLevel("DATA\\DEFAULT.DAT"); CFileLoader::LoadLevel(datFile); #ifdef EXTENDED_PIPELINES // for generic fallback @@ -587,7 +587,7 @@ bool CGame::ShutDown(void) CPlane::Shutdown(); CTrain::Shutdown(); CScriptPaths::Shutdown(); - CWaterCreatures::RemoveAll(); + //CWaterCreatures::RemoveAll(); CSpecialFX::Shutdown(); CGarages::Shutdown(); CMovingThings::Shutdown(); @@ -661,8 +661,9 @@ void CGame::ReInitGameObjectVariables(void) CDraw::SetFOV(120.0f); CDraw::ms_fLODDistance = 500.0f; CStreaming::RequestBigBuildings(LEVEL_GENERIC); - CStreaming::RemoveIslandsNotUsed(LEVEL_BEACH); - CStreaming::RemoveIslandsNotUsed(LEVEL_MAINLAND); + CStreaming::RemoveIslandsNotUsed(LEVEL_INDUSTRIAL); + CStreaming::RemoveIslandsNotUsed(LEVEL_COMMERCIAL); + CStreaming::RemoveIslandsNotUsed(LEVEL_SUBURBAN); CStreaming::LoadAllRequestedModels(false); currArea = AREA_MAIN_MAP; CPed::Initialise(); @@ -748,7 +749,7 @@ void CGame::ShutDownForRestart(void) CRadar::RemoveRadarSections(); FrontEndMenuManager.UnloadTextures(); CParticleObject::RemoveAllExpireableParticleObjects(); - CWaterCreatures::RemoveAll(); + //CWaterCreatures::RemoveAll(); CSetPieces::Init(); CPedType::Shutdown(); CSpecialFX::Shutdown(); @@ -900,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 4052eb00..dd14278a 100644 --- a/src/core/Game.h +++ b/src/core/Game.h @@ -3,8 +3,10 @@ enum eLevelName { LEVEL_IGNORE = -1, // beware, this is only used in CPhysical's m_nZoneLevel LEVEL_GENERIC = 0, - LEVEL_BEACH, - LEVEL_MAINLAND, + LEVEL_INDUSTRIAL, + LEVEL_COMMERCIAL, + LEVEL_SUBURBAN, + LEVEL_UNDERGROUND, NUM_LEVELS }; @@ -78,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 new file mode 100644 index 00000000..c95ab4b1 --- /dev/null +++ b/src/core/KeyGen.cpp @@ -0,0 +1,106 @@ +#include "common.h" +#include "KeyGen.h" +#include <ctype.h> + +uint32 CKeyGen::keyTable[256] = +{ + 0, 0x77073096, 0xEE0E612C, 0x990951BA, + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D +}; + +uint32 +CKeyGen::GetKey(const char *str, int size) +{ + uint32 key = 0xffffffff; + for (int i = 0; i < size; i++) + key = keyTable[(key ^ str[i]) & 0xFF] ^ (key >> 8); + return key; +} + +uint32 +CKeyGen::GetKey(const char *str) +{ + uint32 key = 0xffffffff; + while(*str != '\0') + key = keyTable[(key ^ *(str++)) & 0xFF] ^ (key >> 8); + return key; +} + +uint32 +CKeyGen::GetUppercaseKey(const char *str) +{ + uint32 key = 0xffffffff; + while (*str != '\0') + key = keyTable[(key ^ toupper(*(str++))) & 0xFF] ^ (key >> 8); + return key; +} + +uint32 +CKeyGen::AppendStringToKey(uint32 key, const char *str) +{ + while (*str != '\0') + key = keyTable[(key ^ *(str++)) & 0xFF] ^ (key >> 8); + return key; +}
\ No newline at end of file diff --git a/src/core/KeyGen.h b/src/core/KeyGen.h new file mode 100644 index 00000000..129859ce --- /dev/null +++ b/src/core/KeyGen.h @@ -0,0 +1,11 @@ +#pragma once + +class CKeyGen +{ + static uint32 keyTable[256]; +public: + static uint32 GetKey(const char *str, int size); + static uint32 GetKey(const char *str); + static uint32 GetUppercaseKey(const char *str); + static uint32 AppendStringToKey(uint32 key, const char *str); +};
\ No newline at end of file diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index feda19c6..1e4f48f4 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -97,6 +97,7 @@ extern bool gbFastTime; extern bool gGravityCheat; #endif +/* LCS: removed void SpecialCarCheats() { if ( !CVehicle::bCheat9 ) @@ -145,6 +146,7 @@ void SpecialCarCheats() CPad::bHasPlayerCheated = true; } } +*/ void PickUpChicksCheat() { @@ -370,7 +372,7 @@ void ChangePlayerCheat() do { do { - modelId = CGeneral::GetRandomNumberInRange(0, MI_PGA); + modelId = CGeneral::GetRandomNumberInRange(0, MI_GANG18); anotherModelId = modelId+1; } while (!CModelInfo::GetModelInfo(anotherModelId)); } while (anotherModelId >= MI_SPECIAL01 && anotherModelId <= MI_SPECIAL04 || modelId == MI_TAXI_D); @@ -589,16 +591,18 @@ void SuicideCheat(void) { } void DoChicksWithGunsCheat(void) { +/* // broken in LCS CHud::SetHelpMessage(TheText.Get("CHEAT1"), true); CStreaming::SetModelIsDeletable(CGangs::GetGangPedModel1(GANG_PLAYER)); CStreaming::SetModelIsDeletable(CGangs::GetGangPedModel2(GANG_PLAYER)); CStreaming::SetModelTxdIsDeletable(CGangs::GetGangPedModel1(GANG_PLAYER)); CStreaming::SetModelTxdIsDeletable(CGangs::GetGangPedModel2(GANG_PLAYER)); CStreaming::RemoveCurrentZonesModels(); - CGangs::SetGangPedModels(GANG_PLAYER, MI_HFYBE, MI_WFYBE); + CGangs::SetGangPedModels(GANG_PLAYER, MI_CAS_WOM, MI_HOS_WOM); CGangs::SetGangWeapons(GANG_PLAYER, WEAPONTYPE_M4, WEAPONTYPE_M4); CStats::CheatedCount += 1000; CPad::bHasPlayerCheated = true; +*/ } ////////////////////////////////////////////////////////////////////////// @@ -1420,6 +1424,8 @@ void CPad::AddToPCCheatString(char c) KeyBoardCheatString[0] = ' '; BlackCarsCheat(); } +/* + // LCS: removed for now // "TRAVELINSTYLE" else if (!Cheat_strncmp(KeyBoardCheatString, "HQ`U`iLSFaNZ[")) { KeyBoardCheatString[0] = ' '; @@ -1515,6 +1521,7 @@ void CPad::AddToPCCheatString(char c) KeyBoardCheatString[0] = ' '; ChangePlayerModel("igdiaz"); } +*/ // DEEPFRIEDMARSBARS else if (!Cheat_strncmp(KeyBoardCheatString, "VWHC`mDTEPVZMpRK")) { KeyBoardCheatString[0] = ' '; @@ -1530,11 +1537,13 @@ void CPad::AddToPCCheatString(char c) KeyBoardCheatString[0] = ' '; BackToTheFuture(); } +/* LCS: removed // LOADSOFLITTLETHINGS else if (!Cheat_strncmp(KeyBoardCheatString, "VLUJUoHSU_VTMo`J]bV")) { KeyBoardCheatString[0] = ' '; SpecialCarCheats(); } +*/ // HOPINGIRL else if (!Cheat_strncmp(KeyBoardCheatString, "OWPH[dSVI")) { KeyBoardCheatString[0] = ' '; 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/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 0829dda6..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 }; diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index ec0e8e93..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) @@ -78,10 +79,16 @@ size_t CStreaming::ms_memoryAvailable; int32 desiredNumVehiclesLoaded = 12; -CEntity *pIslandLODmainlandEntity; -CEntity *pIslandLODbeachEntity; -int32 islandLODmainland; -int32 islandLODbeach; +CEntity *pIslandLODindustEntity; +CEntity *pIslandLODcomIndEntity; +CEntity *pIslandLODcomSubEntity; +CEntity *pIslandLODsubIndEntity; +CEntity *pIslandLODsubComEntity; +int32 islandLODindust; +int32 islandLODcomInd; +int32 islandLODcomSub; +int32 islandLODsubInd; +int32 islandLODsubCom; #ifndef MASTER bool gbPrintStats; @@ -240,12 +247,21 @@ CStreaming::Init2(void) // find island LODs - pIslandLODmainlandEntity = nil; - pIslandLODbeachEntity = nil; - islandLODmainland = -1; - islandLODbeach = -1; - CModelInfo::GetModelInfo("IslandLODmainland", &islandLODmainland); - CModelInfo::GetModelInfo("IslandLODbeach", &islandLODbeach); + pIslandLODindustEntity = nil; + pIslandLODcomIndEntity = nil; + pIslandLODcomSubEntity = nil; + pIslandLODsubIndEntity = nil; + pIslandLODsubComEntity = nil; + islandLODindust = -1; + islandLODcomInd = -1; + islandLODcomSub = -1; + islandLODsubInd = -1; + islandLODsubCom = -1; + CModelInfo::GetModelInfo("IslandLODInd", &islandLODindust); + CModelInfo::GetModelInfo("IslandLODcomIND", &islandLODcomInd); + CModelInfo::GetModelInfo("IslandLODcomSUB", &islandLODcomSub); + CModelInfo::GetModelInfo("IslandLODsubIND", &islandLODsubInd); + CModelInfo::GetModelInfo("IslandLODsubCOM", &islandLODsubCom); #ifndef MASTER VarConsole.Add("Streaming Debug", &gbPrintStats, true); @@ -917,65 +933,61 @@ CStreaming::RequestIslands(eLevelName level) { ISLAND_LOADING_ISNT(HIGH) switch(level){ - case LEVEL_MAINLAND: - if(islandLODbeach != -1) - RequestModel(islandLODbeach, BIGBUILDINGFLAGS); + case LEVEL_INDUSTRIAL: + RequestModel(islandLODcomInd, BIGBUILDINGFLAGS); + RequestModel(islandLODsubInd, BIGBUILDINGFLAGS); break; - case LEVEL_BEACH: - if(islandLODmainland != -1) - RequestModel(islandLODmainland, BIGBUILDINGFLAGS); + case LEVEL_COMMERCIAL: + RequestModel(islandLODindust, BIGBUILDINGFLAGS); + RequestModel(islandLODsubCom, BIGBUILDINGFLAGS); + break; + case LEVEL_SUBURBAN: + RequestModel(islandLODindust, BIGBUILDINGFLAGS); + RequestModel(islandLODcomSub, BIGBUILDINGFLAGS); break; default: break; } } -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", "" }; @@ -989,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); @@ -1132,10 +1146,9 @@ CStreaming::RemoveModel(int32 id) void CStreaming::RemoveUnusedBuildings(eLevelName level) { - if(level != LEVEL_BEACH) - RemoveBuildings(LEVEL_BEACH); - if(level != LEVEL_MAINLAND) - RemoveBuildings(LEVEL_MAINLAND); + for(int i = LEVEL_INDUSTRIAL; i < NUM_LEVELS; i++) + if(level != i) + RemoveBuildings((eLevelName)i); } void @@ -1258,10 +1271,9 @@ CStreaming::RemoveUnusedBigBuildings(eLevelName level) { ISLAND_LOADING_IS(LOW) { - if(level != LEVEL_BEACH) - RemoveBigBuildings(LEVEL_BEACH); - if(level != LEVEL_MAINLAND) - RemoveBigBuildings(LEVEL_MAINLAND); + for(int i = LEVEL_INDUSTRIAL; i < NUM_LEVELS; i++) + if(level != i) + RemoveBuildings((eLevelName)i); } RemoveIslandsNotUsed(level); } @@ -1283,29 +1295,53 @@ void CStreaming::RemoveIslandsNotUsed(eLevelName level) { int i; - if(pIslandLODmainlandEntity == nil) + if(pIslandLODindustEntity == nil) for(i = CPools::GetBuildingPool()->GetSize()-1; i >= 0; i--){ CBuilding *building = CPools::GetBuildingPool()->GetSlot(i); if(building == nil) continue; - if(building->GetModelIndex() == islandLODmainland) - pIslandLODmainlandEntity = building; - if(building->GetModelIndex() == islandLODbeach) - pIslandLODbeachEntity = building; + if(building->GetModelIndex() == islandLODindust) + pIslandLODindustEntity = building; + else if(building->GetModelIndex() == islandLODcomInd) + pIslandLODcomIndEntity = building; + else if(building->GetModelIndex() == islandLODcomSub) + pIslandLODcomSubEntity = building; + else if(building->GetModelIndex() == islandLODsubInd) + pIslandLODsubIndEntity = building; + else if(building->GetModelIndex() == islandLODsubCom) + pIslandLODsubComEntity = building; } #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){ - case LEVEL_MAINLAND: - DeleteIsland(pIslandLODmainlandEntity); + case LEVEL_INDUSTRIAL: + DeleteIsland(pIslandLODindustEntity); + DeleteIsland(pIslandLODcomSubEntity); + DeleteIsland(pIslandLODsubComEntity); break; - case LEVEL_BEACH: - DeleteIsland(pIslandLODbeachEntity); - + case LEVEL_COMMERCIAL: + DeleteIsland(pIslandLODcomIndEntity); + DeleteIsland(pIslandLODcomSubEntity); + DeleteIsland(pIslandLODsubIndEntity); + break; + case LEVEL_SUBURBAN: + DeleteIsland(pIslandLODsubIndEntity); + DeleteIsland(pIslandLODsubComEntity); + DeleteIsland(pIslandLODcomIndEntity); + break; + default: + DeleteIsland(pIslandLODindustEntity); + DeleteIsland(pIslandLODcomIndEntity); + DeleteIsland(pIslandLODcomSubEntity); + DeleteIsland(pIslandLODsubIndEntity); + DeleteIsland(pIslandLODsubComEntity); break; } } @@ -1567,6 +1603,7 @@ CStreaming::IsObjectInCdImage(int32 id) void CStreaming::SetModelIsDeletable(int32 id) { + assert(id >= 0); // guard against fake IDs ms_aInfoForModel[id].m_flags &= ~STREAMFLAGS_DONT_REMOVE; if ((id >= STREAM_OFFSET_TXD && id < STREAM_OFFSET_COL || CModelInfo::GetModelInfo(id)->GetModelType() != MITYPE_VEHICLE) && (ms_aInfoForModel[id].m_flags & STREAMFLAGS_SCRIPTOWNED) == 0){ @@ -1645,11 +1682,11 @@ CStreaming::StreamVehiclesAndPeds(void) } if(FindPlayerPed()->m_pWanted->AreFbiRequired()){ - RequestModel(MI_FBIRANCH, STREAMFLAGS_DONT_REMOVE); + RequestModel(MI_FBICAR, STREAMFLAGS_DONT_REMOVE); RequestModel(MI_FBI, STREAMFLAGS_DONT_REMOVE); }else{ - SetModelIsDeletable(MI_FBIRANCH); - if(!HasModelLoaded(MI_FBIRANCH)) + SetModelIsDeletable(MI_FBICAR); + if(!HasModelLoaded(MI_FBICAR)) SetModelIsDeletable(MI_FBI); } @@ -1669,6 +1706,7 @@ CStreaming::StreamVehiclesAndPeds(void) else SetModelIsDeletable(MI_CHOPPER); +/* LCS: removed if (FindPlayerPed()->m_pWanted->AreMiamiViceRequired()) { SetModelIsDeletable(MI_VICE1); SetModelIsDeletable(MI_VICE2); @@ -1710,6 +1748,7 @@ CStreaming::StreamVehiclesAndPeds(void) SetModelIsDeletable(MI_VICE7); SetModelIsDeletable(MI_VICE8); } +*/ if(timeBeforeNextLoad >= 0) timeBeforeNextLoad--; 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/World.h b/src/core/World.h index 59bf634c..4cc9398e 100644 --- a/src/core/World.h +++ b/src/core/World.h @@ -4,19 +4,19 @@ #include "Lists.h" #include "PlayerInfo.h" -/* Sectors span from -2400 to 1600 in x and -2000 to 2000 y. - * With 80x80 sectors, each is 50x50 units. */ +/* Sectors span from -2000 to 2000 in x and y. + * With 100x100 sectors, each is 40x40 units. */ -#define SECTOR_SIZE_X (50.0f) -#define SECTOR_SIZE_Y (50.0f) +#define SECTOR_SIZE_X (40.0f) +#define SECTOR_SIZE_Y (40.0f) -#define NUMSECTORS_X (80) -#define NUMSECTORS_Y (80) +#define NUMSECTORS_X (100) +#define NUMSECTORS_Y (100) #define WORLD_SIZE_X (NUMSECTORS_X * SECTOR_SIZE_X) #define WORLD_SIZE_Y (NUMSECTORS_Y * SECTOR_SIZE_Y) -#define WORLD_MIN_X (-2400.0f) +#define WORLD_MIN_X (-2000.0f) #define WORLD_MIN_Y (-2000.0f) #define WORLD_MAX_X (WORLD_MIN_X + WORLD_SIZE_X) diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp index 55b43c10..1715d811 100644 --- a/src/core/Zones.cpp +++ b/src/core/Zones.cpp @@ -88,20 +88,20 @@ CTheZones::Init(void) TotalNumberOfInfoZones = 1; strcpy(InfoZoneArray[0].name, "CITYINF"); - InfoZoneArray[0].minx = -2400.0f; + InfoZoneArray[0].minx = -2000.0f; InfoZoneArray[0].miny = -2000.0f; InfoZoneArray[0].minz = -500.0f; - InfoZoneArray[0].maxx = 1600.0f; + InfoZoneArray[0].maxx = 2000.0f; InfoZoneArray[0].maxy = 2000.0f; InfoZoneArray[0].maxz = 500.0f; InfoZoneArray[0].level = LEVEL_GENERIC; InfoZoneArray[0].type = ZONE_INFO; strcpy(NavigationZoneArray[0].name, "VICE_C"); - NavigationZoneArray[0].minx = -2400.0f; + NavigationZoneArray[0].minx = -2000.0f; NavigationZoneArray[0].miny = -2000.0f; NavigationZoneArray[0].minz = -500.0f; - NavigationZoneArray[0].maxx = 1600.0f; + NavigationZoneArray[0].maxx = 2000.0f; NavigationZoneArray[0].maxy = 2000.0f; NavigationZoneArray[0].maxz = 500.0f; NavigationZoneArray[0].level = LEVEL_GENERIC; @@ -115,10 +115,10 @@ CTheZones::Init(void) } TotalNumberOfMapZones = 1; strcpy(MapZoneArray[0].name, "THEMAP"); - MapZoneArray[0].minx = -2400.0f; + MapZoneArray[0].minx = -2000.0f; MapZoneArray[0].miny = -2000.0f; MapZoneArray[0].minz = -500.0f; - MapZoneArray[0].maxx = 1600.0f; + MapZoneArray[0].maxx = 2000.0f; MapZoneArray[0].maxy = 2000.0f; MapZoneArray[0].maxz = 500.0f; MapZoneArray[0].level = LEVEL_GENERIC; diff --git a/src/core/common.h b/src/core/common.h index 2391f5fb..ace15ee1 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -92,6 +92,8 @@ typedef ptrdiff_t ssize_t; #endif #include "config.h" +#include "memoryManager.h" +#include "relocatableChunk.h" #include <rphanim.h> #include <rpskin.h> diff --git a/src/core/config.h b/src/core/config.h index 8e528a67..225863f3 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -7,15 +7,15 @@ enum Config { MAX_CDIMAGES = 8, // additional cdimages MAX_CDCHANNELS = 5, - MODELINFOSIZE = 6500, // 4900 on PS2 - TXDSTORESIZE = 1385, - COLSTORESIZE = 31, + MODELINFOSIZE = 6500, // only 4900 + TXDSTORESIZE = 1385, // only 1200 + COLSTORESIZE = 31, // only 15 EXTRADIRSIZE = 256, CUTSCENEDIRSIZE = 512, SIMPLEMODELSIZE = 3885, TIMEMODELSIZE = 385, - CLUMPMODELSIZE = 5, + CLUMPMODELSIZE = 10, WEAPONMODELSIZE = 37, PEDMODELSIZE = 130, VEHICLEMODELSIZE = 110, @@ -26,19 +26,19 @@ enum Config { NUMOBJECTINFO = 210, // Pool sizes - NUMPTRNODES = 50000, - NUMENTRYINFOS = 3200, - NUMPEDS = 140, - NUMVEHICLES = 110, - NUMBUILDINGS = 7000, - NUMTREADABLES = 1, - NUMOBJECTS = 460, - NUMDUMMIES = 2340, + NUMPTRNODES = 50000, // only 30100 + NUMENTRYINFOS = 4000, + NUMPEDS = 140, // only 70 + NUMVEHICLES = 110, // only 70 + NUMBUILDINGS = 7000, // only 6757 + NUMTREADABLES = 1300, + NUMOBJECTS = 475, + NUMDUMMIES = 3000, NUMAUDIOSCRIPTOBJECTS = 192, NUMCOLMODELS = 4400, NUMCUTSCENEOBJECTS = 50, // not a pool in VC - NUMANIMBLOCKS = 35, + NUMANIMBLOCKS = 60, NUMANIMATIONS = 450, NUMTEMPOBJECTS = 40, @@ -58,20 +58,20 @@ enum Config { NUMREFERENCES = 800, // Zones - NUMAUDIOZONES = 14, + NUMAUDIOZONES = 36, NUMINFOZONES = 169, - NUMMAPZONES = 39, - NUMNAVIGZONES = 20, + NUMMAPZONES = 110, + NUMNAVIGZONES = 70, // Cull zones - NUMATTRIBZONES = 704, + NUMATTRIBZONES = 900, NUMOCCLUSIONVOLUMES = 350, NUMACTIVEOCCLUDERS = 48, PATHNODESIZE = 4500, - NUMWEATHERS = 7, + NUMWEATHERS = 8, NUMHOURS = 24, NUMEXTRADIRECTIONALS = 4, @@ -97,7 +97,7 @@ enum Config { NUMPACMANPICKUPS = 256, NUMEVENTS = 64, - NUM_CARGENS = 185, + NUM_CARGENS = 500, NUM_PATH_NODES_IN_AUTOPILOT = 8, @@ -111,7 +111,7 @@ enum Config { NUM_WATERCANNONS = 3, NUMPEDROUTES = 200, - NUMPHONES = 50, + NUMPHONES = 60, NUMPEDGROUPS = 67, NUMMODELSPERPEDGROUP = 16, MAXZONEPEDSLOADED = 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, @@ -197,6 +197,8 @@ enum Config { //#define COMPRESSED_COL_VECTORS // use compressed vectors for collision vertices //#define ANIM_COMPRESSION // only keep most recently used anims uncompressed +#define GTA_TRAIN + #if defined GTA_PS2 # define GTA_PS2_STUFF # define RANDOMSPLASH @@ -257,7 +259,7 @@ enum Config { #define USE_TXD_CDIMAGE // generate and load textures from txd.img #define PS2_ALPHA_TEST // emulate ps2 alpha test #define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number -#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time +//#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time #define DISABLE_VSYNC_ON_TEXTURE_CONVERSION // make texture conversion work faster by disabling vsync //#define USE_TEXTURE_POOL #ifdef LIBRW @@ -315,7 +317,7 @@ enum Config { # ifdef CUSTOM_FRONTEND_OPTIONS # define GRAPHICS_MENU_OPTIONS // otherwise Display settings will be scrollable -# define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU +//# define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU # define CUTSCENE_BORDERS_SWITCH # define MULTISAMPLING // adds MSAA option # define INVERT_LOOK_FOR_PAD // enable the hidden option @@ -369,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 d0663c30..c516cd84 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 @@ -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 37a82fb2..19dd57ba 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 80e8cb6b..efb6ec3b 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -157,7 +157,7 @@ void CheckAndSaveIniFloat(const char *cat, const char *key, float val, bool &cha void LoadINISettings() { - cfg.load_file("reVC.ini"); + cfg.load_file("reLCS.ini"); #ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS // Written by assuming the codes below will run after _InputInitialiseJoys(). @@ -280,7 +280,7 @@ void SaveINISettings() #endif if (changed) - cfg.write_file("reVC.ini"); + cfg.write_file("reLCS.ini"); } #endif @@ -310,7 +310,6 @@ void FastWeatherCheat(); void OnlyRenderWheelsCheat(); void ChittyChittyBangBangCheat(); void StrongGripCheat(); -void SpecialCarCheats(); void PickUpChicksCheat(); DebugMenuEntry *carCol1; @@ -441,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; @@ -581,11 +578,10 @@ DebugMenuPopulate(void) DebugMenuAddCmd("Cheats", "Only render wheels", OnlyRenderWheelsCheat); DebugMenuAddCmd("Cheats", "Chitty chitty bang bang", ChittyChittyBangBangCheat); DebugMenuAddCmd("Cheats", "Strong grip", StrongGripCheat); - DebugMenuAddCmd("Cheats", "Special car", SpecialCarCheats); 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 || @@ -600,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); }); @@ -623,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); @@ -657,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); @@ -669,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); 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 183b85da..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,8 +144,6 @@ void AttachRimPipe(rw::Clump *clump); } -#endif - namespace WorldRender{ extern int numBlendInsts[3]; void AtomicFirstPass(RpAtomic *atomic, int pass); @@ -143,3 +152,4 @@ void RenderBlendPass(int pass); } #endif +#endif diff --git a/src/extras/custompipes_d3d9.cpp b/src/extras/custompipes_d3d9.cpp index d0984ffe..9a02f874 100644 --- a/src/extras/custompipes_d3d9.cpp +++ b/src/extras/custompipes_d3d9.cpp @@ -2,6 +2,10 @@ #include "common.h" #ifdef RW_D3D9 +#ifdef EXTENDED_PIPELINES + +#include "rpmatfx.h" + #include "main.h" #include "RwHelper.h" #include "Lights.h" @@ -14,8 +18,6 @@ #include "World.h" #include "custompipes.h" -#ifdef EXTENDED_PIPELINES - #ifndef LIBRW #error "Need librw for EXTENDED_PIPELINES" #endif @@ -36,13 +38,193 @@ enum { VSLOC_eye = rw::d3d::VSLOC_afterLights, VSLOC_reflProps, - VSLOC_specLights + VSLOC_specLights, + + // Leeds building, Leeds vehicle mobile + VSLOC_emissive = rw::d3d::VSLOC_afterLights, + VSLOC_ambient, + VSLOC_viewMat, // only vehicle + + 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; @@ -83,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; } @@ -140,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); @@ -158,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; @@ -175,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; } @@ -182,11 +398,12 @@ DestroyVehiclePipe(void) /* - * Neo World pipe + * Leeds World pipe */ -static void *neoWorld_VS; -static void *neoWorldVC_PS; +static void *leedsBuilding_VS; +static void *leedsBuilding_mobile_VS; +static void *scale_PS; static void worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) @@ -195,79 +412,72 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header) using namespace rw::d3d; using namespace rw::d3d9; - if(!LightmapEnable){ - defaultRenderCB_Shader(atomic, header); - return; - } - - int vsBits; setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride); setIndices(header->indexBuffer); setVertexDeclaration(header->vertexDeclaration); - vsBits = lightingCB_Shader(atomic); + if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE) + setVertexShader(CustomPipes::leedsBuilding_mobile_VS); + else + setVertexShader(CustomPipes::leedsBuilding_VS); + setPixelShader(scale_PS); + uploadMatrices(atomic->getFrame()->getLTM()); + 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); - float lightfactor[4]; + float colorscale[4]; + colorscale[3] = 1.0f; InstanceData *inst = header->inst; for(rw::uint32 i = 0; i < header->numMeshes; i++){ Material *m = inst->material; - if(MatFX::getEffects(m) == MatFX::DUAL){ - setVertexShader(neoWorld_VS); - - MatFX *matfx = MatFX::get(m); - Texture *dualtex = matfx->getDualTexture(); - if(dualtex == nil) - goto notex; - d3d::setTexture(1, dualtex); - lightfactor[0] = lightfactor[1] = lightfactor[2] = WorldLightmapBlend.Get()*LightmapMult; - }else{ - notex: - setVertexShader(default_amb_VS); - - d3d::setTexture(1, nil); - lightfactor[0] = lightfactor[1] = lightfactor[2] = 0.0f; - } - lightfactor[3] = m->color.alpha/255.0f; - d3d::setTexture(0, m->texture); - d3ddevice->SetPixelShaderConstantF(1, lightfactor, 1); - - SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255); - - RGBA color = { 255, 255, 255, m->color.alpha }; - setMaterial(color, m->surfaceProps); + float cs = 1.0f; + if(WorldPipeSwitch == WORLDPIPE_PS2 && m->texture) + cs = 255/128.0f; + colorscale[0] = colorscale[1] = colorscale[2] = cs; + d3ddevice->SetPixelShaderConstantF(PSLOC_colorscale, colorscale, 1); if(m->texture) d3d::setTexture(0, m->texture); else - d3d::setTexture(0, gpWhiteTexture); - setPixelShader(neoWorldVC_PS); + d3d::setTexture(0, gpWhiteTexture); // actually we don't even render this + + setMaterial(m->color, m->surfaceProps, WorldPipeSwitch == WORLDPIPE_PS2 ? 0.5f : 1.0f); + + SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255); drawInst(header, inst); inst++; } - d3d::setTexture(1, nil); } void CreateWorldPipe(void) { - if(CFileMgr::LoadFile("neo/worldTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0) - printf("Error: couldn't open 'neo/worldTweakingTable.dat'\n"); - else - ReadTweakValueTable((char*)work_buff, WorldLightmapBlend); - -#include "shaders/default_UV2_VS.inc" - neoWorld_VS = rw::d3d::createVertexShader(default_UV2_VS_cso); - assert(neoWorld_VS); - -#include "shaders/neoWorldVC_PS.inc" - neoWorldVC_PS = rw::d3d::createPixelShader(neoWorldVC_PS_cso); - assert(neoWorldVC_PS); - +// if(CFileMgr::LoadFile("neo/worldTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0) +// printf("Error: couldn't open 'neo/worldTweakingTable.dat'\n"); +// else +// ReadTweakValueTable((char*)work_buff, WorldLightmapBlend); + +#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); rw::d3d9::ObjPipeline *pipe = rw::d3d9::ObjPipeline::create(); pipe->instanceCB = rw::d3d9::defaultInstanceCB; @@ -279,10 +489,12 @@ CreateWorldPipe(void) void DestroyWorldPipe(void) { - rw::d3d::destroyVertexShader(neoWorld_VS); - neoWorld_VS = nil; - rw::d3d::destroyPixelShader(neoWorldVC_PS); - neoWorldVC_PS = nil; + 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; ((rw::d3d9::ObjPipeline*)worldPipe)->destroy(); @@ -553,12 +765,7 @@ DestroyRimLightPipes(void) } -#endif - #ifdef NEW_RENDERER -#ifndef LIBRW -#error "Need librw for NEW_PIPELINES" -#endif namespace WorldRender { @@ -616,10 +823,15 @@ AtomicFirstPass(RpAtomic *atomic, int pass) 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; @@ -631,22 +843,37 @@ AtomicFirstPass(RpAtomic *atomic, int pass) 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); + if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE) + setVertexShader(CustomPipes::leedsBuilding_mobile_VS); else - setAmbient(black); + 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; } - setMaterial(m->color, m->surfaceProps); + 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); - if(m->texture){ - d3d::setTexture(0, m->texture); - setPixelShader(default_tex_PS); - }else - setPixelShader(default_PS); + d3d::setTexture(0, m->texture); + + setMaterial(m->color, m->surfaceProps, 0.5f); drawInst(building->instHeader, inst); } @@ -680,7 +907,24 @@ RenderBlendPass(int pass) using namespace rw::d3d; using namespace rw::d3d9; - setVertexShader(default_amb_VS); + 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++){ @@ -690,26 +934,26 @@ RenderBlendPass(int pass) 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(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); - - if(m->texture){ - d3d::setTexture(0, m->texture); - setPixelShader(default_tex_PS); - }else - setPixelShader(default_PS); + setMaterial(color, m->surfaceProps, 0.5f); drawInst(building->instHeader, inst); } @@ -719,3 +963,4 @@ RenderBlendPass(int pass) #endif #endif +#endif diff --git a/src/extras/custompipes_gl.cpp b/src/extras/custompipes_gl.cpp index 67be4afd..eeb62b8d 100644 --- a/src/extras/custompipes_gl.cpp +++ b/src/extras/custompipes_gl.cpp @@ -1,6 +1,10 @@ #include "common.h" #ifdef RW_OPENGL +#ifdef EXTENDED_PIPELINES + +#include "rpmatfx.h" + #include "main.h" #include "RwHelper.h" #include "Lights.h" @@ -13,8 +17,6 @@ #include "World.h" #include "custompipes.h" -#ifdef EXTENDED_PIPELINES - #ifndef LIBRW #error "Need librw for EXTENDED_PIPELINES" #endif @@ -33,14 +35,208 @@ static int32 u_reflProps; static int32 u_specDir; static int32 u_specColor; +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) { @@ -80,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; } @@ -148,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); +// } { @@ -168,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; @@ -182,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; } @@ -189,10 +421,11 @@ DestroyVehiclePipe(void) /* - * Neo World pipe + * Leeds World pipe */ -rw::gl3::Shader *neoWorldShader; +rw::gl3::Shader *leedsWorldShader; +rw::gl3::Shader *leedsWorldShader_mobile; static void worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) @@ -200,15 +433,9 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) using namespace rw; using namespace rw::gl3; - if(!LightmapEnable){ - gl3::defaultRenderCB(atomic, header); - return; - } - Material *m; setWorldMatrix(atomic->getFrame()->getLTM()); - lightingCB(atomic); #ifdef RW_GL_USE_VAOS glBindVertexArray(header->vao); @@ -221,39 +448,42 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header) InstanceData *inst = header->inst; rw::int32 n = header->numMeshes; - neoWorldShader->use(); + 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(u_amb), 1, (float*)&amb); + glUniform4fv(U(u_emiss), 1, (float*)&emiss); - float lightfactor[4]; + float colorscale[4]; + colorscale[3] = 1.0f; while(n--){ m = inst->material; - if(MatFX::getEffects(m) == MatFX::DUAL){ - MatFX *matfx = MatFX::get(m); - Texture *dualtex = matfx->getDualTexture(); - if(dualtex == nil) - goto notex; - setTexture(1, dualtex); - lightfactor[0] = lightfactor[1] = lightfactor[2] = WorldLightmapBlend.Get()*LightmapMult; - }else{ - notex: - setTexture(1, nil); - lightfactor[0] = lightfactor[1] = lightfactor[2] = 0.0f; - } - lightfactor[3] = m->color.alpha/255.0f; - glUniform4fv(U(u_lightMap), 1, lightfactor); - - RGBA color = { 255, 255, 255, m->color.alpha }; - setMaterial(color, m->surfaceProps); + float cs = 1.0f; + 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, 0.5f); + rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF); drawInst(header, inst); inst++; } - setTexture(1, nil); #ifndef RW_GL_USE_VAOS disableAttribPointers(header->attribDesc, header->numAttribs); #endif @@ -265,18 +495,22 @@ CreateWorldPipe(void) using namespace rw; using namespace rw::gl3; - if(CFileMgr::LoadFile("neo/worldTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0) - printf("Error: couldn't open 'neo/worldTweakingTable.dat'\n"); - else - ReadTweakValueTable((char*)work_buff, WorldLightmapBlend); +// if(CFileMgr::LoadFile("neo/worldTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0) +// printf("Error: couldn't open 'neo/worldTweakingTable.dat'\n"); +// else +// ReadTweakValueTable((char*)work_buff, WorldLightmapBlend); { -#include "shaders/neoWorldVC_fs_gl.inc" -#include "shaders/default_UV2_gl.inc" - const char *vs[] = { shaderDecl, header_vert_src, default_UV2_vert_src, nil }; - const char *fs[] = { shaderDecl, header_frag_src, neoWorldVC_frag_src, nil }; - neoWorldShader = Shader::create(vs, fs); - assert(neoWorldShader); +#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,8 +524,10 @@ CreateWorldPipe(void) void DestroyWorldPipe(void) { - neoWorldShader->destroy(); - neoWorldShader = nil; + leedsWorldShader->destroy(); + leedsWorldShader = nil; + leedsWorldShader_mobile->destroy(); + leedsWorldShader_mobile = nil; ((rw::gl3::ObjPipeline*)worldPipe)->destroy(); worldPipe = nil; @@ -609,17 +845,22 @@ CustomPipeRegisterGL(void) u_reflProps = rw::gl3::registerUniform("u_reflProps"); u_specDir = rw::gl3::registerUniform("u_specDir"); u_specColor = rw::gl3::registerUniform("u_specColor"); -} + 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"); } -#endif + +} #ifdef NEW_RENDERER -#ifndef LIBRW -#error "Need librw for NEW_PIPELINES" -#endif namespace WorldRender { @@ -661,23 +902,19 @@ AtomicFirstPass(RpAtomic *atomic, int pass) 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(); + 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; @@ -686,7 +923,10 @@ AtomicFirstPass(RpAtomic *atomic, int pass) // alright we're rendering this atomic if(!setupDone){ - defaultShader->use(); + 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); @@ -695,11 +935,29 @@ AtomicFirstPass(RpAtomic *atomic, int pass) glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo); setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs); #endif - setLights(&lights); + + 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); + 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); @@ -736,11 +994,23 @@ RenderBlendPass(int pass) using namespace rw; using namespace rw::gl3; - defaultShader->use(); - WorldLights lights; - lights.numAmbients = 1; - lights.numDirectionals = 0; - lights.numLocals = 0; + 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++){ @@ -754,21 +1024,24 @@ RenderBlendPass(int pass) 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(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); + 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); @@ -783,3 +1056,4 @@ RenderBlendPass(int pass) #endif #endif +#endif diff --git a/src/extras/postfx.cpp b/src/extras/postfx.cpp index 2ea08141..b07b5426 100644 --- a/src/extras/postfx.cpp +++ b/src/extras/postfx.cpp @@ -25,14 +25,14 @@ static RwIm2DVertex Vertex2[4]; static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 }; #ifdef RW_D3D9 -void *colourfilterVC_PS; +void *colourfilterLCS_PS; void *contrast_PS; #endif #ifdef RW_OPENGL int32 u_blurcolor; int32 u_contrastAdd; int32 u_contrastMult; -rw::gl3::Shader *colourFilterVC; +rw::gl3::Shader *colourFilterLCS; rw::gl3::Shader *contrast; #endif @@ -143,8 +143,8 @@ CPostFX::Open(RwCamera *cam) #ifdef RW_D3D9 -#include "shaders/colourfilterVC_PS.inc" - colourfilterVC_PS = rw::d3d::createPixelShader(colourfilterVC_PS_cso); +#include "shaders/colourfilterLCS_PS.inc" + colourfilterLCS_PS = rw::d3d::createPixelShader(colourfilterLCS_PS_cso); #include "shaders/contrastPS.inc" contrast_PS = rw::d3d::createPixelShader(contrastPS_cso); #endif @@ -153,11 +153,11 @@ CPostFX::Open(RwCamera *cam) { #include "shaders/im2d_gl.inc" -#include "shaders/colourfilterVC_fs_gl.inc" +#include "shaders/colourfilterLCS_fs_gl.inc" const char *vs[] = { shaderDecl, header_vert_src, im2d_vert_src, nil }; - const char *fs[] = { shaderDecl, header_frag_src, colourfilterVC_frag_src, nil }; - colourFilterVC = Shader::create(vs, fs); - assert(colourFilterVC); + const char *fs[] = { shaderDecl, header_frag_src, colourfilterLCS_frag_src, nil }; + colourFilterLCS = Shader::create(vs, fs); + assert(colourFilterLCS); } { @@ -184,9 +184,9 @@ CPostFX::Close(void) pBackBuffer = nil; } #ifdef RW_D3D9 - if(colourfilterVC_PS){ - rw::d3d::destroyPixelShader(colourfilterVC_PS); - colourfilterVC_PS = nil; + if(colourfilterLCS_PS){ + rw::d3d::destroyPixelShader(colourfilterLCS_PS); + colourfilterLCS_PS = nil; } if(contrast_PS){ rw::d3d::destroyPixelShader(contrast_PS); @@ -194,9 +194,9 @@ CPostFX::Close(void) } #endif #ifdef RW_OPENGL - if(colourFilterVC){ - colourFilterVC->destroy(); - colourFilterVC = nil; + if(colourFilterLCS){ + colourFilterLCS->destroy(); + colourFilterLCS = nil; } if(contrast){ contrast->destroy(); @@ -294,12 +294,12 @@ CPostFX::RenderOverlayShader(RwCamera *cam, int32 r, int32 g, int32 b, int32 a) blurcolors[3] = 30/255.0f; #ifdef RW_D3D9 rw::d3d::d3ddevice->SetPixelShaderConstantF(10, blurcolors, 1); - rw::d3d::im2dOverridePS = colourfilterVC_PS; + rw::d3d::im2dOverridePS = colourfilterLCS_PS; #endif #ifdef RW_OPENGL - rw::gl3::im2dOverrideShader = colourFilterVC; - colourFilterVC->use(); - glUniform4fv(colourFilterVC->uniformLocations[u_blurcolor], 1, blurcolors); + rw::gl3::im2dOverrideShader = colourFilterLCS; + colourFilterLCS->use(); + glUniform4fv(colourFilterLCS->uniformLocations[u_blurcolor], 1, blurcolors); #endif } RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6); 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 5089e16a..393ab660 100644 --- a/src/extras/shaders/Makefile +++ b/src/extras/shaders/Makefile @@ -1,19 +1,22 @@ all: im2d_gl.inc simple_fs_gl.inc default_UV2_gl.inc \ - colourfilterVC_fs_gl.inc contrast_fs_gl.inc \ + colourfilterLCS_fs_gl.inc contrast_fs_gl.inc \ neoRim_gl.inc neoRimSkin_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 + im2d_UV2_gl.inc screenDroplet_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 =';\ sed 's/..*/"&\\n"/' im2d.vert;\ echo ';') >im2d_gl.inc -colourfilterVC_fs_gl.inc: colourfilterVC.frag - (echo 'const char *colourfilterVC_frag_src =';\ - sed 's/..*/"&\\n"/' colourfilterVC.frag;\ - echo ';') >colourfilterVC_fs_gl.inc +colourfilterLCS_fs_gl.inc: colourfilterLCS.frag + (echo 'const char *colourfilterLCS_frag_src =';\ + sed 's/..*/"&\\n"/' colourfilterLCS.frag;\ + echo ';') >colourfilterLCS_fs_gl.inc simple_fs_gl.inc: simple.frag (echo 'const char *simple_frag_src =';\ sed 's/..*/"&\\n"/' simple.frag;\ @@ -76,3 +79,43 @@ screenDroplet_fs_gl.inc: screenDroplet.frag (echo 'const char *screenDroplet_frag_src =';\ sed 's/..*/"&\\n"/' screenDroplet.frag;\ echo ';') >screenDroplet_fs_gl.inc + +leedsBuilding_vs_gl.inc: leedsBuilding.vert + (echo 'const char *leedsBuilding_vert_src =';\ + 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/colourfilterLCS.frag b/src/extras/shaders/colourfilterLCS.frag new file mode 100644 index 00000000..67348d0c --- /dev/null +++ b/src/extras/shaders/colourfilterLCS.frag @@ -0,0 +1,20 @@ +uniform sampler2D tex0; +uniform vec4 u_blurcolor; + +FSIN vec4 v_color; +FSIN vec2 v_tex0; +FSIN float v_fog; + +void +main(void) +{ + vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y)); + dst += dst*u_blurcolor; + + vec4 color; + color.rgb = dst.rgb; + color.a = 1.0f; + + FRAGCOLOR(color); +} + diff --git a/src/extras/shaders/colourfilterLCS_PS.cso b/src/extras/shaders/colourfilterLCS_PS.cso Binary files differnew file mode 100644 index 00000000..e5ffa3f1 --- /dev/null +++ b/src/extras/shaders/colourfilterLCS_PS.cso diff --git a/src/extras/shaders/colourfilterLCS_PS.hlsl b/src/extras/shaders/colourfilterLCS_PS.hlsl new file mode 100644 index 00000000..bd91567d --- /dev/null +++ b/src/extras/shaders/colourfilterLCS_PS.hlsl @@ -0,0 +1,13 @@ +sampler2D tex : register(s0); +float4 blurcol : register(c10); + +//float4 blurcols[10] : register(c15); + + +float4 main(in float2 texcoord : TEXCOORD0) : COLOR0 +{ + float4 dst = tex2D(tex, texcoord.xy); + dst += dst*blurcol; + dst.a = 1.0; + return dst; +} diff --git a/src/extras/shaders/colourfilterLCS_PS.inc b/src/extras/shaders/colourfilterLCS_PS.inc new file mode 100644 index 00000000..f9eeab52 --- /dev/null +++ b/src/extras/shaders/colourfilterLCS_PS.inc @@ -0,0 +1,27 @@ +static unsigned char colourfilterLCS_PS_cso[] = { + 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x2b, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, + 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x70, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00, + 0x01, 0x00, 0x2a, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x6c, 0x75, 0x72, + 0x63, 0x6f, 0x6c, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00, + 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 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, + 0x51, 0x00, 0x00, 0x05, 0x00, 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, 0x03, 0xb0, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, + 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, + 0x00, 0x08, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xe4, 0x80, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, + 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, + 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/colourfilterLCS_fs_gl.inc b/src/extras/shaders/colourfilterLCS_fs_gl.inc new file mode 100644 index 00000000..2c8e3532 --- /dev/null +++ b/src/extras/shaders/colourfilterLCS_fs_gl.inc @@ -0,0 +1,22 @@ +const char *colourfilterLCS_frag_src = +"uniform sampler2D tex0;\n" +"uniform vec4 u_blurcolor;\n" + +"FSIN vec4 v_color;\n" +"FSIN vec2 v_tex0;\n" +"FSIN float v_fog;\n" + +"void\n" +"main(void)\n" +"{\n" +" vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n" +" dst += dst*u_blurcolor;\n" + +" vec4 color;\n" +" color.rgb = dst.rgb;\n" +" color.a = 1.0f;\n" + +" FRAGCOLOR(color);\n" +"}\n" + +; diff --git a/src/extras/shaders/colourfilterVC.frag b/src/extras/shaders/colourfilterVC.frag deleted file mode 100644 index 9db3950e..00000000 --- a/src/extras/shaders/colourfilterVC.frag +++ /dev/null @@ -1,27 +0,0 @@ -uniform sampler2D tex0; -uniform vec4 u_blurcolor; - -FSIN vec4 v_color; -FSIN vec2 v_tex0; -FSIN float v_fog; - -void -main(void) -{ - float a = u_blurcolor.a; - vec4 doublec = clamp(u_blurcolor*2.0, 0.0, 1.0); - vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y)); - vec4 prev = dst; - for(int i = 0; i < 5; i++){ - vec4 tmp = dst*(1.0-a) + prev*doublec*a; - tmp += prev*u_blurcolor; - tmp += prev*u_blurcolor; - prev = clamp(tmp, 0.0, 1.0); - } - vec4 color; - color.rgb = prev.rgb; - color.a = 1.0f; - - FRAGCOLOR(color); -} - diff --git a/src/extras/shaders/colourfilterVC_PS.cso b/src/extras/shaders/colourfilterVC_PS.cso Binary files differdeleted file mode 100644 index 4b0e9f3f..00000000 --- a/src/extras/shaders/colourfilterVC_PS.cso +++ /dev/null diff --git a/src/extras/shaders/colourfilterVC_PS.hlsl b/src/extras/shaders/colourfilterVC_PS.hlsl deleted file mode 100644 index 1e62950b..00000000 --- a/src/extras/shaders/colourfilterVC_PS.hlsl +++ /dev/null @@ -1,23 +0,0 @@ -sampler2D tex : register(s0); -float4 blurcol : register(c10); - -//float4 blurcols[10] : register(c15); - - -float4 main(in float2 texcoord : TEXCOORD0) : COLOR0 -{ - float a = blurcol.a; - - float4 doublec = saturate(blurcol*2); - float4 dst = tex2D(tex, texcoord.xy); - float4 prev = dst; - for(int i = 0; i < 5; i++){ -// float4 doublec = saturate(blurcol*2); - float4 tmp = dst*(1-a) + prev*doublec*a; - tmp += prev*blurcol; - tmp += prev*blurcol; - prev = saturate(tmp); - } - prev.a = 1.0f; - return prev; -} diff --git a/src/extras/shaders/colourfilterVC_PS.inc b/src/extras/shaders/colourfilterVC_PS.inc deleted file mode 100644 index daa18360..00000000 --- a/src/extras/shaders/colourfilterVC_PS.inc +++ /dev/null @@ -1,56 +0,0 @@ -static unsigned char colourfilterVC_PS_cso[] = { - 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x2b, 0x00, 0x43, 0x54, 0x41, 0x42, - 0x1c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, - 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x70, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00, - 0x01, 0x00, 0x2a, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x6c, 0x75, 0x72, - 0x63, 0x6f, 0x6c, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00, - 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 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, - 0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x40, - 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xb0, - 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, - 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, - 0x00, 0x08, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x17, 0x80, - 0x0a, 0x00, 0xe4, 0xa0, 0x0a, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, - 0x02, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x80, - 0x12, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80, 0x0a, 0x00, 0xff, 0xa0, - 0x02, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, - 0x02, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0, - 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0x00, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, - 0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80, - 0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, - 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, - 0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80, - 0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, - 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, - 0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80, - 0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, - 0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03, - 0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80, - 0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, - 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80, - 0x00, 0x00, 0x00, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, - 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, 0x02, - 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00 -}; diff --git a/src/extras/shaders/colourfilterVC_fs_gl.inc b/src/extras/shaders/colourfilterVC_fs_gl.inc deleted file mode 100644 index 1f9bf6d8..00000000 --- a/src/extras/shaders/colourfilterVC_fs_gl.inc +++ /dev/null @@ -1,29 +0,0 @@ -const char *colourfilterVC_frag_src = -"uniform sampler2D tex0;\n" -"uniform vec4 u_blurcolor;\n" - -"FSIN vec4 v_color;\n" -"FSIN vec2 v_tex0;\n" -"FSIN float v_fog;\n" - -"void\n" -"main(void)\n" -"{\n" -" float a = u_blurcolor.a;\n" -" vec4 doublec = clamp(u_blurcolor*2.0, 0.0, 1.0);\n" -" vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n" -" vec4 prev = dst;\n" -" for(int i = 0; i < 5; i++){\n" -" vec4 tmp = dst*(1.0-a) + prev*doublec*a;\n" -" tmp += prev*u_blurcolor;\n" -" tmp += prev*u_blurcolor;\n" -" prev = clamp(tmp, 0.0, 1.0);\n" -" }\n" -" vec4 color;\n" -" color.rgb = prev.rgb;\n" -" color.a = 1.0f;\n" - -" FRAGCOLOR(color);\n" -"}\n" - -; diff --git a/src/extras/shaders/leedsBuilding.vert b/src/extras/shaders/leedsBuilding.vert new file mode 100644 index 00000000..766cd081 --- /dev/null +++ b/src/extras/shaders/leedsBuilding.vert @@ -0,0 +1,28 @@ +uniform vec4 u_amb; +uniform vec4 u_emiss; + +#define surfEmissive (u_surfProps.w) + +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; + + v_color = in_color; + v_color.rgb *= u_amb.rgb; + v_color.rgb += u_emiss.rgb*surfEmissive; + 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_VS.cso b/src/extras/shaders/leedsBuilding_VS.cso Binary files differnew file mode 100644 index 00000000..6720364d --- /dev/null +++ b/src/extras/shaders/leedsBuilding_VS.cso diff --git a/src/extras/shaders/leedsBuilding_VS.hlsl b/src/extras/shaders/leedsBuilding_VS.hlsl new file mode 100644 index 00000000..1ed939cc --- /dev/null +++ b/src/extras/shaders/leedsBuilding_VS.hlsl @@ -0,0 +1,43 @@ +#include "standardConstants.h" + +#define surfEmissive (surfProps.w) + +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; + + output.Color = input.Prelight; + output.Color.rgb *= ambient.rgb; + output.Color.rgb += emissive.rgb*surfEmissive; + + 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_VS.inc b/src/extras/shaders/leedsBuilding_VS.inc new file mode 100644 index 00000000..490a8c01 --- /dev/null +++ b/src/extras/shaders/leedsBuilding_VS.inc @@ -0,0 +1,57 @@ +static unsigned char leedsBuilding_VS_cso[] = { + 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, + 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, 0x04, 0x00, 0x55, 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.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 new file mode 100644 index 00000000..33c5eccc --- /dev/null +++ b/src/extras/shaders/leedsBuilding_vs_gl.inc @@ -0,0 +1,30 @@ +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" +"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" + +" v_color = in_color;\n" +" v_color.rgb *= u_amb.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" + +" v_fog = DoFog(gl_Position.w);\n" +"}\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/extras/shaders/scale.frag b/src/extras/shaders/scale.frag new file mode 100644 index 00000000..29165154 --- /dev/null +++ b/src/extras/shaders/scale.frag @@ -0,0 +1,18 @@ +uniform sampler2D tex0; +uniform vec4 u_colorscale; + +FSIN vec4 v_color; +FSIN vec2 v_tex0; +FSIN float v_fog; + +void +main(void) +{ + vec4 color; + color = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y))*u_colorscale; + color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog); + DoAlphaTest(color.a); + + FRAGCOLOR(color); +} + diff --git a/src/extras/shaders/scale_PS.cso b/src/extras/shaders/scale_PS.cso Binary files differnew file mode 100644 index 00000000..d7f7374c --- /dev/null +++ b/src/extras/shaders/scale_PS.cso diff --git a/src/extras/shaders/scale_PS.hlsl b/src/extras/shaders/scale_PS.hlsl new file mode 100644 index 00000000..92466e94 --- /dev/null +++ b/src/extras/shaders/scale_PS.hlsl @@ -0,0 +1,19 @@ +struct VS_out { + float4 Position : POSITION; + float3 TexCoord0 : TEXCOORD0; + float4 Color : COLOR0; +}; + +sampler2D tex0 : register(s0); + +float4 fogColor : register(c0); +float4 colorscale : register(c1); + +float4 main(VS_out input) : COLOR +{ + float4 color = input.Color; + color *= tex2D(tex0, input.TexCoord0.xy); + color *= colorscale; + color.rgb = lerp(fogColor.rgb, color.rgb, input.TexCoord0.z); + return color; +} diff --git a/src/extras/shaders/scale_PS.inc b/src/extras/shaders/scale_PS.inc new file mode 100644 index 00000000..5f711ac8 --- /dev/null +++ b/src/extras/shaders/scale_PS.inc @@ -0,0 +1,33 @@ +static unsigned char scale_PS_cso[] = { + 0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x34, 0x00, 0x43, 0x54, 0x41, 0x42, + 0x1c, 0x00, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, + 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x94, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x06, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x74, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x84, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x73, 0x63, 0x61, + 0x6c, 0x65, 0x00, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x67, 0x43, + 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x74, 0x65, 0x78, 0x30, 0x00, 0xab, 0xab, + 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 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, + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x07, 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, + 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0, + 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, + 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, + 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0xa0, + 0x01, 0x00, 0xe4, 0x81, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x08, 0x80, + 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0xff, 0xa0, 0x04, 0x00, 0x00, 0x04, + 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xaa, 0xb0, 0x00, 0x00, 0xe4, 0x80, + 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, + 0x01, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00 +}; diff --git a/src/extras/shaders/scale_fs_gl.inc b/src/extras/shaders/scale_fs_gl.inc new file mode 100644 index 00000000..8d9563e2 --- /dev/null +++ b/src/extras/shaders/scale_fs_gl.inc @@ -0,0 +1,20 @@ +const char *scale_frag_src = +"uniform sampler2D tex0;\n" +"uniform vec4 u_colorscale;\n" + +"FSIN vec4 v_color;\n" +"FSIN vec2 v_tex0;\n" +"FSIN float v_fog;\n" + +"void\n" +"main(void)\n" +"{\n" +" vec4 color;\n" +" color = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y))*u_colorscale;\n" +" color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog);\n" +" DoAlphaTest(color.a);\n" + +" FRAGCOLOR(color);\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 new file mode 100644 index 00000000..57e7d954 --- /dev/null +++ b/src/leeds/base/memoryManager.cpp @@ -0,0 +1,75 @@ +#include "common.h" +#include "memoryManager.h" + +namespace base +{ + cMemoryManager::cMemoryManager() + { + + } + + void* cMemoryManager::Allocate(uint32 size) + { + void* buf = malloc(size); + memset(buf, 0, size); + return buf; + } + + void* cMemoryManager::AllocateAligned(uint32 size) + { + void* buf = malloc(size); + memset(buf, 0, size); + return buf; + } + + void* cMemoryManager::Realloc(void* buf, uint32 newSize, bool unk) + { + return realloc(buf, newSize); + } + + void cMemoryManager::Free(void* buf) + { + if (buf) + free(buf); + } + + bool cMemoryManager::IsFree(void* buf) + { + return buf == nil; + } + + + cMainMemoryManager* cMainMemoryManager::m_pInstance = nil; + + cMainMemoryManager::cMainMemoryManager() + { + assert(m_pInstance == nil); + m_pInstance = this; + Init(nil, 0); + } + + void cMainMemoryManager::Init(void*, uint32) + { + + } +}; + +void* operator new(size_t size) +{ + return base::cMainMemoryManager::Instance()->Allocate(size); +} + +void* operator new[](size_t size) +{ + return base::cMainMemoryManager::Instance()->Allocate(size); +} + +void operator delete(void* buf) noexcept +{ + base::cMainMemoryManager::Instance()->Free(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 new file mode 100644 index 00000000..91124cd1 --- /dev/null +++ b/src/leeds/base/memoryManager.h @@ -0,0 +1,39 @@ +#pragma once + +namespace base +{ + class cMemoryManager + { + public: + cMemoryManager(); + void* Allocate(uint32 size); + void* AllocateAligned(uint32 size); + void* Realloc(void* buf, uint32 newSize, bool unk); + void Free(void* buf); + bool IsFree(void* buf); + }; + + class cMainMemoryManager : public cMemoryManager + { + static cMainMemoryManager* m_pInstance; + static void Init(void*, uint32); + + public: + cMainMemoryManager(); + static cMainMemoryManager *Instance() + { + static cMainMemoryManager instance; + return &instance; + } + }; + + class cMemoryBlock + { + // TODO + }; +} + +void* operator new(size_t size); +void* operator new[](size_t size); +void operator delete(void* buf) noexcept; +void operator delete[](void* buf) noexcept;
\ No newline at end of file diff --git a/src/leeds/base/relocatableChunk.cpp b/src/leeds/base/relocatableChunk.cpp new file mode 100644 index 00000000..5cb5a426 --- /dev/null +++ b/src/leeds/base/relocatableChunk.cpp @@ -0,0 +1,36 @@ +#include "common.h" +#include "relocatableChunk.h" + +namespace base +{ + // TODO(LCS): add actual code (all of these are stubs) + + void* cRelocatableChunk::Load(void* data, bool bShrink) { return nil; } + void* cRelocatableChunk::Load(const char* name, bool bShrink) { return nil; } + void cRelocatableChunk::Fixup(const sChunkHeader& header, void* data) {} + void cRelocatableChunk::Fixup(void* data) {} + void* cRelocatableChunk::Shrink(const sChunkHeader& header, void* data) { return nil; } + void* cRelocatableChunk::Shrink(void* data) { return nil; } + + cRelocatableChunkClassInfo::cRelocatableChunkClassInfo(const char* class_name, const void* pVmt, int size) {} + + cRelocatableChunkWriter::cRelocatableChunkWriter() {} + cRelocatableChunkWriter::~cRelocatableChunkWriter() {} + + void cRelocatableChunkWriter::AddPatch(void* addr) {} + void cRelocatableChunkWriter::AddPatchWithInfo(const char* str, int unk, void* addr) {} + void cRelocatableChunkWriter::AllocateRaw(void* addr, uint32 size, uint32 align, bool a5, bool a6) {} + + void cRelocatableChunkWriter::Clear() {} + void cRelocatableChunkWriter::Class(void* ptr, const cRelocatableChunkClassInfo& classInfo) {} + void cRelocatableChunkWriter::DebugFileLine(void*) {} + + void cRelocatableChunkWriter::PatchFunc(void* ptr) {} + + bool cRelocatableChunkWriter::IsAllocated(void* addr) { return false; } + + void cRelocatableChunkWriter::Reserve(int, int) {} + + void cRelocatableChunkWriter::Save(const char* filename, uint32 a3, uint32 a4, bool a5) {} + void cRelocatableChunkWriter::Save(void* file, uint32 a3, uint32 a4, bool a5, sChunkHeader* pHeader) {} +};
\ No newline at end of file diff --git a/src/leeds/base/relocatableChunk.h b/src/leeds/base/relocatableChunk.h new file mode 100644 index 00000000..ea910240 --- /dev/null +++ b/src/leeds/base/relocatableChunk.h @@ -0,0 +1,51 @@ +#pragma once + +namespace base +{ + // TODO(LCS): add actual struct fields + + struct sChunkHeader; + struct sDataBlock; + struct sFileLine; + + class cRelocatableChunk + { + public: + void* Load(void* data, bool bShrink); + void* Load(const char* name, bool bShrink); + void Fixup(const sChunkHeader& header, void* data); + void Fixup(void* data); + void* Shrink(const sChunkHeader& header, void* data); + void* Shrink(void* data); + }; + + class cRelocatableChunkClassInfo + { + public: + cRelocatableChunkClassInfo(const char* class_name, const void* pVmt, int size); + }; + + class cRelocatableChunkWriter + { + public: + cRelocatableChunkWriter(); + ~cRelocatableChunkWriter(); + + void AddPatch(void* addr); + void AddPatchWithInfo(const char* str, int unk, void* addr); + void AllocateRaw(void* addr, uint32 size, uint32 align, bool a5 = false, bool a6 = false); + + void Clear(); + void Class(void* ptr, const cRelocatableChunkClassInfo& classInfo); + void DebugFileLine(void*); + + void PatchFunc(void* ptr); + + bool IsAllocated(void* addr); + + void Reserve(int, int); + + void Save(const char* filename, uint32 a3, uint32 a4, bool a5); + void Save(void* file, uint32 a3, uint32 a4, bool a5, sChunkHeader* pHeader); + }; +};
\ 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 182a0cea..792904fc 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -157,96 +157,85 @@ enum MI_FIREMAN, MI_MALE01, - MI_HFYST = 9, - MI_HFOST, - MI_HMYST, - MI_HMOST, - MI_HFYRI, - MI_HFORI, - MI_HMYRI, - MI_HMORI, - MI_HFYBE, - MI_HFOBE, - MI_HMYBE, - MI_HMOBE, - MI_HFYBU, - MI_HFYMD, - MI_HFYCG, - MI_HFYPR, - MI_HFOTR, - MI_HMOTR, - MI_HMYAP, - MI_HMOCA, - MI_TAXI_D = MI_HMOCA, - MI_BMODK, - MI_BMYKR, - MI_BFYST, - MI_BFOST, - MI_BMYST, - MI_BMOST, - MI_BFYRI, - MI_BFORI, - MI_BMYRI, - MI_BFYBE, - MI_BMYBE, - MI_BFOBE, - MI_BMOBE, - MI_BMYBU, - MI_BFYPR, - MI_BFOTR, - MI_BMOTR, - MI_BMYPI, - MI_BMYBB, - MI_WMYCR, - MI_WFYST, - MI_WFOST, - MI_WMYST, - MI_WMOST, - MI_WFYRI, - MI_WFORI, - MI_WMYRI, - MI_WMORI, - MI_WFYBE, - MI_WMYBE, - MI_WFOBE, - MI_WMOBE, - MI_WMYCW, - MI_WMYGO, - MI_WFOGO, - MI_WMOGO, - MI_WFYLG, - MI_WMYLG, - MI_WFYBU, - MI_WMYBU, - MI_WMOBU, - MI_WFYPR, - MI_WFOTR, - MI_WMOTR, - MI_WMYPI, - MI_WMOCA, - MI_WFYJG, - MI_WMYJG, - MI_WFYSK, - MI_WMYSK, - MI_WFYSH, - MI_WFOSH, - MI_JFOTO, - MI_JMOTO, - - MI_CBA,// = 83, - MI_CBB, - MI_HNA, - MI_HNB, - MI_SGA, - MI_SGB, - MI_CLA, - MI_CLB, - MI_GDA, - MI_GDB, - MI_BKA, - MI_BKB, - MI_PGA, - MI_PGB, + MI_TAXI_D = 9, + MI_PIMP, + MI_CRIMINAL01, + MI_CRIMINAL02, + MI_MALE02, + MI_MALE03, + MI_FATMALE01, + MI_FATMALE02, + MI_FEMALE01, + MI_FEMALE02, + MI_FEMALE03, + MI_FATFEMALE01, + MI_FATFEMALE02, + MI_PROSTITUTE, + MI_PROSTITUTE2, + MI_P_MAN1, + MI_P_MAN2, + MI_P_WOM1, + MI_P_WOM2, + MI_CT_MAN1, + MI_CT_MAN2, + MI_CT_WOM1, + MI_CT_WOM2, + MI_LI_MAN1, + MI_LI_MAN2, + MI_LI_WOM1, + MI_LI_WOM2, + MI_DOCKER1, + MI_DOCKER2, + MI_SCUM_MAN, + MI_SCUM_WOM, + MI_WORKER1, + MI_WORKER2, + MI_B_MAN1, + MI_B_MAN2, + MI_B_MAN3, + MI_B_WOM1, + MI_B_WOM2, + MI_B_WOM3, + MI_MOD_MAN, + MI_MOD_WOM, + MI_ST_MAN, + MI_ST_WOM, + MI_FAN_MAN1, + MI_FAN_MAN2, + MI_FAN_WOM, + MI_HOS_MAN, + MI_HOS_WOM, + MI_CONST1, + MI_CONST2, + MI_SHOPPER1, + MI_SHOPPER2, + MI_SHOPPER3, + MI_STUD_MAN, + MI_STUD_WOM, + MI_CAS_MAN, + MI_CAS_WOM, + MI_CAMP_MAN, + MI_CAMP_WOM, + MI_HITMAN, + + MI_GANG01 = 79, + MI_GANG02, + MI_GANG03, + MI_GANG04, + MI_GANG05, + MI_GANG06, + MI_GANG07, + MI_GANG08, + MI_GANG09, + MI_GANG10, + MI_GANG11, + MI_GANG12, + MI_GANG13, + MI_GANG14, + MI_GANG15, + MI_GANG16, + MI_GANG17, + MI_GANG18, MI_VICE1, MI_VICE2, MI_VICE3, @@ -283,19 +272,20 @@ enum MI_LAST_PED = MI_SPECIAL21, MI_FIRST_VEHICLE, - MI_LANDSTAL = MI_FIRST_VEHICLE, + MI_SPIDER = MI_FIRST_VEHICLE, + MI_LANDSTAL, MI_IDAHO, MI_STINGER, MI_LINERUN, MI_PEREN, MI_SENTINEL, - MI_RIO, + MI_PATRIOT, MI_FIRETRUCK, MI_TRASH, MI_STRETCH, MI_MANANA, MI_INFERNUS, - MI_VOODOO, + MI_BLISTA, MI_PONY, MI_MULE, MI_CHEETAH, @@ -304,100 +294,120 @@ enum MI_MOONBEAM, MI_ESPERANT, MI_TAXI, - MI_WASHING, + MI_KURUMA, MI_BOBCAT, MI_MRWHOOP, MI_BFINJECT, - MI_HUNTER, + MI_HEARSE, MI_POLICE, MI_ENFORCER, MI_SECURICA, MI_BANSHEE, - MI_PREDATOR, MI_BUS, MI_RHINO, MI_BARRACKS, - MI_CUBAN, - MI_CHOPPER, - MI_ANGEL, + MI_DODO, MI_COACH, MI_CABBIE, MI_STALLION, MI_RUMPO, MI_RCBANDIT, - MI_ROMERO, - MI_PACKER, - MI_SENTXS, - MI_ADMIRAL, - MI_SQUALO, - MI_SEASPAR, - MI_PIZZABOY, - MI_GANGBUR, - MI_AIRTRAIN, - MI_DEADDODO, - MI_SPEEDER, - MI_REEFER, - MI_TROPIC, + MI_BELLYUP, + MI_MRWONGS, + MI_MAFIA, + MI_YARDIE, + MI_YAKUZA, + MI_DIABLOS, + MI_COLUMB, + MI_HOODS, + MI_PANLANT, MI_FLATBED, MI_YANKEE, - MI_CADDY, - MI_ZEBRA, - MI_TOPFUN, - MI_SKIMMER, + MI_BORGNINE, + MI_TOYZ, + MI_CAMPVAN, + MI_BALLOT, + MI_SHELBY, + MI_PONTIAC, + MI_ESPRIT, + MI_AMMOTRUK, + MI_HOTROD, + MI_SINDACCO_CAR, + MI_FORELLI_CAR, + MI_FERRY, + MI_GHOST, + MI_SPEEDER, + MI_REEFER, + MI_PREDATOR, + MI_TRAIN, + MI_ESCAPE, + MI_CHOPPER, + MI_AIRTRAIN, + MI_DEADDODO, + MI_ANGEL, + MI_PIZZABOY, + MI_NOODLEBOY, MI_PCJ600, MI_FAGGIO, MI_FREEWAY, - MI_RCBARON, - MI_RCRAIDER, - MI_GLENDALE, - MI_OCEANIC, + MI_ANGEL2, + MI_SANCHEZ2, MI_SANCHEZ, + MI_RCGOBLIN, + MI_RCRAIDER, + MI_HUNTER, + MI_MAVERICK, + MI_POLMAV, + MI_VCNMAV, + + MI_LAST_VEHICLE = MI_VCNMAV, + + // HACK HACK, hopefully temporary + MI_SEASPAR = -1000, MI_SPARROW, - MI_PATRIOT, - MI_LOVEFIST, + MI_RCBARON, + MI_TOPFUN, + MI_CADDY, + MI_BAGGAGE, + MI_FBIRANCH, + MI_VICECHEE, + MI_RIO, + MI_SQUALO, + MI_JETMAX, MI_COASTG, MI_DINGHY, - MI_HERMES, - MI_SABRE, - MI_SABRETUR, + MI_MARQUIS, + MI_SKIMMER, + MI_TROPIC, + MI_SANDKING, + MI_VOODOO, + MI_CUBAN, MI_PHEONIX, - MI_WALTON, - MI_REGINA, MI_COMET, + MI_SABRE, + MI_VIRGO, + MI_RANCHER, + MI_BLISTAC, + MI_WASHING, + MI_ADMIRAL, + MI_SABRETUR, MI_DELUXO, + MI_HOTRING, + MI_REGINA, + MI_SENTXS, + MI_GLENDALE, + MI_OCEANIC, + MI_HERMES, + MI_GREENWOO, + MI_LOVEFIST, + MI_GANGBUR, MI_BURRITO, MI_SPAND, - MI_MARQUIS, - MI_BAGGAGE, - MI_KAUFMAN, - MI_MAVERICK, - MI_VCNMAV, - MI_RANCHER, - MI_FBIRANCH, - MI_VIRGO, - MI_GREENWOO, - MI_JETMAX, - MI_HOTRING, - MI_SANDKING, - MI_BLISTAC, - MI_POLMAV, - MI_BOXVILLE, - MI_BENSON, - MI_MESA, - MI_RCGOBLIN, - MI_HOTRINA, - MI_HOTRINB, - MI_BLOODRA, - MI_BLOODRB, - MI_VICECHEE, - - // HACK - MI_TRAIN = -1, - MI_DODO = -2, - - MI_LAST_VEHICLE = MI_VICECHEE, + MI_PACKER, + MI_WALTON, + MI_ROMERO, - MI_WHEEL_RIM, + MI_WHEEL_RIM = 237, MI_WHEEL_OFFROAD, MI_WHEEL_TRUCK, @@ -458,14 +468,18 @@ enum MI_FINGERS, MI_MINIGUN2, - MI_CUTOBJ01,// = 295, + MI_CUTOBJ01 = 120, MI_CUTOBJ02, MI_CUTOBJ03, MI_CUTOBJ04, MI_CUTOBJ05, + MI_CUTOBJ06, + MI_CUTOBJ07, + MI_CUTOBJ08, + MI_CUTOBJ09, + MI_CUTOBJ10, - - NUM_DEFAULT_MODELS,// = 300 + NUM_DEFAULT_MODELS = 300 }; enum{ 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/modelinfo/SimpleModelInfo.cpp b/src/modelinfo/SimpleModelInfo.cpp index 757a3721..d584dada 100644 --- a/src/modelinfo/SimpleModelInfo.cpp +++ b/src/modelinfo/SimpleModelInfo.cpp @@ -175,7 +175,7 @@ CSimpleModelInfo::FindRelatedModel(int32 minID, int32 maxID) } } -#define NEAR_DRAW_DIST 0.0f // 100.0f in liberty city +#define NEAR_DRAW_DIST 100.0f // 0.0f in vice city void CSimpleModelInfo::SetupBigBuilding(int32 minID, int32 maxID) diff --git a/src/modelinfo/VehicleModelInfo.h b/src/modelinfo/VehicleModelInfo.h index c7a41126..6c654284 100644 --- a/src/modelinfo/VehicleModelInfo.h +++ b/src/modelinfo/VehicleModelInfo.h @@ -31,6 +31,7 @@ enum eVehicleType { VEHICLE_TYPE_HELI, VEHICLE_TYPE_PLANE, VEHICLE_TYPE_BIKE, + VEHICLE_TYPE_FERRY, NUM_VEHICLE_TYPES }; 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/Gangs.cpp b/src/peds/Gangs.cpp index 38e37430..7e120af9 100644 --- a/src/peds/Gangs.cpp +++ b/src/peds/Gangs.cpp @@ -22,23 +22,24 @@ CGangInfo::CGangInfo() : void CGangs::Initialise(void) { - SetGangPedModels(GANG_CUBAN, MI_CBA, MI_CBB); - SetGangPedModels(GANG_HAITIAN, MI_HNA, MI_HNB); - SetGangPedModels(GANG_STREET, MI_SGA, MI_SGB); - SetGangPedModels(GANG_DIAZ, MI_CLA, MI_CLB); - SetGangPedModels(GANG_SECURITY, MI_GDA, MI_GDB); - SetGangPedModels(GANG_BIKER, MI_BKA, MI_BKB); - SetGangPedModels(GANG_PLAYER, MI_PGA, MI_PGB); - SetGangPedModels(GANG_GOLFER, MI_WFOGO, MI_WMOGO); - SetGangVehicleModel(GANG_CUBAN, MI_CUBAN); - SetGangVehicleModel(GANG_HAITIAN, MI_VOODOO); - SetGangVehicleModel(GANG_STREET, MI_GANGBUR); - SetGangVehicleModel(GANG_DIAZ, -1); - SetGangVehicleModel(GANG_SECURITY, -1); - SetGangVehicleModel(GANG_BIKER, MI_ANGEL); - SetGangVehicleModel(GANG_PLAYER, -1); - SetGangVehicleModel(GANG_GOLFER, MI_CADDY); - SetGangWeapons(GANG_GOLFER, WEAPONTYPE_GOLFCLUB, WEAPONTYPE_GOLFCLUB); + SetGangPedModels(GANG_MAFIA, MI_GANG01, MI_GANG02); + SetGangPedModels(GANG_TRIAD, MI_GANG03, MI_GANG04); + SetGangPedModels(GANG_DIABLOS, MI_GANG05, MI_GANG06); + SetGangPedModels(GANG_YAKUZA, MI_GANG07, MI_GANG08); + SetGangPedModels(GANG_YARDIE, MI_GANG09, MI_GANG10); + SetGangPedModels(GANG_COLUMB, MI_GANG11, MI_GANG12); + SetGangPedModels(GANG_HOODS, MI_GANG13, MI_GANG14); + SetGangPedModels(GANG_FORELLI, MI_GANG15, MI_GANG16); + SetGangPedModels(GANG_SINDACCO, MI_GANG17, MI_GANG18); + SetGangVehicleModel(GANG_MAFIA, MI_MAFIA); + SetGangVehicleModel(GANG_TRIAD, MI_BELLYUP); + SetGangVehicleModel(GANG_DIABLOS, MI_DIABLOS); + SetGangVehicleModel(GANG_YAKUZA, MI_YAKUZA); + SetGangVehicleModel(GANG_YARDIE, MI_YARDIE); + SetGangVehicleModel(GANG_COLUMB, MI_COLUMB); + SetGangVehicleModel(GANG_HOODS, MI_HOODS); + SetGangVehicleModel(GANG_FORELLI, MI_FORELLI_CAR); + SetGangVehicleModel(GANG_SINDACCO, MI_SINDACCO_CAR); #ifdef FIX_BUGS for (int i = 0; i < NUM_GANGS; i++) SetGangPedModelOverride(i, -1); diff --git a/src/peds/Gangs.h b/src/peds/Gangs.h index c6381343..acb2fb99 100644 --- a/src/peds/Gangs.h +++ b/src/peds/Gangs.h @@ -17,15 +17,15 @@ struct CGangInfo VALIDATE_SIZE(CGangInfo, 0x10); enum { - GANG_CUBAN = 0, - GANG_HAITIAN, - GANG_STREET, - GANG_DIAZ, - GANG_SECURITY, - GANG_BIKER, - GANG_PLAYER, - GANG_GOLFER, - GANG_9, + GANG_MAFIA = 0, + GANG_TRIAD, + GANG_DIABLOS, + GANG_YAKUZA, + GANG_YARDIE, + GANG_COLUMB, + GANG_HOODS, + GANG_FORELLI, + GANG_SINDACCO, NUM_GANGS }; diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index b8afaeab..f597edea 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -9433,7 +9433,7 @@ CPed::SetRadioStation(void) if (IsPlayer() || !m_pMyVehicle || m_pMyVehicle->pDriver != this) return; - if (GetModelIndex() != MI_PGA && GetModelIndex() != MI_PGB) { + if (GetModelIndex() != MI_GANG13 && GetModelIndex() != MI_GANG14) { if (m_pMyVehicle->m_nRadioStation != modelInfo->radio1 && m_pMyVehicle->m_nRadioStation != modelInfo->radio2) { if (CGeneral::GetRandomTrueFalse()) m_pMyVehicle->m_nRadioStation = modelInfo->radio1; diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 7798483f..4056898e 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -100,9 +100,31 @@ enum PedFightMoves { FIGHTMOVE_NULL, // Attacker - FIGHTMOVE_STDPUNCH, +// FIGHTMOVE_STDPUNCH, FIGHTMOVE_IDLE, FIGHTMOVE_SHUFFLE_F, + // Combos + FIGHTMOVE_COMBO_A1, + FIGHTMOVE_COMBO_A2, + FIGHTMOVE_COMBO_A3, + FIGHTMOVE_COMBO_B1, + FIGHTMOVE_COMBO_B2, + FIGHTMOVE_COMBO_B3, + // Melee + FIGHTMOVE_MELEE1, + FIGHTMOVE_MELEE2, + FIGHTMOVE_MELEE3, + // Special + FIGHTMOVE_GROUNDKICK, + // Opponent + FIGHTMOVE_HITFRONT, + FIGHTMOVE_HITBACK, + FIGHTMOVE_HITRIGHT, + FIGHTMOVE_HITLEFT, + FIGHTMOVE_HITONFLOOR, + FIGHTMOVE_HITBEHIND, + FIGHTMOVE_IDLE2NORM, +/* FIGHTMOVE_KNEE, FIGHTMOVE_PUNCHHOOK, FIGHTMOVE_PUNCHJAB, @@ -134,7 +156,16 @@ enum PedFightMoves FIGHTMOVE_MELEE2, FIGHTMOVE_MELEE3, FIGHTMOVE_IDLE2NORM, - NUM_FIGHTMOVES +*/ + + NUM_FIGHTMOVES, + + // LCS replacements for the old names: + // NB: this may be totally bogus, i just need it to compile + FIGHTMOVE_PUNCH = FIGHTMOVE_COMBO_A2, + FIGHTMOVE_FWDRIGHT = FIGHTMOVE_COMBO_B1, + FIGHTMOVE_LONGKICK = FIGHTMOVE_COMBO_B2, + FIGHTMOVE_ROUNDHOUSE = FIGHTMOVE_COMBO_B3, }; enum ePedPieceTypes @@ -490,7 +521,13 @@ 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 @@ -718,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/peds/PedFight.cpp b/src/peds/PedFight.cpp index eaa2aa3d..0f83cdd1 100644 --- a/src/peds/PedFight.cpp +++ b/src/peds/PedFight.cpp @@ -33,6 +33,7 @@ RpClump* flyingClumpTemp; FightMove tFightMoves[NUM_FIGHTMOVES] = { +/* { NUM_STD_ANIMS, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, HITLEVEL_NULL, 0, 0 }, { ANIM_PUNCH_R, 0.2f, 8.f/30.f, 0.0f, 0.3f, 1.0f, HITLEVEL_HIGH, 1, 0 }, { ANIM_FIGHT_IDLE, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, HITLEVEL_NULL, 0, 0 }, @@ -65,6 +66,7 @@ FightMove tFightMoves[NUM_FIGHTMOVES] = { ANIM_WEAPON_CROUCHFIRE, 4.f/30.f, 7.f/30.f, 10.f/30.f, 0.4f, 1.0f, HITLEVEL_HIGH, 1, 0 }, { ANIM_WEAPON_SPECIAL, 4.f / 30.f, 7.f / 30.f, 10.f / 30.f, 0.4f, 1.0f, HITLEVEL_HIGH, 1, 0 }, { ANIM_FIGHT2_IDLE, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, HITLEVEL_NULL, 0, 0 } +*/ }; static PedOnGroundState @@ -1115,10 +1117,7 @@ CPed::StartFightAttack(uint8 buttonPressure) break; } } else { - if (m_curFightMove == FIGHTMOVE_BACKKICK) - animAssoc->speed = 1.15f; - else - animAssoc->speed = 0.8f; + animAssoc->speed = 0.8f; } if (IsPlayer()) animAssoc->SetCurrentTime(0.08f); @@ -1227,12 +1226,14 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk) default: if (hitLevel == HITLEVEL_LOW) { hitAnim = ANIM_KO_SHOT_STOM; +/* LCS: removed } else if (CGeneral::GetRandomNumber() & 1) { fall = false; hitAnim = ANIM_HIT_WALK; } else if (CGeneral::GetRandomNumber() & 1) { fall = false; hitAnim = ANIM_HIT_HEAD; +*/ } else { hitAnim = ANIM_KO_SHOT_FACE; } @@ -1267,7 +1268,7 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk) Say(SOUND_PED_DEFEND); return; } - m_curFightMove = FIGHTMOVE_HITBODY; + m_curFightMove = FIGHTMOVE_HITFRONT; // LCS break; case HITLEVEL_HIGH: switch (direction) { @@ -1281,10 +1282,12 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk) m_curFightMove = FIGHTMOVE_HITRIGHT; break; default: - if (unk <= 5) - m_curFightMove = FIGHTMOVE_HITHEAD; - else - m_curFightMove = FIGHTMOVE_HITBIGSTEP; + // LCS: removed + //if (unk <= 5) + // m_curFightMove = FIGHTMOVE_HITHEAD; + //else + // m_curFightMove = FIGHTMOVE_HITBIGSTEP; + m_curFightMove = FIGHTMOVE_HITFRONT; break; } break; @@ -1300,10 +1303,12 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk) m_curFightMove = FIGHTMOVE_HITRIGHT; break; default: - if (unk <= 5) - m_curFightMove = FIGHTMOVE_HITCHEST; - else - m_curFightMove = FIGHTMOVE_HITBIGSTEP; + // LCS: removed + //if (unk <= 5) + // m_curFightMove = FIGHTMOVE_HITCHEST; + //else + // m_curFightMove = FIGHTMOVE_HITBIGSTEP; + m_curFightMove = FIGHTMOVE_HITFRONT; break; } break; @@ -1457,30 +1462,30 @@ CPed::Fight(void) CVector touchingNodePos(0.0f, 0.0f, 0.0f); switch (m_curFightMove) { - case FIGHTMOVE_KNEE: - TransformToNode(touchingNodePos, PED_LOWERLEGR); - break; - case FIGHTMOVE_PUNCHHOOK: - case FIGHTMOVE_PUNCHJAB: - TransformToNode(touchingNodePos, PED_HANDL); - break; + // case FIGHTMOVE_KNEE: + // TransformToNode(touchingNodePos, PED_LOWERLEGR); + // break; + // case FIGHTMOVE_PUNCHHOOK: + // case FIGHTMOVE_PUNCHJAB: + // TransformToNode(touchingNodePos, PED_HANDL); + // break; case FIGHTMOVE_LONGKICK: case FIGHTMOVE_ROUNDHOUSE: - case FIGHTMOVE_FWDLEFT: - case FIGHTMOVE_BACKRIGHT: + // case FIGHTMOVE_FWDLEFT: + // case FIGHTMOVE_BACKRIGHT: case FIGHTMOVE_GROUNDKICK: TransformToNode(touchingNodePos, PED_FOOTR); break; case FIGHTMOVE_FWDRIGHT: TransformToNode(touchingNodePos, PED_HEAD); break; - case FIGHTMOVE_BACKKICK: - case FIGHTMOVE_BACKFLIP: - TransformToNode(touchingNodePos, PED_FOOTL); - break; - case FIGHTMOVE_BACKLEFT: - TransformToNode(touchingNodePos, PED_UPPERARML); - break; + // case FIGHTMOVE_BACKKICK: + // case FIGHTMOVE_BACKFLIP: + // TransformToNode(touchingNodePos, PED_FOOTL); + // break; + // case FIGHTMOVE_BACKLEFT: + // TransformToNode(touchingNodePos, PED_UPPERARML); + // break; default: TransformToNode(touchingNodePos, PED_HANDR); break; @@ -1532,10 +1537,7 @@ CPed::Fight(void) tFightMoves[m_curFightMove].animId, 8.0f); if (weaponInfo->m_AnimToPlay != ASSOCGRP_KNIFE || m_curFightMove < FIGHTMOVE_MELEE1) { - if (m_curFightMove == FIGHTMOVE_BACKKICK) - animAssoc->speed = 1.15f; - else - animAssoc->speed = 0.8f; + animAssoc->speed = 0.8f; } else { switch (GetWeapon()->m_eWeaponType) { case WEAPONTYPE_SCREWDRIVER: @@ -1676,8 +1678,9 @@ CPed::ChooseAttackAI(uint8 buttonPressure, bool fightWithWeapon) return FIGHTMOVE_IDLE; } } - if (dist < 0.95f && canKneeHead) - return FIGHTMOVE_KNEE; + // LCS: removed + //if (dist < 0.95f && canKneeHead) + // return FIGHTMOVE_KNEE; if (dist < 1.4f) return FIGHTMOVE_PUNCH; if (dist < 2.f && canKick) { @@ -1796,9 +1799,11 @@ CPed::ChooseAttackPlayer(uint8 buttonPressure, bool fightWithWeapon) switch (dir) { case 0: // forward if (fightWithWeapon) { - if (distToVictim < 0.95f - 0.2f && m_nPedState == PED_FIGHT) { - choosenMove = FIGHTMOVE_KNEE; - } else { + // LCS: removed + //if (distToVictim < 0.95f - 0.2f && m_nPedState == PED_FIGHT) { + // choosenMove = FIGHTMOVE_KNEE; + //} else + { if (GetWeapon()->m_eWeaponType == WEAPONTYPE_CLEAVER) { if (distToVictim < 0.85f * weaponInfo->m_fRange) choosenMove = FIGHTMOVE_MELEE1; @@ -1821,18 +1826,20 @@ CPed::ChooseAttackPlayer(uint8 buttonPressure, bool fightWithWeapon) } } } - } else if (distToVictim < 0.95f && m_nPedState == PED_FIGHT) { - choosenMove = FIGHTMOVE_KNEE; + // LCS: removed + //} else if (distToVictim < 0.95f && m_nPedState == PED_FIGHT) { + // choosenMove = FIGHTMOVE_KNEE; } else if (distToVictim < 1.4f) { - if (m_curFightMove == FIGHTMOVE_PUNCHJAB) { + // LCS: removed + /*if (m_curFightMove == FIGHTMOVE_PUNCHJAB) { choosenMove = FIGHTMOVE_PUNCH; - } else if (m_curFightMove != FIGHTMOVE_PUNCH || randVal != 1) { - if (randVal == 2) + } else*/ if (m_curFightMove != FIGHTMOVE_PUNCH || randVal != 1) { + //if (randVal == 2) choosenMove = FIGHTMOVE_PUNCH; - else - choosenMove = FIGHTMOVE_PUNCHJAB; + //else + // choosenMove = FIGHTMOVE_PUNCHJAB; } else { choosenMove = FIGHTMOVE_LONGKICK; } @@ -1840,6 +1847,7 @@ CPed::ChooseAttackPlayer(uint8 buttonPressure, bool fightWithWeapon) choosenMove = FIGHTMOVE_LONGKICK; } break; +/* LCS: removed case 1: choosenMove = FIGHTMOVE_FWDLEFT; break; @@ -1852,6 +1860,7 @@ CPed::ChooseAttackPlayer(uint8 buttonPressure, bool fightWithWeapon) case 4: choosenMove = FIGHTMOVE_BACKRIGHT; break; +*/ default: choosenMove = FIGHTMOVE_FWDRIGHT; break; @@ -1917,20 +1926,22 @@ CPed::ChooseAttackPlayer(uint8 buttonPressure, bool fightWithWeapon) #else switch (CGeneral::GetRandomNumberInRange(0,3)) { #endif - case 0: - choosenMove = FIGHTMOVE_PUNCHJAB; - break; + // LCS: hack hack + // case 0: + // choosenMove = FIGHTMOVE_PUNCHJAB; + // break; + default: case 1: choosenMove = FIGHTMOVE_PUNCH; break; case 2: choosenMove = FIGHTMOVE_LONGKICK; break; - case 3: - choosenMove = FIGHTMOVE_KNEE; - break; - default: - break; + // case 3: + // choosenMove = FIGHTMOVE_KNEE; + // break; + // default: + // break; } } return choosenMove; @@ -1975,6 +1986,7 @@ CPed::EndFight(uint8 endType) void CPed::PlayHitSound(CPed *hitTo) { +#if 0 // LCS: temporarily removed // That was very complicated to reverse for me... // First index is our fight move ID (from 1 to 17, total 17), second is the one of we fight with (from 18 to 27, total 10). enum { @@ -2045,6 +2057,7 @@ CPed::PlayHitSound(CPed *hitTo) if (soundId != NO_SND) DMAudio.PlayOneShot(m_audioEntityId, soundId, (weapon << 8) | ENTITY_TYPE_PED); +#endif } // --MIAMI: Done @@ -2178,8 +2191,9 @@ CPed::FightHitPed(CPed *victim, CVector &touchPoint, CVector &dir, int16 piece) bool brassKnucklePunch = false; if (GetWeapon()->m_eWeaponType == WEAPONTYPE_BRASSKNUCKLE) { - if (m_curFightMove == FIGHTMOVE_PUNCHHOOK || m_curFightMove == FIGHTMOVE_PUNCHJAB || m_curFightMove == FIGHTMOVE_BACKLEFT || - m_curFightMove == FIGHTMOVE_STDPUNCH || m_curFightMove == FIGHTMOVE_PUNCH) { + // LCS: removed + if (/*m_curFightMove == FIGHTMOVE_PUNCHHOOK || m_curFightMove == FIGHTMOVE_PUNCHJAB || m_curFightMove == FIGHTMOVE_BACKLEFT || + m_curFightMove == FIGHTMOVE_STDPUNCH ||*/ m_curFightMove == FIGHTMOVE_PUNCH) { brassKnucklePunch = true; damageMult *= 1.5f; } diff --git a/src/peds/PedType.h b/src/peds/PedType.h index a4698bbb..776dd14d 100644 --- a/src/peds/PedType.h +++ b/src/peds/PedType.h @@ -95,6 +95,9 @@ VALIDATE_SIZE(CPedType, 0x20); enum ePedStats { + PEDSTAT_COWARD, + PEDSTAT_SHOPPER, + PEDSTAT_OLDSHOPPER, PEDSTAT_PLAYER, PEDSTAT_COP, PEDSTAT_MEDIC, @@ -106,6 +109,8 @@ enum ePedStats PEDSTAT_GANG5, PEDSTAT_GANG6, PEDSTAT_GANG7, + PEDSTAT_GANG8, + PEDSTAT_GANG9, PEDSTAT_STREET_GUY, PEDSTAT_SUIT_GUY, PEDSTAT_SENSIBLE_GUY, @@ -128,13 +133,10 @@ enum ePedStats PEDSTAT_PSYCHO, PEDSTAT_STEWARD, PEDSTAT_SPORTSFAN, - PEDSTAT_SHOPPER, - PEDSTAT_OLDSHOPPER, PEDSTAT_BEACH_GUY, PEDSTAT_BEACH_GIRL, PEDSTAT_SKATER, PEDSTAT_STD_MISSION, - PEDSTAT_COWARD, NUM_PEDSTATS }; diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index f07d1ac7..350b527a 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -1172,7 +1172,8 @@ void CPlayerPed::ProcessAnimGroups(void) { AssocGroupId groupToSet; -#ifdef PC_PLAYER_CONTROLS +//#ifdef PC_PLAYER_CONTROLS +#if 0 // chainsaw anims missing in LCS if ((m_fWalkAngle <= -DEGTORAD(50.0f) || m_fWalkAngle >= DEGTORAD(50.0f)) && TheCamera.Cams[TheCamera.ActiveCam].Using3rdPersonMouseCam() && CanStrafeOrMouseControl()) { diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index f886597f..4284def5 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -1207,10 +1207,11 @@ CPopulation::IsSkateable(CVector const& pos) return foundCol.surfaceB == SURFACE_TARMAC || foundCol.surfaceB == SURFACE_PAVEMENT; } +//--LCS: done bool CPopulation::CanJeerAtStripper(int32 model) { - return model == MI_WMOBE || model == MI_WMYBE || model == MI_WMOST || model == MI_BMYBB; + return false; } void @@ -1242,46 +1243,38 @@ bool CPopulation::IsMale(int32 model) { switch (model) { - case MI_HMYST: - case MI_HMOST: - case MI_HMYRI: - case MI_HMORI: - case MI_HMYBE: - case MI_HMOBE: - case MI_HMOTR: - case MI_HMYAP: - case MI_HMOCA: - case MI_BMODK: - case MI_BMYKR: - case MI_BMYST: - case MI_BMOST: - case MI_BMYRI: - case MI_BMYBE: - case MI_BMOBE: - case MI_BMYBU: - case MI_BMOTR: - case MI_BMYPI: - case MI_BMYBB: - case MI_WMYCR: - case MI_WMYST: - case MI_WMOST: - case MI_WMYRI: - case MI_WMORI: - case MI_WMYBE: - case MI_WMOBE: - case MI_WMYCW: - case MI_WMYGO: - case MI_WMOGO: - case MI_WMYLG: - case MI_WMYBU: - case MI_WMOBU: - case MI_WMOTR: - case MI_WMYPI: - case MI_WMOCA: - case MI_WMYJG: - case MI_WMYSK: - - // BUG? Why no JMOTO? + // TODO(LCS): do this right + case MI_TAXI_D: + case MI_PIMP: + case MI_CRIMINAL01: + case MI_CRIMINAL02: + case MI_MALE02: + case MI_MALE03: + case MI_P_MAN1: + case MI_P_MAN2: + case MI_CT_MAN1: + case MI_CT_MAN2: + case MI_LI_MAN1: + case MI_LI_MAN2: + case MI_DOCKER1: + case MI_DOCKER2: + case MI_SCUM_MAN: + case MI_WORKER1: + case MI_WORKER2: + case MI_B_MAN1: + case MI_B_MAN2: + case MI_B_MAN3: + case MI_MOD_MAN: + case MI_ST_MAN: + case MI_FAN_MAN1: + case MI_FAN_MAN2: + case MI_HOS_MAN: + case MI_CONST1: + case MI_CONST2: + case MI_STUD_MAN: + case MI_CAS_MAN: + case MI_CAMP_MAN: + case MI_HITMAN: return true; default: return false; @@ -1292,41 +1285,34 @@ bool CPopulation::IsFemale(int32 model) { switch (model) { - case MI_HFYST: - case MI_HFOST: - case MI_HFYRI: - case MI_HFORI: - case MI_HFYBE: - case MI_HFOBE: - case MI_HFYBU: - case MI_HFYMD: - case MI_HFYCG: - case MI_HFYPR: - case MI_HFOTR: - case MI_BFYST: - case MI_BFOST: - case MI_BFYRI: - case MI_BFORI: - case MI_BFYBE: - case MI_BFOBE: - case MI_BFYPR: - case MI_BFOTR: - case MI_WFYST: - case MI_WFOST: - case MI_WFYRI: - case MI_WFORI: - case MI_WFYBE: - case MI_WFOBE: - case MI_WFOGO: - case MI_WFYLG: - case MI_WFYBU: - case MI_WFYPR: - case MI_WFOTR: - case MI_WFYJG: - case MI_WFYSK: - case MI_WFYSH: - case MI_WFOSH: - case MI_JFOTO: + // TODO(LCS): do this right + case MI_FEMALE01: + case MI_FEMALE02: + case MI_FEMALE03: + case MI_FATFEMALE01: + case MI_FATFEMALE02: + case MI_PROSTITUTE: + case MI_PROSTITUTE2: + case MI_P_WOM1: + case MI_P_WOM2: + case MI_CT_WOM1: + case MI_CT_WOM2: + case MI_LI_WOM1: + case MI_LI_WOM2: + case MI_SCUM_WOM: + case MI_B_WOM1: + case MI_B_WOM2: + case MI_B_WOM3: + case MI_MOD_WOM: + case MI_ST_WOM: + case MI_FAN_WOM: + case MI_HOS_WOM: + case MI_SHOPPER1: + case MI_SHOPPER2: + case MI_SHOPPER3: + case MI_STUD_WOM: + case MI_CAS_WOM: + case MI_CAMP_WOM: return true; default: return false; @@ -1336,23 +1322,7 @@ CPopulation::IsFemale(int32 model) bool CPopulation::IsSunbather(int32 model) { - switch (model) { - case MI_HFYBE: - case MI_HFOBE: - case MI_HMYBE: - case MI_HMOBE: - case MI_BFYBE: - case MI_BMYBE: - case MI_BFOBE: - case MI_BMOBE: - case MI_WFYBE: - case MI_WMYBE: - case MI_WFOBE: - case MI_WMOBE: - return true; - default: - return false; - } + return false; } int32 @@ -1364,13 +1334,13 @@ CPopulation::ComputeRandomisedGangSize(void) bool CPopulation::CanSolicitPlayerInCar(int32 model) { - return model == MI_HFYPR || model == MI_BFYPR || model == MI_WFYPR; + return model == MI_PROSTITUTE || model == MI_PROSTITUTE2; } bool CPopulation::CanSolicitPlayerOnFoot(int32 model) { - return model == MI_HFYMD || model == MI_HFYCG || model == MI_BFOTR || model == MI_BMOTR || model == MI_WFOTR || model == MI_WMOTR; + return model == MI_B_WOM3 || model == MI_FEMALE01 || model == MI_FEMALE02 || model == MI_FEMALE03; } bool diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index 157be0c8..be5c0d6f 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -417,8 +417,9 @@ void CMovingThings::Init() } } - CEscalators::Init(); - aScrollBars[0].Init(CVector(-1069.209f, 1320.126f, 18.848f), CVector(-1069.209f, 1342.299f, 22.612f), SCROLL_ARENA_STRING, 128, 255, 0, 0.3f); +// LCS: removed +// CEscalators::Init(); +// aScrollBars[0].Init(CVector(-1069.209f, 1320.126f, 18.848f), CVector(-1069.209f, 1342.299f, 22.612f), SCROLL_ARENA_STRING, 128, 255, 0, 0.3f); } void CMovingThings::Shutdown() diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index d7a9d75d..350e8c45 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -91,7 +91,7 @@ bool CHud::m_HideRadar; int32 CHud::m_ClockState; // These aren't really in CHud -float CHud::BigMessageInUse[6]; +float BigMessageInUse[6]; float CHud::BigMessageAlpha[6]; float CHud::BigMessageX[6]; float CHud::OddJob2OffTimer; 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 91a34592..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; @@ -1642,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/Timecycle.cpp b/src/render/Timecycle.cpp index 70926c1a..3cb5a0b0 100644 --- a/src/render/Timecycle.cpp +++ b/src/render/Timecycle.cpp @@ -136,6 +136,61 @@ float CTimeCycle::m_fShadowSideY[16]; float CTimeCycle::m_fShadowDisplacementX[16]; float CTimeCycle::m_fShadowDisplacementY[16]; + + +static float tmp_nAmbientRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientRed_Obj[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientGreen_Obj[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientBlue_Obj[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientRed_Bl[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientGreen_Bl[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientBlue_Bl[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientRed_Obj_Bl[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientGreen_Obj_Bl[NUMHOURS][NUMWEATHERS]; +static float tmp_nAmbientBlue_Obj_Bl[NUMHOURS][NUMWEATHERS]; +static float tmp_nDirectionalRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nDirectionalGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nDirectionalBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_nSkyTopRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nSkyTopGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nSkyTopBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_nSkyBottomRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nSkyBottomGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nSkyBottomBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_nSunCoreRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nSunCoreGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nSunCoreBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_nSunCoronaRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nSunCoronaGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nSunCoronaBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_fSunSize[NUMHOURS][NUMWEATHERS]; +static float tmp_fSpriteSize[NUMHOURS][NUMWEATHERS]; +static float tmp_fSpriteBrightness[NUMHOURS][NUMWEATHERS]; +static float tmp_nShadowStrength[NUMHOURS][NUMWEATHERS]; +static float tmp_nLightShadowStrength[NUMHOURS][NUMWEATHERS]; +static float tmp_nPoleShadowStrength[NUMHOURS][NUMWEATHERS]; +static float tmp_fFogStart[NUMHOURS][NUMWEATHERS]; +static float tmp_fFarClip[NUMHOURS][NUMWEATHERS]; +static float tmp_fLightsOnGroundBrightness[NUMHOURS][NUMWEATHERS]; +static float tmp_nLowCloudsRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nLowCloudsGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nLowCloudsBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_nFluffyCloudsTopRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nFluffyCloudsTopGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nFluffyCloudsTopBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_nFluffyCloudsBottomRed[NUMHOURS][NUMWEATHERS]; +static float tmp_nFluffyCloudsBottomGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_nFluffyCloudsBottomBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_fBlurRed[NUMHOURS][NUMWEATHERS]; +static float tmp_fBlurGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_fBlurBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_fWaterRed[NUMHOURS][NUMWEATHERS]; +static float tmp_fWaterGreen[NUMHOURS][NUMWEATHERS]; +static float tmp_fWaterBlue[NUMHOURS][NUMWEATHERS]; +static float tmp_fWaterAlpha[NUMHOURS][NUMWEATHERS]; + void CTimeCycle::Initialise(void) { @@ -173,7 +228,7 @@ CTimeCycle::Initialise(void) for(h = 0; h < NUMHOURS; h++){ li = 0; while(work_buff[bi] == '/' || work_buff[bi] == '\n' || - work_buff[bi] == '\0' || work_buff[bi] == ' ' || work_buff[bi] == '\r'){ + work_buff[bi] == '\0' || work_buff[bi] == '\r'){ while(work_buff[bi] != '\n' && work_buff[bi] != '\0' && work_buff[bi] != '\r') bi++; bi++; @@ -209,65 +264,180 @@ CTimeCycle::Initialise(void) &blurR, &blurG, &blurB, &waterR, &waterG, &waterB, &waterA); - m_nAmbientRed[h][w] = ambR; - m_nAmbientGreen[h][w] = ambG; - m_nAmbientBlue[h][w] = ambB; - m_nAmbientRed_Obj[h][w] = ambobjR; - m_nAmbientGreen_Obj[h][w] = ambobjG; - m_nAmbientBlue_Obj[h][w] = ambobjB; - m_nAmbientRed_Bl[h][w] = ambblR; - m_nAmbientGreen_Bl[h][w] = ambblG; - m_nAmbientBlue_Bl[h][w] = ambblB; - m_nAmbientRed_Obj_Bl[h][w] = ambobjblR; - m_nAmbientGreen_Obj_Bl[h][w] = ambobjblG; - m_nAmbientBlue_Obj_Bl[h][w] = ambobjblB; - m_nDirectionalRed[h][w] = dirR; - m_nDirectionalGreen[h][w] = dirG; - m_nDirectionalBlue[h][w] = dirB; - m_nSkyTopRed[h][w] = skyTopR; - m_nSkyTopGreen[h][w] = skyTopG; - m_nSkyTopBlue[h][w] = skyTopB; - m_nSkyBottomRed[h][w] = skyBotR; - m_nSkyBottomGreen[h][w] = skyBotG; - m_nSkyBottomBlue[h][w] = skyBotB; - m_nSunCoreRed[h][w] = sunCoreR; - m_nSunCoreGreen[h][w] = sunCoreG; - m_nSunCoreBlue[h][w] = sunCoreB; - m_nSunCoronaRed[h][w] = sunCoronaR; - m_nSunCoronaGreen[h][w] = sunCoronaG; - m_nSunCoronaBlue[h][w] = sunCoronaB; - m_fSunSize[h][w] = sunSz * 10.0f; - m_fSpriteSize[h][w] = sprSz * 10.0f; - m_fSpriteBrightness[h][w] = sprBght * 10.0f; - m_nShadowStrength[h][w] = shad; - m_nLightShadowStrength[h][w] = lightShad; - m_nPoleShadowStrength[h][w] = poleShad; - m_fFarClip[h][w] = farClp; - m_fFogStart[h][w] = fogSt; - m_fLightsOnGroundBrightness[h][w] = lightGnd * 10.0f; - m_nLowCloudsRed[h][w] = cloudR; - m_nLowCloudsGreen[h][w] = cloudG; - m_nLowCloudsBlue[h][w] = cloudB; - m_nFluffyCloudsTopRed[h][w] = fluffyTopR; - m_nFluffyCloudsTopGreen[h][w] = fluffyTopG; - m_nFluffyCloudsTopBlue[h][w] = fluffyTopB; - m_nFluffyCloudsBottomRed[h][w] = fluffyBotR; - m_nFluffyCloudsBottomGreen[h][w] = fluffyBotG; - m_nFluffyCloudsBottomBlue[h][w] = fluffyBotB; - m_fBlurRed[h][w] = blurR; - m_fBlurGreen[h][w] = blurG; - m_fBlurBlue[h][w] = blurB; - m_fWaterRed[h][w] = waterR; - m_fWaterGreen[h][w] = waterG; - m_fWaterBlue[h][w] = waterB; - m_fWaterAlpha[h][w] = waterA; + tmp_nAmbientRed[h][w] = ambR; + tmp_nAmbientGreen[h][w] = ambG; + tmp_nAmbientBlue[h][w] = ambB; + tmp_nAmbientRed_Obj[h][w] = ambobjR; + tmp_nAmbientGreen_Obj[h][w] = ambobjG; + tmp_nAmbientBlue_Obj[h][w] = ambobjB; + tmp_nAmbientRed_Bl[h][w] = ambblR; + tmp_nAmbientGreen_Bl[h][w] = ambblG; + tmp_nAmbientBlue_Bl[h][w] = ambblB; + tmp_nAmbientRed_Obj_Bl[h][w] = ambobjblR; + tmp_nAmbientGreen_Obj_Bl[h][w] = ambobjblG; + tmp_nAmbientBlue_Obj_Bl[h][w] = ambobjblB; + tmp_nDirectionalRed[h][w] = dirR; + tmp_nDirectionalGreen[h][w] = dirG; + tmp_nDirectionalBlue[h][w] = dirB; + tmp_nSkyTopRed[h][w] = skyTopR; + tmp_nSkyTopGreen[h][w] = skyTopG; + tmp_nSkyTopBlue[h][w] = skyTopB; + tmp_nSkyBottomRed[h][w] = skyBotR; + tmp_nSkyBottomGreen[h][w] = skyBotG; + tmp_nSkyBottomBlue[h][w] = skyBotB; + tmp_nSunCoreRed[h][w] = sunCoreR; + tmp_nSunCoreGreen[h][w] = sunCoreG; + tmp_nSunCoreBlue[h][w] = sunCoreB; + tmp_nSunCoronaRed[h][w] = sunCoronaR; + tmp_nSunCoronaGreen[h][w] = sunCoronaG; + tmp_nSunCoronaBlue[h][w] = sunCoronaB; + if(sunSz == -1) + tmp_fSunSize[h][w] = -1; + else + tmp_fSunSize[h][w] = sunSz * 10.0f; + if(sprSz == -1) + tmp_fSpriteSize[h][w] = -1; + else + tmp_fSpriteSize[h][w] = sprSz * 10.0f; + if(sprBght == -1) + tmp_fSpriteBrightness[h][w] = -1; + else + tmp_fSpriteBrightness[h][w] = sprBght * 10.0f; + tmp_nShadowStrength[h][w] = shad; + tmp_nLightShadowStrength[h][w] = lightShad; + tmp_nPoleShadowStrength[h][w] = poleShad; + tmp_fFarClip[h][w] = farClp; + tmp_fFogStart[h][w] = fogSt; + if(lightGnd == -1) + tmp_fLightsOnGroundBrightness[h][w] = -1; + else + tmp_fLightsOnGroundBrightness[h][w] = lightGnd * 10.0f; + tmp_nLowCloudsRed[h][w] = cloudR; + tmp_nLowCloudsGreen[h][w] = cloudG; + tmp_nLowCloudsBlue[h][w] = cloudB; + tmp_nFluffyCloudsTopRed[h][w] = fluffyTopR; + tmp_nFluffyCloudsTopGreen[h][w] = fluffyTopG; + tmp_nFluffyCloudsTopBlue[h][w] = fluffyTopB; + tmp_nFluffyCloudsBottomRed[h][w] = fluffyBotR; + tmp_nFluffyCloudsBottomGreen[h][w] = fluffyBotG; + tmp_nFluffyCloudsBottomBlue[h][w] = fluffyBotB; + tmp_fBlurRed[h][w] = blurR; + tmp_fBlurGreen[h][w] = blurG; + tmp_fBlurBlue[h][w] = blurB; + tmp_fWaterRed[h][w] = waterR; + tmp_fWaterGreen[h][w] = waterG; + tmp_fWaterBlue[h][w] = waterB; + tmp_fWaterAlpha[h][w] = waterA; } + UpdateArrays(); + m_FogReduction = 0; debug("CTimeCycle ready\n"); } +template<typename T> void +FillGaps(T (*out)[NUMWEATHERS], float (*in)[NUMWEATHERS]) +{ + int w; + for(w = 0; w < NUMWEATHERS; w++){ + for(int h = 0; h < NUMHOURS; h++) + out[h][w] = in[h][w]; + +#define NEXT(h) (((h)+1)%NUMHOURS) +#define PREV(h) (((h)+NUMHOURS-1)%NUMHOURS) + int hend, h1, h2; + for(hend = 0; hend < NUMHOURS; hend++) + if(in[hend][w] != -1.0f) + goto foundstart; + return; // this should never happen +foundstart: + // Found the start of a block of filled in entries + for(h1 = NEXT(hend); h1 != hend; h1 = h2){ + // Skip filled in entries + for(; h1 != hend; h1 = NEXT(h1)) + if(in[h1][w] == -1.0f) + goto foundfirst; + break; // all filled in already +foundfirst: + // h1 is now the first -1 after n filled in values + for(h2 = NEXT(h1); ; h2 = NEXT(h2)) + if(in[h2][w] != -1.0f) + goto foundlast; + break; +foundlast: + // h2 is now the first entry after a row of -1s + h1 = PREV(h1); // make h1 the first before a row of -1s + int n = (h2-h1 + NUMHOURS) % NUMHOURS; + if(n == 0) n = NUMHOURS; // can't happen + float step = (in[h2][w] - in[h1][w])/n; + + for(int i = 1; i < n; i++){ + float f = (float)i/n; + out[(h1+i)%NUMHOURS][w] = in[h2][w]*f + in[h1][w]*(1.0f-f); + } + } + } +} + +void +CTimeCycle::UpdateArrays(void) +{ + FillGaps(m_nAmbientRed, tmp_nAmbientRed); + FillGaps(m_nAmbientGreen, tmp_nAmbientGreen); + FillGaps(m_nAmbientBlue, tmp_nAmbientBlue); + FillGaps(m_nAmbientRed_Obj, tmp_nAmbientRed_Obj); + FillGaps(m_nAmbientGreen_Obj, tmp_nAmbientGreen_Obj); + FillGaps(m_nAmbientBlue_Obj, tmp_nAmbientBlue_Obj); + FillGaps(m_nAmbientRed_Bl, tmp_nAmbientRed_Bl); + FillGaps(m_nAmbientGreen_Bl, tmp_nAmbientGreen_Bl); + FillGaps(m_nAmbientBlue_Bl, tmp_nAmbientBlue_Bl); + FillGaps(m_nAmbientRed_Obj_Bl, tmp_nAmbientRed_Obj_Bl); + FillGaps(m_nAmbientGreen_Obj_Bl, tmp_nAmbientGreen_Obj_Bl); + FillGaps(m_nAmbientBlue_Obj_Bl, tmp_nAmbientBlue_Obj_Bl); + FillGaps(m_nDirectionalRed, tmp_nDirectionalRed); + FillGaps(m_nDirectionalGreen, tmp_nDirectionalGreen); + FillGaps(m_nDirectionalBlue, tmp_nDirectionalBlue); + FillGaps(m_nSkyTopRed, tmp_nSkyTopRed); + FillGaps(m_nSkyTopGreen, tmp_nSkyTopGreen); + FillGaps(m_nSkyTopBlue, tmp_nSkyTopBlue); + FillGaps(m_nSkyBottomRed, tmp_nSkyBottomRed); + FillGaps(m_nSkyBottomGreen, tmp_nSkyBottomGreen); + FillGaps(m_nSkyBottomBlue, tmp_nSkyBottomBlue); + FillGaps(m_nSunCoreRed, tmp_nSunCoreRed); + FillGaps(m_nSunCoreGreen, tmp_nSunCoreGreen); + FillGaps(m_nSunCoreBlue, tmp_nSunCoreBlue); + FillGaps(m_nSunCoronaRed, tmp_nSunCoronaRed); + FillGaps(m_nSunCoronaGreen, tmp_nSunCoronaGreen); + FillGaps(m_nSunCoronaBlue, tmp_nSunCoronaBlue); + FillGaps(m_fSunSize, tmp_fSunSize); + FillGaps(m_fSpriteSize, tmp_fSpriteSize); + FillGaps(m_fSpriteBrightness, tmp_fSpriteBrightness); + FillGaps(m_nShadowStrength, tmp_nShadowStrength); + FillGaps(m_nLightShadowStrength, tmp_nLightShadowStrength); + FillGaps(m_nPoleShadowStrength, tmp_nPoleShadowStrength); + FillGaps(m_fFogStart, tmp_fFogStart); + FillGaps(m_fFarClip, tmp_fFarClip); + FillGaps(m_fLightsOnGroundBrightness, tmp_fLightsOnGroundBrightness); + FillGaps(m_nLowCloudsRed, tmp_nLowCloudsRed); + FillGaps(m_nLowCloudsGreen, tmp_nLowCloudsGreen); + FillGaps(m_nLowCloudsBlue, tmp_nLowCloudsBlue); + FillGaps(m_nFluffyCloudsTopRed, tmp_nFluffyCloudsTopRed); + FillGaps(m_nFluffyCloudsTopGreen, tmp_nFluffyCloudsTopGreen); + FillGaps(m_nFluffyCloudsTopBlue, tmp_nFluffyCloudsTopBlue); + FillGaps(m_nFluffyCloudsBottomRed, tmp_nFluffyCloudsBottomRed); + FillGaps(m_nFluffyCloudsBottomGreen, tmp_nFluffyCloudsBottomGreen); + FillGaps(m_nFluffyCloudsBottomBlue, tmp_nFluffyCloudsBottomBlue); + FillGaps(m_fBlurRed, tmp_fBlurRed); + FillGaps(m_fBlurGreen, tmp_fBlurGreen); + FillGaps(m_fBlurBlue, tmp_fBlurBlue); + FillGaps(m_fWaterRed, tmp_fWaterRed); + FillGaps(m_fWaterGreen, tmp_fWaterGreen); + FillGaps(m_fWaterBlue, tmp_fWaterBlue); + FillGaps(m_fWaterAlpha, tmp_fWaterAlpha); +} + static float interp_c0, interp_c1, interp_c2, interp_c3; float CTimeCycle::Interpolate(int8 *a, int8 *b) diff --git a/src/render/Timecycle.h b/src/render/Timecycle.h index da911b75..d8c333f6 100644 --- a/src/render/Timecycle.h +++ b/src/render/Timecycle.h @@ -185,6 +185,7 @@ public: static int32 GetWaterAlpha(void) { return m_fCurrentWaterAlpha; } static void Initialise(void); + static void UpdateArrays(void); static void Update(void); static float Interpolate(int8 *a, int8 *b); static float Interpolate(uint8 *a, uint8 *b); diff --git a/src/render/WaterCreatures.cpp b/src/render/WaterCreatures.cpp index d3bd2701..b44f987c 100644 --- a/src/render/WaterCreatures.cpp +++ b/src/render/WaterCreatures.cpp @@ -7,6 +7,7 @@ #include "config.h" #include "General.h" +/* int CWaterCreatures::nNumActiveSeaLifeForms; CWaterCreature CWaterCreatures::aWaterCreatures[NUM_WATER_CREATURES]; @@ -271,4 +272,5 @@ void CWaterCreatures::RemoveAll() { nNumActiveSeaLifeForms--; } } -}
\ No newline at end of file +} +*/
\ No newline at end of file diff --git a/src/render/WaterCreatures.h b/src/render/WaterCreatures.h index 9ef8198c..0b8d2376 100644 --- a/src/render/WaterCreatures.h +++ b/src/render/WaterCreatures.h @@ -1,6 +1,7 @@ #pragma once #include "Object.h" +/* enum eFishSlotState { WATER_CREATURE_INIT = 0, WATER_CREATURE_ACTIVE, @@ -45,4 +46,4 @@ struct WaterCreatureProperties { float fLevel; float fUnknown; //unused float fWaterDepth; -};
\ No newline at end of file +};*/
\ No newline at end of file diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp index 854653f0..6caac31e 100644 --- a/src/render/WaterLevel.cpp +++ b/src/render/WaterLevel.cpp @@ -1175,13 +1175,13 @@ CWaterLevel::RenderWater() if ( WavesCalculatedThisFrame ) { RenderSeaBirds(); - RenderShipsOnHorizon(); - CParticle::HandleShipsAtHorizonStuff(); - HandleBeachToysStuff(); + //RenderShipsOnHorizon(); + //CParticle::HandleShipsAtHorizonStuff(); + //HandleBeachToysStuff(); } - if ( _bSeaLife ) - HandleSeaLifeForms(); + //if ( _bSeaLife ) + // HandleSeaLifeForms(); DefinedState(); } @@ -3105,6 +3105,7 @@ CWaterLevel::RenderShipsOnHorizon() } } +/* void CWaterLevel::HandleSeaLifeForms() { @@ -3145,7 +3146,7 @@ CWaterLevel::HandleSeaLifeForms() } CWaterCreatures::UpdateAll(); -} +}*/ void CWaterLevel::HandleBeachToysStuff(void) diff --git a/src/render/WaterLevel.h b/src/render/WaterLevel.h index 5a497ddf..d0c64eb4 100644 --- a/src/render/WaterLevel.h +++ b/src/render/WaterLevel.h @@ -1,6 +1,6 @@ #pragma once -#define WATER_X_OFFSET (400.0f) +#define WATER_X_OFFSET (0.0f) #define WATER_Z_OFFSET (0.5f) diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp index 17c45fcd..dba9ed14 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]; @@ -647,3 +652,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/rw/Lights.cpp b/src/rw/Lights.cpp index e0dff850..19115ba8 100644 --- a/src/rw/Lights.cpp +++ b/src/rw/Lights.cpp @@ -26,12 +26,7 @@ RwRGBAReal DirectionalLightColourForFrame; RwRGBAReal AmbientLightColour; RwRGBAReal DirectionalLightColour; -#ifdef EXTENDED_COLOURFILTER -#include "postfx.h" -#define USEBLURCOLORS CPostFX::UseBlurColours() -#else -#define USEBLURCOLORS CMBlur::BlurOn -#endif +#define USEBLURCOLORS true // actually CMBlur::BlurOn, but that's always supposed to be on void SetLightsWithTimeOfDayColour(RpWorld *) diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp index cab3b68c..38a0f613 100644 --- a/src/rw/RwHelper.cpp +++ b/src/rw/RwHelper.cpp @@ -18,7 +18,7 @@ bool gPS2alphaTest = true; #else bool gPS2alphaTest = false; #endif -bool gBackfaceCulling = true; +bool gBackfaceCulling = false; // can we ever enable this in LCS even? #if !defined(FINAL) || defined(DEBUGMENU) static bool charsetOpen; diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp index 83c3c5bc..b06c847c 100644 --- a/src/rw/VisibilityPlugins.cpp +++ b/src/rw/VisibilityPlugins.cpp @@ -632,8 +632,9 @@ CVisibilityPlugins::RenderVehicleTailRotorAlphaCB(RpAtomic *atomic) RpAtomic* CVisibilityPlugins::RenderPlayerCB(RpAtomic *atomic) { - if(CWorld::Players[0].m_pSkinTexture) - RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), SetTextureCB, CWorld::Players[0].m_pSkinTexture); +// LCS: removed +// if(CWorld::Players[0].m_pSkinTexture) +// RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), SetTextureCB, CWorld::Players[0].m_pSkinTexture); RENDERCALLBACK(atomic); return atomic; } 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/skel/win/gtalcs.ico b/src/skel/win/gtalcs.ico Binary files differnew file mode 100644 index 00000000..c4b53436 --- /dev/null +++ b/src/skel/win/gtalcs.ico diff --git a/src/skel/win/gtavc.ico b/src/skel/win/gtavc.ico Binary files differdeleted file mode 100644 index d253ff2c..00000000 --- a/src/skel/win/gtavc.ico +++ /dev/null diff --git a/src/skel/win/win.rc b/src/skel/win/win.rc index 9b5aa305..702c3de7 100644 --- a/src/skel/win/win.rc +++ b/src/skel/win/win.rc @@ -42,6 +42,6 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_MAIN_ICON ICON DISCARDABLE "gtavc.ico" +IDI_MAIN_ICON ICON DISCARDABLE "gtalcs.ico" /////////////////////////////////////////////////////////////////////////////
\ No newline at end of file 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 5f7a07cc..fd1659dc 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -13,7 +13,7 @@ static wchar WideErrorString[25]; -CText TheText; +CText *CText::msInstance = nil; CText::CText(void) { @@ -41,7 +41,7 @@ CText::Load(void) 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"); @@ -93,11 +93,13 @@ CText::Load(void) keyArray.Update(data.chars); CFileMgr::CloseFile(file); CFileMgr::SetDir(""); + bIsLoaded = true; } void CText::Unload(void) { + bIsLoaded = false; CMessages::ClearAllMessagesDisplayedByGame(); keyArray.Unload(); data.Unload(); @@ -245,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"); @@ -307,6 +309,11 @@ CText::LoadMissionText(char *MissionTableName) bIsMissionTextLoaded = true; } +bool +CText::IsLoaded() +{ + return bIsLoaded; +} void CKeyArray::Load(size_t length, int file, size_t* offset) diff --git a/src/text/Text.h b/src/text/Text.h index 33dc313e..3e11ea46 100644 --- a/src/text/Text.h +++ b/src/text/Text.h @@ -58,7 +58,7 @@ public: uint32 offset; }; - enum {MAX_MISSION_TEXTS = 90}; // beware that LCS has more + enum {MAX_MISSION_TEXTS = 200}; Entry data[MAX_MISSION_TEXTS]; uint16 size; // You can make this size_t if you want to exceed 32-bit boundaries, everything else should be ready. @@ -84,6 +84,9 @@ class CText bool bIsMissionTextLoaded; char szMissionTableName[8]; CMissionTextOffsets MissionTextOffsets; + bool bIsLoaded; + + static CText *msInstance; public: CText(void); void Load(void); @@ -94,6 +97,15 @@ public: void GetNameOfLoadedMissionText(char *outName); void ReadChunkHeader(ChunkHeader *buf, int32 file, size_t *bytes_read); void LoadMissionText(char *MissionTableName); + bool IsLoaded(); + void GetUTF8(const char*, char*, int); // TODO but unused + + static CText &Instance() + { + if (!msInstance) + msInstance = new CText; + return *msInstance; + } }; -extern CText TheText; +#define TheText CText::Instance() diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 65e3f313..15cbf231 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -1641,13 +1641,13 @@ CAutomobile::ProcessControl(void) // TODO: make the numbers defines float heading; - if(GetPosition().x > 1950.0f-400.0f){ + if(GetPosition().x > 1950.0f){ if(m_vecMoveSpeed.x > 0.0f) m_vecMoveSpeed.x *= -1.0f; heading = GetForward().Heading(); if(heading > 0.0f) // going west SetHeading(-heading); - }else if(GetPosition().x < -1950.0f-400.0f){ + }else if(GetPosition().x < -1950.0f){ if(m_vecMoveSpeed.x < 0.0f) m_vecMoveSpeed.x *= -1.0f; heading = GetForward().Heading(); @@ -2193,8 +2193,7 @@ CAutomobile::PreRender(void) case MI_TAXI: case MI_CABBIE: - case MI_ZEBRA: - case MI_KAUFMAN: + case MI_BORGNINE: if(bTaxiLight){ CVector pos = GetPosition() + GetUp()*0.95f; CCoronas::RegisterCorona((uintptr)this + 21, diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp index 19e95a6e..531128be 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/Cranes.cpp b/src/vehicles/Cranes.cpp index 8433a0ba..ce254100 100644 --- a/src/vehicles/Cranes.cpp +++ b/src/vehicles/Cranes.cpp @@ -62,6 +62,7 @@ void CCranes::InitCranes(void) } } } +/* // TODO(LCS) for (CPtrNode* pNode = CWorld::GetBigBuildingList(LEVEL_MAINLAND).first; pNode; pNode = pNode->next) { CEntity* pEntity = (CEntity*)pNode->item; if (MODELID_CRANE_1 == pEntity->GetModelIndex() || @@ -72,6 +73,7 @@ void CCranes::InitCranes(void) MODELID_CRANE_6 == pEntity->GetModelIndex()) AddThisOneCrane(pEntity); } +*/ } void CCranes::AddThisOneCrane(CEntity* pEntity) @@ -464,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); @@ -479,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 diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp index 9aa834ac..040b6972 100644 --- a/src/vehicles/HandlingMgr.cpp +++ b/src/vehicles/HandlingMgr.cpp @@ -44,6 +44,7 @@ const char VehicleNames[NUMHANDLINGS][14] = { "RHINO", "BARRACKS", "TRAIN", + "FERRY", "HELI", "DODO", "COACH", @@ -56,66 +57,40 @@ const char VehicleNames[NUMHANDLINGS][14] = { "DEADDODO", "FLATBED", "YANKEE", - "GOLFCART", - "VOODOO", - "WASHING", - "CUBAN", - "ROMERO", - "PACKER", - "ADMIRAL", - "GANGBUR", - "ZEBRA", - "TOPFUN", - "GLENDALE", - "OCEANIC", - "HERMES", - "SABRE1", - "SABRETUR", - "PHEONIX", - "WALTON", - "REGINA", - "COMET", - "DELUXO", - "BURRITO", - "SPAND", - "BAGGAGE", - "KAUFMAN", - "RANCHER", - "FBIRANCH", - "VIRGO", - "GREENWOO", - "HOTRING", - "SANDKING", - "BLISTAC", - "BOXVILLE", - "BENSON", - "DESPERAD", - "LOVEFIST", - "BLOODRA", - "BLOODRB", + "BLISTA", + "BELLYUP", + "MRWONGS", + "YARDIE", + "YAKUZA", + "DIABLOS", + "COLUMB", + "HOODS", + "PANLANT", + "BORGNINE", + "CAMPVAN", + "BALLOT", + "SPIDER", + "SHELBY", + "PONTIAC", + "ESPRIT", + "MINI", + "HOTROD", + "SINDACCO", + "FORELLI", "BIKE", "MOPED", "DIRTBIKE", "ANGEL", + "DIRTBIK2", + "ANGE2", "FREEWAY", "PREDATOR", "SPEEDER", "REEFER", - "RIO", - "SQUALO", - "TROPIC", - "COASTGRD", - "DINGHY", - "MARQUIS", - "CUPBOAT", - "SEAPLANE", - "SPARROW", - "SEASPAR", "MAVERICK", "COASTMAV", "POLMAV", "HUNTER", - "RCBARON", "RCGOBLIN", "RCCOPTER" }; @@ -422,15 +397,15 @@ cHandlingDataMgr::GetHandlingId(const char *name) tFlyingHandlingData* cHandlingDataMgr::GetFlyingPointer(uint8 id) { - if(id >= HANDLING_SEAPLANE && id <= HANDLING_RCCOPTER) - return &FlyingHandlingData[id-HANDLING_SEAPLANE]; + if(id >= HANDLING_MAVERICK && id <= HANDLING_RCCOPTER) + return &FlyingHandlingData[id-HANDLING_MAVERICK]; return &FlyingHandlingData[0]; } tBoatHandlingData* cHandlingDataMgr::GetBoatPointer(uint8 id) { - if(id >= HANDLING_PREDATOR && id <= HANDLING_SEAPLANE) + if(id >= HANDLING_PREDATOR && id <= HANDLING_MAVERICK) return &BoatHandlingData[id-HANDLING_PREDATOR]; return &BoatHandlingData[0]; } diff --git a/src/vehicles/HandlingMgr.h b/src/vehicles/HandlingMgr.h index 446395f2..e6b5236f 100644 --- a/src/vehicles/HandlingMgr.h +++ b/src/vehicles/HandlingMgr.h @@ -36,6 +36,7 @@ enum tVehicleType HANDLING_RHINO, HANDLING_BARRACKS, HANDLING_TRAIN, + HANDLING_FERRY, HANDLING_HELI, HANDLING_DODO, HANDLING_COACH, @@ -48,76 +49,51 @@ enum tVehicleType HANDLING_DEADDODO, HANDLING_FLATBED, HANDLING_YANKEE, - HANDLING_GOLFCART, - HANDLING_VOODOO, - HANDLING_WASHING, - HANDLING_CUBAN, - HANDLING_ROMERO, - HANDLING_PACKER, - HANDLING_ADMIRAL, - HANDLING_GANGBUR, - HANDLING_ZEBRA, - HANDLING_TOPFUN, - HANDLING_GLENDALE, - HANDLING_OCEANIC, - HANDLING_HERMES, - HANDLING_SABRE1, - HANDLING_SABRETUR, - HANDLING_PHEONIX, - HANDLING_WALTON, - HANDLING_REGINA, - HANDLING_COMET, - HANDLING_DELUXO, - HANDLING_BURRITO, - HANDLING_SPAND, - HANDLING_BAGGAGE, - HANDLING_KAUFMAN, - HANDLING_RANCHER, - HANDLING_FBIRANCH, - HANDLING_VIRGO, - HANDLING_GREENWOO, - HANDLING_HOTRING, - HANDLING_SANDKING, - HANDLING_BLISTAC, - HANDLING_BOXVILLE, - HANDLING_BENSON, - HANDLING_DESPERAD, - HANDLING_LOVEFIST, - HANDLING_BLOODRA, - HANDLING_BLOODRB, + HANDLING_BLISTA, + HANDLING_BELLYUP, + HANDLING_MRWONGS, + HANDLING_YARDIE, + HANDLING_YAKUZA, + HANDLING_DIABLOS, + HANDLING_COLUMB, + HANDLING_HOODS, + HANDLING_PANLANT, + HANDLING_BORGNINE, + HANDLING_CAMPVAN, + HANDLING_BALLOT, + HANDLING_SPIDER, + HANDLING_SHELBY, + HANDLING_PONTIAC, + HANDLING_ESPRIT, + HANDLING_MINI, + HANDLING_HOTROD, + HANDLING_SINDACCO, + HANDLING_FORELLI, HANDLING_BIKE, HANDLING_MOPED, HANDLING_DIRTBIKE, HANDLING_ANGEL, + HANDLING_DIRTBIK2, + HANDLING_ANGE2, HANDLING_FREEWAY, HANDLING_PREDATOR, HANDLING_SPEEDER, HANDLING_REEFER, - HANDLING_RIO, - HANDLING_SQUALO, - HANDLING_TROPIC, - HANDLING_COASTGRD, - HANDLING_DINGHY, - HANDLING_MARQUIS, - HANDLING_CUPBOAT, - HANDLING_SEAPLANE, // both boat and plane! - HANDLING_SPARROW, - HANDLING_SEASPAR, + HANDLING_MAVERICK, HANDLING_COASTMAV, HANDLING_POLMAV, HANDLING_HUNTER, - HANDLING_RCBARON, HANDLING_RCGOBLIN, HANDLING_RCCOPTER, NUMHANDLINGS, NUMBIKEHANDLINGS = HANDLING_FREEWAY+1 - HANDLING_BIKE, - NUMFLYINGHANDLINGS = HANDLING_RCCOPTER+1 - HANDLING_SEAPLANE, - NUMBOATHANDLINGS = HANDLING_SEAPLANE+1 - HANDLING_PREDATOR, + NUMFLYINGHANDLINGS = HANDLING_RCCOPTER+1 - HANDLING_MAVERICK, + NUMBOATHANDLINGS = HANDLING_COASTMAV+1 - HANDLING_PREDATOR, }; enum tField // most likely a handling field enum, never used so :shrug: diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp index 1a4af307..fefe1781 100644 --- a/src/vehicles/Train.cpp +++ b/src/vehicles/Train.cpp @@ -459,11 +459,11 @@ CTrain::InitTrains(void) CStreaming::LoadAllRequestedModels(false); // El-Train wagons - float wagonPositions[] = { 0.0f, 20.0f, 40.0f, 0.0f, 20.0f }; - int8 firstWagon[] = { 1, 0, 0, 1, 0 }; - int8 lastWagon[] = { 0, 0, 1, 0, 1 }; - int16 wagonGroup[] = { 0, 0, 0, 1, 1 }; - for(i = 0; i < 5; i++){ + float wagonPositions[] = { 0.0f, 20.0f, 0.0f, 20.0f }; + int8 firstWagon[] = { 1, 0, 1, 0 }; + int8 lastWagon[] = { 0, 1, 0, 1 }; + int16 wagonGroup[] = { 0, 0, 1, 1 }; + for(i = 0; i < 4; i++){ train = new CTrain(MI_TRAIN, PERMANENT_VEHICLE); train->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f); train->SetStatus(STATUS_ABANDONED); @@ -650,52 +650,6 @@ CTrain::ReadAndInterpretTrackFile(Const char *filename, CTrainNode **nodes, int1 } void -PlayAnnouncement(uint8 sound, uint8 station) -{ - // this was gone in a PC version but inlined on PS2 - cAudioScriptObject *obj = new cAudioScriptObject; - obj->AudioId = sound; - obj->Posn = CTrain::aStationCoors[station]; - obj->AudioEntity = AEHANDLE_NONE; - DMAudio.CreateOneShotScriptObject(obj); -} - -void -ProcessTrainAnnouncements(void) -{ -#ifdef GTA_TRAIN - for (int i = 0; i < ARRAY_SIZE(StationDist); i++) { - for (int j = 0; j < ARRAY_SIZE(EngineTrackPosition); j++) { - if (!bTrainArrivalAnnounced[i]) { - float preDist = StationDist[i] - 100.0f; - if (preDist < 0.0f) - preDist += TotalLengthOfTrack; - if (EngineTrackPosition[j] > preDist && EngineTrackPosition[j] < StationDist[i]) { - bTrainArrivalAnnounced[i] = true; - PlayAnnouncement(SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_1, i); - break; - } - } else { - float postDist = StationDist[i] + 10.0f; -#ifdef FIX_BUGS - if (postDist > TotalLengthOfTrack) - postDist -= TotalLengthOfTrack; -#else - if (postDist < 0.0f) // does this even make sense here? - postDist += TotalLengthOfTrack; -#endif - if (EngineTrackPosition[j] > StationDist[i] && EngineTrackPosition[j] < postDist) { - bTrainArrivalAnnounced[i] = false; - PlayAnnouncement(SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_2, i); - break; - } - } - } - } -#endif -} - -void CTrain::UpdateTrains(void) { #ifdef GTA_TRAIN @@ -732,8 +686,6 @@ CTrain::UpdateTrains(void) // time offset for each train time += 0x20000/2; } - - ProcessTrainAnnouncements(); } // Update Subway diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 1849fd7f..c2bca63e 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -1841,8 +1841,7 @@ CVehicle::SetDriver(CPed *driver) case MI_TAXI: case MI_CABBIE: - case MI_ZEBRA: - case MI_KAUFMAN: + case MI_BORGNINE: CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 12; break; diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 7388bfab..795161bf 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -384,8 +384,8 @@ public: bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1 && GetStatus() != STATUS_WRECKED; } CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); } - bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_ZEBRA || GetModelIndex() == MI_KAUFMAN; } - bool IsLimo(void) { return GetModelIndex() == MI_STRETCH || GetModelIndex() == MI_LOVEFIST; } + bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE; } + bool IsLimo(void) { return GetModelIndex() == MI_STRETCH; } bool IsRealHeli(void) { return !!(pHandling->Flags & HANDLING_IS_HELI); } bool IsRealPlane(void) { return !!(pHandling->Flags & HANDLING_IS_PLANE); } diff --git a/vendor/librw b/vendor/librw -Subproject 61b288a9fe72ae4073c0ac5fd2a5815ed510c8c +Subproject 78d540fce0ca090b07377cee40d73eadfb7a699 |