Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Colorsystem utilities, and 2mas update!

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> The Soapbox
View previous topic :: View next topic  
Author Message
NeoTA
Idiomatic Nomenclature




Joined: 15 Mar 2004
Posts: 165

PostPosted: Fri Feb 25, 2005 1:12 am    Post subject: Colorsystem utilities, and 2mas update! Reply with quote

Among other things, these allow you to pack a color into a single integer, so you e. g. can write:
Bright Red := 3840

or
Bright Red := pack color(0,0,15)


and then later change a master palette color to bright red using
set palette color(index, Bright Red)
.

http://neota.castleparadox.com/amiga.hsi
http://neota.castleparadox.com/snes.hsi

they each include a demo script, commented out at the bottom, which looks like this:
Code:

define script (1, main test, none)

# this test displays the result of packing white (15,15,15) , then fades color #0 from black to white slowly, using the amiga palette-setter
# this effectively alters the border color of the screen.

script, main test, begin
    # debug it
    show value( pack color( 15, 15, 15)) # same as show value(4095)
   
    wait(15)
    set palette color( 0, pack color( 0, 0, 0 )) # same as set palette color (0, 0)
    update palette
    wait(15)
    set palette color( 0, pack color( 2, 2, 2 )) # same as set palette color (0, 546)
    update palette
    wait(15)
    set palette color( 0, pack color( 4, 4, 4 )) # so, you can calculate these values beforehand
    update palette
    wait(15)
    set palette color( 0, pack color( 6, 6, 6 )) # or assign them to a global variable
    update palette
    wait(15)
    set palette color( 0, pack color( 8, 8, 8 )) # like "BrightRed := 3840"
    update palette
    wait(15)
    set palette color( 0, pack color(10,10,10 )) # or "BrightRed := pack color(0,0,15)
    update palette
    wait(15)
    set palette color( 0, pack color(12,12,12 ))
    update palette
    wait(15)
    set palette color( 0, pack color(14,14,14 ))
    update palette
    wait(15)
    set palette color( 0, pack color(15,15,15 ))
    update palette
end



I also updated 2mas -- it now outputs optional code using one of the above two libraries.
This reduces general script size to <33% of the standard code's size, so much less risk of script-buffer overflow.

fyrewulff compiled an updated 2mas.exe and i packaged it up and sent it to james, so the updated 2mas.zip should be on hamsterrepublic sometime soon.

here is an overview of amiga.hsi or snes.hsi's functionality:
Code:

#  convert RGB values vga<->(amiga or snes)
#  read and write colors from the palette, in packed (amiga or snes) format
#  pack an (amiga or snes) RGB triplet into an integer
#  extract part of a packed color (UNTESTED)
#


the only price you pay for this convenience is decreased color precision:
the OHRRPGCE's 'native' color space uses the range 0..63 for RGB values;
for snes, rgb values range from 0..31;
for amiga, they range 0..15.

here is what the 2mas readme says about these colorspaces:

HSS output gives three sections, VGA, SNES, and AMIGA.
You can only use one of these colorsetting-modes.
Erase the other two sections from the HSS file.
You may need either snes.hss or amiga.hss depending on your choice of colorspaces.

colorspace overview:

VGA: OHR native. 0-63 range for RGB components.
Colors can't be packed and stored in a global variable.
Script is long (769 commands to change the entire 256 colors in the master palette)
maximum color precision

SNES: Same colorsystem as SNES. 0-31 range for RGB components.
You need snes.hss to use this.
Colors can be packed and stored in global variables (eg "BrightRed := 31744").
you can precalculate them, see part 6
Script is short (257 commands to change entire master palette).
Half of maximum color precision.

Amiga: Same colorspace as Amiga. 0-15 range for RGB components.
You need amiga.hss to use this.
Colors can be packed and stored in global variables (eg "BrightRed := 3840").
You can precalculate them, see part 6.
you can also easily take them from your paint program if it displays
the hex code for the color (eg #FFE0D4) : just take out every second digit, so
you are left with #FED in my example. convert that hex number to decimal, and
you have a number you can use (the decimal equiv of my example FED is 4077).

Script is short (257 commands to change entire master palette).
Quarter of maximum color precision. I use this colorspace for most of my own
graphics, as i find it about right -- i can get the color i want, without having
to choose between too many possibles.


Last edited by NeoTA on Sat Feb 26, 2005 2:26 am; edited 1 time in total
Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri Feb 25, 2005 8:27 pm    Post subject: Reply with quote

Actually, that's neat. I'll save this, and will probably end up using it.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
NeoTA
Idiomatic Nomenclature




Joined: 15 Mar 2004
Posts: 165

PostPosted: Sat Feb 26, 2005 2:27 am    Post subject: Reply with quote

okay, updated with a more thorough info, and the updated-2mas-zipfile is now pending addition to HRP.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> The Soapbox All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group