Opened 21 years ago

Closed 21 years ago

Last modified 21 years ago

#1413 closed defect (fixed)

BS2: Cutscene problems in demo version

Reported by: Kirben Owned by: eriktorbjorn
Priority: high Component: Engine: Sword2
Version: Keywords:
Cc: Game: Broken Sword 2

Description

Latest ScummVM cvs version. English version of Broken Sword 2 demo Compiled under mingw with GCC 3.2.3 and running under Windows XP.

The Broken Sword 2 demo attempts to load the eye and intro cutscenes, even though they aren't part of demo.

The Broken Sword 2 demo crashes when it tries to play the final cutscene. The final cutscene (enddemo) uses a resolution of 640 x 480 which might be related. A gdb back trace: Program received signal SIGSEGV, Segmentation fault. 0x00544184 in Sword2::AnimationState::plotYUV(short*, int, int, unsigned char* const*) ( this=0x31fd6f0, lut=0xed13c0, width=640, height=480, dat=0x32343d0) at sword2/driver/animation.cpp:279 279 ptr[RENDERWIDE + linepos++] = lut[i + dat[0][width + ypos++]]; (gdb) bt #0 0x00544184 in Sword2::AnimationState::plotYUV (short*, int, int, unsigned char* const*) ( this=0x31fd6f0, lut=0xed13c0, width=640, height=480, dat=0x32343d0) at sword2/driver/animation.cpp:279 #1 0x0054441e in Sword2::AnimationState::decodeFrame() (this=0x31fd6f0) at sword2/driver/animation.cpp:375 #2 0x00544804 in Sword2::MoviePlayer::play(char const*, Sword2::MovieTextObject**, unsigned char*) (this=0x22f7a8, filename=0x22fbf0 "enddemo", text=0x0, musicOut=0x0) at sword2/driver/animation.cpp:501 #3 0x0053fcd1 in Sword2::Logic::fnPlaySequence(int*) (this=0x24c7f70, params=0x22fc80) at sword2/anims.cpp:679 #4 0x0052bd9a in Sword2::Logic::runScript(char*, char*, unsigned*) (this=0x24c7f70, scriptData=0x3ad307c "\t", objectData=0x372af40 "\003", offset=0x372af90) at sword2/interpreter.cpp:496 #5 0x00531e37 in Sword2::Logic::processSession() (this=0x24c7f70) at sword2/logic.cpp:138 #6 0x0051dcf3 in Sword2::Sword2Engine::gameCycle() (this=0x2408eb0) at sword2/sword2.cpp:276 #7 0x0051df98 in Sword2::Sword2Engine::go() (this=0x2408eb0) at sword2/sword2.cpp:385 #8 0x004066c6 in runGame(GameDetector&, OSystem*) (detector=@0x22ff28, system=0x23fbe80) at base/main.cpp:225 #9 0x00406aa1 in main (argc=2, argv=0x3f2510) at base/main.cpp:313

Ticket imported from: #884568. Ticket imported from: bugs/1413.

Change History (15)

comment:1 by eriktorbjorn, 21 years ago

Owner: set to SF/ender

comment:2 by eriktorbjorn, 21 years ago

The problem, I believe, is in plotYUV() in all its four incarnations. For each pixel in the frame it will do something like:

(x, y) = ... (x + 1, y + 1) = ... (x + 1, y) = ... (x + 2, y + 1) = ...

This looks strange to me. When I first looked at it I thought it was trying to plot a 2x2 square, but on a closer look that doesn't seem to be the case. Then again, I don't really understand what it's trying to do.

More seriously, if the frame fills the entire buffer (most of them don't), then it will plot outside the buffer.

Assigning to Ender, since he's the one who's been working on cutscenes.

comment:3 by eriktorbjorn, 21 years ago

Oh wait, I think I misread. Since it's post-increment, it will be

(x, y) = ... (x, y + 1) = ... (x + 1, y) = ... (x + 1, y + 1) = ...

after all. I think. The bit about writing outside the buffer still holds though.

comment:4 by eriktorbjorn, 21 years ago

The more I think about it, the less certain I get. It *shouldn't* write outside the buffer, as long as the width and height are even, should it?

Aw heck, I give up. Someone who actually has the files will have to track this one down. :-)

comment:5 by fingolfin, 21 years ago

Priority: normalhigh
Summary: BS2: Cutscene problems in demo verisonBS2: Cutscene problems in demo version

comment:6 by fingolfin, 21 years ago

Wouldn't valgrind help here?

comment:7 by SF/roever, 21 years ago

Sorry, when I implemented the cutscened I didn't check the demo, so I thought all the animations are 400 pixel high.

I've appended a patch that fixes the problem.

comment:8 by Kirben, 21 years ago

Resolution: fixed
Status: newclosed

comment:9 by Kirben, 21 years ago

Owner: SF/ender removed
Resolution: fixed
Status: closednew

comment:10 by Kirben, 21 years ago

The demo is now trying to load next scene, at the end of demo: Could not find 'Warehous.clu'

comment:11 by Kirben, 21 years ago

The Broken Sword 2 demo quits correctly by calling fnPlayCredits() but closeGame() seems to have no effect, since game loop continues. Also the current table for leadOut values is missing the two demo sequences (demo and enddemo)

comment:12 by Kirben, 21 years ago

Owner: set to eriktorbjorn

comment:13 by eriktorbjorn, 21 years ago

I don't have the demo installed currently, but perhaps the script never terminates? If so, it might help to return IR_STOP instead of IR_CONT after _vm->closeGame().

Do the other bugs actually cause any worse problems than warning messages? Nevertheless, feel free to add "demo" and "enddemo" to the list of known cutscenes - the only needed information is the number of frames.

comment:14 by Kirben, 21 years ago

Thanks that change worked and I added it to CVS. I just thought the 'Unknown movie' warning might confuse users, I added the two demo sequences to list of known cutscenes. I added a check to prevent demo trying to play other cutscenes too.

comment:15 by Kirben, 21 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.