Made PlayerCfg.CockpitMode an array to hold two values: 0 to store the actual cockpit, 1 to also store Letterbox, Rear, etc. Greatly helps to switch and restore views - especially in Demo playback which now properly selects modes

This commit is contained in:
zicodxx 2010-01-28 00:04:29 +00:00
parent 71c656200b
commit 3d9791ca69
11 changed files with 134 additions and 141 deletions

View file

@ -1,5 +1,9 @@
D2X-Rebirth Changelog
20100128
--------
main/playsave.c, main/playsave.h, main/object.c, main/render.c, main/hostage.c, main/newdemo.c, main/gamerend.c, main/endlevel.c, main/game.c, main/gauges.c: Made PlayerCfg.CockpitMode an array to hold two values: 0 to store the actual "cockpit", 1 to also store Letterbox, Rear, etc. Greatly helps to switch and restore views - especially in Demo playback which now properly selects modes
20100127
--------
main/game.c, main/game.h, main/gamecntl.c, main/gameseq.c, main/kmatrix.c, main/multi.c, main/net_ipx.c, main/net_udp.c, main/newdemo.c, main/render.c: Remove all uses of LeaveGame jmpbuf to allow more changing of main loop

View file

@ -347,8 +347,6 @@ void start_endlevel_sequence()
PlayerFinishedLevel(0); //done with level
}
static int cockpit_mode_save;
void start_rendered_endlevel_sequence()
{
int last_segnum,exit_side,tunnel_length;
@ -394,8 +392,6 @@ void start_rendered_endlevel_sequence()
}
cockpit_mode_save = PlayerCfg.CockpitMode;
#ifdef NETWORK
if (Game_mode & GM_MULTI) {
multi_send_endlevel_start(0);
@ -509,7 +505,7 @@ void stop_endlevel_sequence()
{
Interpolation_method = 0;
select_cockpit(cockpit_mode_save);
select_cockpit(PlayerCfg.CockpitMode[0]);
Endlevel_sequence = EL_OFF;

View file

@ -127,7 +127,6 @@ grs_canvas VR_render_buffer[2]; // Two offscreen buffers for left/right eye
grs_canvas VR_render_sub_buffer[2]; // Two sub buffers for left/right eyes.
grs_canvas VR_editor_canvas; // The canvas that the editor writes to.
static int old_cockpit_mode=-1;
int force_cockpit_redraw=0;
int PaletteRedAdd, PaletteGreenAdd, PaletteBlueAdd;
@ -208,8 +207,6 @@ void game_show_warning(char *s)
u_int32_t Game_screen_mode = SM(640,480);
extern void newdemo_record_cockpit_change(int);
//initialize the various canvases on the game screen
//called every time the screen mode or cockpit changes
void init_cockpit()
@ -220,17 +217,17 @@ void init_cockpit()
return;
if (( Screen_mode == SCREEN_EDITOR ) || ( VR_render_mode != VR_NONE ))
PlayerCfg.CockpitMode = CM_FULL_SCREEN;
PlayerCfg.CockpitMode[1] = CM_FULL_SCREEN;
#ifndef OGL
if ( Game_screen_mode != (GameArg.GfxHiresGFXAvailable? SM(640,480) : SM(320,200)) && PlayerCfg.CockpitMode != CM_LETTERBOX) {
PlayerCfg.CockpitMode = CM_FULL_SCREEN;
if ( Game_screen_mode != (GameArg.GfxHiresGFXAvailable? SM(640,480) : SM(320,200)) && PlayerCfg.CockpitMode[1] != CM_LETTERBOX) {
PlayerCfg.CockpitMode[1] = CM_FULL_SCREEN;
}
#endif
gr_set_current_canvas(NULL);
switch( PlayerCfg.CockpitMode ) {
switch( PlayerCfg.CockpitMode[1] ) {
case CM_FULL_COCKPIT:
game_init_render_sub_buffers(0, 0, SWIDTH, (SHEIGHT*2)/3);
break;
@ -259,18 +256,14 @@ void init_cockpit()
}
}
if (Newdemo_state==ND_STATE_RECORDING) {
newdemo_record_cockpit_change(PlayerCfg.CockpitMode);
}
gr_set_current_canvas(NULL);
}
//selects a given cockpit (or lack of one). See types in game.h
void select_cockpit(int mode)
{
if (mode != PlayerCfg.CockpitMode) { //new mode
PlayerCfg.CockpitMode=mode;
if (mode != PlayerCfg.CockpitMode[1]) { //new mode
PlayerCfg.CockpitMode[1]=mode;
init_cockpit();
}
}
@ -1028,8 +1021,8 @@ void check_rear_view()
if (Rear_view) {
Rear_view = 0;
if (PlayerCfg.CockpitMode==CM_REAR_VIEW) {
select_cockpit(old_cockpit_mode);
if (PlayerCfg.CockpitMode[1]==CM_REAR_VIEW) {
select_cockpit(PlayerCfg.CockpitMode[0]);
}
if (Newdemo_state == ND_STATE_RECORDING)
newdemo_record_restore_rearview();
@ -1038,8 +1031,7 @@ void check_rear_view()
Rear_view = 1;
leave_mode = 0; //means wait for another key
entry_time = timer_get_fixed_seconds();
if (PlayerCfg.CockpitMode == CM_FULL_COCKPIT) {
old_cockpit_mode = PlayerCfg.CockpitMode;
if (PlayerCfg.CockpitMode[1] == CM_FULL_COCKPIT) {
select_cockpit(CM_REAR_VIEW);
}
if (Newdemo_state == ND_STATE_RECORDING)
@ -1056,8 +1048,8 @@ void check_rear_view()
{
if (leave_mode==1 && Rear_view) {
Rear_view = 0;
if (PlayerCfg.CockpitMode==CM_REAR_VIEW) {
select_cockpit(old_cockpit_mode);
if (PlayerCfg.CockpitMode[1]==CM_REAR_VIEW) {
select_cockpit(PlayerCfg.CockpitMode[0]);
}
if (Newdemo_state == ND_STATE_RECORDING)
newdemo_record_restore_rearview();
@ -1073,13 +1065,7 @@ void reset_rear_view(void)
}
Rear_view = 0;
if (!(PlayerCfg.CockpitMode == CM_FULL_COCKPIT || PlayerCfg.CockpitMode == CM_STATUS_BAR || PlayerCfg.CockpitMode == CM_FULL_SCREEN)) {
if (!(old_cockpit_mode == CM_FULL_COCKPIT || old_cockpit_mode == CM_STATUS_BAR || old_cockpit_mode == CM_FULL_SCREEN))
old_cockpit_mode = CM_FULL_COCKPIT;
select_cockpit(old_cockpit_mode);
}
select_cockpit(PlayerCfg.CockpitMode[0]);
}
int Config_menu_flag;
@ -1139,6 +1125,7 @@ window *game_setup(void)
do_lunacy_on(); // Copy values for insane into copy buffer in ai.c
do_lunacy_off(); // Restore true insane mode.
Game_aborted = 0;
PlayerCfg.CockpitMode[1] = PlayerCfg.CockpitMode[0];
last_drawn_cockpit = -1; // Force cockpit to redraw next time a frame renders.
Endlevel_sequence = 0;

View file

@ -127,12 +127,12 @@ void show_framerate()
if (frame_time_total) {
int y=GHEIGHT;
if (PlayerCfg.CockpitMode==CM_FULL_SCREEN) {
if (PlayerCfg.CockpitMode[1]==CM_FULL_SCREEN) {
if ((Game_mode & GM_MULTI) || (Newdemo_state == ND_STATE_PLAYBACK && Newdemo_game_mode && GM_MULTI))
y -= LINE_SPACING * 10;
else
y -= LINE_SPACING * 5;
} else if (PlayerCfg.CockpitMode == CM_STATUS_BAR) {
} else if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR) {
if ((Game_mode & GM_MULTI) || (Newdemo_state == ND_STATE_PLAYBACK && Newdemo_game_mode && GM_MULTI))
y -= LINE_SPACING * 6;
else
@ -389,28 +389,28 @@ void game_draw_hud_stuff()
y = GHEIGHT-(LINE_SPACING*2);
if (PlayerCfg.CockpitMode == CM_FULL_COCKPIT)
if (PlayerCfg.CockpitMode[1] == CM_FULL_COCKPIT)
y = grd_curcanv->cv_bitmap.bm_h / 1.2 ;
if (PlayerCfg.CockpitMode != CM_REAR_VIEW)
if (PlayerCfg.CockpitMode[1] != CM_REAR_VIEW)
gr_printf(0x8000, y, message );
}
render_countdown_gauge();
// this should be made part of hud code some day
if ( Player_num > -1 && Viewer->type==OBJ_PLAYER && Viewer->id==Player_num && PlayerCfg.CockpitMode != CM_REAR_VIEW) {
if ( Player_num > -1 && Viewer->type==OBJ_PLAYER && Viewer->id==Player_num && PlayerCfg.CockpitMode[1] != CM_REAR_VIEW) {
int x = FSPACX(1);
int y = grd_curcanv->cv_bitmap.bm_h;
gr_set_curfont( GAME_FONT );
gr_set_fontcolor( BM_XRGB(0, 31, 0), -1 );
if (Cruise_speed > 0) {
if (PlayerCfg.CockpitMode==CM_FULL_SCREEN) {
if (PlayerCfg.CockpitMode[1]==CM_FULL_SCREEN) {
if (Game_mode & GM_MULTI)
y -= LINE_SPACING * 10;
else
y -= LINE_SPACING * 5;
} else if (PlayerCfg.CockpitMode == CM_STATUS_BAR) {
} else if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR) {
if (Game_mode & GM_MULTI)
y -= LINE_SPACING * 6;
else
@ -426,7 +426,7 @@ void game_draw_hud_stuff()
}
}
if (GameArg.SysFPSIndicator && PlayerCfg.CockpitMode != CM_REAR_VIEW)
if (GameArg.SysFPSIndicator && PlayerCfg.CockpitMode[1] != CM_REAR_VIEW)
show_framerate();
if (Newdemo_state == ND_STATE_PLAYBACK)
@ -693,11 +693,11 @@ void game_render_frame_mono(int flip)
if (Guided_missile[Player_num] && Guided_missile[Player_num]->type==OBJ_WEAPON && Guided_missile[Player_num]->id==GUIDEDMISS_ID && Guided_missile[Player_num]->signature==Guided_missile_sig[Player_num] && PlayerCfg.GuidedInBigWindow) {
object *viewer_save = Viewer;
if (PlayerCfg.CockpitMode==CM_FULL_COCKPIT || PlayerCfg.CockpitMode==CM_REAR_VIEW)
if (PlayerCfg.CockpitMode[1]==CM_FULL_COCKPIT || PlayerCfg.CockpitMode[1]==CM_REAR_VIEW)
{
BigWindowSwitch=1;
force_cockpit_redraw=1;
PlayerCfg.CockpitMode=CM_STATUS_BAR;
PlayerCfg.CockpitMode[1]=CM_STATUS_BAR;
return;
}
@ -725,7 +725,7 @@ void game_render_frame_mono(int flip)
if (BigWindowSwitch)
{
force_cockpit_redraw=1;
PlayerCfg.CockpitMode=(Rear_view?CM_REAR_VIEW:CM_FULL_COCKPIT);
PlayerCfg.CockpitMode[1]=(Rear_view?CM_REAR_VIEW:CM_FULL_COCKPIT);
BigWindowSwitch=0;
return;
}
@ -740,7 +740,7 @@ void game_render_frame_mono(int flip)
if (Newdemo_state == ND_STATE_PLAYBACK)
Game_mode = Newdemo_game_mode;
if (PlayerCfg.CockpitMode==CM_FULL_COCKPIT || PlayerCfg.CockpitMode==CM_STATUS_BAR)
if (PlayerCfg.CockpitMode[1]==CM_FULL_COCKPIT || PlayerCfg.CockpitMode[1]==CM_STATUS_BAR)
render_gauges();
if (Newdemo_state == ND_STATE_PLAYBACK)
@ -769,7 +769,7 @@ void toggle_cockpit()
if (Rear_view || Player_is_dead)
return;
switch (PlayerCfg.CockpitMode)
switch (PlayerCfg.CockpitMode[1])
{
case CM_FULL_COCKPIT:
new_mode = CM_STATUS_BAR;
@ -784,6 +784,7 @@ void toggle_cockpit()
select_cockpit(new_mode);
HUD_clear_messages();
PlayerCfg.CockpitMode[0] = new_mode;
write_player_file();
}
@ -795,13 +796,13 @@ void update_cockpits()
{
grs_bitmap *bm;
PIGGY_PAGE_IN(cockpit_bitmap[PlayerCfg.CockpitMode+(HIRESMODE?(Num_cockpits/2):0)]);
bm=&GameBitmaps[cockpit_bitmap[PlayerCfg.CockpitMode+(HIRESMODE?(Num_cockpits/2):0)].index];
PIGGY_PAGE_IN(cockpit_bitmap[PlayerCfg.CockpitMode[1]+(HIRESMODE?(Num_cockpits/2):0)]);
bm=&GameBitmaps[cockpit_bitmap[PlayerCfg.CockpitMode[1]+(HIRESMODE?(Num_cockpits/2):0)].index];
//Redraw the on-screen cockpit bitmaps
if (VR_render_mode != VR_NONE ) return;
switch( PlayerCfg.CockpitMode ) {
switch( PlayerCfg.CockpitMode[1] ) {
case CM_FULL_COCKPIT:
gr_set_current_canvas(NULL);
#ifdef OGL
@ -840,12 +841,12 @@ void update_cockpits()
gr_set_current_canvas(NULL);
if (PlayerCfg.CockpitMode != last_drawn_cockpit)
last_drawn_cockpit = PlayerCfg.CockpitMode;
if (PlayerCfg.CockpitMode[1] != last_drawn_cockpit)
last_drawn_cockpit = PlayerCfg.CockpitMode[1];
else
return;
if (PlayerCfg.CockpitMode==CM_FULL_COCKPIT || PlayerCfg.CockpitMode==CM_STATUS_BAR)
if (PlayerCfg.CockpitMode[1]==CM_FULL_COCKPIT || PlayerCfg.CockpitMode[1]==CM_STATUS_BAR)
init_gauges();
}

View file

@ -915,7 +915,7 @@ void play_homing_warning(void)
// -----------------------------------------------------------------------------
void show_homing_warning(void)
{
if ((PlayerCfg.CockpitMode == CM_STATUS_BAR) || (Endlevel_sequence)) {
if ((PlayerCfg.CockpitMode[1] == CM_STATUS_BAR) || (Endlevel_sequence)) {
if (Last_homing_warning_shown == 1) {
PAGE_IN_GAUGE( GAUGE_HOMING_WARNING_OFF );
hud_bitblt( HUD_SCALE_X(HOMING_WARNING_X), HUD_SCALE_Y(HOMING_WARNING_Y), &GameBitmaps[ GET_GAUGE_INDEX(GAUGE_HOMING_WARNING_OFF) ]);
@ -992,15 +992,15 @@ void hud_show_orbs (void)
int x=0,y=0;
grs_bitmap *bm;
if (PlayerCfg.CockpitMode == CM_FULL_COCKPIT) {
if (PlayerCfg.CockpitMode[1] == CM_FULL_COCKPIT) {
y=HUD_SCALE_Y_AR(GameBitmaps[ GET_GAUGE_INDEX(GAUGE_LIVES) ].bm_h+2)+FSPACY(1);
x = (SWIDTH/10);
}
else if (PlayerCfg.CockpitMode == CM_STATUS_BAR) {
else if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR) {
y=HUD_SCALE_Y_AR(GameBitmaps[ GET_GAUGE_INDEX(GAUGE_LIVES) ].bm_h+2)+FSPACY(1);
x = FSPACX(2);
}
else if (PlayerCfg.CockpitMode == CM_FULL_SCREEN) {
else if (PlayerCfg.CockpitMode[1] == CM_FULL_SCREEN) {
y=HUD_SCALE_Y_AR(GameBitmaps[ GET_GAUGE_INDEX(GAUGE_LIVES) ].bm_h+GameBitmaps[ GET_GAUGE_INDEX(KEY_ICON_RED) ].bm_h+4)+FSPACY(1);
x = FSPACX(2);
}
@ -1022,15 +1022,15 @@ void hud_show_flag(void)
int x=0,y=0,icon;
grs_bitmap *bm;
if (PlayerCfg.CockpitMode == CM_FULL_COCKPIT) {
if (PlayerCfg.CockpitMode[1] == CM_FULL_COCKPIT) {
y=HUD_SCALE_Y_AR(GameBitmaps[ GET_GAUGE_INDEX(GAUGE_LIVES) ].bm_h+2)+FSPACY(1);
x = (SWIDTH/10);
}
else if (PlayerCfg.CockpitMode == CM_STATUS_BAR) {
else if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR) {
y=HUD_SCALE_Y_AR(GameBitmaps[ GET_GAUGE_INDEX(GAUGE_LIVES) ].bm_h+2)+FSPACY(1);
x = FSPACX(2);
}
else if (PlayerCfg.CockpitMode == CM_FULL_SCREEN) {
else if (PlayerCfg.CockpitMode[1] == CM_FULL_SCREEN) {
y=HUD_SCALE_Y_AR(GameBitmaps[ GET_GAUGE_INDEX(GAUGE_LIVES) ].bm_h+GameBitmaps[ GET_GAUGE_INDEX(KEY_ICON_RED) ].bm_h+4)+FSPACY(1);
x = FSPACX(2);
}
@ -1139,7 +1139,7 @@ void show_bomb_count(int x,int y,int bg_color,int always_show,int right_align)
void draw_primary_ammo_info(int ammo_count)
{
if (PlayerCfg.CockpitMode == CM_STATUS_BAR)
if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR)
draw_ammo_info(SB_PRIMARY_AMMO_X,SB_PRIMARY_AMMO_Y,ammo_count,1);
else
draw_ammo_info(PRIMARY_AMMO_X,PRIMARY_AMMO_Y,ammo_count,1);
@ -1245,7 +1245,7 @@ void hud_show_weapons_mode(int type,int vertical,int x,int y){
case 8:
sprintf(weapon_str,"P");break;
case 9:
if (PlayerCfg.CockpitMode==CM_FULL_SCREEN)
if (PlayerCfg.CockpitMode[1]==CM_FULL_SCREEN)
sprintf(weapon_str, "O%03i", Omega_charge * 100/MAX_OMEGA_CHARGE);
else
sprintf(weapon_str,"O");
@ -1467,7 +1467,7 @@ void hud_show_lives()
if ((HUD_nmessages > 0) && (strlen(HUD_messages[hud_first]) > 38))
return;
if (PlayerCfg.CockpitMode == CM_FULL_COCKPIT)
if (PlayerCfg.CockpitMode[1] == CM_FULL_COCKPIT)
x = HUD_SCALE_X(7);
else
x = FSPACX(2);
@ -1688,9 +1688,9 @@ void cockpit_decode_alpha(grs_bitmap *bm)
void draw_wbu_overlay()
{
grs_bitmap *bm = &GameBitmaps[cockpit_bitmap[PlayerCfg.CockpitMode+(HIRESMODE?(Num_cockpits/2):0)].index];
grs_bitmap *bm = &GameBitmaps[cockpit_bitmap[PlayerCfg.CockpitMode[1]+(HIRESMODE?(Num_cockpits/2):0)].index];
PIGGY_PAGE_IN(cockpit_bitmap[PlayerCfg.CockpitMode+(HIRESMODE?(Num_cockpits/2):0)]);
PIGGY_PAGE_IN(cockpit_bitmap[PlayerCfg.CockpitMode[1]+(HIRESMODE?(Num_cockpits/2):0)]);
cockpit_decode_alpha(bm);
if (WinBoxOverlay[0] != NULL)
@ -2002,7 +2002,7 @@ void draw_weapon_info(int weapon_type,int weapon_num,int laser_level)
if (info_index == LASER_ID && laser_level > MAX_LASER_LEVEL)
info_index = SUPER_LASER_ID;
if (PlayerCfg.CockpitMode == CM_STATUS_BAR)
if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR)
draw_weapon_info_sub(info_index,
&gauge_boxes[SB_PRIMARY_BOX],
SB_PRIMARY_W_PIC_X,SB_PRIMARY_W_PIC_Y,
@ -2019,7 +2019,7 @@ void draw_weapon_info(int weapon_type,int weapon_num,int laser_level)
else {
info_index = Secondary_weapon_to_weapon_info[weapon_num];
if (PlayerCfg.CockpitMode == CM_STATUS_BAR)
if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR)
draw_weapon_info_sub(info_index,
&gauge_boxes[SB_SECONDARY_BOX],
SB_SECONDARY_W_PIC_X,SB_SECONDARY_W_PIC_Y,
@ -2035,10 +2035,10 @@ void draw_weapon_info(int weapon_type,int weapon_num,int laser_level)
if (PlayerCfg.HudMode!=0)
{
if (weapon_box_user[0] == WBU_WEAPON) {
hud_show_weapons_mode(0,1,(PlayerCfg.CockpitMode==CM_STATUS_BAR?SB_PRIMARY_AMMO_X:PRIMARY_AMMO_X),(PlayerCfg.CockpitMode==CM_STATUS_BAR?SB_SECONDARY_AMMO_Y:SECONDARY_AMMO_Y));
hud_show_weapons_mode(0,1,(PlayerCfg.CockpitMode[1]==CM_STATUS_BAR?SB_PRIMARY_AMMO_X:PRIMARY_AMMO_X),(PlayerCfg.CockpitMode[1]==CM_STATUS_BAR?SB_SECONDARY_AMMO_Y:SECONDARY_AMMO_Y));
}
if (weapon_box_user[1] == WBU_WEAPON) {
hud_show_weapons_mode(1,1,(PlayerCfg.CockpitMode==CM_STATUS_BAR?SB_SECONDARY_AMMO_X:SECONDARY_AMMO_X),(PlayerCfg.CockpitMode==CM_STATUS_BAR?SB_SECONDARY_AMMO_Y:SECONDARY_AMMO_Y));
hud_show_weapons_mode(1,1,(PlayerCfg.CockpitMode[1]==CM_STATUS_BAR?SB_SECONDARY_AMMO_X:SECONDARY_AMMO_X),(PlayerCfg.CockpitMode[1]==CM_STATUS_BAR?SB_SECONDARY_AMMO_Y:SECONDARY_AMMO_Y));
}
}
}
@ -2055,7 +2055,7 @@ void draw_ammo_info(int x,int y,int ammo_count,int primary)
void draw_secondary_ammo_info(int ammo_count)
{
if (PlayerCfg.CockpitMode == CM_STATUS_BAR)
if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR)
draw_ammo_info(SB_SECONDARY_AMMO_X,SB_SECONDARY_AMMO_Y,ammo_count,0);
else
draw_ammo_info(SECONDARY_AMMO_X,SECONDARY_AMMO_Y,ammo_count,0);
@ -2123,7 +2123,7 @@ void draw_weapon_box(int weapon_type,int weapon_num)
if (weapon_box_states[weapon_type] != WS_SET) //fade gauge
{
int fade_value = f2i(weapon_box_fade_values[weapon_type]);
int boxofs = (PlayerCfg.CockpitMode==CM_STATUS_BAR)?SB_PRIMARY_BOX:COCKPIT_PRIMARY_BOX;
int boxofs = (PlayerCfg.CockpitMode[1]==CM_STATUS_BAR)?SB_PRIMARY_BOX:COCKPIT_PRIMARY_BOX;
Gr_scanline_darkening_level = fade_value;
gr_rect(HUD_SCALE_X(gauge_boxes[boxofs+weapon_type].left),HUD_SCALE_Y(gauge_boxes[boxofs+weapon_type].top),HUD_SCALE_X(gauge_boxes[boxofs+weapon_type].right),HUD_SCALE_Y(gauge_boxes[boxofs+weapon_type].bot));
@ -2141,7 +2141,7 @@ void draw_static(int win)
vclip *vc = &Vclip[VCLIP_MONITOR_STATIC];
grs_bitmap *bmp;
int framenum;
int boxofs = (PlayerCfg.CockpitMode==CM_STATUS_BAR)?SB_PRIMARY_BOX:COCKPIT_PRIMARY_BOX;
int boxofs = (PlayerCfg.CockpitMode[1]==CM_STATUS_BAR)?SB_PRIMARY_BOX:COCKPIT_PRIMARY_BOX;
#ifndef OGL
int x,y;
#endif
@ -2321,7 +2321,7 @@ void draw_invulnerable_ship()
GameTime & 0x8000)
{
if (PlayerCfg.CockpitMode == CM_STATUS_BAR) {
if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR) {
PAGE_IN_GAUGE( GAUGE_INVULNERABLE+invulnerable_frame );
hud_bitblt( HUD_SCALE_X(SB_SHIELD_GAUGE_X), HUD_SCALE_Y(SB_SHIELD_GAUGE_Y), &GameBitmaps[GET_GAUGE_INDEX(GAUGE_INVULNERABLE+invulnerable_frame) ]);
} else {
@ -2336,7 +2336,7 @@ void draw_invulnerable_ship()
if (++invulnerable_frame == N_INVULNERABLE_FRAMES)
invulnerable_frame=0;
}
} else if (PlayerCfg.CockpitMode == CM_STATUS_BAR)
} else if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR)
sb_draw_shield_bar(f2ir(Players[Player_num].shields));
else
draw_shield_bar(f2ir(Players[Player_num].shields));
@ -2463,7 +2463,7 @@ void hud_show_kill_list()
save_y = y = grd_curcanv->cv_bitmap.bm_h - n_left*(LINE_SPACING);
if (PlayerCfg.CockpitMode == CM_FULL_COCKPIT) {
if (PlayerCfg.CockpitMode[1] == CM_FULL_COCKPIT) {
save_y = y -= FSPACX(6);
if (Game_mode & GM_MULTI_COOP)
x1 = FSPACX(33);
@ -2477,7 +2477,7 @@ void hud_show_kill_list()
int sw,sh,aw;
if (i>=n_left) {
if (PlayerCfg.CockpitMode == CM_FULL_COCKPIT)
if (PlayerCfg.CockpitMode[1] == CM_FULL_COCKPIT)
x0 = grd_curcanv->cv_bitmap.bm_w - FSPACX(53);
else
x0 = grd_curcanv->cv_bitmap.bm_w - FSPACX(60);
@ -2686,21 +2686,21 @@ void show_HUD_names()
void draw_hud()
{
// Show score so long as not in rearview
if ( !Rear_view && PlayerCfg.CockpitMode!=CM_REAR_VIEW && PlayerCfg.CockpitMode!=CM_STATUS_BAR) {
if ( !Rear_view && PlayerCfg.CockpitMode[1]!=CM_REAR_VIEW && PlayerCfg.CockpitMode[1]!=CM_STATUS_BAR) {
hud_show_score();
if (score_time)
hud_show_score_added();
}
if ( !Rear_view && PlayerCfg.CockpitMode!=CM_REAR_VIEW)
if ( !Rear_view && PlayerCfg.CockpitMode[1]!=CM_REAR_VIEW)
hud_show_timer_count();
// Show other stuff if not in rearview or letterbox.
if (!Rear_view && PlayerCfg.CockpitMode!=CM_REAR_VIEW) { // && PlayerCfg.CockpitMode!=CM_LETTERBOX) {
if (PlayerCfg.CockpitMode==CM_STATUS_BAR || PlayerCfg.CockpitMode==CM_FULL_SCREEN)
if (!Rear_view && PlayerCfg.CockpitMode[1]!=CM_REAR_VIEW) { // && PlayerCfg.CockpitMode[1]!=CM_LETTERBOX) {
if (PlayerCfg.CockpitMode[1]==CM_STATUS_BAR || PlayerCfg.CockpitMode[1]==CM_FULL_SCREEN)
hud_show_homing_warning();
if (PlayerCfg.CockpitMode==CM_FULL_SCREEN) {
if (PlayerCfg.CockpitMode[1]==CM_FULL_SCREEN) {
hud_show_energy();
hud_show_shield();
hud_show_afterburner();
@ -2720,22 +2720,22 @@ void draw_hud()
show_time();
#endif
#endif
if (PlayerCfg.ReticleOn && PlayerCfg.CockpitMode != CM_LETTERBOX)
if (PlayerCfg.ReticleOn && PlayerCfg.CockpitMode[1] != CM_LETTERBOX)
show_reticle();
#ifdef NETWORK
show_HUD_names();
if (PlayerCfg.CockpitMode != CM_LETTERBOX && PlayerCfg.CockpitMode != CM_REAR_VIEW)
if (PlayerCfg.CockpitMode[1] != CM_LETTERBOX && PlayerCfg.CockpitMode[1] != CM_REAR_VIEW)
hud_show_flag();
if (PlayerCfg.CockpitMode != CM_LETTERBOX && PlayerCfg.CockpitMode != CM_REAR_VIEW)
if (PlayerCfg.CockpitMode[1] != CM_LETTERBOX && PlayerCfg.CockpitMode[1] != CM_REAR_VIEW)
hud_show_orbs();
#endif
HUD_render_message_frame();
if (PlayerCfg.CockpitMode!=CM_STATUS_BAR)
if (PlayerCfg.CockpitMode[1]!=CM_STATUS_BAR)
hud_show_lives();
#ifdef NETWORK
@ -2744,7 +2744,7 @@ void draw_hud()
#endif
}
if (Rear_view && PlayerCfg.CockpitMode!=CM_REAR_VIEW) {
if (Rear_view && PlayerCfg.CockpitMode[1]!=CM_REAR_VIEW) {
HUD_render_message_frame();
gr_set_curfont( GAME_FONT );
gr_set_fontcolor(BM_XRGB(0,31,0),-1 );
@ -2759,7 +2759,7 @@ void render_gauges()
int shields = f2ir(Players[Player_num].shields);
int cloak = ((Players[Player_num].flags&PLAYER_FLAGS_CLOAKED) != 0);
Assert(PlayerCfg.CockpitMode==CM_FULL_COCKPIT || PlayerCfg.CockpitMode==CM_STATUS_BAR);
Assert(PlayerCfg.CockpitMode[1]==CM_FULL_COCKPIT || PlayerCfg.CockpitMode[1]==CM_STATUS_BAR);
if (shields < 0 ) shields = 0;
@ -2772,7 +2772,7 @@ void render_gauges()
draw_weapon_boxes();
if (PlayerCfg.CockpitMode == CM_FULL_COCKPIT) {
if (PlayerCfg.CockpitMode[1] == CM_FULL_COCKPIT) {
if (Newdemo_state == ND_STATE_RECORDING && (energy != old_energy))
{
newdemo_record_player_energy(old_energy, energy);
@ -2814,7 +2814,7 @@ void render_gauges()
show_homing_warning();
draw_wbu_overlay();
} else if (PlayerCfg.CockpitMode == CM_STATUS_BAR) {
} else if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR) {
if (Newdemo_state == ND_STATE_RECORDING && (energy != old_energy))
{
@ -2944,7 +2944,7 @@ void do_cockpit_window_view(int win,object *viewer,int rear_view_flag,int user,c
Viewer = viewer;
Rear_view = rear_view_flag;
if (PlayerCfg.CockpitMode == CM_FULL_SCREEN)
if (PlayerCfg.CockpitMode[1] == CM_FULL_SCREEN)
{
w = HUD_SCALE_X_AR(HIRESMODE?106:44);
h = HUD_SCALE_Y_AR(HIRESMODE?106:44);
@ -2960,9 +2960,9 @@ void do_cockpit_window_view(int win,object *viewer,int rear_view_flag,int user,c
gr_init_sub_canvas(&window_canv,&grd_curscreen->sc_canvas,window_x,window_y,w,h);
}
else {
if (PlayerCfg.CockpitMode == CM_FULL_COCKPIT)
if (PlayerCfg.CockpitMode[1] == CM_FULL_COCKPIT)
boxnum = (COCKPIT_PRIMARY_BOX)+win;
else if (PlayerCfg.CockpitMode == CM_STATUS_BAR)
else if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR)
boxnum = (SB_PRIMARY_BOX)+win;
else
goto abort;
@ -2992,7 +2992,7 @@ void do_cockpit_window_view(int win,object *viewer,int rear_view_flag,int user,c
if (user == WBU_GUIDED)
draw_guided_crosshair();
if (PlayerCfg.CockpitMode == CM_FULL_SCREEN) {
if (PlayerCfg.CockpitMode[1] == CM_FULL_SCREEN) {
int small_window_bottom,big_window_bottom,extra_part_h;
{
@ -3042,7 +3042,7 @@ void do_cockpit_window_view(int win,object *viewer,int rear_view_flag,int user,c
//force redraw when done
old_weapon[win] = old_ammo_count[win] = -1;
if (PlayerCfg.CockpitMode == CM_FULL_COCKPIT)
if (PlayerCfg.CockpitMode[1] == CM_FULL_COCKPIT)
draw_wbu_overlay();
abort:;

View file

@ -64,7 +64,7 @@ int MSG_Noredundancy = 0;
// ----------------------------------------------------------------------------
void clear_background_messages(void)
{
if (((PlayerCfg.CockpitMode == CM_STATUS_BAR) || (PlayerCfg.CockpitMode == CM_FULL_SCREEN)) && (Last_msg_ycrd != -1) && (Screen_3d_window.cv_bitmap.bm_y >= 6)) {
if (((PlayerCfg.CockpitMode[1] == CM_STATUS_BAR) || (PlayerCfg.CockpitMode[1] == CM_FULL_SCREEN)) && (Last_msg_ycrd != -1) && (Screen_3d_window.cv_bitmap.bm_y >= 6)) {
grs_canvas *canv_save = grd_curcanv;
gr_set_current_canvas(NULL);

View file

@ -96,12 +96,6 @@ extern void init_seismic_disturbances(void);
//#include "nocfile.h"
sbyte WasRecorded [MAX_OBJECTS];
sbyte ViewWasRecorded[MAX_OBJECTS];
sbyte RenderingWasRecorded[32];
object DemoRightExtra,DemoLeftExtra;
ubyte DemoDoRight=0,DemoDoLeft=0;
#define ND_EVENT_EOF 0 // EOF
#define ND_EVENT_START_DEMO 1 // Followed by 16 character, NULL terminated filename of .SAV file to use
#define ND_EVENT_START_FRAME 2 // Followed by integer frame number, then a fix FrameTime
@ -176,7 +170,6 @@ int Newdemo_start_frame = -1;
int Newdemo_frame_number = -1;
unsigned int Newdemo_size;
int Newdemo_num_written;
int Newdemo_old_cockpit;
sbyte Newdemo_no_space;
sbyte Newdemo_at_eof;
sbyte Newdemo_do_interpolate = 1;
@ -191,6 +184,12 @@ fix nd_recorded_time;
sbyte playback_style;
int Newdemo_show_percentage=1;
static int swap_endian = 0;
ubyte Newdemo_dead = 0, Newdemo_rear = 0, Newdemo_guided = 0;
sbyte WasRecorded [MAX_OBJECTS];
sbyte ViewWasRecorded[MAX_OBJECTS];
sbyte RenderingWasRecorded[32];
object DemoRightExtra,DemoLeftExtra;
ubyte DemoDoRight=0,DemoDoLeft=0;
extern int digi_link_sound_to_object3( int org_soundnum, short objnum, int forever, fix max_volume, fix max_distance, int loop_start, int loop_end );
@ -1670,7 +1669,6 @@ int newdemo_read_frame_information(int rewrite)
int done, segnum, side, objnum, soundno, angle, volume, i,shot;
object *obj;
sbyte c,WhichWindow;
static sbyte saved_letter_cockpit = CM_FULL_COCKPIT, saved_rearview_cockpit = CM_FULL_COCKPIT, saved_guided_cockpit = CM_FULL_COCKPIT;
object extraobj;
static char LastReadValue=101;
segment *seg;
@ -2044,20 +2042,16 @@ int newdemo_read_frame_information(int rewrite)
}
case ND_EVENT_START_GUIDED:
if ((Newdemo_vcr_state == ND_STATE_PLAYBACK) || (Newdemo_vcr_state == ND_STATE_FASTFORWARD) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEFORWARD)) {
saved_guided_cockpit = PlayerCfg.CockpitMode;
if (PlayerCfg.CockpitMode == CM_FULL_COCKPIT && 1)
select_cockpit(CM_STATUS_BAR);
Newdemo_guided = 1;
} else if ((Newdemo_vcr_state == ND_STATE_REWINDING) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEBACKWARD)) {
select_cockpit(saved_guided_cockpit);
Newdemo_guided = 0;
}
break;
case ND_EVENT_END_GUIDED:
if ((Newdemo_vcr_state == ND_STATE_REWINDING) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEBACKWARD)) {
saved_guided_cockpit = PlayerCfg.CockpitMode;
if (PlayerCfg.CockpitMode == CM_FULL_COCKPIT && 1)
select_cockpit(CM_STATUS_BAR);
Newdemo_guided = 1;
} else if ((Newdemo_vcr_state == ND_STATE_PLAYBACK) || (Newdemo_vcr_state == ND_STATE_FASTFORWARD) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEFORWARD)) {
select_cockpit(saved_guided_cockpit);
Newdemo_guided = 0;
}
break;
@ -2258,10 +2252,9 @@ int newdemo_read_frame_information(int rewrite)
case ND_EVENT_LETTERBOX:
if ((Newdemo_vcr_state == ND_STATE_PLAYBACK) || (Newdemo_vcr_state == ND_STATE_FASTFORWARD) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEFORWARD)) {
saved_letter_cockpit = PlayerCfg.CockpitMode;
select_cockpit(CM_LETTERBOX);
Newdemo_dead = 1;
} else if ((Newdemo_vcr_state == ND_STATE_REWINDING) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEBACKWARD))
select_cockpit(saved_letter_cockpit);
Newdemo_dead = 0;
break;
case ND_EVENT_CHANGE_COCKPIT: {
@ -2273,38 +2266,25 @@ int newdemo_read_frame_information(int rewrite)
}
case ND_EVENT_REARVIEW:
if ((Newdemo_vcr_state == ND_STATE_PLAYBACK) || (Newdemo_vcr_state == ND_STATE_FASTFORWARD) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEFORWARD)) {
saved_rearview_cockpit = PlayerCfg.CockpitMode;
if (PlayerCfg.CockpitMode == CM_FULL_COCKPIT)
select_cockpit(CM_REAR_VIEW);
Rear_view=1;
Newdemo_rear = 1;
} else if ((Newdemo_vcr_state == ND_STATE_REWINDING) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEBACKWARD)) {
if (saved_rearview_cockpit == CM_REAR_VIEW) // hack to be sure we get a good cockpit on restore
saved_rearview_cockpit = CM_FULL_COCKPIT;
select_cockpit(saved_rearview_cockpit);
Rear_view=0;
Newdemo_rear = 0;
}
break;
case ND_EVENT_RESTORE_COCKPIT:
if ((Newdemo_vcr_state == ND_STATE_REWINDING) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEBACKWARD)) {
saved_letter_cockpit = PlayerCfg.CockpitMode;
select_cockpit(CM_LETTERBOX);
Newdemo_dead = 1;
} else if ((Newdemo_vcr_state == ND_STATE_PLAYBACK) || (Newdemo_vcr_state == ND_STATE_FASTFORWARD) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEFORWARD))
select_cockpit(saved_letter_cockpit);
Newdemo_dead = 0;
break;
case ND_EVENT_RESTORE_REARVIEW:
if ((Newdemo_vcr_state == ND_STATE_REWINDING) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEBACKWARD)) {
saved_rearview_cockpit = PlayerCfg.CockpitMode;
if (PlayerCfg.CockpitMode == CM_FULL_COCKPIT)
select_cockpit(CM_REAR_VIEW);
Rear_view=1;
Newdemo_rear= 1;
} else if ((Newdemo_vcr_state == ND_STATE_PLAYBACK) || (Newdemo_vcr_state == ND_STATE_FASTFORWARD) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEFORWARD)) {
if (saved_rearview_cockpit == CM_REAR_VIEW) // hack to be sure we get a good cockpit on restore
saved_rearview_cockpit = CM_FULL_COCKPIT;
select_cockpit(saved_rearview_cockpit);
Rear_view=0;
Newdemo_rear = 0;
}
break;
@ -2810,6 +2790,34 @@ int newdemo_read_frame_information(int rewrite)
LastReadValue=c;
// Now set up cockpit and views according to what we read out. Note that the demo itself cannot determinate the right views since it does not use a good portion of the real game code.
if (Newdemo_dead)
{
Rear_view = 0;
if (PlayerCfg.CockpitMode[1] != CM_LETTERBOX)
select_cockpit(CM_LETTERBOX);
}
else if (Newdemo_guided)
{
Rear_view = 0;
if (PlayerCfg.CockpitMode[1] != CM_FULL_SCREEN || PlayerCfg.CockpitMode[1] != CM_STATUS_BAR)
{
select_cockpit((PlayerCfg.CockpitMode[0] == CM_FULL_SCREEN)?CM_FULL_SCREEN:CM_STATUS_BAR);
}
}
else if (Newdemo_rear)
{
Rear_view = Newdemo_rear;
if (PlayerCfg.CockpitMode[0] == CM_FULL_COCKPIT)
select_cockpit(CM_REAR_VIEW);
}
else
{
Rear_view = 0;
if (PlayerCfg.CockpitMode[1] != PlayerCfg.CockpitMode[0])
select_cockpit(PlayerCfg.CockpitMode[0]);
}
if (nd_bad_read) {
nm_messagebox( NULL, 1, TXT_OK, "%s %s", TXT_DEMO_ERR_READING, TXT_DEMO_OLD_CORRUPT );
}
@ -3550,7 +3558,6 @@ void newdemo_start_playback(char * filename)
Game_mode = GM_NORMAL;
Newdemo_state = ND_STATE_PLAYBACK;
Newdemo_vcr_state = ND_STATE_PLAYBACK;
Newdemo_old_cockpit = PlayerCfg.CockpitMode;
Newdemo_size = PHYSFS_fileLength(infile);
nd_bad_read = 0;
Newdemo_at_eof = 0;
@ -3558,6 +3565,7 @@ void newdemo_start_playback(char * filename)
playback_style = NORMAL_PLAYBACK;
Function_mode = FMODE_GAME;
init_seismic_disturbances();
Newdemo_dead = Newdemo_rear = Newdemo_guided = 0;
PlayerCfg.Cockpit3DView[0] = CV_NONE; //turn off 3d views on cockpit
PlayerCfg.Cockpit3DView[1] = CV_NONE; //turn off 3d views on cockpit
HUD_clear_messages();
@ -3573,8 +3581,8 @@ void newdemo_stop_playback()
change_playernum_to(0); //this is reality
#endif
strncpy(Players[Player_num].callsign, nd_save_callsign, CALLSIGN_LEN);
PlayerCfg.CockpitMode = Newdemo_old_cockpit;
Rear_view=0;
Newdemo_dead = Newdemo_rear = Newdemo_guided = 0;
Newdemo_game_mode = Game_mode = GM_GAME_OVER;
if (Game_wind)
window_close(Game_wind); // Exit game loop

View file

@ -1379,9 +1379,7 @@ int Player_exploded = 0;
int Death_sequence_aborted=0;
int Player_eggs_dropped=0;
fix Camera_to_player_dist_goal=F1_0*4;
ubyte Control_type_save, Render_type_save;
static int cockpit_mode_save; //set while in letterbox
// ------------------------------------------------------------------------------------------------------------------
void dead_player_end(void)
@ -1396,7 +1394,7 @@ void dead_player_end(void)
Player_exploded = 0;
obj_delete(Dead_player_camera-Objects);
Dead_player_camera = NULL;
select_cockpit(cockpit_mode_save);
select_cockpit(PlayerCfg.CockpitMode[0]);
Viewer = Viewer_save;
ConsoleObject->type = OBJ_PLAYER;
ConsoleObject->flags = Player_flags_save;
@ -1673,7 +1671,6 @@ void start_player_death_sequence(object *player)
Dead_player_camera = Viewer;
}
cockpit_mode_save = PlayerCfg.CockpitMode;
select_cockpit(CM_LETTERBOX);
if (Newdemo_state == ND_STATE_RECORDING)
newdemo_record_letterbox();

View file

@ -111,7 +111,7 @@ int new_player_config()
PlayerCfg.MouseSensitivityY = 8;
PlayerCfg.MouseFilter = 0;
PlayerCfg.JoystickDeadzone = 0;
PlayerCfg.CockpitMode = CM_FULL_COCKPIT;
PlayerCfg.CockpitMode[0] = PlayerCfg.CockpitMode[1] = CM_FULL_COCKPIT;
PlayerCfg.Cockpit3DView[0]=CV_NONE;
PlayerCfg.Cockpit3DView[1]=CV_NONE;
PlayerCfg.ReticleOn = 1;
@ -391,7 +391,7 @@ int read_player_file()
PlayerCfg.DefaultDifficulty = cfile_read_byte(file);
PlayerCfg.AutoLeveling = cfile_read_byte(file);
PlayerCfg.ReticleOn = cfile_read_byte(file);
PlayerCfg.CockpitMode = cfile_read_byte(file);
PlayerCfg.CockpitMode[0] = PlayerCfg.CockpitMode[1] = cfile_read_byte(file);
PHYSFS_seek(file,PHYSFS_tell(file)+sizeof(sbyte)); //skip Default_display_mode
PlayerCfg.MissileViewEnabled = cfile_read_byte(file);
PlayerCfg.HeadlightActiveDefault = cfile_read_byte(file);
@ -631,7 +631,7 @@ int write_player_file()
PHYSFSX_writeU8(file, PlayerCfg.DefaultDifficulty);
PHYSFSX_writeU8(file, PlayerCfg.AutoLeveling);
PHYSFSX_writeU8(file, PlayerCfg.ReticleOn);
PHYSFSX_writeU8(file, (PlayerCfg.CockpitMode==1?0:PlayerCfg.CockpitMode));
PHYSFSX_writeU8(file, PlayerCfg.CockpitMode[0]);
PHYSFS_seek(file,PHYSFS_tell(file)+sizeof(PHYSFS_uint8)); // skip Default_display_mode
PHYSFSX_writeU8(file, PlayerCfg.MissileViewEnabled);
PHYSFSX_writeU8(file, PlayerCfg.HeadlightActiveDefault);

View file

@ -52,7 +52,7 @@ typedef struct player_config
ubyte JoystickSensitivityX;
ubyte JoystickSensitivityY;
int JoystickDeadzone;
int CockpitMode;
int CockpitMode[2]; // 0 saves the "real" cockpit, 1 also saves letterbox and rear. Used to properly switch between modes and restore the real one.
int Cockpit3DView[2];
char NetworkMessageMacro[4][MAX_MESSAGE_LEN];
int NetlifeKills;

View file

@ -1588,7 +1588,7 @@ void render_frame(fix eye_offset, int window_num)
Viewer_eye = Viewer->pos;
// if (Viewer->type == OBJ_PLAYER && (Cockpit_mode!=CM_REAR_VIEW))
// if (Viewer->type == OBJ_PLAYER && (PlayerCfg.CockpitMode[1]!=CM_REAR_VIEW))
// vm_vec_scale_add2(&Viewer_eye,&Viewer->orient.fvec,(Viewer->size*3)/4);
if (eye_offset) {