Skip to content
Permalink
Browse files
Merge branch 'master' of tohjo.ez.lv:vcspc/vcspc
  • Loading branch information
NTAuthority committed Jul 27, 2014
2 parents 1be4c76 + ab385d6 commit 942a20fe000938e13c94ade71d6454d5c07fee59
Showing with 4,358 additions and 940 deletions.
  1. +7 −0 VCS PC/Audio.cpp
  2. +6 −0 VCS PC/Audio.h
  3. +61 −1 VCS PC/Building.cpp
  4. +22 −0 VCS PC/Building.h
  5. +2 −0 VCS PC/Camera.cpp
  6. +2 −2 VCS PC/Camera.h
  7. +6 −2 VCS PC/ControlsMgr.cpp
  8. +11 −1 VCS PC/ControlsMgr.h
  9. +0 −3 VCS PC/EmpireMgr.cpp
  10. +22 −3 VCS PC/FileMgr.cpp
  11. +4 −1 VCS PC/FileMgr.h
  12. +1 −0 VCS PC/Font.cpp
  13. +1 −0 VCS PC/Font.h
  14. +1,800 −228 VCS PC/Frontend.cpp
  15. +263 −46 VCS PC/Frontend.h
  16. +71 −0 VCS PC/FxSystem.cpp
  17. +42 −0 VCS PC/FxSystem.h
  18. +20 −23 VCS PC/General.cpp
  19. +85 −78 VCS PC/General.h
  20. +2 −3 VCS PC/GroupedBuildings.h
  21. +17 −2 VCS PC/MemoryMgr.h
  22. +8 −2 VCS PC/ModelInfo.h
  23. +12 −0 VCS PC/Object.cpp
  24. +4 −0 VCS PC/Object.h
  25. +3 −3 VCS PC/Pad.h
  26. +10 −0 VCS PC/PcSave.cpp
  27. +8 −0 VCS PC/PcSave.h
  28. +56 −0 VCS PC/Ped.cpp
  29. +5 −1 VCS PC/Ped.h
  30. +2 −1 VCS PC/PedIntelligence.cpp
  31. +2 −1 VCS PC/PedIntelligence.h
  32. +7 −1 VCS PC/Pools.cpp
  33. +10 −1 VCS PC/Pools.h
  34. +4 −0 VCS PC/PostEffects.cpp
  35. +10 −0 VCS PC/PostEffects.h
  36. +18 −0 VCS PC/RW.cpp
  37. +592 −0 VCS PC/RealTimeShadowMgr.cpp
  38. +138 −0 VCS PC/RealTimeShadowMgr.h
  39. +118 −1 VCS PC/Rs.cpp
  40. +12 −0 VCS PC/Rs.h
  41. +323 −1 VCS PC/Shadows.cpp
  42. +42 −2 VCS PC/Shadows.h
  43. +7 −0 VCS PC/StdAfx.h
  44. +17 −0 VCS PC/Tasks.cpp
  45. +88 −0 VCS PC/Tasks.h
  46. +1 −1 VCS PC/Text.cpp
  47. +4 −4 VCS PC/UpdateManager.cpp
  48. +12 −0 VCS PC/UpdateManager.h
  49. +8 −0 VCS PC/VCS PC.vcxproj
  50. +24 −0 VCS PC/VCS PC.vcxproj.filters
  51. +284 −453 VCS PC/VCSPC.cpp
  52. +30 −0 VCS PC/Vehicle.cpp
  53. +34 −3 VCS PC/Vehicle.h
  54. +17 −29 VCS PC/VideoPlayer.cpp
  55. +2 −2 VCS PC/VideoPlayer.h
  56. +0 −27 VCS PC/WidescreenSupport.cpp
  57. +1 −14 VCS PC/WidescreenSupport.h
@@ -9,6 +9,13 @@ signed char CAERadioTrackManager::bTracksPlayedRecently[NUM_RADIOSTATIONS];
static std::map<short,tVehicleAudioSettings> AudioSettingsMap;

WRAPPER void CAudioEngine::ReportFrontendAudioEvent(long nSoundID, float fUnk, float fVolume) { WRAPARG(nSoundID); WRAPARG(fUnk); WRAPARG(fVolume); EAXJMP(0x506EA0); }
WRAPPER void CAudioEngine::SetMusicMasterVolume(signed char nVolume) { WRAPARG(nVolume); EAXJMP(0x506DE0); };
WRAPPER void CAudioEngine::SetEffectsMasterVolume(signed char nVolume) { WRAPARG(nVolume); EAXJMP(0x506E10); }
WRAPPER void CAudioEngine::SetRadioAutoRetuneOnOff(bool bRetune) { WRAPARG(bRetune); EAXJMP(0x506F80); }
WRAPPER void CAudioEngine::RetuneRadio(signed char nStation) { WRAPARG(nStation); EAXJMP(0x507E10); }
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)
{
@@ -83,6 +83,12 @@ class CAudioEngine
{
public:
void ReportFrontendAudioEvent(long nSoundID, float fUnk, float fVolume);
void SetMusicMasterVolume(signed char nVolume);
void SetEffectsMasterVolume(signed char nVolume);
void SetRadioAutoRetuneOnOff(bool bRetune);
void RetuneRadio(signed char nStation);
const char* GetRadioStationName(signed char nStation);
void ScrollRadioStations(signed char nDirection);
};

extern CAudioEngine& AudioEngine;
@@ -2,6 +2,8 @@
#include "Building.h"

#include "Pools.h"
#include "RealTimeShadowMgr.h"
#include "Shadows.h"

void* CBuilding::operator new(size_t size)
{
@@ -12,4 +14,62 @@ void* CBuilding::operator new(size_t size)
void CBuilding::operator delete(void* ptr)
{
CPools::GetBuildingPool()->Delete(static_cast<CBuilding*>(ptr));
}
}

void CBuilding::PreRender()
{
CEntity::PreRender();
CShadows::StoreRealTimeShadowForBuilding(this);
}

void CBuildingAux::Construct(CBuilding* pParent)
{
CBuildingAux* pSpace = CPools::GetBuildingPoolAux()->GetAtPointer(pParent);

// ctor
pSpace->m_pShadow = nullptr;
}

CBuilding* CBuildingAux::Destruct(CBuilding* pParent)
{
CBuildingAux* pSpace = CPools::GetBuildingPoolAux()->GetAtPointer(pParent);

// dtor
if ( pSpace->m_pShadow )
g_realTimeShadowMan.ReturnRealTimeShadow(pSpace->m_pShadow);

return pParent;
}

static void __declspec(naked) CtorHack()
{
_asm
{
mov dword ptr [esi], 8585C8h
push esi
call CBuildingAux::Construct
add esp, 4
mov eax, esi
pop esi
retn
}
}

static void __declspec(naked) DtorHack()
{
_asm
{
push ecx
call CBuildingAux::Destruct
add esp, 4
mov ecx, eax
push 535E90h
retn
}
}

static StaticPatcher Patcher([](){
Memory::InjectHook(0x403E16, &CtorHack, PATCH_JUMP);
Memory::InjectHook(0x404134, &DtorHack);
Memory::Patch(0x85860C, &CBuilding::PreRender_Stub);
});
@@ -20,6 +20,11 @@ class NOVMT CBuilding : public CEntity

void* operator new(size_t size);
void operator delete(void* ptr);

inline void PreRender_Stub()
{ CBuilding::PreRender(); }

virtual void PreRender() override;
};


@@ -34,4 +39,21 @@ class NOVMT CDummy : public CEntity
}
};

class CBuildingAux
{
friend class CBuilding;

private:
class CRealTimeShadow* m_pShadow;

public:
inline class CRealTimeShadow* GetShadow()
{ return m_pShadow; }
inline void SetShadow(class CRealTimeShadow* pShadow)
{ m_pShadow = pShadow; }

static void Construct(CBuilding* pParent);
static CBuilding* Destruct(CBuilding* pParent);
};

#endif
@@ -4,6 +4,8 @@
#include "Sprite.h"

bool CCamera::bDontTouchFOVInWidescreen;
float& CCamera::m_fMouseAccelHorzntl = *(float*)0xB6EC1C;
bool& CCamera::m_bUseMouse3rdPerson = *(bool*)0xB6EC2E;

WRAPPER void CamShakeNoPos(CCamera* pCamera, float fStrength) { WRAPARG(pCamera); WRAPARG(fStrength); EAXJMP(0x50A970); }

@@ -290,7 +290,7 @@ class CCamera : public CPlaceable
bool m_bCooperativeCamMode;
bool m_bAllowShootingWith2PlayersInCar;
bool m_bDisableFirstPersonInCar;
static bool m_bUseMouse3rdPerson;
static bool& m_bUseMouse3rdPerson;

short m_ModeForTwoPlayersSeparateCars;
short m_ModeForTwoPlayersSameCarShootingAllowed;
@@ -404,7 +404,7 @@ class CCamera : public CPlaceable
float m_fStartingFOVForInterPol;

// These ones are static so that they don't get cleared in CCamera::Init()
static float m_fMouseAccelHorzntl;// acceleration multiplier for 1st person controls
static float& m_fMouseAccelHorzntl;// acceleration multiplier for 1st person controls
static float m_fMouseAccelVertical;// acceleration multiplier for 1st person controls
static float m_f3rdPersonCHairMultX;
static float m_f3rdPersonCHairMultY;
@@ -5,6 +5,7 @@ WRAPPER void CControllerConfigManager::SaveSettings(FILE* hFile) { WRAPARG(hFile
WRAPPER bool CControllerConfigManager::LoadSettings(FILE* hFile) { WRAPARG(hFile); EAXJMP(0x530530); }
WRAPPER bool CControllerConfigManager::GetIsKeyboardKeyJustDown(RsKeyCodes eKey) { WRAPARG(eKey); EAXJMP(0x52E450); }
WRAPPER bool CControllerConfigManager::GetIsKeyboardKeyDown(RsKeyCodes eKey) { WRAPARG(eKey); EAXJMP(0x52DDB0); }
WRAPPER void CControllerConfigManager::ReinitControls() { EAXJMP(0x531F20); }

void CControllerConfigManager::SaveToFile()
{
@@ -19,12 +20,15 @@ void CControllerConfigManager::SaveToFile()
}
}

void CControllerConfigManager::LoadFromFile()
bool CControllerConfigManager::LoadFromFile()
{
bool bResult = false;

if ( FILE* hFile = CFileMgr::OpenFile("controls.set", "rb") )
{
LoadSettings(hFile);
bResult = LoadSettings(hFile);

CFileMgr::CloseFile(hFile);
}
return bResult;
}
@@ -3,6 +3,13 @@

#define CONTROLS_FILE_VERSION 1

class CMousePointerStateHelper
{
public:
bool m_bVerticalInvert;
bool m_bHorizontalInvert;
};

class CControllerConfigManager
{
public:
@@ -12,10 +19,13 @@ class CControllerConfigManager
bool GetIsKeyboardKeyDown(RsKeyCodes eKey);

void SaveToFile();
void LoadFromFile();
bool LoadFromFile();

static void ReinitControls();
};


extern CControllerConfigManager& ControlsManager;
extern CMousePointerStateHelper& MousePointerStateHelper;

#endif
@@ -227,9 +227,6 @@ void CEmpire::Place()

m_pBuilding[0] = pEmpireBuilding;

// Additional models
CBuilding pAdditionalBuilding[2];

// TODO: Damaged check
for ( int i = 0; i < 2; i++ )
{
@@ -8,6 +8,7 @@
#include "Audio.h"
#include "GroupedBuildings.h"
#include "TxdStore.h"
#include "Object.h"

tFileLoaderList_IMG* CFileLoader::m_pImagesList;
tFileLoaderList* CFileLoader::m_pObjectsList;
@@ -21,12 +22,15 @@ char CFileLoader::m_cParticlesPath[64] = "MODELS\\PARTICLE.TXD";
char CFileLoader::m_cPedgrpPath[64] = "DATA\\PEDGRP.DAT";
char CFileLoader::m_cPopcyclePath[64] = "DATA\\POPCYCLE.DAT";
char CFileLoader::m_cTimecycPath[64] = "DATA\\TIMECYC.DAT";
char CFileLoader::m_cFrontendPath[64] = "\0";
char CFileLoader::m_cFrontendPath[64] = "";
char CFileLoader::m_cP2dfxPath[64];

unsigned char CFileLoader::m_bCurrentEncryptionType;

// Wrappers
WRAPPER void CFileMgr::SetDirMyDocuments() { EAXJMP(0x538860); }
WRAPPER void CFileMgr::SetDir(const char* pDir) { WRAPARG(pDir); EAXJMP(0x5387D0); }

WRAPPER void CFileLoader::LoadObjectTypes(const char* pFileName) { WRAPARG(pFileName); EAXJMP(0x5B8400); }
WRAPPER void CFileLoader::LoadScene(const char* pFileName) { WRAPARG(pFileName); EAXJMP(0x5B8700); }
WRAPPER void CFileLoader::LoadCollisionFile(const char* pFileName, unsigned char bUnk) { WRAPARG(pFileName); WRAPARG(bUnk); EAXJMP(0x5B4E60); }
@@ -35,7 +39,16 @@ WRAPPER void CFileLoader::LoadCollisionFile(const char* pFileName, unsigned char
static WRAPPER void InitPostIDEStuff() { EAXJMP(0x5B924E); }
static WRAPPER void InitPostLoadLevelStuff() { EAXJMP(0x5B930F); }

static WRAPPER void SetAtomicModelInfoFlags(CAtomicModelInfo* pInfo, unsigned int dwFlags) { WRAPARG(pInfo); WRAPARG(dwFlags); EAXJMP(0x5B3B20); }
void SetAtomicModelInfoFlags(CAtomicModelInfo* pInfo, unsigned int dwFlags)
{
((void(*)(CAtomicModelInfo*,unsigned int))0x5B3B20)(pInfo, dwFlags);

// VCS PC flags

// Project realtime shadow?
if ( dwFlags & 0x40000 )
pInfo->SetCastShadowFlag();
}

std::string CFileLoader::TranslatePath(const char* pFileName, const char* pDLCName)
{
@@ -307,6 +320,7 @@ void CFileLoader::LoadLevels()
}

// Pre-IPL stuff
MatchAllModelStrings();
InitModelIndices();

// Wraps some calls
@@ -402,4 +416,9 @@ bool CFileLoader::ParseLevelFile(const char* pFileName, char* pDLCName)
return true;
}
return false;
}
}


static StaticPatcher Patcher([](){
Memory::InjectHook(0x5B3F7B, SetAtomicModelInfoFlags);
});
@@ -15,10 +15,13 @@ class CFileMgr
{ return fgets(str, num, stream) != nullptr; }
static inline size_t Read(FILE* stream, void* buf, size_t len)
{ return fread(buf, 1, len, stream); }
static inline size_t Write(FILE* stream, const char* ptr, size_t len)
static inline size_t Write(FILE* stream, const void* ptr, size_t len)
{ return fwrite(ptr, 1, len, stream); }
static inline bool Seek(FILE* stream, long pos, int from)
{ return fseek(stream, pos, from) != 0; }

static void SetDirMyDocuments();
static void SetDir(const char* pDir);
};

// Now uses multiple lists
@@ -26,6 +26,7 @@ WRAPPER void CFont::SetOrientation(unsigned char bOrientation) { WRAPARG(bOrient
WRAPPER void CFont::PrintString(float posX, float posY, const char* pText) { WRAPARG(posX); WRAPARG(posY); WRAPARG(pText); EAXJMP(0x71A700); }
WRAPPER void CFont::PrintStringFromBottom(float posX, float posY, const char* pText) { WRAPARG(posX); WRAPARG(posY); WRAPARG(pText); EAXJMP(0x71A820); }
WRAPPER void CFont::InitPerFrame() { EAXJMP(0x719800); }
WRAPPER int CFont::GetNumberLines(float, float, const char* pText) { WRAPARG(pText); EAXJMP(0x71A5E0); }

unsigned char CFont::FindSubFontCharacter(char character, unsigned char bFontType)
{
@@ -95,6 +95,7 @@ class CFont
static void PrintStringFromBottom(float posX, float posY, const char* pText);
static void SetWrapx(float fWrap);
static void InitPerFrame();
static int GetNumberLines(float, float, const char* pText);

static void Initialise();
static void Shutdown();

0 comments on commit 942a20f

Please sign in to comment.