Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#10857 closed defect (fixed)

QFG4: Pathfinding in forest 1S 1W from town, east entry

Reported by: tomasz89 Owned by: bluegr
Priority: normal Component: Engine: SCI
Version: Keywords: SCI32 has-pull-request
Cc: Game: Quest for Glory 4

Description

The room south of the town entrance has a pathing error when then going west (towards the castle). The path should take you straight west rather than going back and forth.

Attachments (6)

qfg4-cd-gog.017 (86.9 KB ) - added by tomasz89 5 years ago.
Polygons - Room 557.png (44.8 KB ) - added by Vhati 5 years ago.
Disasm (CD) - Script 50, forest init.txt (41.1 KB ) - added by Vhati 5 years ago.
Decomp (CD) - Script 50, forest init.txt (8.0 KB ) - added by Vhati 5 years ago.
Polygon - Room 557 Stream.png (41.2 KB ) - added by Vhati 5 years ago.
Polygon (Fixed) - Room 557 Stream.png (41.2 KB ) - added by Vhati 5 years ago.

Download all attachments as: .zip

Change History (16)

by tomasz89, 5 years ago

Attachment: qfg4-cd-gog.017 added

comment:1 by tomasz89, 5 years ago

Component: --Unset--Engine: SCI
Game: Quest for Glory 4

comment:2 by Vhati, 5 years ago

Room 557, 1S 1W from town entrance

  • Entering from east (563) is handled by enterRoomScr in script 50.

script 557 - rm557::init()

(self setRegions: 50)

That Room method invokes forest::init() in script 50, which schedules enterRoomScr on the room.

by Vhati, 5 years ago

Attachment: Polygons - Room 557.png added

comment:3 by Vhati, 5 years ago

I can reproduce this in both the CD and floppy editions under ScummVM.
It does not occur in the original interpreters.


QFG4 CD (English)

File - 5kb MD5 - Full MD5
RESOURCE.000 - 263dce4aa34c49d3ad29bec889007b1c - 1364ba69e3c0abb68cc0170650a56692
RESOURCE.AUD - c39521bffb1d8b19a57394866184a0ca - 71098b9e97e20c8941c0e4812d5f906f
RESOURCE.MAP - aba367f2102e81782d961b14fbe3d630 - 801a04cc6aa5d437681a2dd0b6545248
RESOURCE.SFX - 3cf95e09dab8b11d675e0537e18b499a - 7c858d7253f86dab4cc6066013c5ecec

QFG4 Floppy 1.1a + note patch (English)

File - 5kb MD5 - Full MD5
RESOURCE.000 - f64fd6aa3977939a86ff30783dd677e1 - ff42260a665995a85aeb277ad80aac8a
RESOURCE.MAP - d10a4cc177d2091d744e2ad8c049b0ae - 3695b1b0a1d15f3d324ea9f0cc325245
RESOURCE.SFX - 3cf95e09dab8b11d675e0537e18b499a - 7c858d7253f86dab4cc6066013c5ecec

comment:4 by Vhati, 5 years ago

Keywords: SCI32 added
Summary: QFG4 path west results in walking NW then SWQFG4: Pathfinding in forest 1S 1W from town, east entry

comment:5 by Vhati, 5 years ago

SCI Companion got confused, so I decompiled forest::init() by hand.
It was quite long and, as it turns out, not especially relevant to this bug.

The decompiled code and raw disasm from ScummVM are attached.
It's primarily concerned with random monster encounters.


script 50 - forest::init()

(switch myPrevRoomNum
# ...
	((g2_myCurrentRoom east?)
		(g0_hero posn: 335 136 setHeading: 270)
		(= loc1
			(-
				313
				(if g365_myFoeScriptNum 1 else 21)
			)
		)
		(= loc2 136)
		(g2_myCurrentRoom setScript: enterRoomScr)
	)
# ...
)


loc1 and loc2 are x,y coords that hero is sent to by enterRoomScr::changeState(1).

In this case, hero starts at (335,136) and is sent to (292,136).

Version 0, edited 5 years ago by Vhati (next)

by Vhati, 5 years ago

comment:6 by Vhati, 5 years ago

There's an unwalkable stream in the SE corner.
Entry coordinates were inside the edge of the stream's poly.

I shrank the poly by a couple pixels, and hero enters properly.

Last edited 5 years ago by Vhati (previous) (diff)

comment:7 by Vhati, 5 years ago

Keywords: has-pull-request added

Pull Request: SCI32: Fix QFG4 forest pathfinding

comment:8 by bluegr, 5 years ago

Owner: set to bluegr
Resolution: fixed
Status: newclosed

comment:9 by Filippos Karapetis <bluegr@…>, 5 years ago

In aac5ed1c:

SCI32: Fix QFG4 forest pathfinding

Adds workarounds for odd detours during entry, bugs #10857, #10858

comment:10 by tomasz89, 5 years ago

Confirmed fixed.

Note: See TracTickets for help on using tickets.