2018-09-02 21:13:34 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-09-02 09:29:36 +02:00
|
|
|
#include <sol.hpp>
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
#include <fstream>
|
|
|
|
#include <map>
|
2018-09-02 21:13:34 +02:00
|
|
|
#include "..\Global\global.h"
|
2018-09-02 09:29:36 +02:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2018-09-02 21:13:34 +02:00
|
|
|
#define NUM_STRINGS 10000
|
|
|
|
#define NUM_LEVELS 100
|
2018-09-02 09:29:36 +02:00
|
|
|
|
2018-09-02 21:13:34 +02:00
|
|
|
// Define string ids
|
2018-09-02 09:29:36 +02:00
|
|
|
#define STRING_INV_PASSPORT 1
|
|
|
|
#define STRING_INV_LARA_HOME 2
|
|
|
|
#define STRING_INV_CONTROLS 3
|
|
|
|
#define STRING_INV_DISPLAY 4
|
|
|
|
#define STRING_INV_SOUND 5
|
|
|
|
#define STRING_INV_NEW_GAME 6
|
|
|
|
#define STRING_INV_LOAD_GAME 7
|
|
|
|
#define STRING_INV_SAVE_GAME 8
|
|
|
|
#define STRING_INV_EXIT_GAME 9
|
|
|
|
#define STRING_INV_EXIT_TO_TITLE 10
|
|
|
|
#define STRING_INV_UZI 11
|
|
|
|
#define STRING_INV_PISTOLS 12
|
|
|
|
#define STRING_INV_SHOTGUN 13
|
|
|
|
#define STRING_INV_REVOLVER 14
|
|
|
|
#define STRING_INV_REVOLVER_LASER 15
|
|
|
|
#define STRING_INV_DESERT_EAGLE 16
|
|
|
|
#define STRING_INV_DESERT_EAGLE_LASER 17
|
|
|
|
#define STRING_INV_DESERT_EAGLE_AMMO 18
|
|
|
|
#define STRING_INV_HK 19
|
|
|
|
#define STRING_INV_HK_SILENCED 20
|
|
|
|
#define STRING_INV_SHOTGUN_AMMO1 21
|
|
|
|
#define STRING_INV_SHOTGUN_AMMO2 22
|
|
|
|
#define STRING_INV_HK_SNIPER_MODE 23
|
|
|
|
#define STRING_INV_HK_BURST_MODE 24
|
|
|
|
#define STRING_INV_HK_RAPID_MODE 25
|
|
|
|
#define STRING_INV_HK_AMMO 26
|
|
|
|
#define STRING_INV_REVOLVER_AMMO 27
|
|
|
|
#define STRING_INV_UZI_AMMO 28
|
|
|
|
#define STRING_INV_PISTOLS_AMMO 29
|
|
|
|
#define STRING_INV_LASERSIGHT 30
|
|
|
|
#define STRING_INV_SILENCER 31
|
|
|
|
#define STRING_INV_LARGE_MEDIPACK 32
|
|
|
|
#define STRING_INV_SMALL_MEDIPACK 33
|
|
|
|
#define STRING_INV_BINOCULARS 34
|
|
|
|
#define STRING_INV_HEADSET 35
|
|
|
|
#define STRING_INV_FLARES 36
|
|
|
|
#define STRING_INV_TIMEX 37
|
|
|
|
#define STRING_INV_CROWBAR 38
|
|
|
|
#define STRING_INV_USE 39
|
|
|
|
#define STRING_INV_COMBINE 40
|
|
|
|
#define STRING_INV_SEPARE 41
|
|
|
|
#define STRING_INV_CHOOSE_AMMO 42
|
2018-09-03 21:08:40 +02:00
|
|
|
#define STRING_INV_SELECT_LEVEL 43
|
2018-11-11 23:42:30 +01:00
|
|
|
#define STRING_INV_GRENADE_LAUNCHER 46
|
2018-11-21 09:34:01 +01:00
|
|
|
#define STRING_INV_GRENADE_AMMO1 47
|
|
|
|
#define STRING_INV_GRENADE_AMMO2 48
|
|
|
|
#define STRING_INV_GRENADE_AMMO3 49
|
|
|
|
#define STRING_INV_HARPOON_GUN 50
|
|
|
|
#define STRING_INV_HARPOON_AMMO 51
|
|
|
|
#define STRING_INV_ROCKET_LAUNCHER 52
|
|
|
|
#define STRING_INV_ROCKET_AMMO 53
|
|
|
|
#define STRING_INV_CROSSBOW 54
|
|
|
|
#define STRING_INV_CROSSBOW_LASER 55
|
|
|
|
#define STRING_INV_CROSSBOW_AMMO1 56
|
|
|
|
#define STRING_INV_CROSSBOW_AMMO2 57
|
|
|
|
#define STRING_INV_CROSSBOW_AMMO3 58
|
|
|
|
#define STRING_INV_DIARY 59
|
2018-11-28 13:19:01 +01:00
|
|
|
#define STRING_INV_WATERSKIN1_EMPTY 60
|
|
|
|
#define STRING_INV_WATERSKIN2_EMPTY 61
|
2018-09-02 09:29:36 +02:00
|
|
|
|
|
|
|
typedef struct GameScriptSettings {
|
|
|
|
__int32 ScreenWidth;
|
|
|
|
__int32 ScreenHeight;
|
|
|
|
bool EnableLoadSave;
|
|
|
|
bool EnableDynamicShadows;
|
2018-09-03 21:08:40 +02:00
|
|
|
bool EnableWaterCaustics;
|
|
|
|
bool Windowed;
|
2018-09-02 09:29:36 +02:00
|
|
|
string WindowTitle;
|
2018-09-03 21:08:40 +02:00
|
|
|
__int32 DrawingDistance;
|
2018-10-30 18:49:16 +01:00
|
|
|
bool ShowRendererSteps;
|
|
|
|
bool ShowDebugInfo;
|
2018-09-02 09:29:36 +02:00
|
|
|
};
|
|
|
|
|
2018-09-02 21:13:34 +02:00
|
|
|
typedef struct GameScriptSkyLayer {
|
|
|
|
byte R;
|
|
|
|
byte G;
|
|
|
|
byte B;
|
|
|
|
__int16 CloudSpeed;
|
|
|
|
|
|
|
|
GameScriptSkyLayer()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
GameScriptSkyLayer(byte r, byte g, byte b, __int16 speed)
|
|
|
|
{
|
|
|
|
R = r;
|
|
|
|
G = g;
|
|
|
|
B = b;
|
|
|
|
CloudSpeed = speed;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct GameScriptFog {
|
|
|
|
byte R;
|
|
|
|
byte G;
|
|
|
|
byte B;
|
|
|
|
|
|
|
|
GameScriptFog()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
GameScriptFog(byte r, byte g, byte b)
|
|
|
|
{
|
|
|
|
R = r;
|
|
|
|
G = g;
|
|
|
|
B = b;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-11-24 09:39:37 +01:00
|
|
|
typedef struct GameScriptMirror {
|
|
|
|
__int16 Room;
|
|
|
|
__int32 StartX;
|
|
|
|
__int32 EndX;
|
|
|
|
__int32 StartZ;
|
|
|
|
__int32 EndZ;
|
|
|
|
|
|
|
|
GameScriptMirror()
|
|
|
|
{
|
|
|
|
Room = -1;
|
|
|
|
StartX = EndX = StartZ = EndZ = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
GameScriptMirror(__int16 room, __int32 startX, __int32 endX, __int32 startZ, __int32 endZ)
|
|
|
|
{
|
|
|
|
Room = room;
|
|
|
|
StartX = startX;
|
|
|
|
EndX = endX;
|
|
|
|
StartZ = startZ;
|
|
|
|
EndZ = endZ;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-09-02 21:13:34 +02:00
|
|
|
typedef struct GameScriptLevel {
|
|
|
|
string FileName;
|
|
|
|
string ScriptFileName;
|
|
|
|
string LoadScreenFileName;
|
2018-09-03 21:08:40 +02:00
|
|
|
string Background;
|
2018-09-02 21:13:34 +02:00
|
|
|
__int32 Name;
|
|
|
|
__int32 Soundtrack;
|
|
|
|
GameScriptSkyLayer Layer1;
|
|
|
|
GameScriptSkyLayer Layer2;
|
|
|
|
bool Horizon;
|
|
|
|
bool ColAddHorizon;
|
|
|
|
GameScriptFog Fog;
|
2018-09-03 21:08:40 +02:00
|
|
|
bool Storm;
|
2018-09-03 22:09:32 +02:00
|
|
|
bool Rain;
|
|
|
|
bool Snow;
|
2018-09-09 22:07:28 +02:00
|
|
|
bool ResetHub;
|
2018-11-08 23:05:25 +01:00
|
|
|
bool Rumble;
|
2018-09-05 23:56:39 +02:00
|
|
|
LARA_DRAW_TYPE LaraType;
|
2018-11-24 09:39:37 +01:00
|
|
|
GameScriptMirror Mirror;
|
2018-09-02 21:13:34 +02:00
|
|
|
|
|
|
|
GameScriptLevel()
|
|
|
|
{
|
2018-09-04 20:54:15 +02:00
|
|
|
Storm = false;
|
|
|
|
Rain = false;
|
|
|
|
Snow = false;
|
|
|
|
Horizon = false;
|
|
|
|
ColAddHorizon = false;
|
2018-11-10 09:27:10 +01:00
|
|
|
ResetHub = false;
|
|
|
|
Rumble = false;
|
2018-09-05 23:56:39 +02:00
|
|
|
LaraType = LARA_DRAW_TYPE::LARA_NORMAL;
|
2018-09-02 21:13:34 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-09-22 23:54:36 +02:00
|
|
|
class GameFlow
|
2018-09-02 09:29:36 +02:00
|
|
|
{
|
|
|
|
private:
|
2018-09-22 23:54:36 +02:00
|
|
|
sol::state* m_lua;
|
2018-09-02 21:13:34 +02:00
|
|
|
GameScriptSettings m_settings;
|
|
|
|
vector<string> m_strings;
|
|
|
|
vector<GameScriptLevel*> m_levels;
|
2018-09-04 13:24:50 +02:00
|
|
|
|
2018-09-02 21:13:34 +02:00
|
|
|
string loadScriptFromFile(char* luaFilename);
|
2018-09-22 23:54:36 +02:00
|
|
|
map<__int16, __int16> m_itemsMap;
|
2018-09-02 09:29:36 +02:00
|
|
|
|
|
|
|
public:
|
2018-09-02 21:13:34 +02:00
|
|
|
D3DXVECTOR3 SkyColorLayer1;
|
|
|
|
__int32 SkySpeedLayer1;
|
|
|
|
D3DXVECTOR3 SkyColorLayer2;
|
|
|
|
__int32 SkySpeedLayer2;
|
|
|
|
D3DXVECTOR3 FogColor;
|
|
|
|
__int32 FogInDistance;
|
|
|
|
__int32 FogOutDistance;
|
|
|
|
bool DrawHorizon;
|
|
|
|
bool ColAddHorizon;
|
2018-09-03 21:08:40 +02:00
|
|
|
__int32 SelectedLevelForNewGame;
|
2018-10-24 23:32:22 +02:00
|
|
|
__int32 SelectedSaveGame;
|
2018-09-02 21:13:34 +02:00
|
|
|
|
2018-09-22 23:54:36 +02:00
|
|
|
GameFlow(sol::state* lua);
|
|
|
|
~GameFlow();
|
2018-09-02 09:29:36 +02:00
|
|
|
|
2018-09-02 21:13:34 +02:00
|
|
|
bool LoadGameStrings(char* luaFilename);
|
|
|
|
bool LoadGameSettings(char* luaFilename);
|
|
|
|
bool ExecuteScript(char* luaFilename);
|
|
|
|
char* GetString(__int32 id);
|
|
|
|
GameScriptSettings* GetSettings();
|
|
|
|
GameScriptLevel* GetLevel(__int32 id);
|
|
|
|
void SetHorizon(bool horizon, bool colAddHorizon);
|
|
|
|
void SetLayer1(byte r, byte g, byte b, __int16 speed);
|
|
|
|
void SetLayer2(byte r, byte g, byte b, __int16 speed);
|
|
|
|
void SetFog(byte r, byte g, byte b, __int16 startDistance, __int16 endDistance);
|
2018-09-03 21:08:40 +02:00
|
|
|
__int32 GetNumLevels();
|
|
|
|
void AddLevel(GameScriptLevel* level);
|
2018-09-04 13:24:50 +02:00
|
|
|
bool DoGameflow();
|
2018-09-02 09:29:36 +02:00
|
|
|
};
|