1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
/*
SABRE Fighter Plane Simulator
Copyright (c) 1997 Dan Hammer
Portions Donated By Antti Barck
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*************************************************
* SABRE Fighter Plane Simulator *
* Version: 0.1 *
* File : cockpit.C *
* Date : March, 1997 *
* Author : Dan Hammer *
*************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <values.h>
#include <time.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <iostream.h>
#include <fstream.h>
#include "defs.h"
#include "grafix.h"
#include "vga.h"
#include "vga_13.h"
#include "traveler.h"
#include "pen.h"
#include "convpoly.h"
#include "vmath.h"
#include "port_3d.h"
#include "cpoly.h"
#include "font8x8.h"
#include "flight.h"
#include "rotate.h"
#include "colorspc.h"
#include "simfile.h"
#include "bits.h"
#include "instrmnt.h"
#include "transblt.h"
#include "txtrmap.h"
#include "cockpit.h"
Cockpit::Cockpit(unsigned char *byts,
int xs,
int ys,
int tclr,
char *ipath)
: cbytes(byts),
x_size(xs),
y_size(ys),
trans_color(tclr)
{
t_table = new trans_table();
t_table->trans_color = trans_color;
t_table->build_runs(cbytes,y_size,x_size);
y_clip = SCREEN_HEIGHT - y_size + t_table->ntrans_row;
ipanel = &instrument_panel;
cockpit_y = SCREEN_HEIGHT - y_size;
cockpit_x = 0;
::cockpit_y = cockpit_y;
::cockpit_x = cockpit_x;
setup_instruments(ipath,*ipanel);
}
Cockpit::Cockpit(char *tmap_id, char *ipath)
{
TextrMap *tmap = map_man->get_map_ptr(tmap_id);
if (tmap == NULL)
{
fprintf(stderr,"Couldn't find cockpit, tmap id %s\n",
tmap_id);
exit(1);
}
cbytes = tmap->getBytes();
x_size = tmap->map_w;
y_size = tmap->map_h;
trans_color = tmap->trans_colr;
t_table = new trans_table();
t_table->trans_color = trans_color;
t_table->build_runs(cbytes,y_size,x_size);
y_clip = SCREEN_HEIGHT - y_size + t_table->ntrans_row;
ipanel = &instrument_panel;
cockpit_y = SCREEN_HEIGHT - y_size;
cockpit_x = 0;
::cockpit_y = cockpit_y;
::cockpit_x = cockpit_x;
setup_instruments(ipath,*ipanel);
}
Cockpit::~Cockpit()
{
if (t_table)
delete t_table;
}
void Cockpit::draw(Flight &flight)
{
if (SCREEN_WIDTH==320 && SCREEN_HEIGHT==200)
// if (VGAMODE == G320x200x256)
{
ipanel->underpaint(flight);
t_table->trans_blit(buffer_ptr,cockpit_x,cockpit_y,NULL,0);
ipanel->display(flight);
}
}
|