Opened 15 months ago

Closed 14 months ago

Last modified 14 months ago

#14616 closed defect (fixed)

SCUMM: FT: Crash with Assertion Fail when riding the bike for the first time

Reported by: antoniou79 Owned by: AndywinXp
Priority: normal Component: Engine: SCUMM
Version: Keywords: crash, acos, assertion
Cc: Game: Full Throttle

Description

This happens on current build from master HEAD, 2.8.0git, with the classic version of Full Throttle, as extracted from the Remastered version (GOG or Steam). Tested on Windows 10 x64.

The bug does not occur with ScummVM 2.7.1.

This version is detected by ScummVM as "Full Throttle (Version B/English)"

Steps to reproduce:

  • Start a new game, skip the cutscene (optional)
  • Exit the dumpster, go right and kick the door to enter the bar
  • Grab the barkeeper to get the bike keys
  • Exit the bar and "grab" the bike

What happens:

  • The cutscene with Ben riding his bike starts, he says his "When I'm on the road..." lines but when the cutscene should switch to the encounter with another biker, ScummVM crashes with the message "Assertion failed: _akos, file engines/scumm/akos.cpp, line 83"

What should happen:

  • ScummVM should transition to the scene where Ben encounters another biker on the road, and they talk for a bit and then fight.

Attachments (1)

ft.s02 (25.0 KB ) - added by antoniou79 15 months ago.

Download all attachments as: .zip

Change History (9)

by antoniou79, 15 months ago

Attachment: ft.s02 added

comment:1 by antoniou79, 15 months ago

Update: The issue affects The Dig as well.
The crash, with an identical error message, occurs when, after a new game starts and the gameplay begins, you message Miles to release the P.I.G.

I have not tested with other SCUMM games, so others could be affected.

comment:2 by PushmePullyu, 15 months ago

This seems to be a regression introduced by commit 8a54e258a5aeac082ebb3a444d0c57138b6694f0 "SCUMM: (SCUMM7/8) - fix actor turning animation"

I only tested with The Dig, but here the cause is trying to load a costume with index 0 via hasManyDirections(int):

in engines/scumm/actor.cpp:1522
in void Actor::setDirection(int direction):

// Normalize the angle
_facing = normalizeAngle(_vm->_costumeLoader->hasManyDirections(_costume), direction);

Running with --debugflags=RESOURCE produces these messages:

ensureResourceLoaded(Costume,0)
getResourceAddress(Costume,0) == NULL

I am not familiar with the engine, maybe something like this could be done
(not sure whether it should default to returning false or true):

diff --git a/engines/scumm/akos.h b/engines/scumm/akos.h
index e17d922791c..855f2a3fcad 100644
--- a/engines/scumm/akos.h
+++ b/engines/scumm/akos.h
@@ -48,6 +48,8 @@ public:
 
        //void animateLimb(int limb, int f);
        bool hasManyDirections(int id) override {
+               if (id == 0)
+                       return false;
                loadCostume(id);
                return hasManyDirections();
        }

comment:3 by eriktorbjorn, 15 months ago

I got something similar in Putt-Putt Joins the Parade, just from walking (driving?) around the town randomly.

scummvm: engines/scumm/akos.cpp:84: virtual void Scumm::AkosCostumeLoader::loadCostume(int): Assertion `_akos' failed.

Edit: I was able to capture a crash while running ScummVM under GDB. It's the same thing as above: hasManyDirections() is called by Actor::setDirection() while _costume is 0. Something calls setActorCostume(0), but I'm not sure exactly what.

Last edited 15 months ago by eriktorbjorn (previous) (diff)

comment:4 by eriktorbjorn, 15 months ago

I tried bisecting the Full Throttle crash (before hearing that someone else already might have done so), and landed on this commit:

8a54e258a5aeac082ebb3a444d0c57138b6694f0 is the first bad commit
commit 8a54e258a5aeac082ebb3a444d0c57138b6694f0
Author: athrxx <athrxx@scummvm.org>
Date:   Sun Aug 27 02:08:52 2023 +0200

    SCUMM: (SCUMM7/8) - fix actor turning animation
    
    The turning interpolation was completely disabled for v7/8, since it
    interfered with DIG walk scripts. The result was that DIG was the only
    v7/8 game that still had (script controlled) turning animations. COMI
    and FT don't use walk scripts. So the actors would just flip directly from
    the current facing direction to the target facing.
    
    I have now changed parts of the walking code (and some other parts)
    to better match the original v7/8 code.

 engines/scumm/actor.cpp      | 342 +++++++++++++++++++++----------------------
 engines/scumm/actor.h        |  17 ++-
 engines/scumm/akos.h         |   2 +-
 engines/scumm/base-costume.h |   2 +-
 engines/scumm/script_v6.cpp  |   4 +-
 engines/scumm/script_v8.cpp  |   4 +-
 engines/scumm/scumm.cpp      |   2 +
 engines/scumm/util.cpp       |   6 +-
 engines/scumm/util.h         |   2 +-
 9 files changed, 200 insertions(+), 181 deletions(-)

Does that make sense?

comment:5 by AndywinXp, 14 months ago

Owner: set to AndywinXp
Resolution: fixed
Status: newpending

Hi! I have pushed the fix proposed by PushmePullyu; thanks for that.

Let me know if everything now works for you.

comment:6 by antoniou79, 14 months ago

The crashes in Full Throttle and The Dig are fixed with this new commit.

I haven't tested much further, although I do intend to. This basically started with me trying to progress Full Throttle enough so that I can have a saved game before you're able to play the knife game on the bar table, which reportedly may not work on (previous versions? current?) Android port.

If I notice any other issues I'll open a new report.

comment:7 by AndywinXp, 14 months ago

Status: pendingclosed

Great! I think we can close this and when athrxx comes back we can check if the fix is 100% correct...

comment:8 by athrxx, 14 months ago

I have modified the fix a bit, based on original code analysis. It works for the FT bike ride scene and the DIG pig release scene, but I haven't checked any of the other scenarios where the bug could occur (basically whenever a script would call setDirection without setting a valid costume first).

Note: See TracTickets for help on using tickets.