aboutsummaryrefslogtreecommitdiff
path: root/sword2/driver/_console.cpp
blob: 34c9db0c18c01809e0e3090fbf479b854740c7dd (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/* Copyright (C) 1994-2003 Revolution Software Ltd
 *
 * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header$
 */

//=============================================================================
//
//	Filename	:	console.c
//	Created		:	19th September 1996
//	By			:	P.R.Porter
//
//	Summary		:	This module holds the code which controls and displays
//					the console/debugging window.
//
//	Functions
//	---------
//
//	--------------------------------------------------------------------------
//
//	int32 OpenConsole(void)
//
//	Displays the console window and directs keyboard input to it.
//
//	--------------------------------------------------------------------------
//
//	int32 CloseConsole(void)
//
//	Removes the console from the display.
//
//=============================================================================

#include "stdafx.h"
#include "bs2/driver/driver96.h"
#include "bs2/driver/d_draw.h"

namespace Sword2 {

uint8			consoleStatus = 0;			// 1 - console display
//static uint16	consoley = 0;
//static uint32	consoleSize;
static uint8	*consoleSprite = NULL;



//	--------------------------------------------------------------------------
//	Called before the screens are flipped, so that the console can be drawn
//	over the screen if necessary.
//	--------------------------------------------------------------------------
void DisplayConsole(void)

{
	warning("stub DisplayConsole");
/*
	uint8			*src, *dst;
	uint8			i;
//	DDSURFACEDESC	ddDescription;
//	HRESULT			hr;


	if (consoleStatus)
	{

		ddDescription.dwSize = sizeof(ddDescription);
	
		hr = IDirectDrawSurface_Lock(lpBackBuffer, NULL, &ddDescription, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
		if (hr != DD_OK)
		{
			hr = IDirectDrawSurface_Lock(lpBackBuffer, NULL, &ddDescription, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
		}

		if (hr == DD_OK)
		{

			dst = (uint8 *) ddDescription.lpSurface + (screenDeep - consoley) * ddDescription.lPitch;
			src = (uint8 *) consoleSprite;

			for (i=0; i<consoley; i++)
			{
				memcpy(dst, src, screenWide);
				src += screenWide;
				dst += ddDescription.lPitch;
			}
			IDirectDrawSurface_Unlock(lpBackBuffer, ddDescription.lpSurface);
		}
	}
	*/
}




int32 OpenConsole(void)

{
	warning("stub OpenConsole");
/*
	if (consoleStatus)
		return(RDERR_ALREADYOPEN);

	if (consoleSprite == NULL)
	{
		consoley = screenDeep >> 2;
		consoleSize = screenWide * consoley;
		consoleSprite = (uint8 *) malloc(consoleSize);
	}

	if (consoleSprite == NULL)
		return(RDERR_OUTOFMEMORY);

	memset(consoleSprite, 0, consoleSize);
*/
	consoleStatus = 1;
	
	return(RD_OK);

}




int32 CloseConsole(void)

{

	if (!consoleStatus)
		return(RDERR_ALREADYCLOSED);

	free(consoleSprite);
	consoleSprite = NULL;

	consoleStatus = 0;

	return(RD_OK);

}

} // End of namespace Sword2