mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-10-10 00:08:23 +03:00
PartsEngine: clamp passed_time to 0 in PE_UpdateComponent
After loading a save, the game script may give a negative passed_time because it computes the delta time using an absolute system.GetTime() value stored in the save data. This fixes hang on load in Rance 9. This also removes the equivalent workaround in parts_render_update for Rance 01, since the new clamp covers that case as well.
This commit is contained in:
@@ -1120,6 +1120,11 @@ static void parts_update_component(struct parts *parts)
|
||||
|
||||
void PE_UpdateComponent(possibly_unused int passed_time)
|
||||
{
|
||||
// After loading a save, the game script may compute a negative time delta
|
||||
// because it stores an absolute system.GetTime() value in the save data,
|
||||
// which is meaningless across process restarts.
|
||||
if (passed_time < 0)
|
||||
passed_time = 0;
|
||||
while (!TAILQ_EMPTY(&dirty_list)) {
|
||||
// pop parts object from dirty list
|
||||
struct parts *parts = TAILQ_FIRST(&dirty_list);
|
||||
|
||||
@@ -634,12 +634,6 @@ static bool pe_dirty = false;
|
||||
|
||||
void parts_render_update(int passed_time)
|
||||
{
|
||||
// XXX: hack for Rance 01 load issue
|
||||
// There is a bug in Rance 01 where a single bad frame is displayed after
|
||||
// loading a save. When this happens, the game passes a negative time delta
|
||||
// to PE_Update. We fix this issue by ignoring such calls.
|
||||
if (passed_time < 0)
|
||||
return;
|
||||
if (pe_dirty) {
|
||||
struct parts *p;
|
||||
PARTS_LIST_FOREACH(p) {
|
||||
|
||||
Reference in New Issue
Block a user