STARK: Fix build

This commit is contained in:
Bastien Bouclet 2014-09-21 14:16:40 +02:00
parent 45703fd65f
commit 440ee57ccd
17 changed files with 73 additions and 74 deletions

View file

@ -125,9 +125,9 @@ bool Actor::readFromStream(Common::ReadStream *stream) {
VertNode *vert = new VertNode();
ptr = new char[14 * 4];
stream->read(ptr, 14 * 4);
vert->_pos1 = Graphics::Vector3d(get_float(ptr), get_float(ptr + 4), get_float(ptr + 8));
vert->_pos2 = Graphics::Vector3d(get_float(ptr + 12), get_float(ptr + 16), get_float(ptr + 20));
vert->_normal = Graphics::Vector3d(get_float(ptr + 24), get_float(ptr + 28), get_float(ptr + 32));
vert->_pos1 = Math::Vector3d(get_float(ptr), get_float(ptr + 4), get_float(ptr + 8));
vert->_pos2 = Math::Vector3d(get_float(ptr + 12), get_float(ptr + 16), get_float(ptr + 20));
vert->_normal = Math::Vector3d(get_float(ptr + 24), get_float(ptr + 28), get_float(ptr + 32));
vert->_texS = get_float(ptr + 36);
vert->_texT = get_float(ptr + 40);
vert->_bone1 = READ_LE_UINT32(ptr + 44);

View file

@ -28,7 +28,7 @@
#include "engines/stark/sceneelement.h"
#include "graphics/vector3d.h"
#include "math/vector3d.h"
#include "common/str.h"
#include "common/array.h"
@ -44,8 +44,8 @@ class Texture;
class VertNode {
public:
Graphics::Vector3d _pos1, _pos2;
Graphics::Vector3d _normal;
Math::Vector3d _pos1, _pos2;
Math::Vector3d _normal;
float _texS, _texT;
uint32 _bone1, _bone2;
float _boneWeight;

View file

@ -129,8 +129,8 @@ bool XARCArchive::open(const Common::String &filename) {
return true;
}
bool XARCArchive::hasFile(const Common::String &name) {
for (Common::ArchiveMemberList::iterator it = _members.begin(); it != _members.end(); ++it) {
bool XARCArchive::hasFile(const Common::String &name) const {
for (Common::ArchiveMemberList::const_iterator it = _members.begin(); it != _members.end(); ++it) {
if ((*it)->getName() == name) {
// Found it
return true;
@ -141,9 +141,9 @@ bool XARCArchive::hasFile(const Common::String &name) {
return false;
}
int XARCArchive::listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) {
int XARCArchive::listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const {
int matches = 0;
for (Common::ArchiveMemberList::iterator it = _members.begin(); it != _members.end(); ++it) {
for (Common::ArchiveMemberList::const_iterator it = _members.begin(); it != _members.end(); ++it) {
if ((*it)->getName().matchString(pattern)) {
// This file matches, add it
list.push_back(*it);
@ -154,9 +154,9 @@ int XARCArchive::listMatchingMembers(Common::ArchiveMemberList &list, const Comm
return matches;
}
int XARCArchive::listMembers(Common::ArchiveMemberList &list) {
int XARCArchive::listMembers(Common::ArchiveMemberList &list) const {
int files = 0;
for (Common::ArchiveMemberList::iterator it = _members.begin(); it != _members.end(); ++it) {
for (Common::ArchiveMemberList::const_iterator it = _members.begin(); it != _members.end(); ++it) {
// Add all the members to the list
list.push_back(*it);
files++;
@ -165,8 +165,8 @@ int XARCArchive::listMembers(Common::ArchiveMemberList &list) {
return files;
}
Common::ArchiveMemberPtr XARCArchive::getMember(const Common::String &name) {
for (Common::ArchiveMemberList::iterator it = _members.begin(); it != _members.end(); ++it) {
const Common::ArchiveMemberPtr XARCArchive::getMember(const Common::String &name) const {
for (Common::ArchiveMemberList::const_iterator it = _members.begin(); it != _members.end(); ++it) {
if ((*it)->getName() == name) {
// Found it
return *it;

View file

@ -38,10 +38,10 @@ public:
bool open(const Common::String &filename);
// Archive API
bool hasFile(const Common::String &name);
int listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern);
int listMembers(Common::ArchiveMemberList &list);
Common::ArchiveMemberPtr getMember(const Common::String &name);
bool hasFile(const Common::String &name) const;
int listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const;
int listMembers(Common::ArchiveMemberList &list) const;
const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
Common::SeekableReadStream *createReadStreamForMember(const XARCMember *member) const;

View file

@ -48,7 +48,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
Common::GUIO_NONE
GUIO_NONE
},
// The Longest Journey
@ -63,7 +63,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
GF_DVD,
Common::GUIO_NONE
GUIO_NONE
},
// The Longest Journey
@ -77,7 +77,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
Common::GUIO_NONE
GUIO_NONE
},
// The Longest Journey
@ -91,7 +91,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | GF_DVD,
Common::GUIO_NONE
GUIO_NONE
},
// The Longest Journey
@ -105,7 +105,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_DEMO,
Common::GUIO_NONE
GUIO_NONE
},
// The Longest Journey
@ -119,7 +119,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::NB_NOR,
Common::kPlatformWindows,
ADGF_DEMO,
Common::GUIO_NONE
GUIO_NONE
},
// The Longest Journey
@ -133,7 +133,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::NB_NOR,
Common::kPlatformWindows,
ADGF_DEMO,
Common::GUIO_NONE
GUIO_NONE
},
// The Longest Journey
@ -147,7 +147,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
Common::GUIO_NONE
GUIO_NONE
},
// The Longest Journey
@ -161,7 +161,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::SE_SWE,
Common::kPlatformWindows,
ADGF_DEMO,
Common::GUIO_NONE
GUIO_NONE
},
AD_TABLE_END_MARKER
@ -177,7 +177,7 @@ static const ADGameDescription fallbackDescription = {
Common::UNK_LANG,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
Common::GUIO_NONE
GUIO_NONE
};
static const ADFileBasedFallback fileBasedFallback[] = {
@ -189,7 +189,7 @@ class StarkMetaEngine : public AdvancedMetaEngine {
public:
StarkMetaEngine() : AdvancedMetaEngine(gameDescriptions, sizeof(ADGameDescription), starkGames) {
_singleid = "stark";
_guioptions = Common::GUIO_NOMIDI;
_guioptions = GUIO1(GUIO_NOMIDI);
}
virtual const char *getName() const {

View file

@ -24,7 +24,7 @@
*/
#include "engines/stark/gfx/coordinate.h"
#include "graphics/vector3d.h"
#include "math/vector3d.h"
namespace Stark {
@ -36,7 +36,7 @@ namespace Stark {
2 * x * z - 2 * w * y, 2 * y * z + 2 * x * w, 1 - 2 * x * x - 2 * y * y, \
};
Coordinate::Coordinate(const Graphics::Vector3d &left) {
Coordinate::Coordinate(const Math::Vector3d &left) {
_coords[0] = left.x();
_coords[1] = left.y();
_coords[2] = left.z();

View file

@ -26,7 +26,7 @@
#ifndef STARK_GFX_COORDINATE_H
#define STARK_GFX_COORDINATE_H
#include "graphics/vector3d.h"
#include "math/vector3d.h"
namespace Stark {
@ -40,7 +40,7 @@ namespace Stark {
class Coordinate {
public:
Coordinate();
Coordinate(const Graphics::Vector3d &left);
Coordinate(const Math::Vector3d &left);
Coordinate(float x, float y, float z);
~Coordinate();

View file

@ -29,7 +29,7 @@
//#include "engines/stark/color.h"
#include "graphics/surface.h"
#include "common/rect.h"
//#include "graphics/vector3d.h"
//#include "math/vector3d.h"
namespace Stark {
@ -54,9 +54,9 @@ public:
virtual void set3DMode() = 0;
/*
virtual void setupCamera(float fov, float nclip, float fclip, float roll) = 0;
virtual void positionCamera(Graphics::Vector3d pos, Graphics::Vector3d interest) = 0;
virtual void positionCamera(Math::Vector3d pos, Math::Vector3d interest) = 0;
virtual void translateViewpointStart(Graphics::Vector3d pos, float pitch, float yaw, float roll) = 0;
virtual void translateViewpointStart(Math::Vector3d pos, float pitch, float yaw, float roll) = 0;
virtual void translateViewpointFinish() = 0;
virtual void disableLights() = 0;

View file

@ -26,6 +26,7 @@
#include "engines/stark/gfx/opengl.h"
#include "common/system.h"
#include "graphics/pixelbuffer.h"
#ifdef USE_OPENGL
@ -84,7 +85,7 @@ void OpenGLGfxDriver::drawSurface(const Graphics::Surface *surface, Common::Poin
float rasterX = (2 * (float)dest.x / (float)_screenWidth);
float rasterY = (2 * (float)dest.y / (float)_screenHeight);
glRasterPos2f(-1.0f + rasterX, 1.0f - rasterY);
glDrawPixels(surface->w, surface->h, GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels);
glDrawPixels(surface->w, surface->h, GL_RGBA, GL_UNSIGNED_BYTE, surface->getPixels());
//glBegin(GL_QUADS); glVertex3i(-1, -1, -1); glVertex3i(1, -1, -1); glVertex3i(1, 1, -1); glVertex3i(-1, 1, -1); glEnd();
@ -144,11 +145,11 @@ void OpenGLGfxDriver::setupCamera(float fov, float nclip, float fclip, float rol
glRotatef(roll, 0, 0, -1);
}
void OpenGLGfxDriver::positionCamera(Graphics::Vector3d pos, Graphics::Vector3d interest) {
Graphics::Vector3d up_vec(0, 0, 1);
void OpenGLGfxDriver::positionCamera(Math::Vector3d pos, Math::Vector3d interest) {
Math::Vector3d up_vec(0, 0, 1);
if (pos.x() == interest.x() && pos.y() == interest.y())
up_vec = Graphics::Vector3d(0, 1, 0);
up_vec = Math::Vector3d(0, 1, 0);
gluLookAt(pos.x(), pos.y(), pos.z(), interest.x(), interest.y(), interest.z(), up_vec.x(), up_vec.y(), up_vec.z());
}
@ -157,7 +158,7 @@ bool OpenGLGfxDriver::isHardwareAccelerated() {
return true;
}
static void glShadowProjection(Graphics::Vector3d light, Graphics::Vector3d plane, Graphics::Vector3d normal, bool dontNegate) {
static void glShadowProjection(Math::Vector3d light, Math::Vector3d plane, Math::Vector3d normal, bool dontNegate) {
// Based on GPL shadow projection example by
// (c) 2002-2003 Phaetos <phaetos@gaffga.de>
float d, c;
@ -212,7 +213,7 @@ void OpenGLGfxDriver::set3DMode() {
glDepthFunc(GL_LESS);
}
/*
void OpenGLGfxDriver::translateViewpointStart(Graphics::Vector3d pos, float pitch, float yaw, float roll) {
void OpenGLGfxDriver::translateViewpointStart(Math::Vector3d pos, float pitch, float yaw, float roll) {
glMatrixMode(GL_MODELVIEW);
glPushMatrix();

View file

@ -54,9 +54,9 @@ public:
void set3DMode();
/*
void setupCamera(float fov, float nclip, float fclip, float roll);
void positionCamera(Graphics::Vector3d pos, Graphics::Vector3d interest);
void positionCamera(Math::Vector3d pos, Math::Vector3d interest);
void translateViewpointStart(Graphics::Vector3d pos, float pitch, float yaw, float roll);
void translateViewpointStart(Math::Vector3d pos, float pitch, float yaw, float roll);
void translateViewpointFinish();
*/
private:

View file

@ -43,7 +43,7 @@ TinyGLGfxDriver::~TinyGLGfxDriver() {
//delete[] _storedDisplay;
if (_zb) {
TinyGL::glClose();
ZB_close(_zb);
delete _zb;
}
}
@ -52,7 +52,7 @@ const char *TinyGLGfxDriver::getVideoDeviceName() {
}
void TinyGLGfxDriver::setupScreen(int screenW, int screenH, bool fullscreen) {
byte *buffer = g_system->setupScreen(screenW, screenH, fullscreen, false);
Graphics::PixelBuffer buffer = g_system->setupScreen(screenW, screenH, fullscreen, false);
_screenWidth = screenW;
_screenHeight = screenH;
@ -61,8 +61,8 @@ void TinyGLGfxDriver::setupScreen(int screenW, int screenH, bool fullscreen) {
//g_system->setWindowCaption("Residual: Software 3D Renderer");
_zb = TinyGL::ZB_open(screenW, screenH, ZB_MODE_5R6G5B, buffer);
TinyGL::glInit(_zb);
_zb = new TinyGL::FrameBuffer(screenW, screenH, buffer);
TinyGL::glInit(_zb, 256);
/*
//_storedDisplay = new byte[640 * 480 * 2];
@ -78,9 +78,7 @@ void TinyGLGfxDriver::setupScreen(int screenW, int screenH, bool fullscreen) {
}
void TinyGLGfxDriver::clearScreen() {
memset(_zb->pbuf, 0, 640 * 480 * 2);
memset(_zb->zbuf, 0, 640 * 480 * 2);
memset(_zb->zbuf2, 0, 640 * 480 * 4);
_zb->clear(true, 0, true, 0, 0, 0);
}
void TinyGLGfxDriver::flipBuffer() {
@ -93,12 +91,12 @@ void TinyGLGfxDriver::drawSurface(const Graphics::Surface *surface, Common::Poin
rect = Common::Rect(surface->w, surface->h);
for (int i = 0; i < surface->w * surface->h; i++) {
byte *pixel = (byte *)surface->pixels + (i * 3);
byte *pixel = (byte *)surface->getPixels() + (i * 3);
byte r = pixel[0];
byte g = pixel[1];
byte b = pixel[2];
uint16 color = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
_zb->pbuf[i] = color;
_zb->writePixel(i, color);
}
//memcpy(_zb->pbuf, surface->pixels, numPixels);
@ -220,11 +218,11 @@ void TinyGLGfxDriver::setupCamera(float fov, float nclip, float fclip, float rol
tglRotatef(roll, 0, 0, -1);
}
void TinyGLGfxDriver::positionCamera(Graphics::Vector3d pos, Graphics::Vector3d interest) {
Graphics::Vector3d up_vec(0, 0, 1);
void TinyGLGfxDriver::positionCamera(Math::Vector3d pos, Math::Vector3d interest) {
Math::Vector3d up_vec(0, 0, 1);
if (pos.x() == interest.x() && pos.y() == interest.y())
up_vec = Graphics::Vector3d(0, 1, 0);
up_vec = Math::Vector3d(0, 1, 0);
lookAt(pos.x(), pos.y(), pos.z(), interest.x(), interest.y(), interest.z(), up_vec.x(), up_vec.y(), up_vec.z());
}
@ -233,7 +231,7 @@ bool TinyGLGfxDriver::isHardwareAccelerated() {
return false;
}
static void tglShadowProjection(Graphics::Vector3d light, Graphics::Vector3d plane, Graphics::Vector3d normal, bool dontNegate) {
static void tglShadowProjection(Math::Vector3d light, Math::Vector3d plane, Math::Vector3d normal, bool dontNegate) {
// Based on GPL shadow projection example by
// (c) 2002-2003 Phaetos <phaetos@gaffga.de>
float d, c;
@ -298,7 +296,7 @@ void TinyGLGfxDriver::getBoundingBoxPos(const Model::Mesh *model, int *x1, int *
TGLfloat winX, winY, winZ;
for (int i = 0; i < model->_numFaces; i++) {
Graphics::Vector3d v;
Math::Vector3d v;
float* pVertices;
for (int j = 0; j < model->_faces[i]._numVertices; j++) {
@ -368,7 +366,7 @@ void TinyGLGfxDriver::getBoundingBoxPos(const Model::Mesh *model, int *x1, int *
}*/
}
void TinyGLGfxDriver::startActorDraw(Graphics::Vector3d pos, float yaw, float pitch, float roll) {
void TinyGLGfxDriver::startActorDraw(Math::Vector3d pos, float yaw, float pitch, float roll) {
tglEnable(TGL_TEXTURE_2D);
tglMatrixMode(TGL_MODELVIEW);
tglPushMatrix();
@ -479,7 +477,7 @@ void TinyGLGfxDriver::drawModelFace(const Model::Face *face, float *vertices, fl
tglEnd();
}
void TinyGLGfxDriver::translateViewpointStart(Graphics::Vector3d pos, float pitch, float yaw, float roll) {
void TinyGLGfxDriver::translateViewpointStart(Math::Vector3d pos, float pitch, float yaw, float roll) {
tglPushMatrix();
tglTranslatef(pos.x(), pos.y(), pos.z());

View file

@ -52,14 +52,14 @@ public:
void set3DMode();
/*
void setupCamera(float fov, float nclip, float fclip, float roll);
void positionCamera(Graphics::Vector3d pos, Graphics::Vector3d interest);
void positionCamera(Math::Vector3d pos, Math::Vector3d interest);
void translateViewpointStart(Graphics::Vector3d pos, float pitch, float yaw, float roll);
void translateViewpointStart(Math::Vector3d pos, float pitch, float yaw, float roll);
void translateViewpointFinish();
void getBoundingBoxPos(const Model::Mesh *model, int *x1, int *y1, int *x2, int *y2);
void startActorDraw(Graphics::Vector3d pos, float yaw, float pitch, float roll);
void startActorDraw(Math::Vector3d pos, float yaw, float pitch, float roll);
void finishActorDraw();
void setShadow(Shadow *shadow);
@ -107,7 +107,7 @@ public:
*/
private:
TinyGL::ZBuffer *_zb;
TinyGL::FrameBuffer *_zb;
byte *_screen;
byte *_smushBitmap;
int _smushWidth;

View file

@ -107,13 +107,13 @@ bool Skeleton::animate(uint32 delta) {
setNode(_lastTime, _bones[0], Coordinate());
/*
Graphics::Vector3d b1 = (*face)->_verts[vertIdx]->_pos1;
Math::Vector3d b1 = (*face)->_verts[vertIdx]->_pos1;
idx = (*face)->_verts[vertIdx]->_bone1;
BoneNode *bone;
do {
bone = bones[idx];
key1 = anims[idx]->_keys[0];
Graphics::Vector3d tmp = key1->_pos;
Math::Vector3d tmp = key1->_pos;
float tmpRot[] = _Q_MAT(-key1->_rotW, key1->_rot.x(), key1->_rot.y(), key1->_rot.z()); // - is LH to RH
_VECT_ROTATE(b1, tmpRot);
b1 += tmp;

View file

@ -68,9 +68,9 @@ bool SkeletonAnim::createFromStream(Common::ReadStream *stream) {
key->_time = stream->readUint32LE();
char *ptr = new char[7 * 4];
stream->read(ptr, 7 * 4);
key->_rot = Graphics::Vector3d(get_float(ptr), get_float(ptr + 4), get_float(ptr + 8));
key->_rot = Math::Vector3d(get_float(ptr), get_float(ptr + 4), get_float(ptr + 8));
key->_rotW = get_float(ptr + 12);
key->_pos = Graphics::Vector3d(get_float(ptr + 16), get_float(ptr + 20), get_float(ptr + 24));
key->_pos = Math::Vector3d(get_float(ptr + 16), get_float(ptr + 20), get_float(ptr + 24));
node->_keys.push_back(key);
}

View file

@ -26,7 +26,7 @@
#ifndef STARK_SKELETON_ANIM_H
#define STARK_SKELETON_ANIM_H
#include "graphics/vector3d.h"
#include "math/vector3d.h"
#include "engines/stark/gfx/coordinate.h"
#include "common/array.h"
@ -39,9 +39,9 @@ namespace Stark {
class AnimKey {
public:
uint32 _time;
Graphics::Vector3d _rot;
Math::Vector3d _rot;
float _rotW;
Graphics::Vector3d _pos;
Math::Vector3d _pos;
};
class AnimNode {

View file

@ -119,9 +119,9 @@ bool Texture::readChunk(Common::ReadStream *stream, uint32 format) {
img[j] = _palette[stream->readByte()];
if (i == 0)
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, w, h, GL_RGBA, GL_UNSIGNED_BYTE, img);
glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, img); // For whatever reason, this doesn't work...
//gluBuild2DMipmaps(GL_TEXTURE_2D, 4, w, h, GL_RGBA, GL_UNSIGNED_BYTE, img);
//glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, img); // For whatever reason, this doesn't work...
delete[] img;

View file

@ -98,7 +98,7 @@ Graphics::Surface *XMGDecoder::decodeImage(Common::ReadStream *stream) {
Graphics::PixelFormat pixFormat(4, 8, 8, 8, 8, 24, 16, 8 ,0);
surface->create(width, height, pixFormat);
_pixels = (uint32 *)surface->pixels;
_pixels = (uint32 *)surface->getPixels();
uint32 currX = 0, currY = 0;
while (!stream->eos()) {
// TODO: Handle odd-sized images