1 /*
2 BStone: A Source port of
3 Blake Stone: Aliens of Gold and Blake Stone: Planet Strike
4
5 Copyright (c) 1992-2013 Apogee Entertainment, LLC
6 Copyright (c) 2013-2015 Boris I. Bendovsky (bibendovsky@hotmail.com)
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the
20 Free Software Foundation, Inc.,
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 */
23
24
25 //
26 // Planet Strike fizzle effect.
27 //
28
29
30 #include "bstone_ps_fizzle_fx.h"
31 #include "3d_def.h"
32 #include "id_vl.h"
33
34
35 void CA_CacheScreen(
36 int16_t chunk);
37
38
39 namespace bstone
40 {
41
42
PSFizzleFX()43 PSFizzleFX::PSFizzleFX() :
44 buffer_(::vga_ref_width * ::vga_ref_height)
45 {
46 }
47
~PSFizzleFX()48 PSFizzleFX::~PSFizzleFX()
49 {
50 uninitialize();
51 }
52
initialize()53 void PSFizzleFX::initialize()
54 {
55 const auto version_padding = 1;
56
57 VgaBuffer current_screen;
58
59 ::vid_export_ui(current_screen);
60
61
62 ::CA_CacheScreen(TITLE2PIC);
63 ::fontnumber = 2;
64 ::PrintX = ::WindowX + version_padding;
65 ::PrintY = ::WindowY + version_padding;
66
67 ::VWB_Bar(
68 ::WindowX,
69 ::WindowY,
70 ::WindowW,
71 ::WindowH,
72 VERSION_TEXT_BKCOLOR);
73
74 SETFONTCOLOR(
75 VERSION_TEXT_COLOR,
76 VERSION_TEXT_BKCOLOR);
77
78 ::US_Print(::get_version_string().c_str());
79
80 ::vid_export_ui(buffer_);
81
82 ::vid_import_ui(current_screen);
83 }
84
uninitialize()85 void PSFizzleFX::uninitialize()
86 {
87 }
88
is_abortable() const89 bool PSFizzleFX::is_abortable() const
90 {
91 return true;
92 }
93
get_frame_count() const94 int PSFizzleFX::get_frame_count() const
95 {
96 return 70;
97 }
98
get_y() const99 int PSFizzleFX::get_y() const
100 {
101 return 0;
102 }
103
get_height() const104 int PSFizzleFX::get_height() const
105 {
106 return ::vga_ref_height;
107 }
108
plot(int x,int y)109 void PSFizzleFX::plot(
110 int x,
111 int y)
112 {
113 const auto offset = (y * ::vga_ref_width) + x;
114 const auto color_index = buffer_[offset];
115
116 ::VL_Plot(
117 x,
118 y,
119 color_index);
120 }
121
skip_to_the_end()122 void PSFizzleFX::skip_to_the_end()
123 {
124 ::vid_import_ui(buffer_);
125 }
126
127
128 } // bstone
129