Twopass for peds

64x64 lunar
This commit is contained in:
Silent 2014-06-16 20:49:01 +02:00
parent 7452ea4831
commit e076a275b1

View File

@ -32,6 +32,13 @@ struct AlphaObjectInfo
{ return a.fCompareValue < b.fCompareValue; }
};
// CVisibilityPlugins clump plugin
struct ClumpVisibilityPlugin
{
BOOL (*visibilityCallback)(RpClump*);
unsigned int alpha;
};
// RW wrappers
// TODO: Multiple EXEs
WRAPPER RwFrame* RwFrameForAllObjects(RwFrame* frame, RwObjectCallBack callBack, void* data) { WRAPARG(frame); WRAPARG(callBack); WRAPARG(data); EAXJMP(0x7F1200); }
@ -192,12 +199,18 @@ static unsigned char* ZonesVisited = *(unsigned char**)0x57216A - 9;
static const float fRefZVal = 1.0f;
static const float* const pRefFal = &fRefZVal;
static RwInt32& clumpPluginOffset = **(RwInt32**)0x732202;
#ifndef SA_STEAM_TEST
void** rwengine = *(void***)0x58FFC0;
#else
void** rwengine = (void**)0xD22E34;
#endif
// Plugin members access
#define CLUMPVISIBILITYLOCAL(clump, var) \
(RWPLUGINOFFSET(ClumpVisibilityPlugin, clump, clumpPluginOffset)->var)
static inline void RenderOrderedList(CLinkList<AlphaObjectInfo>& list)
{
for ( auto i = list.m_lnListTail.m_pPrev; i != &list.m_lnListHead; i = i->m_pPrev )
@ -987,38 +1000,93 @@ void RenderVehicleHiDetailAlphaCB_HunterDoor(RpAtomic* pAtomic)
#include "PNGFile.h"
// lunar.png
static const BYTE gMoonMaskPNG[] = {
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00,
0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7A, 0x7A, 0xF4, 0x00, 0x00, 0x00,
0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xAE, 0xCE, 0x1C, 0xE9, 0x00, 0x00, 0x00, 0x06, 0x62, 0x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, 0x4B, 0x38, 0xDB, 0x26, 0xC5, 0xDB, 0x19,
0x57, 0x22, 0x50, 0x75, 0x23, 0x3F, 0x78, 0x59, 0x42, 0x6C, 0x0C, 0x5E, 0xD8, 0x30, 0x28, 0x02, 0x5D, 0x47,
0x09, 0x38, 0x49, 0x38, 0xED, 0x6E, 0x81, 0x0E, 0x70, 0xF3, 0xD7, 0xBA, 0xB6, 0x6D, 0x35, 0xF3, 0x80, 0x2B,
0xE9, 0x85, 0x86, 0x9E, 0xD0, 0x62, 0x84, 0x36, 0xEB, 0x69, 0x45, 0xEB, 0xA8, 0xC5, 0xE7, 0x69, 0x97, 0x53,
0x4F, 0x2A, 0xA6, 0x2A, 0x88, 0x46, 0xC8, 0x19, 0xB3, 0x17, 0x0E, 0xD4, 0xD2, 0xFD, 0x28, 0x4B, 0x6A, 0xDC,
0xED, 0xF8, 0x40, 0xED, 0x6A, 0x36, 0x64, 0xDB, 0xCC, 0x66, 0x3C, 0xDD, 0x94, 0xF1, 0xBA, 0x7D, 0x03, 0x9B,
0xCB, 0x2A, 0x13, 0x6A, 0x96, 0x59, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60,
0x82 };
static const BYTE gMoonMaskPNG[] = {
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40,
0x08, 0x06, 0x00, 0x00, 0x00, 0xAA, 0x69, 0x71, 0xDE, 0x00, 0x00, 0x03,
0xC1, 0x49, 0x44, 0x41, 0x54, 0x78, 0xDA, 0xED, 0x9B, 0xD7, 0x6B, 0x54,
0x51, 0x10, 0xC6, 0x27, 0x96, 0x68, 0xEC, 0xA2, 0x41, 0x09, 0x16, 0xAC,
0x60, 0x50, 0x51, 0xAC, 0xB1, 0xF7, 0x8A, 0x3E, 0x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, 0xE4, 0xE4, 0xA3, 0xB3, 0x91, 0x91, 0xF3, 0x06,
0xFC, 0x07, 0x2A, 0x0D, 0x50, 0x50, 0xCC, 0xB6, 0x51, 0x67, 0x00, 0x00,
0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82
};
// TODO: EXEs
#ifndef SA_STEAM_TEST
@ -1365,6 +1433,18 @@ void SetRendererForAtomic(RpAtomic* pAtomic)
RpAtomicSetRenderCallBack(pAtomic, bUseTwoPass ? TwoPassAlphaRender : OnePassAlphaRender);
}
RpAtomic* RenderPedCB(RpAtomic* pAtomic)
{
BOOL bHasAlpha = FALSE;
RpGeometryForAllMaterials(RpAtomicGetGeometry(pAtomic), AlphaTest, &bHasAlpha);
if ( bHasAlpha )
return TwoPassAlphaRender(pAtomic);
return AtomicDefaultRenderCallBack(pAtomic);
}
//#define DO_MAP_DUMP
#ifdef DO_MAP_DUMP
@ -1999,6 +2079,12 @@ BOOL InjectDelayedPatches_10()
}
bUseTwoPass = GetPrivateProfileIntW(L"SilentPatch", L"TwoPassRendering", FALSE, wcModulePath) != FALSE;
if ( bUseTwoPass )
{
// Twopass for peds
InjectHook(0x733614, RenderPedCB);
}
if ( GetPrivateProfileIntW(L"SilentPatch", L"EnableScriptFixes", TRUE, wcModulePath) != FALSE )
{