PATCH: Changing the status window

Completed patches for Keen1.
User avatar
adurdin
Site Founder
Posts: 549
Joined: Fri Aug 29, 2003 11:27 pm
Location: Edinburgh, Scotland
Contact:

PATCH: Changing the status window

Post by adurdin »

The following patch allows you to change the layout of the status window in Keen 1:

Code: Select all

%ext ck1
%version 1.31

# leaves 227 spare bytes at CS:10D1
# leaves 164 spare bytes at DS:1E02 ($14E52)

# Patch in the long-integer drawing function
%patch $11B4                   $55 $89 $E5 $B8 $0A $00 $50 $B8 $90 $82 $50 $FF
               $76 $06 $FF $76 $04 $E8 $03 $C2 $83 $C4 $08 $B8 $90 $82 $50 $E8
               $A5 $C5 $44 $44 $8B $56 $08 $29 $C2 $89 $16 $82 $82 $8B $46 $0A
               $A3 $F8 $82 $B8 $90 $82 $50 $E8 $E8 $50 $44 $44 $89 $EC $5D $C3

# Patch in the name of the status dialog text file
%patch $13084  "STATUS.CK1" $00

# Patch in the code to draw the status text (coordinates are measure in characters--8 pixel blocks)
%patch $0E6A                                           $B8 $00 $3D $BA $34 $00   # Show status window (0E6A)
               $CD $21 $89 $C3 $BF $27 $00 $C6 $06 $9A $82 $00 $B9 $0A $00 $BA
               $90 $82 $B4 $3F $CD $21 $53 $B8 $90 $82 $50 $E8 $2E $97 $44 $44
               $5B $4F $75 $E8 $B4 $3E $CD $21
                                               $8B $46 $FE $05 $01 $00 $50 $89   # Show score (0E98)
               $F0 $05 $0A $00 $50 $FF $36 $CC $AA $FF $36 $CA $AA $E8 $04 $03
               $83 $C4 $08
                           $8B $46 $FE $05 $01 $00 $50 $89 $F0 $05 $1A $00 $50   # Show extra Keen score (0EB3)
               $A1 $C4 $6E $8B $16 $C2 $6E $81 $C2 $20 $4E $15 $00 $00 $50 $52
               $E8 $E1 $02 $83 $C4 $08
                                       $31 $FF $3B $3E $C6 $AA $7D $29 $83 $FF   # Show Keens (0ED6)
               $06 $7D $24 $B8 $00 $00 $50 $8B $46 $FE $05 $03 $00 $B1 $03 $D3
               $E0 $90 $90 $50 $89 $F8 $D1 $E0 $05 $01 $00 $01 $F0 $50 $E8 $2C
               $AC $83 $C4 $06 $47 $EB $D1
%patch $0F07                               $B8 $41 $01 $83 $3E $94 $AA $00 $74   # Draw the joystick
               $03 $B8 $C0 $01 $50 $8B $46 $FE $05 $03 $00 $B1 $03 $D3 $E0 $05
               $04 $00 $50 $89 $F0 $05 $10 $00 $50 $E8 $0D $AA $83 $C4 $06
                                                                           $B8   # Draw the battery
               $42 $01 $83 $3E $9C $AA $00 $74 $03 $B8 $C1 $01 $50 $8B $46 $FE
               $05 $03 $00 $B1 $03 $D3 $E0 $05 $04 $00 $50 $89 $F0 $05 $13 $00
               $50 $E8 $E5 $A9 $83 $C4 $06
                                           $B8 $43 $01 $83 $3E $96 $AA $00 $74   # Draw the vacuum
               $03 $B8 $C2 $01 $50 $8B $46 $FE $05 $03 $00 $B1 $03 $D3 $E0 $05
               $04 $00 $50 $89 $F0 $05 $16 $00 $50 $E8 $BD $A9 $83 $C4 $06
                                                                           $B8   # Draw the whiskey
               $44 $01 $83 $3E $98 $AA $00 $74 $03 $B8 $C3 $01 $50 $8B $46 $FE
               $05 $03 $00 $B1 $03 $D3 $E0 $05 $04 $00 $50 $89 $F0 $05 $19 $00
               $50 $E8 $95 $A9 $83 $C4 $06
%patch $0FA7                               $B8 $0B $00 $83 $3E $9E $AA $00 $74   # Keycard A
               $03 $B8 $A8 $01 $50 $8B $46 $FE $05 $07 $00 $B1 $03 $D3 $E0 $05
               $04 $00 $50 $89 $F0 $05 $13 $00 $50 $E8 $6D $A9 $83 $C4 $06
                                                                           $B8   # Keycard B
               $0B $00 $83 $3E $A0 $AA $00 $74 $03 $B8 $A9 $01 $50 $8B $46 $FE
               $05 $07 $00 $B1 $03 $D3 $E0 $05 $04 $00 $50 $89 $F0 $05 $17 $00
               $50 $E8 $45 $A9 $83 $C4 $06
                                           $B8 $0B $00 $83 $3E $A2 $AA $00 $74   # Keycard C
               $03 $B8 $AA $01 $50 $8B $46 $FE $05 $09 $00 $B1 $03 $D3 $E0 $05
               $04 $00 $50 $89 $F0 $05 $13 $00 $50 $E8 $1D $A9 $83 $C4 $06
                                                                           $B8   # Keycard D
               $0B $00 $83 $3E $A4 $AA $00 $74 $03 $B8 $AB $01 $50 $8B $46 $FE
               $05 $09 $00 $B1 $03 $D3 $E0 $05 $04 $00 $50 $89 $F0 $05 $17 $00
               $50 $E8 $F5 $A8 $83 $C4 $06
%patch $1047                               $B8 $0B $00 $83 $3E $9A $AA $00 $74   # Pogo stick
               $03 $B8 $9F $01 $50 $8B $46 $FE $05 $08 $00 $B1 $03 $D3 $E0 $05
               $04 $00 $50 $89 $F0 $05 $0B $00 $50 $E8 $CD $A8 $83 $C4 $06
                                                                           $8B   # Draw ammo
               $46 $FE $05 $0B $00 $50 $89 $F0 $05 $06 $00 $50 $31 $C0 $50 $FF
               $36 $C8 $AA $E8 $2E $01 $83 $C4 $08
                                                   $B8 $9E $01 $50 $8B $46 $FE   # Draw raygun (replace first two bytes
               $05 $07 $00 $B1 $03 $D3 $E0 $05 $04 $00 $50 $89 $F0 $05 $03 $00   # with $EB $1C if you don't want to
               $50 $E8 $95 $A8 $83 $C4 $06                                       # draw the raygun on the status screen)

                                           $E8 $90 $4B $31 $C0 $50 $E8 $1E $AD   # Wait for a key, then return
               $44 $44 $E8 $81 $A6 $E8 $D1 $F1 $E8 $CE $F1 $E8 $7C $4B $8B $46
               $FC $8B $56 $FA $89 $16 $35 $51 $A3 $37 $51 $5F $5E $89 $EC $5D
               $C3
%end

In order to use this patch, you must create a STATUS.CK1 file which contains the desired layout of the status screen. Click on the above link to see an example.

This Word document contains an annotated version of the patch above, which describes which parts you can change to rearrange the layout of the status window.
Last edited by adurdin on Mon Aug 16, 2004 7:03 am, edited 1 time in total.
User avatar
adurdin
Site Founder
Posts: 549
Joined: Fri Aug 29, 2003 11:27 pm
Location: Edinburgh, Scotland
Contact:

Post by adurdin »

The most useful thing about this patch, in my opinion, is that it frees up 227 bytes for code, and 164 bytes for data. There's a lot that can be done with that. And *anyone* can use this patch as-is, because it's currently set up to duplicate the normal status screen.
Ilsoap
Posts: 197
Joined: Tue Sep 02, 2003 4:04 am
Location: Canada
Contact:

Post by Ilsoap »

This was made in response to my request about changing around the status screen. Adurdin made a custom patch for Lego Keen that works wonderfully... just wanted to publicly thank you for that.
xtraverse
Patch Crafter
Posts: 290
Joined: Tue Sep 02, 2003 6:42 pm
Location: Easter Island
Contact:

..

Post by xtraverse »

Awesome! This is definitely something to add to the Patchotron!

edit: shouldn't "%patch $13084 "STATUS.CK1" $00 " be changed to "%patchfile $13084 "STATUS.CK1" $00 "? or has the syntax changed to patch in a file?
User avatar
adurdin
Site Founder
Posts: 549
Joined: Fri Aug 29, 2003 11:27 pm
Location: Edinburgh, Scotland
Contact:

Post by adurdin »

No, no -- that line is not attempting to patch in a file; rather it is patching in the zero-terminated string "STATUS.CK1".
KeenRush
Patch Maker
Posts: 1988
Joined: Sun Aug 31, 2003 2:52 pm
Location: Sand Yego
Contact:

Post by KeenRush »

Wheee! This is hot, I'll try this later today! Cheerio!
xtraverse
Patch Crafter
Posts: 290
Joined: Tue Sep 02, 2003 6:42 pm
Location: Easter Island
Contact:

...

Post by xtraverse »

So adurdin, I'm assuming you have code in there that tells Keen to read some data from an external file, and that is the reason there's extra space?

Does this mean that we can pull the sound data, helptext, storytext, etc out of Keens 2 and 3, which would not only free up space but also allow any length for these files?
User avatar
ckguy
Posts: 465
Joined: Tue Oct 14, 2003 11:20 am
Location: Wakefield, RI, US
Contact:

Wow!

Post by ckguy »

Woah! Cool idea Xtra!
User avatar
adurdin
Site Founder
Posts: 549
Joined: Fri Aug 29, 2003 11:27 pm
Location: Edinburgh, Scotland
Contact:

Re: ...

Post by adurdin »

xtraverse wrote:So adurdin, I'm assuming you have code in there that tells Keen to read some data from an external file, and that is the reason there's extra space?
That's correct.
Does this mean that we can pull the sound data, helptext, storytext, etc out of Keens 2 and 3, which would not only free up space but also allow any length for these files?
Free up space? Possibly -- it'd all depend on how they were added in. I'd say the answer is probably no, but possibly yes. As for doing the same to allow any length (within reason) for these files, that'd be more likely, though much harder than the status screen thing was.
User avatar
ckguy
Posts: 465
Joined: Tue Oct 14, 2003 11:20 am
Location: Wakefield, RI, US
Contact:

Post by ckguy »

Something I noticed about this patch is that you can't put STATUS.CK1 in a subdirectory of Keen1, like you would other files necessary for mods (ie egalatch.ck1, level??.ck1) as these can be redirected by CK1PATCH.EXE. Two possible solutions:
  1. Change CKxPATCH.EXE to allow redirection of any file.
  2. Allow specification of a path in the string "STATUS.CK1". If there was enough room in the executable there, would Keen1.exe balk at the specification of a path?
KeenRush
Patch Maker
Posts: 1988
Joined: Sun Aug 31, 2003 2:52 pm
Location: Sand Yego
Contact:

Post by KeenRush »

Why they should be in a subdirectory? :)
User avatar
ckguy
Posts: 465
Joined: Tue Oct 14, 2003 11:20 am
Location: Wakefield, RI, US
Contact:

Post by ckguy »

Well, with the new commands in CKxPATCH 0.9.0, you can just put all of the files for a mod in a subdirectory of Keen, instead of having a copy of Keen for every single mod on your computer.
KeenRush
Patch Maker
Posts: 1988
Joined: Sun Aug 31, 2003 2:52 pm
Location: Sand Yego
Contact:

Post by KeenRush »

But Keen doesn't take so much space, and you can always deleted the old ones (I mean ones with mod installed). At the moment only Keen mod installed on my computer is my own. :) I delete after playing, and reinstall when I try again.
User avatar
MultiMania
Patch Master
Posts: 153
Joined: Mon Nov 24, 2003 3:09 am
Location: Deep in the heart of keen.
Contact:

Status Patch

Post by MultiMania »

If you could make the tileinfo a seperate file then the tileinfo could be increased. More tiles would make mods heaps better.

Cool eh? :lol
User avatar
XkyRauh
Posts: 1114
Joined: Sun Aug 31, 2003 9:14 pm
Location: San Diego, California

re: STATUS.CK1

Post by XkyRauh »

If anybody's having problems with this... I recommend you download Lego Keen and study it intensely (after playing it, of course!!)

--Xky :-)
Post Reply