Guard Bot Bullet?

Request patches for Keens 1-3.
Post Reply
User avatar
CommanderSpleen
Posts: 1017
Joined: Sun Aug 31, 2003 12:11 pm
Location: The Land of Sparkly Things
Contact:

Guard Bot Bullet?

Post by CommanderSpleen »

I don't see much in the Patch Index about modifying the speed and behaviour of the guard bot's bullet. Any ideas?
User avatar
CommanderSpleen
Posts: 1017
Joined: Sun Aug 31, 2003 12:11 pm
Location: The Land of Sparkly Things
Contact:

Post by CommanderSpleen »

Alrighty, based on the existing Keen shot patches, I've THINK I've figured out where this patch would fit.

Code: Select all

* Referenced by a CALL at Address:
|:0001.2002|

:0001.48DE 55                     push bp
:0001.48DF 8BEC                   mov bp, sp
:0001.48E1 56                     push si
:0001.48E2 E850E0                 call 2935
:0001.48E5 8BF0                   mov si, ax
:0001.48E7 C7040B00               mov word ptr [si], 000B
:0001.48EB 8B4606                 mov ax, [bp+06]
:0001.48EE 8B5604                 mov dx, [bp+04]
:0001.48F1 895404                 mov [si+04], dx
:0001.48F4 894406                 mov [si+06], ax
:0001.48F7 8B460A                 mov ax, [bp+0A]
:0001.48FA 8B5608                 mov dx, [bp+08]
:0001.48FD 81C20005               add dx, 0500
:0001.4901 150000                 adc ax, 0000
:0001.4904 895408                 mov [si+08], dx
:0001.4907 89440A                 mov [si+0A], ax
:0001.490A C744320848             mov word ptr [si+32], 4808
:0001.490F 8B460C                 mov ax, [bp+0C]
:0001.4912 894420                 mov [si+20], ax
:0001.4915 C74434004A             mov word ptr [si+34], 4A00
:0001.491A C744286D00             mov word ptr [si+28], 006D
:0001.491F 0BC0                   or ax, ax
It seems to me the last line, 0x4912, needs to be replaced with something like 'C744209001', which equates to 'mov word ptr [si+20], 0190'. Alas there are only three bytes with the existing code.
levellass
Posts: 3001
Joined: Wed Oct 11, 2006 12:03 pm
Location: Ngaruawahia New Zealand

Post by levellass »

Indeed, this has confused me for some time; there *must* be some way it gets told its speed, Keen's shot certainly does.
User avatar
CommanderSpleen
Posts: 1017
Joined: Sun Aug 31, 2003 12:11 pm
Location: The Land of Sparkly Things
Contact:

Post by CommanderSpleen »

Its speed is being set with the line 'mov [si+20], ax'. But there is a sequence of calculations prior that determine the value, which I don't entirely comprehend. However, it's possible to overwrite the line above it as well providing six bytes to play with.

Setting the speed value directly causes it to move in one direction only:

Code: Select all

#Set guard bot bullet speed (one way) -- 0x0030 in this example
%patch $490F $C7 $44 $20 $30 $00 $90
However, since I was actually looking for the vertical speed this solution works perfectly for me:

Code: Select all

#Guard bot shoots up or down (negative = up, positive = down)
#Replace $80 $FE with desired speed
%patch $490F $C7 $44 $22 $80 $FE $90
The two ax lines prior to that should be freed for further tweaking by this as well, I think.
Post Reply