Merge pull request #1 from GTAmodding/miami

Miami
This commit is contained in:
Fire_Head
2020-07-29 12:20:02 +03:00
committed by GitHub
267 changed files with 23832 additions and 29992 deletions

View File

@ -129,12 +129,12 @@ CCredits::Render(void)
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.4f, 0.82f, TheText.Get("CRED041"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED042"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED043"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED044"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditSpace(2.0f, lineoffset);
@ -177,14 +177,14 @@ CCredits::Render(void)
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED061"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED062"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED063"), lineoffset, scrolloffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED064"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED065"), lineoffset, scrolloffset);
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED066"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED067"), lineoffset, scrolloffset);
@ -192,16 +192,16 @@ CCredits::Render(void)
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED069"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED070"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED071"), lineoffset, scrolloffset);
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED072"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED073"), lineoffset, scrolloffset);
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED074"), lineoffset, scrolloffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED075"), lineoffset, scrolloffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED076"), lineoffset, scrolloffset);
@ -221,16 +221,16 @@ CCredits::Render(void)
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED085"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED086"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.4f, 0.82f, TheText.Get("CRED087"), lineoffset, scrolloffset);
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED088"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED089"), lineoffset, scrolloffset);
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED090"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED091"), lineoffset, scrolloffset);
@ -250,7 +250,7 @@ CCredits::Render(void)
PrintCreditSpace(2.0f, lineoffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.4f, 0.82f, TheText.Get("CRED100"), lineoffset, scrolloffset);
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED101"), lineoffset, scrolloffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED102"), lineoffset, scrolloffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED103"), lineoffset, scrolloffset);
@ -261,82 +261,82 @@ CCredits::Render(void)
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED269"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED107"), lineoffset, scrolloffset);
PrintCreditSpace(1.5, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED108"), lineoffset, scrolloffset);
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED109"), lineoffset, scrolloffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED108"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED109"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED110"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED110"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED111"), lineoffset, scrolloffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED112"), lineoffset, scrolloffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED112"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED113"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED113"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED114"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED114"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED115"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED115"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED116"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED116"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED117"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED117"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED118"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED118"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED119"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED119"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED120"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED120"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED121"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED121"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED122"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED122"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED123"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED123"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED124"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED124"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED125"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED125"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED126"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED126"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED127"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED127"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED128"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED128"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED129"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED129"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED130"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED130"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED131"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED131"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED132"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED132"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED133"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED133"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED134"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED134"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED135"), lineoffset, scrolloffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED136"), lineoffset, scrolloffset);
@ -349,7 +349,7 @@ CCredits::Render(void)
PrintCreditText(1.7f, 1.7f, TheText.Get("CRD138A"), lineoffset, scrolloffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRD138B"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED139"), lineoffset, scrolloffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED139"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED140"), lineoffset, scrolloffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRD140A"), lineoffset, scrolloffset);
@ -359,12 +359,12 @@ CCredits::Render(void)
PrintCreditText(1.7f, 1.7f, TheText.Get("CRD140E"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.4f, 0.82f, TheText.Get("CRED141"), lineoffset, scrolloffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED142"), lineoffset, scrolloffset);
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED143"), lineoffset, scrolloffset);
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED144"), lineoffset, scrolloffset);
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED142"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED143"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditText(1.0f, 1.0f, TheText.Get("CRED144"), lineoffset, scrolloffset);
PrintCreditSpace(1.0f, lineoffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.4f, 0.82f, TheText.Get("CRED145"), lineoffset, scrolloffset);
PrintCreditText(1.4f, 1.4f, TheText.Get("CRED146"), lineoffset, scrolloffset);
@ -441,19 +441,19 @@ CCredits::Render(void)
PrintCreditText(1.4f, 1.4f, TheText.Get("CRED241"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.4f, 0.82f, TheText.Get("CRED217"), lineoffset, scrolloffset);
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.4f, 0.82f, TheText.Get("CRED218"), lineoffset, scrolloffset);
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRD218A"), lineoffset, scrolloffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRD218B"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.4f, 0.82f, TheText.Get("CRED219"), lineoffset, scrolloffset);
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED220"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.4f, 0.82f, TheText.Get("CRED221"), lineoffset, scrolloffset);
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED222"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.4f, 0.82f, TheText.Get("CRED223"), lineoffset, scrolloffset);
@ -462,7 +462,7 @@ CCredits::Render(void)
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED226"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.4f, 0.82f, TheText.Get("CRED227"), lineoffset, scrolloffset);
PrintCreditSpace(1.5, lineoffset);
PrintCreditSpace(1.5f, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED228"), lineoffset, scrolloffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED229"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);

View File

@ -3,6 +3,7 @@
#include "Draw.h"
#include "Frontend.h"
#include "Camera.h"
#include "CutsceneMgr.h"
#ifdef ASPECT_RATIO_SCALE
float CDraw::ms_fAspectRatio = DEFAULT_ASPECT_RATIO;
@ -61,7 +62,10 @@ void
CDraw::SetFOV(float fov)
{
#ifdef ASPECT_RATIO_SCALE
ms_fScaledFOV = ConvertFOV(fov);
if (!CCutsceneMgr::IsRunning())
ms_fScaledFOV = ConvertFOV(fov);
else
ms_fScaledFOV = fov;
#endif
ms_fFOV = fov;
}

View File

@ -1,11 +1,14 @@
#include "common.h"
#include "main.h"
#include "RenderBuffer.h"
#include "Entity.h"
#include "Fluff.h"
#include "Camera.h"
#include "Sprite.h"
#include "Coronas.h"
#include "Rubbish.h"
#include "Timecycle.h"
#include "General.h"
#include "Timer.h"
#include "Clock.h"
@ -18,6 +21,277 @@
#include "Bones.h"
#include "World.h"
CPlaneTrail CPlaneTrails::aArray[6];
RwImVertexIndex TrailIndices[32] = {
0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16
};
void
CPlaneTrail::Init(void)
{
int i;
for(i = 0; i < ARRAY_SIZE(m_time); i++)
m_time[i] = 0;
}
void
CPlaneTrail::Render(float visibility)
{
int i;
int numVerts = 0;
if(!TheCamera.IsSphereVisible(m_pos[0], 1000.0f))
return;
int alpha = visibility*110.0f;
if(alpha == 0)
return;
for(i = 0; i < ARRAY_SIZE(m_pos); i++){
int32 time = CTimer::GetTimeInMilliseconds() - m_time[i];
if(time > 30000)
m_time[i] = 0;
if(m_time[i] != 0){
float fade = (30000.0f - time) / 10000.0f;
fade = Min(fade, 1.0f);
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[numVerts], 255, 255, 255, (int)(alpha*fade));
RwIm3DVertexSetPos(&TempBufferRenderVertices[numVerts], m_pos[i].x, m_pos[i].y, m_pos[i].z);
numVerts++;
}
}
if(numVerts > 1){
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
if(RwIm3DTransform(TempBufferRenderVertices, numVerts, nil, rwIM3D_VERTEXXYZ|rwIM3D_VERTEXRGBA)){
RwIm3DRenderIndexedPrimitive(rwPRIMTYPELINELIST, TrailIndices, (numVerts-1)*2);
RwIm3DEnd();
}
}
}
void
CPlaneTrail::RegisterPoint(CVector pos)
{
int i;
bool bNewPoint = false;
if(m_time[0] != 0 && CTimer::GetTimeInMilliseconds() - m_time[0] > 2000){
bNewPoint = true;
for(i = ARRAY_SIZE(m_pos)-1; i > 0; i--){
m_pos[i] = m_pos[i-1];
m_time[i] = m_time[i-1];
}
}
m_pos[0] = pos;
if(bNewPoint || m_time[0] == 0)
m_time[0] = CTimer::GetTimeInMilliseconds();
}
void
CPlaneTrails::Init(void)
{
int i;
for(i = 0; i < ARRAY_SIZE(aArray); i++)
aArray[i].Init();
}
void
CPlaneTrails::Update(void)
{
CVector planePos;
planePos.x = 1590.0f * Sin((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI);
planePos.y = 1200.0f * Cos((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI);
planePos.z = 550.0f;
RegisterPoint(planePos, 3);
if(CClock::GetHours() > 22 || CClock::GetHours() < 7){
if(CTimer::GetTimeInMilliseconds() & 0x200)
CCoronas::RegisterCorona(101, 255, 0, 0, 255, planePos, 5.0f, 2000.0f,
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
else
CCoronas::UpdateCoronaCoors(101, planePos, 2000.0f, 0.0f);
}
planePos.x = 1000.0f * Sin((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI);
planePos.y = -1600.0f * Cos((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI);
planePos.z = 500.0f;
RegisterPoint(planePos, 4);
if(CClock::GetHours() > 22 || CClock::GetHours() < 7){
if(CTimer::GetTimeInMilliseconds() & 0x200)
CCoronas::RegisterCorona(102, 255, 0, 0, 255, planePos, 5.0f, 2000.0f,
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
else
CCoronas::UpdateCoronaCoors(102, planePos, 2000.0f, 0.0f);
}
planePos.x = 1100.0f * Cos((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI);
planePos.y = 700.0f * Sin((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI);
planePos.z = 600.0f;
RegisterPoint(planePos, 5);
if(CClock::GetHours() > 22 || CClock::GetHours() < 7){
if(CTimer::GetTimeInMilliseconds() & 0x200)
CCoronas::RegisterCorona(103, 255, 0, 0, 255, planePos, 5.0f, 2000.0f,
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
else
CCoronas::UpdateCoronaCoors(103, planePos, 2000.0f, 0.0f);
}
}
void
CPlaneTrails::Render(void)
{
int i;
float visibility = Min(1.0f-CWeather::Foggyness, 1.0f-CWeather::CloudCoverage);
visibility = Min(visibility, 1.0f-CWeather::Rain);
visibility = Min(Max(Max(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen()), CTimeCycle::GetSkyTopBlue())/256.0f, visibility);
if(visibility > 0.0001f)
for(i = 0; i < ARRAY_SIZE(aArray); i++)
aArray[i].Render(visibility);
}
void
CPlaneTrails::RegisterPoint(CVector pos, uint32 id)
{
aArray[id].RegisterPoint(pos);
}
CPlaneBanner CPlaneBanners::aArray[5];
void
CPlaneBanner::Init(void)
{
int i;
for(i = 0; i < ARRAY_SIZE(m_pos); i++){
m_pos[i].x = i;
m_pos[i].y = 0.0f;
m_pos[i].z = -60.0f;
}
}
void
CPlaneBanner::Update(void)
{
int i;
if(m_pos[0].z > -50.0f){
m_pos[0].z -= 0.05f*CTimer::GetTimeStep();
m_pos[0].z = Max(m_pos[0].z, -100.0f);
for(i = 1; i < ARRAY_SIZE(m_pos); i++){
CVector dist = m_pos[i] - m_pos[i-1];
float len = dist.Magnitude();
if(len > 8.0f)
m_pos[i] = m_pos[i-1] + dist/len*8.0f;
}
}
}
void
CPlaneBanner::Render(void)
{
int i;
if(m_pos[0].z > -50.0f){
float camDist = (TheCamera.GetPosition() - m_pos[0]).Magnitude();
if(TheCamera.IsSphereVisible(m_pos[4], 32.0f) && camDist < 300.0f){
TempBufferVerticesStored = 0;
TempBufferIndicesStored = 0;
int alpha = camDist < 250.0f ? 160 : (300.0f-camDist)/(300.0f-250.0f)*160;
TempBufferVerticesStored += 2;
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[0], 255, 255, 255, alpha);
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[1], 255, 255, 255, alpha);
RwIm3DVertexSetPos(&TempBufferRenderVertices[0], m_pos[2].x, m_pos[2].y, m_pos[2].z);
RwIm3DVertexSetPos(&TempBufferRenderVertices[1], m_pos[2].x, m_pos[2].y, m_pos[2].z - 4.0f);
RwIm3DVertexSetU(&TempBufferRenderVertices[0], 0.0f);
RwIm3DVertexSetV(&TempBufferRenderVertices[0], 0.0f);
RwIm3DVertexSetU(&TempBufferRenderVertices[1], 0.0f);
RwIm3DVertexSetV(&TempBufferRenderVertices[1], 1.0f);
for(i = 2; i < 8; i++){
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored+0], 255, 255, 255, alpha);
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored+1], 255, 255, 255, alpha);
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored+0], m_pos[i].x, m_pos[i].y, m_pos[i].z);
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored+1], m_pos[i].x, m_pos[i].y, m_pos[i].z - 4.0f);
RwIm3DVertexSetU(&TempBufferRenderVertices[TempBufferVerticesStored+0], (i-2)/5.0f);
RwIm3DVertexSetV(&TempBufferRenderVertices[TempBufferVerticesStored+0], 0.0f);
RwIm3DVertexSetU(&TempBufferRenderVertices[TempBufferVerticesStored+1], (i-2)/5.0f);
RwIm3DVertexSetV(&TempBufferRenderVertices[TempBufferVerticesStored+1], 1.0f);
TempBufferRenderIndexList[TempBufferIndicesStored+0] = TempBufferVerticesStored-2;
TempBufferRenderIndexList[TempBufferIndicesStored+1] = TempBufferVerticesStored-1;
TempBufferRenderIndexList[TempBufferIndicesStored+2] = TempBufferVerticesStored+1;
TempBufferRenderIndexList[TempBufferIndicesStored+3] = TempBufferVerticesStored-2;
TempBufferRenderIndexList[TempBufferIndicesStored+4] = TempBufferVerticesStored+1;
TempBufferRenderIndexList[TempBufferIndicesStored+5] = TempBufferVerticesStored;
TempBufferVerticesStored += 2;
TempBufferIndicesStored += 6;
}
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpRubbishTexture[2]));
#ifdef FIX_BUGS
if(RwIm3DTransform(TempBufferRenderVertices, TempBufferVerticesStored, nil, rwIM3D_VERTEXXYZ|rwIM3D_VERTEXUV|rwIM3D_VERTEXRGBA)){
#else
if(RwIm3DTransform(TempBufferRenderVertices, TempBufferVerticesStored, nil, 0)){
#endif
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempBufferRenderIndexList, TempBufferIndicesStored);
RwIm3DEnd();
}
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
TempBufferVerticesStored = 0;
TempBufferIndicesStored = 0;
}
}
}
void
CPlaneBanner::RegisterPoint(CVector pos)
{
m_pos[0] = pos;
}
void
CPlaneBanners::Init(void)
{
int i;
for(i = 0; i < ARRAY_SIZE(aArray); i++)
aArray[i].Init();
}
void
CPlaneBanners::Update(void)
{
int i;
for(i = 0; i < ARRAY_SIZE(aArray); i++)
aArray[i].Update();
}
void
CPlaneBanners::Render(void)
{
int i;
for(i = 0; i < ARRAY_SIZE(aArray); i++)
aArray[i].Render();
}
void
CPlaneBanners::RegisterPoint(CVector pos, uint32 id)
{
aArray[id].RegisterPoint(pos);
}
bool CSmokeTrails::CigOn = false;
CSmokeTrail CSmokeTrails::aSmoke[3];
@ -113,7 +387,9 @@ CMovingThing CMovingThings::aMovingThings[NUMMOVINGTHINGS];
void CMovingThings::Init()
{
CPlaneTrails::Init();
CSmokeTrails::Init();
CPlaneBanners::Init();
StartCloseList.m_pNext = &CMovingThings::EndCloseList;
StartCloseList.m_pPrev = nil;
@ -162,14 +438,19 @@ void CMovingThings::Shutdown()
int i;
for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i)
aScrollBars[i].SetVisibility(false);
/*
for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
aTowerClocks[i].SetVisibility(false);
for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i)
aDigitalClocks[i].SetVisibility(false);
*/
}
void CMovingThings::Update()
{
CPlaneBanners::Update();
CPlaneTrails::Update();
const int TIME_SPAN = 64; // frames to process all aMovingThings
int16 i;
@ -214,6 +495,7 @@ void CMovingThings::Render()
if (aScrollBars[i].IsVisible())
aScrollBars[i].Render();
}
/*
for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
{
if (aTowerClocks[i].IsVisible())
@ -224,8 +506,11 @@ void CMovingThings::Render()
if (aDigitalClocks[i].IsVisible())
aDigitalClocks[i].Render();
}
*/
CPlaneTrails::Render();
CSmokeTrails::Render();
CPlaneBanners::Render();
}
// ---------- CMovingThing ----------
@ -637,7 +922,7 @@ void CScrollBar::Update()
break;
}
m_MessageLength = strlen(m_pMessage);
m_MessageLength = (uint32)strlen(m_pMessage);
m_MessageCurrentChar = 0;
}
@ -934,7 +1219,6 @@ CSmokeTrails::Render(void) {
void
CSmokeTrail::Render(void) {
int numVerts = 0;
RwIm3DVertex TempVertexBuffer[16];
if (TheCamera.IsSphereVisible(m_pos[0], 10.0f)) {
for (int32 i = 0; i < 16; i++) {
@ -949,8 +1233,8 @@ CSmokeTrail::Render(void) {
float posX = (m_pos[i].x + timeSinceSpawned * RandomSmoke[(i - m_seed) & 0xF] * 0.00001f) - offset;
float posY = (m_pos[i].y + timeSinceSpawned * RandomSmoke[(i - m_seed + 5) & 0xF] * 0.00001f) - offset;
float posZ = m_pos[i].z + timeSinceSpawned * 0.0004f;
RwIm3DVertexSetRGBA(&TempVertexBuffer[i], 200, 200, 200, alpha);
RwIm3DVertexSetPos(&TempVertexBuffer[i], posX, posY, posZ);
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[i], 200, 200, 200, alpha);
RwIm3DVertexSetPos(&TempBufferRenderVertices[i], posX, posY, posZ);
numVerts++;
}
}
@ -962,7 +1246,7 @@ CSmokeTrail::Render(void) {
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
if (RwIm3DTransform(TempVertexBuffer, numVerts, nil, rwIM3D_VERTEXXYZ | rwIM3D_VERTEXRGBA)) {
if (RwIm3DTransform(TempBufferRenderVertices, numVerts, nil, rwIM3D_VERTEXXYZ | rwIM3D_VERTEXRGBA)) {
RwIm3DRenderIndexedPrimitive(rwPRIMTYPEPOLYLINE, SmokeTrailIndices, 2 * (numVerts - 1));
RwIm3DEnd();
}
@ -994,13 +1278,12 @@ CSmokeTrails::Update(void) {
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
RwIm3DVertex TempVertexBuffer[2];
RwIm3DVertexSetRGBA(&TempVertexBuffer[0], 255, 255, 255, 255);
RwIm3DVertexSetPos(&TempVertexBuffer[0], startPos.x, startPos.y, startPos.z);
RwIm3DVertexSetRGBA(&TempVertexBuffer[1], 255, 255, 255, 255);
RwIm3DVertexSetPos(&TempVertexBuffer[1], endPos.x, endPos.y, endPos.z);
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[0], 255, 255, 255, 255);
RwIm3DVertexSetPos(&TempBufferRenderVertices[0], startPos.x, startPos.y, startPos.z);
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[1], 255, 255, 255, 255);
RwIm3DVertexSetPos(&TempBufferRenderVertices[1], endPos.x, endPos.y, endPos.z);
if (RwIm3DTransform(TempVertexBuffer, 2, nil, rwIM3D_VERTEXXYZ | rwIM3D_VERTEXRGBA)) {
if (RwIm3DTransform(TempBufferRenderVertices, 2, nil, rwIM3D_VERTEXXYZ | rwIM3D_VERTEXRGBA)) {
RwIm3DRenderIndexedPrimitive(rwPRIMTYPEPOLYLINE, SmokeTrailIndices, 2);
RwIm3DEnd();
}

View File

@ -2,6 +2,70 @@
#include "common.h"
#include "Vector.h"
// TODO
class CScriptPath
{
public:
};
// TODO
class CScriptPaths
{
public:
};
class CPlaneTrail
{
CVector m_pos[16];
int32 m_time[16];
public:
void Init(void);
void Render(float visibility);
void RegisterPoint(CVector pos);
};
class CPlaneTrails
{
static CPlaneTrail aArray[6]; // NB: 3 CPlanes and 3 hardcoded far away ones
public:
static void Init(void);
static void Update(void);
static void Render(void);
static void RegisterPoint(CVector pos, uint32 id);
};
class CPlaneBanner
{
CVector m_pos[8];
public:
void Init(void);
void Update(void);
void Render(void);
void RegisterPoint(CVector pos);
};
class CPlaneBanners
{
static CPlaneBanner aArray[5];
public:
static void Init(void);
static void Update(void);
static void Render(void);
static void RegisterPoint(CVector pos, uint32 id);
};
// TODO
class CEscalators
{
public:
};
// TODO
class CEscalator
{
public:
};
class CMovingThing
{
public:

View File

@ -1133,7 +1133,11 @@ CFont::ParseToken(wchar *s)
case 'r': SetColor(CRGBA(255, 150, 225, 255)); Details.anonymous_23 = true; break;
case 't': SetColor(CRGBA(86, 212, 146, 255)); Details.anonymous_23 = true; break;
case 'w': SetColor(CRGBA(175, 175, 175, 255)); Details.anonymous_23 = true; break;
#ifdef FIX_BUGS
case 'x': SetColor(CRGBA(0, 255, 255, 255)); Details.anonymous_23 = true; break;
#else
case 'x': SetColor(CRGBA(132, 146, 197, 255)); Details.anonymous_23 = true; break;
#endif
case 'y': SetColor(CRGBA(255, 227, 79, 255)); Details.anonymous_23 = true; break;
}
while(*s != '~') s++;
@ -1208,11 +1212,19 @@ CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
color.g = 175;
color.b = 175;
break;
#ifdef FIX_BUGS
case 'x':
color.r = 0;
color.g = 255;
color.b = 255;
break;
#else
case 'x':
color.r = 132;
color.g = 146;
color.b = 197;
break;
#endif
case 'y':
color.r = 255;
color.g = 227;

View File

@ -424,10 +424,10 @@ CGlass::RenderEntityInGlass(CEntity *entity)
ASSERT(col!=nil);
if ( col->numTriangles >= 2 )
{
CVector a = object->GetMatrix() * col->vertices[0];
CVector b = object->GetMatrix() * col->vertices[1];
CVector c = object->GetMatrix() * col->vertices[2];
CVector d = object->GetMatrix() * col->vertices[3];
CVector a = object->GetMatrix() * col->vertices[0].Get();
CVector b = object->GetMatrix() * col->vertices[1].Get();
CVector c = object->GetMatrix() * col->vertices[2].Get();
CVector d = object->GetMatrix() * col->vertices[3].Get();
if ( object->bGlassCracked )
{
@ -613,10 +613,10 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed,
CColModel *col = object->GetColModel();
ASSERT(col!=nil);
CVector a = object->GetMatrix() * col->vertices[0];
CVector b = object->GetMatrix() * col->vertices[1];
CVector c = object->GetMatrix() * col->vertices[2];
CVector d = object->GetMatrix() * col->vertices[3];
CVector a = object->GetMatrix() * col->vertices[0].Get();
CVector b = object->GetMatrix() * col->vertices[1].Get();
CVector c = object->GetMatrix() * col->vertices[2].Get();
CVector d = object->GetMatrix() * col->vertices[3].Get();
float minx = Min(Min(a.x, b.x), Min(c.x, d.x));
float maxx = Max(Max(a.x, b.x), Max(c.x, d.x));

View File

@ -38,10 +38,10 @@ CRGBA TIMER_COLOR(97, 194, 247, 255);
CRGBA COUNTER_COLOR(97, 194, 247, 255);
CRGBA PAGER_COLOR(32, 162, 66, 205);
CRGBA RADARDISC_COLOR(255, 255, 255, 255);
CRGBA BIGMESSAGE_COLOR(85, 119, 133, 255);
CRGBA WASTEDBUSTED_COLOR(255, 150, 225, 255);
CRGBA ODDJOB_COLOR(89, 115, 150, 255);
CRGBA ODDJOB2_COLOR(156, 91, 40, 255);
CRGBA BIGMESSAGE_COLOR(255, 150, 225, 255);
CRGBA WASTEDBUSTED_COLOR(0, 207, 133, 255);
CRGBA ODDJOB_COLOR(0, 207, 133, 255);
CRGBA ODDJOB2_COLOR(97, 194, 247, 255);
CRGBA MISSIONTITLE_COLOR(220, 172, 2, 255);
wchar CHud::m_HelpMessage[256];
@ -70,6 +70,8 @@ bool CHud::m_Wants_To_Draw_Hud;
bool CHud::m_Wants_To_Draw_3dMarkers;
wchar CHud::m_BigMessage[6][128];
int16 CHud::m_ItemToFlash;
bool CHud::m_HideRadar;
int32 CHud::m_DrawClock;
// These aren't really in CHud
float CHud::BigMessageInUse[6];
@ -518,7 +520,6 @@ void CHud::Draw()
DrawZoneName
*/
if (m_pZoneName) {
float fZoneAlpha = 255.0f;
if (m_pZoneName != m_pLastZoneName) {
switch (m_ZoneState) {
@ -527,6 +528,8 @@ void CHud::Draw()
m_ZoneToPrint = m_pZoneName;
m_ZoneNameTimer = 0;
m_ZoneFadeTimer = 0;
if (m_VehicleState == 1 || m_VehicleState == 2)
m_VehicleState = 3;
break;
case 1:
case 2:
@ -541,19 +544,20 @@ void CHud::Draw()
m_pLastZoneName = m_pZoneName;
}
float fZoneAlpha = 255.0f;
if (m_ZoneState) {
switch (m_ZoneState) {
case 1:
fZoneAlpha = 255.0f;
m_ZoneFadeTimer = 1000;
if (m_ZoneNameTimer > 10000) {
if (m_ZoneNameTimer > 10000.0f) {
m_ZoneFadeTimer = 1000;
m_ZoneState = 3;
}
fZoneAlpha = 255.0f;
break;
case 2:
m_ZoneFadeTimer += CTimer::GetTimeStepInMilliseconds();
if (m_ZoneFadeTimer > 1000) {
if (m_ZoneFadeTimer > 1000.0f) {
m_ZoneState = 1;
m_ZoneFadeTimer = 1000;
}
@ -561,7 +565,7 @@ void CHud::Draw()
break;
case 3:
m_ZoneFadeTimer -= CTimer::GetTimeStepInMilliseconds();
if (m_ZoneFadeTimer < 0) {
if (m_ZoneFadeTimer < 0.0f) {
m_ZoneState = 0;
m_ZoneFadeTimer = 0;
}
@ -569,7 +573,7 @@ void CHud::Draw()
break;
case 4:
m_ZoneFadeTimer -= CTimer::GetTimeStepInMilliseconds();
if (m_ZoneFadeTimer < 0) {
if (m_ZoneFadeTimer < 0.0f) {
m_ZoneFadeTimer = 0;
m_ZoneToPrint = m_pLastZoneName;
m_ZoneState = 2;
@ -581,11 +585,8 @@ void CHud::Draw()
}
#ifndef HUD_ENHANCEMENTS
if (!m_Message[0]) {
#else
if (!m_Message[0] && !m_BigMessage[2][0]) { // Hide zone name if wasted/busted text is displaying
#endif
if (!m_Message[0] && BigMessageInUse[1] == 0.0f && BigMessageInUse[2] == 0.0f) {
m_ZoneNameTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetJustifyOff();
CFont::SetPropOn();
@ -605,11 +606,14 @@ void CHud::Draw()
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, fZoneAlpha));
CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(ZONE_COLOR.r, ZONE_COLOR.g, ZONE_COLOR.b, fZoneAlpha));
CFont::PrintStringFromBottom(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f), m_ZoneToPrint);
if (!CTheScripts::bPlayerIsInTheStatium)
CFont::PrintStringFromBottom(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(128.0f), m_ZoneToPrint);
CFont::SetSlant(0.f);
} else {
m_ZoneState = 3;
}
}
}
@ -627,6 +631,8 @@ void CHud::Draw()
m_pVehicleNameToPrint = m_VehicleName;
m_VehicleNameTimer = 0;
m_VehicleFadeTimer = 0;
if (m_ZoneState == 1 || m_ZoneState == 2)
m_ZoneState = 3;
break;
case 1:
case 2:
@ -722,23 +728,26 @@ void CHud::Draw()
/*
DrawClock
*/
CFont::SetJustifyOff();
CFont::SetCentreOff();
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(HUD_TEXT_SCALE_X), SCREEN_SCALE_Y(HUD_TEXT_SCALE_Y));
CFont::SetBackGroundOnlyTextOff();
CFont::SetPropOff();
CFont::SetFontStyle(FONT_HEADING);
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
if (m_DrawClock) {
CFont::SetJustifyOff();
CFont::SetCentreOff();
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(HUD_TEXT_SCALE_X), SCREEN_SCALE_Y(HUD_TEXT_SCALE_Y));
CFont::SetBackGroundOnlyTextOff();
CFont::SetPropOff();
CFont::SetFontStyle(FONT_HEADING);
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
sprintf(sTemp, "%02d:%02d", CClock::GetHours(), CClock::GetMinutes());
AsciiToUnicode(sTemp, sPrint);
sprintf(sTemp, "%02d:%02d", CClock::GetHours(), CClock::GetMinutes());
AsciiToUnicode(sTemp, sPrint);
CFont::SetColor(CLOCK_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint);
CFont::SetColor(CLOCK_COLOR);
if (FrontEndMenuManager.m_PrefsShowHud)
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint);
}
/*
DrawOnScreenTimer
@ -902,20 +911,25 @@ void CHud::Draw()
/*
DrawRadar
*/
if (m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_RADAR) {
if (FrontEndMenuManager.m_PrefsRadarMode != 2 &&
!m_HideRadar && (m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_RADAR)) {
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
CRadar::DrawMap();
CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT));
if (FrontEndMenuManager.m_PrefsRadarMode != 1) {
CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT));
#ifdef FIX_BUGS
rect.Translate(SCREEN_SCALE_X(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT));
rect.Translate(SCREEN_SCALE_X(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT));
#else
rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT));
rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT));
#endif
rect.Grow(6.0f);
rect.Translate(0.0f, 2.0f);
Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255));
rect.Translate(0.0f, -2.0f);
Sprites[HUD_RADARDISC].Draw(rect, RADARDISC_COLOR);
rect.Grow(6.0f);
rect.Translate(0.0f, 2.0f);
Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255));
rect.Translate(0.0f, -2.0f);
Sprites[HUD_RADARDISC].Draw(rect, RADARDISC_COLOR);
}
CRadar::DrawBlips();
}
}
@ -1005,6 +1019,11 @@ void CHud::Draw()
DrawSubtitles
*/
if (m_Message[0] && !m_BigMessage[2][0]) {
if (m_VehicleState != 0)
m_VehicleState = 3;
if (m_ZoneState != 0)
m_ZoneState = 3;
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128));
@ -1043,6 +1062,119 @@ void CHud::Draw()
CFont::SetDropShadowPosition(0);
}
/*
HelpMessage
*/
if (m_HelpMessage[0]) {
if (!CMessages::WideStringCompare(m_HelpMessage, m_LastHelpMessage, 256)) {
switch (m_HelpMessageState) {
case 0:
m_HelpMessageFadeTimer = 0;
m_HelpMessageState = 2;
m_HelpMessageTimer = 0;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, 256);
m_fHelpMessageTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
if (TheCamera.m_ScreenReductionPercentage == 0.0f)
DMAudio.PlayFrontEndSound(SOUND_HUD_SOUND, 0);
break;
case 1:
case 2:
case 3:
case 4:
m_HelpMessageTimer = 5;
m_HelpMessageState = 4;
break;
default:
break;
}
CMessages::WideStringCopy(m_LastHelpMessage, m_HelpMessage, 256);
}
float fAlpha = 225.0f;
if (m_HelpMessageState != 0) {
switch (m_HelpMessageState) {
case 1:
fAlpha = 225.0f;
m_HelpMessageFadeTimer = 600;
if (m_HelpMessageTimer > m_fHelpMessageTime * 1000.0f || m_HelpMessageQuick && m_HelpMessageTimer > 1500.0f) {
m_HelpMessageFadeTimer = 600;
m_HelpMessageState = 3;
}
break;
case 2:
if (TheCamera.m_WideScreenOn)
break;
m_HelpMessageFadeTimer += 2 * CTimer::GetTimeStepInMilliseconds();
if (m_HelpMessageFadeTimer > 0) {
m_HelpMessageState = 1;
m_HelpMessageFadeTimer = 0;
}
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
case 3:
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
if (m_HelpMessageFadeTimer < 0 || TheCamera.m_WideScreenOn) {
m_HelpMessageState = 0;
m_HelpMessageFadeTimer = 0;
}
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
case 4:
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
if (m_HelpMessageFadeTimer < 0) {
m_HelpMessageState = 2;
m_HelpMessageFadeTimer = 0;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, 256);
}
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
default:
break;
}
if (!TheCamera.m_WideScreenOn) {
m_HelpMessageTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetAlphaFade(fAlpha);
CFont::SetCentreOff();
CFont::SetPropOn();
if (CGame::germanGame)
CFont::SetScale(SCREEN_SCALE_X(0.52f * 0.85f), SCREEN_SCALE_Y(1.1f * 0.85f));
#ifdef MORE_LANGUAGES
else if (CFont::IsJapanese())
CFont::SetScale(SCREEN_SCALE_X(0.52f) * 1.35f, SCREEN_SCALE_Y(1.1f) * 1.25f);
#endif
else
CFont::SetScale(SCREEN_SCALE_X(0.52f), SCREEN_SCALE_Y(1.1f));
CFont::DrawFonts();
// CFont::SetColor(CRGBA(175, 175, 175, 255));
CFont::SetJustifyOff();
#ifdef MORE_LANGUAGES
if (CFont::IsJapanese())
CFont::SetWrapx(SCREEN_SCALE_X(229.0f + 34.0f - 4.0f));
else
#endif
CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 34.0f - 4.0f));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetBackgroundOn();
CFont::SetBackGroundOnlyTextOff();
CFont::SetDropShadowPosition(0);
CFont::SetColor(CRGBA(175, 175, 175, 255));
CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.9f));
CFont::PrintString(SCREEN_SCALE_X(34.0f), SCREEN_SCALE_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint);
CFont::SetAlphaFade(255.0f);
CFont::SetWrapx(SCREEN_WIDTH);
}
}
} else
m_HelpMessageState = 0;
/*
DrawBigMessage
*/
@ -1052,10 +1184,15 @@ void CHud::Draw()
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetBackGroundOnlyTextOff();
CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f));
if (CGame::frenchGame || CGame::germanGame) {
CFont::SetScale(SCREEN_SCALE_X(1.6f), SCREEN_SCALE_Y(1.8f));
} else {
CFont::SetScale(SCREEN_SCALE_X(1.8f), SCREEN_SCALE_Y(1.8f));
}
CFont::SetPropOn();
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_X(615.0f));
CFont::SetCentreSize(SCREEN_SCALE_X(590.0f));
CFont::SetColor(CRGBA(255, 255, 0, BigMessageAlpha[0])); // unused color
CFont::SetFontStyle(FONT_HEADING);
if (BigMessageX[0] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) {
@ -1078,14 +1215,9 @@ void CHud::Draw()
if (BigMessageAlpha[0] > 255.0f)
BigMessageAlpha[0] = 255.0f;
}
CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[0]));
#ifdef FIX_BUGS
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(18.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[0]);
#else
CFont::PrintString(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[0]);
#endif
CFont::DrawFonts();
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, BigMessageAlpha[0]));
CFont::SetColor(CRGBA(BIGMESSAGE_COLOR.r, BIGMESSAGE_COLOR.g, BIGMESSAGE_COLOR.b, BigMessageAlpha[0]));
CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(18.0f), m_BigMessage[0]);
}
@ -1125,8 +1257,12 @@ void CHud::Draw()
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), m_BigMessage[2]);
}
else {
BigMessageAlpha[2] = 0.0f;
BigMessageInUse[2] = 1.0f;
BigMessageAlpha[2] = 0.0f;
if (CHud::m_VehicleState != 0)
CHud::m_VehicleState = 0;
if (CHud::m_ZoneState != 0)
CHud::m_ZoneState = 0;
}
}
else {
@ -1137,108 +1273,13 @@ void CHud::Draw()
void CHud::DrawAfterFade()
{
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
if (CTimer::GetIsUserPaused() || CReplay::IsPlayingBack())
return;
if (m_HelpMessage[0]) {
if (!CMessages::WideStringCompare(m_HelpMessage, m_LastHelpMessage, 256)) {
switch (m_HelpMessageState) {
case 0:
m_HelpMessageFadeTimer = 0;
m_HelpMessageState = 2;
m_HelpMessageTimer = 0;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, 256);
m_fHelpMessageTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
if (TheCamera.m_ScreenReductionPercentage == 0.0f)
DMAudio.PlayFrontEndSound(SOUND_HUD_SOUND, 0);
break;
case 1:
case 2:
case 3:
case 4:
m_HelpMessageTimer = 5;
m_HelpMessageState = 4;
break;
default:
break;
}
CMessages::WideStringCopy(m_LastHelpMessage, m_HelpMessage, 256);
}
float fAlpha = 225.0f;
if (m_HelpMessageState != 0) {
switch (m_HelpMessageState) {
case 1:
fAlpha = 225.0f;
m_HelpMessageFadeTimer = 600;
if (m_HelpMessageTimer > m_fHelpMessageTime * 1000.0f || m_HelpMessageQuick && m_HelpMessageTimer > 1500.0f) {
m_HelpMessageFadeTimer = 600;
m_HelpMessageState = 3;
}
break;
case 2:
m_HelpMessageFadeTimer += 2 * CTimer::GetTimeStepInMilliseconds();
if (m_HelpMessageFadeTimer > 0) {
m_HelpMessageState = 1;
m_HelpMessageFadeTimer = 0;
}
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
case 3:
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
if (m_HelpMessageFadeTimer < 0) {
m_HelpMessageState = 0;
m_HelpMessageFadeTimer = 0;
}
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
case 4:
m_HelpMessageFadeTimer -= 2 * CTimer::GetTimeStepInMilliseconds();
if (m_HelpMessageFadeTimer < 0) {
m_HelpMessageState = 2;
m_HelpMessageFadeTimer = 0;
CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, 256);
}
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
default:
break;
}
m_HelpMessageTimer += CTimer::GetTimeStepInMilliseconds();
CFont::SetAlphaFade(fAlpha);
CFont::SetCentreOff();
CFont::SetPropOn();
if (CGame::germanGame)
CFont::SetScale(SCREEN_SCALE_X(0.52f * 0.85f), SCREEN_SCALE_Y(1.1f * 0.85f));
#ifdef MORE_LANGUAGES
else if (CFont::IsJapanese())
CFont::SetScale(SCREEN_SCALE_X(0.52f) * 1.35f, SCREEN_SCALE_Y(1.1f) * 1.25f);
#endif
else
CFont::SetScale(SCREEN_SCALE_X(0.52f), SCREEN_SCALE_Y(1.1f));
CFont::SetColor(CRGBA(175, 175, 175, 255));
CFont::SetJustifyOff();
#ifdef MORE_LANGUAGES
if (CFont::IsJapanese())
CFont::SetWrapx(SCREEN_SCALE_X(229.0f + 26.0f - 4.0f));
else
#endif
CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 26.0f - 4.0f));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetBackgroundOn();
CFont::SetBackGroundOnlyTextOff();
CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.9f));
CFont::PrintString(SCREEN_SCALE_X(26.0f), SCREEN_SCALE_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint);
CFont::SetAlphaFade(255.0f);
}
}
for (int i = 0; i < ARRAY_SIZE(CTheScripts::IntroTextLines); i++) {
intro_text_line &line = CTheScripts::IntroTextLines[i];
if (line.m_Text[0] != '\0' && !line.m_bTextBeforeFade) {
@ -1309,12 +1350,10 @@ void CHud::DrawAfterFade()
CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_X(600.0f));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) + SCREEN_SCALE_Y(2.0f), m_BigMessage[3]);
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetColor(ODDJOB_COLOR);
CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f), m_BigMessage[3]);
CFont::PrintString((SCREEN_WIDTH / 2), SCREEN_SCALE_Y(140.0f) - SCREEN_SCALE_Y(16.0f), m_BigMessage[3]);
}
if (!m_BigMessage[1][0] && m_BigMessage[4][0]) {
@ -1324,13 +1363,11 @@ void CHud::DrawAfterFade()
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_X(620.0f));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::PrintString((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f) - SCREEN_SCALE_Y(2.0f), m_BigMessage[4]);
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetColor(ODDJOB_COLOR);
CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(84.0f), m_BigMessage[4]);
CFont::PrintString((SCREEN_WIDTH / 2), SCREEN_SCALE_Y(140.0f), m_BigMessage[4]);
}
// Oddjob result
@ -1412,7 +1449,7 @@ void CHud::DrawAfterFade()
CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f));
CFont::SetPropOn();
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(-500.0f));
CFont::SetRightJustifyWrap(0.0f);
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_BANK);
if (BigMessageX[1] >= SCREEN_SCALE_FROM_RIGHT(20.0f)) {
@ -1446,6 +1483,7 @@ void CHud::DrawAfterFade()
BigMessageAlpha[1] = 0.0f;
BigMessageX[1] = -60.0f;
BigMessageInUse[1] = 1.0f;
m_ZoneState = 0;
}
}
else {
@ -1535,6 +1573,7 @@ void CHud::Initialise()
if (gpRocketSightTex == nil)
gpRocketSightTex = RwTextureRead("siterocket", nil);
m_DrawClock = 1;
CounterOnLastFrame = false;
m_ItemToFlash = ITEM_NONE;
OddJob2Timer = 0;
@ -1570,6 +1609,7 @@ void CHud::Initialise()
m_WeaponFadeTimer = 0;
m_WeaponTimer = 0;
m_HideRadar = false;
m_LastDisplayScore = CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney;
m_LastWanted = 0;
@ -1584,6 +1624,7 @@ void CHud::ReInitialise() {
CounterOnLastFrame = false;
m_ItemToFlash = ITEM_NONE;
m_DrawClock = 1;
OddJob2Timer = 0;
OddJob2OffTimer = 0.0f;
OddJob2On = 0;
@ -1617,6 +1658,7 @@ void CHud::ReInitialise() {
m_WeaponFadeTimer = 0;
m_WeaponTimer = 0;
m_HideRadar = false;
m_LastDisplayScore = CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney;
m_LastWanted = 0;
}

View File

@ -85,6 +85,8 @@ public:
static bool m_Wants_To_Draw_3dMarkers;
static wchar m_BigMessage[6][128];
static int16 m_ItemToFlash;
static bool m_HideRadar;
static int32 m_DrawClock;
// These aren't really in CHud
static float BigMessageInUse[6];

View File

@ -1,5 +1,11 @@
#define WITHWINDOWS
#ifndef LIBRW
#define WITHD3D
#endif
#include "common.h"
#ifndef LIBRW
#include <d3d8caps.h>
#endif
#include "RwHelper.h"
#include "Camera.h"
@ -18,6 +24,9 @@ static RwIm2DVertex Vertex[4];
static RwIm2DVertex Vertex2[4];
static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 };
#ifndef LIBRW
extern "C" D3DCAPS8 _RwD3D8DeviceCaps;
#endif
RwBool
CMBlur::MotionBlurOpen(RwCamera *cam)
{
@ -65,12 +74,11 @@ CMBlur::MotionBlurOpen(RwCamera *cam)
if(BlurOn)
{
int32 width = Pow(2.0f, int32(log2(RwRasterGetWidth (RwCameraGetRaster(cam))))+1);
int32 height = Pow(2.0f, int32(log2(RwRasterGetHeight(RwCameraGetRaster(cam))))+1);
int32 depth = RwRasterGetDepth(RwCameraGetRaster(cam));
uint32 width = Pow(2.0f, int32(log2(RwRasterGetWidth (RwCameraGetRaster(cam))))+1);
uint32 height = Pow(2.0f, int32(log2(RwRasterGetHeight(RwCameraGetRaster(cam))))+1);
uint32 depth = RwRasterGetDepth(RwCameraGetRaster(cam));
#ifndef LIBRW
extern D3DCAPS8 _RwD3D8DeviceCaps;
extern DWORD _dwMemTotalVideo;
if ( _RwD3D8DeviceCaps.MaxTextureWidth >= width && _RwD3D8DeviceCaps.MaxTextureHeight >= height )
{

View File

@ -1,13 +1,35 @@
#include "common.h"
#include "main.h"
#include "Occlusion.h"
#include "Game.h"
#include "Camera.h"
#include "Vector.h"
#include "Draw.h"
#include "Timer.h"
#include "RwHelper.h"
int32 COcclusion::NumOccludersOnMap;
int16 COcclusion::FarAwayList;
int16 COcclusion::NearbyList;
int16 COcclusion::ListWalkThroughFA;
int16 COcclusion::PreviousListWalkThroughFA;
int16 COcclusion::NumActiveOccluders;
COccluder COcclusion::aOccluders[NUMOCCLUSIONVOLUMES];
CActiveOccluder COcclusion::aActiveOccluders[NUMACTIVEOCCLUDERS];
CVector gCenterOnScreen;
float gMinYInOccluder;
float gMinXInOccluder;
float gMaxYInOccluder;
float gMaxXInOccluder;
bool gOccluderCoorsValid[8];
CVector gOccluderCoorsOnScreen[8];
CVector gOccluderCoors[8];
bool bDisplayOccDebugStuff;
void
COcclusion::Init(void)
@ -17,6 +39,7 @@ COcclusion::Init(void)
NearbyList = -1;
ListWalkThroughFA = -1;
PreviousListWalkThroughFA = -1;
bDisplayOccDebugStuff = false;
}
void
@ -33,12 +56,423 @@ COcclusion::AddOne(float x, float y, float z, float width, float length, float h
aOccluders[NumOccludersOnMap].height = height;
while(angle < 0.0f) angle += 360.0f;
while(angle > 360.0f) angle -= 360.0f;
aOccluders[NumOccludersOnMap].angle = angle * UINT16_MAX/360.0f;
aOccluders[NumOccludersOnMap].angle = angle/360.0f * UINT16_MAX;
aOccluders[NumOccludersOnMap].listIndex = FarAwayList;
FarAwayList = NumOccludersOnMap++;
}
bool
COccluder::NearCamera() {
return (TheCamera.GetPosition() - CVector(x, y, z)).Magnitude() - (Max(width, length) / 2.0f) < 250.0f;
}
bool
DoesInfiniteLineCrossFiniteLine(float p1X, float p1Y, float p2X, float p2Y, float lineX, float lineY, float lineDX, float lineDY)
{
float side1 = (p1X - lineX) * lineDY - (p1Y - lineY) * lineDX;
float side2 = (p2X - lineX) * lineDY - (p2Y - lineY) * lineDX;
return side1 * side2 < 0.0f; // if points lie on opposite sides of the infinte line, the line between them crosses it
}
bool DoesInfiniteLineTouchScreen(float lineX, float lineY, float lineDX, float lineDY) {
if (lineX > 0.0f && lineY > 0.0f && SCREEN_WIDTH > lineX && SCREEN_HEIGHT > lineY)
return true;
return (DoesInfiniteLineCrossFiniteLine(0.0f, 0.0f, SCREEN_WIDTH, 0.0f, lineX, lineY, lineDX, lineDY) ||
DoesInfiniteLineCrossFiniteLine(0.0f, 0.0f, 0.0f, SCREEN_HEIGHT, lineX, lineY, lineDX, lineDY) ||
DoesInfiniteLineCrossFiniteLine(SCREEN_WIDTH, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, lineX, lineY, lineDX, lineDY) ||
DoesInfiniteLineCrossFiniteLine(0.0f, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT, lineX, lineY, lineDX, lineDY));
}
bool IsPointInsideLine(float lineX, float lineY, float lineDX, float lineDY, float pX, float pY, float area = 0.0f) {
return (pX - lineX) * lineDY - (pY - lineY) * lineDX >= area;
}
bool CalcScreenCoors(CVector const &in, CVector *out, float *outw, float *outh) {
*out = TheCamera.m_viewMatrix * in;
if (out->z <= 1.0f) return false;
float recip = 1.0f / out->z;
out->x *= SCREEN_WIDTH * recip;
out->y *= SCREEN_HEIGHT * recip;
float fovScale = DefaultFOV / CDraw::GetFOV();
*outw = fovScale * recip * SCREEN_WIDTH;
*outh = fovScale * recip * SCREEN_HEIGHT;
return true;
}
bool CalcScreenCoors(CVector const &in, CVector *out) {
*out = TheCamera.m_viewMatrix * in;
if (out->z <= 1.0f) return false;
float recip = 1.0f / out->z;
out->x *= SCREEN_WIDTH * recip;
out->y *= SCREEN_HEIGHT * recip;
return true;
}
bool
COccluder::ProcessLineSegment(int corner1, int corner2, CActiveOccluder *occl) {
if (!gOccluderCoorsValid[corner1] && !gOccluderCoorsValid[corner2])
return false;
float x1, y1, x2, y2;
CVector p1, p2;
if (!gOccluderCoorsValid[corner1]) {
float clipDist1 = Abs((TheCamera.m_viewMatrix * gOccluderCoors[corner1]).z - 1.1f);
float clipDist2 = Abs((TheCamera.m_viewMatrix * gOccluderCoors[corner2]).z - 1.1f);
float ratio = clipDist2 / (clipDist1 + clipDist2);
CVector clippedCoors = (1.0f - ratio) * gOccluderCoors[corner2] + ratio * gOccluderCoors[corner1];
if (!CalcScreenCoors(clippedCoors, &p1, &x1, &y1))
return true;
}
else {
p1 = gOccluderCoorsOnScreen[corner1];
}
if (!gOccluderCoorsValid[corner2]) {
float clipDist1 = Abs((TheCamera.m_viewMatrix * gOccluderCoors[corner1]).z - 1.1f);
float clipDist2 = Abs((TheCamera.m_viewMatrix * gOccluderCoors[corner2]).z - 1.1f);
float ratio = clipDist1 / (clipDist1 + clipDist2);
CVector clippedCoors = (1.0f - ratio) * gOccluderCoors[corner2] + ratio * gOccluderCoors[corner1];
if (!CalcScreenCoors(clippedCoors, &p2, &x2, &y2))
return true;
}
else {
p2 = gOccluderCoorsOnScreen[corner2];
}
gMinXInOccluder = Min(Min(gMinXInOccluder, p1.x), p2.x);
gMaxXInOccluder = Max(Max(gMaxXInOccluder, p1.x), p2.x);
gMinYInOccluder = Min(Min(gMinYInOccluder, p1.y), p2.y);
gMaxYInOccluder = Max(Max(gMaxYInOccluder, p1.y), p2.y);
CVector2D origin = p1;
CVector2D direction = p2 - p1;
// Make sure lines are counter-clockwise around center
if (!IsPointInsideLine(origin.x, origin.y, direction.x, direction.y, gCenterOnScreen.x, gCenterOnScreen.y, 0.0f)) {
origin += direction;
direction *= -1.0f;
}
float magnitude = direction.Magnitude();
occl->lines[occl->linesCount].origin = origin;
occl->lines[occl->linesCount].direction = direction / magnitude;
occl->lines[occl->linesCount].length = magnitude;
if (!DoesInfiniteLineTouchScreen(origin.x, origin.y, direction.x, direction.y))
return !IsPointInsideLine(origin.x, origin.y, direction.x, direction.y, SCREEN_WIDTH / 2.0f, SCREEN_HEIGHT / 2.0f, 0.0f);
occl->linesCount++;
return false;
}
bool
COccluder::ProcessOneOccluder(CActiveOccluder *occl) {
float outX, outY;
occl->linesCount = 0;
CVector pos(x, y, z);
if (!CalcScreenCoors(pos, &gCenterOnScreen, &outX, &outY) || gCenterOnScreen.z < -150.0f || gCenterOnScreen.z > 300.0f) {
return false;
}
occl->radius = Max(width, length) * 0.35f + gCenterOnScreen.z;
CVector vec[3];
vec[0].x = length / 2.0f * Sin(GetAngle());
vec[0].y = -length / 2.0f * Cos(GetAngle());
vec[0].z = 0.0f;
vec[1].x = width / 2.0f * Cos(GetAngle());
vec[1].y = width / 2.0f * Sin(GetAngle());
vec[1].z = 0.0f;
vec[2].x = 0.0f;
vec[2].y = 0.0f;
vec[2].z = height / 2.0f;
// Figure out if we see the front or back of a face
bool bFrontFace[6];
for (int i = 0; i < 3; i++) {
bFrontFace[i*2+0] = DotProduct((pos + vec[i] - TheCamera.GetPosition()), vec[i]) < 0.0f;
bFrontFace[i*2+1] = DotProduct((pos - vec[i] - TheCamera.GetPosition()), -vec[i]) < 0.0f;
}
//calculating vertices of a box
gOccluderCoors[0] = pos + vec[0] + vec[1] + vec[2];
gOccluderCoors[1] = pos - vec[0] + vec[1] + vec[2];
gOccluderCoors[2] = pos + vec[0] - vec[1] + vec[2];
gOccluderCoors[3] = pos - vec[0] - vec[1] + vec[2];
gOccluderCoors[4] = pos + vec[0] + vec[1] - vec[2];
gOccluderCoors[5] = pos - vec[0] + vec[1] - vec[2];
gOccluderCoors[6] = pos + vec[0] - vec[1] - vec[2];
gOccluderCoors[7] = pos - vec[0] - vec[1] - vec[2];
for(int i = 0; i < 8; i++)
gOccluderCoorsValid[i] = CalcScreenCoors(gOccluderCoors[i], &gOccluderCoorsOnScreen[i], &outX, &outY);
gMinYInOccluder = 999999.875f;
gMinXInOccluder = 999999.875f;
gMaxYInOccluder = -999999.875f;
gMaxXInOccluder = -999999.875f;
// Between two differently facing sides we see an edge, so process those
if (bFrontFace[2] != bFrontFace[0] && ProcessLineSegment(0, 4, occl))
return false;
if (bFrontFace[3] != bFrontFace[0] && ProcessLineSegment(2, 6, occl))
return false;
if (bFrontFace[4] != bFrontFace[0] && ProcessLineSegment(0, 2, occl))
return false;
if (bFrontFace[5] != bFrontFace[0] && ProcessLineSegment(4, 6, occl))
return false;
if (bFrontFace[2] != bFrontFace[1] && ProcessLineSegment(1, 5, occl))
return false;
if (bFrontFace[3] != bFrontFace[1] && ProcessLineSegment(3, 7, occl))
return false;
if (bFrontFace[4] != bFrontFace[1] && ProcessLineSegment(1, 3, occl))
return false;
if (bFrontFace[5] != bFrontFace[1] && ProcessLineSegment(5, 7, occl))
return false;
if (bFrontFace[4] != bFrontFace[2] && ProcessLineSegment(0, 1, occl))
return false;
if (bFrontFace[3] != bFrontFace[4] && ProcessLineSegment(2, 3, occl))
return false;
if (bFrontFace[5] != bFrontFace[3] && ProcessLineSegment(6, 7, occl))
return false;
if (bFrontFace[2] != bFrontFace[5] && ProcessLineSegment(4, 5, occl))
return false;
if (gMaxXInOccluder - gMinXInOccluder < SCREEN_WIDTH * 0.1f ||
gMaxYInOccluder - gMinYInOccluder < SCREEN_HEIGHT * 0.07f)
return false;
return true;
}
bool
COcclusion::OccluderHidesBehind(CActiveOccluder *occl1, CActiveOccluder *occl2) {
for (int i = 0; i < occl1->linesCount; i++) {
for (int j = 0; j < occl2->linesCount; j++) {
if (!IsPointInsideLine(occl2->lines[j].origin.x, occl2->lines[j].origin.y, occl2->lines[j].direction.x,
occl2->lines[j].direction.y, occl1->lines[i].origin.x, occl1->lines[i].origin.y, 0.0f))
return false;
if (!IsPointInsideLine(occl2->lines[j].origin.x, occl2->lines[j].origin.y, occl2->lines[j].direction.x,
occl2->lines[j].direction.y, (occl1->lines[i].origin.x + occl1->lines[i].direction.x * occl1->lines[i].length),
(occl1->lines[i].origin.y + occl1->lines[i].direction.y * occl1->lines[i].length), 0.0f))
return false;
}
}
return true;
}
void
COcclusion::ProcessBeforeRendering(void)
{
NumActiveOccluders = 0;
if (CGame::currArea != AREA_MAIN_MAP)
return;
if (ListWalkThroughFA == -1) {
PreviousListWalkThroughFA = -1;
ListWalkThroughFA = FarAwayList;
}
int i;
for (i = 0; i < 16 && ListWalkThroughFA != -1; i++) {
if (aOccluders[ListWalkThroughFA].NearCamera()) {
int prevListWalkThroughFA = ListWalkThroughFA;
if (PreviousListWalkThroughFA == -1) {
FarAwayList = aOccluders[ListWalkThroughFA].listIndex;
}
else {
aOccluders[PreviousListWalkThroughFA].listIndex = aOccluders[ListWalkThroughFA].listIndex;
}
int prevNearbyList = NearbyList;
ListWalkThroughFA = aOccluders[ListWalkThroughFA].listIndex;
NearbyList = prevListWalkThroughFA;
aOccluders[prevListWalkThroughFA].listIndex = prevNearbyList;
}
else {
PreviousListWalkThroughFA = ListWalkThroughFA;
ListWalkThroughFA = aOccluders[ListWalkThroughFA].listIndex;
}
}
int prevNearbyList = -1;
int tmpNearbyList = NearbyList;
int indexTmpNearbyList, storeTmpNearbyList, prevFarAwayList;
while (tmpNearbyList != -1)
{
if (NumActiveOccluders < NUMACTIVEOCCLUDERS && aOccluders[tmpNearbyList].ProcessOneOccluder(&aActiveOccluders[NumActiveOccluders]))
++NumActiveOccluders;
indexTmpNearbyList = tmpNearbyList;
if (aOccluders[indexTmpNearbyList].NearCamera())
{
prevNearbyList = tmpNearbyList;
tmpNearbyList = aOccluders[indexTmpNearbyList].listIndex;
}
else
{
storeTmpNearbyList = tmpNearbyList;
if (prevNearbyList == -1) {
NearbyList = aOccluders[indexTmpNearbyList].listIndex;
}
else {
aOccluders[prevNearbyList].listIndex = aOccluders[indexTmpNearbyList].listIndex;
}
tmpNearbyList = aOccluders[indexTmpNearbyList].listIndex;
prevFarAwayList = FarAwayList;
FarAwayList = storeTmpNearbyList;
aOccluders[storeTmpNearbyList].listIndex = prevFarAwayList;
}
}
for (i = 0; i < NumActiveOccluders; i++) {
for (int j = 0; j < NumActiveOccluders; j++) {
if (i != j && aActiveOccluders[j].radius < aActiveOccluders[i].radius) {
if (OccluderHidesBehind(&aActiveOccluders[i], &aActiveOccluders[j])) {
for (int k = i; k < NumActiveOccluders - 1; k++) {
for (int l = 0; l < aActiveOccluders[k + 1].linesCount; l++)
aActiveOccluders[k].lines[l] = aActiveOccluders[k + 1].lines[l];
aActiveOccluders[k].linesCount = aActiveOccluders[k + 1].linesCount;
aActiveOccluders[k].radius = aActiveOccluders[k + 1].radius;
}
NumActiveOccluders--;
i--;
}
}
}
}
}
bool CActiveOccluder::IsPointWithinOcclusionArea(float pX, float pY, float area) {
for (int i = 0; i < linesCount; i++) {
if (!IsPointInsideLine(lines[i].origin.x, lines[i].origin.y, lines[i].direction.x, lines[i].direction.y, pX, pY, area))
return false;
}
return true;
}
bool COcclusion::IsAABoxOccluded(CVector pos, float width, float length, float height) {
CVector coors;
float outW, outH;
if (!NumActiveOccluders || !CalcScreenCoors(pos, &coors, &outW, &outH))
return false;
float side = CVector(width, length, height).Magnitude() / 4.0f;
float area = Max(outW, outH) * side;
CVector minCorner, maxCorner;
minCorner.x = pos.x - width / 2.0f;
minCorner.y = pos.y - length / 2.0f;
minCorner.z = pos.z - height / 2.0f;
maxCorner.x = pos.x + width / 2.0f;
maxCorner.y = pos.y + length / 2.0f;
maxCorner.z = pos.z + height / 2.0f;
for (int i = 0; i < NumActiveOccluders; i++) {
if (coors.z - (side * 0.85f) > aActiveOccluders[i].radius) {
if (aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, area))
return true;
if (aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) {
if (CalcScreenCoors(minCorner, &coors) && !aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) continue;
if (CalcScreenCoors(CVector(maxCorner.x, maxCorner.y, minCorner.z), &coors) && !aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) continue;
if (CalcScreenCoors(CVector(maxCorner.x, minCorner.y, maxCorner.z), &coors) && !aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) continue;
if (CalcScreenCoors(CVector(minCorner.x, maxCorner.y, maxCorner.z), &coors, &outW, &outH) && !aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) continue;
return true;
}
}
}
return false;
}
bool COcclusion::IsPositionOccluded(CVector pos, float side) {
CVector coors;
float width, height;
if (!NumActiveOccluders || !CalcScreenCoors(pos, &coors, &width, &height))
return false;
float area = Max(width, height) * side;
for (int i = 0; i < NumActiveOccluders; i++) {
if (coors.z - (side * 0.85f) > aActiveOccluders[i].radius)
if (aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, area))
return true;
}
return false;
}
#include "Lines.h"
RwIm2DVertex vertexbufferT[2];
void COcclusion::Render() {
if (!bDisplayOccDebugStuff || !(CTimer::GetTimeInMilliseconds() & 0x200))
return;
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, FALSE);
float recipz = 1.0f/RwCameraGetNearClipPlane(Scene.camera);
for (int i = 0; i < NumActiveOccluders; i++) {
for (int j = 0; j < aActiveOccluders[i].linesCount; j++) {
RwIm2DVertexSetScreenX(&vertexbufferT[0], aActiveOccluders[i].lines[j].origin.x);
RwIm2DVertexSetScreenY(&vertexbufferT[0], aActiveOccluders[i].lines[j].origin.y);
RwIm2DVertexSetScreenZ(&vertexbufferT[0], RwIm2DGetNearScreenZ());
RwIm2DVertexSetCameraZ(&vertexbufferT[0], RwCameraGetNearClipPlane(Scene.camera));
RwIm2DVertexSetRecipCameraZ(&vertexbufferT[0], recipz);
RwIm2DVertexSetScreenX(&vertexbufferT[1],
aActiveOccluders[i].lines[j].origin.x + aActiveOccluders[i].lines[j].direction.x * aActiveOccluders[i].lines[j].length);
RwIm2DVertexSetScreenY(&vertexbufferT[1],
aActiveOccluders[i].lines[j].origin.y + aActiveOccluders[i].lines[j].direction.y * aActiveOccluders[i].lines[j].length);
RwIm2DVertexSetScreenZ(&vertexbufferT[1], RwIm2DGetNearScreenZ());
RwIm2DVertexSetCameraZ(&vertexbufferT[1], RwCameraGetNearClipPlane(Scene.camera));
RwIm2DVertexSetRecipCameraZ(&vertexbufferT[1], recipz);
RwIm2DVertexSetIntRGBA(&vertexbufferT[0], 255, 255, 0, 255);
RwIm2DVertexSetIntRGBA(&vertexbufferT[1], 255, 255, 0, 255);
RwIm2DRenderLine(vertexbufferT, 2, 0, 1);
}
}
DefinedState();
}

View File

@ -1,12 +1,33 @@
#pragma once
struct ActiveOccluderLine {
CVector2D origin;
CVector2D direction;
float length;
};
class CActiveOccluder {
public:
ActiveOccluderLine lines[6];
int32 linesCount;
float radius;
bool IsPointWithinOcclusionArea(float x, float y, float area);
};
class COccluder
{
public:
int16 width, length, height;
int16 length, width, height;
int16 x, y, z;
uint16 angle;
int16 listIndex;
bool NearCamera();
bool ProcessOneOccluder(CActiveOccluder *occl);
bool ProcessLineSegment(int corner1, int corner2, CActiveOccluder* occl);
float GetAngle(void) { return angle*TWOPI/UINT16_MAX; }
};
class COcclusion
@ -17,13 +38,21 @@ public:
static int16 NearbyList;
static int16 ListWalkThroughFA;
static int16 PreviousListWalkThroughFA;
static int16 NumActiveOccluders;
static COccluder aOccluders[NUMOCCLUSIONVOLUMES];
static CActiveOccluder aActiveOccluders[NUMACTIVEOCCLUDERS];
static void Init(void);
static void AddOne(float x, float y, float z, float width, float length, float height, float angle);
static void ProcessBeforeRendering(void);
//TODO:
static bool IsAABoxOccluded(CVector pos, float, float, float) { return false; }
static void ProcessBeforeRendering(void);
static bool OccluderHidesBehind(CActiveOccluder *occl1, CActiveOccluder *occl2);
static bool IsAABoxOccluded(CVector pos, float width, float length, float height);
static bool IsPositionOccluded(CVector pos, float side);
static void Render();
};
bool CalcScreenCoors(CVector const &in, CVector *out, float *outw, float *outh);
bool CalcScreenCoors(CVector const &in, CVector *out);
extern bool bDisplayOccDebugStuff;

View File

@ -98,5 +98,6 @@ public:
};
extern bool clearWaterDrop;
extern int32 numWaterDropOnScreen;
VALIDATE_SIZE(CParticle, 0x58);

View File

@ -5,8 +5,7 @@
int32 TempBufferVerticesStored;
int32 TempBufferIndicesStored;
RwIm2DVertex TempVertexBuffer[TEMPBUFFERVERTSIZE];
RwIm3DVertex *TempBufferRenderVertices = (RwIm3DVertex * )TempVertexBuffer;
VertexBufferUnion TempVertexBuffer;
RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE];
int RenderBuffer::VerticesToBeStored;

View File

@ -12,8 +12,14 @@ public:
#define TEMPBUFFERVERTSIZE 512
#define TEMPBUFFERINDEXSIZE 1024
struct VertexBufferUnion
{
RwIm2DVertex im2d[TEMPBUFFERVERTSIZE];
RwIm3DVertex im3d[TEMPBUFFERVERTSIZE];
};
extern int32 TempBufferVerticesStored;
extern int32 TempBufferIndicesStored;
extern RwIm2DVertex TempVertexBuffer[TEMPBUFFERVERTSIZE];
extern RwIm3DVertex *TempBufferRenderVertices;
extern VertexBufferUnion TempVertexBuffer;
#define TempBufferRenderVertices (TempVertexBuffer.im3d)
extern RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE];

View File

@ -317,7 +317,11 @@ enum Visbility
VIS_STREAMME
};
#ifdef FIX_BUGS
#define LOD_DISTANCE (300.0f*TheCamera.LODDistMultiplier)
#else
#define LOD_DISTANCE 300.0f
#endif
#define FADE_DISTANCE 20.0f
#define STREAM_DISTANCE 30.0f
@ -419,6 +423,8 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
// whose draw dist is > LOD_DISTANCE-FADE_DISTANCE, i.e. 280
// because decreasing dist here makes the object visible above LOD_DISTANCE
// before fading normally once below LOD_DISTANCE.
// aha! this must be a workaround for the fact that we're not taking
// the LOD multiplier into account here anywhere
if(LOD_DISTANCE < dist && dist < mi->GetLargestLodDistance() + FADE_DISTANCE)
dist += mi->GetLargestLodDistance() - LOD_DISTANCE;
#endif
@ -751,14 +757,7 @@ CRenderer::ScanWorld(void)
}else
#endif
{
if(f <= LOD_DISTANCE){
poly[0].x = CWorld::GetSectorX(vectors[CORNER_CAM].x);
poly[0].y = CWorld::GetSectorY(vectors[CORNER_CAM].y);
poly[1].x = CWorld::GetSectorX(vectors[CORNER_FAR_TOPLEFT].x);
poly[1].y = CWorld::GetSectorY(vectors[CORNER_FAR_TOPLEFT].y);
poly[2].x = CWorld::GetSectorX(vectors[CORNER_FAR_TOPRIGHT].x);
poly[2].y = CWorld::GetSectorY(vectors[CORNER_FAR_TOPRIGHT].y);
}else{
if(f > LOD_DISTANCE){
// priority
poly[0].x = CWorld::GetSectorX(vectors[CORNER_CAM].x);
poly[0].y = CWorld::GetSectorY(vectors[CORNER_CAM].y);
@ -775,11 +774,19 @@ CRenderer::ScanWorld(void)
poly[1].y = CWorld::GetSectorY(vectors[CORNER_LOD_LEFT].y);
poly[2].x = CWorld::GetSectorX(vectors[CORNER_LOD_RIGHT].x);
poly[2].y = CWorld::GetSectorY(vectors[CORNER_LOD_RIGHT].y);
ScanSectorPoly(poly, 3, ScanSectorList);
}else{
poly[0].x = CWorld::GetSectorX(vectors[CORNER_CAM].x);
poly[0].y = CWorld::GetSectorY(vectors[CORNER_CAM].y);
poly[1].x = CWorld::GetSectorX(vectors[CORNER_FAR_TOPLEFT].x);
poly[1].y = CWorld::GetSectorY(vectors[CORNER_FAR_TOPLEFT].y);
poly[2].x = CWorld::GetSectorX(vectors[CORNER_FAR_TOPRIGHT].x);
poly[2].y = CWorld::GetSectorY(vectors[CORNER_FAR_TOPRIGHT].y);
ScanSectorPoly(poly, 3, ScanSectorList);
}
ScanSectorPoly(poly, 3, ScanSectorList);
ScanBigBuildingList(CWorld::GetBigBuildingList(CGame::currLevel));
ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_NONE));
ScanBigBuildingList(CWorld::GetBigBuildingList(LEVEL_GENERIC));
}
}
}
@ -922,9 +929,9 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL
// prestep x1 and x2 to next integer y
deltaA = CalcNewDelta(&poly[a1], &poly[a2]);
xA = deltaA * (ceilf(poly[a1].y) - poly[a1].y) + poly[a1].x;
xA = deltaA * (Ceil(poly[a1].y) - poly[a1].y) + poly[a1].x;
deltaB = CalcNewDelta(&poly[b1], &poly[b2]);
xB = deltaB * (ceilf(poly[b1].y) - poly[b1].y) + poly[b1].x;
xB = deltaB * (Ceil(poly[b1].y) - poly[b1].y) + poly[b1].x;
if(y != yend){
if(deltaB < 0.0f && (int)xB < xstart)
@ -969,7 +976,7 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL
xstart = poly[b1].x;
}while(y == (int)poly[b2].y);
deltaB = CalcNewDelta(&poly[b1], &poly[b2]);
xB = deltaB * (ceilf(poly[b1].y) - poly[b1].y) + poly[b1].x;
xB = deltaB * (Ceil(poly[b1].y) - poly[b1].y) + poly[b1].x;
if(deltaB < 0.0f && (int)xB < xstart)
xstart = xB;
}
@ -1005,7 +1012,7 @@ CRenderer::ScanSectorPoly(RwV2d *poly, int32 numVertices, void (*scanfunc)(CPtrL
xend = poly[a1].x;
}while(y == (int)poly[a2].y);
deltaA = CalcNewDelta(&poly[a1], &poly[a2]);
xA = deltaA * (ceilf(poly[a1].y) - poly[a1].y) + poly[a1].x;
xA = deltaA * (Ceil(poly[a1].y) - poly[a1].y) + poly[a1].x;
if(deltaA >= 0.0f && (int)xA > xend)
xend = xA;
}

View File

@ -49,3 +49,5 @@ public:
static void Init(void);
static void Shutdown(void);
};
extern RwTexture *gpRubbishTexture[4];

View File

@ -29,11 +29,7 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh,
float recip = 1.0f/out->z;
out->x *= SCREEN_WIDTH * recip;
out->y *= SCREEN_HEIGHT * recip;
#ifdef ASPECT_RATIO_SCALE
float fov = CDraw::ConvertFOV(DefaultFOV);
#else
const float fov = DefaultFOV;
#endif
// this is used to scale correctly if you zoom in with sniper rifle
float fovScale = fov / CDraw::GetFOV();

View File

@ -432,7 +432,7 @@ void CSprite2d::Draw2DPolygon(float x1, float y1, float x2, float y2, float x3,
void
CSprite2d::AddToBuffer(const CRect &r, const CRGBA &c, float u0, float v0, float u1, float v1, float u3, float v3, float u2, float v2)
{
SetVertices(&TempVertexBuffer[nextBufferVertex], r, c, c, c, c, u0, v0, u1, v1, u3, v3, u2, v2);
SetVertices(&TempVertexBuffer.im2d[nextBufferVertex], r, c, c, c, c, u0, v0, u1, v1, u3, v3, u2, v2);
RwImVertexIndex *pIndexList = &TempBufferRenderIndexList[nextBufferIndex];
pIndexList[0] = nextBufferVertex;
pIndexList[1] = nextBufferVertex + 1;
@ -449,7 +449,7 @@ CSprite2d::AddToBuffer(const CRect &r, const CRGBA &c, float u0, float v0, float
bool
CSprite2d::IsVertexBufferFull()
{
return (nextBufferVertex > ARRAY_SIZE(TempVertexBuffer)-128-4 || nextBufferIndex > ARRAY_SIZE(TempBufferRenderIndexList)-6);
return (nextBufferVertex > TEMPBUFFERVERTSIZE-128-4 || nextBufferIndex > ARRAY_SIZE(TempBufferRenderIndexList)-6);
}
void
@ -457,7 +457,7 @@ CSprite2d::RenderVertexBuffer()
{
if (nextBufferVertex > 0) {
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempVertexBuffer, nextBufferVertex, TempBufferRenderIndexList, nextBufferIndex);
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempVertexBuffer.im2d, nextBufferVertex, TempBufferRenderIndexList, nextBufferIndex);
nextBufferVertex = 0;
nextBufferIndex = 0;
}

View File

@ -1167,8 +1167,8 @@ CWaterLevel::RenderTransparentWater(void)
{
if (m_nRenderWaterLayers != 1 && m_nRenderWaterLayers != 6)
{
float fMaskX = floorf(fCamX / 2.0f) * 2.0f;
float fMaskY = floorf(fCamY / 2.0f) * 2.0f;
float fMaskX = Floor(fCamX / 2.0f) * 2.0f;
float fMaskY = Floor(fCamY / 2.0f) * 2.0f;
float fWaterZ = CWaterLevel::ms_aWaterZs[nBlock];
float fSectorX = WATER_FROM_SMALL_SECTOR_X(BlockX) - 400.0f;
float fSectorY = WATER_FROM_SMALL_SECTOR_Y(BlockY);
@ -1519,8 +1519,8 @@ CWaterLevel::RenderWavyMask(float fX, float fY, float fZ,
return;
#ifndef PC_WATER
float fUOffset = fX - (MAX_LARGE_SECTORS * (int32)floorf(fX / MAX_LARGE_SECTORS));
float fVOffset = fY - (MAX_LARGE_SECTORS * (int32)floorf(fY / MAX_LARGE_SECTORS));
float fUOffset = fX - (MAX_LARGE_SECTORS * (int32)Floor(fX / MAX_LARGE_SECTORS));
float fVOffset = fY - (MAX_LARGE_SECTORS * (int32)Floor(fY / MAX_LARGE_SECTORS));
int32 nSecsX = (int32)((fX - fSectorX) / 2.0f);
int32 nSecsY = (int32)((fY - fSectorY) / 2.0f);
@ -1870,8 +1870,8 @@ CWaterLevel::PreCalcWaterGeometry(void)
if ( _IsColideWithBlock(BlockX, BlockY, nBlock) )
{
float fMaskX = floorf(fCamX / 2.0f) * 2.0f;
float fMaskY = floorf(fCamY / 2.0f) * 2.0f;
float fMaskX = Floor(fCamX / 2.0f) * 2.0f;
float fMaskY = Floor(fCamY / 2.0f) * 2.0f;
float fSectorX = WATER_FROM_SMALL_SECTOR_X(BlockX) - WATER_X_OFFSET;
float fSectorY = WATER_FROM_SMALL_SECTOR_Y(BlockY);
@ -1994,8 +1994,8 @@ CWaterLevel::PreCalcWavyMask(float fX, float fY, float fZ,
if ( COcclusion::IsAABoxOccluded(vecSectorPos, MAX_LARGE_SECTORS, MAX_LARGE_SECTORS, 4.0f) )
return false;
floorf(fX / MAX_LARGE_SECTORS);
floorf(fY / MAX_LARGE_SECTORS);
Floor(fX / MAX_LARGE_SECTORS);
Floor(fY / MAX_LARGE_SECTORS);
RpGeometry *wavyGeometry = RpAtomicGetGeometry(ms_pWavyAtomic);
RpMorphTarget *wavyMorph = RpGeometryGetMorphTarget(wavyGeometry, 0);
@ -2335,7 +2335,7 @@ _GetWindedWave(float fX, float fY)
float y = WATER_HUGE_Y(fY);
float fWindFactor (CWeather::WindClipped * 0.4f + 0.2f);
float fWave = Sin(( (x - floorf(x)) + (y - floorf(y)) ) * TWOPI + fAngle);
float fWave = Sin(( (x - Floor(x)) + (y - Floor(y)) ) * TWOPI + fAngle);
return fWindFactor * fWave;
}
@ -2380,8 +2380,8 @@ CWaterLevel::RenderWakeSegment(CVector2D &vecA, CVector2D &vecB, CVector2D &vecC
float fVD = (PosD.y / 4) + _TEXTURE_WAKE_ADDV;
#define MIN4(a, b, c, d) (Min((a), Min((b), Min((c), (d)))))
float fMinU = floorf(MIN4(fUA, fUB, fUC, fUD));
float fMinV = floorf(MIN4(fVA, fVB, fVC, fVD));
float fMinU = Floor(MIN4(fUA, fUB, fUC, fUD));
float fMinV = Floor(MIN4(fVA, fVB, fVC, fVD));
#undef MIN4
float fZA = _GetWindedWave(PosA.x, PosA.y) + fWakeZ;

View File

@ -279,7 +279,7 @@ void CWeather::Update(void)
}
Wind = InterpolationValue * Windiness[NewWeatherType] + (1.0f - InterpolationValue) * Windiness[OldWeatherType];
WindClipped = Max(1.0f, Wind);
WindClipped = Min(1.0f, Wind);
if (CClock::GetHours() == 20)
TrafficLightBrightness = CClock::GetMinutes() / 60.0f;