mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 15:24:30 +01:00
Add follow sprite command to title sequence
This commit is contained in:
committed by
Aaron van Geffen
parent
559a5c662a
commit
500b0d09aa
@@ -456,6 +456,11 @@ static std::vector<TitleCommand> LegacyScriptRead(utf8 * script, size_t scriptLe
|
||||
command.Type = TITLE_SCRIPT_SPEED;
|
||||
command.Speed = Math::Max(1, Math::Min(4, atoi(part1) & 0xFF));
|
||||
}
|
||||
else if (_stricmp(token, "FOLLOW") == 0)
|
||||
{
|
||||
command.Type = TITLE_SCRIPT_FOLLOW;
|
||||
command.SpriteIndex = atoi(part1) & 0xFFFF;
|
||||
}
|
||||
else if (_stricmp(token, "WAIT") == 0)
|
||||
{
|
||||
command.Type = TITLE_SCRIPT_WAIT;
|
||||
|
||||
@@ -30,11 +30,12 @@ typedef struct TitleCommand
|
||||
uint8 X;
|
||||
uint8 Y;
|
||||
};
|
||||
uint8 Rotations; // ROTATE (counter-clockwise)
|
||||
uint8 Zoom; // ZOOM
|
||||
uint8 Speed; // SPEED
|
||||
uint16 Milliseconds; // WAIT
|
||||
utf8 Scenario[TITLE_COMMAND_SCENARIO_LENGTH]; // LOADSC
|
||||
uint8 Rotations; // ROTATE (counter-clockwise)
|
||||
uint8 Zoom; // ZOOM
|
||||
uint16 SpriteIndex; // FOLLOW
|
||||
uint8 Speed; // SPEED
|
||||
uint16 Milliseconds; // WAIT
|
||||
utf8 Scenario[TITLE_COMMAND_SCENARIO_LENGTH]; // LOADSC
|
||||
};
|
||||
} TitleCommand;
|
||||
|
||||
@@ -66,6 +67,7 @@ enum TITLE_SCRIPT
|
||||
TITLE_SCRIPT_LOCATION,
|
||||
TITLE_SCRIPT_ROTATE,
|
||||
TITLE_SCRIPT_ZOOM,
|
||||
TITLE_SCRIPT_FOLLOW,
|
||||
TITLE_SCRIPT_RESTART,
|
||||
TITLE_SCRIPT_LOAD,
|
||||
TITLE_SCRIPT_END,
|
||||
|
||||
@@ -289,6 +289,9 @@ private:
|
||||
case TITLE_SCRIPT_SPEED:
|
||||
gGameSpeed = Math::Clamp<uint8>(1, command->Speed, 4);
|
||||
break;
|
||||
case TITLE_SCRIPT_FOLLOW:
|
||||
FollowSprite(command->SpriteIndex);
|
||||
break;
|
||||
case TITLE_SCRIPT_RESTART:
|
||||
Reset();
|
||||
break;
|
||||
@@ -379,6 +382,14 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
void FollowSprite(uint16 SpriteIndex) {
|
||||
rct_window *const MainWindow = window_get_main();
|
||||
if (MainWindow != nullptr)
|
||||
{
|
||||
MainWindow->viewport_target_sprite = SpriteIndex;
|
||||
}
|
||||
}
|
||||
|
||||
bool LoadParkFromFile(const utf8 * path)
|
||||
{
|
||||
log_verbose("TitleSequencePlayer::LoadParkFromFile(%s)", path);
|
||||
@@ -536,6 +547,9 @@ private:
|
||||
_lastScreenHeight = w->height;
|
||||
_viewCentreLocation.x = x;
|
||||
_viewCentreLocation.y = y;
|
||||
|
||||
// Stop following sprites
|
||||
w->viewport_target_sprite = SPRITE_INDEX_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user