aboutsummaryrefslogtreecommitdiff
path: root/saga/reinherit.h
blob: 8b7690b0b0fe49986f1c2bedd2f2e3481d92e813 (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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2004 The ScummVM project
 *
 * The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
 *
 * 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$
 *
 */
/*
 Description:   
 
    Main Header File

 Notes: 
*/

#ifndef SAGA_REINHERIT_H_
#define SAGA_REINHERIT_H_

#include "common/stdafx.h"
#include "common/scummsys.h"
#include "common/rect.h"

#include "base/engine.h"

/*
 * Implementation conditionals
\*--------------------------------------------------------------------------*/
#define R_ENV_LINUX
#include "sys_interface.h"

namespace Saga {

#define R_MAXPATH 512

/* For debug message processing */
#define R_DEBUG_NONE 0
#define R_DEBUG_INFO 1
#define R_DEBUG_VERBOSE 2
#define R_DEBUG_PARANOID 3

#define R_MEMFAIL_MSG "Memory allocation error."

/*
 * Define opaque types
\*--------------------------------------------------------------------------*/

/* r_rscfile */
typedef struct R_RSCFILE_CONTEXT_tag R_RSCFILE_CONTEXT;

/* r_script */
typedef struct R_SEMAPHORE_tag R_SEMAPHORE;

/*
 * Define common data types
\*--------------------------------------------------------------------------*/

#ifndef HAVE_UCHAR
typedef unsigned char uchar;
#endif
#ifndef HAVE_ULONG
typedef unsigned long ulong;
#endif
#ifndef HAVE_UINT
typedef unsigned int uint;
#endif

typedef Common::Point R_POINT;
typedef Common::Rect R_RECT;


struct R_COLOR {
	int red;
	int green;
	int blue;
	int alpha;
};

struct R_SURFACE {
	uchar *buf;
	int buf_w;
	int buf_h;
	int buf_pitch;

	int bpp;

	R_RECT clip_rect;

	void *impl_src;
};

struct R_SOUNDBUFFER {
	const uchar *res_data;
	size_t res_len;

	long s_freq;
	int s_samplebits;
	int s_stereo;
	int s_signed;

	const uchar *s_buf;
	size_t s_buf_len;
};

#define R_RGB_RED   0x00FF0000UL
#define R_RGB_GREEN 0x0000FF00UL
#define R_RGB_BLUE  0x000000FFUL

struct SAGA_COLOR {
	byte r;
	byte g;
	byte b;
};

#define SAGA_COLOR_LEN 3

struct PALENTRY {
	byte red;
	byte green;
	byte blue;
};

enum R_ERRORCODE {
	R_STOP = -3,
	R_MEM = -2,
	R_FAILURE = -1,
	R_SUCCESS = 0
};


/*
 * r_main.c
\*--------------------------------------------------------------------------*/

void R_Shutdown(int param);

/*
 * r_transitions.c
\*--------------------------------------------------------------------------*/
int TRANSITION_Dissolve(uchar *dst_img,
    int dst_w,
    int dst_h,
    int dst_p, const uchar *src_img, int src_p, int flags, double percent);

/*--------------------------------------------------------------------------*\
 * System specific routines
\*--------------------------------------------------------------------------*/

/*
 * System : Sound
\*--------------------------------------------------------------------------*/
int SYSSOUND_Init(int enabled);
int SYSSOUND_Shutdown(void);

int SYSSOUND_Play(int sound_rn, int channel);
int SYSSOUND_Pause(int channel);
int SYSSOUND_Resume(int channel);
int SYSSOUND_Stop(int channel);

int SYSSOUND_PlayVoice(R_SOUNDBUFFER *);
int SYSSOUND_PauseVoice(void);
int SYSSOUND_ResumeVoice(void);
int SYSSOUND_StopVoice(void);

/*
 * System : Music
\*--------------------------------------------------------------------------*/
enum SYSMUSIC_FLAGS {

	R_MUSIC_LOOP = 0x01
};

int SYSMUSIC_Init(int enabled);
int SYSMUSIC_Shutdown(void);

int SYSMUSIC_Play(ulong music_rn, uint flags);
int SYSMUSIC_Pause(void);
int SYSMUSIC_Resume(void);
int SYSMUSIC_Stop(void);

/*
 * System : Graphics
\*--------------------------------------------------------------------------*/
#define R_PAL_ENTRIES 256

struct R_SYSGFX_INIT {

	int backbuf_w;
	int backbuf_h;
	int backbuf_bpp;

	int screen_w;
	int screen_h;
	int screen_bpp;

	int fullscreen;

};

int SYSGFX_Init(R_SYSGFX_INIT *);

R_SURFACE *SYSGFX_GetScreenSurface(void);
R_SURFACE *SYSGFX_GetBackBuffer(void);

int SYSGFX_LockSurface(R_SURFACE *surface);
int SYSGFX_UnlockSurface(R_SURFACE *surface);

R_SURFACE *SYSGFX_CreateSurface(int w, int h, int bpp);
R_SURFACE *SYSGFX_FormatToDisplay(R_SURFACE *surface);
int SYSGFX_DestroySurface(R_SURFACE *surface);

int SYSGFX_GetWhite(void);
int SYSGFX_GetBlack(void);
int SYSGFX_MatchColor(unsigned long colormask);
int SYSGFX_SetPalette(R_SURFACE *surface, PALENTRY *pal);
int SYSGFX_GetCurrentPal(PALENTRY *src_pal);

int SYSGFX_PalToBlack(R_SURFACE *surface, PALENTRY *src_pal, double percent);

int SYSGFX_BlackToPal(R_SURFACE *surface, PALENTRY *src_pal, double percent);

/*
 * System : Input 
\*--------------------------------------------------------------------------*/
int SYSINPUT_Init(void);
int SYSINPUT_ProcessInput(void);
int SYSINPUT_GetMousePos(int *mouse_x, int *mouse_y);
int SYSINPUT_HideMouse(void);
int SYSINPUT_ShowMouse(void);

/*** sys_signal.c ***/
int ITESYS_CheckSignal(void);

} // End of namespace Saga

#endif				/* SAGA_REINHERIT_H_ */