AVALANCHE: Rename Graph to Graphics. Update everything accordingly.

This commit is contained in:
uruk 2013-07-24 17:02:08 +02:00
parent 0d6a327f98
commit bc5b3fbb65
7 changed files with 24 additions and 24 deletions

View File

@ -30,7 +30,7 @@
#include "avalanche/console.h"
#include "avalanche/graph.h"
#include "avalanche/graphics.h"
#include "avalanche/avalot.h"
#include "avalanche/gyro2.h"
@ -65,7 +65,7 @@ static const int kSavegameVersion = 1;
class AvalancheEngine : public Engine {
public:
Graph _graph;
Graphics _graph;
Avalot _avalot;
Gyro _gyro;

View File

@ -29,7 +29,7 @@
#include "avalanche/avalanche.h"
#include "avalanche/graph.h"
#include "avalanche/graphics.h"
#include "avalanche/avalot.h"
#include "avalanche/gyro2.h"
#include "avalanche/trip6.h"

View File

@ -28,7 +28,7 @@
/* Replacement class for the Graph unit from Pascal. */
#include "avalanche/avalanche.h"
#include "avalanche/graph.h"
#include "avalanche/graphics.h"
#include "common/system.h"
@ -39,15 +39,15 @@
namespace Avalanche {
const byte Graph::_egaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63};
const byte Graphics::_egaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63};
void Graph::setParent(AvalancheEngine *vm) {
void Graphics::setParent(AvalancheEngine *vm) {
_vm = vm;
}
void Graph::init() {
void Graphics::init() {
initGraphics(kScreenWidth, kScreenHeight, true);
for (int i = 0; i < 64; ++i) {
@ -59,30 +59,30 @@ void Graph::init() {
for (byte i = 0; i < 16; i++)
g_system->getPaletteManager()->setPalette(_egaPalette[_egaPaletteIndex[i]], i, 1);
_surface.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8());
_surface.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8());
}
Graph::~Graph() {
Graphics::~Graphics() {
_surface.free();
}
void Graph::flesh_colours()
void Graphics::flesh_colours()
{
g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1);
g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1);
}
byte *Graph::getPixel(int16 x, int16 y) {
byte *Graphics::getPixel(int16 x, int16 y) {
return (byte *)_surface.getBasePtr(x, y);
}
void Graph::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) {
void Graphics::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) {
_surface.fillRect(Common::Rect(x1, y1, x2, y2), color);
}
void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) {
void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) {
/* First we make the pixels of the spirte blank. */
for (byte qay = 0; qay < sprite.yl; qay++) {
@ -112,16 +112,16 @@ void Graph::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y)
}
}
void Graph::drawPicture(const byte *source, uint16 destX, uint16 destY) {
void Graphics::drawPicture(const byte *source, uint16 destX, uint16 destY) {
// The height and the width are stored in 2-2 bytes. We have to add 1 to each because Pascal stores the value of them -1.
uint16 pictureWidth = READ_LE_UINT16(source) + 1;
uint16 pictureHeight = READ_LE_UINT16(source + 2) + 1;
uint32 i = 4;
Graphics::Surface picture; // We make a Surface object for the picture itself.
::Graphics::Surface picture; // We make a Surface object for the picture itself.
picture.create(pictureWidth, pictureHeight, Graphics::PixelFormat::createFormatCLUT8());
picture.create(pictureWidth, pictureHeight, ::Graphics::PixelFormat::createFormatCLUT8());
// Produce the picture.
for (byte y = 0; y < pictureHeight; y++)
@ -140,7 +140,7 @@ void Graph::drawPicture(const byte *source, uint16 destX, uint16 destY) {
*(byte *)_surface.getBasePtr(x + destX, y + destY) = *(byte *)picture.getBasePtr(x, y);
}
void Graph::refreshScreen() {
void Graphics::refreshScreen() {
g_system->copyRectToScreen(_surface.pixels, _surface.pitch , 0, 0, kScreenWidth, kScreenHeight);
g_system->updateScreen();
}

View File

@ -54,7 +54,7 @@ public:
};
class Graph {
class Graphics {
public:
static const int16 kScreenWidth = 640;
static const int16 kScreenHeight = 200;
@ -65,7 +65,7 @@ public:
void init();
~Graph();
~Graphics();
void flesh_colours();
@ -82,7 +82,7 @@ public:
private:
AvalancheEngine *_vm;
Graphics::Surface _surface;
::Graphics::Surface _surface;
static const byte _egaPaletteIndex[16];

View File

@ -243,13 +243,13 @@ void Lucerna::load(byte n) { /* Load2, actually */
move(a0, a1, 12080);
}*/
Graphics::Surface background;
::Graphics::Surface background;
uint16 backgroundWidht = _vm->_graph.kScreenWidth;
byte backgroundHeight = 8 * 12080 / _vm->_graph.kScreenWidth; // With 640 width it's 151
// The 8 = number of bits in a byte, and 12080 comes from the original code (see above)
background.create(backgroundWidht, backgroundHeight, Graphics::PixelFormat::createFormatCLUT8());
background.create(backgroundWidht, backgroundHeight, ::Graphics::PixelFormat::createFormatCLUT8());
for (byte plane = 0; plane < 4; plane++)
for (uint16 y = 0; y < backgroundHeight; y++)

View File

@ -2,7 +2,7 @@ MODULE := engines/avalanche
MODULE_OBJS = \
avalanche.o \
graph.o \
graphics.o \
avalot.o \
console.o \
detection.o \

View File

@ -31,7 +31,7 @@
#ifndef TRIP6_H
#define TRIP6_H
#include "avalanche/graph.h"
#include "avalanche/graphics.h"
#include "common/scummsys.h"
#include "common/str.h"