1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
* $Id$
*
*/
#include "kyra/screen_lol.h"
#include "kyra/lol.h"
namespace Kyra {
Screen_LoL::Screen_LoL(LoLEngine *vm, OSystem *system) : Screen_v2(vm, system), _vm(vm) {
}
void Screen_LoL::setScreenDim(int dim) {
debugC(9, kDebugLevelScreen, "Screen_LoL::setScreenDim(%d)", dim);
assert(dim < _screenDimTableCount);
_curDim = &_screenDimTable[dim];
}
const ScreenDim *Screen_LoL::getScreenDim(int dim) {
debugC(9, kDebugLevelScreen, "Screen_LoL::getScreenDim(%d)", dim);
assert(dim < _screenDimTableCount);
return &_screenDimTable[dim];
}
void Screen_LoL::fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint16 flags, ...) {
debugC(9, kDebugLevelScreen, "Screen_LoL::fprintString('%s', %d, %d, %d, %d, %d, ...)", format, x, y, col1, col2, flags);
if (!format)
return;
char string[240];
va_list vaList;
va_start(vaList, flags);
vsnprintf(string, sizeof(string), format, vaList);
va_end(vaList);
if (flags & 1)
x -= getTextWidth(string) >> 1;
if (flags & 2)
x -= getTextWidth(string);
if (flags & 4) {
printText(string, x - 1, y, 1, col2);
printText(string, x, y + 1, 1, col2);
}
if (flags & 8) {
printText(string, x - 1, y, 227, col2);
printText(string, x, y + 1, 227, col2);
}
printText(string, x, y, col1, col2);
}
void Screen_LoL::fprintStringIntro(const char *format, int x, int y, uint8 c1, uint8 c2, uint8 c3, uint16 flags, ...) {
debugC(9, kDebugLevelScreen, "Screen_LoL::fprintStringIntro('%s', %d, %d, %d, %d, %d, %d, ...)", format, x, y, c1, c2, c3, flags);
char buffer[400];
va_list args;
va_start(args, flags);
vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
if ((flags & 0x0F00) == 0x100)
x -= getTextWidth(buffer) >> 1;
if ((flags & 0x0F00) == 0x200)
x -= getTextWidth(buffer);
if ((flags & 0x00F0) == 0x20) {
printText(buffer, x-1, y, c3, c2);
printText(buffer, x, y+1, c3, c2);
}
printText(buffer, x, y, c1, c2);
}
} // end of namespace Kyra
|