mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-27 05:32:45 +00:00
AVALANCHE: Do renaming/refactoring in Graphics.
This commit is contained in:
parent
ce95f738be
commit
390ecc6a6b
@ -313,7 +313,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {
|
||||
sz.syncAsByte(_trip->tr[i].visible);
|
||||
sz.syncAsByte(_trip->tr[i].homing);
|
||||
sz.syncAsByte(_trip->tr[i].count);
|
||||
sz.syncAsByte(_trip->tr[i]._info.xw);
|
||||
sz.syncAsByte(_trip->tr[i]._info._xWidth);
|
||||
sz.syncAsByte(_trip->tr[i].xs);
|
||||
sz.syncAsByte(_trip->tr[i].ys);
|
||||
sz.syncAsByte(_trip->tr[i].totalnum);
|
||||
|
@ -304,7 +304,7 @@ void Celer::loadBackgroundSprites(byte number) {
|
||||
|
||||
for (uint16 y = 0; y < _sprites[i]._yl + 1; y++) {
|
||||
for (uint16 x = 0; x < _sprites[i]._xl * 8; x++)
|
||||
*(byte *)_sprites[i]._picture.getBasePtr(x, y) = *_vm->_graphics->getPixel(_sprites[i]._x * 8 + x, _sprites[i]._y + y);
|
||||
*(byte *)_sprites[i]._picture.getBasePtr(x, y) = *(byte *)_vm->_graphics->_surface.getBasePtr(_sprites[i]._x * 8 + x, _sprites[i]._y + y);
|
||||
}
|
||||
} else {
|
||||
_sprites[i]._size = sprite._size;
|
||||
|
@ -236,7 +236,7 @@ void MenuBar::draw() {
|
||||
|
||||
//setactivepage(3);
|
||||
|
||||
_dr->_vm->_graphics->drawBar(0, 0, 640, 10, _dr->kMenuBackgroundColor);
|
||||
_dr->_vm->_graphics->_surface.fillRect(Common::Rect(0, 0, 640, 10), _dr->kMenuBackgroundColor);
|
||||
|
||||
byte savecp = _dr->_vm->_gyro->cp;
|
||||
_dr->_vm->_gyro->cp = 3;
|
||||
@ -331,7 +331,7 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text,
|
||||
else
|
||||
ander = 170;
|
||||
|
||||
fontType font;
|
||||
FontType font;
|
||||
for (byte i = 0; i < text.size(); i++) {
|
||||
for (byte j = 0; j < 8; j++) {
|
||||
byte idx = text[i];
|
||||
@ -355,7 +355,7 @@ void Dropdown::drawMenuText(int16 x, int16 y, char trigger, Common::String text,
|
||||
for (byte bit = 0; bit < 8; bit++) {
|
||||
byte pixelBit = (pixel >> bit) & 1;
|
||||
if (pixelBit)
|
||||
*_vm->_graphics->getPixel(x * 8 + i * 8 + 7 - bit, y + 8) = fontColor;
|
||||
*(byte *)_vm->_graphics->_surface.getBasePtr(x * 8 + i * 8 + 7 - bit, y + 8) = fontColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,12 +41,18 @@ namespace Avalanche {
|
||||
|
||||
const byte Graphics::kEgaPaletteIndex[16] = {0, 1, 2, 3, 4, 5, 20, 7, 56, 57, 58, 59, 60, 61, 62, 63};
|
||||
|
||||
|
||||
|
||||
Graphics::Graphics(AvalancheEngine *vm) {
|
||||
_vm = vm;
|
||||
}
|
||||
|
||||
Graphics::~Graphics() {
|
||||
_surface.free();
|
||||
_magics.free();
|
||||
_background.free();
|
||||
_screen.free();
|
||||
_scrolls.free();
|
||||
}
|
||||
|
||||
void Graphics::init() {
|
||||
initGraphics(kScreenWidth, kScreenHeight * 2, true); // Doubling the height.
|
||||
|
||||
@ -60,63 +66,17 @@ void Graphics::init() {
|
||||
g_system->getPaletteManager()->setPalette(_egaPalette[kEgaPaletteIndex[i]], i, 1);
|
||||
|
||||
_surface.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8());
|
||||
|
||||
_magics.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8());
|
||||
|
||||
_screen.create(kScreenWidth, kScreenHeight * 2, ::Graphics::PixelFormat::createFormatCLUT8());
|
||||
|
||||
_scrolls.create(kScreenWidth, kScreenHeight, ::Graphics::PixelFormat::createFormatCLUT8());
|
||||
}
|
||||
|
||||
Graphics::~Graphics() {
|
||||
_surface.free();
|
||||
_magics.free();
|
||||
_background.free();
|
||||
_screen.free();
|
||||
_scrolls.free();
|
||||
}
|
||||
|
||||
|
||||
void Graphics::flesh_colors()
|
||||
void Graphics::fleshColors()
|
||||
{
|
||||
g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1);
|
||||
g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1);
|
||||
}
|
||||
|
||||
|
||||
byte *Graphics::getPixel(int16 x, int16 y) {
|
||||
return (byte *)_surface.getBasePtr(x, y);
|
||||
}
|
||||
|
||||
void Graphics::drawFrame(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) {
|
||||
_surface.frameRect(Common::Rect(x1, y1, x2, y2), color);
|
||||
}
|
||||
|
||||
void Graphics::drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color) {
|
||||
_surface.fillRect(Common::Rect(x1, y1, x2, y2), color);
|
||||
}
|
||||
|
||||
void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) {
|
||||
// First we make the pixels of the spirte blank.
|
||||
for (byte j = 0; j < sprite.yl; j++)
|
||||
for (byte i = 0; i < sprite.xl; i++)
|
||||
if (((*sprite.sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0)
|
||||
*getPixel(x + i, y + j) = 0;
|
||||
|
||||
// Then we draw the picture to the blank places.
|
||||
uint16 maniPos = 0; // Because the original manitype starts at 5!!! See Graphics.h for definition.
|
||||
|
||||
for (byte j = 0; j < sprite.yl; j++)
|
||||
for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way.
|
||||
for (uint16 i = 0; i < sprite.xl; i += 8) {
|
||||
byte pixel = (*sprite.mani[picnum])[maniPos++];
|
||||
for (byte bit = 0; bit < 8; bit++) {
|
||||
byte pixelBit = (pixel >> bit) & 1;
|
||||
*getPixel(x + i + 7 - bit, y + j) += (pixelBit << plane);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color) {
|
||||
Common::Point endPoint;
|
||||
const double pi = 3.14;
|
||||
@ -247,9 +207,7 @@ void Graphics::drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte
|
||||
_scrolls.drawLine(p[2].x, p[2].y, p[0].x, p[0].y, color);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, fontType font, byte fontHeight, int16 x, int16 y, byte color) {
|
||||
void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, byte color) {
|
||||
for (byte i = 0; i < text.size(); i++)
|
||||
for (byte j = 0; j < fontHeight; j++) {
|
||||
byte pixel = font[(byte)text[i]][j];
|
||||
@ -261,8 +219,6 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
::Graphics::Surface Graphics::loadPictureGraphic(Common::File &file) {
|
||||
// This function mimics Pascal's getimage().
|
||||
// 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.
|
||||
@ -309,6 +265,27 @@ void Graphics::drawText(::Graphics::Surface &surface, const Common::String &text
|
||||
return picture;
|
||||
}
|
||||
|
||||
void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) {
|
||||
// First we make the pixels of the spirte blank.
|
||||
for (byte j = 0; j < sprite._yLength; j++)
|
||||
for (byte i = 0; i < sprite._xLength; i++)
|
||||
if (((*sprite._sil[picnum])[j][i / 8] >> ((7 - i % 8)) & 1) == 0)
|
||||
*(byte *)_surface.getBasePtr(x + i, y + j) = 0;
|
||||
|
||||
// Then we draw the picture to the blank places.
|
||||
uint16 maniPos = 0; // Because the original manitype starts at 5!!! See Graphics.h for definition.
|
||||
|
||||
for (byte j = 0; j < sprite._yLength; j++)
|
||||
for (int8 plane = 3; plane >= 0; plane--) // The planes are in the opposite way.
|
||||
for (uint16 i = 0; i < sprite._xLength; i += 8) {
|
||||
byte pixel = (*sprite._mani[picnum])[maniPos++];
|
||||
for (byte bit = 0; bit < 8; bit++) {
|
||||
byte pixelBit = (pixel >> bit) & 1;
|
||||
*(byte *)_surface.getBasePtr(x + i + 7 - bit, y + j) += (pixelBit << plane);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY) {
|
||||
// Copy the picture to the given place on the screen.
|
||||
for (uint16 y = 0; y < picture.h; y++)
|
||||
|
@ -36,89 +36,57 @@
|
||||
namespace Avalanche {
|
||||
class AvalancheEngine;
|
||||
|
||||
typedef byte fontType[256][16]; // raw font type
|
||||
typedef byte FontType[256][16]; // raw font type
|
||||
|
||||
typedef byte manitype[2049]; // manitype = array[5..2053] of byte;
|
||||
typedef byte ManiType[2049]; // manitype = array[5..2053] of byte;
|
||||
// Be aware!!!
|
||||
|
||||
typedef byte siltype[51][11]; // 35, 4
|
||||
typedef byte SilType[51][11]; // 35, 4
|
||||
|
||||
class SpriteInfo {
|
||||
public:
|
||||
byte xw; // x-width in bytes
|
||||
byte xl, yl; // x & y lengths of pictures
|
||||
|
||||
manitype *mani[24];
|
||||
siltype *sil[24];
|
||||
|
||||
uint16 size; // the size of one picture
|
||||
byte _xWidth;
|
||||
byte _xLength, _yLength;
|
||||
ManiType *_mani[24];
|
||||
SilType *_sil[24];
|
||||
uint16 _size; // The size of one picture.
|
||||
};
|
||||
|
||||
|
||||
class Graphics {
|
||||
public:
|
||||
static const int16 kScreenWidth = 640;
|
||||
static const int16 kScreenHeight = 200;
|
||||
|
||||
static const uint16 kBackgroundWidth = kScreenWidth;
|
||||
static const byte kBackgroundHeight = 8 * 12080 / kScreenWidth; // With 640 width it's 151
|
||||
static const byte kBackgroundHeight = 8 * 12080 / kScreenWidth; // With 640 width it's 151.
|
||||
// The 8 = number of bits in a byte, and 12080 comes from Lucerna::load().
|
||||
|
||||
::Graphics::Surface _surface;
|
||||
|
||||
::Graphics::Surface _background;
|
||||
|
||||
::Graphics::Surface _magics;
|
||||
// Lucerna::draw_also_lines() draws the "magical" lines here.
|
||||
// Further information: https://github.com/urukgit/avalot/wiki/Also
|
||||
|
||||
::Graphics::Surface _screen;
|
||||
|
||||
::Graphics::Surface _magics; // Lucerna::draw_also_lines() draws the "magical" lines here. Further information: https://github.com/urukgit/avalot/wiki/Also
|
||||
::Graphics::Surface _scrolls;
|
||||
|
||||
|
||||
|
||||
Graphics(AvalancheEngine *vm);
|
||||
|
||||
void init();
|
||||
|
||||
~Graphics();
|
||||
|
||||
void flesh_colors();
|
||||
|
||||
byte *getPixel(int16 x, int16 y);
|
||||
|
||||
void drawFrame(int16 x1, int16 y1, int16 x2, int16 y2, int16 color);
|
||||
|
||||
void drawBar(int16 x1, int16 y1, int16 x2, int16 y2, int16 color);
|
||||
|
||||
void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y);
|
||||
|
||||
Common::Point drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color);
|
||||
void init();
|
||||
void fleshColors();
|
||||
|
||||
// Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc.
|
||||
// Returns the end point of the arc. (Needed in Lucerna::lucerna_clock().)
|
||||
// TODO: Make it more accurate later.
|
||||
|
||||
Common::Point drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color);
|
||||
|
||||
void drawPieSlice(::Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, byte color);
|
||||
|
||||
void drawTriangle(::Graphics::Surface &surface, Common::Point *p, byte color);
|
||||
|
||||
|
||||
|
||||
void drawText(::Graphics::Surface &surface, const Common::String &text, fontType font, byte fontHeight, int16 x, int16 y, byte color);
|
||||
|
||||
|
||||
void drawText(::Graphics::Surface &surface, const Common::String &text, FontType font, byte fontHeight, int16 x, int16 y, byte color);
|
||||
|
||||
// The caller has to .free() the returned Surfaces!!!
|
||||
::Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data.
|
||||
|
||||
::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data.
|
||||
// Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data
|
||||
::Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data.
|
||||
::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data.
|
||||
|
||||
void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y);
|
||||
void drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example.
|
||||
|
||||
void refreshScreen();
|
||||
|
||||
void refreshBackground();
|
||||
|
||||
private:
|
||||
@ -127,6 +95,7 @@ private:
|
||||
static const byte kEgaPaletteIndex[16];
|
||||
|
||||
byte _egaPalette[64][3];
|
||||
::Graphics::Surface _screen; // Only used in refreshScreen() to make it more optimized. (No recreation of it at every call of the function.)
|
||||
};
|
||||
|
||||
} // End of namespace Avalanche
|
||||
|
@ -522,7 +522,7 @@ public:
|
||||
Common::String atkey; // For XTs, set to "alt-". For ATs, set to "f1".
|
||||
|
||||
byte cp, ledstatus, defaultled;
|
||||
fontType characters;
|
||||
FontType characters;
|
||||
bool alive;
|
||||
byte buffer[2000];
|
||||
uint16 bufsize;
|
||||
|
@ -223,7 +223,7 @@ void Lucerna::load(byte n) { // Load2, actually
|
||||
|
||||
CursorMan.showMouse(false);
|
||||
|
||||
_vm->_graphics->flesh_colors();
|
||||
_vm->_graphics->fleshColors();
|
||||
|
||||
xx = _vm->_gyro->strf(n);
|
||||
Common::String filename;
|
||||
@ -1017,14 +1017,14 @@ void Lucerna::verte(Common::Point cursorPos) {
|
||||
// _vm->_trip->tr[0] : that's the only one we're interested in here. (It's Avalot.)
|
||||
if (cursorPos.x < _vm->_trip->tr[0].x)
|
||||
what = 1;
|
||||
else if (cursorPos.x > (_vm->_trip->tr[0].x + _vm->_trip->tr[0]._info.xl))
|
||||
else if (cursorPos.x > (_vm->_trip->tr[0].x + _vm->_trip->tr[0]._info._xLength))
|
||||
what = 2;
|
||||
else
|
||||
what = 0; // On top
|
||||
|
||||
if (cursorPos.y < _vm->_trip->tr[0].y)
|
||||
what += 3;
|
||||
else if (cursorPos.y > (_vm->_trip->tr[0].y + _vm->_trip->tr[0]._info.yl))
|
||||
else if (cursorPos.y > (_vm->_trip->tr[0].y + _vm->_trip->tr[0]._info._yLength))
|
||||
what += 6;
|
||||
|
||||
switch (what) {
|
||||
|
@ -113,7 +113,7 @@ void Parser::plotText() {
|
||||
|
||||
cursorOff();
|
||||
|
||||
_vm->_graphics->drawBar(24, 161, 640, 169, black); // Black out the line of the text.
|
||||
_vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), black); // Black out the line of the text.
|
||||
|
||||
_vm->_graphics->drawText(_vm->_graphics->_surface, _vm->_parser->_inputText, _vm->_gyro->characters, 8, 24, 161, white);
|
||||
|
||||
@ -149,7 +149,7 @@ int16 Parser::pos(const Common::String &crit, const Common::String &src) {
|
||||
void Parser::drawCursor() {
|
||||
// Draw the '_' character.
|
||||
for (byte bit = 0; bit < 8; bit++)
|
||||
*_vm->_graphics->getPixel(24 + _inputTextPos * 8 + 7 - bit, 168) = white;
|
||||
*(byte *)_vm->_graphics->_surface.getBasePtr(24 + _inputTextPos * 8 + 7 - bit, 168) = white;
|
||||
|
||||
bytefield bf;
|
||||
bf.x1 = _inputTextPos + 1;
|
||||
@ -166,7 +166,7 @@ void Parser::wipeText() {
|
||||
|
||||
cursorOff();
|
||||
|
||||
_vm->_graphics->drawBar(24, 161, 640, 169, black); // Black out the line of the text.
|
||||
_vm->_graphics->_surface.fillRect(Common::Rect(24, 161, 640, 169), black); // Black out the line of the text.
|
||||
|
||||
_quote = true;
|
||||
_inputTextPos = 0;
|
||||
|
@ -72,7 +72,7 @@ void Scrolls::state(byte x) { // Sets "Ready" light to whatever
|
||||
|
||||
CursorMan.showMouse(false);
|
||||
|
||||
_vm->_graphics->drawBar(419, 195, 438, 197, color);
|
||||
_vm->_graphics->_surface.fillRect(Common::Rect(419, 195, 438, 197), color);
|
||||
|
||||
CursorMan.showMouse(true);
|
||||
_vm->_gyro->ledstatus = x;
|
||||
@ -83,7 +83,7 @@ void Scrolls::easteregg() {
|
||||
}
|
||||
|
||||
void Scrolls::say(int16 x, int16 y, Common::String z) { // Fancy FAST screenwriting
|
||||
fontType itw;
|
||||
FontType itw;
|
||||
byte lz = z.size();
|
||||
|
||||
bool offset = x % 8 == 4;
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
|
||||
void musical_scroll();
|
||||
|
||||
fontType ch[2];
|
||||
FontType ch[2];
|
||||
|
||||
private:
|
||||
AvalancheEngine *_vm;
|
||||
|
@ -88,28 +88,28 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) {
|
||||
inf.skip(16 - commentSize);
|
||||
|
||||
a.num = inf.readByte();
|
||||
_info.xl = inf.readByte();
|
||||
_info.yl = inf.readByte();
|
||||
_info._xLength = inf.readByte();
|
||||
_info._yLength = inf.readByte();
|
||||
a.seq = inf.readByte();
|
||||
_info.size = inf.readUint16LE();
|
||||
_info._size = inf.readUint16LE();
|
||||
a.fgc = inf.readByte();
|
||||
a.bgc = inf.readByte();
|
||||
a.accinum = inf.readByte();
|
||||
|
||||
totalnum = 0; // = 1;
|
||||
_info.xw = _info.xl / 8;
|
||||
if ((_info.xl % 8) > 0)
|
||||
_info.xw++;
|
||||
_info._xWidth = _info._xLength / 8;
|
||||
if ((_info._xLength % 8) > 0)
|
||||
_info._xWidth++;
|
||||
for (byte aa = 0; aa < /*nds*seq*/a.num; aa++) {
|
||||
|
||||
_info.sil[totalnum] = new siltype[11 * (_info.yl + 1)];
|
||||
_info._sil[totalnum] = new SilType[11 * (_info._yLength + 1)];
|
||||
//getmem(sil[totalnum-1], 11 * (a.yl + 1));
|
||||
_info.mani[totalnum] = new manitype[_info.size - 6];
|
||||
_info._mani[totalnum] = new ManiType[_info._size - 6];
|
||||
//getmem(mani[totalnum-1], a.size - 6);
|
||||
for (fv = 0; fv <= _info.yl; fv++)
|
||||
inf.read((*_info.sil[totalnum])[fv], _info.xw);
|
||||
for (fv = 0; fv <= _info._yLength; fv++)
|
||||
inf.read((*_info._sil[totalnum])[fv], _info._xWidth);
|
||||
//blockread(inf, (*sil[totalnum-1])[fv], xw);
|
||||
inf.read(*_info.mani[totalnum], _info.size - 6);
|
||||
inf.read(*_info._mani[totalnum], _info._size - 6);
|
||||
//blockread(inf, *mani[totalnum-1], a.size - 6);
|
||||
|
||||
totalnum++;
|
||||
@ -173,8 +173,8 @@ void triptype::appear(int16 wx, int16 wy, byte wf) {
|
||||
bool triptype::collision_check() {
|
||||
for (byte fv = 0; fv < _tr->numtr; fv++)
|
||||
if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) &&
|
||||
((x + _info.xl) > _tr->tr[fv].x) &&
|
||||
(x < (_tr->tr[fv].x + _tr->tr[fv]._info.xl)) &&
|
||||
((x + _info._xLength) > _tr->tr[fv].x) &&
|
||||
(x < (_tr->tr[fv].x + _tr->tr[fv]._info._xLength)) &&
|
||||
(_tr->tr[fv].y == y))
|
||||
return true;
|
||||
|
||||
@ -191,8 +191,8 @@ void triptype::walk() {
|
||||
if (r.x1 == 255)
|
||||
r.x1 = 0;
|
||||
r.y1 = y - 2;
|
||||
r.x2 = ((x + _info.xl) / 8) + 1;
|
||||
r.y2 = y + _info.yl + 2;
|
||||
r.x2 = ((x + _info._xLength) / 8) + 1;
|
||||
r.y2 = y + _info._yLength + 2;
|
||||
|
||||
_tr->getset[1 - _tr->_vm->_gyro->cp].remember(r);
|
||||
}
|
||||
@ -212,7 +212,7 @@ void triptype::walk() {
|
||||
return;
|
||||
}
|
||||
|
||||
tc = _tr->checkfeet(x, x + _info.xl, oy[_tr->_vm->_gyro->cp], y, _info.yl) - 1;
|
||||
tc = _tr->checkfeet(x, x + _info._xLength, oy[_tr->_vm->_gyro->cp], y, _info._yLength) - 1;
|
||||
// -1 is because the modified array indexes of magics[] compared to Pascal .
|
||||
|
||||
if ((tc != 255) & (!_tr->_vm->_gyro->doing_sprite_run)) {
|
||||
@ -279,8 +279,8 @@ int8 triptype::sgn(int16 val) {
|
||||
void triptype::walkto(byte pednum) {
|
||||
pednum--; // Pascal -> C conversion: different array indexes.
|
||||
speed(sgn(_tr->_vm->_gyro->peds[pednum].x - x) * 4, sgn(_tr->_vm->_gyro->peds[pednum].y - y));
|
||||
hx = _tr->_vm->_gyro->peds[pednum].x - _info.xl / 2;
|
||||
hy = _tr->_vm->_gyro->peds[pednum].y - _info.yl;
|
||||
hx = _tr->_vm->_gyro->peds[pednum].x - _info._xLength / 2;
|
||||
hy = _tr->_vm->_gyro->peds[pednum].y - _info._yLength;
|
||||
homing = true;
|
||||
}
|
||||
|
||||
@ -344,7 +344,7 @@ void triptype::stopwalk() {
|
||||
}
|
||||
|
||||
void triptype::chatter() {
|
||||
_tr->_vm->_gyro->talkx = x + _info.xl / 2;
|
||||
_tr->_vm->_gyro->talkx = x + _info._xLength / 2;
|
||||
_tr->_vm->_gyro->talky = y;
|
||||
_tr->_vm->_gyro->talkf = a.fgc;
|
||||
_tr->_vm->_gyro->talkb = a.bgc;
|
||||
@ -362,7 +362,7 @@ void triptype::set_up_saver(trip_saver_type &v) {
|
||||
v.homing = homing;
|
||||
v.check_me = check_me;
|
||||
v.count = count;
|
||||
v.xw = _info.xw;
|
||||
v.xw = _info._xWidth;
|
||||
v.xs = xs;
|
||||
v.ys = ys;
|
||||
v.totalnum = totalnum;
|
||||
@ -385,7 +385,7 @@ void triptype::unload_saver(trip_saver_type v) {
|
||||
homing = v.homing;
|
||||
check_me = v.check_me;
|
||||
count = v.count;
|
||||
_info.xw = v.xw;
|
||||
_info._xWidth = v.xw;
|
||||
xs = v.xs;
|
||||
ys = v.ys;
|
||||
totalnum = v.totalnum;
|
||||
@ -417,13 +417,13 @@ triptype *triptype::done() {
|
||||
|
||||
// nds:=num div seq;
|
||||
totalnum--;
|
||||
_info.xw = _info.xl / 8;
|
||||
if ((_info.xl % 8) > 0)
|
||||
_info.xw++;
|
||||
_info._xWidth = _info._xLength / 8;
|
||||
if ((_info._xLength % 8) > 0)
|
||||
_info._xWidth++;
|
||||
for (byte aa = 0; aa < /*nds*seq*/ a.num; aa++) {
|
||||
totalnum--;
|
||||
delete[] _info.mani[totalnum];
|
||||
delete[] _info.sil[totalnum];
|
||||
delete[] _info._mani[totalnum];
|
||||
delete[] _info._sil[totalnum];
|
||||
}
|
||||
|
||||
quick = false;
|
||||
@ -1115,7 +1115,7 @@ void Trip::rwsp(byte t, byte dir) {
|
||||
void Trip::apped(byte trn, byte np) {
|
||||
trn--;
|
||||
np--;
|
||||
tr[trn].appear(_vm->_gyro->peds[np].x - tr[trn]._info.xl / 2, _vm->_gyro->peds[np].y - tr[trn]._info.yl, _vm->_gyro->peds[np].dir);
|
||||
tr[trn].appear(_vm->_gyro->peds[np].x - tr[trn]._info._xLength / 2, _vm->_gyro->peds[np].y - tr[trn]._info._yLength, _vm->_gyro->peds[np].dir);
|
||||
rwsp(trn, _vm->_gyro->peds[np].dir);
|
||||
}
|
||||
|
||||
@ -1206,9 +1206,9 @@ void Trip::arrow_procs(byte tripnum) {
|
||||
// This is so if: a) the bottom of the arrow is below Avvy's head,
|
||||
// b) the left of the arrow is left of the right of Avvy's head, and
|
||||
// c) the right of the arrow is right of the left of Avvy's head.
|
||||
if (((tr[tripnum].y + tr[tripnum]._info.yl) >= tr[0].y) // A
|
||||
&& (tr[tripnum].x <= (tr[0].x + tr[0]._info.xl)) // B
|
||||
&& ((tr[tripnum].x + tr[tripnum]._info.xl) >= tr[0].x)) { // C
|
||||
if (((tr[tripnum].y + tr[tripnum]._info._yLength) >= tr[0].y) // A
|
||||
&& (tr[tripnum].x <= (tr[0].x + tr[0]._info._xLength)) // B
|
||||
&& ((tr[tripnum].x + tr[tripnum]._info._xLength) >= tr[0].x)) { // C
|
||||
// OK, it's hit him... what now?
|
||||
|
||||
tr[1].call_eachstep = false; // prevent recursion.
|
||||
@ -1547,7 +1547,7 @@ void Trip::fliproom(byte room, byte ped) {
|
||||
bool Trip::infield(byte which) {
|
||||
which--; // Pascal -> C: different array indexes.
|
||||
|
||||
int16 yy = tr[0].y + tr[0]._info.yl;
|
||||
int16 yy = tr[0].y + tr[0]._info._yLength;
|
||||
|
||||
return (tr[0].x >= _vm->_gyro->fields[which].x1) && (tr[0].x <= _vm->_gyro->fields[which].x2)
|
||||
&& (yy >= _vm->_gyro->fields[which].y1) && (yy <= _vm->_gyro->fields[which].y2);
|
||||
@ -1561,7 +1561,7 @@ bool Trip::neardoor() {
|
||||
}
|
||||
|
||||
int16 ux = tr[0].x;
|
||||
int16 uy = tr[0].y + tr[0]._info.yl;
|
||||
int16 uy = tr[0].y + tr[0]._info._yLength;
|
||||
bool nd = false;
|
||||
for (byte fv = 8; fv < _vm->_gyro->numfields; fv++)
|
||||
if ((ux >= _vm->_gyro->fields[fv].x1) && (ux <= _vm->_gyro->fields[fv].x2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user