add gr_flip, allowing significant cleanup; remove final remnants of VR_current_page, also allowing -nodoublebuffer switch for all platforms
This commit is contained in:
parent
d33ccb0f01
commit
9e1281d81e
95
2d/canvas.c
95
2d/canvas.c
|
@ -11,84 +11,17 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
|||
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||
*/
|
||||
/*
|
||||
* $Source: /cvsroot/dxx-rebirth/d1x-rebirth/2d/canvas.c,v $
|
||||
* $Revision: 1.1.1.1 $
|
||||
* $Author: zicodxx $
|
||||
* $Date: 2006/03/17 19:38:57 $
|
||||
*
|
||||
* Graphical routines for manipulating grs_canvas's.
|
||||
*
|
||||
* $Log: canvas.c,v $
|
||||
* Revision 1.1.1.1 2006/03/17 19:38:57 zicodxx
|
||||
* initial import
|
||||
*
|
||||
* Revision 1.2 1999/08/05 22:53:40 sekmu
|
||||
*
|
||||
* D3D patch(es) from ADB
|
||||
*
|
||||
* Revision 1.1.1.1 1999/06/14 21:57:17 donut
|
||||
* Import of d1x 1.37 source.
|
||||
*
|
||||
* Revision 1.14 1995/03/06 09:18:45 john
|
||||
* Made modex page flipping wait for retrace be default.
|
||||
*
|
||||
* Revision 1.13 1995/03/01 15:37:40 john
|
||||
* Better ModeX support.
|
||||
*
|
||||
* Revision 1.12 1994/11/28 17:08:29 john
|
||||
* Took out some unused functions in linear.asm, moved
|
||||
* gr_linear_movsd from linear.asm to bitblt.c, made sure that
|
||||
* the code in ibiblt.c sets the direction flags before rep movsing.
|
||||
*
|
||||
* Revision 1.11 1994/11/18 22:50:24 john
|
||||
* Changed shorts to ints in parameters.
|
||||
*
|
||||
* Revision 1.10 1994/11/10 15:59:33 john
|
||||
* Fixed bugs with canvas's being created with bogus bm_flags.
|
||||
*
|
||||
* Revision 1.9 1994/06/24 17:26:34 john
|
||||
* Made rowsizes bigger than actual screen work with SVGA.
|
||||
*
|
||||
* Revision 1.8 1994/05/06 12:50:41 john
|
||||
* Added supertransparency; neatend things up; took out warnings.
|
||||
*
|
||||
* Revision 1.7 1993/12/08 16:41:26 john
|
||||
* fixed color = -1 bug
|
||||
*
|
||||
* Revision 1.6 1993/10/15 16:22:25 john
|
||||
* *** empty log message ***
|
||||
*
|
||||
* Revision 1.5 1993/09/29 16:14:07 john
|
||||
* added globol variables describing current canvas
|
||||
*
|
||||
* Revision 1.4 1993/09/14 16:03:40 matt
|
||||
* Added new function, gr_clear_canvas()
|
||||
*
|
||||
* Revision 1.3 1993/09/14 13:51:38 matt
|
||||
* in gr_init_sub_canvas(), copy bm_rowsize from source canvas
|
||||
*
|
||||
* Revision 1.2 1993/09/08 17:37:34 john
|
||||
* Checking for potential errors
|
||||
*
|
||||
* Revision 1.1 1993/09/08 11:43:18 john
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
//#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "u_mem.h"
|
||||
|
||||
|
||||
#include "gr.h"
|
||||
#include "grdef.h"
|
||||
#ifdef __MSDOS__
|
||||
#include "modex.h"
|
||||
#include "vesa.h"
|
||||
#endif
|
||||
|
||||
grs_canvas * grd_curcanv; //active canvas
|
||||
grs_screen * grd_curscreen; //active screen
|
||||
|
@ -110,7 +43,7 @@ grs_canvas *gr_create_canvas(int w, int h)
|
|||
|
||||
grs_canvas *gr_create_sub_canvas(grs_canvas *canv, int x, int y, int w, int h)
|
||||
{
|
||||
grs_canvas *new;
|
||||
grs_canvas *new;
|
||||
|
||||
new = (grs_canvas *)malloc( sizeof(grs_canvas) );
|
||||
gr_init_sub_bitmap (&new->cv_bitmap, &canv->cv_bitmap, x, y, w, h);
|
||||
|
@ -126,9 +59,9 @@ grs_canvas *gr_create_sub_canvas(grs_canvas *canv, int x, int y, int w, int h)
|
|||
void gr_init_canvas(grs_canvas *canv, unsigned char * pixdata, int pixtype, int w, int h)
|
||||
{
|
||||
int wreal;
|
||||
canv->cv_color = 0;
|
||||
canv->cv_drawmode = 0;
|
||||
canv->cv_font = NULL;
|
||||
canv->cv_color = 0;
|
||||
canv->cv_drawmode = 0;
|
||||
canv->cv_font = NULL;
|
||||
canv->cv_font_fg_color = 0;
|
||||
canv->cv_font_bg_color = 0;
|
||||
|
||||
|
@ -155,28 +88,12 @@ void gr_init_sub_canvas(grs_canvas *new, grs_canvas *src, int x, int y, int w, i
|
|||
void gr_free_canvas(grs_canvas *canv)
|
||||
{
|
||||
gr_free_bitmap_data(&canv->cv_bitmap);
|
||||
free(canv);
|
||||
free(canv);
|
||||
}
|
||||
|
||||
void gr_free_sub_canvas(grs_canvas *canv)
|
||||
{
|
||||
free(canv);
|
||||
}
|
||||
|
||||
int gr_wait_for_retrace = 1;
|
||||
|
||||
void gr_show_canvas( grs_canvas *canv )
|
||||
{
|
||||
#ifdef __MSDOS__
|
||||
if (canv->cv_bitmap.bm_type == BM_MODEX )
|
||||
gr_modex_setstart( canv->cv_bitmap.bm_x, canv->cv_bitmap.bm_y, gr_wait_for_retrace );
|
||||
|
||||
else if (canv->cv_bitmap.bm_type == BM_SVGA )
|
||||
gr_vesa_setstart( canv->cv_bitmap.bm_x, canv->cv_bitmap.bm_y );
|
||||
#endif
|
||||
// else if (canv->cv_bitmap.bm_type == BM_LINEAR )
|
||||
// Int3(); // Get JOHN!
|
||||
//gr_linear_movsd( canv->cv_bitmap.bm_data, (void *)gr_video_memory, 320*200);
|
||||
free(canv);
|
||||
}
|
||||
|
||||
void gr_set_current_canvas( grs_canvas *canv )
|
||||
|
|
|
@ -68,49 +68,36 @@ int gr_toggle_fullscreen(void){
|
|||
return ogl_fullscreen;
|
||||
}
|
||||
|
||||
extern void ogl_init_pixel_buffers(int w, int h);
|
||||
extern void ogl_close_pixel_buffers(void);
|
||||
|
||||
void ogl_init_state(void){
|
||||
/* select clearing (background) color */
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glShadeModel(GL_SMOOTH);
|
||||
|
||||
/* initialize viewing values */
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
|
||||
glScalef(1.0, -1.0, 1.0);
|
||||
glTranslatef(0.0, -1.0, 0.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();//clear matrix
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
gr_palette_step_up(0,0,0);//in case its left over from in game
|
||||
}
|
||||
|
||||
int last_screen_mode=-1;
|
||||
extern void ogl_init_pixel_buffers(int w, int h);
|
||||
extern void ogl_close_pixel_buffers(void);
|
||||
|
||||
void ogl_set_screen_mode(void){
|
||||
if (last_screen_mode==Screen_mode)
|
||||
return;
|
||||
|
||||
OGL_VIEWPORT(0,0,grd_curscreen->sc_w,grd_curscreen->sc_h);
|
||||
|
||||
if (Screen_mode!=SCREEN_GAME)
|
||||
{
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();//clear matrix
|
||||
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();//clear matrix
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
ogl_init_pixel_buffers(grd_curscreen->sc_w, grd_curscreen->sc_h);
|
||||
last_screen_mode=Screen_mode;
|
||||
}
|
||||
|
||||
void gr_update()
|
||||
{
|
||||
}
|
||||
|
||||
// Set the buffer to draw to. 0 is front, 1 is back
|
||||
void gr_set_draw_buffer(int buf)
|
||||
{
|
||||
glDrawBuffer((buf == 0) ? GL_FRONT : GL_BACK);
|
||||
}
|
||||
|
||||
const char *gl_vendor,*gl_renderer,*gl_version,*gl_extensions;
|
||||
void ogl_get_verinfo(void){
|
||||
int t;
|
||||
|
@ -230,9 +217,10 @@ int gr_set_mode(u_int32_t mode)
|
|||
ogl_init_window(w,h);//platform specific code
|
||||
ogl_get_verinfo();
|
||||
OGL_VIEWPORT(0,0,w,h);
|
||||
ogl_set_screen_mode();
|
||||
gamefont_choose_game_font(w,h);
|
||||
|
||||
ogl_init_state();
|
||||
|
||||
gr_update();
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -142,7 +142,6 @@ void ogl_freebmtexture(grs_bitmap *bm);
|
|||
void ogl_do_palfx(void);
|
||||
void ogl_start_frame(void);
|
||||
void ogl_end_frame(void);
|
||||
void ogl_swap_buffers(void);
|
||||
void ogl_set_screen_mode(void);
|
||||
void ogl_cache_level_textures(void);
|
||||
|
||||
|
|
|
@ -1159,12 +1159,11 @@ void ogl_end_frame(void){
|
|||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
}
|
||||
void ogl_swap_buffers(void){
|
||||
|
||||
void gr_flip(void){
|
||||
ogl_clean_texture_cache();
|
||||
if (gr_renderstats){
|
||||
if (gr_renderstats)
|
||||
gr_printf(5,FONTSCALE_Y(GAME_FONT->ft_h*13+3*13),"%i flat %i tex %i sprites %i bitmaps",r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc);
|
||||
// glmprintf((0,"ogl_end_frame: %i polys, %i tmaps, %i sprites, %i bitmaps, %i bitblts, %i pixels\n",r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc,r_ubitbltc,r_upixelc));//we need to do it here because some things get drawn after end_frame
|
||||
}
|
||||
ogl_do_palfx();
|
||||
ogl_swap_buffers_internal();
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
|
|
@ -64,6 +64,18 @@ void gr_update()
|
|||
SDL_UpdateRect(screen,0,0,0,0);
|
||||
}
|
||||
|
||||
void gr_flip(void)
|
||||
{
|
||||
gr_update(); //FIXME: Add double buffer support to remove cockpit/status bar flicker
|
||||
}
|
||||
|
||||
// Set the buffer to draw to. 0 is front, 1 is back
|
||||
// With SDL, can't use it without resetting the video mode
|
||||
void gr_set_draw_buffer(int buf)
|
||||
{
|
||||
buf = buf;
|
||||
}
|
||||
|
||||
int gr_set_mode(u_int32_t mode)
|
||||
{
|
||||
unsigned int w, h;
|
||||
|
|
|
@ -224,7 +224,17 @@ void gr_update()
|
|||
}*/
|
||||
}
|
||||
|
||||
void gr_flip(void)
|
||||
{
|
||||
gr_update(); //FIXME: Add double buffer support to remove cockpit/status bar flicker
|
||||
}
|
||||
|
||||
// Set the buffer to draw to. 0 is front, 1 is back
|
||||
// With SDL, can't use it without resetting the video mode
|
||||
void gr_set_draw_buffer(int buf)
|
||||
{
|
||||
buf = buf;
|
||||
}
|
||||
|
||||
int gr_set_mode(u_int32_t mode)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ D1X-Rebirth Changelog
|
|||
20070322
|
||||
--------
|
||||
SConstruct, arch/ogl/gr.c, arch/ogl/ogl.c, arch/ogl/include/ogl_init.h, main/credits.c, main/game.c, main/kconfig.c, main/kmatrix.c, main/menu.c, main/netlist.c, main/newmenu.c, main.polyobj.c, main/scores.c, main/state.c, main/titles.c: Use Doublebuffer in OGL for all parts of the game and properly redraw elements, fixed Profiler build
|
||||
2d/canvas.c, arch/ogl/gr.c, arch/ogl/ogl.c, arch/ogl/include/ogl_init.h, arch/sdl/gr.c, arch/win32/gr.c, include/gr.h, main/automap.c, main/credits.c, main/inferno.c, main/game.c, main/game.h, main/gauges.c, main/hud.c, main/kconfig.c, main/kmatrix.c, main/netlist.c, main/newmenu.c, main/scores.c, main/titles.c: add gr_flip, allowing significant cleanup; remove final remnants of VR_current_page, also allowing -nodoublebuffer switch for all platforms
|
||||
|
||||
20070318
|
||||
--------
|
||||
|
|
|
@ -659,7 +659,6 @@ extern unsigned char Test_bitmap_data[64*64];
|
|||
|
||||
extern unsigned int FixDivide( unsigned int x, unsigned int y );
|
||||
|
||||
extern void gr_show_canvas( grs_canvas *canv );
|
||||
extern void gr_set_current_canvas( grs_canvas *canv );
|
||||
|
||||
//flags for fonts
|
||||
|
@ -737,6 +736,8 @@ extern void build_colormap_good( ubyte * palette, ubyte * colormap, int * freq )
|
|||
//extern void decode_data_asm(ubyte *data, int num_pixels, ubyte *colormap, int *count);
|
||||
|
||||
extern void gr_update();
|
||||
extern void gr_flip(void);
|
||||
extern void gr_set_draw_buffer(int buf);
|
||||
|
||||
//added 05/19/99 Matt Mueller - graphics locking stuff
|
||||
#if (defined(TEST_GR_LOCK) || defined(GR_LOCK))
|
||||
|
|
|
@ -151,14 +151,7 @@ static short DrawingListBright[MAX_EDGES];
|
|||
#define ROT_SPEED_DIVISOR (115000)
|
||||
|
||||
// Screen anvas variables
|
||||
#ifndef OGL
|
||||
static int current_page=0;
|
||||
#endif /* OGL */
|
||||
static grs_canvas Pages[2];
|
||||
static grs_canvas DrawingPages[2];
|
||||
|
||||
#define Page Pages[0]
|
||||
#define DrawingPage DrawingPages[0]
|
||||
static grs_canvas Automap_view;
|
||||
|
||||
// Flags
|
||||
static int Automap_cheat = 0; // If set, show everything
|
||||
|
@ -298,7 +291,7 @@ void draw_player( object * obj )
|
|||
automap_draw_line(&sphere_point, &arrow_point);
|
||||
}
|
||||
|
||||
void draw_automap()
|
||||
void draw_automap(int flip)
|
||||
{
|
||||
int i;
|
||||
int color;
|
||||
|
@ -307,7 +300,7 @@ void draw_automap()
|
|||
g3s_point sphere_point;
|
||||
|
||||
#ifndef OGL
|
||||
gr_set_current_canvas(&DrawingPage);
|
||||
gr_set_current_canvas(&Automap_view);
|
||||
#endif
|
||||
|
||||
gr_clear_canvas(BM_XRGB(0,0,0));
|
||||
|
@ -380,14 +373,10 @@ void draw_automap()
|
|||
|
||||
create_name_canv();
|
||||
|
||||
#ifdef OGL
|
||||
ogl_swap_buffers();
|
||||
#else
|
||||
#ifndef OGL
|
||||
gr_bm_ubitblt( Page.cv_bitmap.bm_w, Page.cv_bitmap.bm_h, Page.cv_bitmap.bm_x, Page.cv_bitmap.bm_y, 0, 0, &Page.cv_bitmap, &grd_curscreen->sc_canvas.cv_bitmap );
|
||||
gr_update();
|
||||
#endif
|
||||
#endif
|
||||
if (flip)
|
||||
gr_flip();
|
||||
else
|
||||
gr_update();
|
||||
}
|
||||
|
||||
#define LEAVE_TIME 0x4000
|
||||
|
@ -413,7 +402,7 @@ void do_automap( int key_code ) {
|
|||
int leave_mode=0;
|
||||
int first_time=1;
|
||||
int pcx_error;
|
||||
#if !defined(OGL) || !defined(NDEBUG)
|
||||
#ifndef NDEBUG
|
||||
int i;
|
||||
#endif
|
||||
int c;
|
||||
|
@ -427,9 +416,6 @@ void do_automap( int key_code ) {
|
|||
int Max_segments_away = 0;
|
||||
int SegmentLimit = 1;
|
||||
ubyte pal[256*3];
|
||||
#ifndef OGL
|
||||
int must_free_canvas=0;
|
||||
#endif
|
||||
|
||||
Automap_active = 1;
|
||||
|
||||
|
@ -459,10 +445,8 @@ void do_automap( int key_code ) {
|
|||
gr_palette_clear();
|
||||
|
||||
#ifndef OGL
|
||||
gr_init_sub_canvas(&Page,&VR_render_buffer[0],0, 0, automap_width, automap_height);
|
||||
|
||||
gr_init_sub_canvas(&DrawingPage, &Page, RESCALE_X(27), RESCALE_Y(80), RESCALE_X(582), RESCALE_Y(334));
|
||||
gr_set_current_canvas(&Page);
|
||||
gr_init_sub_canvas(&Automap_view, &grd_curscreen->sc_canvas, RESCALE_X(27), RESCALE_Y(80), RESCALE_X(582), RESCALE_Y(334));
|
||||
gr_set_current_canvas(NULL);
|
||||
|
||||
pcx_error = pcx_read_fullscr(MAP_BACKGROUND_FILENAME, pal);
|
||||
if ( pcx_error != PCX_ERROR_NONE ) {
|
||||
|
@ -479,7 +463,7 @@ void do_automap( int key_code ) {
|
|||
gr_printf(RESCALE_X(130), RESCALE_Y(426), TXT_TURN_SHIP);
|
||||
gr_printf(RESCALE_X(130), RESCALE_Y(443), TXT_SLIDE_UPDOWN);
|
||||
gr_printf(RESCALE_X(130), RESCALE_Y(460), TXT_VIEWING_DISTANCE);
|
||||
gr_set_current_canvas(&DrawingPage);
|
||||
gr_set_current_canvas(&Automap_view);
|
||||
#endif
|
||||
|
||||
automap_build_edge_list();
|
||||
|
@ -513,13 +497,12 @@ void do_automap( int key_code ) {
|
|||
Error("File %s - PCX error: %s", MAP_BACKGROUND_FILENAME, pcx_errormsg(pcx_error));
|
||||
gr_remap_bitmap_good(&Automap_background, pal, -1, -1);
|
||||
|
||||
gr_init_sub_canvas(&Page,&VR_render_buffer[0],0, 0, automap_width, automap_height);
|
||||
gr_init_sub_canvas(&Automap_view, &grd_curscreen->sc_canvas, RESCALE_X(27), RESCALE_Y(80), RESCALE_X(582), RESCALE_Y(334));
|
||||
#endif
|
||||
|
||||
while(!done) {
|
||||
#ifdef OGL
|
||||
gr_init_sub_canvas(&DrawingPage, &Page, RESCALE_X(27), RESCALE_Y(80), RESCALE_X(582), RESCALE_Y(334));
|
||||
gr_set_current_canvas(&Page);
|
||||
gr_set_current_canvas(NULL);
|
||||
if (automap_height<400)
|
||||
show_fullscr(&Automap_background);
|
||||
else
|
||||
|
@ -532,7 +515,7 @@ void do_automap( int key_code ) {
|
|||
gr_printf(RESCALE_X(130), RESCALE_Y(426), TXT_TURN_SHIP);
|
||||
gr_printf(RESCALE_X(130), RESCALE_Y(443), TXT_SLIDE_UPDOWN);
|
||||
gr_printf(RESCALE_X(130), RESCALE_Y(460), TXT_VIEWING_DISTANCE);
|
||||
gr_set_current_canvas(&DrawingPage);
|
||||
gr_set_current_canvas(&Automap_view);
|
||||
#endif
|
||||
if ( leave_mode==0 && Controls.automap_state && (timer_get_fixed_seconds()-entry_time)>LEAVE_TIME)
|
||||
leave_mode = 1;
|
||||
|
@ -654,7 +637,7 @@ void do_automap( int key_code ) {
|
|||
if ( ViewDist < ZOOM_MIN_VALUE ) ViewDist = ZOOM_MIN_VALUE;
|
||||
if ( ViewDist > ZOOM_MAX_VALUE ) ViewDist = ZOOM_MAX_VALUE;
|
||||
|
||||
draw_automap();
|
||||
draw_automap(Game_double_buffer);
|
||||
|
||||
if ( first_time ) {
|
||||
first_time = 0;
|
||||
|
@ -674,15 +657,11 @@ void do_automap( int key_code ) {
|
|||
t1 = t2;
|
||||
}
|
||||
|
||||
#ifndef OGL
|
||||
if (must_free_canvas)
|
||||
free(Page.cv_bitmap.bm_data);
|
||||
#else
|
||||
#ifdef OGL
|
||||
gr_free_bitmap_data(&Automap_background);
|
||||
mprintf( (0, "Automap background memory freed\n" ));
|
||||
#endif
|
||||
|
||||
mprintf( (0, "Automap memory freed\n" ));
|
||||
|
||||
game_flush_inputs();
|
||||
|
||||
if (pause_game)
|
||||
|
|
|
@ -211,7 +211,7 @@ void credits_show(char *credits_filename)
|
|||
|
||||
y = first_line_offset - i;
|
||||
#ifdef OGL
|
||||
ogl_swap_buffers();
|
||||
gr_flip();
|
||||
ogl_ubitmapm_cs(0,0,-1,-1,&backdrop,-1,F1_0);
|
||||
#endif
|
||||
gr_set_current_canvas(CreditsOffscreenBuf);
|
||||
|
|
118
main/game.c
118
main/game.c
|
@ -164,7 +164,6 @@ ubyte new_cheats[]= { KEY_B^0xaa, KEY_B^0xaa, KEY_B^0xaa, KEY_F^0xaa, KEY_A^0xaa
|
|||
KEY_N^0xaa, KEY_D^0xaa, KEY_X^0xaa, KEY_X^0xaa, KEY_A^0xaa };
|
||||
|
||||
ubyte VR_use_paging = 0;
|
||||
ubyte VR_current_page = 0;
|
||||
u_int32_t VR_screen_mode = 0;
|
||||
int VR_render_width = 0;
|
||||
int VR_render_height = 0;
|
||||
|
@ -175,7 +174,6 @@ int VR_sensitivity = 1; // 0 - 2
|
|||
grs_canvas *VR_offscreen_buffer = NULL; // The offscreen data buffer
|
||||
grs_canvas VR_render_buffer[2]; // Two offscreen buffers for left/right eyes.
|
||||
grs_canvas VR_render_sub_buffer[2]; // Two sub buffers for left/right eyes.
|
||||
grs_canvas VR_screen_pages[2]; // Two pages of VRAM if paging is available
|
||||
grs_canvas VR_editor_canvas; // The canvas that the editor writes to.
|
||||
|
||||
//added 07/11/99 by adb:
|
||||
|
@ -336,7 +334,7 @@ int Game_window_h = 0;
|
|||
int max_window_w = 0;
|
||||
int max_window_h = 0;
|
||||
|
||||
int last_drawn_cockpit[2] = { -1, -1 };
|
||||
int last_drawn_cockpit = -1;
|
||||
extern void ogl_loadbmtexture(grs_bitmap *bm);
|
||||
extern void write_player_file();
|
||||
extern int Rear_view;
|
||||
|
@ -352,7 +350,7 @@ void update_cockpits(int force_redraw)
|
|||
switch( Cockpit_mode ) {
|
||||
case CM_FULL_COCKPIT:
|
||||
case CM_REAR_VIEW:
|
||||
gr_set_current_canvas(&VR_screen_pages[VR_current_page]);
|
||||
gr_set_current_canvas(NULL);
|
||||
|
||||
PIGGY_PAGE_IN(cockpit_bitmap[Cockpit_mode]);
|
||||
#ifdef OGL
|
||||
|
@ -367,7 +365,7 @@ void update_cockpits(int force_redraw)
|
|||
fill_background(Game_window_x,Game_window_y,Game_window_w,Game_window_h,Game_window_x,Game_window_y);
|
||||
break;
|
||||
case CM_STATUS_BAR:
|
||||
gr_set_current_canvas(&VR_screen_pages[VR_current_page]);
|
||||
gr_set_current_canvas(NULL);
|
||||
PIGGY_PAGE_IN(cockpit_bitmap[Cockpit_mode]);
|
||||
#ifdef OGL
|
||||
ogl_ubitmapm_cs (0, max_window_h, -1, grd_curcanv->cv_bitmap.bm_h - max_window_h, &GameBitmaps[cockpit_bitmap[Cockpit_mode].index],255, F1_0);
|
||||
|
@ -381,14 +379,14 @@ void update_cockpits(int force_redraw)
|
|||
fill_background(x,y,w,h,x,y);
|
||||
break;
|
||||
case CM_LETTERBOX:
|
||||
gr_set_current_canvas(&VR_screen_pages[VR_current_page]);
|
||||
gr_set_current_canvas(NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
gr_set_current_canvas(&VR_screen_pages[VR_current_page]);
|
||||
gr_set_current_canvas(NULL);
|
||||
|
||||
if (Cockpit_mode != last_drawn_cockpit[VR_current_page] || force_redraw )
|
||||
last_drawn_cockpit[VR_current_page] = Cockpit_mode;
|
||||
if (Cockpit_mode != last_drawn_cockpit || force_redraw )
|
||||
last_drawn_cockpit = Cockpit_mode;
|
||||
else
|
||||
return;
|
||||
|
||||
|
@ -494,8 +492,7 @@ void select_cockpit(int mode)
|
|||
void reset_cockpit()
|
||||
{
|
||||
force_cockpit_redraw=1;
|
||||
last_drawn_cockpit[0] = -1;
|
||||
last_drawn_cockpit[1] = -1;
|
||||
last_drawn_cockpit = -1;
|
||||
}
|
||||
|
||||
void HUD_clear_messages();
|
||||
|
@ -633,7 +630,7 @@ void copy_background_rect(int left,int top,int right,int bot)
|
|||
|
||||
void fill_background(int x,int y,int w,int h,int dx,int dy)
|
||||
{
|
||||
gr_set_current_canvas(&VR_screen_pages[VR_current_page]);
|
||||
gr_set_current_canvas(NULL);
|
||||
copy_background_rect(x-dx,y-dy,x-1,y+h+dy-1);
|
||||
copy_background_rect(x+w,y-dy,x+w+dx-1,y+h+dy-1);
|
||||
copy_background_rect(x,y-dy,x+w-1,y-1);
|
||||
|
@ -765,9 +762,9 @@ int set_screen_mode(int sm)
|
|||
(grd_curscreen->sc_mode != Game_screen_mode)) &&
|
||||
!((sm==SCREEN_MENU) &&
|
||||
(grd_curscreen->sc_mode != MENU_SCREEN_MODE)) ) {
|
||||
gr_set_current_canvas( &VR_screen_pages[VR_current_page] );
|
||||
#ifdef OGL
|
||||
ogl_set_screen_mode();
|
||||
gr_set_current_canvas(NULL);
|
||||
#ifndef OGL
|
||||
gr_set_draw_buffer(0); // Set to the front buffer
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
@ -784,8 +781,6 @@ int set_screen_mode(int sm)
|
|||
if (gr_set_mode(MENU_SCREEN_MODE)) Error("Cannot set screen mode for game!");
|
||||
gr_palette_load( gr_palette );
|
||||
}
|
||||
gr_init_sub_canvas( &VR_screen_pages[0], &grd_curscreen->sc_canvas, 0, 0, grd_curscreen->sc_w, grd_curscreen->sc_h );
|
||||
gr_init_sub_canvas( &VR_screen_pages[1], &grd_curscreen->sc_canvas, 0, 0, grd_curscreen->sc_w, grd_curscreen->sc_h );
|
||||
break;
|
||||
case SCREEN_GAME:
|
||||
if (grd_curscreen->sc_mode != Game_screen_mode)
|
||||
|
@ -794,11 +789,6 @@ int set_screen_mode(int sm)
|
|||
reset_cockpit();
|
||||
max_window_w = grd_curscreen->sc_w;
|
||||
max_window_h = grd_curscreen->sc_h;
|
||||
gr_init_sub_canvas( &VR_screen_pages[0], &grd_curscreen->sc_canvas, 0, 0, grd_curscreen->sc_w, grd_curscreen->sc_h );
|
||||
if ( VR_use_paging )
|
||||
gr_init_sub_canvas( &VR_screen_pages[1], &grd_curscreen->sc_canvas, 0, grd_curscreen->sc_h, grd_curscreen->sc_w, grd_curscreen->sc_h );
|
||||
else
|
||||
gr_init_sub_canvas( &VR_screen_pages[1], &grd_curscreen->sc_canvas, 0, 0, grd_curscreen->sc_w, grd_curscreen->sc_h );
|
||||
init_cockpit();
|
||||
break;
|
||||
#ifdef EDITOR
|
||||
|
@ -814,8 +804,6 @@ int set_screen_mode(int sm)
|
|||
|
||||
gr_init_sub_canvas( &VR_editor_canvas, &grd_curscreen->sc_canvas, 0, 0, grd_curscreen->sc_w, grd_curscreen->sc_h );
|
||||
Canv_editor = &VR_editor_canvas;
|
||||
gr_init_sub_canvas( &VR_screen_pages[0], Canv_editor, 0, 0, Canv_editor->cv_w, Canv_editor->cv_h );
|
||||
gr_init_sub_canvas( &VR_screen_pages[1], Canv_editor, 0, 0, Canv_editor->cv_w, Canv_editor->cv_h );
|
||||
gr_set_current_canvas( Canv_editor );
|
||||
init_editor_screen(); //setup other editor stuff
|
||||
break;
|
||||
|
@ -824,13 +812,12 @@ int set_screen_mode(int sm)
|
|||
Error("Invalid screen mode %d",sm);
|
||||
}
|
||||
|
||||
VR_current_page = 0;
|
||||
gr_set_current_canvas(NULL);
|
||||
|
||||
gr_set_current_canvas( &VR_screen_pages[VR_current_page] );
|
||||
if ( VR_use_paging ) gr_show_canvas( &VR_screen_pages[VR_current_page] );
|
||||
#ifdef OGL
|
||||
ogl_set_screen_mode();
|
||||
#ifndef OGL
|
||||
gr_set_draw_buffer(((Screen_mode == SCREEN_GAME) && Game_double_buffer) ? 1 : 0); // Double buffering or 'front' buffer only
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1319,18 +1306,18 @@ void game_draw_hud_stuff()
|
|||
}
|
||||
|
||||
extern int gr_bitblt_dest_step_shift;
|
||||
extern int gr_wait_for_retrace;
|
||||
extern int gr_bitblt_double;
|
||||
|
||||
//render a frame for the game
|
||||
void game_do_render_frame(void)
|
||||
void game_do_render_frame(int flip)
|
||||
{
|
||||
grs_canvas Screen_3d_window;
|
||||
|
||||
gr_init_sub_canvas( &Screen_3d_window, &VR_screen_pages[0],
|
||||
VR_render_sub_buffer[0].cv_bitmap.bm_x, VR_render_sub_buffer[0].
|
||||
cv_bitmap.bm_y, VR_render_sub_buffer[0].cv_bitmap.bm_w,
|
||||
VR_render_sub_buffer[0].cv_bitmap.bm_h);
|
||||
gr_init_sub_canvas( &Screen_3d_window, &grd_curscreen->sc_canvas,
|
||||
VR_render_sub_buffer[0].cv_bitmap.bm_x,
|
||||
VR_render_sub_buffer[0].cv_bitmap.bm_y,
|
||||
VR_render_sub_buffer[0].cv_bitmap.bm_w,
|
||||
VR_render_sub_buffer[0].cv_bitmap.bm_h);
|
||||
|
||||
if ( Game_double_buffer )
|
||||
gr_set_current_canvas(&VR_render_sub_buffer[0]);
|
||||
|
@ -1342,22 +1329,13 @@ void game_do_render_frame(void)
|
|||
game_draw_hud_stuff();
|
||||
|
||||
if ( Game_double_buffer ) { //copy to visible screen
|
||||
if ( VR_use_paging ) {
|
||||
VR_current_page = !VR_current_page;
|
||||
gr_set_current_canvas( &VR_screen_pages[VR_current_page] );
|
||||
gr_bm_ubitblt( VR_render_sub_buffer[0].cv_w, VR_render_sub_buffer[0].cv_h, VR_render_sub_buffer[0].cv_bitmap.bm_x, VR_render_sub_buffer[0].cv_bitmap.bm_y, 0, 0, &VR_render_sub_buffer[0].cv_bitmap, &VR_screen_pages[VR_current_page].cv_bitmap );
|
||||
gr_wait_for_retrace = 0;
|
||||
gr_show_canvas( &VR_screen_pages[VR_current_page] );
|
||||
gr_wait_for_retrace = 1;
|
||||
} else {
|
||||
gr_bm_ubitblt( VR_render_sub_buffer[0].cv_w,
|
||||
VR_render_sub_buffer[0].cv_h,
|
||||
VR_render_sub_buffer[0].cv_bitmap.bm_x,
|
||||
VR_render_sub_buffer[0].cv_bitmap.bm_y,
|
||||
0, 0,
|
||||
&VR_render_sub_buffer[0].cv_bitmap,
|
||||
&VR_screen_pages[0].cv_bitmap );
|
||||
}
|
||||
gr_bm_ubitblt( VR_render_sub_buffer[0].cv_w,
|
||||
VR_render_sub_buffer[0].cv_h,
|
||||
VR_render_sub_buffer[0].cv_bitmap.bm_x,
|
||||
VR_render_sub_buffer[0].cv_bitmap.bm_y,
|
||||
0, 0,
|
||||
&VR_render_sub_buffer[0].cv_bitmap,
|
||||
&grd_curscreen->sc_canvas.cv_bitmap );
|
||||
}
|
||||
|
||||
update_cockpits(0);
|
||||
|
@ -1379,16 +1357,17 @@ void game_do_render_frame(void)
|
|||
if(show_radar && !Endlevel_sequence)
|
||||
radar_render_frame();
|
||||
|
||||
#ifdef OGL
|
||||
ogl_swap_buffers();
|
||||
#endif
|
||||
if (flip)
|
||||
gr_flip();
|
||||
else
|
||||
gr_update();
|
||||
}
|
||||
|
||||
void game_render_frame()
|
||||
{
|
||||
set_screen_mode( SCREEN_GAME );
|
||||
play_homing_warning();
|
||||
game_do_render_frame();
|
||||
game_do_render_frame(Game_double_buffer);
|
||||
stop_time();
|
||||
gr_palette_fade_in( gr_palette, 32, 0 );
|
||||
start_time();
|
||||
|
@ -1438,13 +1417,13 @@ void save_screen_shot(int automap_flag)
|
|||
}
|
||||
sprintf( message, "%s '%s'", TXT_DUMPING_SCREEN, savename );
|
||||
|
||||
gr_set_current_canvas(&VR_screen_pages[VR_current_page]);
|
||||
gr_set_current_canvas(NULL);
|
||||
save_font = grd_curcanv->cv_font;
|
||||
gr_set_curfont(GAME_FONT);
|
||||
gr_set_fontcolor(gr_find_closest_color_current(0,31,0),-1);
|
||||
gr_get_string_size(message,&w,&h,&aw);
|
||||
x = (VR_screen_pages[VR_current_page].cv_w-w)/2;
|
||||
y = (VR_screen_pages[VR_current_page].cv_h-h)/2;
|
||||
x = (grd_curcanv->cv_w-w)/2;
|
||||
y = (grd_curcanv->cv_h-h)/2;
|
||||
|
||||
if (automap_flag) {
|
||||
modex_print_message(32, y, message);
|
||||
|
@ -1727,7 +1706,7 @@ void show_boxed_message(char *msg)
|
|||
gr_clear_canvas(0);
|
||||
#endif
|
||||
|
||||
gr_set_current_canvas(&VR_screen_pages[VR_current_page]);
|
||||
gr_set_current_canvas(NULL);
|
||||
gr_set_curfont( HELP_FONT );
|
||||
|
||||
gr_get_string_size(msg,&w,&h,&aw);
|
||||
|
@ -1752,7 +1731,7 @@ void show_boxed_message(char *msg)
|
|||
gr_ustring( (grd_curscreen->sc_w-w)/2, y, msg );
|
||||
gr_update();
|
||||
#ifdef OGL
|
||||
ogl_swap_buffers();
|
||||
gr_flip();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2045,8 +2024,7 @@ void game()
|
|||
do_lunacy_on(); // Copy values for insane into copy buffer in ai.c
|
||||
do_lunacy_off(); // Restore true insane mode.
|
||||
Game_aborted = 0;
|
||||
last_drawn_cockpit[0] = -1; // Force cockpit to redraw next time a frame renders.
|
||||
last_drawn_cockpit[1] = -1; // Force cockpit to redraw next time a frame renders.
|
||||
last_drawn_cockpit = -1; // Force cockpit to redraw next time a frame renders.
|
||||
Endlevel_sequence = 0;
|
||||
cheat_enable_index = 0;
|
||||
|
||||
|
@ -2133,8 +2111,7 @@ void game()
|
|||
Screen_mode=-1; set_screen_mode(SCREEN_GAME);
|
||||
Game_window_w=save_w; Game_window_h=save_h;
|
||||
init_cockpit();
|
||||
last_drawn_cockpit[0] = -1;
|
||||
last_drawn_cockpit[1] = -1;
|
||||
last_drawn_cockpit = -1;
|
||||
if (VR_screen_mode != SCREEN_MENU)
|
||||
vr_reset_display();
|
||||
game_flush_inputs();
|
||||
|
@ -2235,11 +2212,6 @@ void close_game()
|
|||
clear_warn_func(game_show_warning); //don't use this func anymore
|
||||
}
|
||||
|
||||
grs_canvas * get_current_game_screen()
|
||||
{
|
||||
return &VR_screen_pages[VR_current_page];
|
||||
}
|
||||
|
||||
ubyte exploding_flag = 0;
|
||||
extern void dump_used_textures_all();
|
||||
int ostate_p=0;
|
||||
|
@ -2292,8 +2264,7 @@ void HandleEndlevelKey(int key)
|
|||
|
||||
if (key == KEY_ESC) {
|
||||
stop_endlevel_sequence();
|
||||
last_drawn_cockpit[0]=-1;
|
||||
last_drawn_cockpit[1]=-1;
|
||||
last_drawn_cockpit=-1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2399,7 +2370,7 @@ void HandleDemoKey(int key)
|
|||
int old_state;
|
||||
old_state = Newdemo_vcr_state;
|
||||
Newdemo_vcr_state = ND_STATE_PRINTSCREEN;
|
||||
game_do_render_frame();
|
||||
game_do_render_frame(Game_double_buffer);
|
||||
save_screen_shot(0);
|
||||
Newdemo_vcr_state = old_state;
|
||||
break;
|
||||
|
@ -3324,9 +3295,6 @@ void GameLoop(int RenderFlag, int ReadControlsFlag )
|
|||
force_cockpit_redraw=0;
|
||||
}
|
||||
game_render_frame();
|
||||
#ifndef D1XD3D
|
||||
gr_update();
|
||||
#endif
|
||||
}
|
||||
|
||||
// mprintf(0,"Velocity %2.2f\n", f2fl(vm_vec_mag(&ConsoleObject->phys_info.velocity)));
|
||||
|
|
199
main/game.h
199
main/game.h
|
@ -11,202 +11,9 @@
|
|||
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||
*/
|
||||
/*
|
||||
* $Source: /cvsroot/dxx-rebirth/d1x-rebirth/main/game.h,v $
|
||||
* $Revision: 1.1.1.1 $
|
||||
* $Author: zicodxx $
|
||||
* $Date: 2006/03/17 19:43:11 $
|
||||
*
|
||||
* Constants & prototypes which pertain to the game only
|
||||
*
|
||||
* $Log: game.h,v $
|
||||
* Revision 1.1.1.1 2006/03/17 19:43:11 zicodxx
|
||||
* initial import
|
||||
*
|
||||
* Revision 1.4 1999/11/21 13:00:08 donut
|
||||
* Changed screen_mode format. Now directly encodes res into a 32bit int, rather than using arbitrary values.
|
||||
*
|
||||
* Revision 1.3 1999/08/05 22:53:41 sekmu
|
||||
*
|
||||
* D3D patch(es) from ADB
|
||||
*
|
||||
* Revision 1.2 1999/07/10 02:59:07 donut
|
||||
* more from orulz
|
||||
*
|
||||
* Revision 1.1.1.1 1999/06/14 22:12:21 donut
|
||||
* Import of d1x 1.37 source.
|
||||
*
|
||||
* Revision 2.1 1995/03/06 15:23:22 john
|
||||
* New screen techniques.
|
||||
*
|
||||
* Revision 2.0 1995/02/27 11:28:21 john
|
||||
* New version 2.0, which has no anonymous unions, builds with
|
||||
* Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
|
||||
*
|
||||
* Revision 1.79 1995/02/13 10:37:17 john
|
||||
* Saved Buggin' cheat mode to save file.
|
||||
*
|
||||
* Revision 1.78 1995/02/01 16:34:12 john
|
||||
* Linted.
|
||||
*
|
||||
* Revision 1.77 1995/01/29 21:37:14 mike
|
||||
* initialize variables on game load so you don't drain your energy when you fire.
|
||||
*
|
||||
* Revision 1.76 1995/01/26 22:11:36 mike
|
||||
* Purple chromo-blaster (ie, fusion cannon) spruce up (chromification)
|
||||
*
|
||||
* Revision 1.75 1995/01/26 16:45:31 mike
|
||||
* Add autofire fusion cannon stuff.
|
||||
*
|
||||
* Revision 1.74 1994/12/11 23:18:06 john
|
||||
* Added -nomusic.
|
||||
* Added RealFrameTime.
|
||||
* Put in a pause when sound initialization error.
|
||||
* Made controlcen countdown and framerate use RealFrameTime.
|
||||
*
|
||||
* Revision 1.73 1994/12/09 00:41:24 mike
|
||||
* fix hang in automap print screen
|
||||
*
|
||||
* Revision 1.72 1994/12/04 13:47:00 mike
|
||||
* enhance custom detail level support.
|
||||
*
|
||||
* Revision 1.71 1994/12/02 15:05:44 matt
|
||||
* Added new "official" cheats
|
||||
*
|
||||
* Revision 1.70 1994/11/28 18:14:09 rob
|
||||
* Added game_mode flag for team games.
|
||||
*
|
||||
* Revision 1.69 1994/11/15 16:51:13 matt
|
||||
* Made rear view only switch to rear cockpit if cockpit on in front view
|
||||
*
|
||||
* Revision 1.68 1994/11/04 16:26:10 john
|
||||
* Fixed bug with letterbox mode game after you finish a game.
|
||||
*
|
||||
* Revision 1.67 1994/11/02 11:59:48 john
|
||||
* Moved menu out of game into inferno main loop.
|
||||
*
|
||||
* Revision 1.66 1994/10/26 23:02:19 matt
|
||||
* Made palette flash saturate negative values
|
||||
*
|
||||
* Revision 1.65 1994/10/26 15:21:05 mike
|
||||
* Detail level stuff. Make Render_depth public.
|
||||
*
|
||||
* Revision 1.64 1994/10/19 00:13:01 matt
|
||||
* Added prototypes
|
||||
*
|
||||
* Revision 1.63 1994/10/09 14:54:39 matt
|
||||
* Made player cockpit state & window size save/restore with saved games & automap
|
||||
*
|
||||
* Revision 1.62 1994/10/08 19:56:32 matt
|
||||
* Added prototype
|
||||
*
|
||||
* Revision 1.61 1994/10/07 22:19:32 mike
|
||||
* Increase number of difficulty levels from 4 to 5.
|
||||
*
|
||||
* Revision 1.60 1994/10/06 14:14:11 matt
|
||||
* Added new function to reset time (to prevent big FrameTime) at start of level
|
||||
*
|
||||
* Revision 1.59 1994/10/05 17:08:43 matt
|
||||
* Changed order of cockpit bitmaps, since there's no longer a full-screen cockpit
|
||||
*
|
||||
* Revision 1.58 1994/10/03 23:44:13 matt
|
||||
* Save & restore palette effect around menus & pause message
|
||||
*
|
||||
* Revision 1.57 1994/09/29 17:42:12 matt
|
||||
* Cleaned up game_mode a little
|
||||
*
|
||||
* Revision 1.56 1994/09/28 23:12:01 matt
|
||||
* Macroized palette flash system
|
||||
*
|
||||
* Revision 1.55 1994/09/24 16:56:13 rob
|
||||
* Added new fields for the Game_mode bitvector for modem play.
|
||||
*
|
||||
* Revision 1.54 1994/09/24 14:16:20 mike
|
||||
* Added new game mode constants.
|
||||
*
|
||||
* Revision 1.53 1994/09/22 19:00:57 mike
|
||||
* Move NDL from robot.h to here.
|
||||
*
|
||||
* Revision 1.52 1994/09/22 10:46:51 mike
|
||||
* Add difficulty levels.
|
||||
*
|
||||
* Revision 1.51 1994/09/17 01:39:52 matt
|
||||
* Added status bar/sizable window mode, and in the process revamped the
|
||||
* whole cockpit mode system.
|
||||
*
|
||||
* Revision 1.50 1994/09/15 21:23:10 matt
|
||||
* Changed system to keep track of whether & what cockpit is up
|
||||
*
|
||||
* Revision 1.49 1994/09/15 16:11:33 john
|
||||
* Added support for VFX1 head tracking. Fixed bug with memory over-
|
||||
* write when using stereo mode.
|
||||
*
|
||||
* Revision 1.48 1994/09/13 16:40:10 mike
|
||||
* Prototype Global_missile_firing_count.
|
||||
*
|
||||
* Revision 1.47 1994/09/13 11:19:05 mike
|
||||
* Add Next_missile_fire_time.
|
||||
*
|
||||
* Revision 1.46 1994/09/12 09:52:50 john
|
||||
* Made global flush function that flushes keyboard,mouse, and joystick.
|
||||
*
|
||||
* Revision 1.45 1994/09/03 15:24:14 mike
|
||||
* Make global Global_laser_firing_count.
|
||||
*
|
||||
* Revision 1.44 1994/08/31 19:26:57 mike
|
||||
* Prototypes for Next_laser_fire_time, Laser_delay_time.
|
||||
*
|
||||
* Revision 1.43 1994/08/18 10:47:22 john
|
||||
* Cleaned up game sequencing and player death stuff
|
||||
* in preparation for making the player explode into
|
||||
* pieces when dead.
|
||||
*
|
||||
* Revision 1.42 1994/08/11 18:03:53 matt
|
||||
* Added prototype
|
||||
*
|
||||
* Revision 1.41 1994/06/29 20:41:38 matt
|
||||
* Added new pause mode; cleaned up countdown & game startup code
|
||||
*
|
||||
* Revision 1.40 1994/06/24 17:03:49 john
|
||||
* Added VFX support. Also took all game sequencing stuff like
|
||||
* EndGame out and put it into gameseq.c
|
||||
*
|
||||
* Revision 1.39 1994/06/20 15:01:08 yuan
|
||||
* Added death when mine blows up...
|
||||
* Continues onto next level.
|
||||
*
|
||||
* Revision 1.38 1994/06/17 18:07:20 matt
|
||||
* Moved some vars out of ifdef
|
||||
*
|
||||
* Revision 1.37 1994/06/15 11:09:22 yuan
|
||||
* Moved gauge_message to mono screen for now.
|
||||
*
|
||||
* Revision 1.36 1994/05/30 20:22:11 yuan
|
||||
* New triggers.
|
||||
*
|
||||
* Revision 1.35 1994/05/27 10:32:48 yuan
|
||||
* New dialog boxes (Walls and Triggers) added.
|
||||
*
|
||||
*
|
||||
* Revision 1.34 1994/05/20 11:56:45 matt
|
||||
* Cleaned up find_vector_intersection() interface
|
||||
* Killed check_point_in_seg(), check_player_seg(), check_object_seg()
|
||||
*
|
||||
* Revision 1.33 1994/05/19 21:45:21 matt
|
||||
* Removed unused prototypes
|
||||
*
|
||||
* Revision 1.32 1994/05/19 18:53:17 yuan
|
||||
* Changing player structure...
|
||||
*
|
||||
* Revision 1.31 1994/05/16 16:38:35 yuan
|
||||
* Fixed palette add so it doesn't show up in the menu.
|
||||
*
|
||||
* Revision 1.30 1994/05/16 09:28:17 matt
|
||||
* Renamed init_player() to be init_player_stats(), added new funtion
|
||||
* init_player_object()
|
||||
*
|
||||
* Revision 1.29 1994/05/14 17:14:57 matt
|
||||
* Got rid of externs in source (non-header) files
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GAME_H
|
||||
|
@ -370,14 +177,8 @@ extern char faded_in;
|
|||
extern void stop_time (void);
|
||||
extern void start_time (void);
|
||||
extern void reset_time (void); //called when starting level
|
||||
|
||||
|
||||
// If automap_flag == 1, then call automap routine to write message.
|
||||
extern void save_screen_shot (int automap_flag);
|
||||
|
||||
extern grs_canvas *get_current_game_screen ();
|
||||
|
||||
|
||||
//valid modes for cockpit
|
||||
#define CM_FULL_COCKPIT 0 //normal screen with cockput
|
||||
#define CM_REAR_VIEW 1 //looking back with bitmap
|
||||
|
|
245
main/gauges.c
245
main/gauges.c
|
@ -167,15 +167,15 @@ grs_canvas *Canv_NumericalGauge;
|
|||
static int score_display;
|
||||
static fix score_time;
|
||||
|
||||
static int old_score[2] = { -1, -1 };
|
||||
static int old_energy[2] = { -1, -1 };
|
||||
static int old_shields[2] = { -1, -1 };
|
||||
static int old_flags[2] = { -1, -1 };
|
||||
static int old_weapon[2][2] = {{ -1, -1 },{-1,-1}};
|
||||
static int old_ammo_count[2][2] = {{ -1, -1 },{-1,-1}};
|
||||
static int old_cloak[2] = { 0, 0 };
|
||||
static int old_lives[2] = { -1, -1 };
|
||||
static int old_prox = -1;
|
||||
static int old_score = -1;
|
||||
static int old_energy = -1;
|
||||
static int old_shields = -1;
|
||||
static int old_flags = -1;
|
||||
static int old_weapon[2] = {-1, -1};
|
||||
static int old_ammo_count[2] = {-1, -1};
|
||||
static int old_cloak = 0;
|
||||
static int old_lives = -1;
|
||||
static int old_prox = -1;
|
||||
|
||||
static int invulnerable_frame = 0;
|
||||
static int cloak_fade_state; //0=steady, -1 fading out, 1 fading in
|
||||
|
@ -515,7 +515,7 @@ void sb_show_score()
|
|||
char score_str[20];
|
||||
int x,y;
|
||||
int w, h, aw;
|
||||
static int last_x[2]={SB_SCORE_RIGHT,SB_SCORE_RIGHT};
|
||||
static int last_x=SB_SCORE_RIGHT;
|
||||
int redraw_score;
|
||||
|
||||
if ( (Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP) )
|
||||
|
@ -551,7 +551,7 @@ void sb_show_score()
|
|||
|
||||
gr_printf(x,y,score_str);
|
||||
|
||||
last_x[VR_current_page] = x;
|
||||
last_x = x;
|
||||
}
|
||||
|
||||
void sb_show_score_added()
|
||||
|
@ -560,8 +560,8 @@ void sb_show_score_added()
|
|||
int w, h, aw;
|
||||
char score_str[32];
|
||||
int x;
|
||||
static int last_x[2]={SB_SCORE_ADDED_RIGHT,SB_SCORE_ADDED_RIGHT};
|
||||
static int last_score_display[2] = { -1, -1};
|
||||
static int last_x=SB_SCORE_ADDED_RIGHT;
|
||||
static int last_score_display = -1;
|
||||
|
||||
if ( (Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP) )
|
||||
return;
|
||||
|
@ -573,9 +573,9 @@ void sb_show_score_added()
|
|||
|
||||
score_time -= FrameTime;
|
||||
if (score_time > 0) {
|
||||
if (score_display != last_score_display[VR_current_page]) {
|
||||
if (score_display != last_score_display) {
|
||||
gr_setcolor(BM_XRGB(0,0,0));
|
||||
last_score_display[VR_current_page] = score_display;
|
||||
last_score_display = score_display;
|
||||
}
|
||||
|
||||
color = f2i(score_time * 20) + 10;
|
||||
|
@ -595,7 +595,7 @@ void sb_show_score_added()
|
|||
gr_set_fontcolor(gr_getcolor(0, color, 0),-1 );
|
||||
gr_printf(x, COCKPITSCALE_Y*SB_SCORE_ADDED_Y, score_str);
|
||||
|
||||
last_x[VR_current_page] = x;
|
||||
last_x = x;
|
||||
|
||||
} else {
|
||||
//erase old score
|
||||
|
@ -605,7 +605,7 @@ void sb_show_score_added()
|
|||
}
|
||||
}
|
||||
|
||||
fix Last_warning_beep_time[2] = {0,0}; // Time we last played homing missile warning beep.
|
||||
fix Last_warning_beep_time = 0; // Time we last played homing missile warning beep.
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void play_homing_warning(void)
|
||||
|
@ -622,48 +622,48 @@ void play_homing_warning(void)
|
|||
else if (beep_delay < F1_0/8)
|
||||
beep_delay = F1_0/8;
|
||||
|
||||
if (GameTime - Last_warning_beep_time[VR_current_page] > beep_delay/2) {
|
||||
if (GameTime - Last_warning_beep_time > beep_delay/2) {
|
||||
digi_play_sample( SOUND_HOMING_WARNING, F1_0 );
|
||||
Last_warning_beep_time[VR_current_page] = GameTime;
|
||||
Last_warning_beep_time = GameTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Last_homing_warning_shown[2]={-1,-1};
|
||||
int Last_homing_warning_shown=-1;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void show_homing_warning(void)
|
||||
{
|
||||
if ((Cockpit_mode == CM_STATUS_BAR) || (Endlevel_sequence)) {
|
||||
if (Last_homing_warning_shown[VR_current_page] == 1) {
|
||||
if (Last_homing_warning_shown == 1) {
|
||||
PIGGY_PAGE_IN( Gauges[GAUGE_HOMING_WARNING_OFF] );
|
||||
hud_bitblt( 7, 171, &GameBitmaps[Gauges[GAUGE_HOMING_WARNING_OFF].index], F1_0);
|
||||
Last_homing_warning_shown[VR_current_page] = 0;
|
||||
Last_homing_warning_shown = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
gr_set_current_canvas( get_current_game_screen() );
|
||||
gr_set_current_canvas( NULL );
|
||||
|
||||
if (Players[Player_num].homing_object_dist >= 0) {
|
||||
|
||||
if (GameTime & 0x4000) {
|
||||
if (Last_homing_warning_shown[VR_current_page] != 1) {
|
||||
if (Last_homing_warning_shown != 1) {
|
||||
PIGGY_PAGE_IN(Gauges[GAUGE_HOMING_WARNING_ON]);
|
||||
hud_bitblt( 7, 171, &GameBitmaps[Gauges[GAUGE_HOMING_WARNING_ON].index], F1_0);
|
||||
Last_homing_warning_shown[VR_current_page] = 1;
|
||||
Last_homing_warning_shown = 1;
|
||||
}
|
||||
} else {
|
||||
if (Last_homing_warning_shown[VR_current_page] != 0) {
|
||||
if (Last_homing_warning_shown != 0) {
|
||||
PIGGY_PAGE_IN(Gauges[GAUGE_HOMING_WARNING_OFF]);
|
||||
hud_bitblt( 7, 171, &GameBitmaps[Gauges[GAUGE_HOMING_WARNING_OFF].index], F1_0);
|
||||
Last_homing_warning_shown[VR_current_page] = 0;
|
||||
Last_homing_warning_shown = 0;
|
||||
}
|
||||
}
|
||||
} else if (Last_homing_warning_shown[VR_current_page] != 0) {
|
||||
} else if (Last_homing_warning_shown != 0) {
|
||||
PIGGY_PAGE_IN(Gauges[GAUGE_HOMING_WARNING_OFF]);
|
||||
hud_bitblt( 7, 171, &GameBitmaps[Gauges[GAUGE_HOMING_WARNING_OFF].index], F1_0);
|
||||
Last_homing_warning_shown[VR_current_page] = 0;
|
||||
Last_homing_warning_shown = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -724,13 +724,13 @@ void hud_show_energy(void)
|
|||
if (Newdemo_state==ND_STATE_RECORDING ) {
|
||||
int energy = f2ir(Players[Player_num].energy);
|
||||
|
||||
if (energy != old_energy[VR_current_page]) {
|
||||
if (energy != old_energy) {
|
||||
#ifdef SHAREWARE
|
||||
newdemo_record_player_energy(energy);
|
||||
#else
|
||||
newdemo_record_player_energy(old_energy[VR_current_page], energy);
|
||||
newdemo_record_player_energy(old_energy, energy);
|
||||
#endif
|
||||
old_energy[VR_current_page] = energy;
|
||||
old_energy = energy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -893,16 +893,16 @@ void hud_show_weapons(void)
|
|||
|
||||
#ifndef SHAREWARE
|
||||
if (Primary_weapon == VULCAN_INDEX) {
|
||||
if (Players[Player_num].primary_ammo[Primary_weapon] != old_ammo_count[0][VR_current_page]) {
|
||||
if (Players[Player_num].primary_ammo[Primary_weapon] != old_ammo_count[0]) {
|
||||
if (Newdemo_state == ND_STATE_RECORDING)
|
||||
newdemo_record_primary_ammo(old_ammo_count[0][VR_current_page], Players[Player_num].primary_ammo[Primary_weapon]);
|
||||
old_ammo_count[0][VR_current_page] = Players[Player_num].primary_ammo[Primary_weapon];
|
||||
newdemo_record_primary_ammo(old_ammo_count[0], Players[Player_num].primary_ammo[Primary_weapon]);
|
||||
old_ammo_count[0] = Players[Player_num].primary_ammo[Primary_weapon];
|
||||
}
|
||||
}
|
||||
if (Players[Player_num].secondary_ammo[Secondary_weapon] != old_ammo_count[1][VR_current_page]) {
|
||||
if (Players[Player_num].secondary_ammo[Secondary_weapon] != old_ammo_count[1]) {
|
||||
if (Newdemo_state == ND_STATE_RECORDING)
|
||||
newdemo_record_secondary_ammo(old_ammo_count[1][VR_current_page], Players[Player_num].secondary_ammo[Secondary_weapon]);
|
||||
old_ammo_count[1][VR_current_page] = Players[Player_num].secondary_ammo[Secondary_weapon];
|
||||
newdemo_record_secondary_ammo(old_ammo_count[1], Players[Player_num].secondary_ammo[Secondary_weapon]);
|
||||
old_ammo_count[1] = Players[Player_num].secondary_ammo[Secondary_weapon];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -958,13 +958,13 @@ void hud_show_shield(void)
|
|||
if (Newdemo_state==ND_STATE_RECORDING ) {
|
||||
int shields = f2ir(Players[Player_num].shields);
|
||||
|
||||
if (shields != old_shields[VR_current_page]) {
|
||||
if (shields != old_shields) {
|
||||
#ifdef SHAREWARE
|
||||
newdemo_record_player_shields(shields);
|
||||
#else
|
||||
newdemo_record_player_shields(old_shields[VR_current_page], shields);
|
||||
newdemo_record_player_shields(old_shields, shields);
|
||||
#endif
|
||||
old_shields[VR_current_page] = shields;
|
||||
old_shields = shields;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1012,19 +1012,19 @@ void sb_show_lives()
|
|||
{
|
||||
char killed_str[20];
|
||||
int w, h, aw;
|
||||
static int last_x[2] = {SB_SCORE_RIGHT,SB_SCORE_RIGHT};
|
||||
static int last_x = SB_SCORE_RIGHT;
|
||||
int x;
|
||||
|
||||
sprintf(killed_str, "%5d", Players[Player_num].net_killed_total);
|
||||
gr_get_string_size(killed_str, &w, &h, &aw);
|
||||
gr_setcolor(BM_XRGB(0,0,0));
|
||||
#ifndef OGL
|
||||
gr_rect(last_x[VR_current_page], y+1, SB_SCORE_RIGHT, y+GAME_FONT->ft_h);
|
||||
gr_rect(last_x, y+1, SB_SCORE_RIGHT, y+GAME_FONT->ft_h);
|
||||
#endif
|
||||
gr_set_fontcolor(gr_getcolor(0,20,0),-1);
|
||||
x = COCKPITSCALE_X*SB_SCORE_RIGHT-w-2;
|
||||
gr_printf(x, COCKPITSCALE_Y*y+1, killed_str);
|
||||
last_x[VR_current_page] = x;
|
||||
last_x = x;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1163,22 +1163,19 @@ void close_gauge_canvases()
|
|||
|
||||
void init_gauges()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<2; i++ ) {
|
||||
if ( ((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP)) || ((Newdemo_state == ND_STATE_PLAYBACK) && (Newdemo_game_mode & GM_MULTI) && !(Newdemo_game_mode & GM_MULTI_COOP)) )
|
||||
old_score[i] = -99;
|
||||
else
|
||||
old_score[i] = -1;
|
||||
old_energy[i] = -1;
|
||||
old_shields[i] = -1;
|
||||
old_flags[i] = -1;
|
||||
old_cloak[i] = -1;
|
||||
old_lives[i] = -1;
|
||||
if ( ((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP)) || ((Newdemo_state == ND_STATE_PLAYBACK) && (Newdemo_game_mode & GM_MULTI) && !(Newdemo_game_mode & GM_MULTI_COOP)) )
|
||||
old_score = -99;
|
||||
else
|
||||
old_score = -1;
|
||||
old_energy = -1;
|
||||
old_shields = -1;
|
||||
old_flags = -1;
|
||||
old_cloak = -1;
|
||||
old_lives = -1;
|
||||
|
||||
old_weapon[0][i] = old_weapon[1][i] = -1;
|
||||
old_ammo_count[0][i] = old_ammo_count[1][i] = -1;
|
||||
}
|
||||
old_weapon[0] = old_weapon[1] = -1;
|
||||
old_ammo_count[0] = old_ammo_count[1] = -1;
|
||||
|
||||
cloak_fade_state = 0;
|
||||
}
|
||||
|
@ -1229,7 +1226,7 @@ void draw_energy_bar(int energy)
|
|||
}
|
||||
}
|
||||
}
|
||||
gr_set_current_canvas( get_current_game_screen() );
|
||||
gr_set_current_canvas( NULL );
|
||||
|
||||
// Draw right energy bar
|
||||
PIGGY_PAGE_IN(Gauges[GAUGE_ENERGY_RIGHT]);
|
||||
|
@ -1265,7 +1262,7 @@ void draw_energy_bar(int energy)
|
|||
}
|
||||
}
|
||||
}
|
||||
gr_set_current_canvas( get_current_game_screen() );
|
||||
gr_set_current_canvas( NULL );
|
||||
}
|
||||
|
||||
#else // ZICO - SDL mode with non-scalable cockpit
|
||||
|
@ -1294,7 +1291,7 @@ void draw_energy_bar(int energy)
|
|||
if (x2 > x1) gr_uscanline( LEFT_ENERGY_GAUGE_X+x1, LEFT_ENERGY_GAUGE_X+x2, LEFT_ENERGY_GAUGE_Y+y );
|
||||
}
|
||||
|
||||
gr_set_current_canvas( get_current_game_screen() );
|
||||
gr_set_current_canvas( NULL );
|
||||
|
||||
// Draw right energy bar
|
||||
PIGGY_PAGE_IN(Gauges[GAUGE_ENERGY_RIGHT]);
|
||||
|
@ -1312,7 +1309,7 @@ void draw_energy_bar(int energy)
|
|||
if (x2 > x1) gr_uscanline( RIGHT_ENERGY_GAUGE_X+x1, RIGHT_ENERGY_GAUGE_X+x2, RIGHT_ENERGY_GAUGE_Y+y );
|
||||
}
|
||||
|
||||
gr_set_current_canvas( get_current_game_screen() );
|
||||
gr_set_current_canvas( NULL );
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -1405,7 +1402,7 @@ void draw_player_ship(int cloak_state,int old_cloak_state,int x, int y)
|
|||
gr_rect(COCKPITSCALE_X*x, COCKPITSCALE_Y*y, COCKPITSCALE_X*(x+bm->bm_w), COCKPITSCALE_Y*(y+bm->bm_h));
|
||||
Gr_scanline_darkening_level = GR_FADE_LEVELS;
|
||||
|
||||
gr_set_current_canvas( get_current_game_screen() );
|
||||
gr_set_current_canvas( NULL );
|
||||
|
||||
gr_bm_ubitbltm( bm->bm_w, bm->bm_h, x, y, x, y, &VR_render_buffer[0].cv_bitmap, &grd_curcanv->cv_bitmap);
|
||||
}
|
||||
|
@ -1432,13 +1429,13 @@ void draw_numerical_display(int shield, int energy)
|
|||
gr_printf( (grd_curscreen->sc_w/1.951)-(ew/2),
|
||||
(grd_curscreen->sc_h/1.5),"%d",energy);
|
||||
|
||||
gr_set_current_canvas( get_current_game_screen() );
|
||||
gr_set_current_canvas( NULL );
|
||||
}
|
||||
|
||||
|
||||
void draw_keys()
|
||||
{
|
||||
gr_set_current_canvas( get_current_game_screen() );
|
||||
gr_set_current_canvas( NULL );
|
||||
|
||||
if (Players[Player_num].flags & PLAYER_FLAGS_BLUE_KEY ) {
|
||||
PIGGY_PAGE_IN(Gauges[GAUGE_BLUE_KEY]);
|
||||
|
@ -1616,57 +1613,57 @@ int draw_weapon_box(int weapon_type,int weapon_num)
|
|||
|
||||
gr_set_curfont( GAME_FONT );
|
||||
|
||||
if (weapon_num != old_weapon[weapon_type][VR_current_page] && weapon_box_states[weapon_type] == WS_SET && (old_weapon[weapon_type][VR_current_page] != -1) && !Gauge_hud_mode)
|
||||
if (weapon_num != old_weapon[weapon_type] && weapon_box_states[weapon_type] == WS_SET && (old_weapon[weapon_type] != -1) && !Gauge_hud_mode)
|
||||
{
|
||||
weapon_box_states[weapon_type] = WS_FADING_OUT;
|
||||
weapon_box_fade_values[weapon_type]=i2f(GR_FADE_LEVELS-1);
|
||||
}
|
||||
|
||||
if ((old_weapon[weapon_type][VR_current_page] == -1) || gauge_update_hud_mode==2)
|
||||
if ((old_weapon[weapon_type] == -1) || gauge_update_hud_mode==2)
|
||||
{
|
||||
draw_weapon_info(weapon_type,weapon_num);
|
||||
old_weapon[weapon_type][VR_current_page] = weapon_num;
|
||||
old_ammo_count[weapon_type][VR_current_page]=-1;
|
||||
old_weapon[weapon_type] = weapon_num;
|
||||
old_ammo_count[weapon_type]=-1;
|
||||
drew_flag=1;
|
||||
weapon_box_states[weapon_type] = WS_SET;
|
||||
}
|
||||
|
||||
if (weapon_box_states[weapon_type] == WS_FADING_OUT) {
|
||||
draw_weapon_info(weapon_type,old_weapon[weapon_type][VR_current_page]);
|
||||
old_ammo_count[weapon_type][VR_current_page]=-1;
|
||||
draw_weapon_info(weapon_type,old_weapon[weapon_type]);
|
||||
old_ammo_count[weapon_type]=-1;
|
||||
drew_flag=1;
|
||||
weapon_box_fade_values[weapon_type] -= FrameTime * FADE_SCALE;
|
||||
if (weapon_box_fade_values[weapon_type] <= 0)
|
||||
{
|
||||
weapon_box_states[weapon_type] = WS_FADING_IN;
|
||||
old_weapon[weapon_type][VR_current_page] = weapon_num;
|
||||
old_weapon[weapon_type][!VR_current_page] = weapon_num;
|
||||
old_weapon[weapon_type] = weapon_num;
|
||||
old_weapon[weapon_type] = weapon_num;
|
||||
weapon_box_fade_values[weapon_type] = 0;
|
||||
}
|
||||
}
|
||||
else if (weapon_box_states[weapon_type] == WS_FADING_IN)
|
||||
{
|
||||
if (weapon_num != old_weapon[weapon_type][VR_current_page])
|
||||
if (weapon_num != old_weapon[weapon_type])
|
||||
{
|
||||
weapon_box_states[weapon_type] = WS_FADING_OUT;
|
||||
}
|
||||
else
|
||||
{
|
||||
draw_weapon_info(weapon_type,weapon_num);
|
||||
old_ammo_count[weapon_type][VR_current_page]=-1;
|
||||
old_ammo_count[weapon_type]=-1;
|
||||
drew_flag=1;
|
||||
weapon_box_fade_values[weapon_type] += FrameTime * FADE_SCALE;
|
||||
if (weapon_box_fade_values[weapon_type] >= i2f(GR_FADE_LEVELS-1)) {
|
||||
weapon_box_states[weapon_type] = WS_SET;
|
||||
old_weapon[weapon_type][!VR_current_page] = -1; //force redraw (at full fade-in) of other page
|
||||
old_weapon[weapon_type] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
draw_weapon_info(weapon_type, weapon_num);
|
||||
old_weapon[weapon_type][VR_current_page] = weapon_num;
|
||||
old_ammo_count[weapon_type][VR_current_page] = -1;
|
||||
old_weapon[weapon_type] = weapon_num;
|
||||
old_ammo_count[weapon_type] = -1;
|
||||
drew_flag = 1;
|
||||
}
|
||||
|
||||
|
@ -1685,7 +1682,7 @@ int draw_weapon_box(int weapon_type,int weapon_num)
|
|||
Gr_scanline_darkening_level = GR_FADE_LEVELS;
|
||||
}
|
||||
|
||||
gr_set_current_canvas(get_current_game_screen());
|
||||
gr_set_current_canvas(NULL);
|
||||
|
||||
return drew_flag;
|
||||
}
|
||||
|
@ -1702,15 +1699,15 @@ void draw_weapon_boxes()
|
|||
copy_gauge_box(&gauge_boxes[boxofs+0],&VR_render_buffer[0].cv_bitmap);
|
||||
|
||||
if (weapon_box_states[0] == WS_SET)
|
||||
if (Players[Player_num].primary_ammo[Primary_weapon] != old_ammo_count[0][VR_current_page])
|
||||
if (Players[Player_num].primary_ammo[Primary_weapon] != old_ammo_count[0])
|
||||
if (Primary_weapon == VULCAN_INDEX)
|
||||
{
|
||||
#ifndef SHAREWARE
|
||||
if (Newdemo_state == ND_STATE_RECORDING)
|
||||
newdemo_record_primary_ammo(old_ammo_count[0][VR_current_page], Players[Player_num].primary_ammo[Primary_weapon]);
|
||||
newdemo_record_primary_ammo(old_ammo_count[0], Players[Player_num].primary_ammo[Primary_weapon]);
|
||||
#endif
|
||||
draw_primary_ammo_info(f2i(VULCAN_AMMO_SCALE * Players[Player_num].primary_ammo[Primary_weapon]));
|
||||
old_ammo_count[0][VR_current_page] = Players[Player_num].primary_ammo[Primary_weapon];
|
||||
old_ammo_count[0] = Players[Player_num].primary_ammo[Primary_weapon];
|
||||
}
|
||||
|
||||
drew = draw_weapon_box(1,Secondary_weapon);
|
||||
|
@ -1718,16 +1715,16 @@ void draw_weapon_boxes()
|
|||
copy_gauge_box(&gauge_boxes[boxofs+1],&VR_render_buffer[0].cv_bitmap);
|
||||
|
||||
if (weapon_box_states[1] == WS_SET)
|
||||
if (Players[Player_num].secondary_ammo[Secondary_weapon] != old_ammo_count[1][VR_current_page] || Players[Player_num].secondary_ammo[2] != old_prox)
|
||||
if (Players[Player_num].secondary_ammo[Secondary_weapon] != old_ammo_count[1] || Players[Player_num].secondary_ammo[2] != old_prox)
|
||||
{
|
||||
old_prox=Players[Player_num].secondary_ammo[2];
|
||||
|
||||
#ifndef SHAREWARE
|
||||
if (Newdemo_state == ND_STATE_RECORDING)
|
||||
newdemo_record_secondary_ammo(old_ammo_count[1][VR_current_page], Players[Player_num].secondary_ammo[Secondary_weapon]);
|
||||
newdemo_record_secondary_ammo(old_ammo_count[1], Players[Player_num].secondary_ammo[Secondary_weapon]);
|
||||
#endif
|
||||
draw_secondary_ammo_info(Players[Player_num].secondary_ammo[Secondary_weapon]);
|
||||
old_ammo_count[1][VR_current_page] = Players[Player_num].secondary_ammo[Secondary_weapon];
|
||||
old_ammo_count[1] = Players[Player_num].secondary_ammo[Secondary_weapon];
|
||||
}
|
||||
|
||||
if(gauge_update_hud_mode)
|
||||
|
@ -1756,7 +1753,7 @@ void sb_draw_energy_bar(int energy)
|
|||
gr_rect(COCKPITSCALE_X*SB_ENERGY_GAUGE_X,COCKPITSCALE_Y*SB_ENERGY_GAUGE_Y,COCKPITSCALE_X*(SB_ENERGY_GAUGE_X+SB_ENERGY_GAUGE_W)-1,COCKPITSCALE_Y*(SB_ENERGY_GAUGE_Y+(erase_height-1)));
|
||||
}
|
||||
|
||||
gr_set_current_canvas( get_current_game_screen() );
|
||||
gr_set_current_canvas( NULL );
|
||||
|
||||
//draw numbers
|
||||
gr_set_fontcolor(gr_getcolor(25,18,6),-1 );
|
||||
|
@ -1784,7 +1781,7 @@ void sb_draw_shield_bar(int shield)
|
|||
{
|
||||
int bm_num = shield>=100?9:(shield / 10);
|
||||
|
||||
gr_set_current_canvas( get_current_game_screen() );
|
||||
gr_set_current_canvas( NULL );
|
||||
|
||||
PIGGY_PAGE_IN( Gauges[GAUGE_SHIELDS+9-bm_num] );
|
||||
hud_bitblt( SB_SHIELD_GAUGE_X, SB_SHIELD_GAUGE_Y, &GameBitmaps[Gauges[GAUGE_SHIELDS+9-bm_num].index], F1_0);
|
||||
|
@ -1795,7 +1792,7 @@ void sb_draw_keys()
|
|||
grs_bitmap * bm;
|
||||
int flags = Players[Player_num].flags;
|
||||
|
||||
gr_set_current_canvas( get_current_game_screen() );
|
||||
gr_set_current_canvas( NULL );
|
||||
|
||||
bm = &GameBitmaps[Gauges[(flags&PLAYER_FLAGS_BLUE_KEY)?SB_GAUGE_BLUE_KEY:SB_GAUGE_BLUE_KEY_OFF].index];
|
||||
PIGGY_PAGE_IN(Gauges[(flags&PLAYER_FLAGS_BLUE_KEY)?SB_GAUGE_BLUE_KEY:SB_GAUGE_BLUE_KEY_OFF]);
|
||||
|
@ -1813,7 +1810,7 @@ void draw_invulnerable_ship()
|
|||
{
|
||||
static fix time=0;
|
||||
|
||||
gr_set_current_canvas( get_current_game_screen() );
|
||||
gr_set_current_canvas( NULL );
|
||||
|
||||
if (((Players[Player_num].invulnerable_time + INVULNERABLE_TIME_MAX - GameTime) > F1_0*4) || (GameTime & 0x8000)) {
|
||||
|
||||
|
@ -1844,7 +1841,7 @@ void draw_hostage_gauge()
|
|||
int drew;
|
||||
|
||||
// gr_set_current_canvas(Canv_game_offscrn);
|
||||
gr_set_current_canvas(get_current_game_screen());
|
||||
gr_set_current_canvas(NULL);
|
||||
|
||||
drew = do_hostage_effects();
|
||||
|
||||
|
@ -1854,7 +1851,7 @@ void draw_hostage_gauge()
|
|||
// gr_set_current_canvas(Canv_game);
|
||||
// copy_gauge_box(&gauge_boxes[boxofs+1],&Canv_game_offscrn->cv_bitmap);
|
||||
|
||||
old_weapon[1][VR_current_page] = old_ammo_count[1][VR_current_page] = -1;
|
||||
old_weapon[1] = old_ammo_count[1] = -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2172,9 +2169,9 @@ void draw_hud()
|
|||
hud_show_keys();
|
||||
hud_show_cloak_invuln();
|
||||
|
||||
if ( ( Newdemo_state==ND_STATE_RECORDING ) && ( Players[Player_num].flags != old_flags[VR_current_page] )) {
|
||||
newdemo_record_player_flags(old_flags[VR_current_page], Players[Player_num].flags);
|
||||
old_flags[VR_current_page] = Players[Player_num].flags;
|
||||
if ( ( Newdemo_state==ND_STATE_RECORDING ) && ( Players[Player_num].flags != old_flags )) {
|
||||
newdemo_record_player_flags(old_flags, Players[Player_num].flags);
|
||||
old_flags = Players[Player_num].flags;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2222,7 +2219,7 @@ void render_gauges()
|
|||
|
||||
if (shields < 0 ) shields = 0;
|
||||
|
||||
gr_set_current_canvas(get_current_game_screen());
|
||||
gr_set_current_canvas(NULL);
|
||||
gr_set_curfont( GAME_FONT );
|
||||
|
||||
if (Newdemo_state == ND_STATE_RECORDING)
|
||||
|
@ -2230,50 +2227,50 @@ void render_gauges()
|
|||
newdemo_record_homing_distance(Players[Player_num].homing_object_dist);
|
||||
|
||||
if (Cockpit_mode == CM_FULL_COCKPIT)
|
||||
draw_player_ship(cloak, old_cloak[VR_current_page], SHIP_GAUGE_X, SHIP_GAUGE_Y);
|
||||
draw_player_ship(cloak, old_cloak, SHIP_GAUGE_X, SHIP_GAUGE_Y);
|
||||
else
|
||||
draw_player_ship(cloak, old_cloak[VR_current_page], SB_SHIP_GAUGE_X, SB_SHIP_GAUGE_Y);
|
||||
draw_player_ship(cloak, old_cloak, SB_SHIP_GAUGE_X, SB_SHIP_GAUGE_Y);
|
||||
|
||||
old_cloak[VR_current_page] = cloak;
|
||||
old_cloak = cloak;
|
||||
|
||||
#ifdef OGL // draw now so draw_wbu_border does not overlap other gauges
|
||||
draw_weapon_boxes();
|
||||
#endif
|
||||
|
||||
if (Cockpit_mode == CM_FULL_COCKPIT) {
|
||||
if (Newdemo_state == ND_STATE_RECORDING && (energy != old_energy[VR_current_page]))
|
||||
if (Newdemo_state == ND_STATE_RECORDING && (energy != old_energy))
|
||||
{
|
||||
newdemo_record_player_energy(
|
||||
#ifndef SHAREWARE
|
||||
old_energy[VR_current_page],
|
||||
old_energy,
|
||||
#endif
|
||||
energy);
|
||||
old_energy[VR_current_page] = energy;
|
||||
old_energy = energy;
|
||||
}
|
||||
draw_energy_bar(energy);
|
||||
draw_numerical_display(shields, energy);
|
||||
|
||||
if (Players[Player_num].flags & PLAYER_FLAGS_INVULNERABLE) {
|
||||
draw_invulnerable_ship();
|
||||
old_shields[VR_current_page] = shields ^ 1;
|
||||
old_shields = shields ^ 1;
|
||||
} else { // Draw the shield gauge
|
||||
if (Newdemo_state == ND_STATE_RECORDING && (shields != old_shields[VR_current_page]))
|
||||
if (Newdemo_state == ND_STATE_RECORDING && (shields != old_shields))
|
||||
{
|
||||
newdemo_record_player_shields(
|
||||
#ifndef SHAREWARE
|
||||
old_shields[VR_current_page],
|
||||
old_shields,
|
||||
#endif
|
||||
shields);
|
||||
old_shields[VR_current_page] = shields;
|
||||
old_shields = shields;
|
||||
}
|
||||
draw_shield_bar(shields);
|
||||
}
|
||||
draw_numerical_display(shields, energy);
|
||||
|
||||
if (Newdemo_state == ND_STATE_RECORDING && (Players[Player_num].flags != old_flags[VR_current_page]))
|
||||
if (Newdemo_state == ND_STATE_RECORDING && (Players[Player_num].flags != old_flags))
|
||||
{
|
||||
newdemo_record_player_flags(old_flags[VR_current_page], Players[Player_num].flags);
|
||||
old_flags[VR_current_page] = Players[Player_num].flags;
|
||||
newdemo_record_player_flags(old_flags, Players[Player_num].flags);
|
||||
old_flags = Players[Player_num].flags;
|
||||
}
|
||||
draw_keys();
|
||||
|
||||
|
@ -2281,41 +2278,41 @@ void render_gauges()
|
|||
|
||||
} else if (Cockpit_mode == CM_STATUS_BAR) {
|
||||
|
||||
if (Newdemo_state == ND_STATE_RECORDING && (energy != old_energy[VR_current_page]))
|
||||
if (Newdemo_state == ND_STATE_RECORDING && (energy != old_energy))
|
||||
{
|
||||
newdemo_record_player_energy(
|
||||
#ifndef SHAREWARE
|
||||
old_energy[VR_current_page],
|
||||
old_energy,
|
||||
#endif
|
||||
energy);
|
||||
old_energy[VR_current_page] = energy;
|
||||
old_energy = energy;
|
||||
}
|
||||
sb_draw_energy_bar(energy);
|
||||
|
||||
if (Players[Player_num].flags & PLAYER_FLAGS_INVULNERABLE)
|
||||
{
|
||||
draw_invulnerable_ship();
|
||||
old_shields[VR_current_page] = shields ^ 1;
|
||||
old_shields = shields ^ 1;
|
||||
}
|
||||
else
|
||||
{ // Draw the shield gauge
|
||||
if (Newdemo_state == ND_STATE_RECORDING && (shields != old_shields[VR_current_page]))
|
||||
if (Newdemo_state == ND_STATE_RECORDING && (shields != old_shields))
|
||||
{
|
||||
newdemo_record_player_shields(
|
||||
#ifndef SHAREWARE
|
||||
old_shields[VR_current_page],
|
||||
old_shields,
|
||||
#endif
|
||||
shields);
|
||||
old_shields[VR_current_page] = shields;
|
||||
old_shields = shields;
|
||||
}
|
||||
sb_draw_shield_bar(shields);
|
||||
}
|
||||
sb_draw_shield_num(shields);
|
||||
|
||||
if (Newdemo_state == ND_STATE_RECORDING && (Players[Player_num].flags != old_flags[VR_current_page]))
|
||||
if (Newdemo_state == ND_STATE_RECORDING && (Players[Player_num].flags != old_flags))
|
||||
{
|
||||
newdemo_record_player_flags(old_flags[VR_current_page], Players[Player_num].flags);
|
||||
old_flags[VR_current_page] = Players[Player_num].flags;
|
||||
newdemo_record_player_flags(old_flags, Players[Player_num].flags);
|
||||
old_flags = Players[Player_num].flags;
|
||||
}
|
||||
sb_draw_keys();
|
||||
|
||||
|
@ -2324,23 +2321,23 @@ void render_gauges()
|
|||
if ((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP))
|
||||
{
|
||||
sb_show_lives();
|
||||
old_lives[VR_current_page] = Players[Player_num].net_killed_total;
|
||||
old_lives = Players[Player_num].net_killed_total;
|
||||
}
|
||||
else
|
||||
{
|
||||
sb_show_lives();
|
||||
old_lives[VR_current_page] = Players[Player_num].lives;
|
||||
old_lives = Players[Player_num].lives;
|
||||
}
|
||||
|
||||
if ((Game_mode&GM_MULTI) && !(Game_mode & GM_MULTI_COOP))
|
||||
{
|
||||
sb_show_score();
|
||||
old_score[VR_current_page] = Players[Player_num].net_kills_total;
|
||||
old_score = Players[Player_num].net_kills_total;
|
||||
}
|
||||
else
|
||||
{
|
||||
sb_show_score();
|
||||
old_score[VR_current_page] = Players[Player_num].score;
|
||||
old_score = Players[Player_num].score;
|
||||
sb_show_score_added();
|
||||
}
|
||||
}
|
||||
|
@ -2354,7 +2351,7 @@ void render_gauges()
|
|||
// If laser is active, set old_weapon[0] to -1 to force redraw.
|
||||
void update_laser_weapon_info(void)
|
||||
{
|
||||
if (old_weapon[0][VR_current_page] == 0)
|
||||
old_weapon[0][VR_current_page] = -1;
|
||||
if (old_weapon[0] == 0)
|
||||
old_weapon[0] = -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ void clear_background_messages(void)
|
|||
{
|
||||
if ((Cockpit_mode == CM_STATUS_BAR) && (Last_msg_ycrd != -1) && (VR_render_sub_buffer[0].cv_bitmap.bm_y >= 6)) {
|
||||
grs_canvas *canv_save = grd_curcanv;
|
||||
gr_set_current_canvas(get_current_game_screen());
|
||||
gr_set_current_canvas(NULL);
|
||||
copy_background_rect(0, Last_msg_ycrd, grd_curcanv->cv_bitmap.bm_w, Last_msg_ycrd+Last_msg_height-1);
|
||||
gr_set_current_canvas(canv_save);
|
||||
Displayed_background_message[0] = 0;
|
||||
|
@ -298,7 +298,7 @@ void HUD_render_message_frame()
|
|||
if (ycrd < 0)
|
||||
ycrd = 0;
|
||||
|
||||
gr_set_current_canvas(get_current_game_screen());
|
||||
gr_set_current_canvas(NULL);
|
||||
|
||||
gr_get_string_size(message, &w, &h, &aw );
|
||||
clear_background_messages();
|
||||
|
|
|
@ -570,7 +570,6 @@ int main(int argc,char **argv)
|
|||
{
|
||||
int old_screen_mode = Screen_mode;
|
||||
Screen_mode = MENU_SCREEN_MODE;
|
||||
ogl_set_screen_mode();
|
||||
Screen_mode = old_screen_mode;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -648,7 +648,7 @@ void kconfig_sub(kc_item * items,int nitems, char * title)
|
|||
|
||||
gr_set_current_canvas(NULL);
|
||||
#ifdef OGL
|
||||
ogl_swap_buffers();
|
||||
gr_flip();
|
||||
nm_draw_background1(NULL);
|
||||
#endif
|
||||
nm_draw_background((SWIDTH/2)-(w/2)-15*(SWIDTH/320), (SHEIGHT/2)-(h/2)-15*(SHEIGHT/200), (SWIDTH/2)+(w/2)+15*(SWIDTH/320), (SHEIGHT/2)+(h/2)+15*(SHEIGHT/200));
|
||||
|
|
|
@ -351,7 +351,7 @@ void kmatrix_view(int network)
|
|||
done = 1;
|
||||
}
|
||||
#ifdef OGL
|
||||
ogl_swap_buffers();
|
||||
gr_flip();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -568,7 +568,7 @@ int network_join_game_menu() {
|
|||
|
||||
while (!done) {
|
||||
#ifdef OGL
|
||||
ogl_swap_buffers();
|
||||
gr_flip();
|
||||
netlist_redraw(bg,menu_text,lis);
|
||||
#endif
|
||||
if (Network_socket != old_socket) {
|
||||
|
|
|
@ -803,7 +803,7 @@ int newmenu_do3_real( char * title, char * subtitle, int nitems, newmenu_item *
|
|||
while(!done) {
|
||||
d_delay(5);
|
||||
#ifdef OGL
|
||||
ogl_swap_buffers();
|
||||
gr_flip();
|
||||
|
||||
gr_set_current_canvas( NULL );
|
||||
nm_draw_background1(filename);
|
||||
|
@ -1645,7 +1645,7 @@ ReadFileNames:
|
|||
gr_update();
|
||||
|
||||
#ifdef OGL
|
||||
ogl_swap_buffers();
|
||||
gr_flip();
|
||||
nm_draw_background1(NULL);
|
||||
nm_draw_background( w_x,w_y,w_x+w_w-1,w_y+w_h );
|
||||
grd_curcanv->cv_font = Gamefonts[GFONT_MEDIUM_3];
|
||||
|
@ -2041,7 +2041,7 @@ int newmenu_listbox1( char * title, int nitems, char * items[], int allow_abort_
|
|||
while(!done) {
|
||||
d_delay(5);
|
||||
#ifdef OGL
|
||||
ogl_swap_buffers();
|
||||
gr_flip();
|
||||
nm_draw_background1(NULL);
|
||||
nm_draw_background( wx-(15*MENSCALE_X),wy-title_height-(15*MENSCALE_Y),wx+width+(15*MENSCALE_X),wy+height+(15*MENSCALE_Y) );
|
||||
grd_curcanv->cv_font = Gamefonts[GFONT_MEDIUM_3];
|
||||
|
|
|
@ -607,7 +607,7 @@ ReshowScores:
|
|||
d_delay(5);
|
||||
gr_set_current_canvas(NULL);
|
||||
#ifdef OGL
|
||||
ogl_swap_buffers();
|
||||
gr_flip();
|
||||
nm_draw_background1(NULL);
|
||||
#endif
|
||||
nm_draw_background((SWIDTH/2)-(w/2)-15*(SWIDTH/320), (SHEIGHT/2)-(h/2)-15*(SHEIGHT/200), (SWIDTH/2)+(w/2)+15*(SWIDTH/320), (SHEIGHT/2)+(h/2)+15*(SHEIGHT/200));
|
||||
|
|
|
@ -130,7 +130,7 @@ int show_title_screen( char * filename, int allow_keys )
|
|||
gr_update();
|
||||
//end addition - adb
|
||||
#ifdef OGL
|
||||
ogl_swap_buffers();
|
||||
gr_flip();
|
||||
#endif
|
||||
gr_free_bitmap_data (&title_bm);
|
||||
|
||||
|
@ -784,7 +784,7 @@ int show_briefing_message(int screen_num, char *message)
|
|||
;
|
||||
d_delay(5);
|
||||
#ifdef OGL
|
||||
ogl_swap_buffers();
|
||||
gr_flip();
|
||||
gr_clear_canvas(255);
|
||||
ogl_ubitmapm_cs(0,0,-1,-1,&briefing_bm,-1,F1_0);
|
||||
redraw_messagestream(streamcount);
|
||||
|
@ -858,7 +858,7 @@ int show_briefing_message(int screen_num, char *message)
|
|||
messagestream[streamcount].color = Briefing_foreground_colors[Current_color];
|
||||
messagestream[streamcount].ch = ch;
|
||||
if (delay_count) {
|
||||
ogl_swap_buffers();
|
||||
gr_flip();
|
||||
gr_clear_canvas(255);
|
||||
ogl_ubitmapm_cs(0,0,-1,-1,&briefing_bm,-1,F1_0);
|
||||
redraw_messagestream(streamcount);
|
||||
|
@ -919,7 +919,7 @@ int show_briefing_message(int screen_num, char *message)
|
|||
;
|
||||
d_delay(15);
|
||||
#ifdef OGL
|
||||
ogl_swap_buffers();
|
||||
gr_flip();
|
||||
gr_clear_canvas(255);
|
||||
ogl_ubitmapm_cs(0,0,-1,-1,&briefing_bm,-1,F1_0);
|
||||
redraw_messagestream(streamcount);
|
||||
|
|
Loading…
Reference in a new issue