mirror of
https://github.com/halpz/re3.git
synced 2025-06-27 03:06:17 +00:00
more high level functions
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
#include "common.h"
|
||||
#include "patcher.h"
|
||||
#include "RwHelper.h"
|
||||
#include "Camera.h"
|
||||
#include "MBlur.h"
|
||||
|
||||
RwRaster *&CMBlur::pFrontBuffer = *(RwRaster**)0x8E2C48;
|
||||
@ -104,26 +105,26 @@ CMBlur::CreateImmediateModeData(RwCamera *cam, RwRect *rect)
|
||||
}
|
||||
|
||||
void
|
||||
CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 alpha, int32 type, uint32 bluralpha)
|
||||
CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 addalpha)
|
||||
{
|
||||
RwRGBA color = { red, green, blue, alpha };
|
||||
RwRGBA color = { red, green, blue, blur };
|
||||
if(BlurOn){
|
||||
if(pFrontBuffer){
|
||||
if(ms_bJustInitialised)
|
||||
ms_bJustInitialised = false;
|
||||
else
|
||||
OverlayRender(cam, pFrontBuffer, color, type, bluralpha);
|
||||
OverlayRender(cam, pFrontBuffer, color, type, addalpha);
|
||||
}
|
||||
RwRasterPushContext(pFrontBuffer);
|
||||
RwRasterRenderFast(RwCameraGetRaster(cam), 0, 0);
|
||||
RwRasterPopContext();
|
||||
}else{
|
||||
OverlayRender(cam, nil, color, type, bluralpha);
|
||||
OverlayRender(cam, nil, color, type, addalpha);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, uint32 bluralpha)
|
||||
CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, uint32 addalpha)
|
||||
{
|
||||
int r, g, b, a;
|
||||
|
||||
@ -135,31 +136,31 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type,
|
||||
DefinedState();
|
||||
|
||||
switch(type){
|
||||
case 3:
|
||||
case MBLUR_INTRO1:
|
||||
r = 0;
|
||||
g = 255;
|
||||
b = 0;
|
||||
a = 128;
|
||||
break;
|
||||
case 5:
|
||||
case MBLUR_INTRO3:
|
||||
r = 100;
|
||||
g = 220;
|
||||
b = 230;
|
||||
a = 158;
|
||||
break;
|
||||
case 6:
|
||||
case MBLUR_INTRO4:
|
||||
r = 80;
|
||||
g = 255;
|
||||
b = 230;
|
||||
a = 138;
|
||||
break;
|
||||
case 8:
|
||||
case MBLUR_INTRO6:
|
||||
r = 255;
|
||||
g = 60;
|
||||
b = 60;
|
||||
a = 200;
|
||||
break;
|
||||
case 9:
|
||||
case MBLUR_UNUSED:
|
||||
r = 255;
|
||||
g = 180;
|
||||
b = 180;
|
||||
@ -191,7 +192,7 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type,
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
|
||||
|
||||
a = bluralpha/2;
|
||||
a = addalpha/2;
|
||||
if(a < 30)
|
||||
a = 30;
|
||||
|
||||
|
@ -10,6 +10,6 @@ public:
|
||||
static void MotionBlurOpen(RwCamera *cam);
|
||||
static void MotionBlurClose(void);
|
||||
static void CreateImmediateModeData(RwCamera *cam, RwRect *rect);
|
||||
static void MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 alpha, int32 type, uint32 bluralpha);
|
||||
static void MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 addalpha);
|
||||
static void OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, uint32 bluralpha);
|
||||
};
|
||||
|
@ -2,4 +2,12 @@
|
||||
#include "patcher.h"
|
||||
#include "PointLights.h"
|
||||
|
||||
int16 &CPointLights::NumLights = *(int16*)0x95CC3E;
|
||||
|
||||
WRAPPER void CPointLights::RenderFogEffect(void) { EAXJMP(0x510C30); }
|
||||
|
||||
void
|
||||
CPointLights::InitPerFrame(void)
|
||||
{
|
||||
NumLights = 0;
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
class CPointLights
|
||||
{
|
||||
static int16 &NumLights;
|
||||
public:
|
||||
static void InitPerFrame(void);
|
||||
static void RenderFogEffect(void);
|
||||
};
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "Treadable.h"
|
||||
#include "Ped.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Heli.h"
|
||||
#include "Object.h"
|
||||
#include "PathFind.h"
|
||||
#include "Collision.h"
|
||||
@ -14,6 +15,7 @@
|
||||
#include "Camera.h"
|
||||
#include "ModelIndices.h"
|
||||
#include "Streaming.h"
|
||||
#include "Shadows.h"
|
||||
#include "Renderer.h"
|
||||
|
||||
bool gbShowPedRoadGroups;
|
||||
@ -48,6 +50,28 @@ CRenderer::Init(void)
|
||||
gSortedVehiclesAndPeds.Init(40);
|
||||
SortBIGBuildings();
|
||||
}
|
||||
|
||||
void
|
||||
CRenderer::PreRender(void)
|
||||
{
|
||||
int i;
|
||||
CLink<CVisibilityPlugins::AlphaObjectInfo> *node;
|
||||
|
||||
for(i = 0; i < ms_nNoOfVisibleEntities; i++)
|
||||
ms_aVisibleEntityPtrs[i]->PreRender();
|
||||
|
||||
for(i = 0; i < ms_nNoOfInVisibleEntities; i++)
|
||||
ms_aInVisibleEntityPtrs[i]->PreRender();
|
||||
|
||||
for(node = CVisibilityPlugins::m_alphaEntityList.tail.prev;
|
||||
node != &CVisibilityPlugins::m_alphaEntityList.head;
|
||||
node = node->prev)
|
||||
((CEntity*)node->item.entity)->PreRender();
|
||||
|
||||
CHeli::SpecialHeliPreRender();
|
||||
CShadows::RenderExtraPlayerShadows();
|
||||
}
|
||||
|
||||
void
|
||||
CRenderer::RenderOneRoad(CEntity *e)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ class CRenderer
|
||||
static bool &m_loadingPriority;
|
||||
public:
|
||||
static void Init(void);
|
||||
// TODO: PreRender, needs CHeli and CShadows
|
||||
static void PreRender(void);
|
||||
|
||||
static void RenderRoads(void);
|
||||
static void RenderFadingInEntities(void);
|
||||
|
@ -5,3 +5,4 @@
|
||||
WRAPPER void CShadows::AddPermanentShadow(unsigned char ShadowType, RwTexture* pTexture, CVector* pPosn, float fX1, float fY1, float fX2, float fY2, short nTransparency, unsigned char nRed, unsigned char nGreen, unsigned char nBlue, float fZDistance, unsigned int nTime, float fScale) { EAXJMP(0x512FD0); }
|
||||
WRAPPER void CShadows::RenderStaticShadows(void) { EAXJMP(0x5145F0); }
|
||||
WRAPPER void CShadows::RenderStoredShadows(void) { EAXJMP(0x514010); }
|
||||
WRAPPER void CShadows::RenderExtraPlayerShadows(void) { EAXJMP(0x516F90); }
|
||||
|
@ -8,4 +8,5 @@ public:
|
||||
static void AddPermanentShadow(uint8 ShadowType, RwTexture* pTexture, CVector* pPosn, float fX1, float fY1, float fX2, float fY2, short nTransparency, uint8 nRed, uint8 nGreen, uint8 nBlue, float fZDistance, uint32 nTime, float fScale);
|
||||
static void RenderStaticShadows(void);
|
||||
static void RenderStoredShadows(void);
|
||||
};
|
||||
static void RenderExtraPlayerShadows(void);
|
||||
};
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "ModelInfo.h"
|
||||
#include "Lights.h"
|
||||
#include "Renderer.h"
|
||||
#include "Camera.h"
|
||||
#include "VisibilityPlugins.h"
|
||||
|
||||
#define FADE_DISTANCE 20.0f
|
||||
@ -24,6 +25,7 @@ int32 &CVisibilityPlugins::ms_atomicPluginOffset = *(int32*)0x600124;
|
||||
int32 &CVisibilityPlugins::ms_framePluginOffset = *(int32*)0x600128;
|
||||
int32 &CVisibilityPlugins::ms_clumpPluginOffset = *(int32*)0x60012C;
|
||||
|
||||
RwCamera *&CVisibilityPlugins::ms_pCamera = *(RwCamera**)0x8F2514;
|
||||
RwV3d *&CVisibilityPlugins::ms_pCameraPosn = *(RwV3d**)0x8F6270;
|
||||
float &CVisibilityPlugins::ms_cullCompsDist = *(float*)0x8F2BC4;
|
||||
float &CVisibilityPlugins::ms_vehicleLod0Dist = *(float*)0x885B28;
|
||||
@ -82,6 +84,28 @@ CVisibilityPlugins::InsertAtomicIntoSortedList(RpAtomic *a, float dist)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
CVisibilityPlugins::SetRenderWareCamera(RwCamera *camera)
|
||||
{
|
||||
ms_pCamera = camera;
|
||||
ms_pCameraPosn = RwMatrixGetPos(RwFrameGetMatrix(RwCameraGetFrame(camera)));
|
||||
|
||||
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN1 ||
|
||||
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWNPED)
|
||||
ms_cullCompsDist = 1000000.0f;
|
||||
else
|
||||
ms_cullCompsDist = sq(TheCamera.LODDistMultiplier * 20.0f);
|
||||
|
||||
ms_vehicleLod0Dist = sq(70.0 * TheCamera.GenerationDistMultiplier);
|
||||
ms_vehicleLod1Dist = sq(90.0 * TheCamera.GenerationDistMultiplier);
|
||||
ms_vehicleFadeDist = sq(100.0 * TheCamera.GenerationDistMultiplier);
|
||||
ms_bigVehicleLod0Dist = sq(60.0 * TheCamera.GenerationDistMultiplier);
|
||||
ms_bigVehicleLod1Dist = sq(150.0 * TheCamera.GenerationDistMultiplier);
|
||||
ms_pedLod0Dist = sq(25.0 * TheCamera.LODDistMultiplier);
|
||||
ms_pedLod1Dist = sq(60.0 * TheCamera.LODDistMultiplier);
|
||||
ms_pedFadeDist = sq(70.0 * TheCamera.LODDistMultiplier);
|
||||
}
|
||||
|
||||
RpMaterial*
|
||||
SetAlphaCB(RpMaterial *material, void *data)
|
||||
{
|
||||
@ -802,6 +826,8 @@ STARTPATCHES
|
||||
InjectHook(0x528FF0, CVisibilityPlugins::InsertEntityIntoSortedList, PATCH_JUMP);
|
||||
InjectHook(0x528F80, CVisibilityPlugins::InitAlphaAtomicList, PATCH_JUMP);
|
||||
InjectHook(0x528FA0, CVisibilityPlugins::InsertAtomicIntoSortedList, PATCH_JUMP);
|
||||
InjectHook(0x528C50, CVisibilityPlugins::SetRenderWareCamera, PATCH_JUMP);
|
||||
|
||||
InjectHook(0x527F60, SetAlphaCB, PATCH_JUMP);
|
||||
InjectHook(0x529040, CVisibilityPlugins::RenderAlphaAtomics, PATCH_JUMP);
|
||||
InjectHook(0x529070, CVisibilityPlugins::RenderFadingEntities, PATCH_JUMP);
|
||||
|
@ -22,6 +22,7 @@ public:
|
||||
|
||||
static CLinkList<AlphaObjectInfo> &m_alphaList;
|
||||
static CLinkList<AlphaObjectInfo> &m_alphaEntityList;
|
||||
static RwCamera *&ms_pCamera;
|
||||
static RwV3d *&ms_pCameraPosn;
|
||||
static float &ms_cullCompsDist;
|
||||
static float &ms_vehicleLod0Dist;
|
||||
@ -39,6 +40,8 @@ public:
|
||||
static void InitAlphaAtomicList(void);
|
||||
static bool InsertAtomicIntoSortedList(RpAtomic *a, float dist);
|
||||
|
||||
static void SetRenderWareCamera(RwCamera *camera);
|
||||
|
||||
static RpAtomic *RenderWheelAtomicCB(RpAtomic *atomic);
|
||||
static RpAtomic *RenderObjNormalAtomic(RpAtomic *atomic);
|
||||
static RpAtomic *RenderAlphaAtomic(RpAtomic *atomic, int alpha);
|
||||
|
Reference in New Issue
Block a user