1 /* ResidualVM - A 3D game interpreter
2 *
3 * ResidualVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the AUTHORS
5 * file distributed with this source distribution.
6 *
7 * Additional copyright for this file:
8 * Copyright (C) 1999-2000 Revolution Software Ltd.
9 * This code is based on source code created by Revolution Software,
10 * used with permission.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 *
26 */
27
28 #include "engines/icb/debug.h"
29 #include "engines/icb/mission.h"
30 #include "engines/icb/global_objects.h"
31
32 namespace ICB {
33
34 #define DEFAULT_WIDESCREEN_SPEED_ON 6
35 #define DEFAULT_WIDESCREEN_MODE_ON 0
36 #define DEFAULT_WIDESCREEN_SPEED_OFF 6
37 #define DEFAULT_WIDESCREEN_MODE_OFF 0
38
fx_widescreen(int32 &,int32 * params)39 mcodeFunctionReturnCodes fx_widescreen(int32 &, int32 *params) {
40 // fx_narrow_screen(mode,0,0,0,target,6
41 // where mode is 0 for on and 2 for off
42 // where target is 27% for on and 0% for off
43 int32 p[6] = {DEFAULT_WIDESCREEN_MODE_OFF, 0, 0, 0, 0, DEFAULT_WIDESCREEN_SPEED_OFF};
44
45 // if on alter arguments 0 (mode) and 4 (percent)
46 if (params[0]) {
47 p[0] = DEFAULT_WIDESCREEN_MODE_ON; // scroll on
48 p[4] = 27; // 27% is 32 pixels off top and bottom
49 p[5] = DEFAULT_WIDESCREEN_SPEED_ON; // speed
50 }
51
52 int32 ret;
53 return MS->fx_narrow_screen(ret, p);
54 }
55
_simple_fx(int32 mode,int32 toFrom,int32 fr,int32 fg,int32 fb,int32 r,int32 g,int32 b,int32 cycles)56 mcodeFunctionReturnCodes _simple_fx(int32 mode, int32 toFrom, int32 fr, int32 fg, int32 fb, int32 r, int32 g, int32 b, int32 cycles) {
57 // fx_generic_fade(mode,onOff,0,0,0,r,g,b,cycles
58 // note from colour is always <0,0,0>
59 int32 p[9] = {mode, toFrom, fr, fg, fb, r, g, b, cycles};
60 int32 ret;
61 return MS->fx_generic_fade(ret, p);
62 }
63
64 // take <r,g,b> and cycles
fx_brighten_to(int32 &,int32 * p)65 mcodeFunctionReturnCodes fx_brighten_to(int32 &, int32 *p) { return _simple_fx(0, 1, 0, 0, 0, p[0], p[1], p[2], p[3]); }
66
fx_brighten_from(int32 &,int32 * p)67 mcodeFunctionReturnCodes fx_brighten_from(int32 &, int32 *p) { return _simple_fx(0, 0, 0, 0, 0, p[0], p[1], p[2], p[3]); }
68
fx_darken_to(int32 &,int32 * p)69 mcodeFunctionReturnCodes fx_darken_to(int32 &, int32 *p) { return _simple_fx(1, 1, 0, 0, 0, p[0], p[1], p[2], p[3]); }
70
fx_darken_from(int32 &,int32 * p)71 mcodeFunctionReturnCodes fx_darken_from(int32 &, int32 *p) { return _simple_fx(1, 0, 0, 0, 0, p[0], p[1], p[2], p[3]); }
72
fx_fade_to(int32 &,int32 * p)73 mcodeFunctionReturnCodes fx_fade_to(int32 &, int32 *p) { return _simple_fx(2, 1, 0, 0, 0, p[0], p[1], p[2], p[3]); }
74
fx_fade_from(int32 &,int32 * p)75 mcodeFunctionReturnCodes fx_fade_from(int32 &, int32 *p) { return _simple_fx(2, 0, 0, 0, 0, p[0], p[1], p[2], p[3]); }
76
77 // blend function takes <r,g,b> -> <r,g,b> and cycles
fx_blend(int32 &,int32 * p)78 mcodeFunctionReturnCodes fx_blend(int32 &, int32 *p) { return _simple_fx(3, 1, p[0], p[1], p[2], p[3], p[4], p[5], p[6]); }
79
80 } // End of namespace ICB
81