mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 01:38:36 +00:00
FREESCAPE: neo image loader to parse images in driller for amiga and atari
This commit is contained in:
parent
182f20dc3c
commit
81e93cff37
@ -45,8 +45,8 @@ FreescapeEngine::FreescapeEngine(OSystem *syst, const ADGameDescription *gd)
|
||||
_screenH = 200;
|
||||
|
||||
if (isAmiga()) {
|
||||
_screenW = 640;
|
||||
_screenH = 480;
|
||||
//_screenW = 640;
|
||||
//_screenH = 480;
|
||||
_renderMode = "amiga";
|
||||
} else if (isAtariST()) {
|
||||
_renderMode = "atari";
|
||||
|
@ -25,14 +25,15 @@
|
||||
|
||||
#include "freescape/freescape.h"
|
||||
#include "freescape/language/8bitDetokeniser.h"
|
||||
#include "freescape/neo.h"
|
||||
|
||||
namespace Freescape {
|
||||
|
||||
DrillerEngine::DrillerEngine(OSystem *syst, const ADGameDescription *gd) : FreescapeEngine(syst, gd) {
|
||||
if (isAmiga())
|
||||
_viewArea = Common::Rect(72, 66, 567, 269);
|
||||
else
|
||||
_viewArea = Common::Rect(40, 16, 279, 116);
|
||||
//if (isAmiga())
|
||||
// _viewArea = Common::Rect(72, 66, 567, 269);
|
||||
//else
|
||||
_viewArea = Common::Rect(40, 16, 279, 116);
|
||||
_playerHeightNumber = 1;
|
||||
_playerHeights.push_back(16);
|
||||
_playerHeights.push_back(48);
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "freescape/freescape.h"
|
||||
#include "freescape/language/8bitDetokeniser.h"
|
||||
#include "freescape/objects/sensor.h"
|
||||
#include "freescape/neo.h"
|
||||
|
||||
namespace Freescape {
|
||||
|
||||
@ -506,6 +507,17 @@ void FreescapeEngine::load8bitBinary(Common::SeekableReadStream *file, int offse
|
||||
}
|
||||
|
||||
void FreescapeEngine::loadBorder() {
|
||||
if (isAmiga() || isAtariST()) {
|
||||
Image::NeoDecoder decoder;
|
||||
Common::File borderFile;
|
||||
borderFile.open("console.neo");
|
||||
decoder.loadStream(borderFile);
|
||||
_border = new Graphics::Surface();
|
||||
_border->copyFrom(*decoder.getSurface());
|
||||
_border->convertToInPlace(_gfx->_currentPixelFormat, decoder.getPalette());
|
||||
return;
|
||||
}
|
||||
|
||||
Image::BitmapDecoder decoder;
|
||||
Common::String borderFilename;
|
||||
if (isAmiga())
|
||||
|
@ -22,6 +22,7 @@ MODULE_OBJS := \
|
||||
language/16bitDetokeniser.o \
|
||||
language/instruction.o \
|
||||
movement.o \
|
||||
neo.o \
|
||||
sound.o
|
||||
|
||||
|
||||
|
116
engines/freescape/neo.cpp
Normal file
116
engines/freescape/neo.cpp
Normal file
@ -0,0 +1,116 @@
|
||||
/* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "neo.h"
|
||||
|
||||
#include "common/stream.h"
|
||||
#include "common/textconsole.h"
|
||||
#include "graphics/pixelformat.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
/**
|
||||
* Based on the PCX specs:
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Image {
|
||||
|
||||
NeoDecoder::NeoDecoder() {
|
||||
_surface = 0;
|
||||
_palette = 0;
|
||||
_paletteColorCount = 0;
|
||||
}
|
||||
|
||||
NeoDecoder::~NeoDecoder() {
|
||||
destroy();
|
||||
}
|
||||
|
||||
void NeoDecoder::destroy() {
|
||||
if (_surface) {
|
||||
_surface->free();
|
||||
delete _surface;
|
||||
_surface = 0;
|
||||
}
|
||||
|
||||
delete[] _palette;
|
||||
_palette = 0;
|
||||
_paletteColorCount = 0;
|
||||
}
|
||||
|
||||
bool NeoDecoder::loadStream(Common::SeekableReadStream &stream) {
|
||||
destroy();
|
||||
|
||||
if (stream.readUint16LE() != 0x00)
|
||||
return false;
|
||||
|
||||
if (stream.readUint16LE() != 0x00)
|
||||
return false;
|
||||
|
||||
_palette = new byte[16 * 3];
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
byte v1 = stream.readByte();
|
||||
byte v2 = stream.readByte();
|
||||
|
||||
_palette[i * 3 + 0] = floor((v1 & 0x07) * 255.0 / 7.0);
|
||||
_palette[i * 3 + 1] = floor((v2 & 0x70) * 255.0 / 7.0 / 16.0);
|
||||
_palette[i * 3 + 2] = floor((v2 & 0x07) * 255.0 / 7.0);
|
||||
}
|
||||
|
||||
stream.seek(128);
|
||||
|
||||
int width = 320;
|
||||
int height = 200;
|
||||
_surface = new Graphics::Surface();
|
||||
_surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
|
||||
_paletteColorCount = 16;
|
||||
|
||||
// 200 rows of image:
|
||||
for (int y = 0; y < 200; y++) {
|
||||
// 20 column blocks:
|
||||
for (int x = 0; x < 20; x++) {
|
||||
// Fetch the 4 words that make up the
|
||||
// next 16 pixels across 4 bitplanes:
|
||||
uint16 uW0 = stream.readUint16BE();
|
||||
uint16 uW1 = stream.readUint16BE();
|
||||
uint16 uW2 = stream.readUint16BE();
|
||||
uint16 uW3 = stream.readUint16BE();
|
||||
|
||||
// The first pixel is found in the highest bit:
|
||||
uint32 uBit = 0x8000;
|
||||
|
||||
// 16 pixels to process:
|
||||
for (int z = 0; z < 16; z++) {
|
||||
// Work out the colour index:
|
||||
int idx = 0;
|
||||
if (uW0 & uBit) idx += 1;
|
||||
if (uW1 & uBit) idx += 2;
|
||||
if (uW2 & uBit) idx += 4;
|
||||
if (uW3 & uBit) idx += 8;
|
||||
|
||||
_surface->setPixel(x*16 + z, y, idx);
|
||||
uBit >>= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Image
|
58
engines/freescape/neo.h
Normal file
58
engines/freescape/neo.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef IMAGE_NEO_H
|
||||
#define IMAGE_NEO_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/str.h"
|
||||
#include "image/image_decoder.h"
|
||||
|
||||
/*
|
||||
Atari-ST Neochrome decoder based on NEOLoad by Jason "Joefish" Railton
|
||||
*/
|
||||
|
||||
namespace Common{
|
||||
class SeekableReadStream;
|
||||
}
|
||||
|
||||
namespace Image {
|
||||
|
||||
class NeoDecoder : public ImageDecoder {
|
||||
public:
|
||||
NeoDecoder();
|
||||
virtual ~NeoDecoder();
|
||||
|
||||
// ImageDecoder API
|
||||
void destroy();
|
||||
virtual bool loadStream(Common::SeekableReadStream &stream);
|
||||
virtual const Graphics::Surface *getSurface() const { return _surface; }
|
||||
const byte *getPalette() const { return _palette; }
|
||||
uint16 getPaletteColorCount() const { return _paletteColorCount; }
|
||||
|
||||
private:
|
||||
Graphics::Surface *_surface;
|
||||
byte *_palette;
|
||||
uint16 _paletteColorCount;
|
||||
};
|
||||
} // End of namespace Image
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user