mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-28 15:57:59 +03:00
Merge pull request #657 from MontyTRC89/bug_fixes_Adngel
Bug fixes adngel
This commit is contained in:
commit
c0c0f4a0d5
5 changed files with 56 additions and 24 deletions
|
@ -101,31 +101,31 @@ void FallingBlockControl(short itemNumber)
|
|||
|
||||
item->Pose.Position.y += item->ItemFlags[1];
|
||||
}
|
||||
|
||||
if (GetDistanceToFloor(itemNumber) >= 0)
|
||||
{
|
||||
// If crumbled before actual delay (e.g. too low position), force delay to be correct
|
||||
if (item->ItemFlags[0] < FALLINGBLOCK_DELAY)
|
||||
item->ItemFlags[0] = FALLINGBLOCK_DELAY;
|
||||
|
||||
// Convert object to shatter item
|
||||
ShatterItem.yRot = item->Pose.Orientation.y;
|
||||
ShatterItem.meshIndex = Objects[item->ObjectNumber].meshIndex;
|
||||
ShatterItem.color = item->Color;
|
||||
ShatterItem.sphere.x = item->Pose.Position.x;
|
||||
ShatterItem.sphere.y = item->Pose.Position.y - STEP_SIZE; // So debris won't spawn below floor
|
||||
ShatterItem.sphere.z = item->Pose.Position.z;
|
||||
ShatterItem.bit = 0;
|
||||
ShatterImpactData.impactDirection = Vector3(0, -(float)item->ItemFlags[1] / (float)FALLINGBLOCK_MAX_SPEED, 0);
|
||||
ShatterImpactData.impactLocation = { (float)ShatterItem.sphere.x, (float)ShatterItem.sphere.y, (float)ShatterItem.sphere.z };
|
||||
ShatterObject(&ShatterItem, nullptr, 0, item->RoomNumber, false);
|
||||
|
||||
SoundEffect(SFX_TR4_ROCK_FALL_LAND, &item->Pose);
|
||||
KillItem(itemNumber);
|
||||
}
|
||||
}
|
||||
|
||||
item->ItemFlags[0]++;
|
||||
|
||||
if (GetDistanceToFloor(itemNumber) >= 0)
|
||||
{
|
||||
// If crumbled before actual delay (e.g. too low position), force delay to be correct
|
||||
if (item->ItemFlags[0] < FALLINGBLOCK_DELAY)
|
||||
item->ItemFlags[0] = FALLINGBLOCK_DELAY;
|
||||
|
||||
// Convert object to shatter item
|
||||
ShatterItem.yRot = item->Pose.Orientation.y;
|
||||
ShatterItem.meshIndex = Objects[item->ObjectNumber].meshIndex;
|
||||
ShatterItem.color = item->Color;
|
||||
ShatterItem.sphere.x = item->Pose.Position.x;
|
||||
ShatterItem.sphere.y = item->Pose.Position.y - STEP_SIZE; // So debris won't spawn below floor
|
||||
ShatterItem.sphere.z = item->Pose.Position.z;
|
||||
ShatterItem.bit = 0;
|
||||
ShatterImpactData.impactDirection = Vector3(0, -(float)item->ItemFlags[1] / (float)FALLINGBLOCK_MAX_SPEED, 0);
|
||||
ShatterImpactData.impactLocation = { (float)ShatterItem.sphere.x, (float)ShatterItem.sphere.y, (float)ShatterItem.sphere.z };
|
||||
ShatterObject(&ShatterItem, nullptr, 0, item->RoomNumber, false);
|
||||
|
||||
SoundEffect(SFX_TR4_ROCK_FALL_LAND, &item->Pose);
|
||||
KillItem(itemNumber);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -29,8 +29,17 @@ void TwoBlocksPlatformControl(short itemNumber)
|
|||
{
|
||||
if (item->TriggerFlags)
|
||||
{
|
||||
if (item->Pose.Position.y > (item->ItemFlags[0] - 16 * (int) (item->TriggerFlags & 0xFFFFFFF0)))
|
||||
item->Pose.Position.y -= item->TriggerFlags & 0xF;
|
||||
int goalHeight = (item->ItemFlags[0] - 16 * (int)(item->TriggerFlags & 0xFFFFFFF0));
|
||||
int speed = item->TriggerFlags & 0xF;
|
||||
|
||||
if (item->Pose.Position.y > goalHeight)
|
||||
item->Pose.Position.y -= speed;
|
||||
else
|
||||
return;
|
||||
|
||||
int DistanceToPortal = *&g_Level.Rooms[item->RoomNumber].maxceiling - item->Pose.Position.y;
|
||||
if (DistanceToPortal <= speed)
|
||||
UpdateBridgeItem(itemNumber);
|
||||
|
||||
auto probe = GetCollision(item);
|
||||
|
||||
|
|
|
@ -92,6 +92,8 @@ static constexpr char ScriptReserved_ToLength[] = "ToLength";
|
|||
|
||||
// Flow Functions
|
||||
static constexpr char ScriptReserved_AddLevel[] = "AddLevel";
|
||||
static constexpr char ScriptReserved_GetLevel[] = "GetLevel";
|
||||
static constexpr char ScriptReserved_GetCurrentLevel[] = "GetCurrentLevel";
|
||||
static constexpr char ScriptReserved_SetIntroImagePath[] = "SetIntroImagePath";
|
||||
static constexpr char ScriptReserved_SetTitleScreenImagePath[] = "SetTitleScreenImagePath";
|
||||
static constexpr char ScriptReserved_SetFarView[] = "SetFarView";
|
||||
|
|
|
@ -46,6 +46,21 @@ Add a level to the Flow.
|
|||
*/
|
||||
table_flow.set_function(ScriptReserved_AddLevel, &FlowHandler::AddLevel, this);
|
||||
|
||||
/*** GetLevel.
|
||||
Returns the level indicated by the parameter id.
|
||||
@function GetLevel
|
||||
@tparam int id of the level
|
||||
@treturn Level the level indicated by the id
|
||||
*/
|
||||
table_flow.set_function(ScriptReserved_GetLevel, &FlowHandler::GetLevel, this);
|
||||
|
||||
/*** GetCurrentLevel.
|
||||
Returns the level that the game control is running in that moment.
|
||||
@function GetCurrentLevel
|
||||
@treturn Level the current level
|
||||
*/
|
||||
table_flow.set_function(ScriptReserved_GetCurrentLevel, &FlowHandler::GetCurrentLevel, this);
|
||||
|
||||
/*** Image to show when loading the game.
|
||||
Must be a .jpg or .png image.
|
||||
@function SetIntroImagePath
|
||||
|
@ -189,6 +204,11 @@ Level* FlowHandler::GetLevel(int id)
|
|||
return Levels[id];
|
||||
}
|
||||
|
||||
Level* FlowHandler::GetCurrentLevel()
|
||||
{
|
||||
return Levels[CurrentLevel];
|
||||
}
|
||||
|
||||
int FlowHandler::GetNumLevels() const
|
||||
{
|
||||
return Levels.size();
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
void SetSettings(Settings const & src);
|
||||
Settings* GetSettings();
|
||||
Level* GetLevel(int id);
|
||||
Level* GetCurrentLevel();
|
||||
int GetLevelNumber(std::string const& flieName);
|
||||
int GetNumLevels() const;
|
||||
void SetIntroImagePath(std::string const& path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue