aboutsummaryrefslogtreecommitdiff
path: root/engines/mortevielle/sprint.cpp
blob: 027d74791a205f0f82e1038cbdbaa5130df560b5 (plain)
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
/* 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.
 *
 */

/*
 * This code is based on original Mortville Manor DOS source code
 * Copyright (c) 1988-1989 Lankhor
 */

#include "common/str.h"
#include "common/textconsole.h"
#include "mortevielle/mortevielle.h"
#include "mortevielle/mouse.h"
#include "mortevielle/sprint.h"
#include "mortevielle/var_mor.h"

namespace Mortevielle {

void fill_box(int x, int y, int dx) {
	box(15, gd, pred(int, x) << 3, pred(int, y) << 3, pred(int, x + dx) << 3, y << 3, 255);
}

void clear_box(int x, int y, int dx) {
	box(0, gd, pred(int, x) << 3, pred(int, y) << 3, pred(int, x + dx) << 3, y << 3, 255);
}

void writeg(Common::String l, int c)

{
	int i, x, xo, yo;
	int cecr = 0;

	/*  debug('writeg : '+l);*/

	if (l == "")  return;
	hide_mouse();
	xo = xwhere;
	yo = ywhere;
	if (res == 2)  i = 6;
	else i = 10;
	x = xo + i * l.size();
	switch (c) {
	case 1:
	case 3  : {
		cecr = 0;
		box(15, gd, xo, yo, x, yo + 7, 255);
	}
	break;
	case 4 : {
		cecr = 0;
	}
	break;
	case 5 : {
		cecr = 15;
	}
	break;
	case 0:
	case 2 : {
		cecr = 15;
		box(0, gd, xo, yo, x, yo + 7, 255);
	}
	break;
	}
	xo = xo + 1;
	yo = yo + 1;
	for (x = 1; x <= (int)l.size(); x ++) {
		affcar(gd, xo, yo, cecr, ord(l[x - 1]));
		xo = xo + i;
	}
	show_mouse();

	// TODO: Move screen updates to main loop once constructed
	g_vm->_screenSurface.updateScreen();
}

} // End of namespace Mortevielle