(svn r2933) Implement the non-breaking space

This commit is contained in:
tron 2005-09-10 08:17:30 +00:00
parent 0fe36a6900
commit 9de2c05c56
6 changed files with 21 additions and 7 deletions

6
gfx.c
View File

@ -1627,15 +1627,15 @@ void LoadStringWidthTable(void)
// 2 equals space. // 2 equals space.
for (i = 2; i != 226; i++) { for (i = 2; i != 226; i++) {
*b++ = (i < 93 || i > 113) && i != 116 && i != 117 && (i < 123 || i > 129) && (i < 151 || i > 153) && i != 155 ? GetSprite(i)->width : 0; *b++ = (i < 93 || i > 97) && (i < 99 || i > 113) && i != 116 && i != 117 && (i < 123 || i > 129) && (i < 151 || i > 153) && i != 155 ? GetSprite(i)->width : 0;
} }
for (i = 226; i != 450; i++) { for (i = 226; i != 450; i++) {
*b++ = (i < 317 || i >= 354) && i != 367 && (i < 375 || i > 377) && i != 379 ? GetSprite(i)->width + 1 : 0; *b++ = (i < 317 || i > 321) && (i < 323 || i > 353) && i != 367 && (i < 375 || i > 377) && i != 379 ? GetSprite(i)->width + 1 : 0;
} }
for (i = 450; i != 674; i++) { for (i = 450; i != 674; i++) {
*b++ = (i < 541 || i >= 579) && i != 585 && i != 587 && i != 588 && (i < 590 || i > 597) && (i < 599 || i > 601) && i != 603 && i != 633 && i != 665 ? GetSprite(i)->width + 1 : 0; *b++ = (i < 541 || i > 577) && i != 585 && i != 587 && i != 588 && (i < 590 || i > 597) && (i < 599 || i > 601) && i != 603 && i != 633 && i != 665 ? GetSprite(i)->width + 1 : 0;
} }
} }

2
gfx.h
View File

@ -41,7 +41,7 @@ void GfxScroll(int left, int top, int width, int height, int xo, int yo);
// XXX doesn't really belong here, but the only // XXX doesn't really belong here, but the only
// consumers always use it in conjunction with DoDrawString() // consumers always use it in conjunction with DoDrawString()
#define UPARROW "\xA0" #define UPARROW "\x80"
#define DOWNARROW "\xAA" #define DOWNARROW "\xAA"

View File

@ -192,7 +192,7 @@ static const SpriteID trg1idx[] = {
2, 92, // ' ' till 'z' 2, 92, // ' ' till 'z'
0xFFFE, 36, 0xFFFE, 36,
160, 160, // Move ¾ to the correct position 160, 160, // Move ¾ to the correct position
130, 130, // TODO Up arrow 98, 98, // Up arrow
131, 133, 131, 133,
0xFFFE, 1, // skip currency sign 0xFFFE, 1, // skip currency sign
135, 135, 135, 135,
@ -219,7 +219,7 @@ static const SpriteID trg1idx[] = {
342, 346, // place holders for transport markers 342, 346, // place holders for transport markers
0xFFFE, 6, 0xFFFE, 6,
384, 384, // Move ¾ to the correct position 384, 384, // Move ¾ to the correct position
354, 354, // TODO Up arrow 322, 322, // Up arrow
355, 357, 355, 357,
0xFFFE, 1, // skip currency sign 0xFFFE, 1, // skip currency sign
359, 359, 359, 359,
@ -316,6 +316,9 @@ static void LoadSpriteTables(void)
files = _use_dos_palette? &files_dos : &files_win; files = _use_dos_palette? &files_dos : &files_win;
LoadGrfIndexed(files->basic[0].filename, trg1idx, 0); LoadGrfIndexed(files->basic[0].filename, trg1idx, 0);
DupSprite( 2, 130); // non-breaking space medium
DupSprite(226, 354); // non-breaking space tiny
DupSprite(450, 578); // non-breaking space large
load_index = 4793; load_index = 4793;
for (i = 1; files->basic[i].filename != NULL; i++) { for (i = 1; files->basic[i].filename != NULL; i++) {

View File

@ -155,6 +155,14 @@ bool LoadNextSprite(int load_index, byte file_index)
return true; return true;
} }
void DupSprite(SpriteID old, SpriteID new)
{
_sprite_file_pos[new] = _sprite_file_pos[old];
_sprite_ptr[new] = NULL;
}
void SkipSprites(uint count) void SkipSprites(uint count)
{ {
for (; count > 0; --count) { for (; count > 0; --count) {

View File

@ -28,6 +28,7 @@ void GfxInitSpriteMem(void);
void IncreaseSpriteLRU(void); void IncreaseSpriteLRU(void);
bool LoadNextSprite(int load_index, byte file_index); bool LoadNextSprite(int load_index, byte file_index);
void DupSprite(SpriteID old, SpriteID new);
void SkipSprites(uint count); void SkipSprites(uint count);
#endif #endif

View File

@ -465,7 +465,9 @@ static const CmdStruct _cmd_structs[] = {
// 0x9E=158 is the LAST special character we may use. // 0x9E=158 is the LAST special character we may use.
{"UPARROW", EmitSingleByte, 0xA0, 0}, {"UPARROW", EmitSingleByte, 0x80, 0},
{"NBSP", EmitSingleByte, 0xA0, 0, C_DONTCOUNT},
{"POUNDSIGN", EmitSingleByte, 0xA3, 0}, {"POUNDSIGN", EmitSingleByte, 0xA3, 0},
{"YENSIGN", EmitSingleByte, 0xA5, 0}, {"YENSIGN", EmitSingleByte, 0xA5, 0},
{"COPYRIGHT", EmitSingleByte, 0xA9, 0}, {"COPYRIGHT", EmitSingleByte, 0xA9, 0},