PATCH: Change color palette in Keen 1

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

PATCH: Change color palette in Keen 1

Post by adurdin »

This patch shows how to change the default 16 color palette to a different set of 16 colors. Each color is specified with three values in the range 0 to 63, one for red, one for green, and one for blue. This sample patch sets the colors to pastel-like shades, but you can change the 16 colors as you want.

Note: If you want to use this patch along with the "Change 'background' tiles" patch, then you must get rid of the last patch statement in this patch file, the one that patches at offset $4409.

Code: Select all

%ext ck1
%version 1.31

# This is the color palette: 16 entries of r, g, b (each 0-63)
%patch $13054
       05 05 00
       14 17 28
       21 28 14
       14 28 28
       28 24 14
       26 20 28
       28 28 20
       20 22 28
       11 12 16
       31 00 63
       39 63 31
       31 63 47
       63 39 31
       55 31 63
       58 63 45
       45 49 63

# Set the palette when we go into graphics mode
%patch $6E46  $E8 $D3 $D5 $90 $90

# Code to set graphics mode and set the palette
%patch $441C                  $B8 $0D $00 $CD
              $10 $B8 $12 $10 $B9 $08 $00 $BB
              $00 $00 $8C $DA $8E $C2 $BA $04
              $00 $CD $10 $BB $18 $00 $BA $1C
              $00 $CD $10 $C3

# Include this part if the "Change background tiles" patch is not used
# It gives us 36 spare bytes for the palette-setting code
%patch $4409      $B8 $14 $01 $26 $81 $3F $31
              $01 $73 $03 $B8 $8F $00 $26 $89
              $07 $E9 $5C $01

%end
A similar patch could be made for Keen 2 and 3, but I don't have time to do it at the moment.
KeenRush
Patch Maker
Posts: 1988
Joined: Sun Aug 31, 2003 2:52 pm
Location: Sand Yego
Contact:

Post by KeenRush »

Hmmm, pretty cool! :)
Oh, and will the user just use modkeen normally, export and import? Or do he/she need to change palette of those bmps too?
User avatar
adurdin
Site Founder
Posts: 549
Joined: Fri Aug 29, 2003 11:27 pm
Location: Edinburgh, Scotland
Contact:

Post by adurdin »

You can change the palette of the bitmaps if you want, so that you when editing them what they'll look like in the game; but you won't need to.
xtraverse
Patch Crafter
Posts: 290
Joined: Tue Sep 02, 2003 6:42 pm
Location: Easter Island
Contact:

..

Post by xtraverse »

Ok now you've surpassed deity..I've been wondering how to do this for years.
User avatar
adurdin
Site Founder
Posts: 549
Joined: Fri Aug 29, 2003 11:27 pm
Location: Edinburgh, Scotland
Contact:

Post by adurdin »

The tricky part with these patches is actually finding somewhere to fit the code in... fitting data (the palette) in is even harder. In the end, I overwrote the Turbo C++ copyright statement, and the three fatal error messages ("Null pointer assignment", "Divide error", "Abnormal program termination") with the palette data. So if for some reason one of these errors occurs, you'll end up with a garbled error message. But I figured it was a worthwhile trade-off.

Now, go show me what you can do with these patches -- they're useless, else. :)
KeenRush
Patch Maker
Posts: 1988
Joined: Sun Aug 31, 2003 2:52 pm
Location: Sand Yego
Contact:

Post by KeenRush »

Now, go show me what you can do with these patches -- they're useless, else. :)
I will, but later. :) That's prefect.
User avatar
Zorath
Posts: 17
Joined: Sun Aug 31, 2003 6:48 pm
Location: Finland
Contact:

Post by Zorath »

Here's the default palette, if someone wants to change just a few of the colors:

Code: Select all

...

%patch $13054 
       00 00 00 # black
       00 00 42 # blue
       00 42 00 # green
       00 42 42 # cyan
       42 00 00 # red
       42 00 42 # magenta
       42 21 00 # brown
       42 42 42 # bright gray
       21 21 21 # gray
       21 21 63 # bright blue
       21 63 21 # bright green
       21 63 63 # bright cyan
       63 21 21 # bright red
       63 21 63 # pink
       63 63 21 # yellow
       63 63 63 # white

...
KeenRush
Patch Maker
Posts: 1988
Joined: Sun Aug 31, 2003 2:52 pm
Location: Sand Yego
Contact:

Post by KeenRush »

Good job Z. :)
User avatar
CheesyDave
Posts: 19
Joined: Mon Sep 15, 2003 4:07 pm
Location: San Diego
Contact:

:: kick ::

Post by CheesyDave »

^^; i'd just like to drudge this to the top and request that a similar patch be written for keen2 and keen3. <.< >.> not that i'm making a ck2 or ck3 mod. ><; not at all! ... ::cough:: =) yea, so if mr. durdin or someone could find a place in the code to smush this in, i'd really appreciate it~
User avatar
Retodon8
Posts: 10
Joined: Tue Aug 10, 2004 9:35 pm
Location: Retodon8.net
Contact:

Colour table

Post by Retodon8 »

I created a table with the default colours in the right (Keen) order, which might be useful for someone.
I decided to use the default EGA naming convention (meaning these names differ from Zorath's list), since most colours are pretty close.

http://retodon8.net/Keen.html#Tech
07-07-2005 edit: In case anybody's interested, the above link no longer works; it is now located at:
http://retodon8.net/Keen/index.php#Tech

Since I'm replying anyway, I'll mention I'd love to see a similar patch for Keen 4, 5, and 6, since I'd rather create something with those than the original trilogy.
Thanks if you can figure that out sometime, and thanks for doing the Keen 1 patch already!

02-09-2004 edit: I created a thread in the proper forum to request the above:
viewtopic.php?t=368
Last edited by Retodon8 on Thu Jul 07, 2005 9:49 pm, edited 2 times in total.
KeenRush
Patch Maker
Posts: 1988
Joined: Sun Aug 31, 2003 2:52 pm
Location: Sand Yego
Contact:

Post by KeenRush »

Nice. Yeah, ones for the 'new' Keens would be cool as well.
Post Reply