scummvm/engines/chewy/effect.cpp

188 lines
5.7 KiB
C++
Raw Normal View History

2019-11-04 22:24:37 +01:00
/* 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.
*
2021-12-26 15:54:17 -08:00
* 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 3 of the License, or
* (at your option) any later version.
2019-11-04 22:24:37 +01:00
*
* 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
2021-12-26 15:54:17 -08:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2019-11-04 22:24:37 +01:00
*
*/
2021-09-11 20:13:53 -07:00
#include "chewy/ngshext.h"
#include "chewy/effect.h"
#include "chewy/global.h"
2019-11-04 22:24:37 +01:00
2021-09-12 15:41:09 -07:00
namespace Chewy {
2022-02-12 19:23:13 -08:00
Effect::Effect() {
2019-11-04 22:24:37 +01:00
}
2022-02-12 19:23:13 -08:00
Effect::~Effect() {
2019-11-04 22:24:37 +01:00
}
2022-02-12 19:23:13 -08:00
void Effect::rnd_blende(byte *rnd_speicher, byte *sram_speicher, byte *screen, byte *palette, int16 col, int16 skip_line) {
byte *sp = (byte *)MALLOC(8 * 8 + 4);
if (!_G(modul)) {
int16 *rnd_zeiger = (int16 *)rnd_speicher;
2019-11-04 22:24:37 +01:00
if (col < 256) {
for (int16 i = 0; i < 1002; i++) {
int16 x;
int16 y = (rnd_zeiger[i] / 40) * 8;
2019-11-04 22:24:37 +01:00
if (rnd_zeiger[i] > 39)
x = (rnd_zeiger[i] - (40 * (y / 8))) * 8;
else
x = rnd_zeiger[i] * 8;
_G(out)->box_fill(x, y, x + 8, y + 8, col);
2019-11-04 22:24:37 +01:00
}
_G(out)->set_palette(palette);
2019-11-04 22:24:37 +01:00
}
for (int16 i = 0; i < 1000; i++) {
int16 x;
int16 y = (rnd_zeiger[i] / 40) * 8;
2019-11-04 22:24:37 +01:00
if (rnd_zeiger[i] > 39)
x = (rnd_zeiger[i] - (40 * (y / 8))) * 8;
else
x = rnd_zeiger[i] * 8;
_G(out)->setze_zeiger(sram_speicher);
_G(out)->sprite_save(sp, x, y, 8, 8, 0);
_G(out)->setze_zeiger(screen);
_G(out)->sprite_set(sp, x, y, 0);
2019-11-04 22:24:37 +01:00
}
free(sp);
}
}
2022-02-12 19:23:13 -08:00
void Effect::blende1(byte *sram_speicher, byte *screen, byte *palette, int16 frames, uint8 mode, int16 col) {
byte *sp = (byte *)MALLOC(8 * 8 + 4);
if (!_G(modul)) {
int16 i = 0;
2019-11-04 22:24:37 +01:00
if (col < 256) {
for (i = 0; i < 13; i++) {
int16 x, y, x1;
2019-11-04 22:24:37 +01:00
for (x = i; x < 39 - i; x++)
_G(out)->box_fill(x * 8, i * 8, x * 8 + 8, i * 8 + 8, col);
2019-11-04 22:24:37 +01:00
for (y = i; y < 24 - i; y++)
_G(out)->box_fill(x * 8, y * 8, x * 8 + 8, y * 8 + 8, col);
2019-11-04 22:24:37 +01:00
for (x1 = 39 - i; x1 > i; x1--)
_G(out)->box_fill(x1 * 8, y * 8, x1 * 8 + 8, y * 8 + 8, col);
for (int16 y1 = 24 - i; y1 >= i; y1--)
_G(out)->box_fill(x1 * 8, y1 * 8, x1 * 8 + 8, y1 * 8 + 8, col);
2019-11-04 22:24:37 +01:00
}
_G(out)->set_palette(palette);
2019-11-04 22:24:37 +01:00
}
switch (mode) {
2019-11-04 22:24:37 +01:00
case 0:
for (i = 13; i >= 0; i--) {
int16 x, y, x1;
2019-11-04 22:24:37 +01:00
for (x = i; x < 39 - i; x++) {
_G(out)->setze_zeiger(sram_speicher);
_G(out)->sprite_save(sp, x * 8, i * 8, 8, 8, 0);
_G(out)->setze_zeiger(screen);
_G(out)->sprite_set(sp, x * 8, i * 8, 0);
2019-11-04 22:24:37 +01:00
}
for (y = i; y < 24 - i; y++) {
_G(out)->setze_zeiger(sram_speicher);
_G(out)->sprite_save(sp, x * 8, y * 8, 8, 8, 0);
_G(out)->setze_zeiger(screen);
_G(out)->sprite_set(sp, x * 8, y * 8, 0);
2019-11-04 22:24:37 +01:00
}
for (x1 = 39 - i; x1 > i; x1--) {
_G(out)->setze_zeiger(sram_speicher);
_G(out)->sprite_save(sp, x1 * 8, y * 8, 8, 8, 0);
_G(out)->setze_zeiger(screen);
_G(out)->sprite_set(sp, x1 * 8, y * 8, 0);
2019-11-04 22:24:37 +01:00
}
for (int16 y1 = 24 - i; y1 > i; y1--) {
_G(out)->setze_zeiger(sram_speicher);
_G(out)->sprite_save(sp, x1 * 8, y1 * 8, 8, 8, 0);
_G(out)->setze_zeiger(screen);
_G(out)->sprite_set(sp, x1 * 8, y1 * 8, 0);
2019-11-04 22:24:37 +01:00
}
}
break;
case 1:
for (i = 0; i < 13; i++) {
int16 x, y, x1;
2019-11-04 22:24:37 +01:00
for (x = i; x < 39 - i; x++) {
_G(out)->setze_zeiger(sram_speicher);
_G(out)->sprite_save(sp, x * 8, i * 8, 8, 8, 0);
_G(out)->setze_zeiger(screen);
_G(out)->sprite_set(sp, x * 8, i * 8, 0);
2019-11-04 22:24:37 +01:00
}
for (y = i; y < 24 - i; y++) {
_G(out)->setze_zeiger(sram_speicher);
_G(out)->sprite_save(sp, x * 8, y * 8, 8, 8, 0);
_G(out)->setze_zeiger(screen);
_G(out)->sprite_set(sp, x * 8, y * 8, 0);
2019-11-04 22:24:37 +01:00
}
for (x1 = 39 - i; x1 > i; x1--) {
_G(out)->setze_zeiger(sram_speicher);
_G(out)->sprite_save(sp, x1 * 8, y * 8, 8, 8, 0);
_G(out)->setze_zeiger(screen);
_G(out)->sprite_set(sp, x1 * 8, y * 8, 0);
2019-11-04 22:24:37 +01:00
}
for (int16 y1 = 24 - i; y1 > i; y1--) {
_G(out)->setze_zeiger(sram_speicher);
_G(out)->sprite_save(sp, x1 * 8, y1 * 8, 8, 8, 0);
_G(out)->setze_zeiger(screen);
_G(out)->sprite_set(sp, x1 * 8, y1 * 8, 0);
2019-11-04 22:24:37 +01:00
}
}
break;
default:
break;
2019-11-04 22:24:37 +01:00
}
free(sp);
}
}
2022-02-12 19:23:13 -08:00
void Effect::border(byte *workpage_, int16 lines, uint8 mode, int16 farbe) {
2021-10-12 21:00:44 -07:00
if (mode) {
for (int i = 0, x = 0; i < 20; ++i, x += 8) {
_G(out)->setze_zeiger(workpage_ + 4);
_G(out)->box_fill(152 - x, 0, 152 - x + 8, 200, farbe);
_G(out)->box_fill(x + 160, 0, x + 168, 200, farbe);
_G(out)->back2screen(workpage_);
2021-10-12 21:00:44 -07:00
}
} else {
for (int i = 0, x = 0; i < 20; ++i, x += 8) {
_G(out)->setze_zeiger(workpage_ + 4);
_G(out)->box_fill(x, 0, x + 8, 200, farbe);
_G(out)->box_fill(312 - x, 0, 31 - x + 8, 200, farbe);
_G(out)->back2screen(workpage_);
2021-10-12 21:00:44 -07:00
}
}
}
2022-02-13 16:48:12 -08:00
void Effect::spr_blende(byte *wrkPage, int16 lines, bool mode, int16 col) {
2021-12-04 22:21:31 -08:00
if (mode) {
for (int i = 0, y = 0; i < 20; ++i, y += 8) {
2022-02-13 16:48:12 -08:00
_G(out)->setze_zeiger(wrkPage + 4);
_G(out)->box_fill(0, 92 - y, 320, 92 - y + 8, col);
_G(out)->box_fill(0, 100 + y, 320, 108 + y, col);
2022-02-13 16:48:12 -08:00
_G(out)->back2screen(wrkPage);
2021-12-04 22:21:31 -08:00
}
} else {
for (int i = 0; i < 20; ++i) {
2022-02-13 16:48:12 -08:00
_G(out)->setze_zeiger(wrkPage + 4);
_G(out)->box_fill(0, i, 320, i + 8, col);
_G(out)->box_fill(0, 192 - i, 320, 200 - i, col);
2022-02-13 16:48:12 -08:00
_G(out)->back2screen(wrkPage);
2021-12-04 22:21:31 -08:00
}
2019-11-04 22:24:37 +01:00
}
}
2021-09-12 15:41:09 -07:00
} // namespace Chewy