screen: move some more shared code to screen_common.h

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
Kevin Shanahan 2012-12-17 11:41:44 +10:30
parent 4a5095252a
commit 8303aea9a1
4 changed files with 103 additions and 198 deletions

View File

@ -926,105 +926,6 @@ SCR_RSShot_f(void)
//=============================================================================
static const char *scr_notifystring;
static qboolean scr_drawdialog;
void
SCR_DrawNotifyString(void)
{
const char *start;
int l;
int j;
int x, y;
start = scr_notifystring;
y = vid.height * 0.35;
do {
// scan the width of the line
for (l = 0; l < 40; l++)
if (start[l] == '\n' || !start[l])
break;
x = (vid.width - l * 8) / 2;
for (j = 0; j < l; j++, x += 8)
Draw_Character(x, y, start[j]);
y += 8;
while (*start && *start != '\n')
start++;
if (!*start)
break;
start++; // skip the \n
} while (1);
}
/*
==================
SCR_ModalMessage
Displays a text string in the center of the screen and waits for a Y or N
keypress.
==================
*/
int
SCR_ModalMessage(const char *text)
{
#ifdef NQ_HACK
if (cls.state == ca_dedicated)
return true;
#endif
scr_notifystring = text;
// draw a fresh screen
scr_fullupdate = 0;
scr_drawdialog = true;
SCR_UpdateScreen();
scr_drawdialog = false;
S_ClearBuffer(); // so dma doesn't loop current sound
do {
key_count = -1; // wait for a key down and up
Sys_SendKeyEvents();
} while (key_lastpress != 'y' && key_lastpress != 'n'
&& key_lastpress != K_ESCAPE);
scr_fullupdate = 0;
SCR_UpdateScreen();
return key_lastpress == 'y';
}
//=============================================================================
/*
===============
SCR_BringDownConsole
Brings the console down and fades the palettes back to normal
================
*/
void
SCR_BringDownConsole(void)
{
int i;
scr_centertime_off = 0;
for (i = 0; i < 20 && scr_conlines != scr_con_current; i++)
SCR_UpdateScreen();
cl.cshifts[0].percent = 0; // no area contents palette on next frame
VID_SetPalette(host_basepal);
}
void
SCR_TileClear(void)
{

View File

@ -884,105 +884,6 @@ SCR_RSShot_f(void)
//=============================================================================
static const char *scr_notifystring;
static qboolean scr_drawdialog;
void
SCR_DrawNotifyString(void)
{
const char *start;
int l;
int j;
int x, y;
start = scr_notifystring;
y = vid.height * 0.35;
do {
// scan the width of the line
for (l = 0; l < 40; l++)
if (start[l] == '\n' || !start[l])
break;
x = (vid.width - l * 8) / 2;
for (j = 0; j < l; j++, x += 8)
Draw_Character(x, y, start[j]);
y += 8;
while (*start && *start != '\n')
start++;
if (!*start)
break;
start++; // skip the \n
} while (1);
}
/*
==================
SCR_ModalMessage
Displays a text string in the center of the screen and waits for a Y or N
keypress.
==================
*/
int
SCR_ModalMessage(const char *text)
{
#ifdef NQ_HACK
if (cls.state == ca_dedicated)
return true;
#endif
scr_notifystring = text;
// draw a fresh screen
scr_fullupdate = 0;
scr_drawdialog = true;
SCR_UpdateScreen();
scr_drawdialog = false;
S_ClearBuffer(); // so dma doesn't loop current sound
do {
key_count = -1; // wait for a key down and up
Sys_SendKeyEvents();
} while (key_lastpress != 'y' && key_lastpress != 'n'
&& key_lastpress != K_ESCAPE);
scr_fullupdate = 0;
SCR_UpdateScreen();
return key_lastpress == 'y';
}
//=============================================================================
/*
===============
SCR_BringDownConsole
Brings the console down and fades the palettes back to normal
================
*/
void
SCR_BringDownConsole(void)
{
int i;
scr_centertime_off = 0;
for (i = 0; i < 20 && scr_conlines != scr_con_current; i++)
SCR_UpdateScreen();
cl.cshifts[0].percent = 0; // no area contents palette on next frame
VID_SetPalette(host_basepal);
}
/*
==================
SCR_UpdateScreen

View File

@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "keys.h"
#include "quakedef.h"
#include "screen.h"
#include "sound.h"
#include "sys.h"
#ifdef NQ_HACK
#include "host.h"
@ -151,3 +153,102 @@ SCR_DrawCenterString(void)
start++; // skip the \n
} while (1);
}
//=============================================================================
static const char *scr_notifystring;
qboolean scr_drawdialog;
void
SCR_DrawNotifyString(void)
{
const char *start;
int l;
int j;
int x, y;
start = scr_notifystring;
y = vid.height * 0.35;
do {
// scan the width of the line
for (l = 0; l < 40; l++)
if (start[l] == '\n' || !start[l])
break;
x = (vid.width - l * 8) / 2;
for (j = 0; j < l; j++, x += 8)
Draw_Character(x, y, start[j]);
y += 8;
while (*start && *start != '\n')
start++;
if (!*start)
break;
start++; // skip the \n
} while (1);
}
/*
==================
SCR_ModalMessage
Displays a text string in the center of the screen and waits for a Y or N
keypress.
==================
*/
int
SCR_ModalMessage(const char *text)
{
#ifdef NQ_HACK
if (cls.state == ca_dedicated)
return true;
#endif
scr_notifystring = text;
// draw a fresh screen
scr_fullupdate = 0;
scr_drawdialog = true;
SCR_UpdateScreen();
scr_drawdialog = false;
S_ClearBuffer(); // so dma doesn't loop current sound
do {
key_count = -1; // wait for a key down and up
Sys_SendKeyEvents();
} while (key_lastpress != 'y' && key_lastpress != 'n'
&& key_lastpress != K_ESCAPE);
scr_fullupdate = 0;
SCR_UpdateScreen();
return key_lastpress == 'y';
}
//=============================================================================
/*
===============
SCR_BringDownConsole
Brings the console down and fades the palettes back to normal
================
*/
void
SCR_BringDownConsole(void)
{
int i;
scr_centertime_off = 0;
for (i = 0; i < 20 && scr_conlines != scr_con_current; i++)
SCR_UpdateScreen();
cl.cshifts[0].percent = 0; // no area contents palette on next frame
VID_SetPalette(host_basepal);
}

View File

@ -38,7 +38,9 @@ void SCR_BeginLoadingPlaque(void);
void SCR_EndLoadingPlaque(void);
int SCR_ModalMessage(const char *text);
extern qboolean scr_drawdialog;
void SCR_DrawCenterString(void);
void SCR_DrawNotifyString(void);
void SCR_EraseCenterString(void);
extern float scr_con_current;