28
28
#include "display.h"
31
// the proportion of the display to use (in segments)
32
#define BIG_SEGMENTS ( NUM_SEGMENTS * 2 / 3 )
33
#define SMALL_SEGMENTS ( NUM_SEGMENTS - BIG_TEXT_SEGMENTS )
34
#define HALF_SEGMENTS ( NUM_SEGMENTS / 2 )
37
31
// the buffer for the message
38
32
char Text::_messages[ NUM_MESSAGE_BUFFERS ][ MESSAGE_BUFFER_LEN ];
59
53
void reset_message_param( int message_num )
61
switch( _message_modes[ message_num ] )
64
_message_params[ message_num ] = -BIG_SEGMENTS;
67
_message_params[ message_num ] = -HALF_SEGMENTS;
71
_message_params[ message_num ] = -( BIG_SEGMENTS -
72
TextRenderer::get_width( _message_lens[ message_num ] ) ) / 2;
76
_message_params[ message_num ] = -( HALF_SEGMENTS -
77
TextRenderer::get_width( _message_lens[ message_num ] ) ) / 2;
55
if( _message_modes[ message_num ] & Text::MODE_HSCROLL )
57
switch( _message_modes[ message_num ] & 0x1c )
59
case Text::MODE_ONEQUARTER:
60
_message_params[ message_num ] = -NUM_SEGMENTS / 4; break;
61
case Text::MODE_ONETHIRD:
62
_message_params[ message_num ] = -NUM_SEGMENTS / 3; break;
64
_message_params[ message_num ] = -NUM_SEGMENTS / 2; break;
65
case Text::MODE_TWOTHIRDS:
66
_message_params[ message_num ] = -NUM_SEGMENTS * 2 / 3; break;
67
case Text::MODE_THREEQUARTERS:
68
_message_params[ message_num ] = -NUM_SEGMENTS * 3 / 4; break;
70
_message_params[ message_num ] = -NUM_SEGMENTS; break;
75
switch( _message_modes[ message_num ] & 0x1c )
77
case Text::MODE_ONEQUARTER:
78
_message_params[ message_num ] = NUM_SEGMENTS / 4; break;
79
case Text::MODE_ONETHIRD:
80
_message_params[ message_num ] = NUM_SEGMENTS / 3; break;
82
_message_params[ message_num ] = NUM_SEGMENTS / 2; break;
83
case Text::MODE_TWOTHIRDS:
84
_message_params[ message_num ] = NUM_SEGMENTS * 2 / 3; break;
85
case Text::MODE_THREEQUARTERS:
86
_message_params[ message_num ] = NUM_SEGMENTS * 3 / 4; break;
88
_message_params[ message_num ] = NUM_SEGMENTS; break;
90
_message_params[ message_num ] = -( _message_params[ message_num ] -
91
TextRenderer::get_width( _message_lens[ message_num ] ) ) / 2;
90
void Text::set_message_mode( int message_num, char mode )
103
void Text::reset_message( int message_num, char mode )
92
105
_message_modes[ message_num ] = mode;
93
106
reset_message_param( message_num );
186
201
TextRenderer::render(
187
202
_messages[ message_num ], _message_lens[ message_num ],
188
203
(long)segment + _message_params[ message_num ],
189
_message_modes[ message_num ] & 1 == 0, 0 );
204
( _message_modes[ message_num ] & 1 ) == 0, 0 );