[Info] Black & White Effect - Tutorial
Select messages from
# through # FAQ
[/[Print]\]

DieHard Wolfers -> Code Crackers

#1: [Info] Black & White Effect - Tutorial Author: Guest PostPosted: Mon Jun 30, 2003 7:47 am
    —
Here's how to make the game black and white!
Place these in id_vl.c, overwriting the existing functions.
Please leave the attribution intact.

::: CODE :::

/* This variation by Steve "Usotsuki" Nickolas 2003.0629: auto-grayscale */
void VL_FillPalette (int r, int g, int b)
{
  int i;

  outportb (PEL_WRITE_ADR,0);
  for (i=0;i<256;i++)
  {
    unsigned long c;

    c=(r*6+g*7+b*3)/16; /* compute approximate logical grayscale */

    /* and blit to the VGA */
    outportb (PEL_DATA,c);
    outportb (PEL_DATA,c);
    outportb (PEL_DATA,c);
  }
}
::: CODE :::

/* This variation by Steve "Usotsuki" Nickolas 2003.0629: auto-grayscale */
void VL_SetColor (int a,int r,int g,int b)
{
  unsigned long c;

  c=(r*6+g*7+b*3)/16; /* compute approximate logical grayscale */
 
  /* and blit to the VGA */
  outportb (PEL_WRITE_ADR,a);
  outportb (PEL_DATA,c);
  outportb (PEL_DATA,c);
  outportb (PEL_DATA,c);
}
::: CODE :::

/* This variation by Steve "Usotsuki" Nickolas 2003.0627: auto-grayscale */
void VL_SetPalette (byte far *palette)
{
  int i;

  /* 256 colors */
  for (i=0;i<256;i++)
  {
    unsigned char r,g,b;
    unsigned int x;
    unsigned long c;

    x=i*3; /* current position in the array */

    /* take the color values */
    r=palette[x];
    g=palette[x+1];
    b=palette[x+2];

    c=(r*6+g*7+b*3)/16; /* compute approximate logical grayscale */

    /* and blit to the VGA */
    outportb(PEL_WRITE_ADR,i);
    outportb(PEL_DATA,(char)c); /* r */
    outportb(PEL_DATA,(char)c); /* g */
    outportb(PEL_DATA,(char)c); /* b */
  }
}


By WSJ!

#2: Re: Black and white effect - how to Author: MartinLocation: Wroclaw PostPosted: Mon Jun 30, 2003 9:52 am
    —
Man, this one looks nice.

Could you give some screenies?

#3: Re: Black and white effect - how to Author: Codetech84Location: Rauma - Finland PostPosted: Mon Jun 30, 2003 1:25 pm
    —
Cool. One modification would be required, setting the palette back to normal. -> The old palette would be saved and restored when called for

#4: Re: Black and white effect - how to Author: RipperLocation: Germany PostPosted: Mon Jun 30, 2003 3:21 pm
    —
Hmmm, this feature would be cool, if you're showing some "history" scenes in an intro Mr Green
Or perhaps the intro shows a scene in a monochrome camera's point of view. Or ingame monochrome cameras!
Woah, and there are so many other ideas running so fast through my mind, that I forgot all others Mr Green *runningfastaroundthenextcorner*

#5: Re: Black and white effect - how to Author: Codetech84Location: Rauma - Finland PostPosted: Mon Jul 14, 2003 11:42 am
    —
That's what I had in mind.

#6: Re: [Info] Black & White Effect - Tutorial Author: Guest PostPosted: Wed Feb 09, 2005 5:54 am
    —
Hey i`d like to use this tutorial but how can i make it so that it switches on and off inside the game.

Then do you have to modify it if you have texture floor/ceiling and shading?

Please answer

#7: Re: [Info] Black & White Effect - Tutorial Author: Zombie_PlanLocation: A hole in the wall PostPosted: Tue Mar 15, 2005 1:31 am
    —
flamer, did you work out the switch thing? I really want that Razz . Please post here!

#8: Re: [Info] Black & White Effect - Tutorial Author: Guest PostPosted: Tue Mar 15, 2005 5:39 am
    —
No i didn`t deathshead. Actually i forgot about this tutorial.

Maybe i`l talk a look at it in some dais

#9: Re: [Info] Black & White Effect - Tutorial Author: TexZKLocation: Northern Italy PostPosted: Thu Mar 17, 2005 12:23 pm
    —
Cool! I've never thought using a B/W palette!

#10: Re: [Info] Black & White Effect - Tutorial Author: WSJ PostPosted: Thu Mar 17, 2005 6:15 pm
    —
Guest wrote:
By WSJ!


What in the blazes... ??!? What? Question I didn't write this feature! I'm pretty sure Usotsuki did.

I wish I'd caught that before...

WSJ.

#11: Re: [Info] Black & White Effect - Tutorial Author: Dugtrio17Location: Seattle PostPosted: Thu Mar 17, 2005 6:24 pm
    —
You know, I saw that too... I didn't think you did it, especially because he wants you to leave the comments in your code, and the comments specifically say he did it.
Oh, if only we knew where Usotsuki went...



DieHard Wolfers -> Code Crackers


output generated using printer-friendly topic mod. All times are GMT

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group