Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge branch 'master' of tohjo.ez.lv:vcspc/vcspc
- Loading branch information
There are no files selected for viewing
|
|
@@ -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(); |
|
|
|
Oops, something went wrong.