mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-12 21:47:03 +03:00
Use script for setting weather
This commit is contained in:
parent
16bbeb48a9
commit
c4090b7c9a
14 changed files with 91 additions and 115 deletions
|
@ -714,12 +714,10 @@ void LaraControl(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
case LW_UNDERWATER:
|
case LW_UNDERWATER:
|
||||||
if (item->hitPoints >= 0)
|
if (item->hitPoints >= 0)
|
||||||
{
|
{
|
||||||
if (LaraDrawType == LARA_TYPE::DIVESUIT)
|
auto level = g_GameFlow->GetLevel(CurrentLevel);
|
||||||
{
|
if (level->LaraType != LaraType::Divesuit)
|
||||||
/* Hardcoded code */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Lara.air--;
|
Lara.air--;
|
||||||
|
|
||||||
if (Lara.air < 0)
|
if (Lara.air < 0)
|
||||||
{
|
{
|
||||||
// if (LaraDrawType == LARA_TYPE::DIVESUIT && Lara.anxiety < 251)
|
// if (LaraDrawType == LARA_TYPE::DIVESUIT && Lara.anxiety < 251)
|
||||||
|
@ -912,7 +910,9 @@ void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
|
|
||||||
lara_control_routines[item->currentAnimState](item, coll);
|
lara_control_routines[item->currentAnimState](item, coll);
|
||||||
|
|
||||||
if (LaraDrawType == LARA_TYPE::DIVESUIT)
|
auto level = g_GameFlow->GetLevel(CurrentLevel);
|
||||||
|
|
||||||
|
if (level->LaraType == LaraType::Divesuit)
|
||||||
{
|
{
|
||||||
if (Lara.turnRate < -ANGLE(0.5f))
|
if (Lara.turnRate < -ANGLE(0.5f))
|
||||||
Lara.turnRate += ANGLE(0.5f);
|
Lara.turnRate += ANGLE(0.5f);
|
||||||
|
@ -930,7 +930,7 @@ void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
|
|
||||||
item->pos.yRot += Lara.turnRate;
|
item->pos.yRot += Lara.turnRate;
|
||||||
|
|
||||||
if (LaraDrawType == LARA_TYPE::DIVESUIT)
|
if (level->LaraType == LaraType::Divesuit)
|
||||||
UpdateSubsuitAngles();
|
UpdateSubsuitAngles();
|
||||||
|
|
||||||
if (item->pos.zRot < -ANGLE(2.0f))
|
if (item->pos.zRot < -ANGLE(2.0f))
|
||||||
|
@ -945,7 +945,7 @@ void LaraUnderWater(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
else if (item->pos.xRot > ANGLE(85.0f))
|
else if (item->pos.xRot > ANGLE(85.0f))
|
||||||
item->pos.xRot = ANGLE(85.0f);
|
item->pos.xRot = ANGLE(85.0f);
|
||||||
|
|
||||||
if (LaraDrawType == LARA_TYPE::DIVESUIT)
|
if (level->LaraType == LaraType::Divesuit)
|
||||||
{
|
{
|
||||||
if (item->pos.zRot > ANGLE(44.0f))
|
if (item->pos.zRot > ANGLE(44.0f))
|
||||||
item->pos.zRot = ANGLE(44.0f);
|
item->pos.zRot = ANGLE(44.0f);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "lara_tests.h"
|
#include "lara_tests.h"
|
||||||
#include "items.h"
|
#include "items.h"
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
#include "GameFlowScript.h"
|
||||||
#include "GameScriptLevel.h"
|
#include "GameScriptLevel.h"
|
||||||
|
|
||||||
/*this file has all the generic **collision** test functions called in lara's state code*/
|
/*this file has all the generic **collision** test functions called in lara's state code*/
|
||||||
|
@ -370,8 +371,9 @@ void LaraSwimCollision(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
int height = LARA_HEIGHT * phd_sin(item->pos.xRot);
|
int height = LARA_HEIGHT * phd_sin(item->pos.xRot);
|
||||||
height = abs(height);
|
height = abs(height);
|
||||||
|
|
||||||
if (height < ((LaraDrawType == LARA_TYPE::DIVESUIT) << 6) + 200)
|
auto level = g_GameFlow->GetLevel(CurrentLevel);
|
||||||
height = ((LaraDrawType == LARA_TYPE::DIVESUIT) << 6) + 200;
|
if (height < ((level->LaraType == LaraType::Divesuit) << 6) + 200)
|
||||||
|
height = ((level->LaraType == LaraType::Divesuit) << 6) + 200;
|
||||||
|
|
||||||
coll->Setup.BadHeightUp = -(STEP_SIZE / 4);
|
coll->Setup.BadHeightUp = -(STEP_SIZE / 4);
|
||||||
coll->Setup.Height = height;
|
coll->Setup.Height = height;
|
||||||
|
|
|
@ -360,7 +360,7 @@ void LaraGun()
|
||||||
{
|
{
|
||||||
Lara.requestGunType = Lara.lastGunType;
|
Lara.requestGunType = Lara.lastGunType;
|
||||||
}
|
}
|
||||||
else if (TrInput & IN_FLARE && (g_GameFlow->GetLevel(CurrentLevel)->LaraType != LARA_TYPE::YOUNG))
|
else if (TrInput & IN_FLARE && (g_GameFlow->GetLevel(CurrentLevel)->LaraType != LaraType::Young))
|
||||||
{
|
{
|
||||||
if (LaraItem->currentAnimState == LS_CROUCH_IDLE && LaraItem->animNumber != LA_CROUCH_IDLE)
|
if (LaraItem->currentAnimState == LS_CROUCH_IDLE && LaraItem->animNumber != LA_CROUCH_IDLE)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -99,11 +99,12 @@ void lara_as_tread(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
if (item->hitPoints <= 0)
|
if (item->hitPoints <= 0)
|
||||||
{
|
{
|
||||||
item->goalAnimState = LS_WATER_DEATH;
|
item->goalAnimState = LS_WATER_DEATH;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TrInput & IN_ROLL && LaraDrawType != LARA_TYPE::DIVESUIT)
|
auto level = g_GameFlow->GetLevel(CurrentLevel);
|
||||||
|
|
||||||
|
if (TrInput & IN_ROLL && level->LaraType != LaraType::Divesuit)
|
||||||
{
|
{
|
||||||
SetAnimation(item, LA_UNDERWATER_ROLL_180_START);
|
SetAnimation(item, LA_UNDERWATER_ROLL_180_START);
|
||||||
return;
|
return;
|
||||||
|
@ -112,7 +113,7 @@ void lara_as_tread(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
if (TrInput & IN_LOOK)
|
if (TrInput & IN_LOOK)
|
||||||
LookUpDown();
|
LookUpDown();
|
||||||
|
|
||||||
if (LaraDrawType == LARA_TYPE::DIVESUIT)
|
if (level->LaraType == LaraType::Divesuit)
|
||||||
SwimTurnSubsuit(item);
|
SwimTurnSubsuit(item);
|
||||||
else
|
else
|
||||||
SwimTurn(item);
|
SwimTurn(item);
|
||||||
|
@ -134,17 +135,18 @@ void lara_as_glide(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
if (item->hitPoints <= 0)
|
if (item->hitPoints <= 0)
|
||||||
{
|
{
|
||||||
item->goalAnimState = LS_WATER_DEATH;
|
item->goalAnimState = LS_WATER_DEATH;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TrInput & IN_ROLL && LaraDrawType != LARA_TYPE::DIVESUIT)
|
auto level = g_GameFlow->GetLevel(CurrentLevel);
|
||||||
|
|
||||||
|
if (TrInput & IN_ROLL && level->LaraType != LaraType::Divesuit)
|
||||||
{
|
{
|
||||||
SetAnimation(item, LA_UNDERWATER_ROLL_180_START);
|
SetAnimation(item, LA_UNDERWATER_ROLL_180_START);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LaraDrawType != LARA_TYPE::DIVESUIT)
|
if (level->LaraType != LaraType::Divesuit)
|
||||||
SwimTurn(item);
|
SwimTurn(item);
|
||||||
else
|
else
|
||||||
SwimTurnSubsuit(item);
|
SwimTurnSubsuit(item);
|
||||||
|
@ -165,17 +167,18 @@ void lara_as_swim(ITEM_INFO* item, COLL_INFO* coll)
|
||||||
if (item->hitPoints <= 0)
|
if (item->hitPoints <= 0)
|
||||||
{
|
{
|
||||||
item->goalAnimState = LS_WATER_DEATH;
|
item->goalAnimState = LS_WATER_DEATH;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TrInput & IN_ROLL && LaraDrawType != LARA_TYPE::DIVESUIT)
|
auto level = g_GameFlow->GetLevel(CurrentLevel);
|
||||||
|
|
||||||
|
if (TrInput & IN_ROLL && level->LaraType != LaraType::Divesuit)
|
||||||
{
|
{
|
||||||
SetAnimation(item, LA_UNDERWATER_ROLL_180_START);
|
SetAnimation(item, LA_UNDERWATER_ROLL_180_START);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LaraDrawType != LARA_TYPE::DIVESUIT)
|
if (level->LaraType != LaraType::Divesuit)
|
||||||
SwimTurn(item);
|
SwimTurn(item);
|
||||||
else
|
else
|
||||||
SwimTurnSubsuit(item);
|
SwimTurnSubsuit(item);
|
||||||
|
|
|
@ -81,9 +81,6 @@ short NextItemFree;
|
||||||
short NextFxActive;
|
short NextFxActive;
|
||||||
short NextFxFree;
|
short NextFxFree;
|
||||||
|
|
||||||
int WeatherType;
|
|
||||||
int LaraDrawType;
|
|
||||||
|
|
||||||
int WeaponDelay;
|
int WeaponDelay;
|
||||||
int WeaponEnemyTimer;
|
int WeaponEnemyTimer;
|
||||||
|
|
||||||
|
@ -347,7 +344,7 @@ GAME_STATUS ControlPhase(int numFrames, int demoMode)
|
||||||
|
|
||||||
// Update Lara's ponytails
|
// Update Lara's ponytails
|
||||||
HairControl(0, 0, 0);
|
HairControl(0, 0, 0);
|
||||||
if (level->LaraType == LARA_TYPE::YOUNG)
|
if (level->LaraType == LaraType::Young)
|
||||||
HairControl(0, 1, 0);
|
HairControl(0, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,9 +58,6 @@ extern short NextItemFree;
|
||||||
extern short NextFxActive;
|
extern short NextFxActive;
|
||||||
extern short NextFxFree;
|
extern short NextFxFree;
|
||||||
|
|
||||||
extern int WeatherType;
|
|
||||||
extern int LaraDrawType;
|
|
||||||
|
|
||||||
extern int WeaponDelay;
|
extern int WeaponDelay;
|
||||||
extern int WeaponEnemyTimer;
|
extern int WeaponEnemyTimer;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ void HairControl(int cutscene, int ponytail, ANIM_FRAME* framePtr)
|
||||||
OBJECT_INFO* object = &Objects[ID_LARA];
|
OBJECT_INFO* object = &Objects[ID_LARA];
|
||||||
ANIM_FRAME* frame;
|
ANIM_FRAME* frame;
|
||||||
int spaz;
|
int spaz;
|
||||||
bool youngLara = g_GameFlow->GetLevel(CurrentLevel)->LaraType == LARA_TYPE::YOUNG;
|
bool youngLara = g_GameFlow->GetLevel(CurrentLevel)->LaraType == LaraType::Young;
|
||||||
|
|
||||||
if (framePtr == NULL)
|
if (framePtr == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1039,7 +1039,9 @@ void LaraBubbles(ITEM_INFO* item)
|
||||||
|
|
||||||
pos.x = 0;
|
pos.x = 0;
|
||||||
|
|
||||||
if (LaraDrawType == LARA_TYPE::DIVESUIT)
|
auto level = g_GameFlow->GetLevel(CurrentLevel);
|
||||||
|
|
||||||
|
if (level->LaraType == LaraType::Divesuit)
|
||||||
{
|
{
|
||||||
pos.y = -192;
|
pos.y = -192;
|
||||||
pos.z = -160;
|
pos.z = -160;
|
||||||
|
|
|
@ -66,17 +66,9 @@ namespace Environment
|
||||||
FlashColorBase = Vector3::Zero;
|
FlashColorBase = Vector3::Zero;
|
||||||
|
|
||||||
// Clear weather
|
// Clear weather
|
||||||
Weather = WeatherType::None;
|
|
||||||
WeatherStrength = 1.0f;
|
|
||||||
Particles.clear();
|
Particles.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnvironmentController::SetWeather(WeatherType weather, float strength)
|
|
||||||
{
|
|
||||||
Weather = weather;
|
|
||||||
WeatherStrength = strength;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EnvironmentController::Flash(int r, int g, int b, float speed)
|
void EnvironmentController::Flash(int r, int g, int b, float speed)
|
||||||
{
|
{
|
||||||
FlashProgress = 1.0f;
|
FlashProgress = 1.0f;
|
||||||
|
@ -330,14 +322,14 @@ namespace Environment
|
||||||
if (Particles.size() > 0)
|
if (Particles.size() > 0)
|
||||||
Particles.erase(std::remove_if(Particles.begin(), Particles.end(), [](const WeatherParticle& part) { return !part.Enabled; }), Particles.end());
|
Particles.erase(std::remove_if(Particles.begin(), Particles.end(), [](const WeatherParticle& part) { return !part.Enabled; }), Particles.end());
|
||||||
|
|
||||||
if (Weather == WeatherType::None || WeatherStrength == 0.0f)
|
if (level->Weather == WeatherType::None || level->WeatherStrength == 0.0f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int spawnDensity = round((float)(Weather == WeatherType::Rain ? RAIN_SPAWN_DENSITY : SNOW_SPAWN_DENSITY) * WeatherStrength);
|
int spawnDensity = round((float)(level->Weather == WeatherType::Rain ? RAIN_SPAWN_DENSITY : SNOW_SPAWN_DENSITY) * level->WeatherStrength);
|
||||||
int maxCount = (Weather == WeatherType::Rain) ? WEATHER_PARTICLES_MAX_COUNT : WEATHER_PARTICLES_MAX_COUNT / SNOW_PARTICLES_COUNT_DIVIDER;
|
int maxCount = (level->Weather == WeatherType::Rain) ? WEATHER_PARTICLES_MAX_COUNT : WEATHER_PARTICLES_MAX_COUNT / SNOW_PARTICLES_COUNT_DIVIDER;
|
||||||
int newParticlesCount = 0;
|
int newParticlesCount = 0;
|
||||||
|
|
||||||
if (Weather != WeatherType::None)
|
if (level->Weather != WeatherType::None)
|
||||||
{
|
{
|
||||||
while (Particles.size() < maxCount)
|
while (Particles.size() < maxCount)
|
||||||
{
|
{
|
||||||
|
@ -361,7 +353,7 @@ namespace Environment
|
||||||
|
|
||||||
auto part = WeatherParticle();
|
auto part = WeatherParticle();
|
||||||
|
|
||||||
switch (Weather)
|
switch (level->Weather)
|
||||||
{
|
{
|
||||||
case WeatherType::Snow:
|
case WeatherType::Snow:
|
||||||
part.Size = MAX_SNOW_SIZE + ((GetRandomDraw() & (MAX_SNOW_SIZE / 2)) - (MAX_SNOW_SIZE / 2));
|
part.Size = MAX_SNOW_SIZE + ((GetRandomDraw() & (MAX_SNOW_SIZE / 2)) - (MAX_SNOW_SIZE / 2));
|
||||||
|
@ -380,7 +372,7 @@ namespace Environment
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
part.Type = Weather;
|
part.Type = level->Weather;
|
||||||
part.Room = IsRoomOutsideNo;
|
part.Room = IsRoomOutsideNo;
|
||||||
part.Position.x = xPos;
|
part.Position.x = xPos;
|
||||||
part.Position.y = yPos;
|
part.Position.y = yPos;
|
||||||
|
|
|
@ -20,13 +20,6 @@ namespace Environment
|
||||||
|
|
||||||
constexpr auto SKY_POSITION_LIMIT = 9728;
|
constexpr auto SKY_POSITION_LIMIT = 9728;
|
||||||
|
|
||||||
enum class WeatherType
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
Rain,
|
|
||||||
Snow
|
|
||||||
};
|
|
||||||
|
|
||||||
struct WeatherParticle
|
struct WeatherParticle
|
||||||
{
|
{
|
||||||
WeatherType Type;
|
WeatherType Type;
|
||||||
|
@ -65,8 +58,6 @@ namespace Environment
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Weather
|
// Weather
|
||||||
float WeatherStrength = 1.0f;
|
|
||||||
WeatherType Weather = WeatherType::Snow;
|
|
||||||
std::vector<WeatherParticle> Particles;
|
std::vector<WeatherParticle> Particles;
|
||||||
|
|
||||||
// Sky
|
// Sky
|
||||||
|
|
|
@ -1928,7 +1928,7 @@ void InventoryClass::construct_object_list()
|
||||||
CurrentGrenadeGunAmmoType = 0;
|
CurrentGrenadeGunAmmoType = 0;
|
||||||
CurrentCrossBowAmmoType = 0;
|
CurrentCrossBowAmmoType = 0;
|
||||||
|
|
||||||
if (!(g_GameFlow->GetLevel(CurrentLevel)->LaraType == LARA_TYPE::YOUNG))
|
if (!(g_GameFlow->GetLevel(CurrentLevel)->LaraType == LaraType::Young))
|
||||||
{
|
{
|
||||||
if (Lara.Weapons[WEAPON_PISTOLS].Present)
|
if (Lara.Weapons[WEAPON_PISTOLS].Present)
|
||||||
insert_object_into_list(INV_OBJECT_PISTOLS);
|
insert_object_into_list(INV_OBJECT_PISTOLS);
|
||||||
|
@ -2133,7 +2133,7 @@ void InventoryClass::construct_combine_object_list()
|
||||||
for (int i = 0; i < INVENTORY_TABLE_SIZE; i++)
|
for (int i = 0; i < INVENTORY_TABLE_SIZE; i++)
|
||||||
rings[RING_AMMO]->current_object_list[i].invitem = NO_ITEM;
|
rings[RING_AMMO]->current_object_list[i].invitem = NO_ITEM;
|
||||||
|
|
||||||
if (!(g_GameFlow->GetLevel(CurrentLevel)->LaraType == LARA_TYPE::YOUNG))
|
if (!(g_GameFlow->GetLevel(CurrentLevel)->LaraType == LaraType::Young))
|
||||||
{
|
{
|
||||||
if (Lara.Weapons[WEAPON_REVOLVER].Present)
|
if (Lara.Weapons[WEAPON_REVOLVER].Present)
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,28 +75,32 @@ void GameScriptLevel::Register(sol::state* state)
|
||||||
/// (bool) Enable flickering lightning in the sky.
|
/// (bool) Enable flickering lightning in the sky.
|
||||||
// Equivalent to classic TRLE's LIGHTNING setting. As in the TRC Ireland levels.
|
// Equivalent to classic TRLE's LIGHTNING setting. As in the TRC Ireland levels.
|
||||||
//
|
//
|
||||||
// __(thunder sounds not yet implemented)__
|
|
||||||
//@mem storm
|
//@mem storm
|
||||||
"storm", &GameScriptLevel::Storm,
|
"storm", &GameScriptLevel::Storm,
|
||||||
|
|
||||||
/// (WeatherType) Choose weather effect.
|
/// (WeatherType) Choose weather effect.
|
||||||
// Must be one of the values `WeatherType.NORMAL`, `WeatherType.RAIN`, or `WeatherType.SNOW`.
|
// Must be one of the values `WeatherType.None`, `WeatherType.Rain`, or `WeatherType.Snow`.
|
||||||
//
|
//
|
||||||
// __(not yet implemented)__
|
|
||||||
//@mem weather
|
//@mem weather
|
||||||
"weather", &GameScriptLevel::Weather,
|
"weather", &GameScriptLevel::Weather,
|
||||||
|
|
||||||
|
/// (float) Choose weather strength.
|
||||||
|
// Must be value between `0.1` and `1.0`.
|
||||||
|
//
|
||||||
|
//@mem weatherStrength
|
||||||
|
"weatherStrength", sol::property(&GameScriptLevel::SetWeatherStrength),
|
||||||
|
|
||||||
/*** (LaraType) Must be one of the LaraType values.
|
/*** (LaraType) Must be one of the LaraType values.
|
||||||
These are:
|
These are:
|
||||||
|
|
||||||
NORMAL
|
Normal
|
||||||
YOUNG
|
Young
|
||||||
BUNHEAD
|
Bunhead
|
||||||
CATSUIT
|
Catsuit
|
||||||
DIVESUIT
|
Divesuit
|
||||||
INVISIBLE
|
Invisible
|
||||||
|
|
||||||
e.g. `myLevel.laraType = LaraType.DIVESUIT`
|
e.g. `myLevel.laraType = LaraType.Divesuit`
|
||||||
|
|
||||||
__(not yet fully implemented)__
|
__(not yet fully implemented)__
|
||||||
@mem laraType*/
|
@mem laraType*/
|
||||||
|
@ -113,20 +117,6 @@ e.g. `myLevel.laraType = LaraType.DIVESUIT`
|
||||||
//@mem mirror
|
//@mem mirror
|
||||||
"mirror", &GameScriptLevel::Mirror,
|
"mirror", &GameScriptLevel::Mirror,
|
||||||
|
|
||||||
/*** (byte) Default speed of "UVRotate" animated textures.
|
|
||||||
|
|
||||||
Must be in the range [-64, 64].
|
|
||||||
|
|
||||||
A level texture can be set in Tomb Editor to use "UVRotate" animation.
|
|
||||||
This gives the effect of the texture looping downwards or upwards in place.
|
|
||||||
Positive values will cause the texture to loop downwards, and negative values
|
|
||||||
will cause an upwards loop. The higher a positive number or the lower a negative
|
|
||||||
number, the faster the scroll will be.
|
|
||||||
|
|
||||||
__(not yet implemented)__
|
|
||||||
@mem UVRotate*/
|
|
||||||
"UVRotate", sol::property(&GameScriptLevel::SetUVRotate),
|
|
||||||
|
|
||||||
/*** (byte) The maximum draw distance for level.
|
/*** (byte) The maximum draw distance for level.
|
||||||
Given in sectors (blocks).
|
Given in sectors (blocks).
|
||||||
Must be in the range [1, 127], and equal to or less than the value passed to SetGameFarView.
|
Must be in the range [1, 127], and equal to or less than the value passed to SetGameFarView.
|
||||||
|
@ -151,18 +141,18 @@ __(not yet implemented)__
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameScriptLevel::SetUVRotate(byte val)
|
void GameScriptLevel::SetWeatherStrength(float val)
|
||||||
{
|
{
|
||||||
bool cond = val <= 64 && val >= -64;
|
bool cond = val <= 1.0f && val >= 0.0f;
|
||||||
std::string msg{ "UVRotate value must be in the range [-64, 64]." };
|
std::string msg{ "weatherStrength value must be in the range [0.1, 1.0]." };
|
||||||
if (!ScriptAssert(cond, msg))
|
if (!ScriptAssert(cond, msg))
|
||||||
{
|
{
|
||||||
ScriptWarn("Setting UVRotate to 0.");
|
ScriptWarn("Setting weatherStrength view to 1.");
|
||||||
UVRotate = 0;
|
WeatherStrength = 1.0f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UVRotate = val;
|
WeatherStrength = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,36 +5,38 @@
|
||||||
#include "GameScriptColor.h"
|
#include "GameScriptColor.h"
|
||||||
#include "GameScriptInventoryObject.h"
|
#include "GameScriptInventoryObject.h"
|
||||||
|
|
||||||
enum class WEATHER_TYPE
|
enum class WeatherType
|
||||||
{
|
{
|
||||||
NORMAL,
|
None,
|
||||||
RAIN,
|
Rain,
|
||||||
SNOW
|
Snow
|
||||||
};
|
};
|
||||||
|
|
||||||
static const std::unordered_map<std::string, WEATHER_TYPE> kWeatherTypes{
|
static const std::unordered_map<std::string, WeatherType> kWeatherTypes
|
||||||
{"NORMAL", WEATHER_TYPE::NORMAL},
|
|
||||||
{"RAIN", WEATHER_TYPE::RAIN},
|
|
||||||
{"SNOW", WEATHER_TYPE::SNOW}
|
|
||||||
};
|
|
||||||
|
|
||||||
enum LARA_TYPE
|
|
||||||
{
|
{
|
||||||
NORMAL = 1,
|
{"None", WeatherType::None},
|
||||||
YOUNG = 2,
|
{"Rain", WeatherType::Rain},
|
||||||
BUNHEAD = 3,
|
{"Snow", WeatherType::Snow}
|
||||||
CATSUIT = 4,
|
|
||||||
DIVESUIT = 5,
|
|
||||||
INVISIBLE = 7
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const std::unordered_map<std::string, LARA_TYPE> kLaraTypes{
|
enum LaraType
|
||||||
{"NORMAL", LARA_TYPE::NORMAL},
|
{
|
||||||
{"YOUNG", LARA_TYPE::YOUNG},
|
Normal = 1,
|
||||||
{"BUNHEAD", LARA_TYPE::BUNHEAD},
|
Young = 2,
|
||||||
{"CATSUIT", LARA_TYPE::CATSUIT},
|
Bunhead = 3,
|
||||||
{"DIVESUIT", LARA_TYPE::DIVESUIT},
|
Catsuit = 4,
|
||||||
{"INVISIBLE", LARA_TYPE::INVISIBLE}
|
Divesuit = 5,
|
||||||
|
Invisible = 7
|
||||||
|
};
|
||||||
|
|
||||||
|
static const std::unordered_map<std::string, LaraType> kLaraTypes
|
||||||
|
{
|
||||||
|
{"Normal", LaraType::Normal},
|
||||||
|
{"Young", LaraType::Young},
|
||||||
|
{"Bunhead", LaraType::Bunhead},
|
||||||
|
{"Catsuit", LaraType::Catsuit},
|
||||||
|
{"Divesuit", LaraType::Divesuit},
|
||||||
|
{"Invisible", LaraType::Invisible}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GameScriptLevel
|
struct GameScriptLevel
|
||||||
|
@ -50,16 +52,16 @@ struct GameScriptLevel
|
||||||
bool ColAddHorizon{ false };
|
bool ColAddHorizon{ false };
|
||||||
GameScriptColor Fog{ 0, 0, 0 };
|
GameScriptColor Fog{ 0, 0, 0 };
|
||||||
bool Storm{ false };
|
bool Storm{ false };
|
||||||
WEATHER_TYPE Weather{ WEATHER_TYPE::NORMAL };
|
WeatherType Weather{ WeatherType::None };
|
||||||
|
float WeatherStrength{ 1.0f };
|
||||||
bool Rumble{ false };
|
bool Rumble{ false };
|
||||||
LARA_TYPE LaraType{ LARA_TYPE::NORMAL };
|
LaraType LaraType{ LaraType::Normal };
|
||||||
GameScriptMirror Mirror;
|
GameScriptMirror Mirror;
|
||||||
byte UVRotate{ 0 };
|
|
||||||
int LevelFarView{ 0 };
|
int LevelFarView{ 0 };
|
||||||
bool UnlimitedAir{ false };
|
bool UnlimitedAir{ false };
|
||||||
std::vector<GameScriptInventoryObject> InventoryObjects;
|
std::vector<GameScriptInventoryObject> InventoryObjects;
|
||||||
|
|
||||||
void SetUVRotate(byte val);
|
void SetWeatherStrength(float val);
|
||||||
void SetLevelFarView(byte val);
|
void SetLevelFarView(byte val);
|
||||||
static void Register(sol::state* state);
|
static void Register(sol::state* state);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1044,8 +1044,8 @@ unsigned CALLBACK LoadLevel(void* data)
|
||||||
|
|
||||||
g_Renderer.updateProgress(20);
|
g_Renderer.updateProgress(20);
|
||||||
|
|
||||||
WeatherType = ReadInt8();
|
ReadInt8(); // TODO: Remove!
|
||||||
LaraDrawType = ReadInt8();
|
ReadInt8(); // TODO: Remove!
|
||||||
|
|
||||||
LoadRooms();
|
LoadRooms();
|
||||||
g_Renderer.updateProgress(40);
|
g_Renderer.updateProgress(40);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue