Skip to content
Permalink
Browse files
fixed bink messups
sun back in correct position
keepalive for building shadows
  • Loading branch information
CookiePLMonster committed Jul 27, 2014
1 parent ab385d6 commit ed9757c05146b7440a575a3c0352fa8d1348ea1c
@@ -14,7 +14,6 @@ WRAPPER void CAudioEngine::SetEffectsMasterVolume(signed char nVolume) { WRAPARG
WRAPPER void CAudioEngine::SetRadioAutoRetuneOnOff(bool bRetune) { WRAPARG(bRetune); EAXJMP(0x506F80); } WRAPPER void CAudioEngine::SetRadioAutoRetuneOnOff(bool bRetune) { WRAPARG(bRetune); EAXJMP(0x506F80); }
WRAPPER void CAudioEngine::RetuneRadio(signed char nStation) { WRAPARG(nStation); EAXJMP(0x507E10); } WRAPPER void CAudioEngine::RetuneRadio(signed char nStation) { WRAPARG(nStation); EAXJMP(0x507E10); }
WRAPPER const char* CAudioEngine::GetRadioStationName(signed char nStation) { WRAPARG(nStation); EAXJMP(0x507000); } WRAPPER const char* CAudioEngine::GetRadioStationName(signed char nStation) { WRAPARG(nStation); EAXJMP(0x507000); }
WRAPPER void CAudioEngine::ScrollRadioStations(signed char nDirection) { WRAPARG(nDirection); EAXJMP(0x573A00); }




signed char CAERadioTrackManager::GetNextTrackByStation(BYTE stationID) signed char CAERadioTrackManager::GetNextTrackByStation(BYTE stationID)
@@ -88,7 +88,6 @@ class CAudioEngine
void SetRadioAutoRetuneOnOff(bool bRetune); void SetRadioAutoRetuneOnOff(bool bRetune);
void RetuneRadio(signed char nStation); void RetuneRadio(signed char nStation);
const char* GetRadioStationName(signed char nStation); const char* GetRadioStationName(signed char nStation);
void ScrollRadioStations(signed char nDirection);
}; };


extern CAudioEngine& AudioEngine; extern CAudioEngine& AudioEngine;
@@ -116,6 +116,7 @@ void CEmpireManager::Initialise()
/*if ( pCurrentModelForDataParsing ) /*if ( pCurrentModelForDataParsing )
pCurrentModelForDataParsing->GetEmpireData()->ReduceContainerSize();*/ pCurrentModelForDataParsing->GetEmpireData()->ReduceContainerSize();*/
countMap.clear(); countMap.clear();
assert(CModelInfo::GetModelInfo(pLine+2) != nullptr);


pCurrentModelForDataParsing = CModelInfo::GetModelInfo(pLine+2)->AsAtomicModelInfoPtr(); pCurrentModelForDataParsing = CModelInfo::GetModelInfo(pLine+2)->AsAtomicModelInfoPtr();
pCurrentModelForDataParsing->InitEmpireData(); pCurrentModelForDataParsing->InitEmpireData();
@@ -237,15 +237,15 @@ MenuItem CMenuManager::ms_pMenus[] = {


// Graphics Setup // Graphics Setup
{ "FEH_GFX", 33, 3, { "FEH_GFX", 33, 3,
61, "FEM_LOD", ACTION_CLICKORARROWS, 27, 0, -124, 2, 0, 0, 56, "FED_RES", ACTION_CLICKORARROWS, 27, 0, -154, 2, 0, 0,
24, "FEM_FRM", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0,
26, "FED_WIS", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0, 26, "FED_WIS", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0,
24, "FEM_FRM", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0,
MENUACTION_EFFECTS_QUALITY, "FED_EFF", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0,
MENUACTION_SHADOWS_QUALITY, "FED_SHA", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0, MENUACTION_SHADOWS_QUALITY, "FED_SHA", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0,
61, "FEM_LOD", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0,
MENUACTION_SHADOWS_DISTANCE, "FED_SHD", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0, MENUACTION_SHADOWS_DISTANCE, "FED_SHD", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0,
MENUACTION_TEXTURE_FILTERMODE, "FED_TXF", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0,
MENUACTION_EFFECTS_QUALITY, "FED_EFF", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0,
44, "FED_AAS", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0, 44, "FED_AAS", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0,
56, "FED_RES", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0, MENUACTION_TEXTURE_FILTERMODE, "FED_TXF", ACTION_CLICKORARROWS, 27, 0, 0, 2, 0, 0,
5, "FET_DEF", ACTION_STANDARD, 50, 0, 141, 3, 0, 0, 5, "FET_DEF", ACTION_STANDARD, 50, 0, 141, 3, 0, 0,
2, "FEDS_TB", ACTION_STANDARD, 33, 0, 0, 3, 0, 0 }, 2, "FEDS_TB", ACTION_STANDARD, 33, 0, 0, 3, 0, 0 },


@@ -402,7 +402,7 @@ MenuItem CMenuManager::ms_pMenus[] = {
2, "FEDS_TB", ACTION_STANDARD, 0, 0, 48, 3, 1, 0 }, 2, "FEDS_TB", ACTION_STANDARD, 0, 0, 48, 3, 1, 0 },


// Restore defaults - Graphics Setup // Restore defaults - Graphics Setup
{ "FEH_GFX", 27, 8, { "FEH_GFX", 27, 9,
1, "FED_RDP", ACTION_NONE, 0, 0, 0, 0, 0, 0, 1, "FED_RDP", ACTION_NONE, 0, 0, 0, 0, 0, 0,
5, "FEM_NO", ACTION_STANDARD, 27, 0, -9, 3, 0, 0, 5, "FEM_NO", ACTION_STANDARD, 27, 0, -9, 3, 0, 0,
57, "FEM_YES", ACTION_STANDARD, 27, 0, 16, 3, 0, 0 }, 57, "FEM_YES", ACTION_STANDARD, 27, 0, 16, 3, 0, 0 },
@@ -423,6 +423,7 @@ WRAPPER void CMenuManager::DisplayHelperText(const char* pText) { WRAPARG(pText)
WRAPPER bool CMenuManager::CheckHover(int, int, int, int) { EAXJMP(0x57C4F0); } WRAPPER bool CMenuManager::CheckHover(int, int, int, int) { EAXJMP(0x57C4F0); }
WRAPPER void CMenuManager::ProcessMissionPackNewGame() { EAXJMP(0x57D520); } WRAPPER void CMenuManager::ProcessMissionPackNewGame() { EAXJMP(0x57D520); }
WRAPPER void CMenuManager::DoSettingsBeforeStartingAGame() { EAXJMP(0x573330); } WRAPPER void CMenuManager::DoSettingsBeforeStartingAGame() { EAXJMP(0x573330); }
WRAPPER void CMenuManager::ScrollRadioStations(signed char nDirection) { WRAPARG(nDirection); EAXJMP(0x573A00); }


void CMenuManager::SaveSettings() void CMenuManager::SaveSettings()
{ {
@@ -733,17 +734,16 @@ void CMenuManager::DrawStandardMenus(bool bDrawMenu)
for ( unsigned int i = 0; i < NUM_ENTRIES_PER_MENU; i++ ) for ( unsigned int i = 0; i < NUM_ENTRIES_PER_MENU; i++ )
{ {
CFont::SetFontStyle(FONT_Eurostile); CFont::SetFontStyle(FONT_Eurostile);
CFont::SetEdge(1);
if ( aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag >= ACTION_SAVE_1 && aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag <= ACTION_SAVE_12 ) if ( aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag >= ACTION_SAVE_1 && aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag <= ACTION_SAVE_12 )
{ {
// Save slot // Save slot
CFont::SetScale(_width(0.42f), _height(0.95f)); CFont::SetScale(_width(0.42f), _height(0.95f));
CFont::SetEdge(1);
} }
else else
{ {
// Regular texts // Regular texts
CFont::SetScale(_width(0.7f), _height(1.0f)); CFont::SetScale(_width(0.7f), _height(1.0f));
CFont::SetEdge(1);
} }
unsigned char nAlign; unsigned char nAlign;


@@ -764,7 +764,7 @@ void CMenuManager::DrawStandardMenus(bool bDrawMenu)
CFont::SetColor(CRGBA(MENU_ACTIVE_R, MENU_ACTIVE_G, MENU_ACTIVE_B)); CFont::SetColor(CRGBA(MENU_ACTIVE_R, MENU_ACTIVE_G, MENU_ACTIVE_B));
else else
{ {
if ( CUpdateManager::NewUpdatesPending() && ((m_bCurrentMenuPage == 33 && i == 6) || (m_bCurrentMenuPage == 34 && i == 1) || (m_bCurrentMenuPage == 41 && i == 5) && (m_bCurrentMenuPage == 44 && i == 2)) ) if ( CUpdateManager::NewUpdatesPending() && ((m_bCurrentMenuPage == 33 && i == 6) || (m_bCurrentMenuPage == 34 && i == 1) || (m_bCurrentMenuPage == 41 && i == 5) || (m_bCurrentMenuPage == 44 && i == 2)) )
CFont::SetColor(CRGBA(MENU_UPDATES_R, MENU_UPDATES_G, MENU_UPDATES_B)); CFont::SetColor(CRGBA(MENU_UPDATES_R, MENU_UPDATES_G, MENU_UPDATES_B));
else else
CFont::SetColor(CRGBA(MENU_INACTIVE_R, MENU_INACTIVE_G, MENU_INACTIVE_B)); CFont::SetColor(CRGBA(MENU_INACTIVE_R, MENU_INACTIVE_G, MENU_INACTIVE_B));
@@ -1142,13 +1142,13 @@ void CMenuManager::DrawStandardMenus(bool bDrawMenu)
case 61: case 61:
{ {
// Draw Distance // Draw Distance
float nMouseInput = DisplaySlider(_xmiddle(MENU_TEXT_POSITION_RCOLUMN), _ymiddle(-124.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _height(MENU_SLIDER_HEIGHT), _width(100.0f), (m_fDrawDistance-0.925f) * (1.0f/0.875f), _width(MENU_SLIDER_WIDTH), false); float nMouseInput = DisplaySlider(_xmiddle(MENU_TEXT_POSITION_RCOLUMN), _ymiddle(-4.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _height(MENU_SLIDER_HEIGHT), _width(100.0f), (m_fDrawDistance-0.925f) * (1.0f/0.875f), _width(MENU_SLIDER_WIDTH), false);


if ( i == m_dwSelectedMenuItem ) if ( i == m_dwSelectedMenuItem )
{ {
if ( CheckHover(_xleft(95.0f), nMouseInput - _width(3.0f), _ymiddle(-124.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-124.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) ) if ( CheckHover(_xleft(95.0f), nMouseInput - _width(3.0f), _ymiddle(-4.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-4.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) )
m_nHoverOption = 9; m_nHoverOption = 9;
else if ( CheckHover(nMouseInput + _width(3.0f), _x(95.0f), _ymiddle(-124.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-124.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) ) else if ( CheckHover(nMouseInput + _width(3.0f), _x(95.0f), _ymiddle(-4.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-4.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) )
m_nHoverOption = 8; m_nHoverOption = 8;
else else
m_nHoverOption = 16; m_nHoverOption = 16;
@@ -1175,15 +1175,15 @@ void CMenuManager::DrawStandardMenus(bool bDrawMenu)
{ {
// Shadows Distance // Shadows Distance
bool bLockedSlider = CShadows::GetShadowQuality() == SHADOW_QUALITY_OFF; bool bLockedSlider = CShadows::GetShadowQuality() == SHADOW_QUALITY_OFF;
float nMouseInput = DisplaySlider(_xmiddle(MENU_TEXT_POSITION_RCOLUMN), _ymiddle(-4.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _height(MENU_SLIDER_HEIGHT), _width(100.0f), CShadows::GetShadowDistance(), _width(MENU_SLIDER_WIDTH), bLockedSlider); float nMouseInput = DisplaySlider(_xmiddle(MENU_TEXT_POSITION_RCOLUMN), _ymiddle(26.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _height(MENU_SLIDER_HEIGHT), _width(100.0f), CShadows::GetShadowDistance(), _width(MENU_SLIDER_WIDTH), bLockedSlider);


if ( !bLockedSlider ) if ( !bLockedSlider )
{ {
/*if ( i == m_dwSelectedMenuItem ) /*if ( i == m_dwSelectedMenuItem )
{ {
if ( CheckHover(_xleft(95.0f), nMouseInput - _width(3.0f), _ymiddle(-4.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-4.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) ) if ( CheckHover(_xleft(95.0f), nMouseInput - _width(3.0f), _ymiddle(26.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(26.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) )
m_nHoverOption = 15; m_nHoverOption = 15;
else if ( CheckHover(nMouseInput + _width(3.0f), _x(95.0f), _ymiddle(-4.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(-4.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) ) else if ( CheckHover(nMouseInput + _width(3.0f), _x(95.0f), _ymiddle(26.0f + MENU_SLIDER_HEIGHT/2 - 1.25f), _ymiddle(26.0f + 3*MENU_SLIDER_HEIGHT/2 + 1.25f)) )
m_nHoverOption = 14; m_nHoverOption = 14;
else else
m_nHoverOption = 16; m_nHoverOption = 16;
@@ -1349,7 +1349,7 @@ void CMenuManager::ProcessMenuOptions(signed char nArrowsInput, bool* bReturn, b


return; return;
case 32: case 32:
AudioEngine.ScrollRadioStations(nArrowsInput); ScrollRadioStations(nArrowsInput);
return; return;
//case 36: - PS2 only //case 36: - PS2 only
case 34: case 34:
@@ -372,6 +372,7 @@ class CMenuManager
private: private:
void ProcessMissionPackNewGame(); void ProcessMissionPackNewGame();
void DoSettingsBeforeStartingAGame(); void DoSettingsBeforeStartingAGame();
void ScrollRadioStations(signed char nDirection);


void PrintStats(); void PrintStats();
void PrintUpdaterScreen(); void PrintUpdaterScreen();
@@ -45,7 +45,7 @@ bool CPed::Load()


void CPed::RenderForShadow(RpClump* pClump, bool bRenderWeapon) void CPed::RenderForShadow(RpClump* pClump, bool bRenderWeapon)
{ {
RpClumpForAllAtomics(pClump, ShadowCameraRenderCB, nullptr); RpClumpForAllAtomics(pClump, ShadowCameraRenderCB, reinterpret_cast<void*>(TRUE));


if ( bRenderWeapon ) if ( bRenderWeapon )
{ {
@@ -43,6 +43,7 @@ WRAPPER RpLight* RpLightSetColor(RpLight* light, const RwRGBAReal* color) { WRAP
WRAPPER RpClump* RpClumpRender(RpClump* clump) { WRAPARG(clump); EAXJMP(0x749B20); } WRAPPER RpClump* RpClumpRender(RpClump* clump) { WRAPARG(clump); EAXJMP(0x749B20); }
WRAPPER RwMatrix* RwMatrixTranslate(RwMatrix* matrix, const RwV3d* translation, RwOpCombineType combineOp) { WRAPARG(matrix); WRAPARG(translation); WRAPARG(combineOp); EAXJMP(0x7F2450); } WRAPPER RwMatrix* RwMatrixTranslate(RwMatrix* matrix, const RwV3d* translation, RwOpCombineType combineOp) { WRAPARG(matrix); WRAPARG(translation); WRAPARG(combineOp); EAXJMP(0x7F2450); }
WRAPPER RwMatrix* RwMatrixRotate(RwMatrix* matrix, const RwV3d* axis, RwReal angle, RwOpCombineType combineOp) { WRAPARG(matrix); WRAPARG(axis); WRAPARG(angle); WRAPARG(combineOp); EAXJMP(0x7F1FD0); } WRAPPER RwMatrix* RwMatrixRotate(RwMatrix* matrix, const RwV3d* axis, RwReal angle, RwOpCombineType combineOp) { WRAPARG(matrix); WRAPARG(axis); WRAPARG(angle); WRAPARG(combineOp); EAXJMP(0x7F1FD0); }
WRAPPER RwFrame* RwFrameRotate(RwFrame* frame, const RwV3d* axis, RwReal angle, RwOpCombineType combine) { WRAPARG(frame); WRAPARG(axis); WRAPARG(angle); WRAPARG(combine); EAXJMP(0x7F1010); }


WRAPPER RwV3d* RwV3dTransformPoints(RwV3d* pointsOut, const RwV3d* pointsIn, RwInt32 numPoints, const RwMatrix* matrix) { WRAPARG(pointsOut); WRAPARG(pointsIn); WRAPARG(numPoints); WRAPARG(matrix); EAXJMP(0x7EDD90); } WRAPPER RwV3d* RwV3dTransformPoints(RwV3d* pointsOut, const RwV3d* pointsIn, RwInt32 numPoints, const RwMatrix* matrix) { WRAPARG(pointsOut); WRAPARG(pointsIn); WRAPARG(numPoints); WRAPARG(matrix); EAXJMP(0x7EDD90); }
WRAPPER RwFrame* RwFrameUpdateObjects(RwFrame* frame) { WRAPARG(frame); EAXJMP(0x7F0910); } WRAPPER RwFrame* RwFrameUpdateObjects(RwFrame* frame) { WRAPARG(frame); EAXJMP(0x7F0910); }
@@ -10,7 +10,7 @@


WRAPPER RwCamera* CShadowCamera::Create(int nSize) { WRAPARG(nSize); EAXJMP(0x705B60); } WRAPPER RwCamera* CShadowCamera::Create(int nSize) { WRAPARG(nSize); EAXJMP(0x705B60); }
WRAPPER void CShadowCamera::Destroy() { EAXJMP(0x705400); } WRAPPER void CShadowCamera::Destroy() { EAXJMP(0x705400); }
WRAPPER void CShadowCamera::SetLight(RpLight* pLight) { WRAPARG(pLight); EAXJMP(0x705520); } WRAPPER RwCamera* CShadowCamera::SetLight(RpLight* pLight) { WRAPARG(pLight); EAXJMP(0x705520); }
WRAPPER void CShadowCamera::MakeGradientRaster() { EAXJMP(0x705D20); } WRAPPER void CShadowCamera::MakeGradientRaster() { EAXJMP(0x705D20); }
WRAPPER RwCamera* CShadowCamera::SetCenter(RwV3d* pVector) { WRAPARG(pVector); EAXJMP(0x705590); } WRAPPER RwCamera* CShadowCamera::SetCenter(RwV3d* pVector) { WRAPARG(pVector); EAXJMP(0x705590); }
WRAPPER RwRaster* CShadowCamera::RasterResample(RwRaster* pRaster) { WRAPARG(pRaster); EAXJMP(0x706070); } WRAPPER RwRaster* CShadowCamera::RasterResample(RwRaster* pRaster) { WRAPARG(pRaster); EAXJMP(0x706070); }
@@ -42,7 +42,7 @@ RpAtomic* ShadowCameraRenderCB_Vehicle(RpAtomic* pAtomic, void* pData)
RpAtomicGetPipeline(pAtomic, &pOldPipe); RpAtomicGetPipeline(pAtomic, &pOldPipe);
RpAtomicSetPipeline(pAtomic, RpAtomicGetDefaultPipeline()); RpAtomicSetPipeline(pAtomic, RpAtomicGetDefaultPipeline());


ShadowCameraRenderCB(pAtomic, pData); ShadowCameraRenderCB(pAtomic, reinterpret_cast<void*>(TRUE));


RpAtomicSetPipeline(pAtomic, pOldPipe); RpAtomicSetPipeline(pAtomic, pOldPipe);


@@ -58,8 +58,17 @@ RpAtomic* ShadowCameraRenderCB(RpAtomic* pAtomic, void* pData)
RpGeometry* pGeometry = RpAtomicGetGeometry(pAtomic); RpGeometry* pGeometry = RpAtomicGetGeometry(pAtomic);
RwUInt32 geometryFlags = RpGeometryGetFlags(pGeometry); RwUInt32 geometryFlags = RpGeometryGetFlags(pGeometry);


RpGeometrySetFlags(pGeometry, geometryFlags & ~(rpGEOMETRYTEXTURED|rpGEOMETRYPRELIT| if ( reinterpret_cast<BOOL>(pData) )
{
RpGeometrySetFlags(pGeometry, geometryFlags & ~(rpGEOMETRYTEXTURED|rpGEOMETRYPRELIT|
rpGEOMETRYLIGHT|rpGEOMETRYMODULATEMATERIALCOLOR|rpGEOMETRYTEXTURED2));
}
else
{
// For CObject renders
RpGeometrySetFlags(pGeometry, geometryFlags & ~(rpGEOMETRYTEXTURED|/*rpGEOMETRYPRELIT|*/
rpGEOMETRYLIGHT|rpGEOMETRYMODULATEMATERIALCOLOR|rpGEOMETRYTEXTURED2)); rpGEOMETRYLIGHT|rpGEOMETRYMODULATEMATERIALCOLOR|rpGEOMETRYTEXTURED2));
}


AtomicDefaultRenderCallBack(pAtomic); AtomicDefaultRenderCallBack(pAtomic);
RpGeometrySetFlags(pGeometry, geometryFlags); RpGeometrySetFlags(pGeometry, geometryFlags);
@@ -93,11 +102,15 @@ RwCamera* CShadowCamera::Update(RpAtomic* pAtomic, CEntity* pEntity)


// Disable prelighting if it's not CObject // Disable prelighting if it's not CObject
if ( pEntity->nType != 4 ) if ( pEntity->nType != 4 )
{
RpGeometrySetFlags(pGeometry, geometryFlags & ~(rpGEOMETRYTEXTURED|rpGEOMETRYPRELIT| RpGeometrySetFlags(pGeometry, geometryFlags & ~(rpGEOMETRYTEXTURED|rpGEOMETRYPRELIT|
rpGEOMETRYLIGHT|rpGEOMETRYMODULATEMATERIALCOLOR|rpGEOMETRYTEXTURED2)); rpGEOMETRYLIGHT|rpGEOMETRYMODULATEMATERIALCOLOR|rpGEOMETRYTEXTURED2));
}
else else
{
RpGeometrySetFlags(pGeometry, geometryFlags & ~(rpGEOMETRYTEXTURED|/*rpGEOMETRYPRELIT|*/ RpGeometrySetFlags(pGeometry, geometryFlags & ~(rpGEOMETRYTEXTURED|/*rpGEOMETRYPRELIT|*/
rpGEOMETRYLIGHT|rpGEOMETRYMODULATEMATERIALCOLOR|rpGEOMETRYTEXTURED2)); rpGEOMETRYLIGHT|rpGEOMETRYMODULATEMATERIALCOLOR|rpGEOMETRYTEXTURED2));
}


AtomicDefaultRenderCallBack(pAtomic); AtomicDefaultRenderCallBack(pAtomic);


@@ -129,6 +142,12 @@ RwCamera* CShadowCamera::Update(RpClump* pClump, CEntity* pEntity)
static_cast<CPed*>(pEntity)->RenderForShadow(pClump, true); static_cast<CPed*>(pEntity)->RenderForShadow(pClump, true);
else if ( pEntity->nType == 2 ) else if ( pEntity->nType == 2 )
static_cast<CVehicle*>(pEntity)->RenderForShadow(pClump); static_cast<CVehicle*>(pEntity)->RenderForShadow(pClump);
else if ( pEntity->nType == 4 )
RpClumpForAllAtomics(pClump, ShadowCameraRenderCB, FALSE);
else
{
assert(!"Baad, unknown entity type in CShadowCamera::Update!");
}
} }


InvertRaster(); InvertRaster();
@@ -137,6 +156,8 @@ RwCamera* CShadowCamera::Update(RpClump* pClump, CEntity* pEntity)
return m_pCamera; return m_pCamera;
} }


#include "Coronas.h"

RwTexture* CRealTimeShadow::Update() RwTexture* CRealTimeShadow::Update()
{ {
if ( m_pEntity->m_pRwObject ) if ( m_pEntity->m_pRwObject )
@@ -160,6 +181,26 @@ RwTexture* CRealTimeShadow::Update()
else if ( m_nRwObjectType == rpCLUMP ) else if ( m_nRwObjectType == rpCLUMP )
m_Camera.Update(reinterpret_cast<RpClump*>(m_pEntity->m_pRwObject), m_pEntity); m_Camera.Update(reinterpret_cast<RpClump*>(m_pEntity->m_pRwObject), m_pEntity);



/*CMatrix Helper(RwFrameGetMatrix(RwCameraGetFrame(m_Camera.m_pCamera)));
CVector vecPos = *Helper.GetPos();
CVector vecRight = *Helper.GetPos() + *Helper.GetRight();
CVector vecUp = *Helper.GetPos() + *Helper.GetUp();
CVector vecAt = *Helper.GetPos() + *Helper.GetAt();
// pos
CCoronas::RegisterCorona((int)m_pEntity + 69, nullptr, 255, 255, 0, 255, vecPos, 0.25f, 1000.0f, gpCoronaTexture[1], 0, 0, 0, 0, 0.0f, false, 1.5f, false, 255, false, true);
// right
CCoronas::RegisterCorona((int)m_pEntity + 69 + 1, nullptr, 255, 0, 0, 255, vecRight, 0.25f, 1000.0f, gpCoronaTexture[1], 0, 0, 0, 0, 0.0f, false, 1.5f, false, 255, false, true);
// up
CCoronas::RegisterCorona((int)m_pEntity + 69 + 2, nullptr, 0, 255, 0, 255, vecUp, 0.25f, 1000.0f, gpCoronaTexture[1], 0, 0, 0, 0, 0.0f, false, 1.5f, false, 255, false, true);
// at
CCoronas::RegisterCorona((int)m_pEntity + 69 + 3, nullptr, 0, 0, 255, 255, vecAt, 0.25f, 1000.0f, gpCoronaTexture[1], 0, 0, 0, 0, 0.0f, false, 1.5f, false, 255, false, true);*/


RwRaster* pRaster = RwCameraGetRaster(m_Camera.m_pCamera); RwRaster* pRaster = RwCameraGetRaster(m_Camera.m_pCamera);


if ( m_bDrawResample ) if ( m_bDrawResample )
@@ -536,6 +577,29 @@ void CRealTimeShadowManager::ReInit()
} }
} }


void CRealTimeShadowManager::KeepBuildingShadowsAlive()
{
if ( m_bInitialised && CShadows::GetShadowQuality() > SHADOW_QUALITY_MEDIUM )
{
CVector vecCamCoords = *TheCamera.GetCoords();
for ( int i = 0; i < NUM_MAX_REALTIME_SHADOWS; i++ )
{
if ( !m_pShadows[i]->GetRenderedThisFrame() )
{
CEntity* pShadowOwner = m_pShadows[i]->GetOwner();
if ( pShadowOwner )
{
if ( pShadowOwner->nType == 1 )
{
if ( (*pShadowOwner->GetCoords() - vecCamCoords).MagnitudeSqr() < 45.0*45.0 )
m_pShadows[i]->SetRenderedThisFrame();
}
}
}
}
}
}

void CRealTimeShadowManager::ReturnRealTimeShadow(CRealTimeShadow* pShadow) void CRealTimeShadowManager::ReturnRealTimeShadow(CRealTimeShadow* pShadow)
{ {
if ( m_bInitialised && pShadow->GetOwner() ) if ( m_bInitialised && pShadow->GetOwner() )
@@ -545,6 +609,11 @@ void CRealTimeShadowManager::ReturnRealTimeShadow(CRealTimeShadow* pShadow)
} }
} }


static void BuildingShadowsKeep()
{
g_realTimeShadowMan.KeepBuildingShadowsAlive();
}

static void __declspec(naked) ReturnShadowHack() static void __declspec(naked) ReturnShadowHack()
{ {
_asm _asm
@@ -566,6 +635,7 @@ static StaticPatcher Patcher([](){
Memory::InjectHook(0x706BA0, &CRealTimeShadowManager::DoShadowThisFrame, PATCH_JUMP); Memory::InjectHook(0x706BA0, &CRealTimeShadowManager::DoShadowThisFrame, PATCH_JUMP);
Memory::InjectHook(0x706AC2, &CRealTimeShadowManager::ReInit); Memory::InjectHook(0x706AC2, &CRealTimeShadowManager::ReInit);
Memory::InjectHook(0x706B29, &CRealTimeShadow::Update); Memory::InjectHook(0x706B29, &CRealTimeShadow::Update);
Memory::InjectHook(0x5539FC, BuildingShadowsKeep);


// Increased shadows limit // Increased shadows limit
Memory::Patch<const void*>(0x45D412, &g_realTimeShadowMan); Memory::Patch<const void*>(0x45D412, &g_realTimeShadowMan);
@@ -25,7 +25,7 @@ class CShadowCamera


RwCamera* Create(int nSize); RwCamera* Create(int nSize);
void Destroy(); void Destroy();
void SetLight(RpLight* pLight); RwCamera* SetLight(RpLight* pLight);
void MakeGradientRaster(); void MakeGradientRaster();
RwCamera* SetCenter(RwV3d* pVector); RwCamera* SetCenter(RwV3d* pVector);
RwRaster* RasterResample(RwRaster* pRaster); RwRaster* RasterResample(RwRaster* pRaster);
@@ -56,8 +56,12 @@ class CRealTimeShadow
RwSphere m_BaseSphere; RwSphere m_BaseSphere;


public: public:
inline RwSphere* GetBaseSphere()
{ return &m_BaseSphere; }
inline class CEntity* GetOwner() inline class CEntity* GetOwner()
{ return m_pEntity; } { return m_pEntity; }
inline bool GetRenderedThisFrame()
{ return m_bRenderedThisFrame; }
inline void SetRenderedThisFrame() inline void SetRenderedThisFrame()
{ m_bRenderedThisFrame = true; } { m_bRenderedThisFrame = true; }
inline void ResetIntensity() inline void ResetIntensity()
@@ -125,6 +129,8 @@ class CRealTimeShadowManager
void DoShadowThisFrame(CEntity* pEntity); void DoShadowThisFrame(CEntity* pEntity);
void GetRealTimeShadow(CEntity* pEntity); void GetRealTimeShadow(CEntity* pEntity);
void ReInit(); void ReInit();

void KeepBuildingShadowsAlive();
}; };


RpAtomic* ShadowCameraRenderCB(RpAtomic* pAtomic, void* pData); RpAtomic* ShadowCameraRenderCB(RpAtomic* pAtomic, void* pData);

0 comments on commit ed9757c

Please sign in to comment.