mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 19:00:01 +00:00
Merge branch 'lcs' of https://github.com/GTAmodding/re3 into lcs
This commit is contained in:
commit
3e6016dc6e
BIN
premake5.exe
BIN
premake5.exe
Binary file not shown.
13
premake5.lua
13
premake5.lua
|
@ -34,6 +34,11 @@ newoption {
|
||||||
description = "Build with opus"
|
description = "Build with opus"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newoption {
|
||||||
|
trigger = "lto",
|
||||||
|
description = "Use link time optimization"
|
||||||
|
}
|
||||||
|
|
||||||
if(_OPTIONS["with-librw"]) then
|
if(_OPTIONS["with-librw"]) then
|
||||||
Librw = "vendor/librw"
|
Librw = "vendor/librw"
|
||||||
else
|
else
|
||||||
|
@ -61,6 +66,7 @@ end
|
||||||
workspace "reLCS"
|
workspace "reLCS"
|
||||||
language "C++"
|
language "C++"
|
||||||
configurations { "Debug", "Release" }
|
configurations { "Debug", "Release" }
|
||||||
|
startproject "reLCS"
|
||||||
location "build"
|
location "build"
|
||||||
symbols "Full"
|
symbols "Full"
|
||||||
staticruntime "off"
|
staticruntime "off"
|
||||||
|
@ -109,7 +115,10 @@ workspace "reLCS"
|
||||||
|
|
||||||
filter "configurations:Release"
|
filter "configurations:Release"
|
||||||
defines { "NDEBUG" }
|
defines { "NDEBUG" }
|
||||||
optimize "On"
|
optimize "Speed"
|
||||||
|
if(_OPTIONS["lto"]) then
|
||||||
|
flags { "LinkTimeOptimization" }
|
||||||
|
end
|
||||||
|
|
||||||
filter { "platforms:win*" }
|
filter { "platforms:win*" }
|
||||||
system "windows"
|
system "windows"
|
||||||
|
@ -167,7 +176,7 @@ workspace "reLCS"
|
||||||
scriptspath = scriptspath or ""
|
scriptspath = scriptspath or ""
|
||||||
if (gamepath) then
|
if (gamepath) then
|
||||||
postbuildcommands {
|
postbuildcommands {
|
||||||
'{COPY} "%{cfg.buildtarget.abspath}" "' .. gamepath .. scriptspath .. '%{cfg.buildtarget.name}"'
|
'{COPYFILE} "%{cfg.buildtarget.abspath}" "' .. gamepath .. scriptspath .. '%{cfg.buildtarget.name}"'
|
||||||
}
|
}
|
||||||
debugdir (gamepath)
|
debugdir (gamepath)
|
||||||
if (exepath) then
|
if (exepath) then
|
||||||
|
|
BIN
premake5Linux
BIN
premake5Linux
Binary file not shown.
|
@ -14,6 +14,7 @@
|
||||||
#include "RpAnimBlend.h"
|
#include "RpAnimBlend.h"
|
||||||
#include "AnimBlendAssociation.h"
|
#include "AnimBlendAssociation.h"
|
||||||
#include "AnimBlendAssocGroup.h"
|
#include "AnimBlendAssocGroup.h"
|
||||||
|
#include "KeyGen.h"
|
||||||
|
|
||||||
//--MIAMI: file done
|
//--MIAMI: file done
|
||||||
|
|
||||||
|
@ -109,27 +110,34 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern const char* csPlayerNames[];
|
||||||
|
extern const char* playerNames[];
|
||||||
|
|
||||||
CBaseModelInfo*
|
CBaseModelInfo*
|
||||||
GetModelFromName(const char *name)
|
GetModelFromName(const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CBaseModelInfo *mi;
|
CBaseModelInfo* mi;
|
||||||
char playername[32];
|
if (CKeyGen::GetUppercaseKey(name) == CKeyGen::GetUppercaseKey("cstoni_a")) {
|
||||||
|
i = 0;
|
||||||
if(strncasecmp(name, "CSplay", 6) == 0 &&
|
while (csPlayerNames[i][0] != '\0') {
|
||||||
strncasecmp(CModelInfo::GetModelInfo(MI_PLAYER)->GetModelName(), "ig", 2) == 0){
|
if (CModelInfo::GetModelInfo(0)->GetNameHashKey() == CKeyGen::GetUppercaseKey(playerNames[i])) {
|
||||||
strcpy(playername, CModelInfo::GetModelInfo(MI_PLAYER)->GetModelName());
|
name = csPlayerNames[i];
|
||||||
playername[0] = 'C';
|
break;
|
||||||
playername[1] = 'S';
|
}
|
||||||
name = playername;
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < MODELINFOSIZE; i++){
|
uint32 hashKey = CKeyGen::GetUppercaseKey(name);
|
||||||
|
for (i = 0; i < MODELINFOSIZE; i++) {
|
||||||
mi = CModelInfo::GetModelInfo(i);
|
mi = CModelInfo::GetModelInfo(i);
|
||||||
if(mi && mi->GetRwObject() && RwObjectGetType(mi->GetRwObject()) == rpCLUMP &&
|
if (mi && mi->GetRwObject()
|
||||||
strcmpIgnoringDigits(mi->GetModelName(), name))
|
&& RwObjectGetType(mi->GetRwObject()) == rpCLUMP &&
|
||||||
|
hashKey == mi->GetNameHashKey())
|
||||||
return mi;
|
return mi;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,3 +191,45 @@ CAnimBlendAssocGroup::CreateAssociations(const char *blockName, RpClump *clump,
|
||||||
}
|
}
|
||||||
numAssociations = numAssocs;
|
numAssociations = numAssocs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CAnimBlendAssocGroup::CreateAssociations(const char *blockName, const char *animNames, const char *objectNames, int numChars)
|
||||||
|
{
|
||||||
|
if (!objectNames) {
|
||||||
|
CreateAssociations(blockName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (assocList)
|
||||||
|
DestroyAssociations();
|
||||||
|
|
||||||
|
animBlock = CAnimManager::GetAnimationBlock(blockName);
|
||||||
|
assocList = new CAnimBlendAssociation[animBlock->numAnims];
|
||||||
|
|
||||||
|
numAssociations = 0;
|
||||||
|
if (animBlock->numAnims > 0)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
for (i = 0; i < animBlock->numAnims; i++) {
|
||||||
|
int animId = -1;
|
||||||
|
for (j = 0; j != animBlock->numAnims; j++)
|
||||||
|
if (strcmp(CAnimManager::GetAnimation(i + animBlock->firstIndex)->name, animNames + numChars * j) == 0)
|
||||||
|
animId = j;
|
||||||
|
|
||||||
|
if (animId != -1) {
|
||||||
|
CBaseModelInfo* minfo = GetModelFromName(objectNames + numChars * animId);
|
||||||
|
if (minfo)
|
||||||
|
{
|
||||||
|
RpClump* clump = (RpClump*)minfo->CreateInstance();
|
||||||
|
RpAnimBlendClumpInit(clump);
|
||||||
|
assocList[numAssociations].Init(clump, CAnimManager::GetAnimation(i + animBlock->firstIndex));
|
||||||
|
if (IsClumpSkinned(clump))
|
||||||
|
RpClumpForAllAtomics(clump, AtomicRemoveAnimFromSkinCB, nil);
|
||||||
|
RpClumpDestroy(clump);
|
||||||
|
assocList[numAssociations].animId = i + numAssociations;
|
||||||
|
assocList[numAssociations++].groupId = groupId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,4 +21,5 @@ public:
|
||||||
CAnimBlendAssociation *CopyAnimation(const char *name);
|
CAnimBlendAssociation *CopyAnimation(const char *name);
|
||||||
void CreateAssociations(const char *name);
|
void CreateAssociations(const char *name);
|
||||||
void CreateAssociations(const char *blockName, RpClump *clump, const char **animNames, int numAssocs);
|
void CreateAssociations(const char *blockName, RpClump *clump, const char **animNames, int numAssocs);
|
||||||
|
void CreateAssociations(const char *blockName, const char *animNames, const char *objectNames, int numChars);
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,156 +22,56 @@
|
||||||
#include "ColStore.h"
|
#include "ColStore.h"
|
||||||
#include "Radar.h"
|
#include "Radar.h"
|
||||||
#include "Pools.h"
|
#include "Pools.h"
|
||||||
|
#include "crossplatform.h"
|
||||||
|
|
||||||
//--MIAMI: file done
|
//--MIAMI: file done
|
||||||
|
|
||||||
const struct {
|
static bool bModelsRemovedForCutscene;
|
||||||
const char *szTrackName;
|
static int32 NumberOfSavedWeapons;
|
||||||
int iTrackId;
|
static eWeaponType SavedWeaponIDs[TOTAL_WEAPON_SLOTS];
|
||||||
} musicNameIdAssoc[] = {
|
static int32 SavedWeaponAmmo[TOTAL_WEAPON_SLOTS];
|
||||||
{ "ASS_1", STREAMED_SOUND_CUTSCENE_ASS_1 },
|
|
||||||
{ "ASS_2", STREAMED_SOUND_CUTSCENE_ASS_2 },
|
|
||||||
{ "BANK_1", STREAMED_SOUND_CUTSCENE_BANK_1 },
|
|
||||||
{ "BANK_2A", STREAMED_SOUND_CUTSCENE_BANK_2A },
|
|
||||||
{ "BANK_2B", STREAMED_SOUND_CUTSCENE_BANK_2B },
|
|
||||||
{ "BANK_3A", STREAMED_SOUND_CUTSCENE_BANK_3A },
|
|
||||||
{ "BANK_3B", STREAMED_SOUND_CUTSCENE_BANK_3B },
|
|
||||||
{ "BANK_4", STREAMED_SOUND_CUTSCENE_BANK_4 },
|
|
||||||
{ "BIKE_1", STREAMED_SOUND_CUTSCENE_BIKE_1 },
|
|
||||||
{ "BIKE_2", STREAMED_SOUND_CUTSCENE_BIKE_2 },
|
|
||||||
{ "BIKE_3", STREAMED_SOUND_CUTSCENE_BIKE_3 },
|
|
||||||
{ "BUD_1", STREAMED_SOUND_CUTSCENE_BUD_1 },
|
|
||||||
{ "BUD_2", STREAMED_SOUND_CUTSCENE_BUD_2 },
|
|
||||||
{ "BUD_3", STREAMED_SOUND_CUTSCENE_BUD_3 },
|
|
||||||
{ "CAP_1", STREAMED_SOUND_CUTSCENE_CAP_1 },
|
|
||||||
{ "CAR_1", STREAMED_SOUND_CUTSCENE_CAR_1 },
|
|
||||||
{ "CNT_1A", STREAMED_SOUND_CUTSCENE_CNT_1A },
|
|
||||||
{ "CNT_1B", STREAMED_SOUND_CUTSCENE_CNT_1B },
|
|
||||||
{ "CNT_2", STREAMED_SOUND_CUTSCENE_CNT_2 },
|
|
||||||
{ "COK_1", STREAMED_SOUND_CUTSCENE_COK_1 },
|
|
||||||
{ "COK_2A", STREAMED_SOUND_CUTSCENE_COK_2A },
|
|
||||||
{ "COK_2B", STREAMED_SOUND_CUTSCENE_COK_2B },
|
|
||||||
{ "COK_3", STREAMED_SOUND_CUTSCENE_COK_3 },
|
|
||||||
{ "COK_4A", STREAMED_SOUND_CUTSCENE_COK_4A },
|
|
||||||
{ "COK_4A2", STREAMED_SOUND_CUTSCENE_COK_4A2 },
|
|
||||||
{ "COK_4B", STREAMED_SOUND_CUTSCENE_COK_4B },
|
|
||||||
{ "COL_1", STREAMED_SOUND_CUTSCENE_COL_1 },
|
|
||||||
{ "COL_2", STREAMED_SOUND_CUTSCENE_COL_2 },
|
|
||||||
{ "COL_3A", STREAMED_SOUND_CUTSCENE_COL_3A },
|
|
||||||
{ "COL_4A", STREAMED_SOUND_CUTSCENE_COL_4A },
|
|
||||||
{ "COL_5A", STREAMED_SOUND_CUTSCENE_COL_5A },
|
|
||||||
{ "COL_5B", STREAMED_SOUND_CUTSCENE_COL_5B },
|
|
||||||
{ "CUB_1", STREAMED_SOUND_CUTSCENE_CUB_1 },
|
|
||||||
{ "CUB_2", STREAMED_SOUND_CUTSCENE_CUB_2 },
|
|
||||||
{ "CUB_3", STREAMED_SOUND_CUTSCENE_CUB_3 },
|
|
||||||
{ "CUB_4", STREAMED_SOUND_CUTSCENE_CUB_4 },
|
|
||||||
{ "DRUG_1", STREAMED_SOUND_CUTSCENE_DRUG_1 },
|
|
||||||
{ "FIN", STREAMED_SOUND_CUTSCENE_FIN },
|
|
||||||
{ "FIN_2", STREAMED_SOUND_CUTSCENE_FIN2 },
|
|
||||||
{ "FINALE", STREAMED_SOUND_CUTSCENE_FINALE },
|
|
||||||
{ "HAT_1", STREAMED_SOUND_CUTSCENE_HAT_1 },
|
|
||||||
{ "HAT_2", STREAMED_SOUND_CUTSCENE_HAT_2 },
|
|
||||||
{ "HAT_3", STREAMED_SOUND_CUTSCENE_HAT_3 },
|
|
||||||
{ "ICE_1", STREAMED_SOUND_CUTSCENE_ICE_1 },
|
|
||||||
{ "INT_A", STREAMED_SOUND_CUTSCENE_INT_A },
|
|
||||||
{ "INT_B", STREAMED_SOUND_CUTSCENE_INT_B },
|
|
||||||
{ "INT_D", STREAMED_SOUND_CUTSCENE_INT_D },
|
|
||||||
{ "INT_M", STREAMED_SOUND_CUTSCENE_INT_M },
|
|
||||||
{ "LAW_1A", STREAMED_SOUND_CUTSCENE_LAW_1A },
|
|
||||||
{ "LAW_1B", STREAMED_SOUND_CUTSCENE_LAW_1B },
|
|
||||||
{ "LAW_2A", STREAMED_SOUND_CUTSCENE_LAW_2A },
|
|
||||||
{ "LAW_2B", STREAMED_SOUND_CUTSCENE_LAW_2B },
|
|
||||||
{ "LAW_2C", STREAMED_SOUND_CUTSCENE_LAW_2C },
|
|
||||||
{ "LAW_3", STREAMED_SOUND_CUTSCENE_LAW_3 },
|
|
||||||
{ "LAW_4", STREAMED_SOUND_CUTSCENE_LAW_4 },
|
|
||||||
{ "PHIL_1", STREAMED_SOUND_CUTSCENE_PHIL_1 },
|
|
||||||
{ "PHIL_2", STREAMED_SOUND_CUTSCENE_PHIL_2 },
|
|
||||||
{ "PORN_1", STREAMED_SOUND_CUTSCENE_PORN_1 },
|
|
||||||
{ "PORN_2", STREAMED_SOUND_CUTSCENE_PORN_2 },
|
|
||||||
{ "PORN_3", STREAMED_SOUND_CUTSCENE_PORN_3 },
|
|
||||||
{ "PORN_4", STREAMED_SOUND_CUTSCENE_PORN_4 },
|
|
||||||
{ "RESC_1A", STREAMED_SOUND_CUTSCENE_RESC_1A },
|
|
||||||
{ "ROK_1", STREAMED_SOUND_CUTSCENE_ROK_1 },
|
|
||||||
{ "ROK_2", STREAMED_SOUND_CUTSCENE_ROK_2 },
|
|
||||||
{ "ROK_3A", STREAMED_SOUND_CUTSCENE_ROK_3A },
|
|
||||||
{ "STRIPA", STREAMED_SOUND_CUTSCENE_STRIPA },
|
|
||||||
{ "TAX_1", STREAMED_SOUND_CUTSCENE_TAX_1 },
|
|
||||||
{ "TEX_1", STREAMED_SOUND_CUTSCENE_TEX_1 },
|
|
||||||
{ "TEX_2", STREAMED_SOUND_CUTSCENE_TEX_2 },
|
|
||||||
{ "TEX_3", STREAMED_SOUND_CUTSCENE_TEX_3 },
|
|
||||||
{ "GSPOT", STREAMED_SOUND_CUTSCENE_GLIGHT },
|
|
||||||
{ "FIST", STREAMED_SOUND_CUTSCENE_FIST },
|
|
||||||
{ "EL_PH1", STREAMED_SOUND_CUTSCENE_ELBURRO1_PH1 },
|
|
||||||
{ "EL_PH2", STREAMED_SOUND_CUTSCENE_ELBURRO2_PH2 },
|
|
||||||
{ NULL, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
int
|
char CCutsceneMgr::ms_cAppendAnimName[NUMCUTSCENEOBJECTS][NAMELENGTH];
|
||||||
FindCutsceneAudioTrackId(const char *szCutsceneName)
|
char CCutsceneMgr::ms_cAppendObjectName[NUMCUTSCENEOBJECTS][NAMELENGTH];
|
||||||
{
|
int CCutsceneMgr::ms_numAppendObjectNames;
|
||||||
for (int i = 0; musicNameIdAssoc[i].szTrackName; i++) {
|
|
||||||
if (!CGeneral::faststricmp(musicNameIdAssoc[i].szTrackName, szCutsceneName))
|
|
||||||
return musicNameIdAssoc[i].iTrackId;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CCutsceneMgr::ms_running;
|
|
||||||
bool CCutsceneMgr::ms_cutsceneProcessing;
|
|
||||||
CDirectory *CCutsceneMgr::ms_pCutsceneDir;
|
CDirectory *CCutsceneMgr::ms_pCutsceneDir;
|
||||||
CCutsceneObject *CCutsceneMgr::ms_pCutsceneObjects[NUMCUTSCENEOBJECTS];
|
|
||||||
int32 CCutsceneMgr::ms_numCutsceneObjs;
|
|
||||||
bool CCutsceneMgr::ms_loaded;
|
bool CCutsceneMgr::ms_loaded;
|
||||||
bool CCutsceneMgr::ms_animLoaded;
|
bool CCutsceneMgr::ms_hasFileInfo;
|
||||||
bool CCutsceneMgr::ms_useLodMultiplier;
|
|
||||||
char CCutsceneMgr::ms_cutsceneName[CUTSCENENAMESIZE];
|
|
||||||
CAnimBlendAssocGroup CCutsceneMgr::ms_cutsceneAssociations;
|
|
||||||
CVector CCutsceneMgr::ms_cutsceneOffset;
|
|
||||||
float CCutsceneMgr::ms_cutsceneTimer;
|
|
||||||
bool CCutsceneMgr::ms_wasCutsceneSkipped;
|
bool CCutsceneMgr::ms_wasCutsceneSkipped;
|
||||||
|
bool CCutsceneMgr::ms_useLodMultiplier;
|
||||||
|
bool CCutsceneMgr::ms_cutsceneProcessing;
|
||||||
|
bool CCutsceneMgr::ms_running;
|
||||||
|
bool CCutsceneMgr::ms_animLoaded;
|
||||||
uint32 CCutsceneMgr::ms_cutsceneLoadStatus;
|
uint32 CCutsceneMgr::ms_cutsceneLoadStatus;
|
||||||
bool CCutsceneMgr::ms_useCutsceneShadows = true;
|
|
||||||
|
|
||||||
bool bCamLoaded;
|
|
||||||
bool bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver; // pls don't shrink the name :P
|
|
||||||
int32 NumberOfSavedWeapons;
|
|
||||||
eWeaponType SavedWeaponIDs[TOTAL_WEAPON_SLOTS];
|
|
||||||
int32 SavedWeaponAmmo[TOTAL_WEAPON_SLOTS];
|
|
||||||
char uncompressedAnims[8][32];
|
|
||||||
uint32 numUncompressedAnims;
|
|
||||||
|
|
||||||
|
|
||||||
RpAtomic *
|
|
||||||
CalculateBoundingSphereRadiusCB(RpAtomic *atomic, void *data)
|
|
||||||
{
|
|
||||||
float radius = RpAtomicGetBoundingSphere(atomic)->radius;
|
|
||||||
RwV3d center = RpAtomicGetBoundingSphere(atomic)->center;
|
|
||||||
|
|
||||||
for (RwFrame *frame = RpAtomicGetFrame(atomic); RwFrameGetParent(frame); frame = RwFrameGetParent(frame))
|
|
||||||
RwV3dTransformPoints(¢er, ¢er, 1, RwFrameGetMatrix(frame));
|
|
||||||
|
|
||||||
float size = RwV3dLength(¢er) + radius;
|
|
||||||
if (size > *(float *)data)
|
|
||||||
*(float *)data = size;
|
|
||||||
return atomic;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CCutsceneMgr::Initialise(void)
|
CCutsceneMgr::Initialise(void *dir)
|
||||||
{
|
{
|
||||||
ms_numCutsceneObjs = 0;
|
ms_cutsceneLoadStatus = CUTSCENE_NOT_LOADED;
|
||||||
ms_loaded = false;
|
|
||||||
ms_wasCutsceneSkipped = false;
|
|
||||||
ms_running = false;
|
ms_running = false;
|
||||||
ms_useLodMultiplier = false;
|
|
||||||
ms_animLoaded = false;
|
ms_animLoaded = false;
|
||||||
ms_cutsceneProcessing = false;
|
ms_cutsceneProcessing = false;
|
||||||
|
ms_useLodMultiplier = false;
|
||||||
|
ms_wasCutsceneSkipped = false;
|
||||||
|
ms_hasFileInfo = false;
|
||||||
|
//ms_numCutsceneObjs = 0;
|
||||||
|
//ms_loaded = false;
|
||||||
|
if (gMakeResources) {
|
||||||
|
ms_pCutsceneDir = new CDirectory(CUTSCENEDIRSIZE);
|
||||||
|
ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ms_pCutsceneDir = (CDirectory*)dir;
|
||||||
|
|
||||||
ms_pCutsceneDir = new CDirectory(CUTSCENEDIRSIZE);
|
//numUncompressedAnims = 0;
|
||||||
ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR");
|
//uncompressedAnims[0][0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
numUncompressedAnims = 0;
|
void CCutsceneMgr::Write(base::cRelocatableChunkWriter& writer)
|
||||||
uncompressedAnims[0][0] = '\0';
|
{
|
||||||
|
writer.AllocateRaw(ms_pCutsceneDir, sizeof(*ms_pCutsceneDir), 4, false, true);
|
||||||
|
writer.AllocateRaw(ms_pCutsceneDir->entries, sizeof(CDirectory::DirectoryInfo) * ms_pCutsceneDir->numEntries, 4, false, true);
|
||||||
|
writer.AddPatch(ms_pCutsceneDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -183,431 +83,25 @@ CCutsceneMgr::Shutdown(void)
|
||||||
void
|
void
|
||||||
CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
|
CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
|
||||||
{
|
{
|
||||||
int file;
|
LoadCutsceneData_overlay(szCutsceneName);
|
||||||
uint32 size;
|
|
||||||
uint32 offset;
|
|
||||||
CPlayerPed *pPlayerPed;
|
|
||||||
|
|
||||||
ms_cutsceneProcessing = true;
|
|
||||||
ms_wasCutsceneSkipped = false;
|
|
||||||
CTimer::Suspend();
|
|
||||||
if (!bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver)
|
|
||||||
CStreaming::RemoveCurrentZonesModels();
|
|
||||||
|
|
||||||
ms_pCutsceneDir->numEntries = 0;
|
|
||||||
ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR");
|
|
||||||
|
|
||||||
CStreaming::RemoveUnusedModelsInLoadedList();
|
|
||||||
CGame::DrasticTidyUpMemory(true);
|
|
||||||
|
|
||||||
strcpy(ms_cutsceneName, szCutsceneName);
|
|
||||||
|
|
||||||
RwStream *stream;
|
|
||||||
stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "ANIM\\CUTS.IMG");
|
|
||||||
assert(stream);
|
|
||||||
|
|
||||||
// Load animations
|
|
||||||
sprintf(gString, "%s.IFP", szCutsceneName);
|
|
||||||
if (ms_pCutsceneDir->FindItem(gString, offset, size)) {
|
|
||||||
CStreaming::MakeSpaceFor(size << 11);
|
|
||||||
CStreaming::ImGonnaUseStreamingMemory();
|
|
||||||
RwStreamSkip(stream, offset << 11);
|
|
||||||
CAnimManager::LoadAnimFile(stream, true, uncompressedAnims);
|
|
||||||
ms_cutsceneAssociations.CreateAssociations(szCutsceneName);
|
|
||||||
CStreaming::IHaveUsedStreamingMemory();
|
|
||||||
ms_animLoaded = true;
|
|
||||||
} else {
|
|
||||||
ms_animLoaded = false;
|
|
||||||
}
|
|
||||||
RwStreamClose(stream, nil);
|
|
||||||
|
|
||||||
// Load camera data
|
|
||||||
file = CFileMgr::OpenFile("ANIM\\CUTS.IMG", "rb");
|
|
||||||
sprintf(gString, "%s.DAT", szCutsceneName);
|
|
||||||
if (ms_pCutsceneDir->FindItem(gString, offset, size)) {
|
|
||||||
CStreaming::ImGonnaUseStreamingMemory();
|
|
||||||
CFileMgr::Seek(file, offset << 11, SEEK_SET);
|
|
||||||
TheCamera.LoadPathSplines(file);
|
|
||||||
CStreaming::IHaveUsedStreamingMemory();
|
|
||||||
bCamLoaded = true;
|
|
||||||
} else {
|
|
||||||
bCamLoaded = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CFileMgr::CloseFile(file);
|
|
||||||
|
|
||||||
if (CGeneral::faststricmp(ms_cutsceneName, "finale")) {
|
|
||||||
DMAudio.ChangeMusicMode(MUSICMODE_CUTSCENE);
|
|
||||||
int trackId = FindCutsceneAudioTrackId(szCutsceneName);
|
|
||||||
if (trackId != -1) {
|
|
||||||
printf("Start preload audio %s\n", szCutsceneName);
|
|
||||||
DMAudio.PreloadCutSceneMusic(trackId);
|
|
||||||
printf("End preload audio %s\n", szCutsceneName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ms_cutsceneTimer = 0.0f;
|
|
||||||
ms_loaded = true;
|
|
||||||
ms_cutsceneOffset = CVector(0.0f, 0.0f, 0.0f);
|
|
||||||
|
|
||||||
pPlayerPed = FindPlayerPed();
|
|
||||||
pPlayerPed->m_pWanted->ClearQdCrimes();
|
|
||||||
pPlayerPed->bIsVisible = false;
|
|
||||||
pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina;
|
|
||||||
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CUTSCENE);
|
|
||||||
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(true);
|
|
||||||
|
|
||||||
CTimer::Resume();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CCutsceneMgr::FinishCutscene()
|
|
||||||
{
|
|
||||||
ms_wasCutsceneSkipped = true;
|
|
||||||
if (bCamLoaded) {
|
|
||||||
CCutsceneMgr::ms_cutsceneTimer = TheCamera.GetCutSceneFinishTime() * 0.001f;
|
|
||||||
TheCamera.FinishCutscene();
|
|
||||||
}
|
|
||||||
|
|
||||||
FindPlayerPed()->bIsVisible = true;
|
|
||||||
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CCutsceneMgr::SetupCutsceneToStart(void)
|
|
||||||
{
|
|
||||||
if (bCamLoaded) {
|
|
||||||
TheCamera.SetCamCutSceneOffSet(ms_cutsceneOffset);
|
|
||||||
TheCamera.TakeControlWithSpline(JUMP_CUT);
|
|
||||||
TheCamera.SetWideScreenOn();
|
|
||||||
}
|
|
||||||
|
|
||||||
ms_cutsceneOffset.z++;
|
|
||||||
|
|
||||||
for (int i = ms_numCutsceneObjs - 1; i >= 0; i--) {
|
|
||||||
assert(RwObjectGetType(ms_pCutsceneObjects[i]->m_rwObject) == rpCLUMP);
|
|
||||||
if (CAnimBlendAssociation *pAnimBlendAssoc = RpAnimBlendClumpGetFirstAssociation((RpClump*)ms_pCutsceneObjects[i]->m_rwObject)) {
|
|
||||||
assert(pAnimBlendAssoc->hierarchy->sequences[0].HasTranslation());
|
|
||||||
if (ms_pCutsceneObjects[i]->m_pAttachTo != nil) {
|
|
||||||
pAnimBlendAssoc->flags &= (~ASSOC_HAS_TRANSLATION);
|
|
||||||
} else {
|
|
||||||
if (pAnimBlendAssoc->hierarchy->IsCompressed()){
|
|
||||||
KeyFrameTransCompressed *keyFrames = ((KeyFrameTransCompressed*)pAnimBlendAssoc->hierarchy->sequences[0].GetKeyFrameCompressed(0));
|
|
||||||
CVector trans;
|
|
||||||
keyFrames->GetTranslation(&trans);
|
|
||||||
ms_pCutsceneObjects[i]->SetPosition(ms_cutsceneOffset + trans);
|
|
||||||
}else{
|
|
||||||
KeyFrameTrans *keyFrames = ((KeyFrameTrans*)pAnimBlendAssoc->hierarchy->sequences[0].GetKeyFrame(0));
|
|
||||||
ms_pCutsceneObjects[i]->SetPosition(ms_cutsceneOffset + keyFrames->translation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pAnimBlendAssoc->SetRun();
|
|
||||||
} else {
|
|
||||||
ms_pCutsceneObjects[i]->SetPosition(ms_cutsceneOffset);
|
|
||||||
}
|
|
||||||
CWorld::Add(ms_pCutsceneObjects[i]);
|
|
||||||
if (RwObjectGetType(ms_pCutsceneObjects[i]->m_rwObject) == rpCLUMP) {
|
|
||||||
ms_pCutsceneObjects[i]->UpdateRpHAnim();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CTimer::Update();
|
|
||||||
CTimer::Update();
|
|
||||||
ms_running = true;
|
|
||||||
ms_cutsceneTimer = 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CCutsceneMgr::SetCutsceneAnim(const char *animName, CObject *pObject)
|
|
||||||
{
|
|
||||||
CAnimBlendAssociation *pNewAnim;
|
|
||||||
CAnimBlendClumpData *pAnimBlendClumpData;
|
|
||||||
|
|
||||||
assert(RwObjectGetType(pObject->m_rwObject) == rpCLUMP);
|
|
||||||
debug("Give cutscene anim %s\n", animName);
|
|
||||||
RpAnimBlendClumpRemoveAllAssociations((RpClump*)pObject->m_rwObject);
|
|
||||||
|
|
||||||
pNewAnim = ms_cutsceneAssociations.GetAnimation(animName);
|
|
||||||
if (!pNewAnim) {
|
|
||||||
debug("\n\nHaven't I told you I can't find the fucking animation %s\n\n\n", animName);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pNewAnim->hierarchy->IsCompressed())
|
|
||||||
pNewAnim->hierarchy->keepCompressed = true;
|
|
||||||
|
|
||||||
CStreaming::ImGonnaUseStreamingMemory();
|
|
||||||
pNewAnim = ms_cutsceneAssociations.CopyAnimation(animName);
|
|
||||||
CStreaming::IHaveUsedStreamingMemory();
|
|
||||||
|
|
||||||
pNewAnim->SetCurrentTime(0.0f);
|
|
||||||
pNewAnim->flags |= ASSOC_HAS_TRANSLATION;
|
|
||||||
pNewAnim->flags &= ~ASSOC_RUNNING;
|
|
||||||
|
|
||||||
pAnimBlendClumpData = *RPANIMBLENDCLUMPDATA(pObject->m_rwObject);
|
|
||||||
pAnimBlendClumpData->link.Prepend(&pNewAnim->link);
|
|
||||||
|
|
||||||
if (pNewAnim->hierarchy->keepCompressed)
|
|
||||||
pAnimBlendClumpData->frames->flag |= AnimBlendFrameData::COMPRESSED;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CCutsceneMgr::SetCutsceneAnimToLoop(const char* animName)
|
|
||||||
{
|
|
||||||
ms_cutsceneAssociations.GetAnimation(animName)->flags |= ASSOC_REPEAT;
|
|
||||||
}
|
|
||||||
|
|
||||||
CCutsceneHead *
|
|
||||||
CCutsceneMgr::AddCutsceneHead(CObject *pObject, int modelId)
|
|
||||||
{
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateCutsceneObjectBoundingBox(RpClump* clump, int modelId)
|
|
||||||
{
|
|
||||||
if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ05) {
|
|
||||||
CColModel* pColModel = &CTempColModels::ms_colModelCutObj[modelId - MI_CUTOBJ01];
|
|
||||||
float radius = 0.0f;
|
|
||||||
RpClumpForAllAtomics(clump, CalculateBoundingSphereRadiusCB, &radius);
|
|
||||||
pColModel->boundingSphere.radius = radius;
|
|
||||||
pColModel->boundingBox.min = CVector(-radius, -radius, -radius);
|
|
||||||
pColModel->boundingBox.max = CVector(radius, radius, radius);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CCutsceneObject *
|
|
||||||
CCutsceneMgr::CreateCutsceneObject(int modelId)
|
|
||||||
{
|
|
||||||
CBaseModelInfo *pModelInfo;
|
|
||||||
CColModel *pColModel;
|
|
||||||
CCutsceneObject *pCutsceneObject;
|
|
||||||
|
|
||||||
CStreaming::ImGonnaUseStreamingMemory();
|
|
||||||
debug("Created cutscene object %s\n", CModelInfo::GetModelInfo(modelId)->GetModelName());
|
|
||||||
if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ05) {
|
|
||||||
pModelInfo = CModelInfo::GetModelInfo(modelId);
|
|
||||||
pColModel = &CTempColModels::ms_colModelCutObj[modelId - MI_CUTOBJ01];
|
|
||||||
pModelInfo->SetColModel(pColModel);
|
|
||||||
UpdateCutsceneObjectBoundingBox((RpClump*)pModelInfo->GetRwObject(), modelId);
|
|
||||||
} else if (modelId >= MI_SPECIAL01 && modelId <= MI_SPECIAL21) {
|
|
||||||
pModelInfo = CModelInfo::GetModelInfo(modelId);
|
|
||||||
if (pModelInfo->GetColModel() == &CTempColModels::ms_colModelPed1) {
|
|
||||||
CColModel *colModel = new CColModel();
|
|
||||||
colModel->boundingSphere.radius = 2.0f;
|
|
||||||
colModel->boundingSphere.center = CVector(0.0f, 0.0f, 0.0f);
|
|
||||||
pModelInfo->SetColModel(colModel, true);
|
|
||||||
}
|
|
||||||
pColModel = pModelInfo->GetColModel();
|
|
||||||
float radius = 2.0f;
|
|
||||||
pColModel->boundingSphere.radius = radius;
|
|
||||||
pColModel->boundingBox.min = CVector(-radius, -radius, -radius);
|
|
||||||
pColModel->boundingBox.max = CVector(radius, radius, radius);
|
|
||||||
}
|
|
||||||
|
|
||||||
pCutsceneObject = new CCutsceneObject();
|
|
||||||
pCutsceneObject->SetModelIndex(modelId);
|
|
||||||
if (ms_useCutsceneShadows)
|
|
||||||
pCutsceneObject->CreateShadow();
|
|
||||||
ms_pCutsceneObjects[ms_numCutsceneObjs++] = pCutsceneObject;
|
|
||||||
CStreaming::IHaveUsedStreamingMemory();
|
|
||||||
return pCutsceneObject;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CCutsceneMgr::DeleteCutsceneData(void)
|
CCutsceneMgr::DeleteCutsceneData(void)
|
||||||
{
|
{
|
||||||
if (!ms_loaded) return;
|
DeleteCutsceneData_overlay();
|
||||||
CTimer::Suspend();
|
if (bModelsRemovedForCutscene)
|
||||||
|
LoadEverythingBecauseCutsceneDeletedAllOfIt();
|
||||||
ms_cutsceneProcessing = false;
|
|
||||||
ms_useLodMultiplier = false;
|
|
||||||
ms_useCutsceneShadows = true;
|
|
||||||
|
|
||||||
for (--ms_numCutsceneObjs; ms_numCutsceneObjs >= 0; ms_numCutsceneObjs--) {
|
|
||||||
CWorld::Remove(ms_pCutsceneObjects[ms_numCutsceneObjs]);
|
|
||||||
ms_pCutsceneObjects[ms_numCutsceneObjs]->DeleteRwObject();
|
|
||||||
delete ms_pCutsceneObjects[ms_numCutsceneObjs];
|
|
||||||
ms_pCutsceneObjects[ms_numCutsceneObjs] = nil;
|
|
||||||
}
|
|
||||||
ms_numCutsceneObjs = 0;
|
|
||||||
|
|
||||||
for (int i = MI_SPECIAL01; i < MI_SPECIAL21; i++) {
|
|
||||||
CBaseModelInfo *minfo = CModelInfo::GetModelInfo(i);
|
|
||||||
CColModel *colModel = minfo->GetColModel();
|
|
||||||
if (colModel != &CTempColModels::ms_colModelPed1) {
|
|
||||||
delete colModel;
|
|
||||||
minfo->SetColModel(&CTempColModels::ms_colModelPed1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ms_animLoaded)
|
|
||||||
CAnimManager::RemoveLastAnimFile();
|
|
||||||
|
|
||||||
ms_animLoaded = false;
|
|
||||||
numUncompressedAnims = 0;
|
|
||||||
uncompressedAnims[0][0] = '\0';
|
|
||||||
|
|
||||||
if (bCamLoaded) {
|
|
||||||
TheCamera.RestoreWithJumpCut();
|
|
||||||
TheCamera.SetWideScreenOff();
|
|
||||||
TheCamera.DeleteCutSceneCamDataMemory();
|
|
||||||
}
|
|
||||||
ms_running = false;
|
|
||||||
ms_loaded = false;
|
|
||||||
|
|
||||||
FindPlayerPed()->bIsVisible = true;
|
|
||||||
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CUTSCENE);
|
|
||||||
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
|
|
||||||
|
|
||||||
if (CGeneral::faststricmp(ms_cutsceneName, "finale")) {
|
|
||||||
DMAudio.StopCutSceneMusic();
|
|
||||||
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
CStreaming::ms_disableStreaming = false;
|
|
||||||
CWorld::bProcessCutsceneOnly = false;
|
|
||||||
|
|
||||||
if(bCamLoaded)
|
|
||||||
CGame::DrasticTidyUpMemory(TheCamera.GetScreenFadeStatus() == FADE_2);
|
|
||||||
|
|
||||||
CPad::GetPad(0)->Clear(false);
|
|
||||||
if (bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver) {
|
|
||||||
CStreaming::LoadInitialPeds();
|
|
||||||
CStreaming::LoadInitialWeapons();
|
|
||||||
CStreaming::LoadInitialVehicles();
|
|
||||||
bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver = false;
|
|
||||||
|
|
||||||
CPlayerPed *pPlayerPed = FindPlayerPed();
|
|
||||||
for (int i = 0; i < NumberOfSavedWeapons; i++) {
|
|
||||||
int32 weaponModelId = CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModelId;
|
|
||||||
uint8 flags = CStreaming::ms_aInfoForModel[weaponModelId].m_flags;
|
|
||||||
CStreaming::RequestModel(weaponModelId, STREAMFLAGS_DONT_REMOVE);
|
|
||||||
CStreaming::LoadAllRequestedModels(false);
|
|
||||||
if (CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModel2Id != -1) {
|
|
||||||
CStreaming::RequestModel(CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModel2Id, 0);
|
|
||||||
CStreaming::LoadAllRequestedModels(false);
|
|
||||||
}
|
|
||||||
if (!(flags & STREAMFLAGS_DONT_REMOVE))
|
|
||||||
CStreaming::SetModelIsDeletable(weaponModelId);
|
|
||||||
pPlayerPed->GiveWeapon(SavedWeaponIDs[i], SavedWeaponAmmo[i], true);
|
|
||||||
}
|
|
||||||
NumberOfSavedWeapons = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CTimer::Resume();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CCutsceneMgr::Update(void)
|
CCutsceneMgr::RemoveEverythingBecauseCutsceneDoesntFitInMemory()
|
||||||
{
|
{
|
||||||
enum {
|
//CStreaming::ms_disableStreaming = true;
|
||||||
CUTSCENE_LOADING_0 = 0,
|
CWorld::ClearExcitingStuffFromArea(FindPlayerCoors(), 120.0f, true);
|
||||||
CUTSCENE_LOADING_AUDIO,
|
|
||||||
CUTSCENE_LOADING_2,
|
|
||||||
CUTSCENE_LOADING_3,
|
|
||||||
CUTSCENE_LOADING_4
|
|
||||||
};
|
|
||||||
|
|
||||||
switch (ms_cutsceneLoadStatus) {
|
|
||||||
case CUTSCENE_LOADING_AUDIO:
|
|
||||||
SetupCutsceneToStart();
|
|
||||||
if (CGeneral::faststricmp(ms_cutsceneName, "finale"))
|
|
||||||
DMAudio.PlayPreloadedCutSceneMusic();
|
|
||||||
ms_cutsceneLoadStatus++;
|
|
||||||
break;
|
|
||||||
case CUTSCENE_LOADING_2:
|
|
||||||
case CUTSCENE_LOADING_3:
|
|
||||||
ms_cutsceneLoadStatus++;
|
|
||||||
break;
|
|
||||||
case CUTSCENE_LOADING_4:
|
|
||||||
ms_cutsceneLoadStatus = CUTSCENE_LOADING_0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ms_running) return;
|
|
||||||
|
|
||||||
ms_cutsceneTimer += CTimer::GetTimeStepNonClippedInSeconds();
|
|
||||||
|
|
||||||
for (int i = 0; i < ms_numCutsceneObjs; i++) {
|
|
||||||
int modelId = ms_pCutsceneObjects[i]->GetModelIndex();
|
|
||||||
if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ05)
|
|
||||||
UpdateCutsceneObjectBoundingBox(ms_pCutsceneObjects[i]->GetClump(), modelId);
|
|
||||||
|
|
||||||
if (ms_pCutsceneObjects[i]->m_pAttachTo != nil && modelId >= MI_SPECIAL01 && modelId <= MI_SPECIAL21)
|
|
||||||
UpdateCutsceneObjectBoundingBox(ms_pCutsceneObjects[i]->GetClump(), modelId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bCamLoaded)
|
|
||||||
if (CGeneral::faststricmp(ms_cutsceneName, "finale") && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FLYBY && ms_cutsceneLoadStatus == CUTSCENE_LOADING_0) {
|
|
||||||
if (CPad::GetPad(0)->GetCrossJustDown()
|
|
||||||
|| (CGame::playingIntro && CPad::GetPad(0)->GetStartJustDown())
|
|
||||||
|| CPad::GetPad(0)->GetLeftMouseJustDown()
|
|
||||||
|| CPad::GetPad(0)->GetEnterJustDown()
|
|
||||||
|| CPad::GetPad(0)->GetCharJustDown(' '))
|
|
||||||
FinishCutscene();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CCutsceneMgr::HasCutsceneFinished(void) { return !bCamLoaded || TheCamera.GetPositionAlongSpline() == 1.0f; }
|
|
||||||
|
|
||||||
void
|
|
||||||
CCutsceneMgr::LoadAnimationUncompressed(char const* name)
|
|
||||||
{
|
|
||||||
strcpy(uncompressedAnims[numUncompressedAnims], name);
|
|
||||||
|
|
||||||
// Because that's how CAnimManager knows the end of array
|
|
||||||
++numUncompressedAnims;
|
|
||||||
assert(numUncompressedAnims < ARRAY_SIZE(uncompressedAnims));
|
|
||||||
uncompressedAnims[numUncompressedAnims][0] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CCutsceneMgr::AttachObjectToParent(CObject *pObject, CEntity *pAttachTo)
|
|
||||||
{
|
|
||||||
((CCutsceneObject*)pObject)->m_pAttachmentObject = nil;
|
|
||||||
((CCutsceneObject*)pObject)->m_pAttachTo = RpClumpGetFrame(pAttachTo->GetClump());
|
|
||||||
|
|
||||||
debug("Attach %s to %s\n", CModelInfo::GetModelInfo(pObject->GetModelIndex())->GetModelName(), CModelInfo::GetModelInfo(pAttachTo->GetModelIndex())->GetModelName());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CCutsceneMgr::AttachObjectToFrame(CObject *pObject, CEntity *pAttachTo, const char *frame)
|
|
||||||
{
|
|
||||||
((CCutsceneObject*)pObject)->m_pAttachmentObject = nil;
|
|
||||||
((CCutsceneObject*)pObject)->m_pAttachTo = RpAnimBlendClumpFindFrame(pAttachTo->GetClump(), frame)->frame;
|
|
||||||
debug("Attach %s to component %s of %s\n",
|
|
||||||
CModelInfo::GetModelInfo(pObject->GetModelIndex())->GetModelName(),
|
|
||||||
frame,
|
|
||||||
CModelInfo::GetModelInfo(pAttachTo->GetModelIndex())->GetModelName());
|
|
||||||
if (RwObjectGetType(pObject->m_rwObject) == rpCLUMP) {
|
|
||||||
RpClump *clump = (RpClump*)pObject->m_rwObject;
|
|
||||||
if (IsClumpSkinned(clump))
|
|
||||||
RpAtomicGetBoundingSphere(GetFirstAtomic(clump))->radius *= 1.1f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CCutsceneMgr::AttachObjectToBone(CObject *pObject, CObject *pAttachTo, int bone)
|
|
||||||
{
|
|
||||||
RpHAnimHierarchy *hanim = GetAnimHierarchyFromSkinClump(pAttachTo->GetClump());
|
|
||||||
RwInt32 id = RpHAnimIDGetIndex(hanim, bone);
|
|
||||||
RwMatrix *matrixArray = RpHAnimHierarchyGetMatrixArray(hanim);
|
|
||||||
((CCutsceneObject*)pObject)->m_pAttachmentObject = pAttachTo;
|
|
||||||
((CCutsceneObject*)pObject)->m_pAttachTo = &matrixArray[id];
|
|
||||||
debug("Attach %s to %s\n",
|
|
||||||
CModelInfo::GetModelInfo(pObject->GetModelIndex())->GetModelName(),
|
|
||||||
CModelInfo::GetModelInfo(pAttachTo->GetModelIndex())->GetModelName());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver()
|
|
||||||
{
|
|
||||||
CStreaming::ms_disableStreaming = true;
|
|
||||||
CColStore::RemoveAllCollision();
|
CColStore::RemoveAllCollision();
|
||||||
CWorld::bProcessCutsceneOnly = true;
|
CWorld::bProcessCutsceneOnly = true;
|
||||||
ms_cutsceneProcessing = true;
|
/*ms_cutsceneProcessing = true;
|
||||||
|
|
||||||
for (int i = CPools::GetPedPool()->GetSize() - 1; i >= 0; i--) {
|
for (int i = CPools::GetPedPool()->GetSize() - 1; i >= 0; i--) {
|
||||||
CPed *pPed = CPools::GetPedPool()->GetSlot(i);
|
CPed *pPed = CPools::GetPedPool()->GetSlot(i);
|
||||||
|
@ -628,25 +122,21 @@ CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CWorld::bProcessCutsceneOnly = true;
|
||||||
bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver = true;
|
//bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver = true;*/
|
||||||
CStreaming::RemoveCurrentZonesModels();
|
CStreaming::RemoveCurrentZonesModels();
|
||||||
|
while (CStreaming::RemoveLoadedVehicle());
|
||||||
|
CRadar::RemoveRadarSections();
|
||||||
CStreaming::SetModelIsDeletable(MI_MALE01);
|
CStreaming::SetModelIsDeletable(MI_MALE01);
|
||||||
CStreaming::SetModelTxdIsDeletable(MI_MALE01);
|
CStreaming::SetModelTxdIsDeletable(MI_MALE01);
|
||||||
CStreaming::SetModelIsDeletable(MI_TAXI_D);
|
CStreaming::SetModelIsDeletable(MI_COLT45);
|
||||||
CStreaming::SetModelTxdIsDeletable(MI_TAXI_D);
|
CStreaming::SetModelTxdIsDeletable(MI_COLT45);
|
||||||
CStreaming::SetModelIsDeletable(MI_NIGHTSTICK);
|
CStreaming::SetModelIsDeletable(MI_NIGHTSTICK);
|
||||||
CStreaming::SetModelTxdIsDeletable(MI_NIGHTSTICK);
|
CStreaming::SetModelTxdIsDeletable(MI_NIGHTSTICK);
|
||||||
CStreaming::SetModelIsDeletable(MI_MISSILE);
|
CStreaming::SetModelIsDeletable(MI_MISSILE);
|
||||||
CStreaming::SetModelTxdIsDeletable(MI_MISSILE);
|
CStreaming::SetModelTxdIsDeletable(MI_MISSILE);
|
||||||
CStreaming::SetModelIsDeletable(MI_POLICE);
|
|
||||||
CStreaming::SetModelTxdIsDeletable(MI_POLICE);
|
|
||||||
|
|
||||||
while (CStreaming::RemoveLoadedVehicle()) ;
|
/*for (int i = CPools::GetDummyPool()->GetSize() - 1; i >= 0; i--) {
|
||||||
|
|
||||||
CRadar::RemoveRadarSections();
|
|
||||||
|
|
||||||
for (int i = CPools::GetDummyPool()->GetSize() - 1; i >= 0; i--) {
|
|
||||||
CDummy* pDummy = CPools::GetDummyPool()->GetSlot(i);
|
CDummy* pDummy = CPools::GetDummyPool()->GetSlot(i);
|
||||||
if (pDummy)
|
if (pDummy)
|
||||||
pDummy->DeleteRwObject();
|
pDummy->DeleteRwObject();
|
||||||
|
@ -666,7 +156,7 @@ CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver()
|
||||||
if (!pBuilding->bImBeingRendered)
|
if (!pBuilding->bImBeingRendered)
|
||||||
pBuilding->DeleteRwObject();
|
pBuilding->DeleteRwObject();
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
CPlayerPed *pPlayerPed = FindPlayerPed();
|
CPlayerPed *pPlayerPed = FindPlayerPed();
|
||||||
pPlayerPed->RemoveWeaponAnims(0, -1000.0f);
|
pPlayerPed->RemoveWeaponAnims(0, -1000.0f);
|
||||||
|
@ -681,5 +171,69 @@ CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver()
|
||||||
}
|
}
|
||||||
|
|
||||||
pPlayerPed->ClearWeapons();
|
pPlayerPed->ClearWeapons();
|
||||||
CGame::DrasticTidyUpMemory(true);
|
bModelsRemovedForCutscene = true;
|
||||||
|
//CGame::DrasticTidyUpMemory(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CCutsceneMgr::LoadEverythingBecauseCutsceneDeletedAllOfIt()
|
||||||
|
{
|
||||||
|
bModelsRemovedForCutscene = false;
|
||||||
|
CStreaming::LoadInitialPeds();
|
||||||
|
CStreaming::LoadInitialWeapons();
|
||||||
|
//CStreaming::LoadInitialVehicles();
|
||||||
|
|
||||||
|
CPlayerPed *pPlayerPed = FindPlayerPed();
|
||||||
|
for (int i = 0; i < NumberOfSavedWeapons; i++) {
|
||||||
|
int32 weaponModelId = CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModelId;
|
||||||
|
uint8 flags = CStreaming::ms_aInfoForModel[weaponModelId].m_flags;
|
||||||
|
CStreaming::RequestModel(weaponModelId, STREAMFLAGS_DONT_REMOVE);
|
||||||
|
CStreaming::LoadAllRequestedModels(false);
|
||||||
|
if (CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModel2Id != -1) {
|
||||||
|
CStreaming::RequestModel(CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModel2Id, 0);
|
||||||
|
CStreaming::LoadAllRequestedModels(false);
|
||||||
|
}
|
||||||
|
if (!(flags & STREAMFLAGS_DONT_REMOVE))
|
||||||
|
CStreaming::SetModelIsDeletable(weaponModelId);
|
||||||
|
pPlayerPed->GiveWeapon(SavedWeaponIDs[i], SavedWeaponAmmo[i], true);
|
||||||
|
}
|
||||||
|
NumberOfSavedWeapons = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CCutsceneMgr::Update(void)
|
||||||
|
{
|
||||||
|
if (ms_cutsceneLoadStatus != CUTSCENE_NOT_LOADED)
|
||||||
|
Update_overlay();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CCutsceneMgr::LoadAnimationUncompressed(char const* name)
|
||||||
|
{
|
||||||
|
strcpy(ms_aUncompressedCutsceneAnims[ms_numUncompressedCutsceneAnims], name);
|
||||||
|
|
||||||
|
// Because that's how CAnimManager knows the end of array
|
||||||
|
++ms_numUncompressedCutsceneAnims;
|
||||||
|
assert(ms_numUncompressedCutsceneAnims < ARRAY_SIZE(ms_aUncompressedCutsceneAnims));
|
||||||
|
ms_aUncompressedCutsceneAnims[ms_numUncompressedCutsceneAnims][0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
CCutsceneMgr::IsCutsceneSkipButtonBeingPressed()
|
||||||
|
{
|
||||||
|
return (CPad::GetPad(0)->GetCrossJustDown()
|
||||||
|
|| CPad::GetPad(0)->GetLeftMouseJustDown()
|
||||||
|
|| CPad::GetPad(0)->GetEnterJustDown()
|
||||||
|
|| CPad::GetPad(0)->GetCharJustDown(' '));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CCutsceneMgr::AppendToNextCutscene(const char *object, const char *anim)
|
||||||
|
{
|
||||||
|
strcpy(ms_cAppendObjectName[ms_numAppendObjectNames], object);
|
||||||
|
strlwr(ms_cAppendObjectName[ms_numAppendObjectNames]);
|
||||||
|
strcpy(ms_cAppendAnimName[ms_numAppendObjectNames], anim);
|
||||||
|
strlwr(ms_cAppendAnimName[ms_numAppendObjectNames]);
|
||||||
|
ms_numAppendObjectNames++;
|
||||||
}
|
}
|
|
@ -1,14 +1,69 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "CutsceneObject.h"
|
#include "CutsceneObject.h"
|
||||||
|
|
||||||
#define CUTSCENENAMESIZE 8
|
|
||||||
|
|
||||||
class CDirectory;
|
class CDirectory;
|
||||||
class CAnimBlendAssocGroup;
|
class CAnimBlendAssocGroup;
|
||||||
class CCutsceneHead;
|
class CCutsceneHead;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
CUTSCENE_NOT_LOADED = 0,
|
||||||
|
CUTSCENE_LOADING,
|
||||||
|
CUTSCENE_LOADED,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
CUTSCENE_PLAYING_0 = 0,
|
||||||
|
CUTSCENE_STARTED,
|
||||||
|
CUTSCENE_PLAYING_2,
|
||||||
|
CUTSCENE_PLAYING_3,
|
||||||
|
CUTSCENE_PLAYING_4,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
NAMELENGTH = 32,
|
||||||
|
NUM_CUTS_PARTICLE_EFFECTS = 8,
|
||||||
|
NUM_CUTS_MAX_TEXTS = 64,
|
||||||
|
NUM_CUTS_UNCOMPRESSED_ANIMS = 8,
|
||||||
|
TEXT_KEY_SIZE = 8,
|
||||||
|
CUTSCENENAMESIZE = 8
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sToHideItem
|
||||||
|
{
|
||||||
|
float x, y, z;
|
||||||
|
char name[NAMELENGTH];
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO: figure out from SA
|
||||||
|
// this is unused in LCS anyway
|
||||||
|
struct sParticleEffect
|
||||||
|
{
|
||||||
|
char name[NAMELENGTH];
|
||||||
|
bool bPlayed; // ??
|
||||||
|
int iTime;
|
||||||
|
int unk1;
|
||||||
|
int unk2;
|
||||||
|
char name2[NAMELENGTH];
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float z;
|
||||||
|
float unkX;
|
||||||
|
float unkY;
|
||||||
|
float unkZ;
|
||||||
|
bool unk10;
|
||||||
|
bool unk11;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sAttachInfo
|
||||||
|
{
|
||||||
|
int attachToId, objectId, boneId;
|
||||||
|
};
|
||||||
|
|
||||||
class CCutsceneMgr
|
class CCutsceneMgr
|
||||||
{
|
{
|
||||||
|
|
||||||
static bool ms_running;
|
static bool ms_running;
|
||||||
static CCutsceneObject *ms_pCutsceneObjects[NUMCUTSCENEOBJECTS];
|
static CCutsceneObject *ms_pCutsceneObjects[NUMCUTSCENEOBJECTS];
|
||||||
|
|
||||||
|
@ -24,10 +79,55 @@ class CCutsceneMgr
|
||||||
static bool ms_wasCutsceneSkipped;
|
static bool ms_wasCutsceneSkipped;
|
||||||
static bool ms_cutsceneProcessing;
|
static bool ms_cutsceneProcessing;
|
||||||
static bool ms_useCutsceneShadows;
|
static bool ms_useCutsceneShadows;
|
||||||
|
static bool ms_hasFileInfo;
|
||||||
|
static int ms_numLoadObjectNames;
|
||||||
|
|
||||||
|
static char ms_cAppendAnimName[NUMCUTSCENEOBJECTS][NAMELENGTH];
|
||||||
|
static char ms_cAppendObjectName[NUMCUTSCENEOBJECTS][NAMELENGTH];
|
||||||
|
static int ms_numAppendObjectNames;
|
||||||
public:
|
public:
|
||||||
static CDirectory *ms_pCutsceneDir;
|
static CDirectory *ms_pCutsceneDir;
|
||||||
static uint32 ms_cutsceneLoadStatus;
|
static uint32 ms_cutsceneLoadStatus;
|
||||||
|
|
||||||
|
static bool mCutsceneSkipFading;
|
||||||
|
static int mCutsceneSkipFadeTime;
|
||||||
|
|
||||||
|
static float m_fPrevCarDensity;
|
||||||
|
static float m_fPrevPedDensity;
|
||||||
|
|
||||||
|
static bool m_PrevExtraColourOn;
|
||||||
|
static uint32 m_PrevExtraColour;
|
||||||
|
|
||||||
|
static uint32 ms_iNumParticleEffects;
|
||||||
|
static sParticleEffect ms_pParticleEffects[NUM_CUTS_PARTICLE_EFFECTS];
|
||||||
|
|
||||||
|
static sToHideItem ms_crToHideItems[NUMCUTSCENEOBJECTS];
|
||||||
|
static uint32 ms_iNumHiddenEntities;
|
||||||
|
static CEntity *ms_pHiddenEntities[NUMCUTSCENEOBJECTS];
|
||||||
|
|
||||||
|
static int ms_numAttachObjectToBones;
|
||||||
|
static bool ms_bRepeatObject[NUMCUTSCENEOBJECTS];
|
||||||
|
|
||||||
|
static sAttachInfo ms_iAttachObjectToBone[NUMCUTSCENEOBJECTS];
|
||||||
|
|
||||||
|
static uint32 ms_numUncompressedCutsceneAnims;
|
||||||
|
|
||||||
|
static char ms_aUncompressedCutsceneAnims[NUM_CUTS_UNCOMPRESSED_ANIMS][NAMELENGTH];
|
||||||
|
|
||||||
|
static uint32 ms_iTextDuration[NUM_CUTS_MAX_TEXTS];
|
||||||
|
static uint32 ms_iTextStartTime[NUM_CUTS_MAX_TEXTS];
|
||||||
|
static char ms_cTextOutput[NUM_CUTS_MAX_TEXTS][TEXT_KEY_SIZE];
|
||||||
|
|
||||||
|
static uint32 ms_currTextOutput;
|
||||||
|
static uint32 ms_numTextOutput;
|
||||||
|
static uint32 ms_iModelIndex[NUMCUTSCENEOBJECTS];
|
||||||
|
|
||||||
|
static char ms_cLoadAnimName[NUMCUTSCENEOBJECTS][NAMELENGTH];
|
||||||
|
static char ms_cLoadObjectName[NUMCUTSCENEOBJECTS][NAMELENGTH];
|
||||||
|
|
||||||
|
static uint32 ms_cutscenePlayStatus;
|
||||||
|
|
||||||
|
static void StartCutscene();
|
||||||
static void StartCutsceneProcessing() { ms_cutsceneProcessing = true; }
|
static void StartCutsceneProcessing() { ms_cutsceneProcessing = true; }
|
||||||
static bool IsRunning(void) { return ms_running; }
|
static bool IsRunning(void) { return ms_running; }
|
||||||
static bool HasLoaded(void) { return ms_loaded; }
|
static bool HasLoaded(void) { return ms_loaded; }
|
||||||
|
@ -35,19 +135,19 @@ public:
|
||||||
static bool WasCutsceneSkipped(void) { return ms_wasCutsceneSkipped; }
|
static bool WasCutsceneSkipped(void) { return ms_wasCutsceneSkipped; }
|
||||||
static bool UseLodMultiplier(void) { return ms_useLodMultiplier; }
|
static bool UseLodMultiplier(void) { return ms_useLodMultiplier; }
|
||||||
static CCutsceneObject* GetCutsceneObject(int id) { return ms_pCutsceneObjects[id]; }
|
static CCutsceneObject* GetCutsceneObject(int id) { return ms_pCutsceneObjects[id]; }
|
||||||
static int GetCutsceneTimeInMilleseconds(void) { return 1000.0f * ms_cutsceneTimer; }
|
static uint32 GetCutsceneTimeInMilleseconds(void);
|
||||||
static char *GetCutsceneName(void) { return ms_cutsceneName; }
|
static char *GetCutsceneName(void) { return ms_cutsceneName; }
|
||||||
static void SetCutsceneOffset(const CVector& vec) { ms_cutsceneOffset = vec; }
|
static void SetCutsceneOffset(const CVector& vec) { ms_cutsceneOffset = vec; }
|
||||||
static bool HasCutsceneFinished(void);
|
static bool HasCutsceneFinished(void);
|
||||||
|
|
||||||
static void Initialise(void);
|
static void Initialise(void *dir = nil);
|
||||||
static void Shutdown(void);
|
static void Shutdown(void);
|
||||||
static void LoadCutsceneData(const char *szCutsceneName);
|
static void LoadCutsceneData(const char *szCutsceneName);
|
||||||
static void FinishCutscene(void);
|
static void FinishCutscene(void);
|
||||||
static void SetupCutsceneToStart(void);
|
static void SetupCutsceneToStart(void);
|
||||||
static void SetCutsceneAnim(const char *animName, CObject *pObject);
|
static void SetCutsceneAnim(const char *animName, CObject *pObject);
|
||||||
static void SetCutsceneAnimToLoop(const char *animName);
|
static void SetCutsceneAnimToLoop(const char *animName);
|
||||||
static CCutsceneHead *AddCutsceneHead(CObject *pObject, int modelId);
|
static CCutsceneHead *SetHeadAnim(const char*, CObject *pObject);
|
||||||
static CCutsceneObject *CreateCutsceneObject(int modelId);
|
static CCutsceneObject *CreateCutsceneObject(int modelId);
|
||||||
static void DeleteCutsceneData(void);
|
static void DeleteCutsceneData(void);
|
||||||
static void LoadAnimationUncompressed(char const*);
|
static void LoadAnimationUncompressed(char const*);
|
||||||
|
@ -56,6 +156,24 @@ public:
|
||||||
static void AttachObjectToParent(CObject *pObject, CEntity *pAttachTo);
|
static void AttachObjectToParent(CObject *pObject, CEntity *pAttachTo);
|
||||||
static void AttachObjectToFrame(CObject *pObject, CEntity *pAttachTo, const char *frame);
|
static void AttachObjectToFrame(CObject *pObject, CEntity *pAttachTo, const char *frame);
|
||||||
static void AttachObjectToBone(CObject *pObject, CObject *pAttachTo, int frame);
|
static void AttachObjectToBone(CObject *pObject, CObject *pAttachTo, int frame);
|
||||||
static void RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver();
|
static void RemoveEverythingBecauseCutsceneDoesntFitInMemory();
|
||||||
|
static void LoadEverythingBecauseCutsceneDeletedAllOfIt();
|
||||||
static void DisableCutsceneShadows() { ms_useCutsceneShadows = false; }
|
static void DisableCutsceneShadows() { ms_useCutsceneShadows = false; }
|
||||||
|
|
||||||
|
|
||||||
|
static void LoadCutsceneData_overlay(const char* szCutsceneName);
|
||||||
|
static bool LoadCutsceneData_postload(bool b = false);
|
||||||
|
static void Update_overlay(void);
|
||||||
|
static void DeleteCutsceneData_overlay(void);
|
||||||
|
|
||||||
|
static bool IsCutsceneSkipButtonBeingPressed();
|
||||||
|
static void AppendToNextCutscene(const char *object, const char *anim);
|
||||||
|
|
||||||
|
static void LoadCutsceneData_preload();
|
||||||
|
static void LoadCutsceneData_loading();
|
||||||
|
static void HideRequestedObjects();
|
||||||
|
|
||||||
|
static bool PresubBodge();
|
||||||
|
|
||||||
|
static void Write(base::cRelocatableChunkWriter& writer);
|
||||||
};
|
};
|
||||||
|
|
1030
src/animation/CutsceneMgr_overlay.cpp
Normal file
1030
src/animation/CutsceneMgr_overlay.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
@ -9407,7 +9407,7 @@ struct MissionAudioData {
|
||||||
|
|
||||||
|
|
||||||
const MissionAudioData MissionAudioNameSfxAssoc[] = {
|
const MissionAudioData MissionAudioNameSfxAssoc[] = {
|
||||||
{"mobring", STREAMED_SOUND_MISSION_MOBR1}, {"pagring", STREAMED_SOUND_MISSION_PAGER}, {"carrev", STREAMED_SOUND_MISSION_CARREV},
|
/*{"mobring", STREAMED_SOUND_MISSION_MOBR1}, {"pagring", STREAMED_SOUND_MISSION_PAGER}, {"carrev", STREAMED_SOUND_MISSION_CARREV},
|
||||||
{"bikerev", STREAMED_SOUND_MISSION_BIKEREV}, {"liftop", STREAMED_SOUND_MISSION_LIFTOP}, {"liftcl", STREAMED_SOUND_MISSION_LIFTCL},
|
{"bikerev", STREAMED_SOUND_MISSION_BIKEREV}, {"liftop", STREAMED_SOUND_MISSION_LIFTOP}, {"liftcl", STREAMED_SOUND_MISSION_LIFTCL},
|
||||||
{"liftrun", STREAMED_SOUND_MISSION_LIFTRUN}, {"liftbel", STREAMED_SOUND_MISSION_LIFTBEL}, {"inlift", STREAMED_SOUND_MISSION_INLIFT},
|
{"liftrun", STREAMED_SOUND_MISSION_LIFTRUN}, {"liftbel", STREAMED_SOUND_MISSION_LIFTBEL}, {"inlift", STREAMED_SOUND_MISSION_INLIFT},
|
||||||
{"caml", STREAMED_SOUND_MISSION_CAMERAL}, {"camr", STREAMED_SOUND_MISSION_CAMERAR}, {"cheer1", STREAMED_SOUND_MISSION_CHEER1},
|
{"caml", STREAMED_SOUND_MISSION_CAMERAL}, {"camr", STREAMED_SOUND_MISSION_CAMERAR}, {"cheer1", STREAMED_SOUND_MISSION_CHEER1},
|
||||||
|
@ -9780,7 +9780,7 @@ const MissionAudioData MissionAudioNameSfxAssoc[] = {
|
||||||
{"bust_18", STREAMED_SOUND_MISSION_BUST_18}, {"bust_19", STREAMED_SOUND_MISSION_BUST_19}, {"bust_20", STREAMED_SOUND_MISSION_BUST_20},
|
{"bust_18", STREAMED_SOUND_MISSION_BUST_18}, {"bust_19", STREAMED_SOUND_MISSION_BUST_19}, {"bust_20", STREAMED_SOUND_MISSION_BUST_20},
|
||||||
{"bust_21", STREAMED_SOUND_MISSION_BUST_21}, {"bust_22", STREAMED_SOUND_MISSION_BUST_22}, {"bust_23", STREAMED_SOUND_MISSION_BUST_23},
|
{"bust_21", STREAMED_SOUND_MISSION_BUST_21}, {"bust_22", STREAMED_SOUND_MISSION_BUST_22}, {"bust_23", STREAMED_SOUND_MISSION_BUST_23},
|
||||||
{"bust_24", STREAMED_SOUND_MISSION_BUST_24}, {"bust_25", STREAMED_SOUND_MISSION_BUST_25}, {"bust_26", STREAMED_SOUND_MISSION_BUST_26},
|
{"bust_24", STREAMED_SOUND_MISSION_BUST_24}, {"bust_25", STREAMED_SOUND_MISSION_BUST_25}, {"bust_26", STREAMED_SOUND_MISSION_BUST_26},
|
||||||
{"bust_27", STREAMED_SOUND_MISSION_BUST_27}, {"bust_28", STREAMED_SOUND_MISSION_BUST_28}, {nil, 0} };
|
{"bust_27", STREAMED_SOUND_MISSION_BUST_27}, {"bust_28", STREAMED_SOUND_MISSION_BUST_28}, */ {nil, 0} };
|
||||||
|
|
||||||
int32
|
int32
|
||||||
FindMissionAudioSfx(const char *name)
|
FindMissionAudioSfx(const char *name)
|
||||||
|
@ -9847,8 +9847,8 @@ cAudioManager::PlayLoadedMissionAudio(uint8 slot)
|
||||||
bool
|
bool
|
||||||
cAudioManager::ShouldDuckMissionAudio(uint8 slot) const
|
cAudioManager::ShouldDuckMissionAudio(uint8 slot) const
|
||||||
{
|
{
|
||||||
if (IsMissionAudioSamplePlaying(slot))
|
//if (IsMissionAudioSamplePlaying(slot))
|
||||||
return m_sMissionAudio.m_nSampleIndex[slot] != STREAMED_SOUND_MISSION_ROK2_01;
|
// return m_sMissionAudio.m_nSampleIndex[slot] != STREAMED_SOUND_MISSION_ROK2_01;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9947,11 +9947,11 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
|
||||||
if (m_nUserPause)
|
if (m_nUserPause)
|
||||||
SampleManager.PauseStream(1, slot + 1);
|
SampleManager.PauseStream(1, slot + 1);
|
||||||
if (m_sMissionAudio.m_bPredefinedProperties[slot]) {
|
if (m_sMissionAudio.m_bPredefinedProperties[slot]) {
|
||||||
if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAL)
|
//if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAL)
|
||||||
SampleManager.SetStreamedVolumeAndPan(80, 0, 1, slot + 1);
|
// SampleManager.SetStreamedVolumeAndPan(80, 0, 1, slot + 1);
|
||||||
else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAR)
|
//else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAR)
|
||||||
SampleManager.SetStreamedVolumeAndPan(80, 127, 1, slot + 1);
|
// SampleManager.SetStreamedVolumeAndPan(80, 127, 1, slot + 1);
|
||||||
else
|
//else
|
||||||
SampleManager.SetStreamedVolumeAndPan(80, 63, 1, slot + 1);
|
SampleManager.SetStreamedVolumeAndPan(80, 63, 1, slot + 1);
|
||||||
} else {
|
} else {
|
||||||
distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]);
|
distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]);
|
||||||
|
@ -9973,8 +9973,8 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
|
||||||
}
|
}
|
||||||
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_PLAYING;
|
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_PLAYING;
|
||||||
nCheckPlayingDelay[slot] = 30;
|
nCheckPlayingDelay[slot] = 30;
|
||||||
if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A)
|
//if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A)
|
||||||
m_sMissionAudio.m_bIsMobile[slot] = true;
|
// m_sMissionAudio.m_bIsMobile[slot] = true;
|
||||||
break;
|
break;
|
||||||
case PLAY_STATUS_PLAYING:
|
case PLAY_STATUS_PLAYING:
|
||||||
if (m_bTimerJustReset) {
|
if (m_bTimerJustReset) {
|
||||||
|
@ -10017,12 +10017,12 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
|
||||||
SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1);
|
SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_ROK2_01) {
|
//} else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_ROK2_01) {
|
||||||
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED;
|
// m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED;
|
||||||
} else {
|
} else {
|
||||||
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED;
|
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED;
|
||||||
if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A)
|
//if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A)
|
||||||
m_sMissionAudio.m_bIsMobile[slot] = false;
|
// m_sMissionAudio.m_bIsMobile[slot] = false;
|
||||||
m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE;
|
m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE;
|
||||||
SampleManager.StopStreamedFile(slot + 1);
|
SampleManager.StopStreamedFile(slot + 1);
|
||||||
m_sMissionAudio.m_nMissionAudioCounter[slot] = 0;
|
m_sMissionAudio.m_nMissionAudioCounter[slot] = 0;
|
||||||
|
|
|
@ -160,8 +160,8 @@ cMusicManager::SetStartingTrackPositions(uint8 isNewGameTimer)
|
||||||
|
|
||||||
if (i < STREAMED_SOUND_CITY_AMBIENT && isNewGameTimer)
|
if (i < STREAMED_SOUND_CITY_AMBIENT && isNewGameTimer)
|
||||||
m_aTracks[i].m_nPosition = NewGameRadioTimers[i];
|
m_aTracks[i].m_nPosition = NewGameRadioTimers[i];
|
||||||
else if (i < STREAMED_SOUND_ANNOUNCE_BRIDGE_CLOSED)
|
//else if (i < STREAMED_SOUND_ANNOUNCE_BRIDGE_CLOSED)
|
||||||
m_aTracks[i].m_nPosition = (pos * AudioManager.GetRandomNumber(i % 5)) % m_aTracks[i].m_nLength;
|
// m_aTracks[i].m_nPosition = (pos * AudioManager.GetRandomNumber(i % 5)) % m_aTracks[i].m_nLength;
|
||||||
else
|
else
|
||||||
m_aTracks[i].m_nPosition = 0;
|
m_aTracks[i].m_nPosition = 0;
|
||||||
|
|
||||||
|
@ -658,7 +658,7 @@ cMusicManager::ServiceGameMode()
|
||||||
}
|
}
|
||||||
if (vehicle == nil)
|
if (vehicle == nil)
|
||||||
{
|
{
|
||||||
m_nFrontendTrack = STREAMED_SOUND_RADIO_WAVE; // huh?
|
m_nFrontendTrack = STREAMED_SOUND_RADIO_LCFR; // huh?
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_bRadioSetByScript)
|
if (m_bRadioSetByScript)
|
||||||
|
@ -712,7 +712,7 @@ cMusicManager::SetUpCorrectAmbienceTrack()
|
||||||
else if (TheCamera.DistanceToWater <= 90.0f) {
|
else if (TheCamera.DistanceToWater <= 90.0f) {
|
||||||
if (CCullZones::bAtBeachForAudio) {
|
if (CCullZones::bAtBeachForAudio) {
|
||||||
if (CWeather::OldWeatherType != WEATHER_HURRICANE && CWeather::NewWeatherType != WEATHER_HURRICANE || CWeather::Wind <= 1.0f)
|
if (CWeather::OldWeatherType != WEATHER_HURRICANE && CWeather::NewWeatherType != WEATHER_HURRICANE || CWeather::Wind <= 1.0f)
|
||||||
m_nFrontendTrack = STREAMED_SOUND_BEACH_AMBIENT;
|
m_nFrontendTrack = STREAMED_SOUND_SAWMILL;
|
||||||
else
|
else
|
||||||
m_nFrontendTrack = STREAMED_SOUND_HAVANA_BEACH_AMBIENT;
|
m_nFrontendTrack = STREAMED_SOUND_HAVANA_BEACH_AMBIENT;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
1283
src/audio/sampman.h
1283
src/audio/sampman.h
File diff suppressed because it is too large
Load diff
|
@ -1057,7 +1057,7 @@ cSampleManager::Initialise(void)
|
||||||
m_szCDRomRootPath[0] = '\0';
|
m_szCDRomRootPath[0] = '\0';
|
||||||
|
|
||||||
strcpy(m_WavFilesPath, m_szCDRomRootPath);
|
strcpy(m_WavFilesPath, m_szCDRomRootPath);
|
||||||
|
/*
|
||||||
#ifdef AUDIO_CACHE
|
#ifdef AUDIO_CACHE
|
||||||
if ( CreateCache )
|
if ( CreateCache )
|
||||||
#endif
|
#endif
|
||||||
|
@ -1084,7 +1084,7 @@ cSampleManager::Initialise(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// Find path of MP3s (originally in CD-Rom)
|
// Find path of MP3s (originally in CD-Rom)
|
||||||
// if NO_CDCHECK is NOT defined but AUDIO_CACHE is defined, we still need to find MP3s' path, but will exit after the first file
|
// if NO_CDCHECK is NOT defined but AUDIO_CACHE is defined, we still need to find MP3s' path, but will exit after the first file
|
||||||
#ifndef NO_CDCHECK
|
#ifndef NO_CDCHECK
|
||||||
|
@ -1102,7 +1102,7 @@ cSampleManager::Initialise(void)
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int32 i = 0; i < STREAMED_SOUND_MISSION_MOBR1; i++)
|
for (int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++)
|
||||||
{
|
{
|
||||||
strcpy(filepath, m_MP3FilesPath);
|
strcpy(filepath, m_MP3FilesPath);
|
||||||
strcat(filepath, StreamedNameTable[i]);
|
strcat(filepath, StreamedNameTable[i]);
|
||||||
|
@ -1143,7 +1143,7 @@ cSampleManager::Initialise(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( !bFileNotFound ) {
|
if ( !bFileNotFound ) {
|
||||||
|
/*
|
||||||
#ifdef AUDIO_CACHE
|
#ifdef AUDIO_CACHE
|
||||||
if ( CreateCache )
|
if ( CreateCache )
|
||||||
#endif
|
#endif
|
||||||
|
@ -1169,7 +1169,7 @@ cSampleManager::Initialise(void)
|
||||||
bFileNotFound = true;
|
bFileNotFound = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bInitialised = !bFileNotFound;
|
m_bInitialised = !bFileNotFound;
|
||||||
|
@ -2046,7 +2046,7 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream)
|
||||||
|
|
||||||
char filepath[MAX_PATH];
|
char filepath[MAX_PATH];
|
||||||
|
|
||||||
strcpy(filepath, nFile < STREAMED_SOUND_MISSION_COMPLETED4 ? m_MP3FilesPath : (nFile < STREAMED_SOUND_MISSION_MOBR1 ? m_MiscomPath : m_WavFilesPath));
|
strcpy(filepath, m_MP3FilesPath);
|
||||||
strcat(filepath, StreamedNameTable[nFile]);
|
strcat(filepath, StreamedNameTable[nFile]);
|
||||||
|
|
||||||
mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);
|
mp3Stream[nStream] = AIL_open_stream(DIG, filepath, 0);
|
||||||
|
|
|
@ -396,7 +396,7 @@ set_new_provider(int index)
|
||||||
static bool
|
static bool
|
||||||
IsThisTrackAt16KHz(uint32 track)
|
IsThisTrackAt16KHz(uint32 track)
|
||||||
{
|
{
|
||||||
return track == STREAMED_SOUND_RADIO_KCHAT || track == STREAMED_SOUND_RADIO_VCPR || track == STREAMED_SOUND_RADIO_POLICE;
|
return false;// track == STREAMED_SOUND_RADIO_KCHAT || track == STREAMED_SOUND_RADIO_VCPR || track == STREAMED_SOUND_RADIO_POLICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
cSampleManager::cSampleManager(void)
|
cSampleManager::cSampleManager(void)
|
||||||
|
|
|
@ -24,7 +24,6 @@ CColModel::CColModel(void)
|
||||||
CColModel::~CColModel(void)
|
CColModel::~CColModel(void)
|
||||||
{
|
{
|
||||||
RemoveCollisionVolumes();
|
RemoveCollisionVolumes();
|
||||||
RemoveTrianglePlanes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void*
|
void*
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
static void RequestCollision(const CVector2D &pos);
|
static void RequestCollision(const CVector2D &pos);
|
||||||
static void EnsureCollisionIsInMemory(const CVector2D &pos);
|
static void EnsureCollisionIsInMemory(const CVector2D &pos);
|
||||||
static bool HasCollisionLoaded(const CVector2D &pos);
|
static bool HasCollisionLoaded(const CVector2D &pos);
|
||||||
|
static bool HasCollisionLoaded(eLevelName level) { return true; }; // TODO
|
||||||
|
|
||||||
static ColDef *GetSlot(int slot) {
|
static ColDef *GetSlot(int slot) {
|
||||||
assert(slot >= 0);
|
assert(slot >= 0);
|
||||||
|
|
|
@ -10,7 +10,7 @@ CColModel CTempColModels::ms_colModelWheel1;
|
||||||
CColModel CTempColModels::ms_colModelPanel1;
|
CColModel CTempColModels::ms_colModelPanel1;
|
||||||
CColModel CTempColModels::ms_colModelBodyPart2;
|
CColModel CTempColModels::ms_colModelBodyPart2;
|
||||||
CColModel CTempColModels::ms_colModelBodyPart1;
|
CColModel CTempColModels::ms_colModelBodyPart1;
|
||||||
CColModel CTempColModels::ms_colModelCutObj[5];
|
CColModel CTempColModels::ms_colModelCutObj[10];
|
||||||
CColModel CTempColModels::ms_colModelPedGroundHit;
|
CColModel CTempColModels::ms_colModelPedGroundHit;
|
||||||
CColModel CTempColModels::ms_colModelBoot1;
|
CColModel CTempColModels::ms_colModelBoot1;
|
||||||
CColModel CTempColModels::ms_colModelDoor1;
|
CColModel CTempColModels::ms_colModelDoor1;
|
||||||
|
|
|
@ -13,7 +13,7 @@ public:
|
||||||
static CColModel ms_colModelPanel1;
|
static CColModel ms_colModelPanel1;
|
||||||
static CColModel ms_colModelBodyPart2;
|
static CColModel ms_colModelBodyPart2;
|
||||||
static CColModel ms_colModelBodyPart1;
|
static CColModel ms_colModelBodyPart1;
|
||||||
static CColModel ms_colModelCutObj[5];
|
static CColModel ms_colModelCutObj[10];
|
||||||
static CColModel ms_colModelPedGroundHit;
|
static CColModel ms_colModelPedGroundHit;
|
||||||
static CColModel ms_colModelBoot1;
|
static CColModel ms_colModelBoot1;
|
||||||
static CColModel ms_colModelDoor1;
|
static CColModel ms_colModelDoor1;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "Accident.h"
|
#include "Accident.h"
|
||||||
#include "AutoPilot.h"
|
#include "AutoPilot.h"
|
||||||
|
#include "Bridge.h"
|
||||||
#include "CarCtrl.h"
|
#include "CarCtrl.h"
|
||||||
#include "General.h"
|
#include "General.h"
|
||||||
#include "HandlingMgr.h"
|
#include "HandlingMgr.h"
|
||||||
|
@ -74,6 +75,18 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
||||||
case STATUS_PLAYER_DISABLED:
|
case STATUS_PLAYER_DISABLED:
|
||||||
break;
|
break;
|
||||||
case STATUS_SIMPLE:
|
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:
|
case STATUS_PHYSICS:
|
||||||
switch (pVehicle->AutoPilot.m_nCarMission) {
|
switch (pVehicle->AutoPilot.m_nCarMission) {
|
||||||
case MISSION_RAMPLAYER_FARAWAY:
|
case MISSION_RAMPLAYER_FARAWAY:
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "Cranes.h"
|
#include "Cranes.h"
|
||||||
#include "Curves.h"
|
#include "Curves.h"
|
||||||
#include "CutsceneMgr.h"
|
#include "CutsceneMgr.h"
|
||||||
|
#include "Frontend.h"
|
||||||
#include "Gangs.h"
|
#include "Gangs.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Garages.h"
|
#include "Garages.h"
|
||||||
|
@ -76,10 +77,11 @@
|
||||||
#define DISTANCE_BETWEEN_CAR_AND_DEAD_PED (6.0f)
|
#define DISTANCE_BETWEEN_CAR_AND_DEAD_PED (6.0f)
|
||||||
#define PROBABILITY_OF_PASSENGER_IN_VEHICLE (0.125f)
|
#define PROBABILITY_OF_PASSENGER_IN_VEHICLE (0.125f)
|
||||||
|
|
||||||
#define ONSCREEN_DESPAWN_RANGE (120.0f)
|
#define ONSCREEN_DESPAWN_RANGE (190.0f)
|
||||||
#define MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN (100.0f)
|
#define MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN (130.0f)
|
||||||
#define REQUEST_ONSCREEN_DISTANCE ((ONSCREEN_DESPAWN_RANGE + MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN) / 2)
|
#define REQUEST_ONSCREEN_DISTANCE (140.0f)
|
||||||
#define OFFSCREEN_DESPAWN_RANGE (40.0f)
|
#define OFFSCREEN_DESPAWN_RANGE (60.0f)
|
||||||
|
#define MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN (40.0f)
|
||||||
#define EXTENDED_RANGE_DESPAWN_MULTIPLIER (1.5f)
|
#define EXTENDED_RANGE_DESPAWN_MULTIPLIER (1.5f)
|
||||||
|
|
||||||
//--MIAMI: file done
|
//--MIAMI: file done
|
||||||
|
@ -95,7 +97,7 @@ int32 CCarCtrl::NumRandomCars;
|
||||||
int32 CCarCtrl::NumParkedCars;
|
int32 CCarCtrl::NumParkedCars;
|
||||||
int32 CCarCtrl::NumPermanentCars;
|
int32 CCarCtrl::NumPermanentCars;
|
||||||
int8 CCarCtrl::CountDownToCarsAtStart;
|
int8 CCarCtrl::CountDownToCarsAtStart;
|
||||||
int32 CCarCtrl::MaxNumberOfCarsInUse = 12;
|
int32 CCarCtrl::MaxNumberOfCarsInUse = 30;
|
||||||
uint32 CCarCtrl::LastTimeLawEnforcerCreated;
|
uint32 CCarCtrl::LastTimeLawEnforcerCreated;
|
||||||
uint32 CCarCtrl::LastTimeFireTruckCreated;
|
uint32 CCarCtrl::LastTimeFireTruckCreated;
|
||||||
uint32 CCarCtrl::LastTimeAmbulanceCreated;
|
uint32 CCarCtrl::LastTimeAmbulanceCreated;
|
||||||
|
@ -161,14 +163,19 @@ CCarCtrl::GenerateOneRandomCar()
|
||||||
carClass = COPS;
|
carClass = COPS;
|
||||||
carModel = ChoosePoliceCarModel();
|
carModel = ChoosePoliceCarModel();
|
||||||
}else{
|
}else{
|
||||||
carModel = ChooseModel(&zone, &carClass);
|
for (int i = 0; i < 5; i++) {
|
||||||
if (carModel == -1 || (carClass == COPS && pWanted->m_nWantedLevel >= 1))
|
carModel = ChooseModel(&zone, &carClass);
|
||||||
/* All cop spawns with wanted level are handled by condition above. */
|
if (carModel == -1)
|
||||||
/* In particular it means that cop cars never spawn if player has wanted level of 1. */
|
return;
|
||||||
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 frontX, frontY;
|
||||||
float preferredDistance, angleLimit;
|
float preferredDistance, angleLimit;
|
||||||
|
float requestMultiplier = 1.0f;
|
||||||
bool invertAngleLimitTest;
|
bool invertAngleLimitTest;
|
||||||
CVector spawnPosition;
|
CVector spawnPosition;
|
||||||
int32 curNodeId, nextNodeId;
|
int32 curNodeId, nextNodeId;
|
||||||
|
@ -188,11 +195,14 @@ CCarCtrl::GenerateOneRandomCar()
|
||||||
angleLimit = -1.0f;
|
angleLimit = -1.0f;
|
||||||
bTopDownCamera = true;
|
bTopDownCamera = true;
|
||||||
invertAngleLimitTest = true;
|
invertAngleLimitTest = true;
|
||||||
preferredDistance = OFFSCREEN_DESPAWN_RANGE + 15.0f;
|
preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN + 15.0f;
|
||||||
/* BUG: testForCollision not initialized in original game. */
|
/* BUG: testForCollision not initialized in original game. */
|
||||||
testForCollision = false;
|
testForCollision = false;
|
||||||
}else if (!pPlayerVehicle){
|
}else if (!pPlayerVehicle){
|
||||||
/* Player is not in vehicle. */
|
/* Player is not in vehicle. */
|
||||||
|
requestMultiplier = 13.0f / 20.0f;
|
||||||
|
if (FrontEndMenuManager.m_PrefsUseWideScreen) // TODO(LCS): static
|
||||||
|
requestMultiplier *= 4.0f / 3.0f;
|
||||||
testForCollision = true;
|
testForCollision = true;
|
||||||
frontX = TheCamera.CamFrontXNorm;
|
frontX = TheCamera.CamFrontXNorm;
|
||||||
frontY = TheCamera.CamFrontYNorm;
|
frontY = TheCamera.CamFrontYNorm;
|
||||||
|
@ -202,95 +212,105 @@ CCarCtrl::GenerateOneRandomCar()
|
||||||
/* Forward to his current direction (camera direction). */
|
/* Forward to his current direction (camera direction). */
|
||||||
angleLimit = 0.707f; /* 45 degrees */
|
angleLimit = 0.707f; /* 45 degrees */
|
||||||
invertAngleLimitTest = true;
|
invertAngleLimitTest = true;
|
||||||
preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier;
|
preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
/* Spawn a vehicle close to player to his side. */
|
/* Spawn a vehicle close to player to his side. */
|
||||||
/* Kinda not within camera angle. */
|
/* Kinda not within camera angle. */
|
||||||
angleLimit = 0.707f; /* 45 degrees */
|
angleLimit = 0.707f; /* 45 degrees */
|
||||||
invertAngleLimitTest = false;
|
invertAngleLimitTest = false;
|
||||||
preferredDistance = OFFSCREEN_DESPAWN_RANGE;
|
preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN;
|
||||||
break;
|
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 */
|
/* Player is moving fast in vehicle */
|
||||||
/* Prefer spawning vehicles very far away from him. */
|
/* Prefer spawning vehicles very far away from him. */
|
||||||
frontX = vecPlayerVehicleSpeed.x / fPlayerVehicleSpeed;
|
frontX = vecPlayerVehicleSpeed.x / fPlayerVehicleSpeed;
|
||||||
frontY = vecPlayerVehicleSpeed.y / fPlayerVehicleSpeed;
|
frontY = vecPlayerVehicleSpeed.y / fPlayerVehicleSpeed;
|
||||||
testForCollision = false;
|
testForCollision = false;
|
||||||
switch (CTimer::GetFrameCounter() & 3) {
|
switch (CTimer::GetFrameCounter() & 3) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
/* Spawn a vehicle in a very narrow gap in front of a player */
|
/* Spawn a vehicle in a very narrow gap in front of a player */
|
||||||
angleLimit = 0.85f; /* approx 30 degrees */
|
angleLimit = 0.85f; /* approx 30 degrees */
|
||||||
invertAngleLimitTest = true;
|
invertAngleLimitTest = true;
|
||||||
preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier;
|
preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
/* Spawn a vehicle relatively far away from player. */
|
/* Spawn a vehicle relatively far away from player. */
|
||||||
/* Forward to his current direction (camera direction). */
|
/* Forward to his current direction (camera direction). */
|
||||||
angleLimit = 0.707f; /* 45 degrees */
|
angleLimit = 0.707f; /* 45 degrees */
|
||||||
invertAngleLimitTest = true;
|
invertAngleLimitTest = true;
|
||||||
preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier;
|
preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
/* Spawn a vehicle close to player to his side. */
|
/* Spawn a vehicle close to player to his side. */
|
||||||
/* Kinda not within camera angle. */
|
/* Kinda not within camera angle. */
|
||||||
angleLimit = 0.707f; /* 45 degrees */
|
angleLimit = 0.707f; /* 45 degrees */
|
||||||
invertAngleLimitTest = false;
|
invertAngleLimitTest = false;
|
||||||
preferredDistance = OFFSCREEN_DESPAWN_RANGE;
|
preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else if (fPlayerVehicleSpeed > 0.1f){ /* 18 km/h */
|
else if (fPlayerVehicleSpeed > 0.1f) { /* 18 km/h */
|
||||||
/* Player is moving moderately fast in vehicle */
|
/* Player is moving moderately fast in vehicle */
|
||||||
/* Spawn more vehicles to player's side. */
|
/* Spawn more vehicles to player's side. */
|
||||||
frontX = vecPlayerVehicleSpeed.x / fPlayerVehicleSpeed;
|
frontX = vecPlayerVehicleSpeed.x / fPlayerVehicleSpeed;
|
||||||
frontY = vecPlayerVehicleSpeed.y / fPlayerVehicleSpeed;
|
frontY = vecPlayerVehicleSpeed.y / fPlayerVehicleSpeed;
|
||||||
testForCollision = false;
|
testForCollision = false;
|
||||||
switch (CTimer::GetFrameCounter() & 3) {
|
switch (CTimer::GetFrameCounter() & 3) {
|
||||||
case 0:
|
case 0:
|
||||||
/* Spawn a vehicle in a very narrow gap in front of a player */
|
/* Spawn a vehicle in a very narrow gap in front of a player */
|
||||||
angleLimit = 0.85f; /* approx 30 degrees */
|
angleLimit = 0.85f; /* approx 30 degrees */
|
||||||
invertAngleLimitTest = true;
|
invertAngleLimitTest = true;
|
||||||
preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier;
|
preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
/* Spawn a vehicle relatively far away from player. */
|
/* Spawn a vehicle relatively far away from player. */
|
||||||
/* Forward to his current direction (camera direction). */
|
/* Forward to his current direction (camera direction). */
|
||||||
angleLimit = 0.707f; /* 45 degrees */
|
angleLimit = 0.707f; /* 45 degrees */
|
||||||
invertAngleLimitTest = true;
|
invertAngleLimitTest = true;
|
||||||
preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier;
|
preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
/* Spawn a vehicle close to player to his side. */
|
/* Spawn a vehicle close to player to his side. */
|
||||||
/* Kinda not within camera angle. */
|
/* Kinda not within camera angle. */
|
||||||
angleLimit = 0.707f; /* 45 degrees */
|
angleLimit = 0.707f; /* 45 degrees */
|
||||||
invertAngleLimitTest = false;
|
invertAngleLimitTest = false;
|
||||||
preferredDistance = OFFSCREEN_DESPAWN_RANGE;
|
preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else{
|
else {
|
||||||
/* Player is in vehicle but moving very slow. */
|
/* Player is in vehicle but moving very slow. */
|
||||||
/* Then use camera direction instead of vehicle direction. */
|
/* Then use camera direction instead of vehicle direction. */
|
||||||
testForCollision = true;
|
testForCollision = true;
|
||||||
frontX = TheCamera.CamFrontXNorm;
|
frontX = TheCamera.CamFrontXNorm;
|
||||||
frontY = TheCamera.CamFrontYNorm;
|
frontY = TheCamera.CamFrontYNorm;
|
||||||
switch (CTimer::GetFrameCounter() & 1) {
|
switch (CTimer::GetFrameCounter() & 1) {
|
||||||
case 0:
|
case 0:
|
||||||
/* Spawn a vehicle relatively far away from player. */
|
/* Spawn a vehicle relatively far away from player. */
|
||||||
/* Forward to his current direction (camera direction). */
|
/* Forward to his current direction (camera direction). */
|
||||||
angleLimit = 0.707f; /* 45 degrees */
|
angleLimit = 0.707f; /* 45 degrees */
|
||||||
invertAngleLimitTest = true;
|
invertAngleLimitTest = true;
|
||||||
preferredDistance = REQUEST_ONSCREEN_DISTANCE * TheCamera.GenerationDistMultiplier;
|
preferredDistance = REQUEST_ONSCREEN_DISTANCE * requestMultiplier * TheCamera.GenerationDistMultiplier;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
/* Spawn a vehicle close to player to his side. */
|
/* Spawn a vehicle close to player to his side. */
|
||||||
/* Kinda not within camera angle. */
|
/* Kinda not within camera angle. */
|
||||||
angleLimit = 0.707f; /* 45 degrees */
|
angleLimit = 0.707f; /* 45 degrees */
|
||||||
invertAngleLimitTest = false;
|
invertAngleLimitTest = false;
|
||||||
preferredDistance = OFFSCREEN_DESPAWN_RANGE;
|
preferredDistance = MINIMAL_DISTANCE_TO_SPAWN_OFFSCREEN;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ThePaths.GenerateCarCreationCoors(vecTargetPos.x, vecTargetPos.y, frontX, frontY,
|
if (!ThePaths.GenerateCarCreationCoors(vecTargetPos.x, vecTargetPos.y, frontX, frontY,
|
||||||
|
@ -300,6 +320,8 @@ CCarCtrl::GenerateOneRandomCar()
|
||||||
CPathNode* pCurNode = &ThePaths.m_pathNodes[curNodeId];
|
CPathNode* pCurNode = &ThePaths.m_pathNodes[curNodeId];
|
||||||
CPathNode* pNextNode = &ThePaths.m_pathNodes[nextNodeId];
|
CPathNode* pNextNode = &ThePaths.m_pathNodes[nextNodeId];
|
||||||
bool bBoatGenerated = false;
|
bool bBoatGenerated = false;
|
||||||
|
if (!OkToCreateVehicleAtThisPosition(spawnPosition))
|
||||||
|
return;
|
||||||
if ((CGeneral::GetRandomNumber() & 0xF) > Min(pCurNode->spawnRate, pNextNode->spawnRate))
|
if ((CGeneral::GetRandomNumber() & 0xF) > Min(pCurNode->spawnRate, pNextNode->spawnRate))
|
||||||
return;
|
return;
|
||||||
if (pCurNode->bWaterPath) {
|
if (pCurNode->bWaterPath) {
|
||||||
|
@ -599,12 +621,12 @@ CCarCtrl::GenerateOneRandomCar()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if ((vecTargetPos - pVehicle->GetPosition()).Magnitude2D() > TheCamera.GenerationDistMultiplier * (pVehicle->bExtendedRange ? EXTENDED_RANGE_DESPAWN_MULTIPLIER : 1.0f) * ONSCREEN_DESPAWN_RANGE ||
|
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 * MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN) {
|
(vecTargetPos - pVehicle->GetPosition()).Magnitude2D() < TheCamera.GenerationDistMultiplier * requestMultiplier * MINIMAL_DISTANCE_TO_SPAWN_ONSCREEN) {
|
||||||
delete pVehicle;
|
delete pVehicle;
|
||||||
return;
|
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;
|
delete pVehicle;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -654,13 +676,13 @@ CCarCtrl::GenerateOneRandomCar()
|
||||||
int nMadDrivers;
|
int nMadDrivers;
|
||||||
switch (pVehicle->GetVehicleAppearance()) {
|
switch (pVehicle->GetVehicleAppearance()) {
|
||||||
case VEHICLE_APPEARANCE_BIKE:
|
case VEHICLE_APPEARANCE_BIKE:
|
||||||
nMadDrivers = 30;
|
nMadDrivers = 20;
|
||||||
break;
|
break;
|
||||||
case VEHICLE_APPEARANCE_BOAT:
|
case VEHICLE_APPEARANCE_BOAT:
|
||||||
nMadDrivers = 40;
|
nMadDrivers = 40;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
nMadDrivers = 6;
|
nMadDrivers = 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((CGeneral::GetRandomNumber() & 0x7F) < nMadDrivers || bMadDriversCheat) {
|
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
|
int32
|
||||||
CCarCtrl::ChooseBoatModel(int32 rating)
|
CCarCtrl::ChooseBoatModel(int32 rating)
|
||||||
{
|
{
|
||||||
|
@ -944,6 +960,7 @@ CCarCtrl::RemoveCarsIfThePoolGetsFull(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pClosestVehicle) {
|
if (pClosestVehicle) {
|
||||||
|
debug(":::::::::::\'Nearest removed\' cause pools was full -> NumRandomCars %d\n", NumRandomCars);
|
||||||
CWorld::Remove(pClosestVehicle);
|
CWorld::Remove(pClosestVehicle);
|
||||||
delete pClosestVehicle;
|
delete pClosestVehicle;
|
||||||
}
|
}
|
||||||
|
@ -966,7 +983,10 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float distanceToPlayer = (pVehicle->GetPosition() - vecPlayerPos).Magnitude2D();
|
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() ||
|
if (pVehicle->GetIsOnScreen() ||
|
||||||
TheCamera.Cams[TheCamera.ActiveCam].LookingLeft ||
|
TheCamera.Cams[TheCamera.ActiveCam].LookingLeft ||
|
||||||
TheCamera.Cams[TheCamera.ActiveCam].LookingRight ||
|
TheCamera.Cams[TheCamera.ActiveCam].LookingRight ||
|
||||||
|
@ -979,7 +999,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
|
||||||
pVehicle->bIsCarParkVehicle ||
|
pVehicle->bIsCarParkVehicle ||
|
||||||
CTimer::GetTimeInMilliseconds() < pVehicle->m_nSetPieceExtendedRangeTime
|
CTimer::GetTimeInMilliseconds() < pVehicle->m_nSetPieceExtendedRangeTime
|
||||||
){
|
){
|
||||||
threshold = ONSCREEN_DESPAWN_RANGE * TheCamera.GenerationDistMultiplier;
|
threshold = ONSCREEN_DESPAWN_RANGE * despawnMultiplier * TheCamera.GenerationDistMultiplier;
|
||||||
}
|
}
|
||||||
if (TheCamera.GetForward().z < -0.9f)
|
if (TheCamera.GetForward().z < -0.9f)
|
||||||
threshold = 70.0f;
|
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)
|
if (pVehicle->AutoPilot.m_nCarMission == MISSION_RAMCAR_CLOSE && pOtherEntity == pVehicle->AutoPilot.m_pTargetCar)
|
||||||
return;
|
return;
|
||||||
CVector2D vecDiff = pOtherCar->GetPosition() - pVehicle->GetPosition();
|
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();
|
float distance = vecDiff.Magnitude();
|
||||||
if (distance < 1.0f)
|
if (distance < 1.0f)
|
||||||
return;
|
return;
|
||||||
|
@ -1582,7 +1602,7 @@ void CCarCtrl::WeaveForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle, float
|
||||||
return;
|
return;
|
||||||
CVector2D forward = pVehicle->GetForward();
|
CVector2D forward = pVehicle->GetForward();
|
||||||
forward.Normalise();
|
forward.Normalise();
|
||||||
float forwardAngle = CGeneral::GetATanOfXY(forward.x, forward.y);
|
float forwardAngle = GetATanOfXY(forward.x, forward.y);
|
||||||
float angleDiff = angleBetweenVehicles - forwardAngle;
|
float angleDiff = angleBetweenVehicles - forwardAngle;
|
||||||
float lenProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.y * sin(angleDiff));
|
float lenProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.y * sin(angleDiff));
|
||||||
float widthProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.x * cos(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);
|
diffToLeftAngle = ABS(diffToLeftAngle);
|
||||||
float angleToWeave = lengthToEvade / 2;
|
float angleToWeave = lengthToEvade / 2;
|
||||||
if (diffToLeftAngle < angleToWeave){
|
if (diffToLeftAngle < angleToWeave){
|
||||||
*pAngleToWeaveLeft = angleBetweenVehicles - angleToWeave;
|
*pAngleToWeaveLeft = LimitRadianAngle(angleBetweenVehicles - angleToWeave);
|
||||||
while (*pAngleToWeaveLeft < -PI)
|
|
||||||
*pAngleToWeaveLeft += TWOPI;
|
|
||||||
}
|
}
|
||||||
float diffToRightAngle = LimitRadianAngle(angleBetweenVehicles - *pAngleToWeaveRight);
|
float diffToRightAngle = LimitRadianAngle(angleBetweenVehicles - *pAngleToWeaveRight);
|
||||||
diffToRightAngle = ABS(diffToRightAngle);
|
diffToRightAngle = ABS(diffToRightAngle);
|
||||||
if (diffToRightAngle < angleToWeave){
|
if (diffToRightAngle < angleToWeave){
|
||||||
*pAngleToWeaveRight = angleBetweenVehicles + angleToWeave;
|
*pAngleToWeaveRight = LimitRadianAngle(angleBetweenVehicles + angleToWeave);
|
||||||
while (*pAngleToWeaveRight > PI)
|
|
||||||
*pAngleToWeaveRight -= TWOPI;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1632,23 +1648,19 @@ void CCarCtrl::WeaveForPed(CEntity* pOtherEntity, CVehicle* pVehicle, float* pAn
|
||||||
return;
|
return;
|
||||||
CPed* pPed = (CPed*)pOtherEntity;
|
CPed* pPed = (CPed*)pOtherEntity;
|
||||||
CVector2D vecDiff = pPed->GetPosition() - pVehicle->GetPosition();
|
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 distance = vecDiff.Magnitude();
|
||||||
float lengthToEvade = (WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x + PED_WIDTH_TO_WEAVE) / distance;
|
float lengthToEvade = (WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x + PED_WIDTH_TO_WEAVE) / distance;
|
||||||
float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicleAndPed - *pAngleToWeaveLeft);
|
float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicleAndPed - *pAngleToWeaveLeft);
|
||||||
diffToLeftAngle = ABS(diffToLeftAngle);
|
diffToLeftAngle = ABS(diffToLeftAngle);
|
||||||
float angleToWeave = lengthToEvade / 2;
|
float angleToWeave = lengthToEvade / 2;
|
||||||
if (diffToLeftAngle < angleToWeave) {
|
if (diffToLeftAngle < angleToWeave) {
|
||||||
*pAngleToWeaveLeft = angleBetweenVehicleAndPed - angleToWeave;
|
*pAngleToWeaveLeft = LimitRadianAngle(angleBetweenVehicleAndPed - angleToWeave);
|
||||||
while (*pAngleToWeaveLeft < -PI)
|
|
||||||
*pAngleToWeaveLeft += TWOPI;
|
|
||||||
}
|
}
|
||||||
float diffToRightAngle = LimitRadianAngle(angleBetweenVehicleAndPed - *pAngleToWeaveRight);
|
float diffToRightAngle = LimitRadianAngle(angleBetweenVehicleAndPed - *pAngleToWeaveRight);
|
||||||
diffToRightAngle = ABS(diffToRightAngle);
|
diffToRightAngle = ABS(diffToRightAngle);
|
||||||
if (diffToRightAngle < angleToWeave) {
|
if (diffToRightAngle < angleToWeave) {
|
||||||
*pAngleToWeaveRight = angleBetweenVehicleAndPed + angleToWeave;
|
*pAngleToWeaveRight = LimitRadianAngle(angleBetweenVehicleAndPed + angleToWeave);
|
||||||
while (*pAngleToWeaveRight > PI)
|
|
||||||
*pAngleToWeaveRight -= TWOPI;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1704,23 +1716,19 @@ void CCarCtrl::WeaveForObject(CEntity* pOtherEntity, CVehicle* pVehicle, float*
|
||||||
rightCoef * pObject->GetRight() +
|
rightCoef * pObject->GetRight() +
|
||||||
forwardCoef * pObject->GetForward() -
|
forwardCoef * pObject->GetForward() -
|
||||||
pVehicle->GetPosition();
|
pVehicle->GetPosition();
|
||||||
float angleBetweenVehicleAndObject = CGeneral::GetATanOfXY(vecDiff.x, vecDiff.y);
|
float angleBetweenVehicleAndObject = GetATanOfXY(vecDiff.x, vecDiff.y);
|
||||||
float distance = vecDiff.Magnitude();
|
float distance = vecDiff.Magnitude();
|
||||||
float lengthToEvade = (WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x + OBJECT_WIDTH_TO_WEAVE) / distance;
|
float lengthToEvade = (WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x + OBJECT_WIDTH_TO_WEAVE) / distance;
|
||||||
float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicleAndObject - *pAngleToWeaveLeft);
|
float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicleAndObject - *pAngleToWeaveLeft);
|
||||||
diffToLeftAngle = ABS(diffToLeftAngle);
|
diffToLeftAngle = ABS(diffToLeftAngle);
|
||||||
float angleToWeave = lengthToEvade / 2;
|
float angleToWeave = lengthToEvade / 2;
|
||||||
if (diffToLeftAngle < angleToWeave) {
|
if (diffToLeftAngle < angleToWeave) {
|
||||||
*pAngleToWeaveLeft = angleBetweenVehicleAndObject - angleToWeave;
|
*pAngleToWeaveLeft = LimitRadianAngle(angleBetweenVehicleAndObject - angleToWeave);
|
||||||
while (*pAngleToWeaveLeft < -PI)
|
|
||||||
*pAngleToWeaveLeft += TWOPI;
|
|
||||||
}
|
}
|
||||||
float diffToRightAngle = LimitRadianAngle(angleBetweenVehicleAndObject - *pAngleToWeaveRight);
|
float diffToRightAngle = LimitRadianAngle(angleBetweenVehicleAndObject - *pAngleToWeaveRight);
|
||||||
diffToRightAngle = ABS(diffToRightAngle);
|
diffToRightAngle = ABS(diffToRightAngle);
|
||||||
if (diffToRightAngle < angleToWeave) {
|
if (diffToRightAngle < angleToWeave) {
|
||||||
*pAngleToWeaveRight = angleBetweenVehicleAndObject + angleToWeave;
|
*pAngleToWeaveRight = LimitRadianAngle(angleBetweenVehicleAndObject + angleToWeave);
|
||||||
while (*pAngleToWeaveRight > PI)
|
|
||||||
*pAngleToWeaveRight -= TWOPI;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1762,7 +1770,7 @@ bool CCarCtrl::PickNextNodeAccordingStrategy(CVehicle* pVehicle)
|
||||||
void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
|
void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
|
||||||
{
|
{
|
||||||
if (pVehicle->m_nRouteSeed)
|
if (pVehicle->m_nRouteSeed)
|
||||||
CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed);
|
CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed++);
|
||||||
int32 prevNode = pVehicle->AutoPilot.m_nCurrentRouteNode;
|
int32 prevNode = pVehicle->AutoPilot.m_nCurrentRouteNode;
|
||||||
int32 curNode = pVehicle->AutoPilot.m_nNextRouteNode;
|
int32 curNode = pVehicle->AutoPilot.m_nNextRouteNode;
|
||||||
uint8 totalLinks = ThePaths.m_pathNodes[curNode].numLinks;
|
uint8 totalLinks = ThePaths.m_pathNodes[curNode].numLinks;
|
||||||
|
@ -1848,13 +1856,15 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
|
||||||
pNextPathNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nNextRouteNode];
|
pNextPathNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nNextRouteNode];
|
||||||
if ((!pNextPathNode->bDisabled || pPrevPathNode->bDisabled) &&
|
if ((!pNextPathNode->bDisabled || pPrevPathNode->bDisabled) &&
|
||||||
(!pNextPathNode->bBetweenLevels || pPrevPathNode->bBetweenLevels || !pVehicle->AutoPilot.m_bStayInCurrentLevel))
|
(!pNextPathNode->bBetweenLevels || pPrevPathNode->bBetweenLevels || !pVehicle->AutoPilot.m_bStayInCurrentLevel))
|
||||||
/* Nice way to exit loop but this will fail because this is used for indexing! */
|
break;
|
||||||
nextLink = 1000;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nextLink < 999)
|
if (nextLink >= totalLinks) {
|
||||||
/* If everything else failed, turn vehicle around */
|
/* 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;
|
pVehicle->AutoPilot.m_nNextRouteNode = prevNode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pNextPathNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nNextRouteNode];
|
pNextPathNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nNextRouteNode];
|
||||||
pNextLink = &ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[nextLink + pCurPathNode->firstLink]];
|
pNextLink = &ThePaths.m_carPathLinks[ThePaths.m_carPathConnections[nextLink + pCurPathNode->firstLink]];
|
||||||
|
@ -1967,7 +1977,7 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (pVehicle->m_nRouteSeed)
|
if (pVehicle->m_nRouteSeed)
|
||||||
CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed);
|
CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed++);
|
||||||
int prevNode = pVehicle->AutoPilot.m_nCurrentRouteNode;
|
int prevNode = pVehicle->AutoPilot.m_nCurrentRouteNode;
|
||||||
int curNode = pVehicle->AutoPilot.m_nNextRouteNode;
|
int curNode = pVehicle->AutoPilot.m_nNextRouteNode;
|
||||||
CPathNode* pPrevNode = &ThePaths.m_pathNodes[prevNode];
|
CPathNode* pPrevNode = &ThePaths.m_pathNodes[prevNode];
|
||||||
|
@ -1987,7 +1997,7 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
|
||||||
int nextLink;
|
int nextLink;
|
||||||
if (numNodes != 1 && numNodes != 2 || pTargetNode[0] == pCurNode){
|
if (numNodes != 1 && numNodes != 2 || pTargetNode[0] == pCurNode){
|
||||||
if (numNodes != 2 || pTargetNode[1] == 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;
|
nextLink = 0;
|
||||||
float lowestAngleChange = 10.0f;
|
float lowestAngleChange = 10.0f;
|
||||||
int numLinks = pCurNode->numLinks;
|
int numLinks = pCurNode->numLinks;
|
||||||
|
@ -1997,7 +2007,7 @@ void CCarCtrl::PickNextNodeToChaseCar(CVehicle* pVehicle, float targetX, float t
|
||||||
if (conNode == prevNode && i > 1)
|
if (conNode == prevNode && i > 1)
|
||||||
continue;
|
continue;
|
||||||
CPathNode* pTestNode = &ThePaths.m_pathNodes[conNode];
|
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 = LimitRadianAngle(angle - currentAngle);
|
||||||
angle = ABS(angle);
|
angle = ABS(angle);
|
||||||
if (angle < lowestAngleChange) {
|
if (angle < lowestAngleChange) {
|
||||||
|
@ -2415,6 +2425,16 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe
|
||||||
*pHandbrake = true;
|
*pHandbrake = true;
|
||||||
return;
|
return;
|
||||||
case MISSION_CRUISE:
|
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_RAMPLAYER_FARAWAY:
|
||||||
case MISSION_BLOCKPLAYER_FARAWAY:
|
case MISSION_BLOCKPLAYER_FARAWAY:
|
||||||
case MISSION_GOTOCOORDS:
|
case MISSION_GOTOCOORDS:
|
||||||
|
@ -2485,11 +2505,19 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe
|
||||||
*pHandbrake = false;
|
*pHandbrake = false;
|
||||||
return;
|
return;
|
||||||
case MISSION_RAMCAR_CLOSE:
|
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,
|
SteerAICarWithPhysicsHeadingForTarget(pVehicle, pVehicle->AutoPilot.m_pTargetCar,
|
||||||
pVehicle->AutoPilot.m_pTargetCar->GetPosition().x, pVehicle->AutoPilot.m_pTargetCar->GetPosition().y,
|
pVehicle->AutoPilot.m_pTargetCar->GetPosition().x, pVehicle->AutoPilot.m_pTargetCar->GetPosition().y,
|
||||||
pSwerve, pAccel, pBrake, pHandbrake);
|
pSwerve, pAccel, pBrake, pHandbrake);
|
||||||
return;
|
return;
|
||||||
case MISSION_BLOCKCAR_CLOSE:
|
case MISSION_BLOCKCAR_CLOSE:
|
||||||
|
if (!pVehicle->AutoPilot.m_pTargetCar) {
|
||||||
|
debug("NO TARGET VEHICLE FOR MISSION_BLOCKCAR_CLOSE\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
SteerAICarWithPhysicsTryingToBlockTarget(pVehicle,
|
SteerAICarWithPhysicsTryingToBlockTarget(pVehicle,
|
||||||
pVehicle->AutoPilot.m_pTargetCar->GetPosition().x,
|
pVehicle->AutoPilot.m_pTargetCar->GetPosition().x,
|
||||||
pVehicle->AutoPilot.m_pTargetCar->GetPosition().y,
|
pVehicle->AutoPilot.m_pTargetCar->GetPosition().y,
|
||||||
|
@ -2498,6 +2526,9 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe
|
||||||
pSwerve, pAccel, pBrake, pHandbrake);
|
pSwerve, pAccel, pBrake, pHandbrake);
|
||||||
return;
|
return;
|
||||||
case MISSION_BLOCKCAR_HANDBRAKESTOP:
|
case MISSION_BLOCKCAR_HANDBRAKESTOP:
|
||||||
|
if (!pVehicle->AutoPilot.m_pTargetCar) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
SteerAICarWithPhysicsTryingToBlockTarget_Stop(pVehicle,
|
SteerAICarWithPhysicsTryingToBlockTarget_Stop(pVehicle,
|
||||||
pVehicle->AutoPilot.m_pTargetCar->GetPosition().x,
|
pVehicle->AutoPilot.m_pTargetCar->GetPosition().x,
|
||||||
pVehicle->AutoPilot.m_pTargetCar->GetPosition().y,
|
pVehicle->AutoPilot.m_pTargetCar->GetPosition().y,
|
||||||
|
@ -2575,8 +2606,8 @@ void CCarCtrl::SteerAIBoatWithPhysicsHeadingForTarget(CVehicle* pVehicle, float
|
||||||
{
|
{
|
||||||
CVector2D forward = pVehicle->GetForward();
|
CVector2D forward = pVehicle->GetForward();
|
||||||
forward.Normalise();
|
forward.Normalise();
|
||||||
float angleToTarget = CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
|
float angleToTarget = GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
|
||||||
float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y);
|
float angleForward = GetATanOfXY(forward.x, forward.y);
|
||||||
float steerAngle = LimitRadianAngle(angleToTarget - angleForward);
|
float steerAngle = LimitRadianAngle(angleToTarget - angleForward);
|
||||||
steerAngle = clamp(steerAngle, -DEFAULT_MAX_STEER_ANGLE, DEFAULT_MAX_STEER_ANGLE);
|
steerAngle = clamp(steerAngle, -DEFAULT_MAX_STEER_ANGLE, DEFAULT_MAX_STEER_ANGLE);
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
|
@ -2607,8 +2638,8 @@ void CCarCtrl::SteerAIBoatWithPhysicsAttackingPlayer(CVehicle* pVehicle, float*
|
||||||
CVector2D forward = pVehicle->GetForward();
|
CVector2D forward = pVehicle->GetForward();
|
||||||
forward.Normalise();
|
forward.Normalise();
|
||||||
CVector2D vecToProjection = FindPlayerCoors() + FindPlayerSpeed() * projection * GAME_SPEED_TO_CARAI_SPEED;
|
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 angleToTarget = GetATanOfXY(vecToProjection.x - pVehicle->GetPosition().x, vecToProjection.y - pVehicle->GetPosition().y);
|
||||||
float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y);
|
float angleForward = GetATanOfXY(forward.x, forward.y);
|
||||||
float steerAngle = LimitRadianAngle(angleToTarget - angleForward);
|
float steerAngle = LimitRadianAngle(angleToTarget - angleForward);
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
float speedTarget = pVehicle->AutoPilot.GetCruiseSpeed();
|
float speedTarget = pVehicle->AutoPilot.GetCruiseSpeed();
|
||||||
|
@ -2696,7 +2727,7 @@ void CCarCtrl::SteerAIHeliTowardsTargetCoors(CAutomobile* pHeli)
|
||||||
if (distanceToTarget < 8.0f && pHeli->m_fHeliOrientation < 0.0f)
|
if (distanceToTarget < 8.0f && pHeli->m_fHeliOrientation < 0.0f)
|
||||||
ZTurnSpeedTarget = 0.0f;
|
ZTurnSpeedTarget = 0.0f;
|
||||||
else {
|
else {
|
||||||
float fAngleTarget = CGeneral::GetATanOfXY(vecToTarget.x, vecToTarget.y) + PI;
|
float fAngleTarget = GetATanOfXY(vecToTarget.x, vecToTarget.y) + PI;
|
||||||
if (pHeli->m_fHeliOrientation >= 0.0f)
|
if (pHeli->m_fHeliOrientation >= 0.0f)
|
||||||
fAngleTarget = pHeli->m_fHeliOrientation;
|
fAngleTarget = pHeli->m_fHeliOrientation;
|
||||||
fAngleTarget -= pHeli->m_fOrientation;
|
fAngleTarget -= pHeli->m_fOrientation;
|
||||||
|
@ -2739,7 +2770,7 @@ void CCarCtrl::SteerAIPlaneTowardsTargetCoors(CAutomobile* pPlane)
|
||||||
CVector2D vecToTarget = pPlane->AutoPilot.m_vecDestinationCoors - pPlane->GetPosition();
|
CVector2D vecToTarget = pPlane->AutoPilot.m_vecDestinationCoors - pPlane->GetPosition();
|
||||||
float fForwardZ = (pPlane->AutoPilot.m_vecDestinationCoors.z - pPlane->GetPosition().z) / vecToTarget.Magnitude();
|
float fForwardZ = (pPlane->AutoPilot.m_vecDestinationCoors.z - pPlane->GetPosition().z) / vecToTarget.Magnitude();
|
||||||
fForwardZ = clamp(fForwardZ, -0.3f, 0.3f);
|
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)
|
while (angle > TWOPI)
|
||||||
angle -= TWOPI;
|
angle -= TWOPI;
|
||||||
float difference = LimitRadianAngle(angle - pPlane->m_fOrientation);
|
float difference = LimitRadianAngle(angle - pPlane->m_fOrientation);
|
||||||
|
@ -2836,8 +2867,8 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
|
||||||
projectedPosition.y = positionOnCurrentLinkIncludingLane.y;
|
projectedPosition.y = positionOnCurrentLinkIncludingLane.y;
|
||||||
}
|
}
|
||||||
CVector2D distanceToProjectedPosition = projectedPosition - pVehicle->GetPosition();
|
CVector2D distanceToProjectedPosition = projectedPosition - pVehicle->GetPosition();
|
||||||
float angleCurrentLink = CGeneral::GetATanOfXY(distanceToProjectedPosition.x, distanceToProjectedPosition.y);
|
float angleCurrentLink = GetATanOfXY(distanceToProjectedPosition.x, distanceToProjectedPosition.y);
|
||||||
float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y);
|
float angleForward = GetATanOfXY(forward.x, forward.y);
|
||||||
if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_AVOID_CARS)
|
if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_AVOID_CARS)
|
||||||
angleCurrentLink = FindAngleToWeaveThroughTraffic(pVehicle, nil, angleCurrentLink, angleForward);
|
angleCurrentLink = FindAngleToWeaveThroughTraffic(pVehicle, nil, angleCurrentLink, angleForward);
|
||||||
float steerAngle = LimitRadianAngle(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);
|
pCurrentLink->GetY() - ((pVehicle->AutoPilot.m_nCurrentLane + pCurrentLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForward.x);
|
||||||
trajectory -= pVehicle->GetPosition();
|
trajectory -= pVehicle->GetPosition();
|
||||||
float speedAngleMultiplier = FindSpeedMultiplier(
|
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);
|
MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
|
||||||
float tmpWideMultiplier = FindSpeedMultiplier(
|
float tmpWideMultiplier = FindSpeedMultiplier(
|
||||||
CGeneral::GetATanOfXY(currentPathLinkForward.x, currentPathLinkForward.y) -
|
GetATanOfXY(currentPathLinkForward.x, currentPathLinkForward.y) -
|
||||||
CGeneral::GetATanOfXY(nextPathLinkForwardX, nextPathLinkForwardY),
|
GetATanOfXY(nextPathLinkForwardX, nextPathLinkForwardY),
|
||||||
MIN_ANGLE_FOR_SPEED_LIMITING_BETWEEN_NODES, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
|
MIN_ANGLE_FOR_SPEED_LIMITING_BETWEEN_NODES, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
|
||||||
float speedNodesMultiplier;
|
float speedNodesMultiplier;
|
||||||
if (scalarDistanceToNextNode > DISTANCE_TO_NEXT_NODE_TO_CONSIDER_SLOWING_DOWN || pVehicle->AutoPilot.m_nCruiseSpeed < 12)
|
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;
|
*pHandbrake = false;
|
||||||
CVector2D forward = pVehicle->GetForward();
|
CVector2D forward = pVehicle->GetForward();
|
||||||
forward.Normalise();
|
forward.Normalise();
|
||||||
float angleToTarget = CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
|
float angleToTarget = GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y);
|
||||||
float angleForward = CGeneral::GetATanOfXY(forward.x, forward.y);
|
float angleForward = GetATanOfXY(forward.x, forward.y);
|
||||||
if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_AVOID_CARS)
|
if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_AVOID_CARS)
|
||||||
angleToTarget = FindAngleToWeaveThroughTraffic(pVehicle, pTarget, angleToTarget, angleForward);
|
angleToTarget = FindAngleToWeaveThroughTraffic(pVehicle, pTarget, angleToTarget, angleForward);
|
||||||
float steerAngle = LimitRadianAngle(angleToTarget - angleForward);
|
float steerAngle = LimitRadianAngle(angleToTarget - angleForward);
|
||||||
|
@ -2930,7 +2961,7 @@ void CCarCtrl::SteerAICarWithPhysicsHeadingForTarget(CVehicle* pVehicle, CPhysic
|
||||||
*pHandbrake = true;
|
*pHandbrake = true;
|
||||||
float maxAngle = FindMaxSteerAngle(pVehicle);
|
float maxAngle = FindMaxSteerAngle(pVehicle);
|
||||||
steerAngle = Min(maxAngle, Max(-maxAngle, steerAngle));
|
steerAngle = Min(maxAngle, Max(-maxAngle, steerAngle));
|
||||||
float speedMultiplier = FindSpeedMultiplier(angleToTarget - angleForward,
|
float speedMultiplier = FindSpeedMultiplier(CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y) - angleForward,
|
||||||
MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
|
MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
|
||||||
float speedTarget = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier;
|
float speedTarget = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier;
|
||||||
float currentSpeed = pVehicle->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_CARAI_SPEED;
|
float currentSpeed = pVehicle->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_CARAI_SPEED;
|
||||||
|
@ -3127,7 +3158,7 @@ bool CCarCtrl::JoinCarWithRoadSystemGotoCoors(CVehicle* pVehicle, CVector vecTar
|
||||||
void CCarCtrl::FindLinksToGoWithTheseNodes(CVehicle* pVehicle)
|
void CCarCtrl::FindLinksToGoWithTheseNodes(CVehicle* pVehicle)
|
||||||
{
|
{
|
||||||
if (pVehicle->m_nRouteSeed)
|
if (pVehicle->m_nRouteSeed)
|
||||||
CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed);
|
CGeneral::SetRandomSeed(pVehicle->m_nRouteSeed++);
|
||||||
int nextLink;
|
int nextLink;
|
||||||
CPathNode* pCurNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nCurrentRouteNode];
|
CPathNode* pCurNode = &ThePaths.m_pathNodes[pVehicle->AutoPilot.m_nCurrentRouteNode];
|
||||||
for (nextLink = 0; nextLink < 12; nextLink++)
|
for (nextLink = 0; nextLink < 12; nextLink++)
|
||||||
|
@ -3169,10 +3200,12 @@ void CCarCtrl::GenerateEmergencyServicesCar(void)
|
||||||
return;
|
return;
|
||||||
if (CGame::IsInInterior())
|
if (CGame::IsInInterior())
|
||||||
return;
|
return;
|
||||||
|
if (TheCamera.m_WideScreenOn) // TODO(LCS): verify
|
||||||
|
return;
|
||||||
if (NumFiretrucksOnDuty + NumAmbulancesOnDuty + NumParkedCars + NumMissionCars +
|
if (NumFiretrucksOnDuty + NumAmbulancesOnDuty + NumParkedCars + NumMissionCars +
|
||||||
NumLawEnforcerCars + NumRandomCars > MaxNumberOfCarsInUse)
|
NumLawEnforcerCars + NumRandomCars > MaxNumberOfCarsInUse)
|
||||||
return;
|
return;
|
||||||
if (NumAmbulancesOnDuty == 0){
|
if (NumAmbulancesOnDuty == 0 /* TODO(LCS): && gbEmergencyVehiclesEnabled */){
|
||||||
if (gAccidentManager.CountActiveAccidents() < 2){
|
if (gAccidentManager.CountActiveAccidents() < 2){
|
||||||
if (CStreaming::HasModelLoaded(MI_AMBULAN))
|
if (CStreaming::HasModelLoaded(MI_AMBULAN))
|
||||||
CStreaming::SetModelIsDeletable(MI_MEDIC);
|
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 (gFireManager.GetTotalActiveFires() < 3){
|
||||||
if (CStreaming::HasModelLoaded(MI_FIRETRUCK))
|
if (CStreaming::HasModelLoaded(MI_FIRETRUCK))
|
||||||
CStreaming::SetModelIsDeletable(MI_FIREMAN);
|
CStreaming::SetModelIsDeletable(MI_FIREMAN);
|
||||||
|
@ -3348,6 +3381,17 @@ bool CCarCtrl::MapCouldMoveInThisArea(float x, float y)
|
||||||
#endif
|
#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)
|
float CCarCtrl::FindSpeedMultiplierWithSpeedFromNodes(int8 type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -3357,3 +3401,8 @@ float CCarCtrl::FindSpeedMultiplierWithSpeedFromNodes(int8 type)
|
||||||
}
|
}
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCarCtrl::RenderDebugInfo(CVehicle*)
|
||||||
|
{
|
||||||
|
//TODO(LCS)
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
#include "Boat.h"
|
#include "Boat.h"
|
||||||
|
#include "General.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
|
|
||||||
#define GAME_SPEED_TO_METERS_PER_SECOND 50.0f
|
#define GAME_SPEED_TO_METERS_PER_SECOND 50.0f
|
||||||
|
@ -130,6 +131,10 @@ public:
|
||||||
static void SteerAIBoatWithPhysicsAttackingPlayer(CVehicle*, float*, float*, float*, bool*);
|
static void SteerAIBoatWithPhysicsAttackingPlayer(CVehicle*, float*, float*, float*, bool*);
|
||||||
static void SteerAICarBlockingPlayerForwardAndBack(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)
|
static float GetPositionAlongCurrentCurve(CVehicle* pVehicle)
|
||||||
{
|
{
|
||||||
uint32 timeInCurve = CTimer::GetTimeInMilliseconds() - pVehicle->AutoPilot.m_nTimeEnteredCurve;
|
uint32 timeInCurve = CTimer::GetTimeInMilliseconds() - pVehicle->AutoPilot.m_nTimeEnteredCurve;
|
||||||
|
@ -138,11 +143,7 @@ public:
|
||||||
|
|
||||||
static float LimitRadianAngle(float angle)
|
static float LimitRadianAngle(float angle)
|
||||||
{
|
{
|
||||||
while (angle < -PI)
|
return CGeneral::LimitRadianAngle(angle);
|
||||||
angle += TWOPI;
|
|
||||||
while (angle > PI)
|
|
||||||
angle -= TWOPI;
|
|
||||||
return angle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool bMadDriversCheat;
|
static bool bMadDriversCheat;
|
||||||
|
|
|
@ -1494,9 +1494,9 @@ void CGarage::BuildRotatedDoorMatrix(CEntity * pDoor, float fPosition)
|
||||||
void CGarage::UpdateCrusherAngle()
|
void CGarage::UpdateCrusherAngle()
|
||||||
{
|
{
|
||||||
RefreshDoorPointers(false);
|
RefreshDoorPointers(false);
|
||||||
m_pDoor2->GetMatrix().SetRotateXOnly(TWOPI - m_fDoorPos);
|
//m_pDoor2->GetMatrix().SetRotateXOnly(TWOPI - m_fDoorPos); TODO
|
||||||
m_pDoor2->GetMatrix().UpdateRW();
|
//m_pDoor2->GetMatrix().UpdateRW();
|
||||||
m_pDoor2->UpdateRwFrame();
|
//m_pDoor2->UpdateRwFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGarage::UpdateCrusherShake(float X, float Y)
|
void CGarage::UpdateCrusherShake(float X, float Y)
|
||||||
|
|
|
@ -1186,7 +1186,9 @@ CPickups::DoPickUpEffects(CEntity *entity)
|
||||||
CCoronas::REFLECTION_OFF,
|
CCoronas::REFLECTION_OFF,
|
||||||
CCoronas::LOSCHECK_OFF,
|
CCoronas::LOSCHECK_OFF,
|
||||||
CCoronas::STREAK_OFF,
|
CCoronas::STREAK_OFF,
|
||||||
0.0f);
|
0.0f,
|
||||||
|
false,
|
||||||
|
-0.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1253,7 +1255,7 @@ CPickups::DoCollectableEffects(CEntity *entity)
|
||||||
int32 color = (MAXDIST - dist) * (0.5f * s + 0.5f) / MAXDIST * 255.0f;
|
int32 color = (MAXDIST - dist) * (0.5f * s + 0.5f) / MAXDIST * 255.0f;
|
||||||
CShadows::StoreStaticShadow((uintptr)entity, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, 2.0f, 0.0f, 0.0f, -2.0f, 0, color, color, color, 4.0f,
|
CShadows::StoreStaticShadow((uintptr)entity, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, 2.0f, 0.0f, 0.0f, -2.0f, 0, color, color, color, 4.0f,
|
||||||
1.0f, 40.0f, false, 0.0f);
|
1.0f, 40.0f, false, 0.0f);
|
||||||
CCoronas::RegisterCorona((uintptr)entity, color, color, color, 255, pos, 0.6f, 40.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
|
CCoronas::RegisterCorona((uintptr)entity, color, color, color, 255, pos, 0.6f, 40.0f, CCoronas::TYPE_HEX, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
entity->GetMatrix().SetRotateZOnly((float)(CTimer::GetTimeInMilliseconds() & 0xFFF) * DEGTORAD(360.0f / 0x1000));
|
entity->GetMatrix().SetRotateZOnly((float)(CTimer::GetTimeInMilliseconds() & 0xFFF) * DEGTORAD(360.0f / 0x1000));
|
||||||
|
|
|
@ -331,7 +331,7 @@ void CSceneEdit::Draw(void)
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(COMMAND_NAME_Y + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(COMMAND_NAME_Y + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
|
||||||
#else
|
#else
|
||||||
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
|
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT, wstr);
|
||||||
#endif
|
#endif
|
||||||
if (nCommandDrawn == m_nCurrentCommand)
|
if (nCommandDrawn == m_nCurrentCommand)
|
||||||
CFont::SetColor(CRGBA(156, 91, 40, 255));
|
CFont::SetColor(CRGBA(156, 91, 40, 255));
|
||||||
|
@ -340,7 +340,7 @@ void CSceneEdit::Draw(void)
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT), SCREEN_SCALE_Y(COMMAND_NAME_Y + i * COMMAND_NAME_HEIGHT), wstr);
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT), SCREEN_SCALE_Y(COMMAND_NAME_Y + i * COMMAND_NAME_HEIGHT), wstr);
|
||||||
#else
|
#else
|
||||||
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT), wstr);
|
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT, wstr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -30,9 +30,9 @@ void FlushLog();
|
||||||
#define UPSIDEDOWN_TURN_SPEED_THRESHOLD (0.02f)
|
#define UPSIDEDOWN_TURN_SPEED_THRESHOLD (0.02f)
|
||||||
#define UPSIDEDOWN_TIMER_THRESHOLD (1000)
|
#define UPSIDEDOWN_TIMER_THRESHOLD (1000)
|
||||||
|
|
||||||
#define SPHERE_MARKER_R (252)
|
#define SPHERE_MARKER_R (255)
|
||||||
#define SPHERE_MARKER_G (138)
|
#define SPHERE_MARKER_G (255)
|
||||||
#define SPHERE_MARKER_B (242)
|
#define SPHERE_MARKER_B (128)
|
||||||
#define SPHERE_MARKER_A (228)
|
#define SPHERE_MARKER_A (228)
|
||||||
#define SPHERE_MARKER_PULSE_PERIOD 2048
|
#define SPHERE_MARKER_PULSE_PERIOD 2048
|
||||||
#define SPHERE_MARKER_PULSE_FRACTION 0.1f
|
#define SPHERE_MARKER_PULSE_FRACTION 0.1f
|
||||||
|
@ -47,7 +47,15 @@ void FlushLog();
|
||||||
|
|
||||||
#define KEY_LENGTH_IN_SCRIPT (8)
|
#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
|
struct intro_script_rectangle
|
||||||
{
|
{
|
||||||
|
@ -214,16 +222,34 @@ public:
|
||||||
bool HasCarBeenStuckForAWhile(int32);
|
bool HasCarBeenStuckForAWhile(int32);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
MAX_STACK_DEPTH = 16,
|
||||||
|
NUM_LOCAL_VARS = 96,
|
||||||
|
NUM_TIMERS = 2,
|
||||||
|
NUM_GLOBAL_SLOTS = 26
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ARGUMENT_END = 0,
|
ARGUMENT_END = 0,
|
||||||
|
ARGUMENT_INT_ZERO,
|
||||||
|
ARGUMENT_FLOAT_ZERO,
|
||||||
|
ARGUMENT_FLOAT_1BYTE,
|
||||||
|
ARGUMENT_FLOAT_2BYTES,
|
||||||
|
ARGUMENT_FLOAT_3BYTES,
|
||||||
ARGUMENT_INT32,
|
ARGUMENT_INT32,
|
||||||
ARGUMENT_GLOBALVAR,
|
|
||||||
ARGUMENT_LOCALVAR,
|
|
||||||
ARGUMENT_INT8,
|
ARGUMENT_INT8,
|
||||||
ARGUMENT_INT16,
|
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
|
struct tCollectiveData
|
||||||
{
|
{
|
||||||
int32 colIndex;
|
int32 colIndex;
|
||||||
|
@ -253,38 +279,31 @@ enum {
|
||||||
VAR_GLOBAL = 2,
|
VAR_GLOBAL = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
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 {
|
enum {
|
||||||
MAX_NUM_SCRIPTS = 128,
|
MAX_NUM_SCRIPTS = 128,
|
||||||
MAX_NUM_INTRO_TEXT_LINES = 48,
|
MAX_NUM_INTRO_TEXT_LINES = 48,
|
||||||
MAX_NUM_INTRO_RECTANGLES = 16,
|
MAX_NUM_INTRO_RECTANGLES = 16,
|
||||||
MAX_NUM_SCRIPT_SRPITES = 16,
|
MAX_NUM_SCRIPT_SRPITES = 16,
|
||||||
MAX_NUM_SCRIPT_SPHERES = 16,
|
MAX_NUM_SCRIPT_SPHERES = 16,
|
||||||
MAX_NUM_USED_OBJECTS = 220,
|
MAX_NUM_COLLECTIVES = 32,
|
||||||
MAX_NUM_MISSION_SCRIPTS = 120,
|
MAX_NUM_USED_OBJECTS = 305,
|
||||||
MAX_NUM_BUILDING_SWAPS = 25,
|
MAX_NUM_MISSION_SCRIPTS = 150,
|
||||||
MAX_NUM_INVISIBILITY_SETTINGS = 20,
|
MAX_NUM_BUILDING_SWAPS = 80,
|
||||||
MAX_NUM_STORED_LINES = 1024
|
MAX_NUM_INVISIBILITY_SETTINGS = 52,
|
||||||
|
MAX_NUM_STORED_LINES = 1024,
|
||||||
|
MAX_ALLOWED_COLLISIONS = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
class CTheScripts
|
class CTheScripts
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static uint8 ScriptSpace[SIZE_SCRIPT_SPACE];
|
static uint8* ScriptSpace;
|
||||||
static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS];
|
static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS];
|
||||||
static intro_text_line IntroTextLines[MAX_NUM_INTRO_TEXT_LINES];
|
static intro_text_line IntroTextLines[MAX_NUM_INTRO_TEXT_LINES];
|
||||||
static intro_script_rectangle IntroRectangles[MAX_NUM_INTRO_RECTANGLES];
|
static intro_script_rectangle IntroRectangles[MAX_NUM_INTRO_RECTANGLES];
|
||||||
static CSprite2d ScriptSprites[MAX_NUM_SCRIPT_SRPITES];
|
static CSprite2d ScriptSprites[MAX_NUM_SCRIPT_SRPITES];
|
||||||
static script_sphere_struct ScriptSphereArray[MAX_NUM_SCRIPT_SPHERES];
|
static script_sphere_struct ScriptSphereArray[MAX_NUM_SCRIPT_SPHERES];
|
||||||
|
static tCollectiveData CollectiveArray[MAX_NUM_COLLECTIVES];
|
||||||
static tUsedObject UsedObjectArray[MAX_NUM_USED_OBJECTS];
|
static tUsedObject UsedObjectArray[MAX_NUM_USED_OBJECTS];
|
||||||
static int32 MultiScriptArray[MAX_NUM_MISSION_SCRIPTS];
|
static int32 MultiScriptArray[MAX_NUM_MISSION_SCRIPTS];
|
||||||
static tBuildingSwap BuildingSwapArray[MAX_NUM_BUILDING_SWAPS];
|
static tBuildingSwap BuildingSwapArray[MAX_NUM_BUILDING_SWAPS];
|
||||||
|
@ -316,20 +335,22 @@ public:
|
||||||
static uint16 ScriptsUpdated;
|
static uint16 ScriptsUpdated;
|
||||||
static uint32 LastMissionPassedTime;
|
static uint32 LastMissionPassedTime;
|
||||||
static uint16 NumberOfExclusiveMissionScripts;
|
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 bool bPlayerIsInTheStatium;
|
||||||
static uint8 RiotIntensity;
|
static uint8 RiotIntensity;
|
||||||
static bool bPlayerHasMetDebbieHarry;
|
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 void Process();
|
||||||
|
|
||||||
static CRunningScript* StartTestScript();
|
static CRunningScript* StartTestScript();
|
||||||
|
@ -420,6 +441,9 @@ public:
|
||||||
static void SwitchToMission(int32 mission);
|
static void SwitchToMission(int32 mission);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int GetSaveVarIndex(int);
|
||||||
|
static void Shutdown(void);
|
||||||
|
|
||||||
#ifdef GTA_SCRIPT_COLLECTIVE
|
#ifdef GTA_SCRIPT_COLLECTIVE
|
||||||
static void AdvanceCollectiveIndex()
|
static void AdvanceCollectiveIndex()
|
||||||
{
|
{
|
||||||
|
@ -441,12 +465,9 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern int ScriptParams[32];
|
||||||
|
|
||||||
enum {
|
VALIDATE_SIZE(uStackReturnValue, 4);
|
||||||
MAX_STACK_DEPTH = 6,
|
|
||||||
NUM_LOCAL_VARS = 16,
|
|
||||||
NUM_TIMERS = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
class CRunningScript
|
class CRunningScript
|
||||||
{
|
{
|
||||||
|
@ -470,14 +491,25 @@ class CRunningScript
|
||||||
ORS_8
|
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:
|
public:
|
||||||
CRunningScript* next;
|
CRunningScript* next;
|
||||||
CRunningScript* prev;
|
CRunningScript* prev;
|
||||||
|
int m_nId;
|
||||||
char m_abScriptName[8];
|
char m_abScriptName[8];
|
||||||
uint32 m_nIp;
|
uint32 m_nIp;
|
||||||
uint32 m_anStack[MAX_STACK_DEPTH];
|
uint32 m_anStack[MAX_STACK_DEPTH];
|
||||||
uint16 m_nStackPointer;
|
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_bIsActive;
|
||||||
bool m_bCondResult;
|
bool m_bCondResult;
|
||||||
bool m_bIsMissionScript;
|
bool m_bIsMissionScript;
|
||||||
|
@ -497,8 +529,8 @@ public:
|
||||||
void Load(uint8*& buf);
|
void Load(uint8*& buf);
|
||||||
|
|
||||||
void UpdateTimers(float timeStep) {
|
void UpdateTimers(float timeStep) {
|
||||||
m_anLocalVariables[NUM_LOCAL_VARS] += timeStep;
|
for (int i = 0; i < NUM_TIMERS; i++)
|
||||||
m_anLocalVariables[NUM_LOCAL_VARS + 1] += timeStep;
|
m_anLocalVariables[NUM_LOCAL_VARS + 8 + i] += timeStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
@ -509,7 +541,7 @@ public:
|
||||||
|
|
||||||
static const uint32 nSaveStructSize;
|
static const uint32 nSaveStructSize;
|
||||||
|
|
||||||
void CollectParameters(uint32*, int16);
|
void CollectParameters(uint32*, int16, int* pParams = (int*)&ScriptParams);
|
||||||
int32 CollectNextParameterWithoutIncreasingPC(uint32);
|
int32 CollectNextParameterWithoutIncreasingPC(uint32);
|
||||||
int32* GetPointerToScriptVariable(uint32*, int16);
|
int32* GetPointerToScriptVariable(uint32*, int16);
|
||||||
void StoreParameters(uint32*, int16);
|
void StoreParameters(uint32*, int16);
|
||||||
|
@ -534,6 +566,8 @@ public:
|
||||||
int8 ProcessCommands1200To1299(int32);
|
int8 ProcessCommands1200To1299(int32);
|
||||||
int8 ProcessCommands1300To1399(int32);
|
int8 ProcessCommands1300To1399(int32);
|
||||||
int8 ProcessCommands1400To1499(int32);
|
int8 ProcessCommands1400To1499(int32);
|
||||||
|
int8 ProcessCommands1500To1599(int32);
|
||||||
|
int8 ProcessCommands1600To1699(int32);
|
||||||
|
|
||||||
void LocatePlayerCommand(int32, uint32*);
|
void LocatePlayerCommand(int32, uint32*);
|
||||||
void LocatePlayerCharCommand(int32, uint32*);
|
void LocatePlayerCharCommand(int32, uint32*);
|
||||||
|
@ -571,11 +605,11 @@ public:
|
||||||
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
|
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
|
||||||
|
|
||||||
bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal);
|
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);
|
static bool ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami);
|
||||||
|
|
||||||
|
void ReturnFromGosubOrFunction();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef USE_DEBUG_SCRIPT_LOADER
|
#ifdef USE_DEBUG_SCRIPT_LOADER
|
||||||
|
@ -600,3 +634,6 @@ void RetryMission(int, int);
|
||||||
#ifdef USE_DEBUG_SCRIPT_LOADER
|
#ifdef USE_DEBUG_SCRIPT_LOADER
|
||||||
extern int scriptToLoad;
|
extern int scriptToLoad;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern int gScriptsFile;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -106,7 +106,10 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
||||||
printf("Couldn't find zone - %s\n", zone);
|
printf("Couldn't find zone - %s\n", zone);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CTheZones::SetPedGroup(zone_id, ScriptParams[0], ScriptParams[1]);
|
while (zone_id >= 0) {
|
||||||
|
CTheZones::SetPedGroup(zone_id, ScriptParams[0], ScriptParams[1]);
|
||||||
|
zone_id = CTheZones::FindNextZoneByLabelAndReturnIndex(zone, ZONE_INFO);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_START_CAR_FIRE:
|
case COMMAND_START_CAR_FIRE:
|
||||||
|
@ -954,7 +957,10 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
||||||
pPed->WarpPedIntoCar(pVehicle);
|
pPed->WarpPedIntoCar(pVehicle);
|
||||||
return 0;
|
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_SET_AUDIO_STREAM:
|
||||||
case COMMAND_PRINT_WITH_2_NUMBERS_BIG:
|
case COMMAND_PRINT_WITH_2_NUMBERS_BIG:
|
||||||
{
|
{
|
||||||
|
@ -1354,11 +1360,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||||
CTxdStore::AddRef(slot);
|
CTxdStore::AddRef(slot);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
case COMMAND_REMOVE_TEXTURE_DICTIONARY:
|
case COMMAND_REMOVE_TEXTURE_DICTIONARY:
|
||||||
{
|
{
|
||||||
CTheScripts::RemoveScriptTextureDictionary();
|
CTheScripts::RemoveScriptTextureDictionary();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
case COMMAND_SET_OBJECT_DYNAMIC:
|
case COMMAND_SET_OBJECT_DYNAMIC:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
|
@ -1418,7 +1426,6 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||||
pVehicle->m_bSirenOrAlarm = ScriptParams[1] != 0;
|
pVehicle->m_bSirenOrAlarm = ScriptParams[1] != 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
case COMMAND_SWITCH_PED_ROADS_ON_ANGLED:
|
case COMMAND_SWITCH_PED_ROADS_ON_ANGLED:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 7);
|
CollectParameters(&m_nIp, 7);
|
||||||
|
@ -1441,7 +1448,6 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||||
ThePaths.SwitchRoadsInAngledArea(*(float*)&ScriptParams[0], *(float*)&ScriptParams[1], *(float*)&ScriptParams[2],
|
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);
|
*(float*)&ScriptParams[3], *(float*)&ScriptParams[4], *(float*)&ScriptParams[5], *(float*)&ScriptParams[6], 1, 0);
|
||||||
return 0;
|
return 0;
|
||||||
*/
|
|
||||||
case COMMAND_SET_CAR_WATERTIGHT:
|
case COMMAND_SET_CAR_WATERTIGHT:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
|
@ -1781,7 +1787,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||||
*/
|
*/
|
||||||
case COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_STRING:
|
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);
|
uint16 var = CTheScripts::Read2BytesFromScript(&m_nIp);
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ???
|
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ???
|
||||||
|
@ -1792,7 +1798,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||||
}
|
}
|
||||||
case COMMAND_DISPLAY_ONSCREEN_COUNTER_WITH_STRING:
|
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);
|
uint16 var = CTheScripts::Read2BytesFromScript(&m_nIp);
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ???
|
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ???
|
||||||
|
@ -1967,12 +1973,10 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||||
CWorld::Add(car);
|
CWorld::Add(car);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
case COMMAND_IS_COLLISION_IN_MEMORY:
|
case COMMAND_IS_COLLISION_IN_MEMORY:
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
UpdateCompareFlag(CCollision::ms_collisionInMemory == ScriptParams[0]);
|
UpdateCompareFlag(CCollision::ms_collisionInMemory == ScriptParams[0]);
|
||||||
return 0;
|
return 0;
|
||||||
*/
|
|
||||||
case COMMAND_SET_WANTED_MULTIPLIER:
|
case COMMAND_SET_WANTED_MULTIPLIER:
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
FindPlayerPed()->m_pWanted->m_fCrimeSensitivity = *(float*)&ScriptParams[0];
|
FindPlayerPed()->m_pWanted->m_fCrimeSensitivity = *(float*)&ScriptParams[0];
|
||||||
|
@ -2042,7 +2046,8 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||||
case COMMAND_HAS_MISSION_AUDIO_LOADED:
|
case COMMAND_HAS_MISSION_AUDIO_LOADED:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
UpdateCompareFlag(DMAudio.GetMissionAudioLoadingStatus(ScriptParams[0] - 1) == 1);
|
//UpdateCompareFlag(DMAudio.GetMissionAudioLoadingStatus(ScriptParams[0] - 1) == 1);
|
||||||
|
UpdateCompareFlag(true); // TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_PLAY_MISSION_AUDIO:
|
case COMMAND_PLAY_MISSION_AUDIO:
|
||||||
|
@ -2052,7 +2057,8 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||||
case COMMAND_HAS_MISSION_AUDIO_FINISHED:
|
case COMMAND_HAS_MISSION_AUDIO_FINISHED:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
UpdateCompareFlag(DMAudio.IsMissionAudioSampleFinished(ScriptParams[0] - 1));
|
//UpdateCompareFlag(DMAudio.IsMissionAudioSampleFinished(ScriptParams[0] - 1)); // TODO
|
||||||
|
UpdateCompareFlag(true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING:
|
case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING:
|
||||||
|
|
|
@ -2531,7 +2531,7 @@ int CTheScripts::FindFreeSlotInCollectiveArray()
|
||||||
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, int16 p1, int16 p2)
|
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, int16 p1, int16 p2)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
||||||
if (CollectiveArray[i].colIndex = colIndex) {
|
if (CollectiveArray[i].colIndex == colIndex) {
|
||||||
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
||||||
if (pPed == nil) {
|
if (pPed == nil) {
|
||||||
CollectiveArray[i].colIndex = -1;
|
CollectiveArray[i].colIndex = -1;
|
||||||
|
@ -2548,7 +2548,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
|
||||||
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1, float p2)
|
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1, float p2)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
||||||
if (CollectiveArray[i].colIndex = colIndex) {
|
if (CollectiveArray[i].colIndex == colIndex) {
|
||||||
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
||||||
if (pPed == nil) {
|
if (pPed == nil) {
|
||||||
CollectiveArray[i].colIndex = -1;
|
CollectiveArray[i].colIndex = -1;
|
||||||
|
@ -2565,7 +2565,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
|
||||||
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1)
|
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
||||||
if (CollectiveArray[i].colIndex = colIndex) {
|
if (CollectiveArray[i].colIndex == colIndex) {
|
||||||
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
||||||
if (pPed == nil) {
|
if (pPed == nil) {
|
||||||
CollectiveArray[i].colIndex = -1;
|
CollectiveArray[i].colIndex = -1;
|
||||||
|
@ -2582,7 +2582,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
|
||||||
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, void* p1)
|
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, void* p1)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
||||||
if (CollectiveArray[i].colIndex = colIndex) {
|
if (CollectiveArray[i].colIndex == colIndex) {
|
||||||
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
||||||
if (pPed == nil) {
|
if (pPed == nil) {
|
||||||
CollectiveArray[i].colIndex = -1;
|
CollectiveArray[i].colIndex = -1;
|
||||||
|
@ -2599,7 +2599,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
|
||||||
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective)
|
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
||||||
if (CollectiveArray[i].colIndex = colIndex) {
|
if (CollectiveArray[i].colIndex == colIndex) {
|
||||||
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
||||||
if (pPed == nil) {
|
if (pPed == nil) {
|
||||||
CollectiveArray[i].colIndex = -1;
|
CollectiveArray[i].colIndex = -1;
|
||||||
|
@ -2740,6 +2740,9 @@ void CTheScripts::ReadObjectNamesFromScript()
|
||||||
{
|
{
|
||||||
int32 varSpace = GetSizeOfVariableSpace();
|
int32 varSpace = GetSizeOfVariableSpace();
|
||||||
uint32 ip = varSpace + 8;
|
uint32 ip = varSpace + 8;
|
||||||
|
NumSaveVars = Read4BytesFromScript(&ip);
|
||||||
|
SavedVarIndices = (short*)&ScriptParams[ip];
|
||||||
|
ip += 2 * NumSaveVars;
|
||||||
NumberOfUsedObjects = Read2BytesFromScript(&ip);
|
NumberOfUsedObjects = Read2BytesFromScript(&ip);
|
||||||
ip += 2;
|
ip += 2;
|
||||||
for (uint16 i = 0; i < NumberOfUsedObjects; i++) {
|
for (uint16 i = 0; i < NumberOfUsedObjects; i++) {
|
||||||
|
@ -2751,30 +2754,16 @@ void CTheScripts::ReadObjectNamesFromScript()
|
||||||
|
|
||||||
void CTheScripts::UpdateObjectIndices()
|
void CTheScripts::UpdateObjectIndices()
|
||||||
{
|
{
|
||||||
char name[USED_OBJECT_NAME_LENGTH];
|
|
||||||
char error[112];
|
char error[112];
|
||||||
for (int i = 1; i < NumberOfUsedObjects; i++) {
|
for (int i = 1; i < NumberOfUsedObjects; i++) {
|
||||||
bool found = false;
|
UsedObjectArray[i].index = -1;
|
||||||
for (int j = 0; j < MODELINFOSIZE && !found; j++) {
|
CModelInfo::GetModelInfo(UsedObjectArray[i].name, &UsedObjectArray[i].index);
|
||||||
CBaseModelInfo* pModel = CModelInfo::GetModelInfo(j);
|
#ifndef FINAL
|
||||||
if (!pModel)
|
if (UsedObjectArray[i].index == -1) {
|
||||||
continue;
|
|
||||||
strcpy(name, pModel->GetModelName());
|
|
||||||
#ifdef FIX_BUGS
|
|
||||||
for (int k = 0; k < USED_OBJECT_NAME_LENGTH && name[k]; k++)
|
|
||||||
#else
|
|
||||||
for (int k = 0; k < USED_OBJECT_NAME_LENGTH; k++)
|
|
||||||
#endif
|
|
||||||
name[k] = toupper(name[k]);
|
|
||||||
if (strcmp(name, UsedObjectArray[i].name) == 0) {
|
|
||||||
found = true;
|
|
||||||
UsedObjectArray[i].index = j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
sprintf(error, "CTheScripts::UpdateObjectIndices - Couldn't find %s", UsedObjectArray[i].name);
|
sprintf(error, "CTheScripts::UpdateObjectIndices - Couldn't find %s", UsedObjectArray[i].name);
|
||||||
debug("%s\n", error);
|
debug("%s\n", error);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2784,7 +2773,8 @@ void CTheScripts::ReadMultiScriptFileOffsetsFromScript()
|
||||||
uint32 ip = varSpace + 3;
|
uint32 ip = varSpace + 3;
|
||||||
int32 objectSize = Read4BytesFromScript(&ip);
|
int32 objectSize = Read4BytesFromScript(&ip);
|
||||||
ip = objectSize + 8;
|
ip = objectSize + 8;
|
||||||
MainScriptSize = Read4BytesFromScript(&ip);
|
NumTrueGlobals = Read2BytesFromScript(&ip);
|
||||||
|
MostGlobals = Read2BytesFromScript(&ip);
|
||||||
LargestMissionScriptSize = Read4BytesFromScript(&ip);
|
LargestMissionScriptSize = Read4BytesFromScript(&ip);
|
||||||
NumberOfMissionScripts = Read2BytesFromScript(&ip);
|
NumberOfMissionScripts = Read2BytesFromScript(&ip);
|
||||||
NumberOfExclusiveMissionScripts = Read2BytesFromScript(&ip);
|
NumberOfExclusiveMissionScripts = Read2BytesFromScript(&ip);
|
||||||
|
|
|
@ -83,7 +83,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||||
{
|
{
|
||||||
switch (command) {
|
switch (command) {
|
||||||
//case COMMAND_FLASH_RADAR_BLIP:
|
//case COMMAND_FLASH_RADAR_BLIP:
|
||||||
/*
|
|
||||||
case COMMAND_IS_CHAR_IN_CONTROL:
|
case COMMAND_IS_CHAR_IN_CONTROL:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
|
@ -91,7 +90,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||||
UpdateCompareFlag(pPed->IsPedInControl());
|
UpdateCompareFlag(pPed->IsPedInControl());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
case COMMAND_SET_GENERATE_CARS_AROUND_CAMERA:
|
case COMMAND_SET_GENERATE_CARS_AROUND_CAMERA:
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CCarCtrl::bCarsGeneratedAroundCamera = (ScriptParams[0] != 0);
|
CCarCtrl::bCarsGeneratedAroundCamera = (ScriptParams[0] != 0);
|
||||||
|
@ -374,32 +372,30 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
|
|
||||||
if (CTheScripts::NumberOfExclusiveMissionScripts > 0 && ScriptParams[0] <= UINT16_MAX - 2)
|
if (CTheScripts::NumberOfExclusiveMissionScripts > 0) {
|
||||||
return 0;
|
if (ScriptParams[0] < UINT16_MAX - 1)
|
||||||
|
return 0;
|
||||||
|
ScriptParams[0] = UINT16_MAX - ScriptParams[0];
|
||||||
|
}
|
||||||
#ifdef MISSION_REPLAY
|
#ifdef MISSION_REPLAY
|
||||||
missionRetryScriptIndex = ScriptParams[0];
|
missionRetryScriptIndex = ScriptParams[0];
|
||||||
if (missionRetryScriptIndex == 19)
|
if (missionRetryScriptIndex == 19)
|
||||||
CStats::LastMissionPassedName[0] = '\0';
|
CStats::LastMissionPassedName[0] = '\0';
|
||||||
#endif
|
#endif
|
||||||
CTimer::Suspend();
|
CTimer::Suspend();
|
||||||
int offset = CTheScripts::MultiScriptArray[ScriptParams[0]];
|
int offset = CTheScripts::MultiScriptArray[ScriptParams[0]] + 8;
|
||||||
#ifdef USE_DEBUG_SCRIPT_LOADER
|
int size = CTheScripts::MultiScriptArray[ScriptParams[0] + 1] - CTheScripts::MultiScriptArray[ScriptParams[0]];
|
||||||
CFileMgr::ChangeDir("\\data\\");
|
if (size <= 0)
|
||||||
int handle = CFileMgr::OpenFile(scriptfile, "rb");
|
size = CTheScripts::LargestMissionScriptSize;
|
||||||
CFileMgr::ChangeDir("\\");
|
CFileMgr::Seek(gScriptsFile, offset, 0);
|
||||||
#else
|
CFileMgr::Read(gScriptsFile, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], size); // TODO
|
||||||
CFileMgr::ChangeDir("\\");
|
CRunningScript* pMissionScript = CTheScripts::StartNewScript(CTheScripts::MainScriptSize);
|
||||||
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);
|
|
||||||
CTimer::Resume();
|
CTimer::Resume();
|
||||||
pMissionScript->m_bIsMissionScript = true;
|
pMissionScript->m_bIsMissionScript = true;
|
||||||
pMissionScript->m_bMissionFlag = true;
|
pMissionScript->m_bMissionFlag = true;
|
||||||
CTheScripts::bAlreadyRunningAMissionScript = true;
|
CTheScripts::bAlreadyRunningAMissionScript = true;
|
||||||
CGameLogic::ClearShortCut();
|
memset(&CTheScripts::ScriptSpace[CTheScripts::NumTrueGlobals * 4 + 8], 0, CTheScripts::MostGlobals * 4);
|
||||||
|
pMissionScript->Process();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_SET_OBJECT_DRAW_LAST:
|
case COMMAND_SET_OBJECT_DRAW_LAST:
|
||||||
|
@ -527,7 +523,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
case COMMAND_MARK_ROADS_BETWEEN_LEVELS:
|
case COMMAND_MARK_ROADS_BETWEEN_LEVELS:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 6);
|
CollectParameters(&m_nIp, 6);
|
||||||
|
@ -576,7 +571,6 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||||
ThePaths.PedMarkRoadsBetweenLevelsInArea(infX, supX, infY, supY, infZ, supZ);
|
ThePaths.PedMarkRoadsBetweenLevelsInArea(infX, supX, infY, supY, infZ, supZ);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
case COMMAND_SET_CAR_AVOID_LEVEL_TRANSITIONS:
|
case COMMAND_SET_CAR_AVOID_LEVEL_TRANSITIONS:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
|
|
|
@ -540,7 +540,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
|
||||||
case COMMAND_DISPLAY_NTH_ONSCREEN_COUNTER_WITH_STRING:
|
case COMMAND_DISPLAY_NTH_ONSCREEN_COUNTER_WITH_STRING:
|
||||||
{
|
{
|
||||||
char onscreen_str[12];
|
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);
|
uint16 var = CTheScripts::Read2BytesFromScript(&m_nIp);
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]); // ???
|
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_CHAR_BEEN_DAMAGED_BY_CAR:
|
||||||
//case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_CHAR:
|
//case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_CHAR:
|
||||||
//case COMMAND_HAS_CAR_BEEN_DAMAGED_BY_CAR:
|
//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_DISPLAY_TEXT_WITH_3_NUMBERS:
|
||||||
//case COMMAND_IS_CAR_DROWNING_IN_WATER:
|
//case COMMAND_IS_CAR_DROWNING_IN_WATER:
|
||||||
case COMMAND_IS_CHAR_DROWNING_IN_WATER:
|
case COMMAND_IS_CHAR_DROWNING_IN_WATER:
|
||||||
|
@ -1013,7 +1018,7 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_REMOVE_EVERYTHING_FOR_HUGE_CUTSCENE:
|
case COMMAND_REMOVE_EVERYTHING_FOR_HUGE_CUTSCENE:
|
||||||
{
|
{
|
||||||
CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver();
|
//CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_IS_PLAYER_TOUCHING_VEHICLE:
|
case COMMAND_IS_PLAYER_TOUCHING_VEHICLE:
|
||||||
|
@ -1327,7 +1332,19 @@ int8 CRunningScript::ProcessCommands1300To1399(int32 command)
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
UpdateCompareFlag(CPools::GetPedPool()->GetAt(ScriptParams[0]) != 0);
|
UpdateCompareFlag(CPools::GetPedPool()->GetAt(ScriptParams[0]) != 0);
|
||||||
return 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_BLIP_FOR_CONTACT_POINT:
|
||||||
case COMMAND_ADD_SHORT_RANGE_SPRITE_BLIP_FOR_CONTACT_POINT:
|
case COMMAND_ADD_SHORT_RANGE_SPRITE_BLIP_FOR_CONTACT_POINT:
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,7 +77,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
|
||||||
case COMMAND_PLAY_ANNOUNCEMENT:
|
case COMMAND_PLAY_ANNOUNCEMENT:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
DMAudio.PlayRadioAnnouncement(ScriptParams[0] + STREAMED_SOUND_ANNOUNCE_BRIDGE_CLOSED);
|
DMAudio.PlayRadioAnnouncement(ScriptParams[0] + STREAMED_SOUND_NEWS_A);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_SET_PLAYER_IS_IN_STADIUM:
|
case COMMAND_SET_PLAYER_IS_IN_STADIUM:
|
||||||
|
@ -384,7 +384,6 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#if (defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT)
|
|
||||||
case COMMAND_IS_JAPANESE_GAME:
|
case COMMAND_IS_JAPANESE_GAME:
|
||||||
#ifdef MORE_LANGUAGES
|
#ifdef MORE_LANGUAGES
|
||||||
UpdateCompareFlag(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_JAPANESE);
|
UpdateCompareFlag(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_JAPANESE);
|
||||||
|
@ -394,218 +393,728 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
|
||||||
UpdateCompareFlag(false);
|
UpdateCompareFlag(false);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
#elif (!defined GTA_PS2)
|
case COMMAND_1442:
|
||||||
case COMMAND_SET_ONSCREEN_COUNTER_FLASH_WHEN_FIRST_DISPLAYED:
|
script_assert(false);
|
||||||
script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR);
|
return 0;
|
||||||
uint16 var = CTheScripts::Read2BytesFromScript(&m_nIp);
|
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);
|
CollectParameters(&m_nIp, 1);
|
||||||
//CUserDisplay::OnscnTimer.SetCounterFlashWhenFirstDisplayed(var, ScriptParams[0]);
|
// TODO (GET_PAD_BUTTON_STATE)
|
||||||
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:
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
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);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case COMMAND_GET_OBJECT_VELOCITY:
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case COMMAND_IS_DEBUG_CAMERA_ON:
|
|
||||||
UpdateCompareFlag(TheCamera.WorldViewerBeingUsed);
|
|
||||||
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);
|
|
||||||
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);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case COMMAND_IS_OBJECT_STATIC:
|
|
||||||
{
|
|
||||||
CollectParameters(&m_nIp, 1);
|
|
||||||
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
|
|
||||||
UpdateCompareFlag(pObject->GetIsStatic());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case COMMAND_GET_ANGLE_BETWEEN_2D_VECTORS:
|
|
||||||
{
|
|
||||||
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
|
|
||||||
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);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case COMMAND_GET_OBJECT_ROTATION_VELOCITY:
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case COMMAND_ADD_VELOCITY_RELATIVE_TO_OBJECT_VELOCITY:
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
case COMMAND_GET_OBJECT_SPEED:
|
|
||||||
{
|
|
||||||
CollectParameters(&m_nIp, 1);
|
|
||||||
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
|
|
||||||
*(float*)&ScriptParams[0] = pObject->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_METERS_PER_SECOND;
|
|
||||||
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;
|
ScriptParams[0] = 0;
|
||||||
#endif
|
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_SET_IN_AMMUNATION:
|
case COMMAND_1452:
|
||||||
CollectParameters(&m_nIp, 1);
|
script_assert(false);
|
||||||
#ifdef MISSION_REPLAY
|
|
||||||
IsInAmmunation = ScriptParams[0];
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_DO_SAVE_GAME:
|
case COMMAND_1453:
|
||||||
CollectParameters(&m_nIp, 1);
|
script_assert(false);
|
||||||
#ifdef MISSION_REPLAY
|
|
||||||
SaveGameForPause(ScriptParams[0]);
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_IS_RETRY:
|
case COMMAND_CALL:
|
||||||
#ifdef MISSION_REPLAY
|
case COMMAND_NOTCALL:
|
||||||
if (strcmp(m_abScriptName, "porno4") != 0)
|
{
|
||||||
ScriptParams[0] = AllowMissionReplay;
|
m_anStack[m_nStackPointer++] = m_nIp | BIT(STACKVALUE_IS_FUNCTION_CALL_BIT) | ((command == COMMAND_NOTCALL) ? BIT(STACKVALUE_INVERT_RETURN_BIT) : 0);
|
||||||
#ifdef FIX_BUGS
|
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);
|
||||||
|
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
|
else
|
||||||
ScriptParams[0] = gbTryingPorn4Again;
|
m_nIp = ScriptParams[0];
|
||||||
#else
|
|
||||||
else if (gbTryingPorn4Again)
|
|
||||||
ScriptParams[0] = 1;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
ScriptParams[0] = 0;
|
|
||||||
#endif
|
|
||||||
StoreParameters(&m_nIp, 1);
|
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_DUMMY:
|
}
|
||||||
|
case COMMAND_1456:
|
||||||
|
script_assert(false);
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
case COMMAND_1457:
|
||||||
#if (defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
|
script_assert(false);
|
||||||
// it is unknown what these commands do but they don't take parameters
|
|
||||||
case COMMAND_MARK_CUTSCENE_START:
|
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_MARK_CUTSCENE_END:
|
case COMMAND_1458:
|
||||||
|
script_assert(false);
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_CUTSCENE_SCROLL:
|
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);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
// TODO (SET_NUMBER_USJ_FOUND?)
|
||||||
|
return 0;
|
||||||
|
case COMMAND_1520:
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
// TODO (SET_TOTAL_HIDDEN_PACKAGES?)
|
||||||
|
return 0;
|
||||||
|
case COMMAND_1521:
|
||||||
|
script_assert(false);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_1522:
|
||||||
|
script_assert(false);
|
||||||
|
return 0;
|
||||||
|
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);
|
||||||
|
// TODO (SET_ONFOOT_CAMERA_MODE?)
|
||||||
|
return 0;
|
||||||
|
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:
|
||||||
|
{
|
||||||
|
// TODO (SET_HELP_MESSAGE?)
|
||||||
|
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
// 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_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:
|
||||||
|
{
|
||||||
|
char tmp[12]; // TODO
|
||||||
|
CTheScripts::ReadTextLabelFromScript(&m_nIp, tmp);
|
||||||
|
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
||||||
|
// TODO (CHANGE_STORED_PLAYER_OUTFIT?)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
case COMMAND_1646:
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
// TODO (DISABLE_PAUSE_MENU?)
|
||||||
|
return 0;
|
||||||
|
case COMMAND_1647:
|
||||||
|
CollectParameters(&m_nIp, 1);
|
||||||
|
// TODO (IS_CHANNEL_PLAYING?)
|
||||||
|
UpdateCompareFlag(false);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_1648:
|
||||||
|
CollectParameters(&m_nIp, 3);
|
||||||
|
// TODO (SET_CLOCK_EVENT_WARNING);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_1649:
|
||||||
|
CollectParameters(&m_nIp, 3);
|
||||||
|
// TODO (SET_EXTRA_COLOUR_DIRECTION)
|
||||||
|
return 0;
|
||||||
|
case COMMAND_1650:
|
||||||
|
script_assert(false);
|
||||||
|
return 0;
|
||||||
|
case COMMAND_1651:
|
||||||
|
script_assert(false);
|
||||||
|
return 0;
|
||||||
|
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;
|
return 0;
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
script_assert(0);
|
script_assert(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,6 +215,11 @@ enum {
|
||||||
COMMAND_WHILE,
|
COMMAND_WHILE,
|
||||||
COMMAND_WHILENOT,
|
COMMAND_WHILENOT,
|
||||||
COMMAND_ENDWHILE,
|
COMMAND_ENDWHILE,
|
||||||
|
COMMAND_214,
|
||||||
|
COMMAND_215,
|
||||||
|
COMMAND_216,
|
||||||
|
COMMAND_217,
|
||||||
|
COMMAND_218,
|
||||||
COMMAND_ANDOR,
|
COMMAND_ANDOR,
|
||||||
COMMAND_LAUNCH_MISSION,
|
COMMAND_LAUNCH_MISSION,
|
||||||
COMMAND_MISSION_HAS_FINISHED,
|
COMMAND_MISSION_HAS_FINISHED,
|
||||||
|
@ -1437,39 +1442,222 @@ enum {
|
||||||
COMMAND_REGISTER_FIRE_LEVEL,
|
COMMAND_REGISTER_FIRE_LEVEL,
|
||||||
COMMAND_IS_AUSTRALIAN_GAME,
|
COMMAND_IS_AUSTRALIAN_GAME,
|
||||||
COMMAND_DISARM_CAR_BOMB,
|
COMMAND_DISARM_CAR_BOMB,
|
||||||
#if (defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT)
|
|
||||||
COMMAND_IS_JAPANESE_GAME,
|
COMMAND_IS_JAPANESE_GAME,
|
||||||
#elif (!defined GTA_PS2)
|
COMMAND_1442,
|
||||||
COMMAND_SET_ONSCREEN_COUNTER_FLASH_WHEN_FIRST_DISPLAYED,
|
COMMAND_1443,
|
||||||
#endif
|
COMMAND_1444,
|
||||||
#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
|
COMMAND_1445,
|
||||||
COMMAND_SHUFFLE_CARD_DECKS,
|
COMMAND_1446,
|
||||||
COMMAND_FETCH_NEXT_CARD,
|
COMMAND_1447,
|
||||||
COMMAND_GET_OBJECT_VELOCITY,
|
COMMAND_1448,
|
||||||
COMMAND_IS_DEBUG_CAMERA_ON,
|
COMMAND_1449,
|
||||||
COMMAND_ADD_TO_OBJECT_ROTATION_VELOCITY,
|
COMMAND_1450,
|
||||||
COMMAND_SET_OBJECT_ROTATION_VELOCITY,
|
COMMAND_1451,
|
||||||
COMMAND_IS_OBJECT_STATIC,
|
COMMAND_1452,
|
||||||
COMMAND_GET_ANGLE_BETWEEN_2D_VECTORS,
|
COMMAND_1453,
|
||||||
COMMAND_DO_2D_RECTANGLES_COLLIDE,
|
COMMAND_CALL,
|
||||||
COMMAND_GET_OBJECT_ROTATION_VELOCITY,
|
COMMAND_NOTCALL,
|
||||||
COMMAND_ADD_VELOCITY_RELATIVE_TO_OBJECT_VELOCITY,
|
COMMAND_1456,
|
||||||
COMMAND_GET_OBJECT_SPEED,
|
COMMAND_1457,
|
||||||
#endif
|
COMMAND_1458,
|
||||||
#if (defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT)
|
COMMAND_1459,
|
||||||
COMMAND_MARK_CUTSCENE_START,
|
COMMAND_1460,
|
||||||
COMMAND_MARK_CUTSCENE_END,
|
COMMAND_1461,
|
||||||
COMMAND_CUTSCENE_SCROLL,
|
COMMAND_1462,
|
||||||
#elif (defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
|
COMMAND_1463,
|
||||||
COMMAND_IS_MISSION_SKIP,
|
COMMAND_1464,
|
||||||
COMMAND_SET_IN_AMMUNATION,
|
COMMAND_1465,
|
||||||
COMMAND_DO_SAVE_GAME,
|
COMMAND_1466,
|
||||||
COMMAND_IS_RETRY,
|
COMMAND_1467,
|
||||||
COMMAND_DUMMY,
|
COMMAND_1468,
|
||||||
COMMAND_MARK_CUTSCENE_START,
|
COMMAND_1469,
|
||||||
COMMAND_MARK_CUTSCENE_END,
|
COMMAND_1470,
|
||||||
COMMAND_CUTSCENE_SCROLL,
|
COMMAND_1471,
|
||||||
#endif
|
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
|
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||||
LAST_SCRIPT_COMMAND
|
LAST_SCRIPT_COMMAND
|
||||||
#endif
|
#endif
|
||||||
|
@ -1488,7 +1676,9 @@ enum eScriptArgument
|
||||||
ARGTYPE_PED_HANDLE,
|
ARGTYPE_PED_HANDLE,
|
||||||
ARGTYPE_VEHICLE_HANDLE,
|
ARGTYPE_VEHICLE_HANDLE,
|
||||||
ARGTYPE_OBJECT_HANDLE,
|
ARGTYPE_OBJECT_HANDLE,
|
||||||
ARGTYPE_ANDOR
|
ARGTYPE_ANDOR,
|
||||||
|
ARGTYPE_LIST,
|
||||||
|
ARGTYPE_FUNCTION
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tScriptCommandData
|
struct tScriptCommandData
|
||||||
|
|
|
@ -123,6 +123,7 @@ CCam::Process(void)
|
||||||
else
|
else
|
||||||
TargetOrientation = CGeneral::GetATanOfXY(CamTargetEntity->GetForward().x, CamTargetEntity->GetForward().y);
|
TargetOrientation = CGeneral::GetATanOfXY(CamTargetEntity->GetForward().x, CamTargetEntity->GetForward().y);
|
||||||
|
|
||||||
|
/* LCS: removed
|
||||||
CVector Fwd(0.0f, 0.0f, 0.0f);
|
CVector Fwd(0.0f, 0.0f, 0.0f);
|
||||||
Fwd.x = CamTargetEntity->GetForward().x;
|
Fwd.x = CamTargetEntity->GetForward().x;
|
||||||
Fwd.y = CamTargetEntity->GetForward().y;
|
Fwd.y = CamTargetEntity->GetForward().y;
|
||||||
|
@ -140,6 +141,9 @@ CCam::Process(void)
|
||||||
else
|
else
|
||||||
TargetSpeedVar = -Min(Sqrt(SQR(FwdSpeedX) + SQR(FwdSpeedY))/1.8f, 0.5f);
|
TargetSpeedVar = -Min(Sqrt(SQR(FwdSpeedX) + SQR(FwdSpeedY))/1.8f, 0.5f);
|
||||||
SpeedVar = 0.895f*SpeedVar + 0.105*TargetSpeedVar;
|
SpeedVar = 0.895f*SpeedVar + 0.105*TargetSpeedVar;
|
||||||
|
*/
|
||||||
|
SpeedVar = 0.0f;
|
||||||
|
TargetSpeedVar = 0.0f;
|
||||||
}else{
|
}else{
|
||||||
if(CamTargetEntity == FindPlayerPed()){
|
if(CamTargetEntity == FindPlayerPed()){
|
||||||
// Some fancy smoothing of player position and speed
|
// Some fancy smoothing of player position and speed
|
||||||
|
@ -3947,11 +3951,11 @@ CCam::Process_Debug(const CVector&, float, float, float)
|
||||||
}
|
}
|
||||||
|
|
||||||
// stay inside sectors
|
// stay inside sectors
|
||||||
while(CWorld::GetSectorX(Source.x) > 75.0f)
|
while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f)
|
||||||
Source.x -= 1.0f;
|
Source.x -= 1.0f;
|
||||||
while(CWorld::GetSectorX(Source.x) < 5.0f)
|
while(CWorld::GetSectorX(Source.x) < 5.0f)
|
||||||
Source.x += 1.0f;
|
Source.x += 1.0f;
|
||||||
while(CWorld::GetSectorY(Source.y) > 75.0f)
|
while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f)
|
||||||
Source.y -= 1.0f;
|
Source.y -= 1.0f;
|
||||||
while(CWorld::GetSectorY(Source.y) < 5.0f)
|
while(CWorld::GetSectorY(Source.y) < 5.0f)
|
||||||
Source.y += 1.0f;
|
Source.y += 1.0f;
|
||||||
|
@ -4018,11 +4022,11 @@ CCam::Process_Debug(const CVector&, float, float, float)
|
||||||
}
|
}
|
||||||
|
|
||||||
// stay inside sectors
|
// stay inside sectors
|
||||||
while(CWorld::GetSectorX(Source.x) > 75.0f)
|
while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f)
|
||||||
Source.x -= 1.0f;
|
Source.x -= 1.0f;
|
||||||
while(CWorld::GetSectorX(Source.x) < 5.0f)
|
while(CWorld::GetSectorX(Source.x) < 5.0f)
|
||||||
Source.x += 1.0f;
|
Source.x += 1.0f;
|
||||||
while(CWorld::GetSectorY(Source.y) > 75.0f)
|
while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f)
|
||||||
Source.y -= 1.0f;
|
Source.y -= 1.0f;
|
||||||
while(CWorld::GetSectorY(Source.y) < 5.0f)
|
while(CWorld::GetSectorY(Source.y) < 5.0f)
|
||||||
Source.y += 1.0f;
|
Source.y += 1.0f;
|
||||||
|
@ -4099,11 +4103,11 @@ CCam::Process_Editor(const CVector&, float, float, float)
|
||||||
}
|
}
|
||||||
|
|
||||||
// stay inside sectors
|
// stay inside sectors
|
||||||
while(CWorld::GetSectorX(Source.x) > 75.0f)
|
while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f)
|
||||||
Source.x -= 1.0f;
|
Source.x -= 1.0f;
|
||||||
while(CWorld::GetSectorX(Source.x) < 5.0f)
|
while(CWorld::GetSectorX(Source.x) < 5.0f)
|
||||||
Source.x += 1.0f;
|
Source.x += 1.0f;
|
||||||
while(CWorld::GetSectorY(Source.y) > 75.0f)
|
while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f)
|
||||||
Source.y -= 1.0f;
|
Source.y -= 1.0f;
|
||||||
while(CWorld::GetSectorY(Source.y) < 5.0f)
|
while(CWorld::GetSectorY(Source.y) < 5.0f)
|
||||||
Source.y += 1.0f;
|
Source.y += 1.0f;
|
||||||
|
|
|
@ -20,6 +20,7 @@ uint16 CClock::ms_Stored_nGameClockSeconds;
|
||||||
uint32 CClock::ms_nMillisecondsPerGameMinute;
|
uint32 CClock::ms_nMillisecondsPerGameMinute;
|
||||||
uint32 CClock::ms_nLastClockTick;
|
uint32 CClock::ms_nLastClockTick;
|
||||||
bool CClock::ms_bClockHasBeenStored;
|
bool CClock::ms_bClockHasBeenStored;
|
||||||
|
float CClock::ms_EnvMapTimeMultiplicator;
|
||||||
|
|
||||||
#ifndef MASTER
|
#ifndef MASTER
|
||||||
bool gbFreezeTime;
|
bool gbFreezeTime;
|
||||||
|
@ -35,6 +36,7 @@ CClock::Initialise(uint32 scale)
|
||||||
ms_nMillisecondsPerGameMinute = scale;
|
ms_nMillisecondsPerGameMinute = scale;
|
||||||
ms_nLastClockTick = CTimer::GetTimeInMilliseconds();
|
ms_nLastClockTick = CTimer::GetTimeInMilliseconds();
|
||||||
ms_bClockHasBeenStored = false;
|
ms_bClockHasBeenStored = false;
|
||||||
|
ms_EnvMapTimeMultiplicator = 1.0f;
|
||||||
debug("CClock ready\n");
|
debug("CClock ready\n");
|
||||||
#ifndef MASTER
|
#ifndef MASTER
|
||||||
VarConsole.Add("Time (hour of day)", &ms_nGameClockHours, 1, 0, 23, true);
|
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_nGameClockMinutes = ms_Stored_nGameClockMinutes;
|
||||||
ms_nGameClockSeconds = ms_Stored_nGameClockSeconds;
|
ms_nGameClockSeconds = ms_Stored_nGameClockSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CClock::CalcEnvMapTimeMultiplicator(void)
|
||||||
|
{
|
||||||
|
float nightness = Abs(ms_nGameClockHours/24.0f - 0.5f);
|
||||||
|
ms_EnvMapTimeMultiplicator = SQR(1.0f - nightness);;
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ public:
|
||||||
static uint32 ms_nMillisecondsPerGameMinute;
|
static uint32 ms_nMillisecondsPerGameMinute;
|
||||||
static uint32 ms_nLastClockTick;
|
static uint32 ms_nLastClockTick;
|
||||||
static bool ms_bClockHasBeenStored;
|
static bool ms_bClockHasBeenStored;
|
||||||
|
static float ms_EnvMapTimeMultiplicator;
|
||||||
|
|
||||||
static void Initialise(uint32 scale);
|
static void Initialise(uint32 scale);
|
||||||
static void Update(void);
|
static void Update(void);
|
||||||
|
@ -21,6 +22,8 @@ public:
|
||||||
static void StoreClock(void);
|
static void StoreClock(void);
|
||||||
static void RestoreClock(void);
|
static void RestoreClock(void);
|
||||||
|
|
||||||
|
static void CalcEnvMapTimeMultiplicator(void);
|
||||||
|
|
||||||
static uint8 GetHours(void) { return ms_nGameClockHours; }
|
static uint8 GetHours(void) { return ms_nGameClockHours; }
|
||||||
static uint8 GetMinutes(void) { return ms_nGameClockMinutes; }
|
static uint8 GetMinutes(void) { return ms_nGameClockMinutes; }
|
||||||
static int16 GetSeconds(void) { return ms_nGameClockSeconds; }
|
static int16 GetSeconds(void) { return ms_nGameClockSeconds; }
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "FrontEndControls.h"
|
#include "FrontEndControls.h"
|
||||||
|
|
||||||
#define X SCREEN_SCALE_X
|
#define X SCREEN_SCALE_X
|
||||||
#define Y(x) SCREEN_SCALE_Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(DEFAULT_SCREEN_HEIGHT_PAL)))
|
#define Y(x) SCREEN_SCALE_Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(SCREEN_HEIGHT_PAL)))
|
||||||
|
|
||||||
void
|
void
|
||||||
CPlaceableShText::Draw(float x, float y)
|
CPlaceableShText::Draw(float x, float y)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <dinput.h>
|
#include <dinput.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define FORCE_PC_SCALING
|
||||||
#define WITHWINDOWS
|
#define WITHWINDOWS
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#ifndef PS2_MENU
|
#ifndef PS2_MENU
|
||||||
|
@ -58,6 +59,19 @@ const CRGBA RADIO_SELECTOR_COLOR = SLIDEROFF_COLOR;
|
||||||
const CRGBA INACTIVE_RADIO_COLOR(100, 100, 255, 100);
|
const CRGBA INACTIVE_RADIO_COLOR(100, 100, 255, 100);
|
||||||
const CRGBA SCROLLBAR_COLOR = LABEL_COLOR;
|
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_MIN_SIZE 162.f
|
||||||
#define MAP_SIZE_TO_ALLOW_X_MOVE 297.f
|
#define MAP_SIZE_TO_ALLOW_X_MOVE 297.f
|
||||||
|
|
||||||
|
@ -465,7 +479,7 @@ CMenuManager::CMenuManager()
|
||||||
m_PrefsMusicVolume = 49;
|
m_PrefsMusicVolume = 49;
|
||||||
m_PrefsRadioStation = 0;
|
m_PrefsRadioStation = 0;
|
||||||
m_PrefsStereoMono = 1;
|
m_PrefsStereoMono = 1;
|
||||||
m_PrefsBrightness = 256;
|
m_PrefsBrightness = DEFAULT_BRIGHTNESS;
|
||||||
m_PrefsLOD = CRenderer::ms_lodDistScale;
|
m_PrefsLOD = CRenderer::ms_lodDistScale;
|
||||||
m_KeyPressedCode = -1;
|
m_KeyPressedCode = -1;
|
||||||
m_bFrontEnd_ReloadObrTxtGxt = false;
|
m_bFrontEnd_ReloadObrTxtGxt = false;
|
||||||
|
@ -674,8 +688,8 @@ CMenuManager::CheckSliderMovement(int value)
|
||||||
{
|
{
|
||||||
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
|
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
|
||||||
case MENUACTION_BRIGHTNESS:
|
case MENUACTION_BRIGHTNESS:
|
||||||
m_PrefsBrightness += value * 24.19f;
|
m_PrefsBrightness += value * 32.0f;
|
||||||
m_PrefsBrightness = clamp(m_PrefsBrightness, 0, 384);
|
m_PrefsBrightness = clamp(m_PrefsBrightness, MIN_BRIGHTNESS, MAX_BRIGHTNESS);
|
||||||
break;
|
break;
|
||||||
case MENUACTION_DRAWDIST:
|
case MENUACTION_DRAWDIST:
|
||||||
if(value > 0)
|
if(value > 0)
|
||||||
|
@ -1464,7 +1478,7 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
|
||||||
int lastActiveBarX;
|
int lastActiveBarX;
|
||||||
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
|
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
|
||||||
case MENUACTION_BRIGHTNESS:
|
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;
|
break;
|
||||||
case MENUACTION_DRAWDIST:
|
case MENUACTION_DRAWDIST:
|
||||||
ProcessSlider((m_PrefsLOD - 0.925f) / 0.875f, 99.0f, HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST, SCREEN_WIDTH, true);
|
ProcessSlider((m_PrefsLOD - 0.925f) / 0.875f, 99.0f, HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST, SCREEN_WIDTH, true);
|
||||||
|
@ -4736,7 +4750,7 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
|
||||||
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
|
DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1);
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
} else if (m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) {
|
} else if (m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) {
|
||||||
m_PrefsBrightness = 256;
|
m_PrefsBrightness = DEFAULT_BRIGHTNESS;
|
||||||
m_PrefsLOD = 1.2f;
|
m_PrefsLOD = 1.2f;
|
||||||
#ifdef LEGACY_MENU_OPTIONS
|
#ifdef LEGACY_MENU_OPTIONS
|
||||||
m_PrefsVsync = true;
|
m_PrefsVsync = true;
|
||||||
|
|
|
@ -43,7 +43,7 @@ void DoRWStuffEndOfFrame(void);
|
||||||
#define X SCREEN_SCALE_X
|
#define X SCREEN_SCALE_X
|
||||||
#define Y SCREEN_SCALE_Y
|
#define Y SCREEN_SCALE_Y
|
||||||
|
|
||||||
#define YF(x) Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(DEFAULT_SCREEN_HEIGHT_PAL)))
|
#define YF(x) Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(SCREEN_HEIGHT_PAL)))
|
||||||
//#define X(x) ((x)/640.0f*SCRW)
|
//#define X(x) ((x)/640.0f*SCRW)
|
||||||
//#define Y(y) ((y)/448.0f*SCRH)
|
//#define Y(y) ((y)/448.0f*SCRH)
|
||||||
|
|
||||||
|
|
|
@ -901,7 +901,7 @@ void CGame::Process(void)
|
||||||
if (!CReplay::IsPlayingBack())
|
if (!CReplay::IsPlayingBack())
|
||||||
CCranes::UpdateCranes();
|
CCranes::UpdateCranes();
|
||||||
CClouds::Update();
|
CClouds::Update();
|
||||||
CMovingThings::Update();
|
//CMovingThings::Update(); // TODO
|
||||||
CWaterCannons::Update();
|
CWaterCannons::Update();
|
||||||
CUserDisplay::Process();
|
CUserDisplay::Process();
|
||||||
CReplay::Update();
|
CReplay::Update();
|
||||||
|
|
|
@ -80,4 +80,4 @@ public:
|
||||||
static void ProcessTidyUpMemory(void);
|
static void ProcessTidyUpMemory(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool IsAreaVisible(int area) { return area == CGame::currArea || area == AREA_EVERYWHERE; }
|
inline bool IsAreaVisible(int area) { return true; }
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
// --MIAMI: file done
|
// --MIAMI: file done
|
||||||
|
|
||||||
float CIniFile::PedNumberMultiplier = 0.6f;
|
float CIniFile::PedNumberMultiplier = 0.6f;
|
||||||
float CIniFile::CarNumberMultiplier = 0.6f;
|
float CIniFile::CarNumberMultiplier = 0.8f;
|
||||||
|
|
||||||
void CIniFile::LoadIniFile()
|
void CIniFile::LoadIniFile()
|
||||||
{
|
{
|
||||||
|
@ -27,5 +27,5 @@ void CIniFile::LoadIniFile()
|
||||||
}
|
}
|
||||||
CPopulation::MaxNumberOfPedsInUse = 25.0f * PedNumberMultiplier;
|
CPopulation::MaxNumberOfPedsInUse = 25.0f * PedNumberMultiplier;
|
||||||
CPopulation::MaxNumberOfPedsInUseInterior = 40.0f * PedNumberMultiplier;
|
CPopulation::MaxNumberOfPedsInUseInterior = 40.0f * PedNumberMultiplier;
|
||||||
CCarCtrl::MaxNumberOfCarsInUse = 12.0f * CarNumberMultiplier;
|
CCarCtrl::MaxNumberOfCarsInUse = 30.0f * CarNumberMultiplier;
|
||||||
}
|
}
|
|
@ -1,10 +1,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "KeyGen.h"
|
#include "KeyGen.h"
|
||||||
#if defined _WIN32 && !defined __MINGW32__
|
#include <ctype.h>
|
||||||
#include "ctype.h"
|
|
||||||
#else
|
|
||||||
#include <cwctype>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint32 CKeyGen::keyTable[256] =
|
uint32 CKeyGen::keyTable[256] =
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,6 +164,8 @@ public:
|
||||||
int32 LastTimeTouched;
|
int32 LastTimeTouched;
|
||||||
int32 AverageWeapon;
|
int32 AverageWeapon;
|
||||||
int32 AverageEntries;
|
int32 AverageEntries;
|
||||||
|
float unk_B4;
|
||||||
|
float unk_B8;
|
||||||
|
|
||||||
#ifdef DETECT_PAD_INPUT_SWITCH
|
#ifdef DETECT_PAD_INPUT_SWITCH
|
||||||
static bool IsAffectedByController;
|
static bool IsAffectedByController;
|
||||||
|
|
|
@ -132,7 +132,7 @@ CPlayerInfo::Process(void)
|
||||||
CAutomobile *car = (CAutomobile*)m_pPed->m_pMyVehicle;
|
CAutomobile *car = (CAutomobile*)m_pPed->m_pMyVehicle;
|
||||||
|
|
||||||
if (car->m_nWheelsOnGround < 3)
|
if (car->m_nWheelsOnGround < 3)
|
||||||
m_nTimeNotFullyOnGround += CTimer::GetTimeInMilliseconds();
|
m_nTimeNotFullyOnGround += CTimer::GetTimeStepInMilliseconds();
|
||||||
else
|
else
|
||||||
m_nTimeNotFullyOnGround = 0;
|
m_nTimeNotFullyOnGround = 0;
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,11 @@ CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = {
|
||||||
&RadioVCPRSprite,
|
&RadioVCPRSprite,
|
||||||
&RadioEspantosoSprite,
|
&RadioEspantosoSprite,
|
||||||
&RadioEmotionSprite,
|
&RadioEmotionSprite,
|
||||||
|
&RadioWaveSprite, // tmp hack
|
||||||
|
&RadioWaveSprite,
|
||||||
|
&RadioWaveSprite,
|
||||||
|
&RadioWaveSprite,
|
||||||
|
&RadioWaveSprite,
|
||||||
&RadioWaveSprite
|
&RadioWaveSprite
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1689,6 +1694,7 @@ CRadar::DrawLegend(int32 x, int32 y, int32 sprite)
|
||||||
text = TheText.Get("LG_34");
|
text = TheText.Get("LG_34");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
text = TheText.Get("LG_34"); // tmp hack
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CFont::PrintString(SCREEN_SCALE_X(20.f) + x, SCREEN_SCALE_Y(3.0f) + y, text);
|
CFont::PrintString(SCREEN_SCALE_X(20.f) + x, SCREEN_SCALE_Y(3.0f) + y, text);
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
#define OBJECTBLIP_MARKER_COLOR_B 242
|
#define OBJECTBLIP_MARKER_COLOR_B 242
|
||||||
#define OBJECTBLIP_MARKER_COLOR_A 255
|
#define OBJECTBLIP_MARKER_COLOR_A 255
|
||||||
|
|
||||||
#define COORDBLIP_MARKER_COLOR_R 252
|
#define COORDBLIP_MARKER_COLOR_R 255
|
||||||
#define COORDBLIP_MARKER_COLOR_G 138
|
#define COORDBLIP_MARKER_COLOR_G 255
|
||||||
#define COORDBLIP_MARKER_COLOR_B 242
|
#define COORDBLIP_MARKER_COLOR_B 128
|
||||||
#define COORDBLIP_MARKER_COLOR_A 228
|
#define COORDBLIP_MARKER_COLOR_A 228
|
||||||
|
|
||||||
#define NUM_MAP_LEGENDS 75
|
#define NUM_MAP_LEGENDS 75
|
||||||
|
@ -92,6 +92,11 @@ enum eRadarSprite
|
||||||
RADAR_SPRITE_RADIO_ESPANTOSO,
|
RADAR_SPRITE_RADIO_ESPANTOSO,
|
||||||
RADAR_SPRITE_RADIO_EMOTION,
|
RADAR_SPRITE_RADIO_EMOTION,
|
||||||
RADAR_SPRITE_RADIO_WAVE,
|
RADAR_SPRITE_RADIO_WAVE,
|
||||||
|
RADAR_SPRITE_40, // tmp
|
||||||
|
RADAR_SPRITE_41,
|
||||||
|
RADAR_SPRITE_42,
|
||||||
|
RADAR_SPRITE_43,
|
||||||
|
RADAR_SPRITE_44,
|
||||||
|
|
||||||
RADAR_SPRITE_COUNT
|
RADAR_SPRITE_COUNT
|
||||||
};
|
};
|
||||||
|
@ -156,8 +161,28 @@ struct sRadarTraceSave
|
||||||
// Values for screen space
|
// Values for screen space
|
||||||
#define RADAR_LEFT (40.0f)
|
#define RADAR_LEFT (40.0f)
|
||||||
#define RADAR_BOTTOM (40.0f)
|
#define RADAR_BOTTOM (40.0f)
|
||||||
|
|
||||||
|
#ifdef FIX_RADAR
|
||||||
|
/*
|
||||||
|
The values are from an early screenshot taken before R* broke radar
|
||||||
|
#define RADAR_WIDTH (82.0f)
|
||||||
|
#define RADAR_HEIGHT (82.0f)
|
||||||
|
*/
|
||||||
|
#define RADAR_WIDTH ((CDraw::ms_bFixRadar) ? (82.0f) : (94.0f))
|
||||||
|
#define RADAR_HEIGHT ((CDraw::ms_bFixRadar) ? (82.0f) : (76.0f))
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
broken since forever, someone tried to fix size for 640x512(PAL)
|
||||||
|
http://aap.rockstarvision.com/pics/gta3/ps2screens/gta3_interface.jpg
|
||||||
|
but failed:
|
||||||
|
http://aap.rockstarvision.com/pics/gta3/artwork/gta3_artwork_16.jpg
|
||||||
|
most likely the guy used something like this:
|
||||||
|
int y = 82 * (640.0/512.0)/(640.0/480.0);
|
||||||
|
int x = y * (640.0/512.0);
|
||||||
|
*/
|
||||||
#define RADAR_WIDTH (94.0f)
|
#define RADAR_WIDTH (94.0f)
|
||||||
#define RADAR_HEIGHT (76.0f)
|
#define RADAR_HEIGHT (76.0f)
|
||||||
|
#endif
|
||||||
|
|
||||||
class CRadar
|
class CRadar
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
#include "Frontend.h"
|
#include "Frontend.h"
|
||||||
#include "VarConsole.h"
|
#include "VarConsole.h"
|
||||||
|
#include "KeyGen.h"
|
||||||
|
|
||||||
//--MIAMI: file done (possibly bugs)
|
//--MIAMI: file done (possibly bugs)
|
||||||
|
|
||||||
|
@ -948,53 +949,45 @@ CStreaming::RequestIslands(eLevelName level)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *IGnames[] = {
|
const char *csPlayerNames[] =
|
||||||
"player",
|
{
|
||||||
"player2",
|
"csplr",
|
||||||
"player3",
|
"csplr2",
|
||||||
"player4",
|
"csplr3",
|
||||||
"player5",
|
"csplr4",
|
||||||
"player6",
|
"csplr5",
|
||||||
"player7",
|
"csplr6",
|
||||||
"player8",
|
"csplr7",
|
||||||
"player9",
|
"csplr8",
|
||||||
"play10",
|
"csplr9",
|
||||||
"play11",
|
"csplr10",
|
||||||
"igken",
|
"csplr11",
|
||||||
"igcandy",
|
"csplr12",
|
||||||
"igsonny",
|
"csplr13",
|
||||||
"igbuddy",
|
"csplr14",
|
||||||
"igjezz",
|
"csplr15",
|
||||||
"ighlary",
|
"csplr16",
|
||||||
"igphil",
|
|
||||||
"igmerc",
|
|
||||||
"igdick",
|
|
||||||
"igdiaz",
|
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *CSnames[] = {
|
const char* playerNames[] =
|
||||||
"csplay",
|
{
|
||||||
"csplay2",
|
"plr",
|
||||||
"csplay3",
|
"plr2",
|
||||||
"csplay4",
|
"plr3",
|
||||||
"csplay5",
|
"plr4",
|
||||||
"csplay6",
|
"plr5",
|
||||||
"csplay7",
|
"plr6",
|
||||||
"csplay8",
|
"plr7",
|
||||||
"csplay9",
|
"plr8",
|
||||||
"csplay10",
|
"plr9",
|
||||||
"csplay11",
|
"plr10",
|
||||||
"csken",
|
"plr11",
|
||||||
"cscandy",
|
"plr12",
|
||||||
"cssonny",
|
"plr13",
|
||||||
"csbuddy",
|
"plr14",
|
||||||
"csjezz",
|
"plr15",
|
||||||
"cshlary",
|
"plr16",
|
||||||
"csphil",
|
|
||||||
"csmerc",
|
|
||||||
"csdick",
|
|
||||||
"csdiaz",
|
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1008,15 +1001,17 @@ CStreaming::RequestSpecialModel(int32 modelId, const char *modelName, int32 flag
|
||||||
int i, n;
|
int i, n;
|
||||||
|
|
||||||
mi = CModelInfo::GetModelInfo(modelId);
|
mi = CModelInfo::GetModelInfo(modelId);
|
||||||
if(strncasecmp("CSPlay", modelName, 6) == 0){
|
if (CKeyGen::GetUppercaseKey(modelName) == CKeyGen::GetUppercaseKey("cstoni_a")) {
|
||||||
char *curname = CModelInfo::GetModelInfo(MI_PLAYER)->GetModelName();
|
i = 0;
|
||||||
for(int i = 0; CSnames[i][0]; i++){
|
while (csPlayerNames[i][0] != '\0') {
|
||||||
if(strcasecmp(curname, IGnames[i]) == 0){
|
if (CModelInfo::GetModelInfo(0)->GetNameHashKey() == CKeyGen::GetUppercaseKey(playerNames[i])) {
|
||||||
modelName = CSnames[i];
|
modelName = csPlayerNames[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!CGeneral::faststrcmp(mi->GetModelName(), modelName)){
|
if(!CGeneral::faststrcmp(mi->GetModelName(), modelName)){
|
||||||
// Already have the correct name, just request it
|
// Already have the correct name, just request it
|
||||||
RequestModel(modelId, flags);
|
RequestModel(modelId, flags);
|
||||||
|
@ -1151,12 +1146,9 @@ CStreaming::RemoveModel(int32 id)
|
||||||
void
|
void
|
||||||
CStreaming::RemoveUnusedBuildings(eLevelName level)
|
CStreaming::RemoveUnusedBuildings(eLevelName level)
|
||||||
{
|
{
|
||||||
if(level != LEVEL_INDUSTRIAL)
|
for(int i = LEVEL_INDUSTRIAL; i < NUM_LEVELS; i++)
|
||||||
RemoveBuildings(LEVEL_INDUSTRIAL);
|
if(level != i)
|
||||||
if(level != LEVEL_COMMERCIAL)
|
RemoveBuildings((eLevelName)i);
|
||||||
RemoveBuildings(LEVEL_COMMERCIAL);
|
|
||||||
if(level != LEVEL_SUBURBAN)
|
|
||||||
RemoveBuildings(LEVEL_SUBURBAN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1279,12 +1271,9 @@ CStreaming::RemoveUnusedBigBuildings(eLevelName level)
|
||||||
{
|
{
|
||||||
ISLAND_LOADING_IS(LOW)
|
ISLAND_LOADING_IS(LOW)
|
||||||
{
|
{
|
||||||
if(level != LEVEL_INDUSTRIAL)
|
for(int i = LEVEL_INDUSTRIAL; i < NUM_LEVELS; i++)
|
||||||
RemoveBigBuildings(LEVEL_INDUSTRIAL);
|
if(level != i)
|
||||||
if(level != LEVEL_COMMERCIAL)
|
RemoveBuildings((eLevelName)i);
|
||||||
RemoveBigBuildings(LEVEL_COMMERCIAL);
|
|
||||||
if(level != LEVEL_SUBURBAN)
|
|
||||||
RemoveBigBuildings(LEVEL_SUBURBAN);
|
|
||||||
}
|
}
|
||||||
RemoveIslandsNotUsed(level);
|
RemoveIslandsNotUsed(level);
|
||||||
}
|
}
|
||||||
|
@ -1324,8 +1313,11 @@ CStreaming::RemoveIslandsNotUsed(eLevelName level)
|
||||||
}
|
}
|
||||||
#ifdef NO_ISLAND_LOADING
|
#ifdef NO_ISLAND_LOADING
|
||||||
if(FrontEndMenuManager.m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_HIGH) {
|
if(FrontEndMenuManager.m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_HIGH) {
|
||||||
DeleteIsland(pIslandLODmainlandEntity);
|
DeleteIsland(pIslandLODindustEntity);
|
||||||
DeleteIsland(pIslandLODbeachEntity);
|
DeleteIsland(pIslandLODcomIndEntity);
|
||||||
|
DeleteIsland(pIslandLODcomSubEntity);
|
||||||
|
DeleteIsland(pIslandLODsubIndEntity);
|
||||||
|
DeleteIsland(pIslandLODsubComEntity);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
switch(level){
|
switch(level){
|
||||||
|
|
|
@ -17,6 +17,8 @@ enum StreamFlags
|
||||||
STREAMFLAGS_PRIORITY = 0x08,
|
STREAMFLAGS_PRIORITY = 0x08,
|
||||||
STREAMFLAGS_NOFADE = 0x10,
|
STREAMFLAGS_NOFADE = 0x10,
|
||||||
STREAMFLAGS_20 = 0x20, // TODO(MIAMI): what's this
|
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_CANT_REMOVE = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED,
|
||||||
STREAMFLAGS_KEEP_IN_MEMORY = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED|STREAMFLAGS_DEPENDENCY,
|
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 HasColLoaded(int32 id) { return HasModelLoaded(id+STREAM_OFFSET_COL); }
|
||||||
static bool HasAnimLoaded(int32 id) { return HasModelLoaded(id+STREAM_OFFSET_ANIM); }
|
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 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 CanRemoveTxd(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_TXD); }
|
||||||
static bool CanRemoveCol(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_COL); }
|
static bool CanRemoveCol(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_COL); }
|
||||||
static bool CanRemoveAnim(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_ANIM); }
|
static bool CanRemoveAnim(int32 id) { return CanRemoveModel(id+STREAM_OFFSET_ANIM); }
|
||||||
|
@ -213,3 +216,10 @@ public:
|
||||||
|
|
||||||
static void PrintStreamingBufferState();
|
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;
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
int32 NumOfHelisRequired();
|
int32 NumOfHelisRequired();
|
||||||
void SetWantedLevel(int32);
|
void SetWantedLevel(int32);
|
||||||
void SetWantedLevelNoDrop(int32 level);
|
void SetWantedLevelNoDrop(int32 level);
|
||||||
|
int32 GetWantedLevel() { return m_nWantedLevel; }
|
||||||
void CheatWantedLevel(int32 level);
|
void CheatWantedLevel(int32 level);
|
||||||
void RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
|
void RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
|
||||||
void RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
|
void RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
|
||||||
|
|
|
@ -93,6 +93,7 @@ typedef ptrdiff_t ssize_t;
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "memoryManager.h"
|
#include "memoryManager.h"
|
||||||
|
#include "relocatableChunk.h"
|
||||||
|
|
||||||
#include <rphanim.h>
|
#include <rphanim.h>
|
||||||
#include <rpskin.h>
|
#include <rpskin.h>
|
||||||
|
@ -124,17 +125,43 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
|
||||||
#include "skeleton.h"
|
#include "skeleton.h"
|
||||||
#include "Draw.h"
|
#include "Draw.h"
|
||||||
|
|
||||||
#define DEFAULT_SCREEN_WIDTH (640)
|
#if defined(PROPER_SCALING)
|
||||||
#define DEFAULT_SCREEN_HEIGHT (448)
|
#ifdef FORCE_PC_SCALING
|
||||||
#define DEFAULT_SCREEN_HEIGHT_PAL (512)
|
#define DEFAULT_SCREEN_WIDTH (640)
|
||||||
#define DEFAULT_SCREEN_HEIGHT_NTSC (448)
|
#define DEFAULT_SCREEN_HEIGHT (448)
|
||||||
|
#else
|
||||||
|
#define DEFAULT_SCREEN_WIDTH (640)
|
||||||
|
#define DEFAULT_SCREEN_HEIGHT (480)
|
||||||
|
#endif
|
||||||
|
#elif defined(GTA_PS2)
|
||||||
|
#define DEFAULT_SCREEN_WIDTH (640)
|
||||||
|
#define DEFAULT_SCREEN_HEIGHT (480)
|
||||||
|
#else //elif defined(GTA_PC)
|
||||||
|
#define DEFAULT_SCREEN_WIDTH (640)
|
||||||
|
#define DEFAULT_SCREEN_HEIGHT (448)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DEFAULT_ASPECT_RATIO (4.0f/3.0f)
|
#define DEFAULT_ASPECT_RATIO (4.0f/3.0f)
|
||||||
#define DEFAULT_VIEWWINDOW (0.7f)
|
#define DEFAULT_VIEWWINDOW (0.7f)
|
||||||
|
|
||||||
// game uses maximumWidth/Height, but this probably won't work
|
// game uses maximumWidth/Height, but this probably won't work
|
||||||
// with RW windowed mode
|
// with RW windowed mode
|
||||||
#define SCREEN_WIDTH ((float)RsGlobal.width)
|
#ifdef GTA_PS2
|
||||||
|
#ifdef GTA_PAL
|
||||||
|
#define SCREEN_WIDTH ((float)640)
|
||||||
|
#define SCREEN_HEIGHT ((float)512)
|
||||||
|
#else
|
||||||
|
#define SCREEN_WIDTH ((float)640)
|
||||||
|
#define SCREEN_HEIGHT ((float)448)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define SCREEN_WIDTH ((float)RsGlobal.width)
|
||||||
#define SCREEN_HEIGHT ((float)RsGlobal.height)
|
#define SCREEN_HEIGHT ((float)RsGlobal.height)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SCREEN_HEIGHT_PAL ((float)512)
|
||||||
|
#define SCREEN_HEIGHT_NTSC ((float)448)
|
||||||
|
|
||||||
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
|
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
|
||||||
#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetScaledFOV() * 0.5f)))
|
#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetScaledFOV() * 0.5f)))
|
||||||
|
|
||||||
|
@ -152,8 +179,13 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
|
||||||
|
|
||||||
#ifdef ASPECT_RATIO_SCALE
|
#ifdef ASPECT_RATIO_SCALE
|
||||||
#define SCREEN_SCALE_AR(a) ((a) * DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO)
|
#define SCREEN_SCALE_AR(a) ((a) * DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO)
|
||||||
extern float ScaleAndCenterX(float x);
|
#define SCALE_AND_CENTER_X(x) ((SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH) ? (x) : (SCREEN_WIDTH - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)) / 2 + SCREEN_SCALE_X((x)))
|
||||||
#define SCALE_AND_CENTER_X(x) ScaleAndCenterX(x)
|
#ifdef PROPER_SCALING
|
||||||
|
#ifndef FORCE_PC_SCALING
|
||||||
|
#undef SCREEN_SCALE_Y
|
||||||
|
#define SCREEN_SCALE_Y(a) CDraw::ScaleY(SCREEN_STRETCH_Y(a))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#define SCREEN_SCALE_AR(a) (a)
|
#define SCREEN_SCALE_AR(a) (a)
|
||||||
#define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x)
|
#define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x)
|
||||||
|
|
|
@ -97,7 +97,7 @@ enum Config {
|
||||||
NUMPACMANPICKUPS = 256,
|
NUMPACMANPICKUPS = 256,
|
||||||
NUMEVENTS = 64,
|
NUMEVENTS = 64,
|
||||||
|
|
||||||
NUM_CARGENS = 185,
|
NUM_CARGENS = 500,
|
||||||
|
|
||||||
NUM_PATH_NODES_IN_AUTOPILOT = 8,
|
NUM_PATH_NODES_IN_AUTOPILOT = 8,
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ enum Config {
|
||||||
|
|
||||||
NUM_GARAGE_STORED_CARS = 4,
|
NUM_GARAGE_STORED_CARS = 4,
|
||||||
|
|
||||||
NUM_CRANES = 8,
|
NUM_CRANES = 11,
|
||||||
NUM_ESCALATORS = 22,
|
NUM_ESCALATORS = 22,
|
||||||
NUM_WATER_CREATURES = 8,
|
NUM_WATER_CREATURES = 8,
|
||||||
|
|
||||||
|
@ -254,6 +254,7 @@ enum Config {
|
||||||
|
|
||||||
// Rendering/display
|
// Rendering/display
|
||||||
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
|
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
|
||||||
|
#define PROPER_SCALING // use original DEFAULT_SCREEN_WIDTH/DEFAULT_SCREEN_HEIGHT from PS2 instead of PC(R* changed HEIGHT here to make radar look better, but broke other hud elements aspect ratio).
|
||||||
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
|
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
|
||||||
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
|
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
|
||||||
#define PS2_ALPHA_TEST // emulate ps2 alpha test
|
#define PS2_ALPHA_TEST // emulate ps2 alpha test
|
||||||
|
@ -268,6 +269,8 @@ enum Config {
|
||||||
#define NEW_RENDERER // leeds-like world rendering, needs librw
|
#define NEW_RENDERER // leeds-like world rendering, needs librw
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define FIX_SPRITES // fix sprites aspect ratio(moon, coronas, particle etc)
|
||||||
|
|
||||||
#ifndef EXTENDED_COLOURFILTER
|
#ifndef EXTENDED_COLOURFILTER
|
||||||
#undef SCREEN_DROPLETS // we need the backbuffer for this effect
|
#undef SCREEN_DROPLETS // we need the backbuffer for this effect
|
||||||
#endif
|
#endif
|
||||||
|
@ -298,6 +301,8 @@ enum Config {
|
||||||
// Hud, frontend and radar
|
// Hud, frontend and radar
|
||||||
#define PC_MENU
|
#define PC_MENU
|
||||||
|
|
||||||
|
#define FIX_RADAR // use radar size from early version before R* broke it
|
||||||
|
|
||||||
#ifndef PC_MENU
|
#ifndef PC_MENU
|
||||||
# define PS2_MENU
|
# define PS2_MENU
|
||||||
//# define PS2_MENU_USEALLPAGEICONS
|
//# define PS2_MENU_USEALLPAGEICONS
|
||||||
|
@ -366,7 +371,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
|
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
|
||||||
//#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
|
#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
|
||||||
//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
|
//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
|
||||||
#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files
|
#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,10 @@ char gString2[512];
|
||||||
wchar gUString[256];
|
wchar gUString[256];
|
||||||
wchar gUString2[256];
|
wchar gUString2[256];
|
||||||
|
|
||||||
|
// leeds
|
||||||
|
bool gMakeResources = true;
|
||||||
|
bool gUseChunkFiles = false;
|
||||||
|
|
||||||
float FramesPerSecond = 30.0f;
|
float FramesPerSecond = 30.0f;
|
||||||
|
|
||||||
bool gbPrintShite = false;
|
bool gbPrintShite = false;
|
||||||
|
@ -124,7 +128,7 @@ bool gbPrintMemoryUsage;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NEW_RENDERER
|
#ifdef NEW_RENDERER
|
||||||
bool gbNewRenderer;
|
bool gbNewRenderer = true;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
// need to clear stencil for mblur fx. no idea why it works in the original game
|
// need to clear stencil for mblur fx. no idea why it works in the original game
|
||||||
|
@ -1143,10 +1147,10 @@ MattRenderScene(void)
|
||||||
/// CWorld::AdvanceCurrentScanCode();
|
/// CWorld::AdvanceCurrentScanCode();
|
||||||
// CMattRenderer::ResetRenderStates
|
// CMattRenderer::ResetRenderStates
|
||||||
/// CRenderer::ClearForFrame(); // before ConstructRenderList
|
/// CRenderer::ClearForFrame(); // before ConstructRenderList
|
||||||
// CClock::CalcEnvMapTimeMultiplicator
|
CClock::CalcEnvMapTimeMultiplicator();
|
||||||
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
|
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
|
||||||
CWaterLevel::RenderWater(); // actually CMattRenderer::RenderWater
|
CWaterLevel::RenderWater(); // actually CMattRenderer::RenderWater
|
||||||
// CClock::ms_EnvMapTimeMultiplicator = 1.0f;
|
CClock::ms_EnvMapTimeMultiplicator = 1.0f;
|
||||||
// cWorldStream::ClearDynamics
|
// cWorldStream::ClearDynamics
|
||||||
/// CRenderer::ConstructRenderList(); // before PreRender
|
/// CRenderer::ConstructRenderList(); // before PreRender
|
||||||
if(gbRenderWorld0)
|
if(gbRenderWorld0)
|
||||||
|
@ -1159,6 +1163,8 @@ if(gbRenderWorld1)
|
||||||
if(gbRenderRoads)
|
if(gbRenderRoads)
|
||||||
CRenderer::RenderRoads();
|
CRenderer::RenderRoads();
|
||||||
|
|
||||||
|
CRenderer::GenerateEnvironmentMap(); // should be after static shadows, but that's weird
|
||||||
|
|
||||||
CRenderer::RenderPeds();
|
CRenderer::RenderPeds();
|
||||||
|
|
||||||
// not sure where to put these since LCS has no underwater entities
|
// not sure where to put these since LCS has no underwater entities
|
||||||
|
@ -1172,7 +1178,7 @@ if(gbRenderWater)
|
||||||
|
|
||||||
if(gbRenderEverythingBarRoads)
|
if(gbRenderEverythingBarRoads)
|
||||||
CRenderer::RenderEverythingBarRoads();
|
CRenderer::RenderEverythingBarRoads();
|
||||||
// get env map here?
|
// seam fixer
|
||||||
// moved this:
|
// moved this:
|
||||||
// CRenderer::RenderFadingInEntities();
|
// CRenderer::RenderFadingInEntities();
|
||||||
}
|
}
|
||||||
|
@ -1195,7 +1201,6 @@ void
|
||||||
RenderEffects_new(void)
|
RenderEffects_new(void)
|
||||||
{
|
{
|
||||||
CShadows::RenderStaticShadows();
|
CShadows::RenderStaticShadows();
|
||||||
// CRenderer::GenerateEnvironmentMap
|
|
||||||
CShadows::RenderStoredShadows();
|
CShadows::RenderStoredShadows();
|
||||||
CSkidmarks::Render();
|
CSkidmarks::Render();
|
||||||
CRubbish::Render();
|
CRubbish::Render();
|
||||||
|
|
|
@ -24,6 +24,10 @@ extern bool gbShowTimebars;
|
||||||
extern bool gbPrintMemoryUsage;
|
extern bool gbPrintMemoryUsage;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// leeds
|
||||||
|
extern bool gMakeResources;
|
||||||
|
extern bool gUseChunkFiles;
|
||||||
|
|
||||||
class CSprite2d;
|
class CSprite2d;
|
||||||
|
|
||||||
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
|
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
|
||||||
|
|
|
@ -220,6 +220,16 @@ void LoadINISettings()
|
||||||
CustomPipes::GlossMult = CheckAndReadIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult);
|
CustomPipes::GlossMult = CheckAndReadIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult);
|
||||||
#endif
|
#endif
|
||||||
gBackfaceCulling = CheckAndReadIniInt("Rendering", "BackfaceCulling", gBackfaceCulling);
|
gBackfaceCulling = CheckAndReadIniInt("Rendering", "BackfaceCulling", gBackfaceCulling);
|
||||||
|
|
||||||
|
#ifdef PROPER_SCALING
|
||||||
|
CDraw::ms_bProperScaling = CheckAndReadIniInt("Draw", "ProperScaling", CDraw::ms_bProperScaling);
|
||||||
|
#endif
|
||||||
|
#ifdef FIX_RADAR
|
||||||
|
CDraw::ms_bFixRadar = CheckAndReadIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar);
|
||||||
|
#endif
|
||||||
|
#ifdef FIX_SPRITES
|
||||||
|
CDraw::ms_bFixSprites = CheckAndReadIniInt("Draw", "FixSprites", CDraw::ms_bFixSprites);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveINISettings()
|
void SaveINISettings()
|
||||||
|
@ -259,6 +269,16 @@ void SaveINISettings()
|
||||||
#endif
|
#endif
|
||||||
CheckAndSaveIniInt("Rendering", "BackfaceCulling", gBackfaceCulling, changed);
|
CheckAndSaveIniInt("Rendering", "BackfaceCulling", gBackfaceCulling, changed);
|
||||||
|
|
||||||
|
#ifdef PROPER_SCALING
|
||||||
|
CheckAndSaveIniInt("Draw", "ProperScaling", CDraw::ms_bProperScaling, changed);
|
||||||
|
#endif
|
||||||
|
#ifdef FIX_RADAR
|
||||||
|
CheckAndSaveIniInt("Draw", "FixRadar", CDraw::ms_bFixRadar, changed);
|
||||||
|
#endif
|
||||||
|
#ifdef FIX_SPRITES
|
||||||
|
CheckAndSaveIniInt("Draw", "FixSprites", CDraw::ms_bFixSprites, changed);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
cfg.write_file("reLCS.ini");
|
cfg.write_file("reLCS.ini");
|
||||||
}
|
}
|
||||||
|
@ -420,17 +440,15 @@ SwitchToMission(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char *carnames[] = {
|
static const char *carnames[] = {
|
||||||
"landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "rio", "firetruk", "trash", "stretch", "manana",
|
"spider", "landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "patriot", "firetruk", "trash", "stretch",
|
||||||
"infernus", "voodoo", "pony", "mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", "washing",
|
"manana", "infernus", "blista", "pony", "mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi",
|
||||||
"bobcat", "mrwhoop", "bfinject", "hunter", "police", "enforcer", "securica", "banshee", "predator", "bus",
|
"kuruma", "bobcat", "mrwhoop", "bfinject", "hearse", "police", "enforcer", "securica", "banshee", "bus", "rhino",
|
||||||
"rhino", "barracks", "cuban", "chopper", "angel", "coach", "cabbie", "stallion", "rumpo", "rcbandit", "romero",
|
"barracks", "dodo", "coach", "cabbie", "stallion", "rumpo", "rcbandit", "bellyup", "mrwongs", "mafia", "yardie",
|
||||||
"packer", "sentxs", "admiral", "squalo", "seaspar", "pizzaboy", "gangbur", "airtrain", "deaddodo", "speeder",
|
"yakuza", "diablos", "columb", "hoods", "panlant", "flatbed", "yankee", "borgnine", "toyz", "campvan", "ballot",
|
||||||
"reefer", "tropic", "flatbed", "yankee", "caddy", "zebra", "topfun", "skimmer", "pcj600", "faggio", "freeway",
|
"shelby", "pontiac", "esprit", "ammotruk", "hotrod", "Sindacco_Car", "Forelli_Car", "ferry", "ghost", "speeder",
|
||||||
"rcbaron", "rcraider", "glendale", "oceanic", "sanchez", "sparrow", "patriot", "lovefist", "coastg", "dinghy",
|
"reefer", "predator", "train", "escape", "chopper", "airtrain", "deaddodo", "angel", "pizzaboy", "noodleboy",
|
||||||
"hermes", "sabre", "sabretur", "pheonix", "walton", "regina", "comet", "deluxo", "burrito", "spand", "marquis",
|
"pcj600", "faggio", "freeway", "angel2", "sanchez2", "sanchez", "rcgoblin", "rcraider", "hunter", "maverick",
|
||||||
"baggage", "kaufman", "maverick", "vcnmav", "rancher", "fbiranch", "virgo", "greenwoo", "jetmax", "hotring",
|
"polmav", "vcnmav"
|
||||||
"sandking", "blistac", "polmav", "boxville", "benson", "mesa", "rcgoblin", "hotrina", "hotrinb",
|
|
||||||
"bloodra", "bloodrb", "vicechee"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static CTweakVar** TweakVarsList;
|
static CTweakVar** TweakVarsList;
|
||||||
|
@ -563,7 +581,7 @@ DebugMenuPopulate(void)
|
||||||
DebugMenuAddCmd("Cheats", "Pickup chicks", PickUpChicksCheat);
|
DebugMenuAddCmd("Cheats", "Pickup chicks", PickUpChicksCheat);
|
||||||
|
|
||||||
static int spawnCarId = MI_LANDSTAL;
|
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);
|
DebugMenuEntrySetWrap(e, true);
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Car", [](){
|
DebugMenuAddCmd("Spawn", "Spawn Car", [](){
|
||||||
if(spawnCarId == MI_CHOPPER ||
|
if(spawnCarId == MI_CHOPPER ||
|
||||||
|
@ -578,22 +596,19 @@ DebugMenuPopulate(void)
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Stinger", [](){ SpawnCar(MI_STINGER); });
|
DebugMenuAddCmd("Spawn", "Spawn Stinger", [](){ SpawnCar(MI_STINGER); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Infernus", [](){ SpawnCar(MI_INFERNUS); });
|
DebugMenuAddCmd("Spawn", "Spawn Infernus", [](){ SpawnCar(MI_INFERNUS); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Cheetah", [](){ SpawnCar(MI_CHEETAH); });
|
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 Banshee", [](){ SpawnCar(MI_BANSHEE); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Esperanto", [](){ SpawnCar(MI_ESPERANT); });
|
DebugMenuAddCmd("Spawn", "Spawn Esperanto", [](){ SpawnCar(MI_ESPERANT); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Stallion", [](){ SpawnCar(MI_STALLION); });
|
DebugMenuAddCmd("Spawn", "Spawn Stallion", [](){ SpawnCar(MI_STALLION); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Admiral", [](){ SpawnCar(MI_ADMIRAL); });
|
DebugMenuAddCmd("Spawn", "Spawn Mafia", [](){ SpawnCar(MI_MAFIA); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Washington", [](){ SpawnCar(MI_WASHING); });
|
DebugMenuAddCmd("Spawn", "Spawn Kuruma", [](){ SpawnCar(MI_KURUMA); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Taxi", [](){ SpawnCar(MI_TAXI); });
|
DebugMenuAddCmd("Spawn", "Spawn Taxi", [](){ SpawnCar(MI_TAXI); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Police", [](){ SpawnCar(MI_POLICE); });
|
DebugMenuAddCmd("Spawn", "Spawn Police", [](){ SpawnCar(MI_POLICE); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); });
|
DebugMenuAddCmd("Spawn", "Spawn Enforcer", [](){ SpawnCar(MI_ENFORCER); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Cuban", [](){ SpawnCar(MI_CUBAN); });
|
DebugMenuAddCmd("Spawn", "Spawn Diablo", [](){ SpawnCar(MI_DIABLOS); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Voodoo", [](){ SpawnCar(MI_VOODOO); });
|
DebugMenuAddCmd("Spawn", "Spawn Yardie", [](){ SpawnCar(MI_YARDIE); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn BF injection", [](){ SpawnCar(MI_BFINJECT); });
|
DebugMenuAddCmd("Spawn", "Spawn BF injection", [](){ SpawnCar(MI_BFINJECT); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Maverick", [](){ SpawnCar(MI_MAVERICK); });
|
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 Hunter", [](){ SpawnCar(MI_HUNTER); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
|
DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
|
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
|
||||||
|
@ -601,10 +616,9 @@ DebugMenuPopulate(void)
|
||||||
DebugMenuAddCmd("Spawn", "Spawn PCJ 600", [](){ SpawnCar(MI_PCJ600); });
|
DebugMenuAddCmd("Spawn", "Spawn PCJ 600", [](){ SpawnCar(MI_PCJ600); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Faggio", [](){ SpawnCar(MI_FAGGIO); });
|
DebugMenuAddCmd("Spawn", "Spawn Faggio", [](){ SpawnCar(MI_FAGGIO); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Freeway", [](){ SpawnCar(MI_FREEWAY); });
|
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);
|
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", "Backface Culling", &gBackfaceCulling, nil);
|
||||||
DebugMenuAddVarBool8("Render", "PS2 Alpha test Emu", &gPS2alphaTest, nil);
|
DebugMenuAddVarBool8("Render", "PS2 Alpha test Emu", &gPS2alphaTest, nil);
|
||||||
DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil);
|
DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil);
|
||||||
|
@ -635,8 +649,8 @@ extern bool gbRenderWorld2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTENDED_COLOURFILTER
|
#ifdef EXTENDED_COLOURFILTER
|
||||||
static const char *filternames[] = { "None", "Simple", "Normal", "Mobile" };
|
static const char *filternames[] = { "None", "PS2" };
|
||||||
e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_MOBILE, filternames);
|
e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_NORMAL, filternames);
|
||||||
DebugMenuEntrySetWrap(e, true);
|
DebugMenuEntrySetWrap(e, true);
|
||||||
DebugMenuAddVar("Render", "Intensity", &CPostFX::Intensity, nil, 0.05f, 0, 10.0f);
|
DebugMenuAddVar("Render", "Intensity", &CPostFX::Intensity, nil, 0.05f, 0, 10.0f);
|
||||||
DebugMenuAddVarBool8("Render", "Blur", &CPostFX::BlurOn, nil);
|
DebugMenuAddVarBool8("Render", "Blur", &CPostFX::BlurOn, nil);
|
||||||
|
@ -647,18 +661,25 @@ extern bool gbRenderWorld2;
|
||||||
DebugMenuAddVarBool8("Render", "Occlusion debug", &bDispayOccDebugStuff, nil);
|
DebugMenuAddVarBool8("Render", "Occlusion debug", &bDispayOccDebugStuff, nil);
|
||||||
#endif
|
#endif
|
||||||
#ifdef EXTENDED_PIPELINES
|
#ifdef EXTENDED_PIPELINES
|
||||||
static const char *vehpipenames[] = { "MatFX", "Neo" };
|
static const char *worldpipenames[] = { "PS2", "Mobile" };
|
||||||
e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil,
|
e = DebugMenuAddVar("Render", "World Rendering", &CustomPipes::WorldPipeSwitch, nil,
|
||||||
1, CustomPipes::VEHICLEPIPE_MATFX, CustomPipes::VEHICLEPIPE_NEO, vehpipenames);
|
1, CustomPipes::WORLDPIPE_PS2, CustomPipes::WORLDPIPE_MOBILE, worldpipenames);
|
||||||
DebugMenuEntrySetWrap(e, true);
|
DebugMenuEntrySetWrap(e, true);
|
||||||
DebugMenuAddVar("Render", "Neo Vehicle Shininess", &CustomPipes::VehicleShininess, nil, 0.1f, 0, 1.0f);
|
static const char *vehpipenames[] = { "PS2", "Mobile", "Neo" };
|
||||||
DebugMenuAddVar("Render", "Neo Vehicle Specularity", &CustomPipes::VehicleSpecularity, nil, 0.1f, 0, 1.0f);
|
e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil,
|
||||||
|
1, CustomPipes::VEHICLEPIPE_PS2, CustomPipes::VEHICLEPIPE_MOBILE, vehpipenames);
|
||||||
|
DebugMenuEntrySetWrap(e, true);
|
||||||
|
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);
|
DebugMenuAddVarBool8("Render", "Neo Ped Rim light enable", &CustomPipes::RimlightEnable, nil);
|
||||||
DebugMenuAddVar("Render", "Mult", &CustomPipes::RimlightMult, nil, 0.1f, 0, 1.0f);
|
DebugMenuAddVar("Render", "Mult", &CustomPipes::RimlightMult, nil, 0.1f, 0, 1.0f);
|
||||||
DebugMenuAddVarBool8("Render", "Neo World Lightmaps enable", &CustomPipes::LightmapEnable, nil);
|
// DebugMenuAddVarBool8("Render", "Neo World Lightmaps enable", &CustomPipes::LightmapEnable, nil);
|
||||||
DebugMenuAddVar("Render", "Mult", &CustomPipes::LightmapMult, nil, 0.1f, 0, 1.0f);
|
// DebugMenuAddVar("Render", "Mult", &CustomPipes::LightmapMult, nil, 0.1f, 0, 1.0f);
|
||||||
DebugMenuAddVarBool8("Render", "Neo Road Gloss enable", &CustomPipes::GlossEnable, nil);
|
// DebugMenuAddVarBool8("Render", "Neo Road Gloss enable", &CustomPipes::GlossEnable, nil);
|
||||||
DebugMenuAddVar("Render", "Mult", &CustomPipes::GlossMult, nil, 0.1f, 0, 1.0f);
|
// DebugMenuAddVar("Render", "Mult", &CustomPipes::GlossMult, nil, 0.1f, 0, 1.0f);
|
||||||
#endif
|
#endif
|
||||||
DebugMenuAddVarBool8("Render", "Show Ped Paths", &gbShowPedPaths, nil);
|
DebugMenuAddVarBool8("Render", "Show Ped Paths", &gbShowPedPaths, nil);
|
||||||
DebugMenuAddVarBool8("Render", "Show Car Paths", &gbShowCarPaths, nil);
|
DebugMenuAddVarBool8("Render", "Show Car Paths", &gbShowCarPaths, nil);
|
||||||
|
@ -672,6 +693,16 @@ extern bool gbRenderWorld2;
|
||||||
DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil);
|
DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil);
|
||||||
DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil);
|
DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil);
|
||||||
|
|
||||||
|
#ifdef PROPER_SCALING
|
||||||
|
DebugMenuAddVarBool8("Draw", "Proper Scaling", &CDraw::ms_bProperScaling, nil);
|
||||||
|
#endif
|
||||||
|
#ifdef FIX_RADAR
|
||||||
|
DebugMenuAddVarBool8("Draw", "Fix Radar", &CDraw::ms_bFixRadar, nil);
|
||||||
|
#endif
|
||||||
|
#ifdef FIX_SPRITES
|
||||||
|
DebugMenuAddVarBool8("Draw", "Fix Sprites", &CDraw::ms_bFixSprites, nil);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef FINAL
|
#ifndef FINAL
|
||||||
DebugMenuAddVarBool8("Debug", "Print Memory Usage", &gbPrintMemoryUsage, nil);
|
DebugMenuAddVarBool8("Debug", "Print Memory Usage", &gbPrintMemoryUsage, nil);
|
||||||
#ifdef USE_CUSTOM_ALLOCATOR
|
#ifdef USE_CUSTOM_ALLOCATOR
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "RwHelper.h"
|
#include "RwHelper.h"
|
||||||
#include "ModelIndices.h"
|
#include "ModelIndices.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
#include "Streaming.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
@ -623,10 +624,15 @@ CEntity::SetupBigBuilding(void)
|
||||||
m_level = CTheZones::GetLevelFromPosition(&GetPosition());
|
m_level = CTheZones::GetLevelFromPosition(&GetPosition());
|
||||||
if(mi->m_lodDistances[0] <= 2000.0f)
|
if(mi->m_lodDistances[0] <= 2000.0f)
|
||||||
bStreamBIGBuilding = true;
|
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;
|
m_level = LEVEL_GENERIC;
|
||||||
else if(m_level == LEVEL_GENERIC)
|
// else if(m_level == LEVEL_GENERIC)
|
||||||
printf("%s isn't in a level\n", mi->GetModelName());
|
// printf("%s isn't in a level\n", mi->GetModelName());
|
||||||
}
|
}
|
||||||
|
|
||||||
float WindTabel[] = {
|
float WindTabel[] = {
|
||||||
|
|
|
@ -46,13 +46,14 @@ CustomMatCopy(void *dst, void *src, int32, int32)
|
||||||
|
|
||||||
rw::TexDictionary *neoTxd;
|
rw::TexDictionary *neoTxd;
|
||||||
|
|
||||||
|
bool gGlassCarsCheat;
|
||||||
bool bRenderingEnvMap;
|
bool bRenderingEnvMap;
|
||||||
int32 EnvMapSize = 128;
|
int32 EnvMapSize = 512;
|
||||||
rw::Camera *EnvMapCam;
|
rw::Camera *EnvMapCam;
|
||||||
rw::Texture *EnvMapTex;
|
rw::Texture *EnvMapTex;
|
||||||
rw::Texture *EnvMaskTex;
|
rw::Texture *EnvMaskTex;
|
||||||
static rw::RWDEVICE::Im2DVertex EnvScreenQuad[4];
|
rw::RWDEVICE::Im2DVertex EnvScreenQuad[4];
|
||||||
static int16 QuadIndices[6] = { 0, 1, 2, 0, 2, 3 };
|
int16 QuadIndices[6] = { 0, 1, 2, 0, 2, 3 };
|
||||||
|
|
||||||
static rw::Camera*
|
static rw::Camera*
|
||||||
CreateEnvMapCam(rw::World *world)
|
CreateEnvMapCam(rw::World *world)
|
||||||
|
@ -341,7 +342,7 @@ ReadTweakValueTable(char *fp, InterpolatedValue &interp)
|
||||||
* Neo Vehicle pipe
|
* Neo Vehicle pipe
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int32 VehiclePipeSwitch = VEHICLEPIPE_MATFX;
|
int32 VehiclePipeSwitch = VEHICLEPIPE_PS2;
|
||||||
float VehicleShininess = 1.0f;
|
float VehicleShininess = 1.0f;
|
||||||
float VehicleSpecularity = 1.0f;
|
float VehicleSpecularity = 1.0f;
|
||||||
InterpolatedFloat Fresnel(0.4f);
|
InterpolatedFloat Fresnel(0.4f);
|
||||||
|
@ -369,6 +370,7 @@ AttachVehiclePipe(rw::Clump *clump)
|
||||||
* Neo World pipe
|
* Neo World pipe
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
int32 WorldPipeSwitch = 0;
|
||||||
bool LightmapEnable;
|
bool LightmapEnable;
|
||||||
float LightmapMult = 1.0f;
|
float LightmapMult = 1.0f;
|
||||||
InterpolatedFloat WorldLightmapBlend(1.0f);
|
InterpolatedFloat WorldLightmapBlend(1.0f);
|
||||||
|
|
|
@ -75,16 +75,22 @@ void CustomPipeInit(void);
|
||||||
void CustomPipeShutdown(void);
|
void CustomPipeShutdown(void);
|
||||||
void SetTxdFindCallback(void);
|
void SetTxdFindCallback(void);
|
||||||
|
|
||||||
|
extern bool gGlassCarsCheat;
|
||||||
extern bool bRenderingEnvMap;
|
extern bool bRenderingEnvMap;
|
||||||
extern int32 EnvMapSize;
|
extern int32 EnvMapSize;
|
||||||
extern rw::Camera *EnvMapCam;
|
extern rw::Camera *EnvMapCam;
|
||||||
extern rw::Texture *EnvMapTex;
|
extern rw::Texture *EnvMapTex;
|
||||||
extern rw::Texture *EnvMaskTex;
|
extern rw::Texture *EnvMaskTex;
|
||||||
|
extern rw::RWDEVICE::Im2DVertex EnvScreenQuad[4];
|
||||||
|
extern int16 QuadIndices[6];
|
||||||
void EnvMapRender(void);
|
void EnvMapRender(void);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
VEHICLEPIPE_MATFX,
|
VEHICLEPIPE_PS2,
|
||||||
VEHICLEPIPE_NEO
|
VEHICLEPIPE_MOBILE,
|
||||||
|
|
||||||
|
// maybe later again...
|
||||||
|
VEHICLEPIPE_NEO = -1
|
||||||
};
|
};
|
||||||
extern int32 VehiclePipeSwitch;
|
extern int32 VehiclePipeSwitch;
|
||||||
extern float VehicleShininess;
|
extern float VehicleShininess;
|
||||||
|
@ -99,6 +105,11 @@ void DestroyVehiclePipe(void);
|
||||||
void AttachVehiclePipe(rw::Atomic *atomic);
|
void AttachVehiclePipe(rw::Atomic *atomic);
|
||||||
void AttachVehiclePipe(rw::Clump *clump);
|
void AttachVehiclePipe(rw::Clump *clump);
|
||||||
|
|
||||||
|
enum {
|
||||||
|
WORLDPIPE_PS2,
|
||||||
|
WORLDPIPE_MOBILE
|
||||||
|
};
|
||||||
|
extern int32 WorldPipeSwitch;
|
||||||
extern bool LightmapEnable;
|
extern bool LightmapEnable;
|
||||||
extern float LightmapMult;
|
extern float LightmapMult;
|
||||||
extern InterpolatedFloat WorldLightmapBlend;
|
extern InterpolatedFloat WorldLightmapBlend;
|
||||||
|
@ -133,5 +144,12 @@ void AttachRimPipe(rw::Clump *clump);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace WorldRender{
|
||||||
|
extern int numBlendInsts[3];
|
||||||
|
void AtomicFirstPass(RpAtomic *atomic, int pass);
|
||||||
|
void AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha);
|
||||||
|
void RenderBlendPass(int pass);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#ifdef RW_D3D9
|
#ifdef RW_D3D9
|
||||||
#ifdef EXTENDED_PIPELINES
|
#ifdef EXTENDED_PIPELINES
|
||||||
|
|
||||||
|
#include "rpmatfx.h"
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "RwHelper.h"
|
#include "RwHelper.h"
|
||||||
#include "Lights.h"
|
#include "Lights.h"
|
||||||
|
@ -38,17 +40,191 @@ enum {
|
||||||
VSLOC_reflProps,
|
VSLOC_reflProps,
|
||||||
VSLOC_specLights,
|
VSLOC_specLights,
|
||||||
|
|
||||||
// Leeds building
|
// Leeds building, Leeds vehicle mobile
|
||||||
VSLOC_emissive = rw::d3d::VSLOC_afterLights,
|
VSLOC_emissive = rw::d3d::VSLOC_afterLights,
|
||||||
VSLOC_ambient,
|
VSLOC_ambient,
|
||||||
|
VSLOC_viewMat, // only vehicle
|
||||||
|
|
||||||
PSLOC_colorscale = 1
|
PSLOC_colorscale = 1,
|
||||||
|
|
||||||
|
// Leeds vehicle PS2
|
||||||
|
VSLOC_texMat = rw::d3d::VSLOC_afterLights,
|
||||||
|
|
||||||
|
PSLOC_shininess = 1,
|
||||||
|
PSLOC_skyTop,
|
||||||
|
PSLOC_skyBot
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Neo Vehicle pipe
|
* Leeds & Neo Vehicle pipe
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static void *leedsVehicle_VS;
|
||||||
|
static void *leedsVehicle_mobile_VS;
|
||||||
|
static void *leedsVehicle_blend_PS;
|
||||||
|
static void *leedsVehicle_add_PS;
|
||||||
|
static void *leedsVehicle_mobile_PS;
|
||||||
|
|
||||||
|
static rw::RawMatrix normal2texcoord_flipU = {
|
||||||
|
{ -0.5f, 0.0f, 0.0f }, 0.0f,
|
||||||
|
{ 0.0f, -0.5f, 0.0f }, 0.0f,
|
||||||
|
{ 0.0f, 0.0f, 1.0f }, 0.0f,
|
||||||
|
{ 0.5f, 0.5f, 0.0f }, 1.0f
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
uploadEnvMatrix(rw::Frame *frame)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
Matrix invMat;
|
||||||
|
if(frame == nil)
|
||||||
|
frame = engine->currentCamera->getFrame();
|
||||||
|
|
||||||
|
RawMatrix envMtx, invMtx;
|
||||||
|
Matrix tmp = *frame->getLTM();
|
||||||
|
// Now the weird part: we remove the camera pitch
|
||||||
|
tmp.at.z = 0.0f;
|
||||||
|
tmp.at = normalize(tmp.at);
|
||||||
|
tmp.right.x = -tmp.at.y;
|
||||||
|
tmp.right.y = tmp.at.x;
|
||||||
|
tmp.right.z = 0.0f;;
|
||||||
|
tmp.up.set(0.0f, 0.0f, 1.0f);
|
||||||
|
tmp.pos.set(0.0f, 0.0f, 0.0f);
|
||||||
|
tmp.flags = Matrix::TYPEORTHONORMAL;
|
||||||
|
|
||||||
|
Matrix::invert(&invMat, &tmp);
|
||||||
|
convMatrix(&invMtx, &invMat);
|
||||||
|
RawMatrix::mult(&envMtx, &invMtx, &normal2texcoord_flipU);
|
||||||
|
d3d::d3ddevice->SetVertexShaderConstantF(VSLOC_texMat, (float*)&envMtx, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
leedsVehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::d3d;
|
||||||
|
using namespace rw::d3d9;
|
||||||
|
|
||||||
|
int vsBits;
|
||||||
|
setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride);
|
||||||
|
setIndices(header->indexBuffer);
|
||||||
|
setVertexDeclaration(header->vertexDeclaration);
|
||||||
|
|
||||||
|
vsBits = lightingCB_Shader(atomic);
|
||||||
|
uploadMatrices(atomic->getFrame()->getLTM());
|
||||||
|
|
||||||
|
setVertexShader(leedsVehicle_VS);
|
||||||
|
if(gGlassCarsCheat)
|
||||||
|
setPixelShader(leedsVehicle_blend_PS);
|
||||||
|
else
|
||||||
|
setPixelShader(leedsVehicle_add_PS);
|
||||||
|
|
||||||
|
d3d::setTexture(1, EnvMapTex);
|
||||||
|
uploadEnvMatrix(nil);
|
||||||
|
|
||||||
|
SetRenderState(SRCBLEND, BLENDONE);
|
||||||
|
|
||||||
|
InstanceData *inst = header->inst;
|
||||||
|
for(rw::uint32 i = 0; i < header->numMeshes; i++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
|
||||||
|
SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
|
||||||
|
|
||||||
|
float coef = 0.0f;
|
||||||
|
if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP){
|
||||||
|
coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f;
|
||||||
|
if(gGlassCarsCheat)
|
||||||
|
coef = 1.0f;
|
||||||
|
}
|
||||||
|
d3ddevice->SetPixelShaderConstantF(PSLOC_shininess, (float*)&coef, 1);
|
||||||
|
|
||||||
|
setMaterial(m->color, m->surfaceProps);
|
||||||
|
|
||||||
|
if(m->texture)
|
||||||
|
d3d::setTexture(0, m->texture);
|
||||||
|
else
|
||||||
|
d3d::setTexture(0, gpWhiteTexture);
|
||||||
|
|
||||||
|
drawInst(header, inst);
|
||||||
|
inst++;
|
||||||
|
}
|
||||||
|
|
||||||
|
d3d::setTexture(1, nil);
|
||||||
|
|
||||||
|
SetRenderState(SRCBLEND, BLENDSRCALPHA);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
leedsVehicleRenderCB_mobile(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::d3d;
|
||||||
|
using namespace rw::d3d9;
|
||||||
|
|
||||||
|
int vsBits;
|
||||||
|
setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride);
|
||||||
|
setIndices(header->indexBuffer);
|
||||||
|
setVertexDeclaration(header->vertexDeclaration);
|
||||||
|
|
||||||
|
vsBits = lightingCB_Shader(atomic);
|
||||||
|
uploadMatrices(atomic->getFrame()->getLTM());
|
||||||
|
|
||||||
|
setVertexShader(leedsVehicle_mobile_VS);
|
||||||
|
setPixelShader(leedsVehicle_mobile_PS);
|
||||||
|
|
||||||
|
RGBAf amb, emiss;
|
||||||
|
amb.red = CTimeCycle::GetAmbientRed();
|
||||||
|
amb.green = CTimeCycle::GetAmbientGreen();
|
||||||
|
amb.blue = CTimeCycle::GetAmbientBlue();
|
||||||
|
amb.alpha = 1.0f;
|
||||||
|
emiss = pAmbient->color;
|
||||||
|
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_ambient, (float*)&amb, 1);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_emissive, (float*)&emiss, 1);
|
||||||
|
|
||||||
|
RGBAf skyTop, skyBot;
|
||||||
|
skyTop.red = CTimeCycle::GetSkyTopRed()/255.0f;
|
||||||
|
skyTop.green = CTimeCycle::GetSkyTopGreen()/255.0f;
|
||||||
|
skyTop.blue = CTimeCycle::GetSkyTopBlue()/255.0f;
|
||||||
|
skyBot.red = CTimeCycle::GetSkyBottomRed()/255.0f;
|
||||||
|
skyBot.green = CTimeCycle::GetSkyBottomGreen()/255.0f;
|
||||||
|
skyBot.blue = CTimeCycle::GetSkyBottomBlue()/255.0f;
|
||||||
|
|
||||||
|
d3ddevice->SetPixelShaderConstantF(PSLOC_skyTop, (float*)&skyTop, 1);
|
||||||
|
d3ddevice->SetPixelShaderConstantF(PSLOC_skyBot, (float*)&skyBot, 1);
|
||||||
|
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_viewMat, (float*)&rw::engine->currentCamera->devView, 4);
|
||||||
|
|
||||||
|
d3d::setTexture(1, EnvMapTex);
|
||||||
|
|
||||||
|
InstanceData *inst = header->inst;
|
||||||
|
for(rw::uint32 i = 0; i < header->numMeshes; i++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
|
||||||
|
SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
|
||||||
|
|
||||||
|
float coef = 0.0f;
|
||||||
|
if(RpMatFXMaterialGetEffects(m) == rpMATFXEFFECTENVMAP){
|
||||||
|
coef = CClock::ms_EnvMapTimeMultiplicator * RpMatFXMaterialGetEnvMapCoefficient(m)*0.5f;
|
||||||
|
if(gGlassCarsCheat)
|
||||||
|
coef = 1.0f;
|
||||||
|
}
|
||||||
|
d3ddevice->SetPixelShaderConstantF(PSLOC_shininess, (float*)&coef, 1);
|
||||||
|
|
||||||
|
setMaterial(m->color, m->surfaceProps);
|
||||||
|
|
||||||
|
if(m->texture)
|
||||||
|
d3d::setTexture(0, m->texture);
|
||||||
|
else
|
||||||
|
d3d::setTexture(0, gpWhiteTexture);
|
||||||
|
|
||||||
|
drawInst(header, inst);
|
||||||
|
inst++;
|
||||||
|
}
|
||||||
|
|
||||||
|
d3d::setTexture(1, nil);
|
||||||
|
}
|
||||||
|
|
||||||
static void *neoVehicle_VS;
|
static void *neoVehicle_VS;
|
||||||
static void *neoVehicle_PS;
|
static void *neoVehicle_PS;
|
||||||
|
|
||||||
|
@ -89,8 +265,13 @@ vehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
|
||||||
using namespace rw::d3d9;
|
using namespace rw::d3d9;
|
||||||
|
|
||||||
// TODO: make this less of a kludge
|
// TODO: make this less of a kludge
|
||||||
if(VehiclePipeSwitch == VEHICLEPIPE_MATFX){
|
if(VehiclePipeSwitch == VEHICLEPIPE_PS2){
|
||||||
matFXGlobals.pipelines[rw::platform]->render(atomic);
|
leedsVehicleRenderCB(atomic, header);
|
||||||
|
// matFXGlobals.pipelines[rw::platform]->render(atomic);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(VehiclePipeSwitch == VEHICLEPIPE_MOBILE){
|
||||||
|
leedsVehicleRenderCB_mobile(atomic, header);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,15 +327,15 @@ vehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
|
||||||
void
|
void
|
||||||
CreateVehiclePipe(void)
|
CreateVehiclePipe(void)
|
||||||
{
|
{
|
||||||
if(CFileMgr::LoadFile("neo/carTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0)
|
// if(CFileMgr::LoadFile("neo/carTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0)
|
||||||
printf("Error: couldn't open 'neo/carTweakingTable.dat'\n");
|
// printf("Error: couldn't open 'neo/carTweakingTable.dat'\n");
|
||||||
else{
|
// else{
|
||||||
char *fp = (char*)work_buff;
|
// char *fp = (char*)work_buff;
|
||||||
fp = ReadTweakValueTable(fp, Fresnel);
|
// fp = ReadTweakValueTable(fp, Fresnel);
|
||||||
fp = ReadTweakValueTable(fp, Power);
|
// fp = ReadTweakValueTable(fp, Power);
|
||||||
fp = ReadTweakValueTable(fp, DiffColor);
|
// fp = ReadTweakValueTable(fp, DiffColor);
|
||||||
fp = ReadTweakValueTable(fp, SpecColor);
|
// fp = ReadTweakValueTable(fp, SpecColor);
|
||||||
}
|
// }
|
||||||
|
|
||||||
#include "shaders/neoVehicle_VS.inc"
|
#include "shaders/neoVehicle_VS.inc"
|
||||||
neoVehicle_VS = rw::d3d::createVertexShader(neoVehicle_VS_cso);
|
neoVehicle_VS = rw::d3d::createVertexShader(neoVehicle_VS_cso);
|
||||||
|
@ -164,6 +345,26 @@ CreateVehiclePipe(void)
|
||||||
neoVehicle_PS = rw::d3d::createPixelShader(neoVehicle_PS_cso);
|
neoVehicle_PS = rw::d3d::createPixelShader(neoVehicle_PS_cso);
|
||||||
assert(neoVehicle_PS);
|
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();
|
rw::d3d9::ObjPipeline *pipe = rw::d3d9::ObjPipeline::create();
|
||||||
pipe->instanceCB = rw::d3d9::defaultInstanceCB;
|
pipe->instanceCB = rw::d3d9::defaultInstanceCB;
|
||||||
|
@ -181,6 +382,15 @@ DestroyVehiclePipe(void)
|
||||||
rw::d3d::destroyPixelShader(neoVehicle_PS);
|
rw::d3d::destroyPixelShader(neoVehicle_PS);
|
||||||
neoVehicle_PS = nil;
|
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();
|
((rw::d3d9::ObjPipeline*)vehiclePipe)->destroy();
|
||||||
vehiclePipe = nil;
|
vehiclePipe = nil;
|
||||||
}
|
}
|
||||||
|
@ -192,6 +402,7 @@ DestroyVehiclePipe(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void *leedsBuilding_VS;
|
static void *leedsBuilding_VS;
|
||||||
|
static void *leedsBuilding_mobile_VS;
|
||||||
static void *scale_PS;
|
static void *scale_PS;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -201,12 +412,14 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
|
||||||
using namespace rw::d3d;
|
using namespace rw::d3d;
|
||||||
using namespace rw::d3d9;
|
using namespace rw::d3d9;
|
||||||
|
|
||||||
int vsBits;
|
|
||||||
setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride);
|
setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride);
|
||||||
setIndices(header->indexBuffer);
|
setIndices(header->indexBuffer);
|
||||||
setVertexDeclaration(header->vertexDeclaration);
|
setVertexDeclaration(header->vertexDeclaration);
|
||||||
|
|
||||||
setVertexShader(leedsBuilding_VS);
|
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
|
||||||
|
setVertexShader(CustomPipes::leedsBuilding_mobile_VS);
|
||||||
|
else
|
||||||
|
setVertexShader(CustomPipes::leedsBuilding_VS);
|
||||||
setPixelShader(scale_PS);
|
setPixelShader(scale_PS);
|
||||||
|
|
||||||
uploadMatrices(atomic->getFrame()->getLTM());
|
uploadMatrices(atomic->getFrame()->getLTM());
|
||||||
|
@ -229,7 +442,7 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
|
||||||
Material *m = inst->material;
|
Material *m = inst->material;
|
||||||
|
|
||||||
float cs = 1.0f;
|
float cs = 1.0f;
|
||||||
if(m->texture)
|
if(WorldPipeSwitch == WORLDPIPE_PS2 && m->texture)
|
||||||
cs = 255/128.0f;
|
cs = 255/128.0f;
|
||||||
colorscale[0] = colorscale[1] = colorscale[2] = cs;
|
colorscale[0] = colorscale[1] = colorscale[2] = cs;
|
||||||
d3ddevice->SetPixelShaderConstantF(PSLOC_colorscale, colorscale, 1);
|
d3ddevice->SetPixelShaderConstantF(PSLOC_colorscale, colorscale, 1);
|
||||||
|
@ -239,7 +452,7 @@ worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
|
||||||
else
|
else
|
||||||
d3d::setTexture(0, gpWhiteTexture); // actually we don't even render this
|
d3d::setTexture(0, gpWhiteTexture); // actually we don't even render this
|
||||||
|
|
||||||
setMaterial(m->color, m->surfaceProps, 0.5f);
|
setMaterial(m->color, m->surfaceProps, WorldPipeSwitch == WORLDPIPE_PS2 ? 0.5f : 1.0f);
|
||||||
|
|
||||||
SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
|
SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
|
||||||
|
|
||||||
|
@ -259,6 +472,9 @@ CreateWorldPipe(void)
|
||||||
#include "shaders/leedsBuilding_VS.inc"
|
#include "shaders/leedsBuilding_VS.inc"
|
||||||
leedsBuilding_VS = rw::d3d::createVertexShader(leedsBuilding_VS_cso);
|
leedsBuilding_VS = rw::d3d::createVertexShader(leedsBuilding_VS_cso);
|
||||||
assert(leedsBuilding_VS);
|
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"
|
#include "shaders/scale_PS.inc"
|
||||||
scale_PS = rw::d3d::createPixelShader(scale_PS_cso);
|
scale_PS = rw::d3d::createPixelShader(scale_PS_cso);
|
||||||
assert(scale_PS);
|
assert(scale_PS);
|
||||||
|
@ -275,6 +491,8 @@ DestroyWorldPipe(void)
|
||||||
{
|
{
|
||||||
rw::d3d::destroyVertexShader(leedsBuilding_VS);
|
rw::d3d::destroyVertexShader(leedsBuilding_VS);
|
||||||
leedsBuilding_VS = nil;
|
leedsBuilding_VS = nil;
|
||||||
|
rw::d3d::destroyVertexShader(leedsBuilding_mobile_VS);
|
||||||
|
leedsBuilding_mobile_VS = nil;
|
||||||
rw::d3d::destroyPixelShader(scale_PS);
|
rw::d3d::destroyPixelShader(scale_PS);
|
||||||
scale_PS = nil;
|
scale_PS = nil;
|
||||||
|
|
||||||
|
@ -547,5 +765,202 @@ DestroyRimLightPipes(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
|
||||||
|
namespace WorldRender
|
||||||
|
{
|
||||||
|
|
||||||
|
struct BuildingInst
|
||||||
|
{
|
||||||
|
rw::RawMatrix combinedMat;
|
||||||
|
rw::d3d9::InstanceDataHeader *instHeader;
|
||||||
|
uint8 fadeAlpha;
|
||||||
|
bool lighting;
|
||||||
|
};
|
||||||
|
BuildingInst blendInsts[3][2000];
|
||||||
|
int numBlendInsts[3];
|
||||||
|
|
||||||
|
static RwRGBAReal black;
|
||||||
|
|
||||||
|
static void
|
||||||
|
SetMatrix(BuildingInst *building, rw::Matrix *worldMat)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
RawMatrix world, worldview;
|
||||||
|
Camera *cam = engine->currentCamera;
|
||||||
|
convMatrix(&world, worldMat);
|
||||||
|
RawMatrix::mult(&worldview, &world, &cam->devView);
|
||||||
|
RawMatrix::mult(&building->combinedMat, &worldview, &cam->devProj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
IsTextureTransparent(RwTexture *tex)
|
||||||
|
{
|
||||||
|
if(tex == nil || tex->raster == nil)
|
||||||
|
return false;
|
||||||
|
return PLUGINOFFSET(rw::d3d::D3dRaster, tex->raster, rw::d3d::nativeRasterOffset)->hasAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render all opaque meshes and put atomics that needs blending
|
||||||
|
// into the deferred list.
|
||||||
|
void
|
||||||
|
AtomicFirstPass(RpAtomic *atomic, int pass)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::d3d;
|
||||||
|
using namespace rw::d3d9;
|
||||||
|
|
||||||
|
BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]];
|
||||||
|
|
||||||
|
atomic->getPipeline()->instance(atomic);
|
||||||
|
building->instHeader = (d3d9::InstanceDataHeader*)atomic->geometry->instData;
|
||||||
|
assert(building->instHeader != nil);
|
||||||
|
assert(building->instHeader->platform == PLATFORM_D3D9);
|
||||||
|
building->fadeAlpha = 255;
|
||||||
|
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||||
|
|
||||||
|
bool setupDone = false;
|
||||||
|
bool defer = false;
|
||||||
|
SetMatrix(building, atomic->getFrame()->getLTM());
|
||||||
|
|
||||||
|
float colorscale[4];
|
||||||
|
|
||||||
|
InstanceData *inst = building->instHeader->inst;
|
||||||
|
for(rw::uint32 i = 0; i < building->instHeader->numMeshes; i++, inst++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
|
||||||
|
if(m->texture == nil)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(inst->vertexAlpha || m->color.alpha != 255 ||
|
||||||
|
IsTextureTransparent(m->texture)){
|
||||||
|
defer = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// alright we're rendering this atomic
|
||||||
|
if(!setupDone){
|
||||||
|
setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride);
|
||||||
|
setIndices(building->instHeader->indexBuffer);
|
||||||
|
setVertexDeclaration(building->instHeader->vertexDeclaration);
|
||||||
|
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
|
||||||
|
setVertexShader(CustomPipes::leedsBuilding_mobile_VS);
|
||||||
|
else
|
||||||
|
setVertexShader(CustomPipes::leedsBuilding_VS);
|
||||||
|
setPixelShader(CustomPipes::scale_PS);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4);
|
||||||
|
|
||||||
|
RGBAf amb, emiss;
|
||||||
|
amb.red = CTimeCycle::GetAmbientRed();
|
||||||
|
amb.green = CTimeCycle::GetAmbientGreen();
|
||||||
|
amb.blue = CTimeCycle::GetAmbientBlue();
|
||||||
|
amb.alpha = 1.0f;
|
||||||
|
emiss = pAmbient->color;
|
||||||
|
|
||||||
|
d3ddevice->SetVertexShaderConstantF(CustomPipes::VSLOC_ambient, (float*)&amb, 1);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(CustomPipes::VSLOC_emissive, (float*)&emiss, 1);
|
||||||
|
|
||||||
|
colorscale[3] = 1.0f;
|
||||||
|
|
||||||
|
setupDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
float cs = 1.0f;
|
||||||
|
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture)
|
||||||
|
cs = 255/128.0f;
|
||||||
|
colorscale[0] = colorscale[1] = colorscale[2] = cs;
|
||||||
|
d3ddevice->SetPixelShaderConstantF(CustomPipes::PSLOC_colorscale, colorscale, 1);
|
||||||
|
|
||||||
|
d3d::setTexture(0, m->texture);
|
||||||
|
|
||||||
|
setMaterial(m->color, m->surfaceProps, 0.5f);
|
||||||
|
|
||||||
|
drawInst(building->instHeader, inst);
|
||||||
|
}
|
||||||
|
if(defer)
|
||||||
|
numBlendInsts[pass]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::d3d;
|
||||||
|
using namespace rw::d3d9;
|
||||||
|
|
||||||
|
BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]];
|
||||||
|
|
||||||
|
atomic->getPipeline()->instance(atomic);
|
||||||
|
building->instHeader = (d3d9::InstanceDataHeader*)atomic->geometry->instData;
|
||||||
|
assert(building->instHeader != nil);
|
||||||
|
assert(building->instHeader->platform == PLATFORM_D3D9);
|
||||||
|
building->fadeAlpha = fadeAlpha;
|
||||||
|
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||||
|
SetMatrix(building, atomic->getFrame()->getLTM());
|
||||||
|
numBlendInsts[pass]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RenderBlendPass(int pass)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::d3d;
|
||||||
|
using namespace rw::d3d9;
|
||||||
|
|
||||||
|
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
|
||||||
|
setVertexShader(CustomPipes::leedsBuilding_mobile_VS);
|
||||||
|
else
|
||||||
|
setVertexShader(CustomPipes::leedsBuilding_VS);
|
||||||
|
setPixelShader(CustomPipes::scale_PS);
|
||||||
|
|
||||||
|
RGBAf amb, emiss;
|
||||||
|
amb.red = CTimeCycle::GetAmbientRed();
|
||||||
|
amb.green = CTimeCycle::GetAmbientGreen();
|
||||||
|
amb.blue = CTimeCycle::GetAmbientBlue();
|
||||||
|
amb.alpha = 1.0f;
|
||||||
|
emiss = pAmbient->color;
|
||||||
|
|
||||||
|
d3ddevice->SetVertexShaderConstantF(CustomPipes::VSLOC_ambient, (float*)&amb, 1);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(CustomPipes::VSLOC_emissive, (float*)&emiss, 1);
|
||||||
|
|
||||||
|
float colorscale[4];
|
||||||
|
colorscale[3] = 1.0f;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < numBlendInsts[pass]; i++){
|
||||||
|
BuildingInst *building = &blendInsts[pass][i];
|
||||||
|
|
||||||
|
setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride);
|
||||||
|
setIndices(building->instHeader->indexBuffer);
|
||||||
|
setVertexDeclaration(building->instHeader->vertexDeclaration);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4);
|
||||||
|
|
||||||
|
InstanceData *inst = building->instHeader->inst;
|
||||||
|
for(rw::uint32 j = 0; j < building->instHeader->numMeshes; j++, inst++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
if(m->texture == nil)
|
||||||
|
continue;
|
||||||
|
if(!inst->vertexAlpha && m->color.alpha == 255 && !IsTextureTransparent(m->texture) && building->fadeAlpha == 255)
|
||||||
|
continue; // already done this one
|
||||||
|
|
||||||
|
float cs = 1.0f;
|
||||||
|
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture)
|
||||||
|
cs = 255/128.0f;
|
||||||
|
colorscale[0] = colorscale[1] = colorscale[2] = cs;
|
||||||
|
d3ddevice->SetPixelShaderConstantF(CustomPipes::PSLOC_colorscale, colorscale, 1);
|
||||||
|
|
||||||
|
d3d::setTexture(0, m->texture);
|
||||||
|
|
||||||
|
rw::RGBA color = m->color;
|
||||||
|
color.alpha = (color.alpha * building->fadeAlpha)/255;
|
||||||
|
setMaterial(color, m->surfaceProps, 0.5f);
|
||||||
|
|
||||||
|
drawInst(building->instHeader, inst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#ifdef RW_OPENGL
|
#ifdef RW_OPENGL
|
||||||
#ifdef EXTENDED_PIPELINES
|
#ifdef EXTENDED_PIPELINES
|
||||||
|
|
||||||
|
#include "rpmatfx.h"
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "RwHelper.h"
|
#include "RwHelper.h"
|
||||||
#include "Lights.h"
|
#include "Lights.h"
|
||||||
|
@ -37,14 +39,204 @@ static int32 u_amb;
|
||||||
static int32 u_emiss;
|
static int32 u_emiss;
|
||||||
static int32 u_colorscale;
|
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]
|
#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;
|
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
|
static void
|
||||||
uploadSpecLights(void)
|
uploadSpecLights(void)
|
||||||
{
|
{
|
||||||
|
@ -84,8 +276,13 @@ vehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
using namespace rw::gl3;
|
using namespace rw::gl3;
|
||||||
|
|
||||||
// TODO: make this less of a kludge
|
// TODO: make this less of a kludge
|
||||||
if(VehiclePipeSwitch == VEHICLEPIPE_MATFX){
|
if(VehiclePipeSwitch == VEHICLEPIPE_PS2){
|
||||||
matFXGlobals.pipelines[rw::platform]->render(atomic);
|
leedsVehicleRenderCB(atomic, header);
|
||||||
|
// matFXGlobals.pipelines[rw::platform]->render(atomic);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(VehiclePipeSwitch == VEHICLEPIPE_MOBILE){
|
||||||
|
leedsVehicleRenderCB_mobile(atomic, header);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,15 +349,15 @@ CreateVehiclePipe(void)
|
||||||
using namespace rw;
|
using namespace rw;
|
||||||
using namespace rw::gl3;
|
using namespace rw::gl3;
|
||||||
|
|
||||||
if(CFileMgr::LoadFile("neo/carTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0)
|
// if(CFileMgr::LoadFile("neo/carTweakingTable.dat", work_buff, sizeof(work_buff), "r") <= 0)
|
||||||
printf("Error: couldn't open 'neo/carTweakingTable.dat'\n");
|
// printf("Error: couldn't open 'neo/carTweakingTable.dat'\n");
|
||||||
else{
|
// else{
|
||||||
char *fp = (char*)work_buff;
|
// char *fp = (char*)work_buff;
|
||||||
fp = ReadTweakValueTable(fp, Fresnel);
|
// fp = ReadTweakValueTable(fp, Fresnel);
|
||||||
fp = ReadTweakValueTable(fp, Power);
|
// fp = ReadTweakValueTable(fp, Power);
|
||||||
fp = ReadTweakValueTable(fp, DiffColor);
|
// fp = ReadTweakValueTable(fp, DiffColor);
|
||||||
fp = ReadTweakValueTable(fp, SpecColor);
|
// fp = ReadTweakValueTable(fp, SpecColor);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -172,6 +369,28 @@ CreateVehiclePipe(void)
|
||||||
assert(neoVehicleShader);
|
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();
|
rw::gl3::ObjPipeline *pipe = rw::gl3::ObjPipeline::create();
|
||||||
pipe->instanceCB = rw::gl3::defaultInstanceCB;
|
pipe->instanceCB = rw::gl3::defaultInstanceCB;
|
||||||
|
@ -186,6 +405,15 @@ DestroyVehiclePipe(void)
|
||||||
neoVehicleShader->destroy();
|
neoVehicleShader->destroy();
|
||||||
neoVehicleShader = nil;
|
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();
|
((rw::gl3::ObjPipeline*)vehiclePipe)->destroy();
|
||||||
vehiclePipe = nil;
|
vehiclePipe = nil;
|
||||||
}
|
}
|
||||||
|
@ -197,6 +425,7 @@ DestroyVehiclePipe(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rw::gl3::Shader *leedsWorldShader;
|
rw::gl3::Shader *leedsWorldShader;
|
||||||
|
rw::gl3::Shader *leedsWorldShader_mobile;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
|
@ -219,7 +448,10 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
InstanceData *inst = header->inst;
|
InstanceData *inst = header->inst;
|
||||||
rw::int32 n = header->numMeshes;
|
rw::int32 n = header->numMeshes;
|
||||||
|
|
||||||
leedsWorldShader->use();
|
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
|
||||||
|
CustomPipes::leedsWorldShader_mobile->use();
|
||||||
|
else
|
||||||
|
CustomPipes::leedsWorldShader->use();
|
||||||
|
|
||||||
RGBAf amb, emiss;
|
RGBAf amb, emiss;
|
||||||
amb.red = CTimeCycle::GetAmbientRed();
|
amb.red = CTimeCycle::GetAmbientRed();
|
||||||
|
@ -238,14 +470,14 @@ worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||||
m = inst->material;
|
m = inst->material;
|
||||||
|
|
||||||
float cs = 1.0f;
|
float cs = 1.0f;
|
||||||
if(m->texture)
|
if(WorldPipeSwitch == WORLDPIPE_PS2 && m->texture)
|
||||||
cs = 255/128.0f;
|
cs = 255/128.0f;
|
||||||
colorscale[0] = colorscale[1] = colorscale[2] = cs;
|
colorscale[0] = colorscale[1] = colorscale[2] = cs;
|
||||||
glUniform4fv(U(u_colorscale), 1, colorscale);
|
glUniform4fv(U(u_colorscale), 1, colorscale);
|
||||||
|
|
||||||
setTexture(0, m->texture);
|
setTexture(0, m->texture);
|
||||||
|
|
||||||
setMaterial(m->color, m->surfaceProps);
|
setMaterial(m->color, m->surfaceProps, 0.5f);
|
||||||
|
|
||||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||||
|
|
||||||
|
@ -271,10 +503,14 @@ CreateWorldPipe(void)
|
||||||
{
|
{
|
||||||
#include "shaders/scale_fs_gl.inc"
|
#include "shaders/scale_fs_gl.inc"
|
||||||
#include "shaders/leedsBuilding_vs_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[] = { 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 };
|
const char *fs[] = { shaderDecl, header_frag_src, scale_frag_src, nil };
|
||||||
leedsWorldShader = Shader::create(vs, fs);
|
leedsWorldShader = Shader::create(vs, fs);
|
||||||
assert(leedsWorldShader);
|
assert(leedsWorldShader);
|
||||||
|
leedsWorldShader_mobile = Shader::create(vs_mobile, fs);
|
||||||
|
assert(leedsWorldShader_mobile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -290,6 +526,8 @@ DestroyWorldPipe(void)
|
||||||
{
|
{
|
||||||
leedsWorldShader->destroy();
|
leedsWorldShader->destroy();
|
||||||
leedsWorldShader = nil;
|
leedsWorldShader = nil;
|
||||||
|
leedsWorldShader_mobile->destroy();
|
||||||
|
leedsWorldShader_mobile = nil;
|
||||||
|
|
||||||
((rw::gl3::ObjPipeline*)worldPipe)->destroy();
|
((rw::gl3::ObjPipeline*)worldPipe)->destroy();
|
||||||
worldPipe = nil;
|
worldPipe = nil;
|
||||||
|
@ -611,10 +849,211 @@ CustomPipeRegisterGL(void)
|
||||||
u_amb = rw::gl3::registerUniform("u_amb");
|
u_amb = rw::gl3::registerUniform("u_amb");
|
||||||
u_emiss = rw::gl3::registerUniform("u_emiss");
|
u_emiss = rw::gl3::registerUniform("u_emiss");
|
||||||
u_colorscale = rw::gl3::registerUniform("u_colorscale");
|
u_colorscale = rw::gl3::registerUniform("u_colorscale");
|
||||||
|
|
||||||
|
u_texMatrix = rw::gl3::registerUniform("u_texMatrix");
|
||||||
|
u_fxparams = rw::gl3::registerUniform("u_fxparams");
|
||||||
|
|
||||||
|
u_skyTop = rw::gl3::registerUniform("u_skyTop");
|
||||||
|
u_skyBot = rw::gl3::registerUniform("u_skyBot");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
|
||||||
|
namespace WorldRender
|
||||||
|
{
|
||||||
|
|
||||||
|
struct BuildingInst
|
||||||
|
{
|
||||||
|
rw::Matrix matrix;
|
||||||
|
rw::gl3::InstanceDataHeader *instHeader;
|
||||||
|
uint8 fadeAlpha;
|
||||||
|
bool lighting;
|
||||||
|
};
|
||||||
|
BuildingInst blendInsts[3][2000];
|
||||||
|
int numBlendInsts[3];
|
||||||
|
|
||||||
|
static RwRGBAReal black;
|
||||||
|
|
||||||
|
static bool
|
||||||
|
IsTextureTransparent(RwTexture *tex)
|
||||||
|
{
|
||||||
|
if(tex == nil || tex->raster == nil)
|
||||||
|
return false;
|
||||||
|
return PLUGINOFFSET(rw::gl3::Gl3Raster, tex->raster, rw::gl3::nativeRasterOffset)->hasAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render all opaque meshes and put atomics that needs blending
|
||||||
|
// into the deferred list.
|
||||||
|
void
|
||||||
|
AtomicFirstPass(RpAtomic *atomic, int pass)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::gl3;
|
||||||
|
|
||||||
|
BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]];
|
||||||
|
|
||||||
|
atomic->getPipeline()->instance(atomic);
|
||||||
|
building->instHeader = (gl3::InstanceDataHeader*)atomic->geometry->instData;
|
||||||
|
assert(building->instHeader != nil);
|
||||||
|
assert(building->instHeader->platform == PLATFORM_GL3);
|
||||||
|
building->fadeAlpha = 255;
|
||||||
|
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||||
|
|
||||||
|
bool setupDone = false;
|
||||||
|
bool defer = false;
|
||||||
|
building->matrix = *atomic->getFrame()->getLTM();
|
||||||
|
|
||||||
|
float colorscale[4];
|
||||||
|
|
||||||
|
InstanceData *inst = building->instHeader->inst;
|
||||||
|
for(rw::uint32 i = 0; i < building->instHeader->numMeshes; i++, inst++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
|
||||||
|
if(m->texture == nil)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(inst->vertexAlpha || m->color.alpha != 255 ||
|
||||||
|
IsTextureTransparent(m->texture)){
|
||||||
|
defer = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// alright we're rendering this atomic
|
||||||
|
if(!setupDone){
|
||||||
|
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
|
||||||
|
CustomPipes::leedsWorldShader_mobile->use();
|
||||||
|
else
|
||||||
|
CustomPipes::leedsWorldShader->use();
|
||||||
|
setWorldMatrix(&building->matrix);
|
||||||
|
#ifdef RW_GL_USE_VAOS
|
||||||
|
glBindVertexArray(building->instHeader->vao);
|
||||||
|
#else
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo);
|
||||||
|
setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
RGBAf amb, emiss;
|
||||||
|
amb.red = CTimeCycle::GetAmbientRed();
|
||||||
|
amb.green = CTimeCycle::GetAmbientGreen();
|
||||||
|
amb.blue = CTimeCycle::GetAmbientBlue();
|
||||||
|
amb.alpha = 1.0f;
|
||||||
|
emiss = pAmbient->color;
|
||||||
|
|
||||||
|
glUniform4fv(U(CustomPipes::u_amb), 1, (float*)&amb);
|
||||||
|
glUniform4fv(U(CustomPipes::u_emiss), 1, (float*)&emiss);
|
||||||
|
|
||||||
|
colorscale[3] = 1.0f;
|
||||||
|
|
||||||
|
setupDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
setMaterial(m->color, m->surfaceProps, 0.5f);
|
||||||
|
|
||||||
|
float cs = 1.0f;
|
||||||
|
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture)
|
||||||
|
cs = 255/128.0f;
|
||||||
|
colorscale[0] = colorscale[1] = colorscale[2] = cs;
|
||||||
|
glUniform4fv(U(CustomPipes::u_colorscale), 1, colorscale);
|
||||||
|
|
||||||
|
setTexture(0, m->texture);
|
||||||
|
|
||||||
|
drawInst(building->instHeader, inst);
|
||||||
|
}
|
||||||
|
#ifndef RW_GL_USE_VAOS
|
||||||
|
disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
|
||||||
|
#endif
|
||||||
|
if(defer)
|
||||||
|
numBlendInsts[pass]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::gl3;
|
||||||
|
|
||||||
|
BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]];
|
||||||
|
|
||||||
|
atomic->getPipeline()->instance(atomic);
|
||||||
|
building->instHeader = (gl3::InstanceDataHeader*)atomic->geometry->instData;
|
||||||
|
assert(building->instHeader != nil);
|
||||||
|
assert(building->instHeader->platform == PLATFORM_GL3);
|
||||||
|
building->fadeAlpha = fadeAlpha;
|
||||||
|
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||||
|
building->matrix = *atomic->getFrame()->getLTM();
|
||||||
|
numBlendInsts[pass]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RenderBlendPass(int pass)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::gl3;
|
||||||
|
|
||||||
|
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_MOBILE)
|
||||||
|
CustomPipes::leedsWorldShader_mobile->use();
|
||||||
|
else
|
||||||
|
CustomPipes::leedsWorldShader->use();
|
||||||
|
|
||||||
|
RGBAf amb, emiss;
|
||||||
|
amb.red = CTimeCycle::GetAmbientRed();
|
||||||
|
amb.green = CTimeCycle::GetAmbientGreen();
|
||||||
|
amb.blue = CTimeCycle::GetAmbientBlue();
|
||||||
|
amb.alpha = 1.0f;
|
||||||
|
emiss = pAmbient->color;
|
||||||
|
|
||||||
|
glUniform4fv(U(CustomPipes::u_amb), 1, (float*)&amb);
|
||||||
|
glUniform4fv(U(CustomPipes::u_emiss), 1, (float*)&emiss);
|
||||||
|
|
||||||
|
float colorscale[4];
|
||||||
|
colorscale[3] = 1.0f;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < numBlendInsts[pass]; i++){
|
||||||
|
BuildingInst *building = &blendInsts[pass][i];
|
||||||
|
|
||||||
|
#ifdef RW_GL_USE_VAOS
|
||||||
|
glBindVertexArray(building->instHeader->vao);
|
||||||
|
#else
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo);
|
||||||
|
setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
|
||||||
|
#endif
|
||||||
|
setWorldMatrix(&building->matrix);
|
||||||
|
|
||||||
|
InstanceData *inst = building->instHeader->inst;
|
||||||
|
for(rw::uint32 j = 0; j < building->instHeader->numMeshes; j++, inst++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
if(m->texture == nil)
|
||||||
|
continue;
|
||||||
|
if(!inst->vertexAlpha && m->color.alpha == 255 && !IsTextureTransparent(m->texture) && building->fadeAlpha == 255)
|
||||||
|
continue; // already done this one
|
||||||
|
|
||||||
|
rw::RGBA color = m->color;
|
||||||
|
color.alpha = (color.alpha * building->fadeAlpha)/255;
|
||||||
|
setMaterial(color, m->surfaceProps, 0.5f);
|
||||||
|
|
||||||
|
float cs = 1.0f;
|
||||||
|
if(CustomPipes::WorldPipeSwitch == CustomPipes::WORLDPIPE_PS2 && m->texture)
|
||||||
|
cs = 255/128.0f;
|
||||||
|
colorscale[0] = colorscale[1] = colorscale[2] = cs;
|
||||||
|
glUniform4fv(U(CustomPipes::u_colorscale), 1, colorscale);
|
||||||
|
|
||||||
|
setTexture(0, m->texture);
|
||||||
|
|
||||||
|
drawInst(building->instHeader, inst);
|
||||||
|
}
|
||||||
|
#ifndef RW_GL_USE_VAOS
|
||||||
|
disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,9 +7,13 @@ class CPostFX
|
||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
POSTFX_OFF,
|
POSTFX_OFF,
|
||||||
POSTFX_SIMPLE,
|
// POSTFX_SIMPLE,
|
||||||
POSTFX_NORMAL,
|
POSTFX_NORMAL,
|
||||||
POSTFX_MOBILE
|
// POSTFX_MOBILE
|
||||||
|
|
||||||
|
// not so sensible for the moment
|
||||||
|
POSTFX_SIMPLE = -1,
|
||||||
|
POSTFX_MOBILE = -2
|
||||||
};
|
};
|
||||||
static RwRaster *pFrontBuffer;
|
static RwRaster *pFrontBuffer;
|
||||||
static RwRaster *pBackBuffer;
|
static RwRaster *pBackBuffer;
|
||||||
|
|
|
@ -4,7 +4,9 @@ all: im2d_gl.inc simple_fs_gl.inc default_UV2_gl.inc \
|
||||||
neoWorldVC_fs_gl.inc neoGloss_vs_gl.inc neoGloss_fs_gl.inc \
|
neoWorldVC_fs_gl.inc neoGloss_vs_gl.inc neoGloss_fs_gl.inc \
|
||||||
neoVehicle_vs_gl.inc neoVehicle_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 scale_fs_gl.inc
|
leedsBuilding_vs_gl.inc leedsBuilding_mobile_vs_gl.inc scale_fs_gl.inc \
|
||||||
|
leedsVehicle_vs_gl.inc leedsVehicle_add_gl.inc leedsVehicle_blend_gl.inc \
|
||||||
|
leedsVehicle_mobile_vs_gl.inc leedsVehicle_mobile_fs_gl.inc
|
||||||
|
|
||||||
im2d_gl.inc: im2d.vert
|
im2d_gl.inc: im2d.vert
|
||||||
(echo 'const char *im2d_vert_src =';\
|
(echo 'const char *im2d_vert_src =';\
|
||||||
|
@ -83,7 +85,37 @@ leedsBuilding_vs_gl.inc: leedsBuilding.vert
|
||||||
sed 's/..*/"&\\n"/' leedsBuilding.vert;\
|
sed 's/..*/"&\\n"/' leedsBuilding.vert;\
|
||||||
echo ';') >leedsBuilding_vs_gl.inc
|
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
|
scale_fs_gl.inc: scale.frag
|
||||||
(echo 'const char *scale_frag_src =';\
|
(echo 'const char *scale_frag_src =';\
|
||||||
sed 's/..*/"&\\n"/' scale.frag;\
|
sed 's/..*/"&\\n"/' scale.frag;\
|
||||||
echo ';') >scale_fs_gl.inc
|
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
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
uniform vec4 u_amb;
|
uniform vec4 u_amb;
|
||||||
uniform vec4 u_emiss;
|
uniform vec4 u_emiss;
|
||||||
|
|
||||||
|
#define surfEmissive (u_surfProps.w)
|
||||||
|
|
||||||
VSIN(ATTRIB_POS) vec3 in_pos;
|
VSIN(ATTRIB_POS) vec3 in_pos;
|
||||||
|
|
||||||
VSOUT vec4 v_color;
|
VSOUT vec4 v_color;
|
||||||
|
@ -18,7 +20,7 @@ main(void)
|
||||||
|
|
||||||
v_color = in_color;
|
v_color = in_color;
|
||||||
v_color.rgb *= u_amb.rgb;
|
v_color.rgb *= u_amb.rgb;
|
||||||
v_color.rgb += u_emiss.rgb;
|
v_color.rgb += u_emiss.rgb*surfEmissive;
|
||||||
v_color = clamp(v_color, 0.0, 1.0);
|
v_color = clamp(v_color, 0.0, 1.0);
|
||||||
v_color.a *= u_matColor.a;
|
v_color.a *= u_matColor.a;
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -1,5 +1,7 @@
|
||||||
#include "standardConstants.h"
|
#include "standardConstants.h"
|
||||||
|
|
||||||
|
#define surfEmissive (surfProps.w)
|
||||||
|
|
||||||
float4 emissive : register(c41);
|
float4 emissive : register(c41);
|
||||||
float4 ambient : register(c42);
|
float4 ambient : register(c42);
|
||||||
|
|
||||||
|
@ -8,14 +10,12 @@ struct VS_in
|
||||||
float4 Position : POSITION;
|
float4 Position : POSITION;
|
||||||
float3 Normal : NORMAL;
|
float3 Normal : NORMAL;
|
||||||
float2 TexCoord : TEXCOORD0;
|
float2 TexCoord : TEXCOORD0;
|
||||||
float2 TexCoord1 : TEXCOORD1;
|
|
||||||
float4 Prelight : COLOR0;
|
float4 Prelight : COLOR0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct VS_out {
|
struct VS_out {
|
||||||
float4 Position : POSITION;
|
float4 Position : POSITION;
|
||||||
float3 TexCoord0 : TEXCOORD0; // also fog
|
float3 TexCoord0 : TEXCOORD0; // also fog
|
||||||
float2 TexCoord1 : TEXCOORD1;
|
|
||||||
float4 Color : COLOR0;
|
float4 Color : COLOR0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@ VS_out main(in VS_in input)
|
||||||
float3 Normal = mul(normalMat, input.Normal);
|
float3 Normal = mul(normalMat, input.Normal);
|
||||||
|
|
||||||
output.TexCoord0.xy = input.TexCoord;
|
output.TexCoord0.xy = input.TexCoord;
|
||||||
output.TexCoord1.xy = input.TexCoord1;
|
|
||||||
|
|
||||||
output.Color = input.Prelight;
|
output.Color = input.Prelight;
|
||||||
output.Color.rgb *= ambient.rgb;
|
output.Color.rgb *= ambient.rgb;
|
||||||
output.Color.rgb += emissive.rgb;
|
output.Color.rgb += emissive.rgb*surfEmissive;
|
||||||
|
|
||||||
output.Color = clamp(output.Color, 0.0, 1.0);
|
output.Color = clamp(output.Color, 0.0, 1.0);
|
||||||
output.Color.a *= matCol.a;
|
output.Color.a *= matCol.a;
|
||||||
|
|
|
@ -1,37 +1,40 @@
|
||||||
static unsigned char leedsBuilding_VS_cso[] = {
|
static unsigned char leedsBuilding_VS_cso[] = {
|
||||||
0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x42, 0x00, 0x43, 0x54, 0x41, 0x42,
|
0x00, 0x02, 0xfe, 0xff, 0xfe, 0xff, 0x4a, 0x00, 0x43, 0x54, 0x41, 0x42,
|
||||||
0x1c, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff,
|
0x1c, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xff,
|
||||||
0x05, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
0x06, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
||||||
0xcc, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x2a, 0x00,
|
0xea, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x02, 0x00, 0x2a, 0x00,
|
||||||
0x01, 0x00, 0xaa, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x01, 0x00, 0xaa, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x98, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00,
|
0xac, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00,
|
||||||
0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00,
|
0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00,
|
||||||
0x02, 0x00, 0x29, 0x00, 0x01, 0x00, 0xa6, 0x00, 0x88, 0x00, 0x00, 0x00,
|
0x02, 0x00, 0x29, 0x00, 0x01, 0x00, 0xa6, 0x00, 0x9c, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0e, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0e, 0x00,
|
||||||
0x01, 0x00, 0x3a, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x01, 0x00, 0x3a, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0xc5, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x32, 0x00,
|
0xd9, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x32, 0x00,
|
||||||
0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x6d, 0x62, 0x69,
|
0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
|
||||||
0x65, 0x6e, 0x74, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00,
|
0x02, 0x00, 0x0d, 0x00, 0x01, 0x00, 0x36, 0x00, 0x9c, 0x00, 0x00, 0x00,
|
||||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6d, 0x62,
|
0x00, 0x00, 0x00, 0x00, 0x61, 0x6d, 0x62, 0x69, 0x65, 0x6e, 0x74, 0x00,
|
||||||
0x69, 0x6e, 0x65, 0x64, 0x4d, 0x61, 0x74, 0x00, 0x03, 0x00, 0x03, 0x00,
|
0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x65, 0x64,
|
||||||
0x65, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x76, 0x65, 0x00, 0x66, 0x6f, 0x67,
|
0x4d, 0x61, 0x74, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00,
|
||||||
0x44, 0x61, 0x74, 0x61, 0x00, 0x6d, 0x61, 0x74, 0x43, 0x6f, 0x6c, 0x00,
|
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x6d, 0x69, 0x73,
|
||||||
0x76, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f,
|
0x73, 0x69, 0x76, 0x65, 0x00, 0x66, 0x6f, 0x67, 0x44, 0x61, 0x74, 0x61,
|
||||||
0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53,
|
0x00, 0x6d, 0x61, 0x74, 0x43, 0x6f, 0x6c, 0x00, 0x73, 0x75, 0x72, 0x66,
|
||||||
0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d,
|
0x50, 0x72, 0x6f, 0x70, 0x73, 0x00, 0x76, 0x73, 0x5f, 0x32, 0x5f, 0x30,
|
||||||
0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39,
|
0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28,
|
||||||
0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05,
|
0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64,
|
||||||
0x04, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
|
0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02,
|
0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31,
|
||||||
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02,
|
0x31, 0x00, 0xab, 0xab, 0x51, 0x00, 0x00, 0x05, 0x04, 0x00, 0x0f, 0xa0,
|
||||||
0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x05, 0x00, 0x01, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02,
|
0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80,
|
||||||
0x0a, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02,
|
0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80,
|
||||||
0x00, 0x00, 0x07, 0x80, 0x2a, 0x00, 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04,
|
0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80,
|
||||||
0x00, 0x00, 0x07, 0x80, 0x03, 0x00, 0xe4, 0x90, 0x00, 0x00, 0xe4, 0x80,
|
0x02, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0x80,
|
||||||
0x29, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80,
|
0x29, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80,
|
||||||
0x03, 0x00, 0xff, 0x90, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 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, 0xe4, 0x80, 0x04, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x03,
|
||||||
0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x55, 0xa0,
|
0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x55, 0xa0,
|
||||||
0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0xd0, 0x00, 0x00, 0xff, 0x80,
|
0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0xd0, 0x00, 0x00, 0xff, 0x80,
|
||||||
|
@ -50,6 +53,5 @@ static unsigned char leedsBuilding_VS_cso[] = {
|
||||||
0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03,
|
0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0xff, 0xa0, 0x0a, 0x00, 0x00, 0x03,
|
||||||
0x00, 0x00, 0x04, 0xe0, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x55, 0xa0,
|
0x00, 0x00, 0x04, 0xe0, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x55, 0xa0,
|
||||||
0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90,
|
0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0xe0, 0x01, 0x00, 0xe4, 0x90,
|
||||||
0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x03, 0xe0, 0x02, 0x00, 0xe4, 0x90,
|
|
||||||
0xff, 0xff, 0x00, 0x00
|
0xff, 0xff, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
52
src/extras/shaders/leedsBuilding_mobile.vert
Normal file
52
src/extras/shaders/leedsBuilding_mobile.vert
Normal file
|
@ -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);
|
||||||
|
}
|
BIN
src/extras/shaders/leedsBuilding_mobile_VS.cso
Normal file
BIN
src/extras/shaders/leedsBuilding_mobile_VS.cso
Normal file
Binary file not shown.
64
src/extras/shaders/leedsBuilding_mobile_VS.hlsl
Normal file
64
src/extras/shaders/leedsBuilding_mobile_VS.hlsl
Normal file
|
@ -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;
|
||||||
|
}
|
70
src/extras/shaders/leedsBuilding_mobile_VS.inc
Normal file
70
src/extras/shaders/leedsBuilding_mobile_VS.inc
Normal file
|
@ -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
|
||||||
|
};
|
54
src/extras/shaders/leedsBuilding_mobile_vs_gl.inc
Normal file
54
src/extras/shaders/leedsBuilding_mobile_vs_gl.inc
Normal file
|
@ -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"
|
||||||
|
;
|
|
@ -2,6 +2,8 @@ const char *leedsBuilding_vert_src =
|
||||||
"uniform vec4 u_amb;\n"
|
"uniform vec4 u_amb;\n"
|
||||||
"uniform vec4 u_emiss;\n"
|
"uniform vec4 u_emiss;\n"
|
||||||
|
|
||||||
|
"#define surfEmissive (u_surfProps.w)\n"
|
||||||
|
|
||||||
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
|
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
|
||||||
|
|
||||||
"VSOUT vec4 v_color;\n"
|
"VSOUT vec4 v_color;\n"
|
||||||
|
@ -19,7 +21,7 @@ const char *leedsBuilding_vert_src =
|
||||||
|
|
||||||
" v_color = in_color;\n"
|
" v_color = in_color;\n"
|
||||||
" v_color.rgb *= u_amb.rgb;\n"
|
" v_color.rgb *= u_amb.rgb;\n"
|
||||||
" v_color.rgb += u_emiss.rgb;\n"
|
" v_color.rgb += u_emiss.rgb*surfEmissive;\n"
|
||||||
" v_color = clamp(v_color, 0.0, 1.0);\n"
|
" v_color = clamp(v_color, 0.0, 1.0);\n"
|
||||||
" v_color.a *= u_matColor.a;\n"
|
" v_color.a *= u_matColor.a;\n"
|
||||||
|
|
||||||
|
|
27
src/extras/shaders/leedsVehicle.vert
Normal file
27
src/extras/shaders/leedsVehicle.vert
Normal file
|
@ -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);
|
||||||
|
}
|
BIN
src/extras/shaders/leedsVehicle_VS.cso
Normal file
BIN
src/extras/shaders/leedsVehicle_VS.cso
Normal file
Binary file not shown.
45
src/extras/shaders/leedsVehicle_VS.hlsl
Normal file
45
src/extras/shaders/leedsVehicle_VS.hlsl
Normal file
|
@ -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;
|
||||||
|
}
|
103
src/extras/shaders/leedsVehicle_VS.inc
Normal file
103
src/extras/shaders/leedsVehicle_VS.inc
Normal file
|
@ -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
|
||||||
|
};
|
32
src/extras/shaders/leedsVehicle_add.frag
Normal file
32
src/extras/shaders/leedsVehicle_add.frag
Normal file
|
@ -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);
|
||||||
|
}
|
BIN
src/extras/shaders/leedsVehicle_add_PS.cso
Normal file
BIN
src/extras/shaders/leedsVehicle_add_PS.cso
Normal file
Binary file not shown.
34
src/extras/shaders/leedsVehicle_add_PS.hlsl
Normal file
34
src/extras/shaders/leedsVehicle_add_PS.hlsl
Normal file
|
@ -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;
|
||||||
|
}
|
44
src/extras/shaders/leedsVehicle_add_PS.inc
Normal file
44
src/extras/shaders/leedsVehicle_add_PS.inc
Normal file
|
@ -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
|
||||||
|
};
|
34
src/extras/shaders/leedsVehicle_add_gl.inc
Normal file
34
src/extras/shaders/leedsVehicle_add_gl.inc
Normal file
|
@ -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"
|
||||||
|
;
|
32
src/extras/shaders/leedsVehicle_blend.frag
Normal file
32
src/extras/shaders/leedsVehicle_blend.frag
Normal file
|
@ -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);
|
||||||
|
}
|
BIN
src/extras/shaders/leedsVehicle_blend_PS.cso
Normal file
BIN
src/extras/shaders/leedsVehicle_blend_PS.cso
Normal file
Binary file not shown.
33
src/extras/shaders/leedsVehicle_blend_PS.hlsl
Normal file
33
src/extras/shaders/leedsVehicle_blend_PS.hlsl
Normal file
|
@ -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;
|
||||||
|
}
|
50
src/extras/shaders/leedsVehicle_blend_PS.inc
Normal file
50
src/extras/shaders/leedsVehicle_blend_PS.inc
Normal file
|
@ -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
|
||||||
|
};
|
34
src/extras/shaders/leedsVehicle_blend_gl.inc
Normal file
34
src/extras/shaders/leedsVehicle_blend_gl.inc
Normal file
|
@ -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"
|
||||||
|
;
|
76
src/extras/shaders/leedsVehicle_mobile.frag
Normal file
76
src/extras/shaders/leedsVehicle_mobile.frag
Normal file
|
@ -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);
|
||||||
|
}
|
40
src/extras/shaders/leedsVehicle_mobile.vert
Normal file
40
src/extras/shaders/leedsVehicle_mobile.vert
Normal file
|
@ -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);
|
||||||
|
}
|
BIN
src/extras/shaders/leedsVehicle_mobile_PS.cso
Normal file
BIN
src/extras/shaders/leedsVehicle_mobile_PS.cso
Normal file
Binary file not shown.
53
src/extras/shaders/leedsVehicle_mobile_PS.hlsl
Normal file
53
src/extras/shaders/leedsVehicle_mobile_PS.hlsl
Normal file
|
@ -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;
|
||||||
|
}
|
63
src/extras/shaders/leedsVehicle_mobile_PS.inc
Normal file
63
src/extras/shaders/leedsVehicle_mobile_PS.inc
Normal file
|
@ -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
|
||||||
|
};
|
BIN
src/extras/shaders/leedsVehicle_mobile_VS.cso
Normal file
BIN
src/extras/shaders/leedsVehicle_mobile_VS.cso
Normal file
Binary file not shown.
57
src/extras/shaders/leedsVehicle_mobile_VS.hlsl
Normal file
57
src/extras/shaders/leedsVehicle_mobile_VS.hlsl
Normal file
|
@ -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;
|
||||||
|
}
|
132
src/extras/shaders/leedsVehicle_mobile_VS.inc
Normal file
132
src/extras/shaders/leedsVehicle_mobile_VS.inc
Normal file
|
@ -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
|
||||||
|
};
|
78
src/extras/shaders/leedsVehicle_mobile_fs_gl.inc
Normal file
78
src/extras/shaders/leedsVehicle_mobile_fs_gl.inc
Normal file
|
@ -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"
|
||||||
|
;
|
42
src/extras/shaders/leedsVehicle_mobile_vs_gl.inc
Normal file
42
src/extras/shaders/leedsVehicle_mobile_vs_gl.inc
Normal file
|
@ -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"
|
||||||
|
;
|
29
src/extras/shaders/leedsVehicle_vs_gl.inc
Normal file
29
src/extras/shaders/leedsVehicle_vs_gl.inc
Normal file
|
@ -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"
|
||||||
|
;
|
|
@ -394,7 +394,7 @@ RwStream *RwStreamOpen(RwStreamType type, RwStreamAccessType accessType, const v
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RwBool RwStreamClose(RwStream * stream, void *pData) { stream->close(); rwFree(stream); return true; }
|
RwBool RwStreamClose(RwStream * stream, void *pData) { if (!stream) return false; stream->close(); rwFree(stream); return true; }
|
||||||
RwUInt32 RwStreamRead(RwStream * stream, void *buffer, RwUInt32 length) { return stream->read8(buffer, length); }
|
RwUInt32 RwStreamRead(RwStream * stream, void *buffer, RwUInt32 length) { return stream->read8(buffer, length); }
|
||||||
RwStream *RwStreamWrite(RwStream * stream, const void *buffer, RwUInt32 length) { stream->write8(buffer, length); return stream; }
|
RwStream *RwStreamWrite(RwStream * stream, const void *buffer, RwUInt32 length) { stream->write8(buffer, length); return stream; }
|
||||||
RwStream *RwStreamSkip(RwStream * stream, RwUInt32 offset) { stream->seek(offset); return stream; }
|
RwStream *RwStreamSkip(RwStream * stream, RwUInt32 offset) { stream->seek(offset); return stream; }
|
||||||
|
|
|
@ -64,12 +64,12 @@ void* operator new[](size_t size)
|
||||||
return base::cMainMemoryManager::Instance()->Allocate(size);
|
return base::cMainMemoryManager::Instance()->Allocate(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void* buf)
|
void operator delete(void* buf) noexcept
|
||||||
{
|
{
|
||||||
base::cMainMemoryManager::Instance()->Free(buf);
|
base::cMainMemoryManager::Instance()->Free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete[](void* buf)
|
void operator delete[](void* buf) noexcept
|
||||||
{
|
{
|
||||||
base::cMainMemoryManager::Instance()->Free(buf);
|
base::cMainMemoryManager::Instance()->Free(buf);
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue