Talk:Episode 58 - The Ruin of Roib

From KeenWiki
Jump to navigation Jump to search

Known bugs and how to fix them

The v3.0 beta still contains some bugs, including a nasty one in which any level containing the Super Duper enemy is prone to crashing.

To fix that particular bug, and possibly some others, open the ROIB.PAT file in a text editor and copy+paste the following text (written by K1n9 Duk3) into the line just before the very last line with the "%end" command. Then save the resulting file.

##############################################################################
# BUGFIXES - BUGFIXES - BUGFIXES - BUGFIXES - BUGFIXES - BUGFIXES - BUGFIXES #
##############################################################################

#fix bad jump address in KeenContact - contacting object type 17 (foot)
#is not supposed to end the level in this mod?
%patch $CCBC $158w

#fix bad jump address after spawning ground-based Roich in ScanInfoPlane
%patch $EAD0 $032Bw

#fix bad jump address after spawning the boss(?) in ScanInfoPlane
%patch $EB58 $02A3w

#fix bad jump table entries for ScanInfoPlane (info values 80-82)
%patch $EF23 $50Dw $50Dw $50Dw

#fix offset for calling the function to spawn speech bubble #4
%patch $F767 $1080086Erl

#restore messed up SD_PlaySound call in Dopefish/boss contact function
%patch $12408 $9A $187409F1rl

#convert far call in PlatformThink into a near jump (the old call jumps into the
#middle of another function, corrupting registers SI and DI on return)
%patch $117C7 $E9 $FD9Aw $90 $90

#fix bad function address for Slop's contact function in the initial state
%patch $3103A $2EE7421Frl

#turn bad function address into NULL pointer (the state SHOULD be unused anyway)
%patch $31B3A 0l

#turn crashed superduper's obclass into 'stunned object' when loading a game
%patch $6060
	$83 $3F $13		#	cmp	[bx], 13h
	$75 $08			#	jnz	skip
	$C7 $07 $0021w		#	mov	[bx], 21h
	$EB $EA			#	jmp	clear_temp3
	$90 $90			#	nop nop
#This overwrites the code that would clear the sprite pointers for the platform
#thrusters, but they don't exist in Roib, so it's safe to overwrite that code.
#Note that this doesn't fix the bug. It just allows you to load "corrupted"
#saves and continue playing from that point.

#make superduper change its obclass to 'stunned object' when it hits the ground
# new (near) subroutine to change state and obclass (si is obj, ax is new state)
%patch $11ED7			#seg012:04B7
	$50			#	push	ax
	$56			#	push	si
	$9A $09DC120Arl		#	call	ChangeState
	$83 $C4 $04		#	add	sp, 4
	$C7 $04 $0021w		#	mov	[si], 21h
	$C3			#	retn

# call new subroutine to change to crashed superduper state
%patch $12002
	$E8 $FED2w		#	call	SetStunnedState
	$90 $90 $90 $90		#	nop nop nop nop
	$90 $90 $90		#	nop nop nop
%patch $1206A
	$E8 $FE6Aw		#	call	SetStunnedState
	$90 $90 $90 $90		#	nop nop nop nop
	$90 $90 $90		#	nop nop nop
	

#------------------------------------
# restore some of the error messages
#------------------------------------

#RF_PlaceSprite: No free spots in spritearray!
%patch $2EF8F "RF_PlaceSprite: No free spots in spritearray!" 0
%patch $17C1B $011Fw

#RF_PlaceSprite: Placed an uncached sprite:
%patch $2EFBD "RF_PlaceSprite: Placed an uncached sprite:" 0
%patch $17C88 $014Dw