Added title flyby; Added scripted audio tracks;

This commit is contained in:
MontyTRC89 2019-05-31 21:45:13 +02:00
parent 1eb5c6a0d3
commit c89f89f607
27 changed files with 1790 additions and 285 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -30,15 +30,16 @@ PlayAnyLevel= ENABLED
FlyCheat= ENABLED FlyCheat= ENABLED
Diagnostic= ENABLED Diagnostic= ENABLED
WorldFarView= 200 WorldFarView= 200
Intro= SCREENS\MAIN.PNG
;-------------------------------------- ;--------------------------------------
; Title ; Title
;-------------------------------------- ;--------------------------------------
[Title] [Title]
LoadScreen= SCREENS\TITLE.PNG Background= SCREENS\TITLE.PNG
LevelFile= DATA\TITLE.TRC LevelFile= DATA\TITLE.TRC
AmbientTrack= 104 AmbientTrack= 83
;-------------------------------------- ;--------------------------------------
; Levels ; Levels

136
Build/Script/Tracks.txt Normal file
View file

@ -0,0 +1,136 @@
xa1_TL_10B.wav
xa1_Z10.wav
xa1_TL_05.wav
xa1_TL_08.wav
xa1_TL_11.wav
xa1_ANDYPEW.wav
xa1_SECRET.wav
xa1_TL_02.wav
xa2_HMMM05.wav
xa2_TL_01.wav
xa2_ATTACK04.wav
xa2_UWATER2B.wav
xa2_SPOOKY2A.wav
xa2_TL_10A.wav
xa2_HMMM02.wav
xa2_TOMS01.wav
xa3_Attack03.wav
xa3_Attack02.wav
xa3_Hmmm01.wav
xa3_Stealth1.wav
xa3_Stealth2.wav
xa3_Attack01.wav
xa3_TL_06.wav
xa3_TL_03.wav
xa4_hmmm06.wav
xa4_mil01.wav
xa4_Z_03.wav
xa4_hit01.wav
xa4_spooky05.wav
xa4_drama01.wav
xa4_stealth4.wav
xa4_mil05.wav
xa5_HMMM04.wav
xa5_MIL06.wav
xa5_SPOOKY02.wav
xa5_TL_12.wav
xa5_MIL02A.wav
xa5_HMMM03.wav
xa5_MIL02.wav
xa5_TL_04.wav
xa6_Mil04.wav
xa6_Solo01.wav
xa6_Z12.wav
xa6_Stealth3.wav
xa6_AuthSolo.wav
xa6_Spooky03.wav
xa6_Z13.wav
xa6_Z_04anim.wav
xa7_z_06a.wav
xa7_andyoooh.wav
xa7_andyooer.wav
xa7_tl_07.wav
xa7_z_02.wav
xa7_evibes01.wav
xa7_z_06.wav
xa7_authtr.wav
xa8_mil03.wav
xa8_fightsc.wav
xa8_richcut3.wav
xa8_z_13.wav
xa8_z_08.wav
xa8_uwater2a.wav
xa8_jobyalrm.wav
xa8_mil02b.wav
xa9_swampy.wav
xa9_evibes02.wav
xa9_gods01.wav
xa9_z_03.wav
xa9_richcut4.wav
xa9_title4.wav
xa9_spooky01.wav
xa9_chopin01.wav
xa10_echoir01.wav
xa10_title3.wav
xa10_perc01.wav
xa10_vc01.wav
xa10_title2.wav
xa10_z_09.wav
xa10_spooky04.wav
xa10_z_10.wav
xa11_vc01atv.wav
xa11_andy3.wav
xa11_title1.wav
xa11_flyby1.wav
xa11_monk_2.wav
xa11_andy4.wav
xa11_flyby3.wav
xa11_flyby2.wav
xa12_moses01.wav
xa12_andy4b.wav
xa12_z_10.wav
xa12_flyby4.wav
xa12_richcut1.wav
xa12_andy5.wav
xa12_z_05.wav
xa12_z_01.wav
xa13_Joby3.wav
xa13_Andy7.wav
xa13_Andrea3B.wav
xa13_cossack.wav
xa13_Z_07.wav
xa13_Andy6.wav
xa13_Andrea3.wav
xa13_Joby7.wav
xa14_uwater1.wav
xa14_joby1.wav
xa14_andy10.wav
xa14_richcut2.wav
xa14_andrea1.wav
xa14_andy8.wav
xa14_joby6.wav
xa14_ecredits.wav
xa15_boss_01.wav
xa15_joby2.wav
xa15_joby4.wav
xa15_joby5.wav
xa15_joby9.wav
xa15_a_andy.wav
xa15_a_rome.wav
xa15_andy2.wav
xa16_Joby8.wav
xa16_A_Sub_Amb.wav
xa16_Joby10.wav
xa16_A_Harbour_out.wav
xa16_A_Andy_Out_Norm.wav
xa16_A_Andy_Out_Spooky.wav
xa16_A_Rome_Day.wav
xa16_A_Underwater.wav
xa17_A_Rome_Night.wav
xa17_A_VC_Saga.wav
xa17_A_Industry.wav
xa17_Andrea2.wav
xa17_Andy1.wav
xa17_Andrea4.wav
xa17_Andy9.wav
xa17_Andy11.wav

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

BIN
Build/savegame.6 Normal file

Binary file not shown.

View file

@ -4,7 +4,7 @@
#include <stdio.h> #include <stdio.h>
#include "draw.h" #include "draw.h"
void __cdecl phd_LookAt(__int32 posX, __int32 posY, __int32 posZ, void __cdecl LookAt(__int32 posX, __int32 posY, __int32 posZ,
__int32 targetX, __int32 targetY, __int32 targetZ, __int32 targetX, __int32 targetY, __int32 targetZ,
__int16 roll) __int16 roll)
{ {
@ -12,11 +12,12 @@ void __cdecl phd_LookAt(__int32 posX, __int32 posY, __int32 posZ,
Vector3 target = Vector3(targetX, targetY, targetZ); Vector3 target = Vector3(targetX, targetY, targetZ);
Vector3 up = Vector3(0.0f, -1.0f, 0.0f); Vector3 up = Vector3(0.0f, -1.0f, 0.0f);
float fov = TR_ANGLE_TO_RAD(CurrentFOV); float fov = TR_ANGLE_TO_RAD(CurrentFOV);
float r = TR_ANGLE_TO_RAD(roll);
g_Renderer->UpdateCameraMatrices(posX, posY, posZ, targetX, targetY, targetZ, roll, fov); g_Renderer->UpdateCameraMatrices(posX, posY, posZ, targetX, targetY, targetZ, r, fov);
} }
void __cdecl phd_AlterFOV(__int32 value) void __cdecl AlterFOV(__int32 value)
{ {
CurrentFOV = value; CurrentFOV = value;
PhdPerspective = PhdWidth / 2 * COS(CurrentFOV / 2) / SIN(CurrentFOV / 2); PhdPerspective = PhdWidth / 2 * COS(CurrentFOV / 2) / SIN(CurrentFOV / 2);
@ -24,13 +25,12 @@ void __cdecl phd_AlterFOV(__int32 value)
void __cdecl j_CalculateCamera() void __cdecl j_CalculateCamera()
{ {
//printf("Item: %d\n", Camera.target);
CalculateCamera(); CalculateCamera();
} }
void Inject_Camera() void Inject_Camera()
{ {
INJECT(0x0048EDC0, phd_AlterFOV); INJECT(0x0048EDC0, AlterFOV);
INJECT(0x0048F760, phd_LookAt); INJECT(0x0048F760, LookAt);
INJECT(0x00401D5C, j_CalculateCamera); INJECT(0x00401D5C, j_CalculateCamera);
} }

View file

@ -11,10 +11,10 @@
#define InitialiseCamera ((void (__cdecl*)()) 0x0040C690) #define InitialiseCamera ((void (__cdecl*)()) 0x0040C690)
#define CalculateCamera ((void (__cdecl*)()) 0x0040ED30) #define CalculateCamera ((void (__cdecl*)()) 0x0040ED30)
void __cdecl phd_LookAt(__int32 posX, __int32 posY, __int32 posZ, void __cdecl LookAt(__int32 posX, __int32 posY, __int32 posZ,
__int32 targetX, __int32 targetY, __int32 targetZ, __int32 targetX, __int32 targetY, __int32 targetZ,
__int16 roll); __int16 roll);
void __cdecl phd_AlterFOV(__int32 value); void __cdecl AlterFOV(__int32 value);
void __cdecl j_CalculateCamera(); void __cdecl j_CalculateCamera();
void Inject_Camera(); void Inject_Camera();

View file

@ -53,11 +53,14 @@ GAME_STATUS __cdecl ControlPhase(__int32 numFrames, __int32 demoMode)
UpdateSky(); UpdateSky();
// Poll the keyboard and update input variables // Poll the keyboard and update input variables
if (CurrentLevel != 0)
{
if (S_UpdateInput() == -1) if (S_UpdateInput() == -1)
return GAME_STATUS_NONE; return GAME_STATUS_NONE;
}
// Has Lara control been disabled? // Has Lara control been disabled?
if (DisableLaraControl) if (DisableLaraControl || CurrentLevel == 0)
{ {
if (CurrentLevel != 0) if (CurrentLevel != 0)
DbInput = 0; DbInput = 0;
@ -87,13 +90,13 @@ GAME_STATUS __cdecl ControlPhase(__int32 numFrames, __int32 demoMode)
} }
// Has level been completed? // Has level been completed?
if (LevelComplete) if (CurrentLevel != 0 && LevelComplete)
return GAME_STATUS_LEVEL_COMPLETED; return GAME_STATUS_LEVEL_COMPLETED;
__int32 oldInput = TrInput; __int32 oldInput = TrInput;
// Is Lara dead? // Is Lara dead?
if (Lara.deathCount > 300 || Lara.deathCount > 60 && TrInput) if (CurrentLevel != 0 && (Lara.deathCount > 300 || Lara.deathCount > 60 && TrInput))
{ {
__int32 inventoryResult = g_Inventory->DoInventory(); __int32 inventoryResult = g_Inventory->DoInventory();
switch (inventoryResult) switch (inventoryResult)
@ -113,7 +116,12 @@ GAME_STATUS __cdecl ControlPhase(__int32 numFrames, __int32 demoMode)
TrInput = 0; TrInput = 0;
} }
if (CurrentLevel == 0)
TrInput = 0;
// Handle lasersight and binocular // Handle lasersight and binocular
if (CurrentLevel != 0)
{
if (!(TrInput & IN_LOOK) || SniperCameraActive || UseSpotCam || TrackCameraInit || if (!(TrInput & IN_LOOK) || SniperCameraActive || UseSpotCam || TrackCameraInit ||
((LaraItem->currentAnimState != STATE_LARA_STOP || LaraItem->animNumber != ANIMATION_LARA_STAY_IDLE) ((LaraItem->currentAnimState != STATE_LARA_STOP || LaraItem->animNumber != ANIMATION_LARA_STAY_IDLE)
&& (!Lara.isDucked && (!Lara.isDucked
@ -132,7 +140,7 @@ GAME_STATUS __cdecl ControlPhase(__int32 numFrames, __int32 demoMode)
{ {
BinocularRange = 0; BinocularRange = 0;
LaserSight = false; LaserSight = false;
phd_AlterFOV(ANGLE(80)); AlterFOV(ANGLE(80));
LaraItem->meshBits = 0xFFFFFFFF; LaraItem->meshBits = 0xFFFFFFFF;
Lara.isDucked = false; Lara.isDucked = false;
Camera.type = BinocularOldCamera; Camera.type = BinocularOldCamera;
@ -197,6 +205,7 @@ GAME_STATUS __cdecl ControlPhase(__int32 numFrames, __int32 demoMode)
Infrared = false; Infrared = false;
} }
} }
}
// Clear dynamic lights // Clear dynamic lights
ClearDynamics(); ClearDynamics();
@ -257,6 +266,8 @@ GAME_STATUS __cdecl ControlPhase(__int32 numFrames, __int32 demoMode)
if (WeaponEnemyTimer) if (WeaponEnemyTimer)
WeaponEnemyTimer--; WeaponEnemyTimer--;
if (CurrentLevel != 0)
{
if (Lara.hasFired) if (Lara.hasFired)
{ {
AlertNearbyGuards(LaraItem); AlertNearbyGuards(LaraItem);
@ -302,10 +313,12 @@ GAME_STATUS __cdecl ControlPhase(__int32 numFrames, __int32 demoMode)
HairControl(0, 0, 0); HairControl(0, 0, 0);
if (level->LaraType == LARA_YOUNG) if (level->LaraType == LARA_YOUNG)
HairControl(0, 1, 0); HairControl(0, 1, 0);
}
if (UseSpotCam) if (UseSpotCam)
{ {
// Draw flyby cameras // Draw flyby cameras
if (CurrentLevel != 0)
g_Renderer->EnableCinematicBars(true); g_Renderer->EnableCinematicBars(true);
CalculateSpotCameras(); CalculateSpotCameras();
} }
@ -313,6 +326,7 @@ GAME_STATUS __cdecl ControlPhase(__int32 numFrames, __int32 demoMode)
{ {
// Do the standard camera // Do the standard camera
g_Renderer->EnableCinematicBars(false); g_Renderer->EnableCinematicBars(false);
TrackCameraInit = false;
CalculateCamera(); CalculateCamera();
} }
@ -411,11 +425,63 @@ GAME_STATUS __cdecl DoTitle(__int32 index)
DB_Log(2, "DoTitle - DLL"); DB_Log(2, "DoTitle - DLL");
printf("DoTitle\n"); printf("DoTitle\n");
// Load the title level CreditsDone = false;
S_LoadLevelFile(0); CanLoad = false;
__int32 inventoryResult = g_Inventory->DoTitleInventory(); // Load the level
S_LoadLevelFile(index);
__int32 inventoryResult;
if (g_GameFlow->TitleType == TITLE_FLYBY)
{
// Initialise items, effects, lots, camera
InitialiseFXArray(true);
InitialisePickUpDisplay();
InitialiseCamera();
SOUND_Stop();
RequiredStartPos = false;
if (InitialiseGame)
{
GameTimer = 0;
RequiredStartPos = false;
InitialiseGame = false;
}
Savegame.Level.Timer = 0;
if (CurrentLevel == 1)
Savegame.TLCount = 0;
LastInventoryItem = -1;
DelCutSeqPlayer = 0;
TitleControlsLockedOut = false;
GameMode = 1;
// Initialise flyby cameras
InitSpotCamSequences();
InitialiseSpotCam(2);
CurrentAtmosphere = 83;
UseSpotCam = true;
// Play background music
//CurrentAtmosphere = ambient;
S_CDPlay(CurrentAtmosphere, 1);
IsAtmospherePlaying = true;
// Initialise ponytails
InitialiseHair();
ControlPhase(2, 0);
inventoryResult = g_Inventory->DoTitleInventory();
}
else
{
inventoryResult = g_Inventory->DoTitleInventory();
}
UseSpotCam = false;
S_CDStop(); S_CDStop();
switch (inventoryResult) switch (inventoryResult)
@ -505,7 +571,7 @@ GAME_STATUS __cdecl DoLevel(__int32 index, __int32 ambient, bool loadFromSavegam
while (true) while (true)
{ {
nframes = DrawPhaseGame(); nframes = DrawPhaseGame();
result = ControlPhase(nframes, 0); result = ControlPhase(nframes, 0); printf("LastSpotCam: %d\n", LastSpotCam);
if (result == GAME_STATUS_EXIT_TO_TITLE || if (result == GAME_STATUS_EXIT_TO_TITLE ||
result == GAME_STATUS_LOAD_GAME || result == GAME_STATUS_LOAD_GAME ||
@ -910,7 +976,7 @@ void __cdecl TestTriggers(__int16* data, __int32 heavy, __int32 HeavyFlags)
else else
{ {
spotCamIndex = 0; spotCamIndex = 0;
if (SpotCamRemap[value] > 0) if (SpotCamRemap[value] != 0)
{ {
for (__int32 i = 0; i < SpotCamRemap[value]; i++) for (__int32 i = 0; i < SpotCamRemap[value]; i++)
{ {
@ -918,17 +984,17 @@ void __cdecl TestTriggers(__int16* data, __int32 heavy, __int32 HeavyFlags)
} }
} }
if (!(SpotCam[spotCamIndex].flags & 0x8000)) if (!(SpotCam[spotCamIndex].flags & SCF_CAMERA_ONE_SHOT))
{ {
if (trigger & 0x100) if (trigger & 0x100)
SpotCam[spotCamIndex].flags |= 0x8000; SpotCam[spotCamIndex].flags |= SCF_CAMERA_ONE_SHOT;
if (!UseSpotCam) if (!UseSpotCam || CurrentLevel == 0)
{ {
UseSpotCam = true; UseSpotCam = true;
if (LastSpotCam != value) if (LastSpotCam != value)
TrackCameraInit = false; TrackCameraInit = false;
InitialiseSpotCameras(value); InitialiseSpotCam(value);
} }
} }
} }
@ -1085,7 +1151,16 @@ void __cdecl AnimateWaterfalls()
} }
} }
void __cdecl TestTriggersAtXYZ(__int32 x, __int32 y, __int32 z, __int16 roomNumber, __int16 heavy, __int16 heavyFlags)
{
FLOOR_INFO* floor = GetFloor(x, y, z, &roomNumber);
GetFloorHeight(floor, x, y, z);
TestTriggers(TriggerIndex, heavy, heavyFlags);
}
void Inject_Control() void Inject_Control()
{ {
INJECT(0x00416760, TestTriggers);
INJECT(0x004167B0, TestTriggers);
INJECT(0x0047D9D0, TestTriggersAtXYZ);
} }

View file

@ -42,6 +42,7 @@
#define AlterFloorHeight ((void (__cdecl*)(ITEM_INFO*, __int32)) 0x004159F0) #define AlterFloorHeight ((void (__cdecl*)(ITEM_INFO*, __int32)) 0x004159F0)
#define SoundEffects ((void (__cdecl*)()) 0x00432640) #define SoundEffects ((void (__cdecl*)()) 0x00432640)
//#define AnimateWaterfalls ((void (__cdecl*)()) 0x00465DF0) //#define AnimateWaterfalls ((void (__cdecl*)()) 0x00465DF0)
//#define TestTriggersAtXYZ ((void (__cdecl*)(__int32, __int32, __int32, __int16, __int32, __int32)) 0x0047D9D0)
GAME_STATUS __cdecl DoTitle(__int32 index); GAME_STATUS __cdecl DoTitle(__int32 index);
GAME_STATUS __cdecl DoLevel(__int32 index, __int32 ambient, bool loadFromSavegame); GAME_STATUS __cdecl DoLevel(__int32 index, __int32 ambient, bool loadFromSavegame);
@ -51,5 +52,5 @@ void __cdecl AnimateWaterfalls();
unsigned __stdcall GameMain(void*); unsigned __stdcall GameMain(void*);
void __cdecl TestTriggers(__int16* data, __int32 heavy, __int32 HeavyFlags); void __cdecl TestTriggers(__int16* data, __int32 heavy, __int32 HeavyFlags);
void __cdecl TestTriggersAtXYZ(__int32 x, __int32 y, __int32 z, __int16 roomNumber, __int16 heavy, __int16 heavyFlags);
void Inject_Control(); void Inject_Control();

View file

@ -13,42 +13,13 @@ __int32 __cdecl DrawPhaseGame()
// Calls my new rock & roll renderer :) // Calls my new rock & roll renderer :)
g_Renderer->Draw(); g_Renderer->Draw();
nFrames = g_Renderer->SyncRenderer(); Camera.numberFrames = g_Renderer->SyncRenderer();
// We need to pop the matrix stack or the game will crash // We need to pop the matrix stack or the game will crash
MatrixPtr -= 12; MatrixPtr -= 12;
DxMatrixPtr -= 48; DxMatrixPtr -= 48;
return nFrames; return Camera.numberFrames;
}
__int32 DrawGame()
{
// Control routines uses joints calculated here for getting Lara joint positions
CalcLaraMatrices(0);
phd_PushUnitMatrix();
CalcLaraMatrices(1);
// Calls my new rock & roll renderer :)
g_Renderer->Draw();
nFrames = g_Renderer->SyncRenderer();
// We need to pop the matrix stack or the game will crash
MatrixPtr -= 12;
DxMatrixPtr -= 48;
return nFrames;
}
__int32 DrawInventory()
{
return g_Renderer->DrawInventory();
}
void __cdecl DoBootScreen(__int32 language)
{
//printf("DoBootScreen\n");
//DrawFullScreenImage((char*)"load.bmp");
} }
__int32 __cdecl GetFrame_D2(ITEM_INFO* item, __int16* framePtr[], __int32* rate) __int32 __cdecl GetFrame_D2(ITEM_INFO* item, __int16* framePtr[], __int32* rate)
@ -79,5 +50,5 @@ __int32 __cdecl GetFrame_D2(ITEM_INFO* item, __int16* framePtr[], __int32* rate)
void Inject_Draw() void Inject_Draw()
{ {
INJECT(0x004B8A80, DoBootScreen);
} }

View file

@ -5,19 +5,15 @@
#define DrawAnimatingItem ((void (__cdecl*)(ITEM_INFO*)) 0x0042B900) #define DrawAnimatingItem ((void (__cdecl*)(ITEM_INFO*)) 0x0042B900)
#define GetBoundsAccurate ((short* (__cdecl*)(ITEM_INFO*)) 0x0042CF80) #define GetBoundsAccurate ((short* (__cdecl*)(ITEM_INFO*)) 0x0042CF80)
#define GetBestFrame ((short* (__cdecl*)(ITEM_INFO*)) 0x0042D020) #define GetBestFrame ((short* (__cdecl*)(ITEM_INFO*)) 0x0042D020)
//#define GetFrame_D2 ((__int32 (__cdecl*)(ITEM_INFO*, __int16**, __int32*)) 0x0042CEB0)
#define CalcLaraMatrices ((void (__cdecl*)(__int32)) 0x0041E120) #define CalcLaraMatrices ((void (__cdecl*)(__int32)) 0x0041E120)
#define phd_PushUnitMatrix ((void (__cdecl*)()) 0x0048FA90) #define phd_PushUnitMatrix ((void (__cdecl*)()) 0x0048FA90)
#define Sync ((__int32 (__cdecl*)()) 0x004D1A40) #define Sync ((__int32 (__cdecl*)()) 0x004D1A40)
#define GetRoomBounds ((void (__cdecl*)()) 0x0042D4F0) #define GetRoomBounds ((void (__cdecl*)()) 0x0042D4F0)
#define UpdateStorm ((void (__cdecl*)()) 0x0042A310) #define UpdateStorm ((void (__cdecl*)()) 0x0042A310)
#define Sub_0042A050 ((void (__cdecl*)()) 0x0042A050) #define Sub_0042A050 ((void (__cdecl*)()) 0x0042A050)
#define IsRoomOutside ((__int32 (__cdecl*)(__int32, __int32, __int32)) 0x0044C050) #define IsRoomOutside ((__int32 (__cdecl*)(__int32, __int32, __int32)) 0x00418E90)
__int32 __cdecl DrawPhaseGame(); __int32 __cdecl DrawPhaseGame();
__int32 DrawGame();
__int32 DrawInventory();
void __cdecl DoBootScreen(__int32 language);
__int32 __cdecl GetFrame_D2(ITEM_INFO* item, __int16* framePtr[], __int32* rate); __int32 __cdecl GetFrame_D2(ITEM_INFO* item, __int16* framePtr[], __int32* rate);
extern Renderer11* g_Renderer; extern Renderer11* g_Renderer;

View file

@ -854,8 +854,7 @@ __int32 Inventory::DoInventory()
{ {
m_rings[m_activeRing].rotation += deltaAngle; m_rings[m_activeRing].rotation += deltaAngle;
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
if (m_rings[m_activeRing].currentObject == m_rings[m_activeRing].numObjects - 1) if (m_rings[m_activeRing].currentObject == m_rings[m_activeRing].numObjects - 1)
@ -878,8 +877,7 @@ __int32 Inventory::DoInventory()
{ {
m_rings[m_activeRing].rotation -= deltaAngle; m_rings[m_activeRing].rotation -= deltaAngle;
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
if (m_rings[m_activeRing].currentObject == 0) if (m_rings[m_activeRing].currentObject == 0)
@ -906,8 +904,7 @@ __int32 Inventory::DoInventory()
g_Renderer->FadeOut(); g_Renderer->FadeOut();
for (__int32 i = 0; i < FADE_FRAMES_COUNT; i++) for (__int32 i = 0; i < FADE_FRAMES_COUNT; i++)
{ {
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
return passportResult; return passportResult;
@ -959,8 +956,7 @@ __int32 Inventory::DoInventory()
} }
} }
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
CloseRing(m_activeRing, true); CloseRing(m_activeRing, true);
@ -1090,8 +1086,7 @@ __int32 Inventory::DoWeapon()
} }
} }
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
PopoverObject(); PopoverObject();
@ -1241,8 +1236,7 @@ bool Inventory::DoCombine()
{ {
combineRing->rotation += deltaAngle; combineRing->rotation += deltaAngle;
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
if (combineRing->currentObject > 0) if (combineRing->currentObject > 0)
@ -1264,8 +1258,7 @@ bool Inventory::DoCombine()
{ {
combineRing->rotation -= deltaAngle; combineRing->rotation -= deltaAngle;
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
SoundEffect(SFX_MENU_ROTATE, NULL, 0); SoundEffect(SFX_MENU_ROTATE, NULL, 0);
@ -1303,8 +1296,7 @@ bool Inventory::DoCombine()
SayNo(); SayNo();
} }
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
CloseRing(INV_RING_COMBINE, false); CloseRing(INV_RING_COMBINE, false);
@ -1423,8 +1415,7 @@ void Inventory::DoSelectAmmo()
{ {
ammoRing->rotation += deltaAngle; ammoRing->rotation += deltaAngle;
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
if (ammoRing->currentObject > 0) if (ammoRing->currentObject > 0)
@ -1446,8 +1437,7 @@ void Inventory::DoSelectAmmo()
{ {
ammoRing->rotation -= deltaAngle; ammoRing->rotation -= deltaAngle;
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
SoundEffect(SFX_MENU_ROTATE, NULL, 0); SoundEffect(SFX_MENU_ROTATE, NULL, 0);
@ -1484,8 +1474,7 @@ void Inventory::DoSelectAmmo()
break; break;
} }
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
CloseRing(INV_RING_CHOOSE_AMMO, false); CloseRing(INV_RING_CHOOSE_AMMO, false);
@ -1856,6 +1845,38 @@ void Inventory::InitialiseTitle()
InventoryItemChosen = -1; InventoryItemChosen = -1;
} }
bool Inventory::UpdateSceneAndDrawInventory()
{
__int32 nframes;
if (CurrentLevel == 0 && g_GameFlow->TitleType == TITLE_FLYBY)
{
// Control routines uses joints calculated here for getting Lara joint positions
CalcLaraMatrices(0);
phd_PushUnitMatrix();
CalcLaraMatrices(1);
// Calls my new rock & roll renderer :)
g_Renderer->DumpGameScene();
g_Renderer->DrawInventory();
Camera.numberFrames = g_Renderer->SyncRenderer();
// We need to pop the matrix stack or the game will crash
MatrixPtr -= 12;
DxMatrixPtr -= 48;
nframes = Camera.numberFrames;
ControlPhase(nframes, 0);
}
else
{
g_Renderer->DrawInventory();
g_Renderer->SyncRenderer();
}
return true;
}
__int32 Inventory::DoTitleInventory() __int32 Inventory::DoTitleInventory()
{ {
InitialiseTitle(); InitialiseTitle();
@ -1871,8 +1892,7 @@ __int32 Inventory::DoTitleInventory()
g_Renderer->FadeIn(); g_Renderer->FadeIn();
for (__int32 i = 0; i < FADE_FRAMES_COUNT; i++) for (__int32 i = 0; i < FADE_FRAMES_COUNT; i++)
{ {
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
CurrentAtmosphere = CDA_XA11_FLYBY1; CurrentAtmosphere = CDA_XA11_FLYBY1;
@ -1904,8 +1924,7 @@ __int32 Inventory::DoTitleInventory()
{ {
ring->rotation += deltaAngle; ring->rotation += deltaAngle;
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
if (ring->currentObject == ring->numObjects - 1) if (ring->currentObject == ring->numObjects - 1)
@ -1927,8 +1946,7 @@ __int32 Inventory::DoTitleInventory()
{ {
ring->rotation -= deltaAngle; ring->rotation -= deltaAngle;
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
if (ring->currentObject == 0) if (ring->currentObject == 0)
@ -1964,8 +1982,7 @@ __int32 Inventory::DoTitleInventory()
DoSoundSettings(); DoSoundSettings();
} }
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
CloseRing(INV_RING_OPTIONS, true); CloseRing(INV_RING_OPTIONS, true);
@ -1974,8 +1991,7 @@ __int32 Inventory::DoTitleInventory()
g_Renderer->FadeOut(); g_Renderer->FadeOut();
for (__int32 i = 0; i < FADE_FRAMES_COUNT; i++) for (__int32 i = 0; i < FADE_FRAMES_COUNT; i++)
{ {
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
return result; return result;
@ -2017,8 +2033,7 @@ __int32 Inventory::DoPassport()
// Open the passport // Open the passport
for (__int32 i = 0; i < 14; i++) for (__int32 i = 0; i < 14; i++)
{ {
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
ring->frameIndex++; ring->frameIndex++;
} }
@ -2058,8 +2073,7 @@ __int32 Inventory::DoPassport()
ring->frameIndex = 19; ring->frameIndex = 19;
for (__int32 i = 0; i < 5; i++) for (__int32 i = 0; i < 5; i++)
{ {
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
ring->frameIndex--; ring->frameIndex--;
} }
@ -2077,8 +2091,7 @@ __int32 Inventory::DoPassport()
ring->frameIndex = 14; ring->frameIndex = 14;
for (__int32 i = 0; i < 5; i++) for (__int32 i = 0; i < 5; i++)
{ {
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
ring->frameIndex++; ring->frameIndex++;
} }
@ -2155,8 +2168,7 @@ __int32 Inventory::DoPassport()
LoadSavegameInfos(); LoadSavegameInfos();
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
} }
else if (choices[choice] == INV_WHAT_PASSPORT_SAVE_GAME) else if (choices[choice] == INV_WHAT_PASSPORT_SAVE_GAME)
@ -2231,8 +2243,7 @@ __int32 Inventory::DoPassport()
LoadSavegameInfos(); LoadSavegameInfos();
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
} }
else if (choices[choice] == INV_WHAT_PASSPORT_SELECT_LEVEL) else if (choices[choice] == INV_WHAT_PASSPORT_SELECT_LEVEL)
@ -2302,8 +2313,7 @@ __int32 Inventory::DoPassport()
ring->selectedIndex = selectedLevel; ring->selectedIndex = selectedLevel;
ring->passportAction = INV_WHAT_PASSPORT_SELECT_LEVEL; ring->passportAction = INV_WHAT_PASSPORT_SELECT_LEVEL;
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
} }
else if (choices[choice] == INV_WHAT_PASSPORT_NEW_GAME) else if (choices[choice] == INV_WHAT_PASSPORT_NEW_GAME)
@ -2357,8 +2367,7 @@ __int32 Inventory::DoPassport()
ring->passportAction = INV_WHAT_PASSPORT_NEW_GAME; ring->passportAction = INV_WHAT_PASSPORT_NEW_GAME;
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
} }
else if (choices[choice] == INV_WHAT_PASSPORT_EXIT_GAME) else if (choices[choice] == INV_WHAT_PASSPORT_EXIT_GAME)
@ -2412,8 +2421,7 @@ __int32 Inventory::DoPassport()
ring->passportAction = INV_WHAT_PASSPORT_EXIT_GAME; ring->passportAction = INV_WHAT_PASSPORT_EXIT_GAME;
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
} }
else if (choices[choice] == INV_WHAT_PASSPORT_EXIT_TO_TITLE) else if (choices[choice] == INV_WHAT_PASSPORT_EXIT_TO_TITLE)
@ -2467,14 +2475,12 @@ __int32 Inventory::DoPassport()
ring->passportAction = INV_WHAT_PASSPORT_EXIT_TO_TITLE; ring->passportAction = INV_WHAT_PASSPORT_EXIT_TO_TITLE;
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
} }
else else
{ {
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
} }
@ -2482,8 +2488,7 @@ __int32 Inventory::DoPassport()
ring->frameIndex = 24; ring->frameIndex = 24;
for (__int32 i = 24; i < 30; i++) for (__int32 i = 24; i < 30; i++)
{ {
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
ring->frameIndex++; ring->frameIndex++;
} }
@ -2508,8 +2513,7 @@ __int32 Inventory::PopupObject()
for (__int32 i = 0; i < steps; i++) for (__int32 i = 0; i < steps; i++)
{ {
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
ring->objects[ring->currentObject].rotation += deltaAngle; ring->objects[ring->currentObject].rotation += deltaAngle;
ring->objects[ring->currentObject].scale += deltaScale; ring->objects[ring->currentObject].scale += deltaScale;
@ -2534,8 +2538,7 @@ __int32 Inventory::PopoverObject()
for (__int32 i = 0; i < steps; i++) for (__int32 i = 0; i < steps; i++)
{ {
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
ring->objects[ring->currentObject].rotation -= deltaAngle; ring->objects[ring->currentObject].rotation -= deltaAngle;
ring->objects[ring->currentObject].scale -= deltaScale; ring->objects[ring->currentObject].scale -= deltaScale;
@ -2620,8 +2623,7 @@ void Inventory::DoControlsSettings()
} }
else else
{ {
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
continue; continue;
} }
@ -2674,8 +2676,7 @@ void Inventory::DoControlsSettings()
} }
} }
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
SetDebounce = true; SetDebounce = true;
S_UpdateInput(); S_UpdateInput();
@ -2684,8 +2685,7 @@ void Inventory::DoControlsSettings()
} }
} }
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
PopoverObject(); PopoverObject();
@ -2853,8 +2853,7 @@ void Inventory::DoGraphicsSettings()
} }
} }
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
PopoverObject(); PopoverObject();
@ -2871,13 +2870,6 @@ void Inventory::DoSoundSettings()
// Copy configuration to a temporary object // Copy configuration to a temporary object
memcpy(&ring->Configuration, &g_Configuration, sizeof(GameConfiguration)); memcpy(&ring->Configuration, &g_Configuration, sizeof(GameConfiguration));
// Open the passport
for (__int32 i = 0; i < 14; i++)
{
g_Renderer->DrawInventory();
g_Renderer->SyncRenderer();
}
bool closeObject = false; bool closeObject = false;
__int32 oldVolume = ring->Configuration.MusicVolume; __int32 oldVolume = ring->Configuration.MusicVolume;
__int32 oldSfxVolume = ring->Configuration.SfxVolume; __int32 oldSfxVolume = ring->Configuration.SfxVolume;
@ -3030,8 +3022,7 @@ void Inventory::DoSoundSettings()
} }
} }
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
PopoverObject(); PopoverObject();
@ -3078,8 +3069,7 @@ void Inventory::OpenRing(__int32 r, bool animateCamera)
m_cameraTilt -= deltaTilt; m_cameraTilt -= deltaTilt;
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
m_cameraTilt = INV_CAMERA_TILT; m_cameraTilt = INV_CAMERA_TILT;
@ -3113,8 +3103,7 @@ void Inventory::CloseRing(__int32 r, bool animateCamera)
m_cameraTilt += deltaTilt; m_cameraTilt += deltaTilt;
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
m_cameraTilt = (animateCamera ? INV_CAMERA_ANIMATION_TILT : INV_CAMERA_TILT); m_cameraTilt = (animateCamera ? INV_CAMERA_ANIMATION_TILT : INV_CAMERA_TILT);
@ -3160,8 +3149,7 @@ void Inventory::SwitchRing(__int32 from, __int32 to, float verticalShift)
ring2->draw = true; ring2->draw = true;
} }
g_Renderer->DrawInventory(); UpdateSceneAndDrawInventory();
g_Renderer->SyncRenderer();
} }
ring1->distance = 0; ring1->distance = 0;

View file

@ -375,6 +375,7 @@ public:
float GetCameraY(); float GetCameraY();
float GetCameraTilt(); float GetCameraTilt();
bool HasWeaponMultipleAmmos(__int16 object); bool HasWeaponMultipleAmmos(__int16 object);
bool UpdateSceneAndDrawInventory();
}; };
extern Inventory* g_Inventory; extern Inventory* g_Inventory;

View file

@ -7,6 +7,7 @@
#include "..\Game\lot.h" #include "..\Game\lot.h"
#include "..\Game\laramisc.h" #include "..\Game\laramisc.h"
#include "..\Objects\newobjects.h" #include "..\Objects\newobjects.h"
#include "..\Game\sound.h"
FileStream* SaveGame::m_stream; FileStream* SaveGame::m_stream;
ChunkReader* SaveGame::m_reader; ChunkReader* SaveGame::m_reader;
@ -45,6 +46,8 @@ ChunkId* SaveGame::m_chunkBats;
ChunkId* SaveGame::m_chunkRats; ChunkId* SaveGame::m_chunkRats;
ChunkId* SaveGame::m_chunkSpiders; ChunkId* SaveGame::m_chunkSpiders;
extern vector<AudioTrack> g_AudioTracks;
void SaveGame::saveItems() void SaveGame::saveItems()
{ {
// Save level items // Save level items
@ -171,8 +174,8 @@ void SaveGame::saveGameStatus(__int32 arg1, __int32 arg2)
for (__int32 i = 0; i < NumberSpotcams; i++) for (__int32 i = 0; i < NumberSpotcams; i++)
m_writer->WriteChunk(m_chunkFlybyFlags, &saveFlybyFlags, i, SpotCam[i].flags); m_writer->WriteChunk(m_chunkFlybyFlags, &saveFlybyFlags, i, SpotCam[i].flags);
for (__int32 i = 0; i < 136; i++) for (__int32 i = 0; i < g_AudioTracks.size(); i++)
m_writer->WriteChunk(m_chunkCdFlags, &saveCdFlags, i, CdFlags[i]); m_writer->WriteChunk(m_chunkCdFlags, &saveCdFlags, i, g_AudioTracks[i].Mask);
for (__int32 i = 0; i < NumberCameras; i++) for (__int32 i = 0; i < NumberCameras; i++)
m_writer->WriteChunk(m_chunkCamera, &saveCamera, i, Camera.fixed[i].flags); m_writer->WriteChunk(m_chunkCamera, &saveCamera, i, Camera.fixed[i].flags);
@ -674,7 +677,8 @@ bool SaveGame::readGameStatusChunks(ChunkId* chunkId, __int32 maxSize, __int32 a
__int16 index = LEB128::ReadInt16(m_stream); __int16 index = LEB128::ReadInt16(m_stream);
printf("Index: %d\n", index); printf("Index: %d\n", index);
__int16 value = LEB128::ReadInt16(m_stream); __int16 value = LEB128::ReadInt16(m_stream);
CdFlags[index] = value; if (index < g_AudioTracks.size())
g_AudioTracks[index].Mask = value;
return true; return true;
} }
else if (chunkId->EqualsTo(m_chunkCamera)) else if (chunkId->EqualsTo(m_chunkCamera))

View file

@ -15,6 +15,8 @@ const BASS_BFX_FREEVERB BASS_ReverbTypes[NUM_REVERB_TYPES] = // Reverb preset
{ 1.0f, 0.25f, 0.90f, 1.00f, 1.0f, 0, -1 } // 4 = Pipe { 1.0f, 0.25f, 0.90f, 1.00f, 1.0f, 0, -1 } // 4 = Pipe
}; };
vector<AudioTrack> g_AudioTracks;
bool __cdecl Sound_LoadSample(char *pointer, __int32 compSize, __int32 uncompSize, __int32 index) // Replaces DXCreateSampleADPCM() bool __cdecl Sound_LoadSample(char *pointer, __int32 compSize, __int32 uncompSize, __int32 index) // Replaces DXCreateSampleADPCM()
{ {
if (index >= SOUND_MAX_SAMPLES) if (index >= SOUND_MAX_SAMPLES)
@ -266,7 +268,7 @@ void __cdecl S_CDPlay(short index, unsigned int mode)
DWORD crossfadeTime; DWORD crossfadeTime;
DWORD flags = BASS_STREAM_AUTOFREE | BASS_SAMPLE_FLOAT | BASS_ASYNCFILE; DWORD flags = BASS_STREAM_AUTOFREE | BASS_SAMPLE_FLOAT | BASS_ASYNCFILE;
if (index >= SOUND_LEGACY_TRACKTABLE_SIZE || index < 0) if (index >= g_AudioTracks.size() || index < 0)
return; return;
mode = (mode >= NUM_SOUND_TRACK_TYPES) ? SOUND_TRACK_BGM : mode; mode = (mode >= NUM_SOUND_TRACK_TYPES) ? SOUND_TRACK_BGM : mode;
@ -294,9 +296,9 @@ void __cdecl S_CDPlay(short index, unsigned int mode)
static char fullTrackName[1024]; static char fullTrackName[1024];
char* mask = &TrackNamePrefix; char* mask = &TrackNamePrefix;
char* name = TrackNameTable[index]; char* name = g_AudioTracks[index].Name;
snprintf(fullTrackName, sizeof(fullTrackName), &TrackNamePrefix, TrackNameTable[index]); snprintf(fullTrackName, sizeof(fullTrackName), &TrackNamePrefix, name);
auto stream = BASS_StreamCreateFile(false, fullTrackName, 0, 0, flags); auto stream = BASS_StreamCreateFile(false, fullTrackName, 0, 0, flags);
@ -344,7 +346,7 @@ void __cdecl S_CDPlayEx(short index, DWORD mask, DWORD unknown)
static short loopedTracks[] = { 117, 118, 121, 123, 124, 125, 126, 127, 128, 129, 130 }; static short loopedTracks[] = { 117, 118, 121, 123, 124, 125, 126, 127, 128, 129, 130 };
bool looped = false; bool looped = false;
if (index >= SOUND_LEGACY_TRACKTABLE_SIZE || index < 0) if (index >= g_AudioTracks.size() || index < 0)
return; return;
// Assign looping based on hardcoded track IDs. // Assign looping based on hardcoded track IDs.
@ -362,10 +364,10 @@ void __cdecl S_CDPlayEx(short index, DWORD mask, DWORD unknown)
if (!looped) if (!looped)
{ {
byte filteredMask = (mask >> 8) & 0x3F; byte filteredMask = (mask >> 8) & 0x3F;
if ((TrackMap[index] & filteredMask) == filteredMask) if ((g_AudioTracks[index].Mask & filteredMask) == filteredMask)
return; // Mask is the same, don't play it. return; // Mask is the same, don't play it.
TrackMap[index] |= filteredMask; g_AudioTracks[index].Mask |= filteredMask;
} }
S_CDPlay(index, looped); S_CDPlay(index, looped);

View file

@ -3,6 +3,7 @@
#include <bass.h> #include <bass.h>
#include <bass_fx.h> #include <bass_fx.h>
#include <d3dx9math.h> #include <d3dx9math.h>
#include <vector>
#include "..\Game\control.h" #include "..\Game\control.h"
#include "..\Global\global.h" #include "..\Global\global.h"
@ -664,6 +665,16 @@ enum reverb_type
NUM_REVERB_TYPES NUM_REVERB_TYPES
}; };
struct AudioTrack
{
char* Name;
byte Mask;
};
using namespace std;
extern vector<AudioTrack> g_AudioTracks;
#define SayNo ((void (__cdecl*)()) 0x004790E0) #define SayNo ((void (__cdecl*)()) 0x004790E0)
long __cdecl SoundEffect(__int32 effectID, PHD_3DPOS* position, __int32 env_flags); long __cdecl SoundEffect(__int32 effectID, PHD_3DPOS* position, __int32 env_flags);

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,33 @@
#pragma once #pragma once
#define InitSpotCamSequences ((void (__cdecl*)()) 0x0047A800) enum spotcam_flags
{
SCF_CUT_PAN = (1 << 0), // 0x0001 cut without panning smoothly
SCF_VIGNETTE = (1 << 1), // 0x0002
SCF_LOOP_SEQUENCE = (1 << 2), // 0x0004
SCF_TRACKING_CAM = (1 << 3), // 0x0008
SCF_HIDE_LARA = (1 << 4), // 0x0010
SCF_FOCUS_LARA_HEAD = (1 << 5), // 0x0020
SCF_PAN_TO_LARA_CAM = (1 << 6), // 0x0040
SCF_CUT_TO_CAM = (1 << 7), // 0x0080
SCF_STOP_MOVEMENT = (1 << 8), // 0x0100 stops movement for a given time (cf. `Timer` field)
SCF_DISABLE_BREAKOUT = (1 << 9), // 0x0200 disables breaking out from cutscene using Look key
SCF_DISABLE_LARA_CONTROLS = (1 << 10), // 0x0400 also adds widescreen bars
SCF_REENABLE_LARA_CONTROLS = (1 << 11), // 0x0800 use with 0x0400, keeps widescreen bars
SCF_SCREEN_FADE_IN = (1 << 12), // 0x1000
SCF_SCREEN_FADE_OUT = (1 << 13), // 0x2000
SCF_ACTIVATE_HEAVY_TRIGGERS = (1 << 14), // 0x4000 when camera is moving above heavy trigger sector, it'll be activated
SCF_CAMERA_ONE_SHOT = (1 << 15), // 0x8000
};
//#define InitSpotCamSequences ((void (__cdecl*)()) 0x0047A800)
#define CalculateSpotCameras ((void (__cdecl*)()) 0x0047B280) #define CalculateSpotCameras ((void (__cdecl*)()) 0x0047B280)
#define InitialiseSpotCameras ((void (__cdecl*)(__int16)) 0x0047A9D0) //#define InitialiseSpotCam ((void (__cdecl*)(__int16)) 0x0047A9D0)
#define TriggerTitleSpotcam ((void (__cdecl*)(__int32)) 0x004284A0) #define TriggerTitleSpotcam ((void (__cdecl*)(__int32)) 0x004284A0)
#define Spline ((__int32 (__cdecl*)(__int32, __int32*, __int32)) 0x0047A890)
void __cdecl InitSpotCamSequences();
void __cdecl InitialiseSpotCam(__int16 sequence);
//void __cdecl CalculateSpotCameras();
void __cdecl Inject_Spotcam();

View file

@ -1375,6 +1375,11 @@ typedef struct BOUNDING_BOX {
__int16 Z2; __int16 Z2;
}; };
struct QUAKE_CAMERA {
GAME_VECTOR spos;
GAME_VECTOR epos;
};
typedef void (cdecl *EFFECT_ROUTINE)(ITEM_INFO*); typedef void (cdecl *EFFECT_ROUTINE)(ITEM_INFO*);
typedef void (cdecl *LARA_COLLISION_ROUTINE)(ITEM_INFO*, COLL_INFO*); typedef void (cdecl *LARA_COLLISION_ROUTINE)(ITEM_INFO*, COLL_INFO*);
typedef void (cdecl *LARA_CONTROL_ROUTINE)(ITEM_INFO*, COLL_INFO*); typedef void (cdecl *LARA_CONTROL_ROUTINE)(ITEM_INFO*, COLL_INFO*);

View file

@ -72,7 +72,6 @@
#define CutSeqTriggered VAR_U_(0x0051CAAC, __int32) #define CutSeqTriggered VAR_U_(0x0051CAAC, __int32)
#define GlobalPlayingCutscene VAR_U_(0x0051CAB0, __int32) #define GlobalPlayingCutscene VAR_U_(0x0051CAB0, __int32)
#define Wibble VAR_U_(0x0051CDF0, __int32) #define Wibble VAR_U_(0x0051CDF0, __int32)
#define CdFlags ARRAY_(0x00EEEA40, byte, [136])
#define DbInput VAR_U_(0x00878DAC, __int32) #define DbInput VAR_U_(0x00878DAC, __int32)
#define TrInput VAR_U_(0x00878D98, __int32) #define TrInput VAR_U_(0x00878D98, __int32)
#define MatrixStack ARRAY_(0x0055D66C, __int32, [480]) #define MatrixStack ARRAY_(0x0055D66C, __int32, [480])
@ -85,8 +84,6 @@
#define SamplePointer ARRAY_(0x0086BEF0, HSAMPLE, [SOUND_MAX_SAMPLES]) #define SamplePointer ARRAY_(0x0086BEF0, HSAMPLE, [SOUND_MAX_SAMPLES])
#define SoundSlot ARRAY_(0x00E52430, SoundEffectSlot, [SOUND_MAX_CHANNELS]) #define SoundSlot ARRAY_(0x00E52430, SoundEffectSlot, [SOUND_MAX_CHANNELS])
#define TrackNamePrefix VAR_U_(0x00511828, char) #define TrackNamePrefix VAR_U_(0x00511828, char)
#define TrackNameTable ARRAY_(0x005108C0, char*, [SOUND_LEGACY_TRACKTABLE_SIZE])
#define TrackMap ARRAY_(0x00EEEA40, byte, [SOUND_LEGACY_TRACKTABLE_SIZE])
#define IsAtmospherePlaying VAR_U_(0x00EEEFFC, byte) #define IsAtmospherePlaying VAR_U_(0x00EEEFFC, byte)
#define CurrentAtmosphere VAR_U_(0x00EEEB90, byte) #define CurrentAtmosphere VAR_U_(0x00EEEB90, byte)
#define GlobalMusicVolume VAR_U_(0x00517B68, unsigned int) #define GlobalMusicVolume VAR_U_(0x00517B68, unsigned int)
@ -259,6 +256,36 @@
#define KeyboardLayout1 ARRAY_(0x00516C60, __int16, [18]) #define KeyboardLayout1 ARRAY_(0x00516C60, __int16, [18])
#define KeyMap ARRAY_(0x0086BB8C, byte, [256]) #define KeyMap ARRAY_(0x0086BB8C, byte, [256])
#define ConflictingKeys ARRAY_(0x00878C4C, byte, [256]) #define ConflictingKeys ARRAY_(0x00878C4C, byte, [256])
#define LastSequence VAR_U_(0x00E51F2C, __int16)
#define SpotcamTimer VAR_U_(0x0051D00C, __int16)
#define SpotcamLoopCnt VAR_U_(0x00E4F488, __int16)
#define LaraAir VAR_U_(0x00E4F6A8, __int32)
#define LaraHealth VAR_U_(0x00E51F20, __int32)
#define CameraFade VAR_U_(0x00E4F36C, __int32)
#define LaraFixedPosition VAR_U_(0x00E4F360, PHD_VECTOR)
#define InitialCameraRoom VAR_U_(0x00E4F588, __int16)
#define LastFOV VAR_U_(0x00E4F506, __int16)
#define InitialCameraPosition VAR_U_(0x00E4F3D0, PHD_VECTOR)
#define InitialCameraTarget VAR_U_(0x00E4F350, PHD_VECTOR)
#define CurrentSequence VAR_U_(0x00E4F502, __int16)
#define CurrentSplinePosition VAR_U_(0x00E51F28, __int32)
#define SplineToCamera VAR_U_(0x00E4F48C, __int32)
#define FirstCamera VAR_U_(0x00E51F24, __int16)
#define LastCamera VAR_U_(0x00E4F6AC, __int16)
#define CurrentCameraCnt VAR_U_(0x00E4EAA0, __int32)
#define CameraXposition ARRAY_(0x00E4F440, __int32, [18])
#define CameraYposition ARRAY_(0x00E4F600, __int32, [18])
#define CameraZposition ARRAY_(0x00E4F540, __int32, [18])
#define CameraXtarget ARRAY_(0x00E4F3E0, __int32, [18])
#define CameraYtarget ARRAY_(0x00E51EC0, __int32, [18])
#define CameraZtarget ARRAY_(0x00E4F5A0, __int32, [18])
#define CameraRoll ARRAY_(0x00E4F4A0, __int32, [18])
#define CameraFOV ARRAY_(0x00E4F380, __int32, [18])
#define CameraSpeed ARRAY_(0x00E4F660, __int32, [18])
#define SpotcamDontDrawLara VAR_U_(0x0051D021, byte)
#define QuakeCam VAR_U_(0x00E4F520, QUAKE_CAMERA)
#define SplineFromCamera VAR_U_(0x00E4F3DC, __int32)
#define Unk_0051D024 VAR_U_(0x0051D024, byte)
extern bool MonksAttackLara; extern bool MonksAttackLara;

View file

@ -440,7 +440,7 @@ bool Renderer11::Initialise(__int32 w, __int32 h, __int32 refreshRate, bool wind
return false; return false;
} }
m_titleScreen = Texture2D::LoadFromFile(m_device, "Screens\\Title.jpg"); m_titleScreen = Texture2D::LoadFromFile(m_device, (char*)g_GameFlow->GetLevel(0)->Background.c_str());
if (m_titleScreen == NULL) if (m_titleScreen == NULL)
return false; return false;
@ -600,8 +600,12 @@ void Renderer11::UpdateCameraMatrices(float posX, float posY, float posZ, float
{ {
g_Configuration.MaxDrawDistance = 200; g_Configuration.MaxDrawDistance = 200;
Vector3 up = -Vector3::UnitY;
Matrix upRotation = Matrix::CreateFromYawPitchRoll(0.0f, 0.0f, roll);
up = Vector3::Transform(up, upRotation);
FieldOfView = fov; FieldOfView = fov;
View = Matrix::CreateLookAt(Vector3(posX, posY, posZ), Vector3(targetX, targetY, targetZ), -Vector3::UnitY); View = Matrix::CreateLookAt(Vector3(posX, posY, posZ), Vector3(targetX, targetY, targetZ), up);
Projection = Matrix::CreatePerspectiveFieldOfView(fov, ScreenWidth / (float)ScreenHeight, 20.0f, g_Configuration.MaxDrawDistance * 1024.0f); Projection = Matrix::CreatePerspectiveFieldOfView(fov, ScreenWidth / (float)ScreenHeight, 20.0f, g_Configuration.MaxDrawDistance * 1024.0f);
m_stCameraMatrices.View = View; m_stCameraMatrices.View = View;
@ -635,7 +639,7 @@ bool Renderer11::drawHorizonAndSky()
return true; return true;
if (BinocularRange) if (BinocularRange)
phd_AlterFOV(14560 - BinocularRange); AlterFOV(14560 - BinocularRange);
// Storm // Storm
if (level->Storm) if (level->Storm)
@ -1181,7 +1185,7 @@ bool Renderer11::drawItems(bool transparent, bool animated)
bool Renderer11::drawLara(bool transparent, bool shadowMap) bool Renderer11::drawLara(bool transparent, bool shadowMap)
{ {
// Don't draw Lara if binoculars or sniper // Don't draw Lara if binoculars or sniper
if (BinocularRange || SpotcamOverlay || SpotcamDontDrawLara) if (BinocularRange || SpotcamOverlay || SpotcamDontDrawLara || CurrentLevel == 0)
return true; return true;
UINT stride = sizeof(RendererVertex); UINT stride = sizeof(RendererVertex);
@ -1493,6 +1497,8 @@ __int32 Renderer11::DumpGameScene()
__int32 Renderer11::DrawInventory() __int32 Renderer11::DrawInventory()
{ {
if (CurrentLevel == 0 && g_GameFlow->TitleType == TITLE_FLYBY)
drawScene(true);
drawInventoryScene(); drawInventoryScene();
drawFinalPass(); drawFinalPass();
@ -5573,7 +5579,10 @@ __int32 Renderer11::drawInventoryScene()
// Clear the Z-Buffer after drawing the background // Clear the Z-Buffer after drawing the background
if (g_Inventory->GetType() == INV_TYPE_TITLE) if (g_Inventory->GetType() == INV_TYPE_TITLE)
{ {
if (g_GameFlow->TitleType == TITLE_BACKGROUND)
drawFullScreenQuad(m_titleScreen->ShaderResourceView, Vector3(m_fadeFactor, m_fadeFactor, m_fadeFactor), false); drawFullScreenQuad(m_titleScreen->ShaderResourceView, Vector3(m_fadeFactor, m_fadeFactor, m_fadeFactor), false);
else
drawFullScreenQuad(m_dumpScreenRenderTarget->ShaderResourceView, Vector3(1.0f, 1.0f, 1.0f), false);
} }
else else
{ {
@ -5627,7 +5636,7 @@ __int32 Renderer11::drawInventoryScene()
objectIndex = ring->currentObject; objectIndex = ring->currentObject;
// Yellow title // Yellow title
if (ring->focusState == INV_FOCUS_STATE_NONE) if (ring->focusState == INV_FOCUS_STATE_NONE && g_Inventory->GetType() != INV_TYPE_TITLE)
PrintString(400, 20, g_GameFlow->GetString(activeRing->titleStringIndex), PRINTSTRING_COLOR_YELLOW, PRINTSTRING_CENTER); PrintString(400, 20, g_GameFlow->GetString(activeRing->titleStringIndex), PRINTSTRING_COLOR_YELLOW, PRINTSTRING_CENTER);
for (__int32 i = 0; i < numObjects; i++) for (__int32 i = 0; i < numObjects; i++)
@ -5635,6 +5644,9 @@ __int32 Renderer11::drawInventoryScene()
__int16 inventoryObject = ring->objects[objectIndex].inventoryObject; __int16 inventoryObject = ring->objects[objectIndex].inventoryObject;
__int16 objectNumber = g_Inventory->GetInventoryObject(ring->objects[objectIndex].inventoryObject)->objectNumber; __int16 objectNumber = g_Inventory->GetInventoryObject(ring->objects[objectIndex].inventoryObject)->objectNumber;
//if (ring->focusState != INV_FOCUS_STATE_NONE && (k != g_Inventory->GetActiveRing() || inventoryObject != ring->objects[i].inventoryObject))
// continue;
// Calculate the inventory object position and rotation // Calculate the inventory object position and rotation
float currentAngle = 0.0f; float currentAngle = 0.0f;
__int16 steps = -objectIndex + ring->currentObject; __int16 steps = -objectIndex + ring->currentObject;
@ -7059,7 +7071,7 @@ bool Renderer11::drawShadowMap()
bool Renderer11::DoTitleImage() bool Renderer11::DoTitleImage()
{ {
Texture2D* texture = Texture2D::LoadFromFile(m_device, (char*)"Title.png"); Texture2D* texture = Texture2D::LoadFromFile(m_device, (char*)g_GameFlow->Intro);
if (!texture) if (!texture)
return false; return false;

View file

@ -20,9 +20,13 @@ ChunkId* ChunkGameFlowLevelLayer = ChunkId::FromString("Tr5MainLevelLayer");
ChunkId* ChunkGameFlowLevelLuaEvent = ChunkId::FromString("Tr5MainLevelLuaEvent"); ChunkId* ChunkGameFlowLevelLuaEvent = ChunkId::FromString("Tr5MainLevelLuaEvent");
ChunkId* ChunkGameFlowLevelLegend = ChunkId::FromString("Tr5MainLevelLegend"); ChunkId* ChunkGameFlowLevelLegend = ChunkId::FromString("Tr5MainLevelLegend");
ChunkId* ChunkGameFlowStrings = ChunkId::FromString("Tr5MainStrings"); ChunkId* ChunkGameFlowStrings = ChunkId::FromString("Tr5MainStrings");
ChunkId* ChunkGameFlowAudioTracks = ChunkId::FromString("Tr5MainAudioTracks");
ChunkId* ChunkGameFlowTitleBackground = ChunkId::FromString("Tr5MainTitleBackground");
ChunkReader* g_ScriptChunkIO; ChunkReader* g_ScriptChunkIO;
extern vector<AudioTrack> g_AudioTracks;
GameFlow::GameFlow(sol::state* lua) GameFlow::GameFlow(sol::state* lua)
{ {
m_lua = lua; m_lua = lua;
@ -105,7 +109,11 @@ bool __cdecl readGameFlowFlags()
g_GameFlow->FlyCheat = LEB128::ReadByte(g_ScriptChunkIO->GetRawStream()); g_GameFlow->FlyCheat = LEB128::ReadByte(g_ScriptChunkIO->GetRawStream());
g_GameFlow->DebugMode = LEB128::ReadByte(g_ScriptChunkIO->GetRawStream()); g_GameFlow->DebugMode = LEB128::ReadByte(g_ScriptChunkIO->GetRawStream());
g_GameFlow->LevelFarView = LEB128::ReadInt32(g_ScriptChunkIO->GetRawStream()); g_GameFlow->LevelFarView = LEB128::ReadInt32(g_ScriptChunkIO->GetRawStream());
g_GameFlow->TitleType = LEB128::ReadInt32(g_ScriptChunkIO->GetRawStream()); //g_GameFlow->TitleType = LEB128::ReadInt32(g_ScriptChunkIO->GetRawStream());
char* str;
g_ScriptChunkIO->GetRawStream()->ReadString(&str);
g_GameFlow->Intro = str;
return true; return true;
} }
@ -117,8 +125,8 @@ bool __cdecl readGameFlowStrings()
LanguageScript* lang = new LanguageScript(name); LanguageScript* lang = new LanguageScript(name);
free(name); free(name);
int numStrings = LEB128::ReadUInt32(g_ScriptChunkIO->GetRawStream()); __int32 numStrings = LEB128::ReadUInt32(g_ScriptChunkIO->GetRawStream());
for (int i = 0; i < numStrings; i++) for (__int32 i = 0; i < numStrings; i++)
{ {
char* str; char* str;
g_ScriptChunkIO->GetRawStream()->ReadString(&str); g_ScriptChunkIO->GetRawStream()->ReadString(&str);
@ -131,6 +139,23 @@ bool __cdecl readGameFlowStrings()
return true; return true;
} }
bool __cdecl readGameFlowTracks()
{
__int32 numTracks = LEB128::ReadUInt32(g_ScriptChunkIO->GetRawStream());
for (__int32 i = 0; i < numTracks; i++)
{
char* str;
g_ScriptChunkIO->GetRawStream()->ReadString(&str);
AudioTrack track;
track.Name = str;
track.Mask = 0;
g_AudioTracks.push_back(track);
}
return true;
}
bool __cdecl readGameFlowLevelChunks(ChunkId* chunkId, __int32 maxSize, __int32 arg) bool __cdecl readGameFlowLevelChunks(ChunkId* chunkId, __int32 maxSize, __int32 arg)
{ {
GameScriptLevel* level = g_GameFlow->Levels[arg]; GameScriptLevel* level = g_GameFlow->Levels[arg];
@ -147,6 +172,10 @@ bool __cdecl readGameFlowLevelChunks(ChunkId* chunkId, __int32 maxSize, __int32
level->LoadScreenFileName = string(str); level->LoadScreenFileName = string(str);
free(str); free(str);
g_ScriptChunkIO->GetRawStream()->ReadString(&str);
level->Background = str;
free(str);
level->NameStringIndex = LEB128::ReadUInt32(g_ScriptChunkIO->GetRawStream()); level->NameStringIndex = LEB128::ReadUInt32(g_ScriptChunkIO->GetRawStream());
level->Soundtrack = LEB128::ReadUInt32(g_ScriptChunkIO->GetRawStream()); level->Soundtrack = LEB128::ReadUInt32(g_ScriptChunkIO->GetRawStream());
@ -273,6 +302,8 @@ bool __cdecl readGameFlowChunks(ChunkId* chunkId, __int32 maxSize, __int32 arg)
return readGameFlowFlags(); return readGameFlowFlags();
else if (chunkId->EqualsTo(ChunkGameFlowStrings)) else if (chunkId->EqualsTo(ChunkGameFlowStrings))
return readGameFlowStrings(); return readGameFlowStrings();
else if (chunkId->EqualsTo(ChunkGameFlowAudioTracks))
return readGameFlowTracks();
else if (chunkId->EqualsTo(ChunkGameFlowLevel)) else if (chunkId->EqualsTo(ChunkGameFlowLevel))
return readGameFlowLevel(); return readGameFlowLevel();
return false; return false;
@ -406,6 +437,8 @@ bool GameFlow::DoGameflow()
// We loop indefinitely, looking for return values of DoTitle or DoLevel // We loop indefinitely, looking for return values of DoTitle or DoLevel
bool loadFromSavegame = false; bool loadFromSavegame = false;
//DoLevel(0, 120, false);
while (true) while (true)
{ {
// First we need to fill some legacy variables in PCTomb5.exe // First we need to fill some legacy variables in PCTomb5.exe

View file

@ -141,6 +141,7 @@ bool __cdecl readGameFlowLevelChunks(ChunkId* chunkId, __int32 maxSize, __int32
bool __cdecl readGameFlowChunks(ChunkId* chunkId, __int32 maxSize, __int32 arg); bool __cdecl readGameFlowChunks(ChunkId* chunkId, __int32 maxSize, __int32 arg);
bool __cdecl readGameFlowLevel(); bool __cdecl readGameFlowLevel();
bool __cdecl readGameFlowStrings(); bool __cdecl readGameFlowStrings();
bool __cdecl readGameFlowTracks();
bool __cdecl readGameFlowFlags(); bool __cdecl readGameFlowFlags();
bool __cdecl LoadScript(); bool __cdecl LoadScript();
@ -172,6 +173,7 @@ public:
bool DebugMode; bool DebugMode;
__int32 LevelFarView; __int32 LevelFarView;
__int32 TitleType; __int32 TitleType;
char* Intro;
// Selected language set // Selected language set
LanguageScript* CurrentStrings; LanguageScript* CurrentStrings;

Binary file not shown.