mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-25 13:51:36 +00:00
[nq] Get intermission view working again
This is currently just the basic intermission view (not the finale view or the deathmatch intermission view).
This commit is contained in:
parent
a07eccd5c7
commit
bdbb8f1e0b
8 changed files with 110 additions and 56 deletions
|
@ -65,15 +65,15 @@ typedef struct viewstate_s {
|
|||
float height;
|
||||
int weaponframe;
|
||||
int onground; // -1 when in air
|
||||
int active:1;
|
||||
int loading:1;
|
||||
int watervis:1;
|
||||
int demoplayback:1;
|
||||
int drift_enabled:1;
|
||||
int voffs_enabled:1;
|
||||
int bob_enabled:1;
|
||||
int intermission:1;
|
||||
int decay_punchangle:1;
|
||||
unsigned active:1;
|
||||
unsigned loading:1;
|
||||
unsigned watervis:1;
|
||||
unsigned demoplayback:1;
|
||||
unsigned drift_enabled:1;
|
||||
unsigned voffs_enabled:1;
|
||||
unsigned bob_enabled:1;
|
||||
unsigned intermission:1;
|
||||
unsigned decay_punchangle:1;
|
||||
int force_cshifts; // bitfield of server enforced cshifts
|
||||
uint32_t flags;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void Sbar_Changed (sbar_changed change);
|
|||
void Sbar_Draw (void);
|
||||
// called every frame by screen
|
||||
|
||||
void Sbar_IntermissionOverlay (void);
|
||||
void Sbar_Intermission (int mode);
|
||||
// called each frame after the level has been completed
|
||||
|
||||
void Sbar_FinaleOverlay (void);
|
||||
|
|
|
@ -154,23 +154,15 @@ static SCR_Func scr_funcs_normal[] = {
|
|||
};
|
||||
|
||||
static SCR_Func scr_funcs_intermission[] = {
|
||||
Sbar_IntermissionOverlay,
|
||||
HUD_Draw_Views,
|
||||
Con_DrawConsole,
|
||||
scr_draw_views,
|
||||
0
|
||||
};
|
||||
|
||||
static SCR_Func scr_funcs_finale[] = {
|
||||
Sbar_FinaleOverlay,
|
||||
Con_DrawConsole,
|
||||
scr_draw_views,
|
||||
0,
|
||||
};
|
||||
|
||||
static SCR_Func *scr_funcs[] = {
|
||||
scr_funcs_normal,
|
||||
scr_funcs_intermission,
|
||||
scr_funcs_finale,
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
|
@ -209,9 +209,9 @@ hud_swap_f (void *data, const cvar_t *cvar)
|
|||
static void
|
||||
hud_scoreboard_gravity_f (void *data, const cvar_t *cvar)
|
||||
{
|
||||
#if 0//XXX
|
||||
view_setgravity (hud_overlay_view, hud_scoreboard_gravity);
|
||||
#endif
|
||||
if (View_Valid (hud_overlay_view)) {
|
||||
View_SetGravity (hud_overlay_view, hud_scoreboard_gravity);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -231,6 +231,7 @@ CL_ClearMemory (void)
|
|||
// wipe the entire cl structure
|
||||
__auto_type cam = cl.viewstate.camera_transform;
|
||||
memset (&cl, 0, sizeof (cl));
|
||||
Sbar_Intermission (cl.intermission = 0);
|
||||
cl.viewstate.camera_transform = cam;
|
||||
|
||||
CL_ClearTEnts ();
|
||||
|
@ -338,7 +339,7 @@ CL_Disconnect (void)
|
|||
}
|
||||
|
||||
cl_world.scene->worldmodel = NULL;
|
||||
cl.intermission = 0;
|
||||
Sbar_Intermission (cl.intermission = 0);
|
||||
cl.viewstate.intermission = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -986,13 +986,13 @@ CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_intermission:
|
||||
cl.intermission = 1;
|
||||
Sbar_Intermission (cl.intermission = 1);
|
||||
SCR_SetFullscreen (1);
|
||||
cl.completed_time = cl.time;
|
||||
break;
|
||||
|
||||
case svc_finale:
|
||||
cl.intermission = 2;
|
||||
Sbar_Intermission (cl.intermission = 2);
|
||||
SCR_SetFullscreen (1);
|
||||
cl.completed_time = cl.time;
|
||||
str = MSG_ReadString (net_message);
|
||||
|
@ -1018,7 +1018,7 @@ CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_cutscene:
|
||||
cl.intermission = 3;
|
||||
Sbar_Intermission (cl.intermission = 3);
|
||||
SCR_SetFullscreen (1);
|
||||
cl.completed_time = cl.time;
|
||||
str = MSG_ReadString (net_message);
|
||||
|
|
117
nq/source/sbar.c
117
nq/source/sbar.c
|
@ -89,6 +89,11 @@ static view_t sbar_solo_anchor;
|
|||
static view_t sbar_solo_name;
|
||||
static view_t sbar_tile[2];
|
||||
|
||||
static view_t intermission_view;
|
||||
static view_t intermission_time;
|
||||
static view_t intermission_secr;
|
||||
static view_t intermission_kill;
|
||||
|
||||
typedef struct {
|
||||
view_t *view;
|
||||
struct {
|
||||
|
@ -105,6 +110,23 @@ typedef struct {
|
|||
} view_def_t;
|
||||
|
||||
static view_def_t view_defs[] = {
|
||||
{&hud_overlay_view, { 0, 0,320,200}, grav_center, &cl_screen_view},
|
||||
{&intermission_view, { 0, 0,320,200}, grav_northwest, &hud_overlay_view},
|
||||
{0, {64, 24, 24, 24}, grav_northwest, &intermission_view, 1, 0, 0},
|
||||
{0, {0, 56, 24, 24}, grav_northwest, &intermission_view, 1, 0, 0},
|
||||
{&intermission_time, {160,64,134,24}, grav_northwest, &intermission_view},
|
||||
{0, {0, 0, 24, 24}, grav_northwest, &intermission_time, 3, 24, 0},
|
||||
{0, {74, 0, 16, 24}, grav_northwest, &intermission_time, 1, 0, 0},
|
||||
{0, {86, 0, 24, 24}, grav_northwest, &intermission_time, 2, 24, 0},
|
||||
{&intermission_secr, {160,104,152,24}, grav_northwest, &intermission_view},
|
||||
{0, {0, 0, 24, 24}, grav_northwest, &intermission_secr, 3, 24, 0},
|
||||
{0, {72, 0, 16, 24}, grav_northwest, &intermission_secr, 1, 0, 0},
|
||||
{0, {80, 0, 24, 24}, grav_northwest, &intermission_secr, 3, 24, 0},
|
||||
{&intermission_kill, {160,144,152,24}, grav_northwest, &intermission_view},
|
||||
{0, {0, 0, 24, 24}, grav_northwest, &intermission_kill, 3, 24, 0},
|
||||
{0, {72, 0, 16, 24}, grav_northwest, &intermission_kill, 1, 0, 0},
|
||||
{0, {80, 0, 24, 24}, grav_northwest, &intermission_kill, 3, 24, 0},
|
||||
|
||||
{&sbar_main, { 0, 0,320, 48}, grav_south, &cl_screen_view},
|
||||
{&sbar_inventory, { 0, 0,320, 24}, grav_northwest, &sbar_main},
|
||||
{&sbar_frags, { 0, 0,130, 8}, grav_northeast, &sbar_inventory},
|
||||
|
@ -1174,50 +1196,89 @@ draw_fps (view_t view)
|
|||
}
|
||||
|
||||
static void
|
||||
draw_intermission (view_t *view)
|
||||
draw_intermission (view_t view)
|
||||
{
|
||||
#if 0
|
||||
int dig;
|
||||
int num;
|
||||
const char *n;
|
||||
|
||||
r_data->scr_copyeverything = 1;
|
||||
r_data->scr_fullupdate = 0;
|
||||
n = "gfx/complete.lmp";
|
||||
sbar_setcomponent (View_GetChild (view, 0), hud_cachepic, &n);
|
||||
n = "gfx/inter.lmp";
|
||||
sbar_setcomponent (View_GetChild (view, 1), hud_cachepic, &n);
|
||||
|
||||
draw_cachepic (view, 64, 24, "gfx/complete.lmp", 0);
|
||||
view_t time_views[] = {
|
||||
View_GetChild (intermission_time, 0),
|
||||
View_GetChild (intermission_time, 1),
|
||||
View_GetChild (intermission_time, 2),
|
||||
View_GetChild (intermission_time, 3),
|
||||
View_GetChild (intermission_time, 4),
|
||||
View_GetChild (intermission_time, 5),
|
||||
};
|
||||
int dig = cl.completed_time / 60;
|
||||
int num = cl.completed_time - dig * 60;
|
||||
draw_num (time_views + 0, dig, 3, 0);
|
||||
sbar_setcomponent (time_views[3], hud_pic, &sb_colon);
|
||||
draw_num (time_views + 4, num, 2, 0);
|
||||
|
||||
draw_cachepic (view, 0, 56, "gfx/inter.lmp", 0);
|
||||
view_t secr_views[] = {
|
||||
View_GetChild (intermission_secr, 0),
|
||||
View_GetChild (intermission_secr, 1),
|
||||
View_GetChild (intermission_secr, 2),
|
||||
View_GetChild (intermission_secr, 3),
|
||||
View_GetChild (intermission_secr, 4),
|
||||
View_GetChild (intermission_secr, 5),
|
||||
View_GetChild (intermission_secr, 6),
|
||||
};
|
||||
draw_num (secr_views + 0, cl.stats[STAT_SECRETS], 3, 0);
|
||||
sbar_setcomponent (secr_views[3], hud_pic, &sb_slash);
|
||||
draw_num (secr_views + 4, cl.stats[STAT_TOTALSECRETS], 3, 0);
|
||||
|
||||
// time
|
||||
dig = cl.completed_time / 60;
|
||||
draw_num (view, 160, 64, dig, 3, 0);
|
||||
num = cl.completed_time - dig * 60;
|
||||
draw_pic (view, 234, 64, sb_colon);
|
||||
draw_pic (view, 246, 64, sb_nums[0][num / 10]);
|
||||
draw_pic (view, 266, 64, sb_nums[0][num % 10]);
|
||||
|
||||
draw_num (view, 160, 104, cl.stats[STAT_SECRETS], 3, 0);
|
||||
draw_pic (view, 232, 104, sb_slash);
|
||||
draw_num (view, 240, 104, cl.stats[STAT_TOTALSECRETS], 3, 0);
|
||||
|
||||
draw_num (view, 160, 144, cl.stats[STAT_MONSTERS], 3, 0);
|
||||
draw_pic (view, 232, 144, sb_slash);
|
||||
draw_num (view, 240, 144, cl.stats[STAT_TOTALMONSTERS], 3, 0);
|
||||
#endif
|
||||
view_t kill_views[] = {
|
||||
View_GetChild (intermission_kill, 0),
|
||||
View_GetChild (intermission_kill, 1),
|
||||
View_GetChild (intermission_kill, 2),
|
||||
View_GetChild (intermission_kill, 3),
|
||||
View_GetChild (intermission_kill, 4),
|
||||
View_GetChild (intermission_kill, 5),
|
||||
View_GetChild (intermission_kill, 6),
|
||||
};
|
||||
draw_num (kill_views + 0, cl.stats[STAT_MONSTERS], 3, 0);
|
||||
sbar_setcomponent (kill_views[3], hud_pic, &sb_slash);
|
||||
draw_num (kill_views + 4, cl.stats[STAT_TOTALMONSTERS], 3, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
clear_views (view_t view)
|
||||
{
|
||||
sbar_remcomponent (view, hud_cachepic);
|
||||
sbar_remcomponent (view, hud_pic);
|
||||
|
||||
for (uint32_t i = 0; i < View_ChildCount (view); i++) {
|
||||
clear_views (View_GetChild (view, i));
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
Sbar_IntermissionOverlay (void)
|
||||
{
|
||||
#if 0
|
||||
r_data->scr_copyeverything = 1;
|
||||
r_data->scr_fullupdate = 0;
|
||||
|
||||
if (cl.gametype == GAME_DEATHMATCH) {
|
||||
Sbar_DeathmatchOverlay (hud_overlay_view);
|
||||
return;
|
||||
}
|
||||
draw_intermission (hud_overlay_view);
|
||||
draw_intermission (intermission_view);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Sbar_Intermission (int mode)
|
||||
{
|
||||
void *f = clear_views;
|
||||
if (mode == 1) {
|
||||
f = draw_intermission;
|
||||
}
|
||||
sbar_setcomponent (intermission_view, hud_updateonce, &f);
|
||||
}
|
||||
|
||||
/* CENTER PRINTING */
|
||||
|
@ -1453,7 +1514,6 @@ Sbar_Draw (void)
|
|||
draw_miniteam (0);
|
||||
draw_minifrags (0);
|
||||
draw_overlay (0);
|
||||
draw_intermission (0);
|
||||
Sbar_DeathmatchOverlay (0);
|
||||
sbar_update_vis ();
|
||||
}
|
||||
|
@ -1595,6 +1655,7 @@ init_sbar_views (void)
|
|||
for (int i = 0; i < 4; i++) {
|
||||
view_t v = View_GetChild (sbar_miniammo, i);
|
||||
draw_charbuffer_t *buffer = Draw_CreateBuffer (3, 1);
|
||||
Draw_ClearBuffer (buffer);
|
||||
sbar_setcomponent (v, hud_charbuff, &buffer);
|
||||
}
|
||||
|
||||
|
|
|
@ -1620,10 +1620,10 @@ draw_stuff (view_t *view)
|
|||
draw_net (view);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
Sbar_IntermissionOverlay (void)
|
||||
{
|
||||
#if 0
|
||||
r_data->scr_copyeverything = 1;
|
||||
r_data->scr_fullupdate = 0;
|
||||
|
||||
|
@ -1631,8 +1631,8 @@ Sbar_IntermissionOverlay (void)
|
|||
Sbar_TeamOverlay (hud_overlay_view);
|
||||
else
|
||||
Sbar_DeathmatchOverlay (hud_overlay_view, 0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* CENTER PRINTING */
|
||||
static dstring_t center_string = {&dstring_default_mem};
|
||||
|
|
Loading…
Reference in a new issue