Merge branch 'master' into miami

# Conflicts:
#	src/animation/RpAnimBlend.cpp
#	src/audio/oal/stream.cpp
#	src/audio/sampman.h
#	src/control/Pickups.cpp
#	src/core/Collision.cpp
#	src/core/Collision.h
#	src/core/FileLoader.cpp
#	src/core/FileMgr.cpp
#	src/core/FileMgr.h
#	src/core/Streaming.cpp
#	src/core/Streaming.h
#	src/core/SurfaceTable.h
#	src/modelinfo/VehicleModelInfo.h
#	src/peds/Ped.cpp
#	src/rw/RwHelper.cpp
#	src/rw/RwHelper.h
#	src/skel/glfw/glfw.cpp
#	src/skel/platform.h
#	src/text/Text.cpp
#	src/text/Text.h
#	src/vehicles/CarGen.cpp
#	src/vehicles/Heli.cpp
This commit is contained in:
Sergeanur 2020-07-29 15:34:57 +03:00
commit acdc52116e
14 changed files with 377 additions and 41 deletions

View File

@ -720,15 +720,9 @@ CPickups::DoPickUpEffects(CEntity *entity)
const CVector& pos = entity->GetPosition(); const CVector& pos = entity->GetPosition();
if (doOuterGlow) { if (doOuterGlow) {
float colorModifier = ((CGeneral::GetRandomNumber() & 0x1F) * 0.015f + 1.0f) * modifiedSin * 0.15f; float colorModifier = ((CGeneral::GetRandomNumber() & 0x1F) * 0.015f + 1.0f) * modifiedSin * 0.15f;
CShadows::StoreStaticShadow( CShadows::StoreStaticShadow((uintptr)entity, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, 2.0f, 0.0f, 0.0f, -2.0f, 0,
(uintptr)entity, aWeaponReds[colorId] * colorModifier, aWeaponGreens[colorId] * colorModifier, aWeaponBlues[colorId] * colorModifier, 4.0f,
SHADOWTYPE_ADDITIVE, 1.0f, 40.0f, false, 0.0f);
gpShadowExplosionTex,
&pos,
2.0f, 0.0f, 0.0f, -2.0f,
255, // this is 0 on PC which results in no shadow
aWeaponReds[colorId] * colorModifier, aWeaponGreens[colorId] * colorModifier, aWeaponBlues[colorId] * colorModifier,
4.0f, 1.0f, 40.0f, false, 0.0f);
float radius = (CGeneral::GetRandomNumber() & 0xF) * 0.1f + 3.0f; float radius = (CGeneral::GetRandomNumber() & 0xF) * 0.1f + 3.0f;
CPointLights::AddLight(CPointLights::LIGHT_POINT, pos, CVector(0.0f, 0.0f, 0.0f), radius, aWeaponReds[colorId] * modifiedSin / 256.0f, aWeaponGreens[colorId] * modifiedSin / 256.0f, aWeaponBlues[colorId] * modifiedSin / 256.0f, CPointLights::FOG_NONE, true); CPointLights::AddLight(CPointLights::LIGHT_POINT, pos, CVector(0.0f, 0.0f, 0.0f), radius, aWeaponReds[colorId] * modifiedSin / 256.0f, aWeaponGreens[colorId] * modifiedSin / 256.0f, aWeaponBlues[colorId] * modifiedSin / 256.0f, CPointLights::FOG_NONE, true);
@ -792,11 +786,8 @@ CPickups::DoMineEffects(CEntity *entity)
float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x1FF) * DEGTORAD(360.0f / 0x200)); float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x1FF) * DEGTORAD(360.0f / 0x200));
int32 red = (MAXDIST - dist) * (0.5f * s + 0.5f) / MAXDIST * 64.0f; int32 red = (MAXDIST - dist) * (0.5f * s + 0.5f) / MAXDIST * 64.0f;
CShadows::StoreStaticShadow((uintptr)entity, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, CShadows::StoreStaticShadow((uintptr)entity, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, 2.0f, 0.0f, 0.0f, -2.0f, 0, red, 0, 0, 4.0f, 1.0f, 40.0f,
2.0f, 0.0f, 0.0f, -2.0f, false, 0.0f);
255, // this is 0 on PC which results in no shadow
red, 0, 0,
4.0f, 1.0f, 40.0f, false, 0.0f);
CCoronas::RegisterCorona((uintptr)entity, red, 0, 0, 255, pos, 0.6f, 60.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); CCoronas::RegisterCorona((uintptr)entity, red, 0, 0, 255, pos, 0.6f, 60.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
} }
@ -814,11 +805,8 @@ CPickups::DoMoneyEffects(CEntity *entity)
float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x3FF) * DEGTORAD(360.0f / 0x400)); float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x3FF) * DEGTORAD(360.0f / 0x400));
int32 green = (MAXDIST - dist) * (0.2f * s + 0.3f) / MAXDIST * 64.0f; int32 green = (MAXDIST - dist) * (0.2f * s + 0.3f) / MAXDIST * 64.0f;
CShadows::StoreStaticShadow((uintptr)entity, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, CShadows::StoreStaticShadow((uintptr)entity, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, 2.0f, 0.0f, 0.0f, -2.0f, 0, 0, green, 0, 4.0f, 1.0f,
2.0f, 0.0f, 0.0f, -2.0f, 40.0f, false, 0.0f);
255, // this is 0 on PC which results in no shadow
0, green, 0,
4.0f, 1.0f, 40.0f, false, 0.0f);
CCoronas::RegisterCorona((uintptr)entity, 0, green, 0, 255, pos, 0.4f, 40.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); CCoronas::RegisterCorona((uintptr)entity, 0, green, 0, 255, pos, 0.4f, 40.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
} }
@ -836,11 +824,8 @@ CPickups::DoCollectableEffects(CEntity *entity)
float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800)); float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800));
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, CShadows::StoreStaticShadow((uintptr)entity, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &pos, 2.0f, 0.0f, 0.0f, -2.0f, 0, color, color, color, 4.0f,
2.0f, 0.0f, 0.0f, -2.0f, 1.0f, 40.0f, false, 0.0f);
255, // this is 0 on PC which results in no shadow
color, color, color,
4.0f, 1.0f, 40.0f, false, 0.0f);
CCoronas::RegisterCorona((uintptr)entity, color, color, color, 255, pos, 0.6f, 40.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f); CCoronas::RegisterCorona((uintptr)entity, color, color, color, 255, pos, 0.6f, 40.0f, CCoronas::TYPE_RING, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
} }

View File

@ -3995,8 +3995,8 @@ CCamera::CalculateDerivedValues(void)
m_cameraMatrix = Invert(m_matrix); m_cameraMatrix = Invert(m_matrix);
float hfov = DEGTORAD(CDraw::GetScaledFOV()/2.0f); float hfov = DEGTORAD(CDraw::GetScaledFOV()/2.0f);
float c = cos(hfov); float c = Cos(hfov);
float s = sin(hfov); float s = Sin(hfov);
// right plane // right plane
m_vecFrustumNormals[0] = CVector(c, -s, 0.0f); m_vecFrustumNormals[0] = CVector(c, -s, 0.0f);

View File

@ -141,11 +141,8 @@ CFire::ProcessFire(void)
lightpos.z = m_vecPos.z + 5.0f; lightpos.z = m_vecPos.z + 5.0f;
if (!m_pEntity) { if (!m_pEntity) {
CShadows::StoreStaticShadow((uintptr)this, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &lightpos, CShadows::StoreStaticShadow((uintptr)this, SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &lightpos, 7.0f, 0.0f, 0.0f, -7.0f, 0, nRandNumber / 2,
7.0f, 0.0f, 0.0f, -7.0f, nRandNumber / 2, 0, 10.0f, 1.0f, 40.0f, 0, 0.0f);
255, // this is 0 on PC which results in no shadow
nRandNumber / 2, nRandNumber / 2, 0,
10.0f, 1.0f, 40.0f, 0, 0.0f);
} }
fGreen = nRandNumber / 128; fGreen = nRandNumber / 128;
fRed = nRandNumber / 128; fRed = nRandNumber / 128;

View File

@ -152,9 +152,14 @@ CGame::InitialiseOnceBeforeRW(void)
return true; return true;
} }
#if !defined(LIBRW) && defined(PS2_MATFX) #ifndef LIBRW
#ifdef PS2_MATFX
void ReplaceMatFxCallback(); void ReplaceMatFxCallback();
#endif #endif // PS2_MATFX
#ifdef DUAL_PASS_RENDERING
void ReplaceAtomicPipeCallback();
#endif // DUAL_PASS_RENDERING
#endif // !LIBRW
bool bool
CGame::InitialiseRenderWare(void) CGame::InitialiseRenderWare(void)
@ -206,9 +211,14 @@ CGame::InitialiseRenderWare(void)
#else #else
rw::MatFX::modulateEnvMap = false; rw::MatFX::modulateEnvMap = false;
#endif #endif
#elif defined(PS2_MATFX) #else
#ifdef PS2_MATFX
ReplaceMatFxCallback(); ReplaceMatFxCallback();
#endif #endif // PS2_MATFX
#ifdef DUAL_PASS_RENDERING
ReplaceAtomicPipeCallback();
#endif // DUAL_PASS_RENDERING
#endif // LIBRW
CFont::Initialise(); CFont::Initialise();
CHud::Initialise(); CHud::Initialise();

View File

@ -8,6 +8,7 @@
#include "common.h" #include "common.h"
#include "crossplatform.h" #include "crossplatform.h"
#include "platform.h"
#ifdef XINPUT #ifdef XINPUT
#include <xinput.h> #include <xinput.h>
#pragma comment( lib, "Xinput9_1_0.lib" ) #pragma comment( lib, "Xinput9_1_0.lib" )

View File

@ -88,6 +88,16 @@ IsShootThrough(uint8 surfType)
return false; return false;
} }
inline bool
IsSeeThrough(uint8 surfType)
{
switch(surfType)
case SURFACE_GLASS:
case SURFACE_TRANSPARENT_CLOTH:
return true;
return false;
}
class CSurfaceTable class CSurfaceTable
{ {
static float ms_aAdhesiveLimitTable[NUMADHESIVEGROUPS][NUMADHESIVEGROUPS]; static float ms_aAdhesiveLimitTable[NUMADHESIVEGROUPS][NUMADHESIVEGROUPS];

View File

@ -214,6 +214,7 @@ enum Config {
#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 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 DUAL_PASS_RENDERING // dual pass rendering from SkyGfx
#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number #define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
//#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time //#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time
//#define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU //#define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU
@ -292,4 +293,7 @@ enum Config {
#define FREE_CAM // Rotating cam #define FREE_CAM // Rotating cam
// Audio // Audio
#ifndef AUDIO_OAL // is not working yet for openal
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot #define AUDIO_CACHE // cache sound lengths to speed up the cold boot
#endif
//#define PS2_AUDIO // changes audio paths for cutscenes and radio to PS2 paths, needs vbdec to support VB with MSS

View File

@ -797,6 +797,8 @@ CShadows::RenderStaticShadows(void)
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void *)FALSE); RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void *)FALSE);
SetAlphaTest(0);
for ( int32 i = 0; i < MAX_STATICSHADOWS; i++ ) for ( int32 i = 0; i < MAX_STATICSHADOWS; i++ )
aStaticShadows[i].m_bRendered = false; aStaticShadows[i].m_bRendered = false;
@ -850,6 +852,7 @@ CShadows::RenderStaticShadows(void)
RenderBuffer::RenderStuffInBuffer(); RenderBuffer::RenderStuffInBuffer();
} }
} }
RestoreAlphaTest();
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)TRUE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)TRUE);

247
src/rw/RwDualPass.cpp Normal file
View File

@ -0,0 +1,247 @@
#ifndef LIBRW
#define WITHD3D
#include "common.h"
#ifdef DUAL_PASS_RENDERING
#include "rwcore.h"
extern "C" {
RwBool _rwD3D8RenderStateIsVertexAlphaEnable(void);
RwBool _rwD3D8RenderStateVertexAlphaEnable(RwBool enable);
RwRaster *_rwD3D8RWGetRasterStage(RwUInt32 stage);
}
extern bool gPS2alphaTest;
void
_rxD3D8DualPassRenderCallback(RwResEntry *repEntry, void *object, RwUInt8 type, RwUInt32 flags)
{
RxD3D8ResEntryHeader *resEntryHeader;
RxD3D8InstanceData *instancedData;
RwInt32 numMeshes;
RwBool lighting;
RwBool vertexAlphaBlend;
RwBool forceBlack;
RwUInt32 ditherEnable;
RwUInt32 shadeMode;
void *lastVertexBuffer;
/* Get lighting state */
RwD3D8GetRenderState(D3DRS_LIGHTING, &lighting);
forceBlack = FALSE;
if (lighting) {
if (flags & rxGEOMETRY_PRELIT) {
/* Emmisive color from the vertex colors */
RwD3D8SetRenderState(D3DRS_COLORVERTEX, TRUE);
RwD3D8SetRenderState(D3DRS_EMISSIVEMATERIALSOURCE, D3DMCS_COLOR1);
} else {
/* Emmisive color from material, set to black in the submit node */
RwD3D8SetRenderState(D3DRS_COLORVERTEX, FALSE);
RwD3D8SetRenderState(D3DRS_EMISSIVEMATERIALSOURCE, D3DMCS_MATERIAL);
}
} else {
if ((flags & rxGEOMETRY_PRELIT) == 0) {
forceBlack = TRUE;
RwD3D8GetRenderState(D3DRS_DITHERENABLE, &ditherEnable);
RwD3D8GetRenderState(D3DRS_SHADEMODE, &shadeMode);
RwD3D8SetRenderState(D3DRS_TEXTUREFACTOR, 0xff000000);
RwD3D8SetRenderState(D3DRS_DITHERENABLE, FALSE);
RwD3D8SetRenderState(D3DRS_SHADEMODE, D3DSHADE_FLAT);
}
}
/* Enable clipping */
if (type == rpATOMIC) {
RpAtomic *atomic;
RwCamera *cam;
atomic = (RpAtomic *)object;
cam = RwCameraGetCurrentCamera();
// RWASSERT(cam);
if (RwD3D8CameraIsSphereFullyInsideFrustum(cam, RpAtomicGetWorldBoundingSphere(atomic))) {
RwD3D8SetRenderState(D3DRS_CLIPPING, FALSE);
} else {
RwD3D8SetRenderState(D3DRS_CLIPPING, TRUE);
}
} else {
RpWorldSector *worldSector;
RwCamera *cam;
worldSector = (RpWorldSector *)object;
cam = RwCameraGetCurrentCamera();
// RWASSERT(cam);
if (RwD3D8CameraIsBBoxFullyInsideFrustum(cam, RpWorldSectorGetTightBBox(worldSector))) {
RwD3D8SetRenderState(D3DRS_CLIPPING, FALSE);
} else {
RwD3D8SetRenderState(D3DRS_CLIPPING, TRUE);
}
}
/* Set texture to NULL if hasn't any texture flags */
if ((flags & (rxGEOMETRY_TEXTURED | rpGEOMETRYTEXTURED2)) == 0) {
RwD3D8SetTexture(NULL, 0);
if (forceBlack) {
RwD3D8SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG2);
RwD3D8SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TFACTOR);
RwD3D8SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
}
}
/* Get vertex alpha Blend state */
vertexAlphaBlend = _rwD3D8RenderStateIsVertexAlphaEnable();
/* Set Last vertex buffer to force the call */
lastVertexBuffer = (void *)0xffffffff;
/* Get the instanced data */
resEntryHeader = (RxD3D8ResEntryHeader *)(repEntry + 1);
instancedData = (RxD3D8InstanceData *)(resEntryHeader + 1);
/*
* Data shared between meshes
*/
/*
* Set the Default Pixel shader
*/
RwD3D8SetPixelShader(0);
/*
* Vertex shader
*/
RwD3D8SetVertexShader(instancedData->vertexShader);
/* Get the number of meshes */
numMeshes = resEntryHeader->numMeshes;
while (numMeshes--) {
// RWASSERT(instancedData->material != NULL);
if ((flags & (rxGEOMETRY_TEXTURED | rpGEOMETRYTEXTURED2))) {
RwD3D8SetTexture(instancedData->material->texture, 0);
if (forceBlack) {
/* Only change the colorop, we need to use the texture alpha channel */
RwD3D8SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG2);
RwD3D8SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TFACTOR);
}
}
if (instancedData->vertexAlpha || (0xFF != instancedData->material->color.alpha)) {
if (!vertexAlphaBlend) {
vertexAlphaBlend = TRUE;
_rwD3D8RenderStateVertexAlphaEnable(TRUE);
}
} else {
if (vertexAlphaBlend) {
vertexAlphaBlend = FALSE;
_rwD3D8RenderStateVertexAlphaEnable(FALSE);
}
}
if (lighting) {
if (instancedData->vertexAlpha) {
RwD3D8SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_COLOR1);
} else {
RwD3D8SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_MATERIAL);
}
RwD3D8SetSurfaceProperties(&instancedData->material->color, &instancedData->material->surfaceProps, (flags & rxGEOMETRY_MODULATE));
}
/*
* Render
*/
/* Set the stream source */
if (lastVertexBuffer != instancedData->vertexBuffer) {
RwD3D8SetStreamSource(0, instancedData->vertexBuffer, instancedData->stride);
lastVertexBuffer = instancedData->vertexBuffer;
}
if (!gPS2alphaTest) {
/* Set the Index buffer */
if (instancedData->indexBuffer != NULL) {
RwD3D8SetIndices(instancedData->indexBuffer, instancedData->baseIndex);
/* Draw the indexed primitive */
RwD3D8DrawIndexedPrimitive((D3DPRIMITIVETYPE)instancedData->primType, 0, instancedData->numVertices, 0, instancedData->numIndices);
} else {
RwD3D8DrawPrimitive((D3DPRIMITIVETYPE)instancedData->primType, instancedData->baseIndex, instancedData->numVertices);
}
} else {
RwD3D8SetIndices(instancedData->indexBuffer, instancedData->baseIndex);
int hasAlpha, alphafunc, alpharef, zwrite;
RwD3D8GetRenderState(D3DRS_ALPHABLENDENABLE, &hasAlpha);
RwD3D8GetRenderState(D3DRS_ZWRITEENABLE, &zwrite);
if (hasAlpha && zwrite) {
RwD3D8GetRenderState(D3DRS_ALPHAFUNC, &alphafunc);
RwD3D8GetRenderState(D3DRS_ALPHAREF, &alpharef);
RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);
RwD3D8SetRenderState(D3DRS_ALPHAREF, 128);
if (instancedData->indexBuffer)
RwD3D8DrawIndexedPrimitive(instancedData->primType, 0, instancedData->numVertices, 0, instancedData->numIndices);
else
RwD3D8DrawPrimitive(instancedData->primType, instancedData->baseIndex, instancedData->numVertices);
RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_LESS);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
if (instancedData->indexBuffer)
RwD3D8DrawIndexedPrimitive(instancedData->primType, 0, instancedData->numVertices, 0, instancedData->numIndices);
else
RwD3D8DrawPrimitive(instancedData->primType, instancedData->baseIndex, instancedData->numVertices);
RwD3D8SetRenderState(D3DRS_ALPHAFUNC, alphafunc);
RwD3D8SetRenderState(D3DRS_ALPHAREF, alpharef);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)TRUE);
} else {
if (instancedData->indexBuffer)
RwD3D8DrawIndexedPrimitive(instancedData->primType, 0, instancedData->numVertices, 0, instancedData->numIndices);
else
RwD3D8DrawPrimitive(instancedData->primType, instancedData->baseIndex, instancedData->numVertices);
}
}
/* Move onto the next instancedData */
instancedData++;
}
if (forceBlack) {
RwD3D8SetRenderState(D3DRS_DITHERENABLE, ditherEnable);
RwD3D8SetRenderState(D3DRS_SHADEMODE, shadeMode);
if (_rwD3D8RWGetRasterStage(0)) {
RwD3D8SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
RwD3D8SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
} else {
RwD3D8SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG2);
RwD3D8SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
}
}
}
void
ReplaceAtomicPipeCallback()
{
RxD3D8AllInOneSetRenderCallBack(RxPipelineFindNodeByName(RXPIPELINEGLOBAL(platformAtomicPipeline), RxNodeDefinitionGetD3D8AtomicAllInOne()->name, nil, nil),
_rxD3D8DualPassRenderCallback);
}
#endif // DUAL_PASS_RENDERING
#endif // !LIBRW

View File

@ -11,7 +11,11 @@
RtCharset *debugCharset; RtCharset *debugCharset;
#endif #endif
bool gPS2alphaTest = 1; #ifdef DUAL_PASS_RENDERING
bool gPS2alphaTest = true;
#else
bool gPS2alphaTest = false;
#endif
bool gBackfaceCulling; bool gBackfaceCulling;
#ifndef FINAL #ifndef FINAL
@ -688,3 +692,37 @@ ConvertPlatformAtomic(RpAtomic *atomic, void *data)
return atomic; return atomic;
} }
#endif #endif
#if defined(FIX_BUGS) && defined(GTA_PC)
RwUInt32 saved_alphafunc, saved_alpharef;
void
SetAlphaTest(RwUInt32 alpharef)
{
#ifdef LIBRW
saved_alphafunc = rw::GetRenderState(rw::ALPHATESTFUNC);
saved_alpharef = rw::GetRenderState(rw::ALPHATESTREF);
rw::SetRenderState(rw::ALPHATESTFUNC, rw::ALPHAGREATEREQUAL);
rw::SetRenderState(rw::ALPHATESTREF, 0);
#else
RwD3D8GetRenderState(D3DRS_ALPHAFUNC, &saved_alphafunc);
RwD3D8GetRenderState(D3DRS_ALPHAREF, &saved_alpharef);
RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);
RwD3D8SetRenderState(D3DRS_ALPHAREF, alpharef);
#endif
}
void
RestoreAlphaTest()
{
#ifdef LIBRW
rw::SetRenderState(rw::ALPHATESTFUNC, saved_alphafunc);
rw::SetRenderState(rw::ALPHATESTREF, saved_alpharef);
#else
RwD3D8SetRenderState(D3DRS_ALPHAFUNC, saved_alphafunc);
RwD3D8SetRenderState(D3DRS_ALPHAREF, saved_alpharef);
#endif
}
#endif

View File

@ -57,3 +57,11 @@ void _TexturePoolsInitialise();
void _TexturePoolsShutdown(); void _TexturePoolsShutdown();
RpAtomic *ConvertPlatformAtomic(RpAtomic *atomic, void *data); RpAtomic *ConvertPlatformAtomic(RpAtomic *atomic, void *data);
#if defined(FIX_BUGS) && defined (GTA_PC)
void SetAlphaTest(RwUInt32 alpharef);
void RestoreAlphaTest();
#else
#define SetAlphaTest(a) (0)
#define RestoreAlphaTest() (0)
#endif

View File

@ -2,7 +2,6 @@
#define WITHD3D #define WITHD3D
#include "common.h" #include "common.h"
#include "rwcore.h"
#include "rpmatfx.h" #include "rpmatfx.h"
struct MatFXNothing { int pad[5]; int effect; }; struct MatFXNothing { int pad[5]; int effect; };
@ -51,9 +50,9 @@ extern "C" {
extern int MatFXAtomicDataOffset; extern int MatFXAtomicDataOffset;
void _rpMatFXD3D8AtomicMatFXEnvRender(RxD3D8InstanceData* inst, int flags, int sel, RwTexture* texture, RwTexture* envMap); void _rpMatFXD3D8AtomicMatFXEnvRender(RxD3D8InstanceData* inst, int flags, int sel, RwTexture* texture, RwTexture* envMap);
void _rpMatFXD3D8AtomicMatFXRenderBlack(RxD3D8InstanceData *inst); void _rpMatFXD3D8AtomicMatFXRenderBlack(RxD3D8InstanceData *inst);
void _rpMatFXD3D8AtomicMatFXBumpMapRender(RxD3D8InstanceData *inst, int flags, RwTexture *texture, RwTexture *bumpMap, RwTexture *envMap); void _rpMatFXD3D8AtomicMatFXBumpMapRender(RxD3D8InstanceData *inst, int flags, RwTexture *texture, RwTexture *bumpMap, RwTexture *envMap);
void _rpMatFXD3D8AtomicMatFXDualPassRender(RxD3D8InstanceData *inst, int flags, RwTexture *texture, RwTexture *dualTexture); void _rpMatFXD3D8AtomicMatFXDualPassRender(RxD3D8InstanceData *inst, int flags, RwTexture *texture, RwTexture *dualTexture);
} }
@ -305,7 +304,8 @@ ReplaceMatFxCallback()
{ {
RxD3D8AllInOneSetRenderCallBack( RxD3D8AllInOneSetRenderCallBack(
RxPipelineFindNodeByName(RpMatFXGetD3D8Pipeline(rpMATFXD3D8ATOMICPIPELINE), RxNodeDefinitionGetD3D8AtomicAllInOne()->name, nil, nil), RxPipelineFindNodeByName(RpMatFXGetD3D8Pipeline(rpMATFXD3D8ATOMICPIPELINE), RxNodeDefinitionGetD3D8AtomicAllInOne()->name, nil, nil),
_rwD3D8AtomicMatFXRenderCallback); _rwD3D8AtomicMatFXRenderCallback);
} }
#endif // PS2_MATFX #endif // PS2_MATFX

View File

@ -1371,6 +1371,11 @@ cursorEnterCB(GLFWwindow* window, int entered) {
PSGLOBAL(cursorIsInWindow) = !!entered; PSGLOBAL(cursorIsInWindow) = !!entered;
} }
void
cursorEnterCB(GLFWwindow* window, int entered) {
PSGLOBAL(cursorIsInWindow) = !!entered;
}
/* /*
***************************************************************************** *****************************************************************************
*/ */

View File

@ -1305,6 +1305,34 @@ InitApplication(HANDLE instance)
} }
/*
*****************************************************************************
*/
static BOOL
InitApplication(HANDLE instance)
{
/*
* Perform any necessary MS Windows application initialization. Basically,
* this means registering the window class for this application.
*/
WNDCLASS windowClass;
windowClass.style = CS_BYTEALIGNWINDOW;
windowClass.lpfnWndProc = (WNDPROC)MainWndProc;
windowClass.cbClsExtra = 0;
windowClass.cbWndExtra = 0;
windowClass.hInstance = (HINSTANCE)instance;
windowClass.hIcon = nil;
windowClass.hCursor = LoadCursor(nil, IDC_ARROW);
windowClass.hbrBackground = nil;
windowClass.lpszMenuName = NULL;
windowClass.lpszClassName = AppClassName;
return RegisterClass(&windowClass);
}
/* /*
***************************************************************************** *****************************************************************************
*/ */