svgalib support

This commit is contained in:
Bradley Bell 2001-01-22 12:51:49 +00:00
parent bc6671b183
commit 82f5791668
5 changed files with 944 additions and 0 deletions

17
arch/svgalib_init.c Normal file
View file

@ -0,0 +1,17 @@
/* SVGALib initialization */
#include <conf.h>
#ifdef __SVGALIB__
#include "args.h"
extern void d_mouse_init();
void arch_svgalib_init()
{
if (!args_find("-nomouse"))
d_mouse_init();
}
#endif /* __SVGALIB__ */

31
input/svgalib_event.c Normal file
View file

@ -0,0 +1,31 @@
/* SVGALib Event related stuff */
#include <conf.h>
#ifdef SVGALIB_INPUT
#include <stdio.h>
#include <stdlib.h>
#include <vgakeyboard.h>
#include <vgamouse.h>
void key_handler(int scancode, int press);
//added on 10/17/98 by Hans de Goede for mouse functionality
//extern void mouse_button_handler(SDL_MouseButtonEvent *mbe);
//extern void mouse_motion_handler(SDL_MouseMotionEvent *mme);
//end this section addition - Hans
void event_poll()
{
keyboard_update();
mouse_update();
}
/*int event_init()
{
initialised = 1;
return 0;
}*/
#endif /* SVGALIB_INPUT */

368
input/svgalib_key.c Normal file
View file

@ -0,0 +1,368 @@
/* SVGALib keyboard input support */
#include <conf.h>
#ifdef SVGALIB_INPUT
#include <stdio.h>
#include <stdlib.h>
#include <vgakeyboard.h>
#include "event.h"
#include "error.h"
#include "key.h"
#include "timer.h"
//added on 9/3/98 by Matt Mueller to free some cpu instead of hogging during menus and such
#include "d_delay.h"
//end this section addition - Matt Mueller
#define KEY_BUFFER_SIZE 16
static unsigned char Installed = 0;
//-------- Variable accessed by outside functions ---------
unsigned char keyd_buffer_type; // 0=No buffer, 1=buffer ASCII, 2=buffer scans
unsigned char keyd_repeat;
unsigned char keyd_editor_mode;
volatile unsigned char keyd_last_pressed;
volatile unsigned char keyd_last_released;
volatile unsigned char keyd_pressed[256];
volatile int keyd_time_when_last_pressed;
typedef struct Key_info {
ubyte state; // state of key 1 == down, 0 == up
ubyte last_state; // previous state of key
int counter; // incremented each time key is down in handler
fix timewentdown; // simple counter incremented each time in interrupt and key is down
fix timehelddown; // counter to tell how long key is down -- gets reset to 0 by key routines
ubyte downcount; // number of key counts key was down
ubyte upcount; // number of times key was released
} Key_info;
typedef struct keyboard {
unsigned short keybuffer[KEY_BUFFER_SIZE];
Key_info keys[256];
fix time_pressed[KEY_BUFFER_SIZE];
unsigned int keyhead, keytail;
} keyboard;
static /*volatile*/ keyboard key_data;
char *key_text[256];
unsigned char ascii_table[128] =
{ 255, 255, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=',255,255,
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 255, 255,
'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', 39, '`',
255, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 255,'*',
255, ' ', 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,255,255,
255, 255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255 };
unsigned char shifted_ascii_table[128] =
{ 255, 255, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+',255,255,
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', 255, 255,
'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~',
255, '|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', 255,255,
255, ' ', 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,255,255,
255, 255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255 };
//killed on 10/03/98 by Matt Mueller
//unsigned char key_to_ascii(int a)
//{
// if (!isprint(a)) return 255;
// if (a & KEY_SHIFTED) {
// return (toupper((unsigned char) a));
// } else {
// return ((unsigned char) a);
// }
//}
//end kill -MM
//added on 10/03/98 by Matt Mueller to fix shifted keys (copied from dos/key.c)
unsigned char key_to_ascii(int keycode)
{
int shifted;
shifted = keycode & KEY_SHIFTED;
keycode &= 0xFF;
if ( keycode>=127 )
return 255;
if (shifted)
return shifted_ascii_table[keycode];
else
return ascii_table[keycode];
}
//end addition -MM
void key_handler(int scancode, int press)
{
ubyte state, key_state;
int i, keycode, event_key;
Key_info *key;
unsigned char temp;
if (press == KEY_EVENTPRESS)
key_state = 1;
else if (press == KEY_EVENTRELEASE)
key_state = 0;
else
return;
event_key = scancode;
//=====================================================
//Here a translation from win keycodes to mac keycodes!
//=====================================================
for (i = 255; i >= 0; i--) {
keycode = i;
key = &(key_data.keys[keycode]);
if (i == event_key)
state = key_state;
else
state = key->last_state;
if ( key->last_state == state ) {
if (state) {
key->counter++;
keyd_last_pressed = keycode;
keyd_time_when_last_pressed = timer_get_fixed_seconds();
}
} else {
if (state) {
keyd_last_pressed = keycode;
keyd_pressed[keycode] = 1;
key->downcount += state;
key->state = 1;
key->timewentdown = keyd_time_when_last_pressed = timer_get_fixed_seconds();
key->counter++;
} else {
keyd_pressed[keycode] = 0;
keyd_last_released = keycode;
key->upcount += key->state;
key->state = 0;
key->counter = 0;
key->timehelddown += timer_get_fixed_seconds() - key->timewentdown;
}
}
if ( (state && !key->last_state) || (state && key->last_state && (key->counter > 30) && (key->counter & 0x01)) ) {
if ( keyd_pressed[KEY_LSHIFT] || keyd_pressed[KEY_RSHIFT])
keycode |= KEY_SHIFTED;
if ( keyd_pressed[KEY_LALT] || keyd_pressed[KEY_RALT])
keycode |= KEY_ALTED;
if ( keyd_pressed[KEY_LCTRL] || keyd_pressed[KEY_RCTRL])
keycode |= KEY_CTRLED;
if ( keyd_pressed[KEY_DELETE] )
keycode |= KEY_DEBUGGED;
temp = key_data.keytail+1;
if ( temp >= KEY_BUFFER_SIZE ) temp=0;
if (temp!=key_data.keyhead) {
key_data.keybuffer[key_data.keytail] = keycode;
key_data.time_pressed[key_data.keytail] = keyd_time_when_last_pressed;
key_data.keytail = temp;
}
}
key->last_state = state;
}
}
void key_close()
{
Installed = 0;
keyboard_close();
}
void key_init()
{
if (keyboard_init())
Error ("SVGAlib Keyboard Init Failed");
Installed=1;
keyboard_seteventhandler (key_handler);
keyd_time_when_last_pressed = timer_get_fixed_seconds();
keyd_buffer_type = 1;
keyd_repeat = 1;
// Clear the keyboard array
key_flush();
atexit(key_close);
}
void key_flush()
{
int i;
fix curtime;
if (!Installed)
key_init();
key_data.keyhead = key_data.keytail = 0;
//Clear the keyboard buffer
for (i=0; i<KEY_BUFFER_SIZE; i++ ) {
key_data.keybuffer[i] = 0;
key_data.time_pressed[i] = 0;
}
//use gettimeofday here:
curtime = timer_get_fixed_seconds();
for (i=0; i<256; i++ ) {
keyd_pressed[i] = 0;
key_data.keys[i].state = 1;
key_data.keys[i].last_state = 0;
key_data.keys[i].timewentdown = curtime;
key_data.keys[i].downcount=0;
key_data.keys[i].upcount=0;
key_data.keys[i].timehelddown = 0;
key_data.keys[i].counter = 0;
}
}
int add_one(int n)
{
n++;
if ( n >= KEY_BUFFER_SIZE ) n=0;
return n;
}
int key_checkch()
{
int is_one_waiting = 0;
event_poll();
if (key_data.keytail!=key_data.keyhead)
is_one_waiting = 1;
return is_one_waiting;
}
int key_inkey()
{
int key = 0;
if (!Installed)
key_init();
event_poll();
if (key_data.keytail!=key_data.keyhead) {
key = key_data.keybuffer[key_data.keyhead];
key_data.keyhead = add_one(key_data.keyhead);
}
//added 9/3/98 by Matt Mueller to free cpu time instead of hogging during menus and such
// else d_delay(1);
//end addition - Matt Mueller
return key;
}
int key_inkey_time(fix * time)
{
int key = 0;
if (!Installed)
key_init();
event_poll();
if (key_data.keytail!=key_data.keyhead) {
key = key_data.keybuffer[key_data.keyhead];
*time = key_data.time_pressed[key_data.keyhead];
key_data.keyhead = add_one(key_data.keyhead);
}
return key;
}
int key_peekkey()
{
int key = 0;
event_poll();
if (key_data.keytail!=key_data.keyhead)
key = key_data.keybuffer[key_data.keyhead];
return key;
}
int key_getch()
{
int dummy=0;
if (!Installed)
return 0;
// return getch();
while (!key_checkch())
dummy++;
return key_inkey();
}
unsigned int key_get_shift_status()
{
unsigned int shift_status = 0;
if ( keyd_pressed[KEY_LSHIFT] || keyd_pressed[KEY_RSHIFT] )
shift_status |= KEY_SHIFTED;
if ( keyd_pressed[KEY_LALT] || keyd_pressed[KEY_RALT] )
shift_status |= KEY_ALTED;
if ( keyd_pressed[KEY_LCTRL] || keyd_pressed[KEY_RCTRL] )
shift_status |= KEY_CTRLED;
#ifndef NDEBUG
if (keyd_pressed[KEY_DELETE])
shift_status |=KEY_DEBUGGED;
#endif
return shift_status;
}
// Returns the number of seconds this key has been down since last call.
fix key_down_time(int scancode)
{
fix time_down, time;
event_poll();
if ((scancode<0)|| (scancode>255)) return 0;
if (!keyd_pressed[scancode]) {
time_down = key_data.keys[scancode].timehelddown;
key_data.keys[scancode].timehelddown = 0;
} else {
time = timer_get_fixed_seconds();
time_down = time - key_data.keys[scancode].timewentdown;
key_data.keys[scancode].timewentdown = time;
}
return time_down;
}
unsigned int key_down_count(int scancode)
{
int n;
event_poll();
if ((scancode<0)|| (scancode>255)) return 0;
n = key_data.keys[scancode].downcount;
key_data.keys[scancode].downcount = 0;
return n;
}
unsigned int key_up_count(int scancode)
{
int n;
event_poll();
if ((scancode<0)|| (scancode>255)) return 0;
n = key_data.keys[scancode].upcount;
key_data.keys[scancode].upcount = 0;
return n;
}
#endif /* SVGALIB_INPUT */

211
input/svgalib_mouse.c Normal file
View file

@ -0,0 +1,211 @@
/* SVGALib mouse input support */
#include <conf.h>
#ifdef SVGALIB_INPUT
#include <string.h>
#include <vga.h>
#include <vgamouse.h>
#include "fix.h"
#include "timer.h"
#include "event.h"
#include "mouse.h"
ubyte installed = 0;
struct mousebutton {
ubyte pressed;
fix time_went_down;
fix time_held_down;
uint num_downs;
uint num_ups;
};
static struct mouseinfo {
struct mousebutton buttons[MOUSE_MAX_BUTTONS];
//added on 10/17/98 by Hans de Goede for mouse functionality
int min_x, min_y;
int max_x, max_y;
int delta_x, delta_y;
int x,y;
//end this section addition - Hans
} Mouse;
void mouse_handler (int vga_button, int dx, int dy, int dz, int drx, int dry, int drz)
{
int i;
int button;
int state;
/* map bit 0,1,2 (R,M,L) to 1,2,0 */
button = ((vga_button & 1) << 1) | ((vga_button & 2) << 1) |
((vga_button & 4) >> 2);
for (i = 0; i < 8; i++)
{
state = button & (1 << i);
if (!Mouse.buttons[i].pressed && state)
{
Mouse.buttons[i].time_went_down = timer_get_fixed_seconds();
Mouse.buttons[i].num_downs++;
}
else if (Mouse.buttons[i].pressed && !state)
{
Mouse.buttons[i].num_ups++;
}
Mouse.buttons[i].pressed = state;
}
Mouse.delta_x += dx;
Mouse.delta_y += dy;
Mouse.x += dx;
Mouse.y += dy;
if (Mouse.x > Mouse.max_x) Mouse.x = Mouse.max_x;
else if (Mouse.x < Mouse.min_x) Mouse.x = Mouse.min_x;
if (Mouse.y > Mouse.max_y) Mouse.y = Mouse.max_y;
else if (Mouse.y < Mouse.min_y) Mouse.y = Mouse.min_y;
}
void d_mouse_close(void)
{
if (installed)
vga_setmousesupport(0);
installed = 0;
}
void d_mouse_init(void)
{
memset(&Mouse,0,sizeof(Mouse));
vga_setmousesupport(1);
if (!installed)
atexit(d_mouse_close);
installed = 1;
}
int mouse_set_limits( int x1, int y1, int x2, int y2 )
{
event_poll();
Mouse.min_x = x1;
Mouse.min_y = y1;
Mouse.max_x = x2;
Mouse.max_y = y2;
return 0;
}
void mouse_flush() // clears all mice events...
{
int i;
fix current_time;
event_poll();
current_time = timer_get_fixed_seconds();
for (i=0; i<MOUSE_MAX_BUTTONS; i++)
{
Mouse.buttons[i].pressed=0;
Mouse.buttons[i].time_went_down=current_time;
Mouse.buttons[i].time_held_down=0;
Mouse.buttons[i].num_ups=0;
Mouse.buttons[i].num_downs=0;
}
//added on 10/17/98 by Hans de Goede for mouse functionality
Mouse.delta_x = 0;
Mouse.delta_y = 0;
Mouse.x = 0;
Mouse.y = 0;
//end this section addition - Hans
}
//========================================================================
void mouse_get_pos( int *x, int *y)
{
event_poll();
*x = Mouse.x;
*y = Mouse.y;
}
void mouse_get_delta( int *dx, int *dy )
{
event_poll();
*dx = Mouse.delta_x;
*dy = Mouse.delta_y;
Mouse.delta_x = 0;
Mouse.delta_y = 0;
}
int mouse_get_btns()
{
int i;
uint flag=1;
int status = 0;
event_poll();
for (i=0; i<MOUSE_MAX_BUTTONS; i++ )
{
if (Mouse.buttons[i].pressed)
status |= flag;
flag <<= 1;
}
return status;
}
void mouse_set_pos( int x, int y)
{
event_poll();
Mouse.x=x;
Mouse.y=y;
if (Mouse.x > Mouse.max_x) Mouse.x = Mouse.max_x;
else if (Mouse.x < Mouse.min_x) Mouse.x = Mouse.min_x;
if (Mouse.y > Mouse.max_y) Mouse.y = Mouse.max_y;
else if (Mouse.y < Mouse.min_y) Mouse.y = Mouse.min_y;
//end this section change - Hans
}
void mouse_get_cyberman_pos( int *x, int *y )
{
// Shrug...
event_poll();
}
// Returns how long this button has been down since last call.
fix mouse_button_down_time(int button)
{
fix time_down, time;
event_poll();
if (!Mouse.buttons[button].pressed) {
time_down = Mouse.buttons[button].time_held_down;
Mouse.buttons[button].time_held_down = 0;
} else {
time = timer_get_fixed_seconds();
time_down = time - Mouse.buttons[button].time_held_down;
Mouse.buttons[button].time_held_down = time;
}
return time_down;
}
// Returns how many times this button has went down since last call
int mouse_button_down_count(int button)
{
int count;
event_poll();
count = Mouse.buttons[button].num_downs;
Mouse.buttons[button].num_downs = 0;
return count;
}
// Returns 1 if this button is currently down
int mouse_button_state(int button)
{
event_poll();
return Mouse.buttons[button].pressed;
}
#endif /* SVGALIB_INPUT */

317
video/svgalib_gr.c Normal file
View file

@ -0,0 +1,317 @@
/* SVGALib video functions */
#include <conf.h>
#ifdef SVGALIB_VIDEO
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <vga.h>
#include <vgagl.h>
#include "gr.h"
#include "grdef.h"
#include "palette.h"
#include "u_mem.h"
#include "error.h"
#ifdef SVGALIB_INPUT
#include <vgamouse.h>
#endif
#include "gamefont.h"
int gr_installed = 0;
int usebuffer;
extern void mouse_handler (int button, int dx, int dy, int dz, int drx, int dry, int drz);
GraphicsContext *physicalscreen, *screenbuffer;
void gr_update()
{
if (usebuffer)
gl_copyscreen(physicalscreen);
}
int gr_set_mode(u_int32_t mode)
{
unsigned int w, h;
char vgamode[16];
vga_modeinfo *modeinfo;
int modenum, rowsize;
void *framebuffer;
#ifdef NOGRAPH
return 0;
#endif
if (mode<=0)
return 0;
w=SM_W(mode);
h=SM_H(mode);
gr_palette_clear();
sprintf(vgamode, "G%dx%dx256", w, h);
modenum = vga_getmodenumber(vgamode);
vga_setmode(modenum);
#ifdef SVGALIB_INPUT
mouse_seteventhandler(mouse_handler);
#endif
modeinfo = vga_getmodeinfo(modenum);
if (modeinfo->flags & CAPABLE_LINEAR)
{
usebuffer = 0;
vga_setlinearaddressing();
// Set up physical screen only
gl_setcontextvga(modenum);
physicalscreen = gl_allocatecontext();
gl_getcontext(physicalscreen);
screenbuffer = physicalscreen;
framebuffer = physicalscreen->vbuf;
rowsize = physicalscreen->bytewidth;
}
else
{
usebuffer = 1;
// Set up the physical screen
gl_setcontextvga(modenum);
physicalscreen = gl_allocatecontext();
gl_getcontext(physicalscreen);
// Set up the virtual screen
gl_setcontextvgavirtual(modenum);
screenbuffer = gl_allocatecontext();
gl_getcontext(screenbuffer);
framebuffer = screenbuffer->vbuf;
rowsize = screenbuffer->bytewidth;
}
memset(grd_curscreen, 0, sizeof(grs_screen));
grd_curscreen->sc_mode = mode;
grd_curscreen->sc_w = w;
grd_curscreen->sc_h = h;
grd_curscreen->sc_aspect = fixdiv(grd_curscreen->sc_w*3,grd_curscreen->sc_h*4);
grd_curscreen->sc_canvas.cv_bitmap.bm_x = 0;
grd_curscreen->sc_canvas.cv_bitmap.bm_y = 0;
grd_curscreen->sc_canvas.cv_bitmap.bm_w = w;
grd_curscreen->sc_canvas.cv_bitmap.bm_h = h;
grd_curscreen->sc_canvas.cv_bitmap.bm_rowsize = rowsize;
grd_curscreen->sc_canvas.cv_bitmap.bm_type = BM_LINEAR;
grd_curscreen->sc_canvas.cv_bitmap.bm_data = framebuffer;
gr_set_current_canvas(NULL);
//gamefont_choose_game_font(w,h);
return 0;
}
int gr_init(void)
{
int retcode;
int mode = SM(320,200);
// Only do this function once!
if (gr_installed==1)
return -1;
MALLOC(grd_curscreen,grs_screen, 1);
memset(grd_curscreen, 0, sizeof(grs_screen));
vga_init();
if ((retcode=gr_set_mode(mode)))
return retcode;
grd_curscreen->sc_canvas.cv_color = 0;
grd_curscreen->sc_canvas.cv_drawmode = 0;
grd_curscreen->sc_canvas.cv_font = NULL;
grd_curscreen->sc_canvas.cv_font_fg_color = 0;
grd_curscreen->sc_canvas.cv_font_bg_color = 0;
gr_set_current_canvas( &grd_curscreen->sc_canvas );
gr_installed = 1;
atexit(gr_close);
return 0;
}
void gr_close ()
{
if (gr_installed==1)
{
gr_installed = 0;
free(grd_curscreen);
gl_freecontext(screenbuffer);
gl_freecontext(physicalscreen);
}
}
// Palette functions follow.
static int last_r=0, last_g=0, last_b=0;
void gr_palette_clear ()
{
int colors[768];
memset (colors, 0, 768 * sizeof(int));
vga_setpalvec (0, 256, colors);
gr_palette_faded_out = 1;
}
void gr_palette_step_up (int r, int g, int b)
{
int i = 0;
ubyte *p = gr_palette;
int temp;
int colors[768];
if (gr_palette_faded_out) return;
if ((r==last_r) && (g==last_g) && (b==last_b)) return;
last_r = r;
last_g = g;
last_b = b;
while (i < 768)
{
temp = (int)(*p++) + r + gr_palette_gamma;
if (temp<0) temp=0;
else if (temp>63) temp=63;
colors[i++] = temp;
temp = (int)(*p++) + g + gr_palette_gamma;
if (temp<0) temp=0;
else if (temp>63) temp=63;
colors[i++] = temp;
temp = (int)(*p++) + b + gr_palette_gamma;
if (temp<0) temp=0;
else if (temp>63) temp=63;
colors[i++] = temp;
}
vga_setpalvec (0, 256, colors);
}
//added on 980913 by adb to fix palette problems
// need a min without side effects...
#undef min
static inline int min(int x, int y) { return x < y ? x : y; }
//end changes by adb
void gr_palette_load (ubyte *pal)
{
int i;
int colors[768];
for (i = 0; i < 768; i++)
{
gr_current_pal[i] = pal[i];
if (gr_current_pal[i] > 63) gr_current_pal[i] = 63;
colors[i] = (min(gr_current_pal[i] + gr_palette_gamma, 63));
}
vga_setpalvec (0, 256, colors);
gr_palette_faded_out = 0;
init_computed_colors();
}
int gr_palette_fade_out (ubyte *pal, int nsteps, int allow_keys)
{
int i, j;
ubyte c;
fix fade_palette[768];
fix fade_palette_delta[768];
int fade_colors[768];
if (gr_palette_faded_out) return 0;
if (pal==NULL) pal=gr_current_pal;
for (i=0; i<768; i++)
{
gr_current_pal[i] = pal[i];
fade_palette[i] = i2f(pal[i]);
fade_palette_delta[i] = fade_palette[i] / nsteps;
}
for (j=0; j<nsteps; j++)
{
for (i = 0; i < 768; i++)
{
fade_palette[i] -= fade_palette_delta[i];
if (fade_palette[i] > i2f(pal[i] + gr_palette_gamma))
fade_palette[i] = i2f(pal[i] + gr_palette_gamma);
c = f2i(fade_palette[i]);
if (c > 63) c = 63;
fade_colors[i] = c;
}
vga_setpalvec (0, 256, fade_colors);
}
gr_palette_faded_out = 1;
return 0;
}
int gr_palette_fade_in (ubyte *pal, int nsteps, int allow_keys)
{
int i, j;
ubyte c;
fix fade_palette[768];
fix fade_palette_delta[768];
int fade_colors[768];
if (!gr_palette_faded_out) return 0;
for (i=0; i<768; i++)
{
gr_current_pal[i] = pal[i];
fade_palette[i] = 0;
fade_palette_delta[i] = i2f(pal[i] + gr_palette_gamma) / nsteps;
}
for (j=0; j<nsteps; j++ )
{
for (i = 0; i < 768; i++ )
{
fade_palette[i] += fade_palette_delta[i];
if (fade_palette[i] > i2f(pal[i] + gr_palette_gamma))
fade_palette[i] = i2f(pal[i] + gr_palette_gamma);
c = f2i(fade_palette[i]);
if (c > 63) c = 63;
fade_colors[i] = c;
}
vga_setpalvec (0, 256, fade_colors);
}
gr_palette_faded_out = 0;
return 0;
}
void gr_palette_read (ubyte *pal)
{
int colors[768];
int i;
vga_getpalvec (0, 256, colors);
for (i = 0; i < 768; i++)
pal[i] = colors[i];
}
#endif /* SVGALIB_VIDEO */