mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-10 11:51:52 +00:00
WATCHMAKER: Apply astyle formatting to code base.
This commit is contained in:
parent
ad47f12c1f
commit
349bf36149
@ -120,7 +120,7 @@ uint8 GetLightPosition(t3dV3F *dest, uint8 pos) {
|
||||
|
||||
auto pLights = t3dCurRoom->getPositionalLight(pos);
|
||||
dest->y = CurFloorY;
|
||||
for (auto light: pLights) {
|
||||
for (auto light : pLights) {
|
||||
if (light.Pos.x && light.Pos.z) {
|
||||
dest->x = light.Pos.x;
|
||||
dest->z = light.Pos.z;
|
||||
@ -140,7 +140,7 @@ uint8 GetLightDirection(t3dV3F *dest, uint8 pos) {
|
||||
|
||||
auto pLights = t3dCurRoom->getPositionalLight(pos);
|
||||
dest->y = CurFloorY;
|
||||
for (auto light: pLights) {
|
||||
for (auto light : pLights) {
|
||||
if (light.Dir.x && light.Dir.z) {
|
||||
dest->x = light.Dir.x;
|
||||
dest->z = light.Dir.x;
|
||||
@ -673,7 +673,7 @@ uint8 GetFullLightDirection(t3dV3F *dest, uint8 pos) {
|
||||
if (!pos) return 0;
|
||||
|
||||
auto pLights = t3dCurRoom->getPositionalLight(pos);
|
||||
for (auto light: pLights) {
|
||||
for (auto light : pLights) {
|
||||
if (light.Dir.x && light.Dir.z) {
|
||||
*dest = light.Dir;
|
||||
return pos;
|
||||
@ -725,7 +725,7 @@ uint8 CompareLightPosition(char *roomname, uint8 pos1, t3dV3F *pos2, t3dF32 acce
|
||||
|
||||
auto pLights = t->getPositionalLight(pos1);
|
||||
bool foundLight = false;
|
||||
for (auto light: pLights) {
|
||||
for (auto light : pLights) {
|
||||
if (light.Pos.x && light.Pos.z) {
|
||||
p1.x = light.Pos.x;
|
||||
p1.y = light.Pos.y;
|
||||
|
@ -27,7 +27,7 @@ namespace Watchmaker {
|
||||
|
||||
DDSHeader::DDSHeader(Common::SeekableReadStream &stream) {
|
||||
//warning("TODO: Implement DDS Header parsing");
|
||||
uint32 retv = MKTAG( ' ','S','D','D' );
|
||||
uint32 retv = MKTAG(' ', 'S', 'D', 'D');
|
||||
uint32 magic = stream.readUint32LE();
|
||||
if (magic != retv) {
|
||||
error("parseDDSHeader: Wrong Magic, expected %08X, got %08X\n", retv, magic);
|
||||
@ -50,7 +50,7 @@ DDSHeader::DDSHeader(Common::SeekableReadStream &stream) {
|
||||
}
|
||||
|
||||
uint32 blockSize(DxtCompression compression) {
|
||||
switch(compression) {
|
||||
switch (compression) {
|
||||
case DxtCompression::DXT1:
|
||||
return 8;
|
||||
default:
|
||||
@ -70,25 +70,33 @@ private:
|
||||
DDSHeader _header;
|
||||
public:
|
||||
DDSTextureData(byte *data, uint32 dataSize, DDSHeader header) : TextureData(header.compression),
|
||||
_data(data),
|
||||
_dataSize(dataSize),
|
||||
_header(header) {}
|
||||
_data(data),
|
||||
_dataSize(dataSize),
|
||||
_header(header) {}
|
||||
~DDSTextureData() override {
|
||||
delete[] _data;
|
||||
}
|
||||
DxtCompression _compression;
|
||||
int getWidth() const override { return _header.width; }
|
||||
int getHeight() const override { return _header.height; }
|
||||
int getDataSize() const override { return _dataSize; }
|
||||
const void *getData() const override { return _data; }
|
||||
int getWidth() const override {
|
||||
return _header.width;
|
||||
}
|
||||
int getHeight() const override {
|
||||
return _header.height;
|
||||
}
|
||||
int getDataSize() const override {
|
||||
return _dataSize;
|
||||
}
|
||||
const void *getData() const override {
|
||||
return _data;
|
||||
}
|
||||
};
|
||||
|
||||
Common::SharedPtr<TextureData> loadDdsTexture(Common::SeekableReadStream& stream) {
|
||||
Common::SharedPtr<TextureData> loadDdsTexture(Common::SeekableReadStream &stream) {
|
||||
DDSHeader header(stream);
|
||||
return loadDdsTexture(stream, header);
|
||||
}
|
||||
|
||||
Common::SharedPtr<TextureData> loadDdsTexture(Common::SeekableReadStream& stream, DDSHeader &header) {
|
||||
Common::SharedPtr<TextureData> loadDdsTexture(Common::SeekableReadStream &stream, DDSHeader &header) {
|
||||
assert(header.width > 0);
|
||||
unsigned char *data = new unsigned char[header.dataSize()]();
|
||||
stream.read(data, header.dataSize());
|
||||
|
@ -29,11 +29,11 @@ namespace Watchmaker {
|
||||
|
||||
enum class DxtCompression : uint32 {
|
||||
UNCOMPRESSED = 0,
|
||||
DXT1 = MKTAG('1','T','X','D'),
|
||||
DXT2 = MKTAG('2','T','X','D'),
|
||||
DXT3 = MKTAG('3','T','X','D'),
|
||||
DXT4 = MKTAG('4','T','X','D'),
|
||||
DXT5 = MKTAG('5','T','X','D')
|
||||
DXT1 = MKTAG('1', 'T', 'X', 'D'),
|
||||
DXT2 = MKTAG('2', 'T', 'X', 'D'),
|
||||
DXT3 = MKTAG('3', 'T', 'X', 'D'),
|
||||
DXT4 = MKTAG('4', 'T', 'X', 'D'),
|
||||
DXT5 = MKTAG('5', 'T', 'X', 'D')
|
||||
};
|
||||
|
||||
class TextureData {
|
||||
@ -65,8 +65,8 @@ struct DDSHeader {
|
||||
};
|
||||
|
||||
//Common::SharedPtr<Texture> loadTgaTextureData(Common::SeekableReadStream &stream);
|
||||
Common::SharedPtr<TextureData> loadDdsTexture(Common::SeekableReadStream& stream, DDSHeader &header);
|
||||
Common::SharedPtr<TextureData> loadDdsTexture(Common::SeekableReadStream& stream);
|
||||
Common::SharedPtr<TextureData> loadDdsTexture(Common::SeekableReadStream &stream, DDSHeader &header);
|
||||
Common::SharedPtr<TextureData> loadDdsTexture(Common::SeekableReadStream &stream);
|
||||
|
||||
} // End of namespace Watchmaker
|
||||
|
||||
|
@ -3402,7 +3402,7 @@ void t3dProcessPortals(void) {
|
||||
* t3dAddTriangle
|
||||
* --------------------------------------------------*/
|
||||
void t3dAddTriangle(t3dF32 x1, t3dF32 y1, t3dF32 x2, t3dF32 y2, t3dF32 x3, t3dF32 y3,
|
||||
int32 r, int32 g, int32 b, int32 a) {
|
||||
int32 r, int32 g, int32 b, int32 a) {
|
||||
rAddTrianglesArray(x1, y1, r, g, b, a);
|
||||
rAddTrianglesArray(x2, y2, r, g, b, a);
|
||||
rAddTrianglesArray(x3, y3, r, g, b, a);
|
||||
@ -3412,7 +3412,7 @@ void t3dAddTriangle(t3dF32 x1, t3dF32 y1, t3dF32 x2, t3dF32 y2, t3dF32 x3, t3dF3
|
||||
* t3dAddQuad
|
||||
* --------------------------------------------------*/
|
||||
void t3dAddQuad(t3dF32 x1, t3dF32 y1, t3dF32 x2, t3dF32 y2, t3dF32 x3, t3dF32 y3, t3dF32 x4, t3dF32 y4,
|
||||
int32 r, int32 g, int32 b, int32 a) {
|
||||
int32 r, int32 g, int32 b, int32 a) {
|
||||
t3dAddTriangle(x1, y1, x2, y2, x3, y3, r, g, b, a);
|
||||
t3dAddTriangle(x2, y2, x4, y4, x3, y3, r, g, b, a);
|
||||
}
|
||||
|
@ -82,9 +82,9 @@ void t3dSortMeshes();
|
||||
void QueueMaterialList(MaterialTable &MatList, unsigned int NumMat, signed short int ViewMatrixNum);
|
||||
void ProcessMaterialList();
|
||||
void t3dAddTriangle(t3dF32 x1, t3dF32 y1, t3dF32 x2, t3dF32 y2, t3dF32 x3, t3dF32 y3,
|
||||
int32 r, int32 g, int32 b, int32 a);
|
||||
int32 r, int32 g, int32 b, int32 a);
|
||||
void t3dAddQuad(t3dF32 x1, t3dF32 y1, t3dF32 x2, t3dF32 y2, t3dF32 x3, t3dF32 y3, t3dF32 x4, t3dF32 y4,
|
||||
int32 r, int32 g, int32 b, int32 a);
|
||||
int32 r, int32 g, int32 b, int32 a);
|
||||
} // End of namespace Watchmaker
|
||||
|
||||
#endif // WATCHMAKER_GEOMETRY_H
|
||||
|
@ -329,7 +329,7 @@ void GetBoundaries(t3dBODY *b, t3dF32 *minx, t3dF32 *miny, t3dF32 *minz, t3dF32
|
||||
|
||||
t3dLIGHT::t3dLIGHT(WGame &game, t3dBODY *b, WorkDirs &workDirs, Common::SeekableReadStream &stream) {
|
||||
Type = stream.readUint32LE(); // Legge tipo
|
||||
// DebugFile("%d: SPOT %X ATTEN %X SHAD %X",light,Light[light].Type&T3D_LIGHT_SPOTLIGHT,Light[light].Type&T3D_LIGHT_ATTENUATION,Light[light].Type&T3D_LIGHT_CASTSHADOWS);
|
||||
// DebugFile("%d: SPOT %X ATTEN %X SHAD %X",light,Light[light].Type&T3D_LIGHT_SPOTLIGHT,Light[light].Type&T3D_LIGHT_ATTENUATION,Light[light].Type&T3D_LIGHT_CASTSHADOWS);
|
||||
Source = t3dV3F(stream) * SCALEFACTOR; // Legge Source
|
||||
Target = t3dV3F(stream) * SCALEFACTOR; // Legge Target
|
||||
|
||||
@ -368,7 +368,7 @@ t3dLIGHT::t3dLIGHT(WGame &game, t3dBODY *b, WorkDirs &workDirs, Common::Seekable
|
||||
}
|
||||
#else
|
||||
strcpy(Appo, WmMapsDir);
|
||||
strcat(Appo, Name);
|
||||
strcat(Appo, Name);
|
||||
#endif
|
||||
|
||||
#ifndef WMGEN
|
||||
|
@ -219,7 +219,7 @@ t3dBODY *t3dLoadSingleRoom(WGame &game, const Common::String &_pname, t3dBODY *b
|
||||
b = (t3dBODY *)t3dRealloc((uint32 *)b, sizeof(t3dBODY) * (++(*NumBody))); // Altrimenti, ridimensiona
|
||||
|
||||
//warning("Loading %s ...", name.c_str());
|
||||
*b = t3dBODY(); // Azzera Body
|
||||
*b = t3dBODY(); // Azzera Body
|
||||
|
||||
uint16 fileVersion = stream->readByte();
|
||||
if (fileVersion != T3DFILEVERSION) { // Controlla la versione del file
|
||||
@ -322,8 +322,8 @@ t3dParticle::t3dParticle(Common::SeekableReadStream &stream) {
|
||||
|
||||
#ifndef WMGEN
|
||||
ParticleIndex = t3dCreateSmokeParticle(Num,
|
||||
Type,
|
||||
OR1);
|
||||
Type,
|
||||
OR1);
|
||||
#endif
|
||||
difR1 = (R2 - R1) / (Seg1 / Speed1);
|
||||
difG1 = (G2 - G1) / (Seg1 / Speed1);
|
||||
|
@ -30,35 +30,32 @@ MaterialPtr rAddMaterial(gMaterial &Material, const Common::String &TextName, in
|
||||
// TODO: This is duplicated in opengl_3d.cpp
|
||||
warning("TODO: Fix rAddMaterial");
|
||||
#if 0
|
||||
bool AlreadyLoaded=FALSE;
|
||||
int len=strlen(TextName);
|
||||
bool AlreadyLoaded = FALSE;
|
||||
int len = strlen(TextName);
|
||||
|
||||
if (((TextName[len-1-0]=='i')|| (TextName[len-1-0]=='I')) &&
|
||||
((TextName[len-1-1]=='v')|| (TextName[len-1-1]=='V')) &&
|
||||
((TextName[len-1-2]=='a')|| (TextName[len-1-2]=='A')) )
|
||||
{
|
||||
if( (Material.Movie=gLoadMovie(TextName)) == NULL )
|
||||
if (((TextName[len - 1 - 0] == 'i') || (TextName[len - 1 - 0] == 'I')) &&
|
||||
((TextName[len - 1 - 1] == 'v') || (TextName[len - 1 - 1] == 'V')) &&
|
||||
((TextName[len - 1 - 2] == 'a') || (TextName[len - 1 - 2] == 'A'))) {
|
||||
if ((Material.Movie = gLoadMovie(TextName)) == NULL)
|
||||
return NULL;
|
||||
if( (Material.Texture=gUserTexture( 64,
|
||||
128)) == NULL )
|
||||
// if( (Material->Texture=gUserTexture( Material->Movie->g_psiStreamInfo.rcFrame.right,
|
||||
if ((Material.Texture = gUserTexture(64,
|
||||
128)) == NULL)
|
||||
// if( (Material->Texture=gUserTexture( Material->Movie->g_psiStreamInfo.rcFrame.right,
|
||||
// Material->Movie->g_psiStreamInfo.rcFrame.bottom)) == NULL )
|
||||
return NULL;
|
||||
Material.Flags|=T3D_MATERIAL_MOVIE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( (Material.Texture=gLoadTexture(TextName,LoaderFlags)) == NULL )
|
||||
Material.Flags |= T3D_MATERIAL_MOVIE;
|
||||
} else {
|
||||
if ((Material.Texture = gLoadTexture(TextName, LoaderFlags)) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//f
|
||||
//f Material->FacesList=(WORD *)t3dRealloc(Material->FacesList,sizeof(WORD)*3*NumFaces+1);
|
||||
//f Material->NumAllocatedFaces+=3*NumFaces+1;
|
||||
Material.FacesList.resize(Material.FacesList.size() + NumFaces * 3 );
|
||||
Material.NumAllocatedFaces+=NumFaces*3;
|
||||
//f Material->FacesList=(WORD *)t3dRealloc(Material->FacesList,sizeof(WORD)*3*NumFaces+1);
|
||||
//f Material->NumAllocatedFaces+=3*NumFaces+1;
|
||||
Material.FacesList.resize(Material.FacesList.size() + NumFaces * 3);
|
||||
Material.NumAllocatedFaces += NumFaces * 3;
|
||||
//f
|
||||
Material.Flags|=T3D_MATERIAL_NOLIGHTMAP;
|
||||
Material.Flags |= T3D_MATERIAL_NOLIGHTMAP;
|
||||
return Material;
|
||||
#endif
|
||||
return nullptr;
|
||||
@ -97,19 +94,18 @@ void gMaterial::addColor(unsigned char r_add, unsigned char g_add, unsigned char
|
||||
}
|
||||
|
||||
bool gMaterial::addNumFacesAdditionalMaterial(MaterialPtr am, unsigned int num) {
|
||||
if( !num || !am )
|
||||
if (!num || !am)
|
||||
return false;
|
||||
|
||||
Common::SharedPtr<gMaterial> cm;
|
||||
int i;
|
||||
for ( i=0; i<this->NumAddictionalMaterial; i++ ) {
|
||||
for (i = 0; i < this->NumAddictionalMaterial; i++) {
|
||||
cm = this->AddictionalMaterial[i];
|
||||
if (cm->Texture->ID == am->Texture->ID)
|
||||
break;
|
||||
}
|
||||
|
||||
if( i == this->NumAddictionalMaterial )
|
||||
{
|
||||
if (i == this->NumAddictionalMaterial) {
|
||||
this->AddictionalMaterial.push_back(Common::SharedPtr<gMaterial>(new gMaterial(*am)));
|
||||
cm = this->AddictionalMaterial.back();
|
||||
cm->FacesList.resize(0);
|
||||
@ -125,12 +121,12 @@ bool gMaterial::addNumFaces(unsigned int num) {
|
||||
|
||||
|
||||
MaterialPtr rMergeMaterial(MaterialPtr Mat1, MaterialPtr Mat2) {
|
||||
if ( !Mat1 || !Mat2 )
|
||||
if (!Mat1 || !Mat2)
|
||||
return nullptr;
|
||||
|
||||
for ( int i=0; i<Mat2->NumAddictionalMaterial; i++ ) {
|
||||
for (int i = 0; i < Mat2->NumAddictionalMaterial; i++) {
|
||||
Mat1->addNumFacesAdditionalMaterial(Mat2->AddictionalMaterial[i],
|
||||
/*Mat2->AddictionalMaterial[i]->NumAllocatedFaces*/ Mat2->AddictionalMaterial[i]->NumFaces());
|
||||
/*Mat2->AddictionalMaterial[i]->NumAllocatedFaces*/ Mat2->AddictionalMaterial[i]->NumFaces());
|
||||
}
|
||||
//reset mat2
|
||||
rRemoveMaterial(Mat2);
|
||||
@ -198,24 +194,22 @@ void gMaterial::clear() {
|
||||
// TODO: This flag clearing doesn't happen in the original, but shouldn't matter as the class is instantiated again when used in Particles.
|
||||
Flags = 0;
|
||||
|
||||
if (Movie)
|
||||
{
|
||||
if (Movie) {
|
||||
Movie = nullptr;
|
||||
}
|
||||
FacesList.clear();
|
||||
VertsList.clear();
|
||||
FlagsList.clear();
|
||||
// rDeleteVertexBuffer(m->VB);
|
||||
VBO=0;
|
||||
// rDeleteVertexBuffer(m->VB);
|
||||
VBO = 0;
|
||||
|
||||
for ( int j=0; j<NumAddictionalMaterial; j++)
|
||||
{
|
||||
for (int j = 0; j < NumAddictionalMaterial; j++) {
|
||||
Common::SharedPtr<gMaterial> cm = AddictionalMaterial[j];
|
||||
cm->FacesList.clear();
|
||||
cm->VertsList.clear();
|
||||
cm->FlagsList.clear();
|
||||
// rDeleteVertexBuffer(cm->VB);
|
||||
cm->VBO=0;
|
||||
// rDeleteVertexBuffer(cm->VB);
|
||||
cm->VBO = 0;
|
||||
}
|
||||
AddictionalMaterial.clear();
|
||||
}
|
||||
@ -252,7 +246,7 @@ void rAddToMaterialList(gMaterial &mat, signed short int ViewMatrixNum) {
|
||||
for (int o = 0; o < bb->FacesList.size(); o++) {
|
||||
warning("%d", bb->FacesList[o]);
|
||||
}
|
||||
warning("%d > %d (%d)", bb->FacesList[f],bb->VBO->_buffer.size(), bb->NumVerts());
|
||||
warning("%d > %d (%d)", bb->FacesList[f], bb->VBO->_buffer.size(), bb->NumVerts());
|
||||
}
|
||||
}
|
||||
mat.emptyFacesList(); // We may want to keep the reservation to avoid the extra reallocs here.
|
||||
@ -302,7 +296,7 @@ void rBuildMaterialList(MaterialTable &MatList, unsigned int NumMat, signed shor
|
||||
if (NumMat == 0)
|
||||
return;
|
||||
|
||||
for (auto &mat: MatList) {
|
||||
for (auto &mat : MatList) {
|
||||
rAddToMaterialList(mat, ViewMatrixNum);
|
||||
}
|
||||
}
|
||||
|
@ -40,26 +40,38 @@ struct gMaterial {
|
||||
gTexture *Texture = nullptr; // pointer to texture struct
|
||||
Common::SharedPtr<gMovie> Movie; // pointer to movie struct
|
||||
unsigned int Flags = 0; // material flags
|
||||
int NumFaces() { return FacesList.size(); }; // current number of faces to be processed
|
||||
int NumFaces() {
|
||||
return FacesList.size();
|
||||
}; // current number of faces to be processed
|
||||
void addFace(uint16 face) {
|
||||
FacesList.push_back(face);
|
||||
}
|
||||
uint16 getFace(int index) const { return FacesList[index]; }
|
||||
void clearFaceList() { FacesList.clear(); }
|
||||
void emptyFacesList() { FacesList.resize(0); }
|
||||
Common::Array<uint16> getFacesList() { return FacesList; }
|
||||
uint16 getFace(int index) const {
|
||||
return FacesList[index];
|
||||
}
|
||||
void clearFaceList() {
|
||||
FacesList.clear();
|
||||
}
|
||||
void emptyFacesList() {
|
||||
FacesList.resize(0);
|
||||
}
|
||||
Common::Array<uint16> getFacesList() {
|
||||
return FacesList;
|
||||
}
|
||||
private:
|
||||
Common::Array<uint16> FacesList; // list of verts indices
|
||||
public:
|
||||
Common::Array<gVertex*> VertsList; // pointers to pointers to verts
|
||||
int NumAllocatedVerts() { return this->VertsList.size(); }; // number of allocated vertex in mat VB
|
||||
Common::Array<gVertex *> VertsList; // pointers to pointers to verts
|
||||
int NumAllocatedVerts() {
|
||||
return this->VertsList.size();
|
||||
}; // number of allocated vertex in mat VB
|
||||
Common::SharedPtr<VertexBuffer> VBO = nullptr;
|
||||
// LPDIRECT3DVERTEXBUFFER7 VB; // mat VB struct
|
||||
int NumAllocatedMesh = 0; // num mesh to check for modifications
|
||||
Common::Array<unsigned int *> FlagsList; // vector of pointer to mesh flags
|
||||
unsigned char r, g, b; // default material color
|
||||
int NumAddictionalMaterial = 0; // number of addictional material (lightmaps)
|
||||
MaterialTable AddictionalMaterial; // pointer to addictional material struct
|
||||
MaterialTable AddictionalMaterial; // pointer to addictional material struct
|
||||
public:
|
||||
gMaterial() : r(0), g(0), b(0) {
|
||||
|
||||
|
@ -365,7 +365,7 @@ uint8 t3dVectPlaneIntersection(t3dV3F *inter, t3dV3F start, t3dV3F end, t3dNORMA
|
||||
}
|
||||
|
||||
uint8 t3dVectTriangleIntersection(t3dV3F *inter, t3dV3F start, t3dV3F end,
|
||||
t3dV3F v1, t3dV3F v2, t3dV3F v3, t3dNORMAL n) {
|
||||
t3dV3F v1, t3dV3F v2, t3dV3F v3, t3dNORMAL n) {
|
||||
t3dV3F appo;
|
||||
t3dNORMAL normal;
|
||||
|
||||
|
@ -38,13 +38,13 @@ gMovie::gMovie(Common::SharedPtr<Common::SeekableReadStream> stream, Texture *te
|
||||
_numBlocks = _width * _height / 16;
|
||||
_curFrame = 0xFFFF;
|
||||
|
||||
_frameOffsets = new uint32[_numFrames]{};
|
||||
_frameOffsets = new uint32[_numFrames] {};
|
||||
if (!_frameOffsets) {
|
||||
error("gLoadMovie FAILED: Can't alloc Movie->frameOffsets struct");
|
||||
}
|
||||
|
||||
_buffer = new uint8[bufferSize()]{};
|
||||
_surfaceBuffer = new uint8[_header.dataSize()]{};
|
||||
_buffer = new uint8[bufferSize()] {};
|
||||
_surfaceBuffer = new uint8[_header.dataSize()] {};
|
||||
_frameStream = new Common::MemoryReadStream(_surfaceBuffer, _header.dataSize(), DisposeAfterUse::NO);
|
||||
if (!_buffer) {
|
||||
error("gLoadMovie FAILED: Can't alloc Movie->buffer struct");
|
||||
@ -72,19 +72,18 @@ Common::SharedPtr<gMovie> gLoadMovie(WorkDirs &workDirs, const char *TextName, T
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Movie->frameRate=240;
|
||||
// Movie->frameRate=240;
|
||||
return Movie;
|
||||
}
|
||||
|
||||
void gMovie::loadThisFrameData(uint32 frame)
|
||||
{
|
||||
void gMovie::loadThisFrameData(uint32 frame) {
|
||||
_stream->seek(_frameOffsets[frame], SEEK_SET);
|
||||
//read frame data
|
||||
int size = 0;
|
||||
if ((frame+1)==_numFrames) {
|
||||
if ((frame + 1) == _numFrames) {
|
||||
size = _stream->size() - _frameOffsets[frame];
|
||||
} else {
|
||||
size = _frameOffsets[frame+1] - _frameOffsets[frame];
|
||||
size = _frameOffsets[frame + 1] - _frameOffsets[frame];
|
||||
}
|
||||
assert(size <= bufferSize());
|
||||
_stream->read(_buffer, size);
|
||||
@ -94,20 +93,21 @@ void gMovie::loadThisFrameData(uint32 frame)
|
||||
void gMovie::buildNewFrame(byte *surf, uint32 frame) {
|
||||
loadThisFrameData(frame);
|
||||
|
||||
DWORD bitArraySize=_numBlocks>>3;
|
||||
byte *buf=&_buffer[bitArraySize];
|
||||
WORD curBlock=0;
|
||||
DWORD bitArraySize = _numBlocks >> 3;
|
||||
byte *buf = &_buffer[bitArraySize];
|
||||
WORD curBlock = 0;
|
||||
|
||||
for(int i=0; i<bitArraySize; i++) {
|
||||
for (int i = 0; i < bitArraySize; i++) {
|
||||
byte block = _buffer[i];
|
||||
if(!block) {
|
||||
if (!block) {
|
||||
curBlock += 8;
|
||||
continue; //everything is equal
|
||||
continue; //everything is equal
|
||||
}
|
||||
|
||||
for(int j=0; j<8; j++, curBlock++) {
|
||||
if(block & (1<<j) ) {
|
||||
memcpy(&surf[curBlock<<3],buf,8); buf+=8;
|
||||
for (int j = 0; j < 8; j++, curBlock++) {
|
||||
if (block & (1 << j)) {
|
||||
memcpy(&surf[curBlock << 3], buf, 8);
|
||||
buf += 8;
|
||||
}
|
||||
}//for j
|
||||
}//for
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
|
||||
bool _paused = false;
|
||||
|
||||
gMovie(Common::SharedPtr<Common::SeekableReadStream> stream, Texture *texture, const Common::String& name);
|
||||
gMovie(Common::SharedPtr<Common::SeekableReadStream> stream, Texture *texture, const Common::String &name);
|
||||
|
||||
bool setFrame(uint32 newFrame);
|
||||
void loadThisFrameData(uint32 frame);
|
||||
|
@ -119,37 +119,31 @@ void rResetExtends(void) {
|
||||
// TODO: Move this to Renderer
|
||||
extern Rect gBlitterViewport;
|
||||
bool gClipToBlitterViewport(int *sposx, int *sposy, int *sdimx, int *sdimy,
|
||||
int *dposx, int *dposy )
|
||||
{
|
||||
int *dposx, int *dposy) {
|
||||
int dwWidth, dwHeight;
|
||||
|
||||
dwWidth=(gBlitterViewport.right-gBlitterViewport.left);
|
||||
dwHeight=(gBlitterViewport.bottom-gBlitterViewport.top);
|
||||
dwWidth = (gBlitterViewport.right - gBlitterViewport.left);
|
||||
dwHeight = (gBlitterViewport.bottom - gBlitterViewport.top);
|
||||
|
||||
if ( ((*dposx)+(*sdimx))>dwWidth)
|
||||
{
|
||||
(*sdimx)=(*sdimx)-((*dposx)+(*sdimx)-dwWidth);
|
||||
if (((*dposx) + (*sdimx)) > dwWidth) {
|
||||
(*sdimx) = (*sdimx) - ((*dposx) + (*sdimx) - dwWidth);
|
||||
}
|
||||
if ( ((*dposy)+(*sdimy))>dwHeight)
|
||||
{
|
||||
(*sdimy)=(*sdimy)-((*dposy)+(*sdimy)-dwHeight);
|
||||
if (((*dposy) + (*sdimy)) > dwHeight) {
|
||||
(*sdimy) = (*sdimy) - ((*dposy) + (*sdimy) - dwHeight);
|
||||
}
|
||||
|
||||
if ( (*dposx)<gBlitterViewport.left)
|
||||
{
|
||||
(*sposx)+=gBlitterViewport.left-(*dposx);
|
||||
(*sdimx)-=gBlitterViewport.left-(*dposx);
|
||||
(*dposx)=gBlitterViewport.left;
|
||||
if ((*dposx) < gBlitterViewport.left) {
|
||||
(*sposx) += gBlitterViewport.left - (*dposx);
|
||||
(*sdimx) -= gBlitterViewport.left - (*dposx);
|
||||
(*dposx) = gBlitterViewport.left;
|
||||
}
|
||||
if ( (*dposy)<gBlitterViewport.top)
|
||||
{
|
||||
(*sposy)+=gBlitterViewport.top-(*dposy);
|
||||
(*sdimy)-=gBlitterViewport.top-(*dposy);
|
||||
(*dposy)=gBlitterViewport.top;
|
||||
if ((*dposy) < gBlitterViewport.top) {
|
||||
(*sposy) += gBlitterViewport.top - (*dposy);
|
||||
(*sdimy) -= gBlitterViewport.top - (*dposy);
|
||||
(*dposy) = gBlitterViewport.top;
|
||||
}
|
||||
|
||||
if(((*sdimx)<=0) || ((*sdimy)<=0))
|
||||
{
|
||||
if (((*sdimx) <= 0) || ((*sdimy) <= 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -176,7 +170,7 @@ void exit2Dmode() {
|
||||
|
||||
void renderTexture(WGame &game, gTexture &bitmap, Rect srcRect, Rect dstRect) {
|
||||
checkGlError("Entering renderTexture");
|
||||
glClearColor(0,0,1,0);
|
||||
glClearColor(0, 0, 1, 0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
@ -189,9 +183,9 @@ void renderTexture(WGame &game, gTexture &bitmap, Rect srcRect, Rect dstRect) {
|
||||
glTranslatef(0, 0, 0.0);
|
||||
|
||||
float bottomSrc = ((float)srcRect.bottom) / bitmap.RealDimY;
|
||||
float topSrc = ((float)srcRect.top) / bitmap.RealDimY;
|
||||
float leftSrc = ((float)srcRect.left) / bitmap.RealDimX;
|
||||
float rightSrc = ((float)srcRect.right) / bitmap.RealDimX;
|
||||
float topSrc = ((float)srcRect.top) / bitmap.RealDimY;
|
||||
float leftSrc = ((float)srcRect.left) / bitmap.RealDimX;
|
||||
float rightSrc = ((float)srcRect.right) / bitmap.RealDimX;
|
||||
|
||||
Rect viewport = game._renderer->_viewport;
|
||||
float bottomDst = 1.0 - ((dstRect.bottom == 0 ? 0 : ((double)dstRect.bottom) / viewport.height()) * 2.0);
|
||||
@ -268,7 +262,7 @@ void rBlitter(WGame &game, int dst, int src, int dposx, int dposy,
|
||||
}
|
||||
|
||||
if ((dposx >= dwWidth) || (dposy >= dwHeight) || (sposx >= dwWidth) || (sposy >= dwHeight) ||
|
||||
((dposx + sdimx) <= 0) || ((dposy + sdimy) <= 0) || ((sposx + sdimx) <= 0) || ((sposy + sdimy) <= 0)) {
|
||||
((dposx + sdimx) <= 0) || ((dposy + sdimy) <= 0) || ((sposx + sdimx) <= 0) || ((sposy + sdimy) <= 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -289,22 +283,21 @@ void rBlitter(WGame &game, int dst, int src, int dposx, int dposy,
|
||||
{
|
||||
Rect srcRect;
|
||||
// Source rect
|
||||
srcRect.top=sposy;
|
||||
srcRect.left=sposx;
|
||||
srcRect.right= sposx + sdimx;
|
||||
srcRect.bottom= sposy + sdimy;
|
||||
srcRect.top = sposy;
|
||||
srcRect.left = sposx;
|
||||
srcRect.right = sposx + sdimx;
|
||||
srcRect.bottom = sposy + sdimy;
|
||||
|
||||
Rect dstRect;
|
||||
// Destination rect
|
||||
// Convention in dpos is that 0,0 is upper left hand corner, increasing down the y-axis.
|
||||
dstRect.top=dposy;
|
||||
dstRect.left=dposx;
|
||||
dstRect.right= dposx + sdimx;
|
||||
dstRect.bottom= dposy + sdimy;
|
||||
if(((dstRect.bottom - dstRect.top) <= 0) || ((dstRect.right - dstRect.left ) <= 0) || ((srcRect.bottom - srcRect.top) <= 0) || ((srcRect.right - srcRect.left ) <= 0) ||
|
||||
(dstRect.right <= 0) || (srcRect.right <= 0) || (dstRect.bottom < 0) || (srcRect.bottom < 0) )
|
||||
{
|
||||
// DebugLogWindow("gBlitter: blit not needed: dimx:%d dimy:%d", ( sr.top-sr.bottom ),( sr.left-sr.right ));
|
||||
dstRect.top = dposy;
|
||||
dstRect.left = dposx;
|
||||
dstRect.right = dposx + sdimx;
|
||||
dstRect.bottom = dposy + sdimy;
|
||||
if (((dstRect.bottom - dstRect.top) <= 0) || ((dstRect.right - dstRect.left) <= 0) || ((srcRect.bottom - srcRect.top) <= 0) || ((srcRect.right - srcRect.left) <= 0) ||
|
||||
(dstRect.right <= 0) || (srcRect.right <= 0) || (dstRect.bottom < 0) || (srcRect.bottom < 0)) {
|
||||
// DebugLogWindow("gBlitter: blit not needed: dimx:%d dimy:%d", ( sr.top-sr.bottom ),( sr.left-sr.right ));
|
||||
return;
|
||||
}
|
||||
dstBitmap.blitInto(&bitmap, srcRect, dstRect);
|
||||
|
@ -192,9 +192,9 @@ bool rSetViewMatrix(float _00, float _01, float _02,
|
||||
|
||||
void rSetViewMatrix(const t3dM3X3F &viewMatrix, const t3dV3F &translation) {
|
||||
rSetViewMatrix(viewMatrix.M[0], viewMatrix.M[1], viewMatrix.M[2],
|
||||
viewMatrix.M[3], viewMatrix.M[4], viewMatrix.M[5],
|
||||
viewMatrix.M[6], viewMatrix.M[7], viewMatrix.M[8],
|
||||
translation.x, translation.y, -translation.z);
|
||||
viewMatrix.M[3], viewMatrix.M[4], viewMatrix.M[5],
|
||||
viewMatrix.M[6], viewMatrix.M[7], viewMatrix.M[8],
|
||||
translation.x, translation.y, -translation.z);
|
||||
}
|
||||
|
||||
void rSaveViewMatrix() {
|
||||
@ -238,9 +238,9 @@ bool rBuildLinesViewMatrix(float _00, float _01, float _02,
|
||||
|
||||
int rBuildLinesViewMatrix(const t3dM3X3F &viewMatrix, const t3dV3F &translation) {
|
||||
return rBuildLinesViewMatrix(viewMatrix.M[0], viewMatrix.M[1], viewMatrix.M[2],
|
||||
viewMatrix.M[3], viewMatrix.M[4], viewMatrix.M[5],
|
||||
viewMatrix.M[6], viewMatrix.M[7], viewMatrix.M[8],
|
||||
translation.x, translation.y, translation.z);
|
||||
viewMatrix.M[3], viewMatrix.M[4], viewMatrix.M[5],
|
||||
viewMatrix.M[6], viewMatrix.M[7], viewMatrix.M[8],
|
||||
translation.x, translation.y, translation.z);
|
||||
}
|
||||
|
||||
//***********************************************************************************************
|
||||
@ -298,9 +298,9 @@ int rAddUserViewMatrix(float _00, float _01, float _02,
|
||||
|
||||
int rAddUserViewMatrix(const t3dM3X3F &viewMatrix, const t3dV3F &translation) {
|
||||
return rAddUserViewMatrix(viewMatrix.M[0], viewMatrix.M[1], viewMatrix.M[2],
|
||||
viewMatrix.M[3], viewMatrix.M[4], viewMatrix.M[5],
|
||||
viewMatrix.M[6], viewMatrix.M[7], viewMatrix.M[8],
|
||||
translation.x, translation.y, translation.z);
|
||||
viewMatrix.M[3], viewMatrix.M[4], viewMatrix.M[5],
|
||||
viewMatrix.M[6], viewMatrix.M[7], viewMatrix.M[8],
|
||||
translation.x, translation.y, translation.z);
|
||||
}
|
||||
|
||||
void rResetPipeline() {
|
||||
@ -590,14 +590,14 @@ public:
|
||||
|
||||
if (compressed) {
|
||||
glCompressedTexImage2D(GL_TEXTURE_2D, // target
|
||||
0, // level
|
||||
texFormat, // internalFormat
|
||||
data.getWidth(), // width
|
||||
data.getHeight(), // height
|
||||
0, // border
|
||||
data.getDataSize(),
|
||||
data.getData()
|
||||
);
|
||||
0, // level
|
||||
texFormat, // internalFormat
|
||||
data.getWidth(), // width
|
||||
data.getHeight(), // height
|
||||
0, // border
|
||||
data.getDataSize(),
|
||||
data.getData()
|
||||
);
|
||||
checkGlError("glCompressedTexImage");
|
||||
} else {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, texFormat, data.getWidth(), data.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, data.getData());
|
||||
@ -621,10 +621,18 @@ public:
|
||||
delete _surface;
|
||||
}
|
||||
}
|
||||
int getWidth() const override { return _surface->w; }
|
||||
int getHeight() const override { return _surface->h; }
|
||||
int getDataSize() const override { return _surface->w * _surface->h * _surface->format.bytesPerPixel; }
|
||||
const void *getData() const override { return _surface->getPixels(); }
|
||||
int getWidth() const override {
|
||||
return _surface->w;
|
||||
}
|
||||
int getHeight() const override {
|
||||
return _surface->h;
|
||||
}
|
||||
int getDataSize() const override {
|
||||
return _surface->w * _surface->h * _surface->format.bytesPerPixel;
|
||||
}
|
||||
const void *getData() const override {
|
||||
return _surface->getPixels();
|
||||
}
|
||||
};
|
||||
|
||||
Texture *createGLTexture() {
|
||||
|
@ -98,10 +98,10 @@ void OpenGLRenderer::drawIndexedPrimitivesVBO(PrimitiveType primitiveType, int V
|
||||
|
||||
void OpenGLRenderer::drawIndexedPrimitivesVBO(PrimitiveType primitiveType, gBatchBlock &bb) {
|
||||
drawIndexedPrimitivesVBO(primitiveType,
|
||||
bb.VBO, 0, bb.NumVerts(),
|
||||
bb.FacesList,
|
||||
bb.NumFaces()/*, 0x0*/
|
||||
);
|
||||
bb.VBO, 0, bb.NumVerts(),
|
||||
bb.FacesList,
|
||||
bb.NumFaces()/*, 0x0*/
|
||||
);
|
||||
}
|
||||
|
||||
void OpenGLRenderer::setTransformMatrix(TransformMatrix which, const Matrix4x4 &matrix) {
|
||||
@ -132,14 +132,14 @@ void OpenGLRenderer::popModelView() {
|
||||
void OpenGLRenderer::setTextureWrapMode(int index, TextureWrapMode mode) {
|
||||
GLint openGlWrapMode = 0;
|
||||
switch (mode) {
|
||||
case TextureWrapMode::WRAP:
|
||||
openGlWrapMode = GL_REPEAT;
|
||||
break;
|
||||
case TextureWrapMode::CLAMP:
|
||||
openGlWrapMode = GL_CLAMP;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
case TextureWrapMode::WRAP:
|
||||
openGlWrapMode = GL_REPEAT;
|
||||
break;
|
||||
case TextureWrapMode::CLAMP:
|
||||
openGlWrapMode = GL_CLAMP;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, openGlWrapMode);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, openGlWrapMode);
|
||||
@ -166,15 +166,17 @@ void setGlFeature(GLint feature, bool state) {
|
||||
|
||||
void OpenGLRenderer::setRenderState(RenderState state, int value) {
|
||||
switch (state) {
|
||||
case RenderState::ZENABLE: {
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
setGlFeature(GL_DEPTH_TEST, value);
|
||||
break;
|
||||
}
|
||||
case RenderState::ALPHAREF: { // ALPHA-func is never changed.
|
||||
glAlphaFunc(GL_ALWAYS, value);
|
||||
}
|
||||
case RenderState::ALPHABLEND: setGlFeature(GL_BLEND, value); break; // TODO
|
||||
case RenderState::ZENABLE: {
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
setGlFeature(GL_DEPTH_TEST, value);
|
||||
break;
|
||||
}
|
||||
case RenderState::ALPHAREF: { // ALPHA-func is never changed.
|
||||
glAlphaFunc(GL_ALWAYS, value);
|
||||
}
|
||||
case RenderState::ALPHABLEND:
|
||||
setGlFeature(GL_BLEND, value);
|
||||
break; // TODO
|
||||
|
||||
}
|
||||
//warning("TODO: Implement setRenderState");
|
||||
@ -182,16 +184,24 @@ void OpenGLRenderer::setRenderState(RenderState state, int value) {
|
||||
|
||||
GLenum translateBlendFactorToGL(BlendFactor factor) {
|
||||
switch (factor) {
|
||||
case BlendFactor::ONE: return GL_ONE;
|
||||
case BlendFactor::ZERO: return GL_ZERO;
|
||||
case BlendFactor::SRCALPHA: return GL_SRC_ALPHA;
|
||||
case BlendFactor::INVSRCALPHA: return GL_ONE_MINUS_SRC_ALPHA;
|
||||
case BlendFactor::INVSRCCOLOR: return GL_ONE_MINUS_SRC_COLOR;
|
||||
case BlendFactor::SRCCOLOR: return GL_SRC_COLOR;
|
||||
case BlendFactor::DESTCOLOR: return GL_DST_COLOR;
|
||||
case BlendFactor::INVDESTCOLOR: return GL_ONE_MINUS_DST_COLOR;
|
||||
default:
|
||||
assert(false);
|
||||
case BlendFactor::ONE:
|
||||
return GL_ONE;
|
||||
case BlendFactor::ZERO:
|
||||
return GL_ZERO;
|
||||
case BlendFactor::SRCALPHA:
|
||||
return GL_SRC_ALPHA;
|
||||
case BlendFactor::INVSRCALPHA:
|
||||
return GL_ONE_MINUS_SRC_ALPHA;
|
||||
case BlendFactor::INVSRCCOLOR:
|
||||
return GL_ONE_MINUS_SRC_COLOR;
|
||||
case BlendFactor::SRCCOLOR:
|
||||
return GL_SRC_COLOR;
|
||||
case BlendFactor::DESTCOLOR:
|
||||
return GL_DST_COLOR;
|
||||
case BlendFactor::INVDESTCOLOR:
|
||||
return GL_ONE_MINUS_DST_COLOR;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,8 +61,8 @@ void t3dLoadMaterials(WGame &game, t3dBODY *b, Common::SeekableReadStream &strea
|
||||
#ifndef WMGEN
|
||||
len = strlen(Name);
|
||||
if (((Name[len - 1] == 'i') || (Name[len - 1] == 'I')) &&
|
||||
((Name[len - 2] == 'v') || (Name[len - 2] == 'V')) &&
|
||||
((Name[len - 3] == 'a') || (Name[len - 3] == 'A'))) {
|
||||
((Name[len - 2] == 'v') || (Name[len - 2] == 'V')) &&
|
||||
((Name[len - 3] == 'a') || (Name[len - 3] == 'A'))) {
|
||||
strcpy(Appo, workdirs._moviesDir.c_str()); // altrimenti prende quello di default
|
||||
} else {
|
||||
strcpy(Appo, workdirs._mapsDir.c_str()); // altrimenti prende quello di default
|
||||
@ -368,10 +368,10 @@ void LoadLightmaps(WorkDirs &workDirs, t3dBODY *b) {
|
||||
if (f.n == b->NList[i]) {
|
||||
// f->mat->Texture=f->mat->Lightmap;
|
||||
if ((!(f.hasMaterialFlag(T3D_MATERIAL_OPACITY))) &&
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_CLIPMAP))) &&
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_BOTTLE))) &&
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_ADDITIVE))) &&
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_GLASS)))) {
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_CLIPMAP))) &&
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_BOTTLE))) &&
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_ADDITIVE))) &&
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_GLASS)))) {
|
||||
alphaval1 = RGBA_GETALPHA(gv[f.VertexIndex[0]].diffuse);
|
||||
alphaval2 = RGBA_GETALPHA(gv[f.VertexIndex[1]].diffuse);
|
||||
alphaval3 = RGBA_GETALPHA(gv[f.VertexIndex[2]].diffuse);
|
||||
@ -381,10 +381,10 @@ void LoadLightmaps(WorkDirs &workDirs, t3dBODY *b) {
|
||||
f.lightmap = b->LightmapTable[Map];
|
||||
f.getMaterial()->addNumFacesAdditionalMaterial(f.lightmap, 1);
|
||||
} else if (((f.hasMaterialFlag(T3D_MATERIAL_OPACITY))) ||
|
||||
((f.hasMaterialFlag(T3D_MATERIAL_CLIPMAP))) ||
|
||||
((f.hasMaterialFlag(T3D_MATERIAL_BOTTLE))) ||
|
||||
((f.hasMaterialFlag(T3D_MATERIAL_ADDITIVE))) ||
|
||||
((f.hasMaterialFlag(T3D_MATERIAL_GLASS)))) {
|
||||
((f.hasMaterialFlag(T3D_MATERIAL_CLIPMAP))) ||
|
||||
((f.hasMaterialFlag(T3D_MATERIAL_BOTTLE))) ||
|
||||
((f.hasMaterialFlag(T3D_MATERIAL_ADDITIVE))) ||
|
||||
((f.hasMaterialFlag(T3D_MATERIAL_GLASS)))) {
|
||||
f.lightmap = nullptr;
|
||||
}
|
||||
|
||||
@ -424,10 +424,10 @@ void LoadLightmaps(WorkDirs &workDirs, t3dBODY *b) {
|
||||
f.lightmap = nullptr;
|
||||
// if (Map==-1)
|
||||
if ((!(f.hasMaterialFlag(T3D_MATERIAL_OPACITY))) &&
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_CLIPMAP))) &&
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_BOTTLE))) &&
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_ADDITIVE))) &&
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_GLASS)))) {
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_CLIPMAP))) &&
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_BOTTLE))) &&
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_ADDITIVE))) &&
|
||||
(!(f.hasMaterialFlag(T3D_MATERIAL_GLASS)))) {
|
||||
alphaval1 = RGBA_GETALPHA(gv[f.VertexIndex[0]].diffuse);
|
||||
alphaval2 = RGBA_GETALPHA(gv[f.VertexIndex[1]].diffuse);
|
||||
alphaval3 = RGBA_GETALPHA(gv[f.VertexIndex[2]].diffuse);
|
||||
@ -453,8 +453,8 @@ void LoadLightmaps(WorkDirs &workDirs, t3dBODY *b) {
|
||||
t3dF32 v = stream->readFloatLE();
|
||||
|
||||
if ((RGBA_GETRED(gv[j].diffuse) == 254) &&
|
||||
(RGBA_GETGREEN(gv[j].diffuse) == 254) &&
|
||||
(RGBA_GETBLUE(gv[j].diffuse) == 254)) {
|
||||
(RGBA_GETGREEN(gv[j].diffuse) == 254) &&
|
||||
(RGBA_GETBLUE(gv[j].diffuse) == 254)) {
|
||||
gv[j].u2 = u;
|
||||
gv[j].v2 = v;
|
||||
gv[j].diffuse = RGBA_MAKE(255, 255, 255, RGBA_GETALPHA(gv[j].diffuse));
|
||||
@ -505,7 +505,7 @@ t3dBODY *t3dBODY::loadFromStream(WGame &game, const Common::String &pname, Commo
|
||||
//-------------------LOADING MESHES--------------------------------------
|
||||
t3dMESH *ReceiveRipples = nullptr;
|
||||
uint8 Mirror = 0;
|
||||
t3dLoadMeshes(this,numMeshes, ReceiveRipples, Mirror, stream); // TODO: We probably don't need to pass ReceiveRipples, Mirror
|
||||
t3dLoadMeshes(this, numMeshes, ReceiveRipples, Mirror, stream); // TODO: We probably don't need to pass ReceiveRipples, Mirror
|
||||
//-------------------END OF LOADING MESHES-------------------------------
|
||||
this->initNormals(stream);
|
||||
|
||||
@ -561,7 +561,7 @@ t3dBODY *t3dBODY::loadFromStream(WGame &game, const Common::String &pname, Commo
|
||||
if (!(LoaderFlags & T3D_NOLIGHTMAPS)) { // Carica le Lightmaps
|
||||
// TODO: This looks odd
|
||||
if (!pname.equalsIgnoreCase("rxt.t3d") || !pname.equalsIgnoreCase("rxt-b.t3d") || !pname.equalsIgnoreCase("rxt-c.t3d") ||
|
||||
!pname.equalsIgnoreCase("rxt-d.t3d") || !pname.equalsIgnoreCase("rxt-e.t3d") || !pname.equalsIgnoreCase("rxt.t3d-f"))
|
||||
!pname.equalsIgnoreCase("rxt-d.t3d") || !pname.equalsIgnoreCase("rxt-e.t3d") || !pname.equalsIgnoreCase("rxt.t3d-f"))
|
||||
LoadLightmaps(workdirs, this);
|
||||
}
|
||||
if ((LoaderFlags & T3D_OUTDOORLIGHTS)) { // Carica le luci per l'esterno
|
||||
|
@ -30,26 +30,40 @@
|
||||
namespace Watchmaker {
|
||||
|
||||
struct t3dBODY {
|
||||
Common::String name; // room name
|
||||
uint32 NumMeshes() { return MeshTable.size(); }; // num meshes
|
||||
uint32 NumCameras() const { return CameraTable.size(); } // num cameras
|
||||
uint16 NumPaths() const { return CameraPath.size(); } // num camera paths
|
||||
uint32 NumLights() const { return LightTable.size(); } // num lights
|
||||
Common::String name; // room name
|
||||
uint32 NumMeshes() {
|
||||
return MeshTable.size();
|
||||
}; // num meshes
|
||||
uint32 NumCameras() const {
|
||||
return CameraTable.size(); // num cameras
|
||||
}
|
||||
uint16 NumPaths() const {
|
||||
return CameraPath.size(); // num camera paths
|
||||
}
|
||||
uint32 NumLights() const {
|
||||
return LightTable.size(); // num lights
|
||||
}
|
||||
uint16 NumPanels[T3D_MAX_LEVELS] = {}; // num panels per level
|
||||
uint16 NumNormals = 0; // num face normals
|
||||
uint16 NumVerticesNormals = 0; // num vertex normals
|
||||
uint16 NumPosLights() const { return PosLightTable.size(); }; // num positional lights
|
||||
uint16 NumPosLights() const {
|
||||
return PosLightTable.size();
|
||||
}; // num positional lights
|
||||
uint16 NumLevels = 0; // num panel levels
|
||||
uint16 CurLevel = 0; // current level
|
||||
uint32 NumTotVerts = 0; // total number of verts in room
|
||||
t3dV3F AmbientLight; // room ambient color
|
||||
Common::Array<t3dMESH> MeshTable; // meshes list
|
||||
MaterialTable MatTable; // materials list
|
||||
uint32 NumMaterials() const { return MatTable.size(); } // num materials
|
||||
MaterialTable LightmapTable; // lightmap material list
|
||||
Common::Array<t3dMESH> MeshTable; // meshes list
|
||||
MaterialTable MatTable; // materials list
|
||||
uint32 NumMaterials() const {
|
||||
return MatTable.size(); // num materials
|
||||
}
|
||||
MaterialTable LightmapTable; // lightmap material list
|
||||
uint32 NumLightmaps = 0; // num lightmap materials
|
||||
MaterialTable MirrorMatTable; // material list (for mirrors)
|
||||
uint32 NumMirrorMaterials() const { return MirrorMatTable.size(); }; // num materials (for mirror)
|
||||
MaterialTable MirrorMatTable; // material list (for mirrors)
|
||||
uint32 NumMirrorMaterials() const {
|
||||
return MirrorMatTable.size();
|
||||
}; // num materials (for mirror)
|
||||
private:
|
||||
Common::Array<Common::SharedPtr<VertexBuffer>> VBTable; // metrial vertex buffers list
|
||||
public:
|
||||
@ -63,19 +77,21 @@ public:
|
||||
}
|
||||
VBTable.clear();
|
||||
}
|
||||
uint32 NumVB() { return VBTable.size(); }; // num vertex buffer
|
||||
uint32 NumVB() {
|
||||
return VBTable.size();
|
||||
}; // num vertex buffer
|
||||
public:
|
||||
Common::Array<t3dCAMERA> CameraTable; // camera list
|
||||
Common::Array<t3dLIGHT> LightTable; // light list
|
||||
Common::Array<t3dPLIGHT> PosLightTable; // positional light list
|
||||
NormalList NList; // normal list
|
||||
NormalList NList; // normal list
|
||||
t3dCAMERAGRID CameraGrid; // camera grid
|
||||
Common::Array<t3dCAMERAPATH> CameraPath; // camer paths list
|
||||
t3dPAN *Panel[T3D_MAX_LEVELS] = {}; // room panels for level
|
||||
t3dF32 PanelHeight[T3D_MAX_LEVELS] = {}; // panel height for levels
|
||||
t3dPAN *Panel[T3D_MAX_LEVELS] = {}; // room panels for level
|
||||
t3dF32 PanelHeight[T3D_MAX_LEVELS] = {}; // panel height for levels
|
||||
Common::SharedPtr<t3dVolLights> VolumetricLights; // volumetric lights
|
||||
t3dMESH *BlockMeshes[T3D_MAX_BLOCK_MESHES] = {}; // block mesh (for external rooms)
|
||||
t3dV3F MinPos; // min room position
|
||||
t3dMESH *BlockMeshes[T3D_MAX_BLOCK_MESHES] = {}; // block mesh (for external rooms)
|
||||
t3dV3F MinPos; // min room position
|
||||
private:
|
||||
void allocateNormals();
|
||||
void initNormals(Common::SeekableReadStream &stream);
|
||||
|
@ -54,7 +54,7 @@ MaterialPtr t3dFACE::getMaterial() {
|
||||
}
|
||||
}
|
||||
|
||||
const gMaterial* t3dFACE::getMaterial() const {
|
||||
const gMaterial *t3dFACE::getMaterial() const {
|
||||
if (_mat) {
|
||||
return _mat.get();
|
||||
} else {
|
||||
|
@ -50,9 +50,11 @@ public:
|
||||
|
||||
t3dFACE(t3dBODY *b, Common::SeekableReadStream &stream);
|
||||
|
||||
bool hasMaterialFlag(uint32 flag) { return getMaterial()->hasFlag(flag); }
|
||||
bool hasMaterialFlag(uint32 flag) {
|
||||
return getMaterial()->hasFlag(flag);
|
||||
}
|
||||
MaterialPtr getMaterial();
|
||||
const gMaterial* getMaterial() const;
|
||||
const gMaterial *getMaterial() const;
|
||||
uint16 getMaterialIndex() const {
|
||||
return _materialIndex;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ t3dMESH::t3dMESH(t3dBODY *b, Common::SeekableReadStream &stream, t3dMESH *&Recei
|
||||
// if( this->Flags&T3D_MESH_PORTAL)
|
||||
// this->Flags|=T3D_MESH_PORTAL;
|
||||
if ((this->Flags & T3D_MESH_RECEIVERIPPLES) || // Aggiunge buffer per le onde
|
||||
(this->Flags & T3D_MESH_POOLWATER))
|
||||
(this->Flags & T3D_MESH_POOLWATER))
|
||||
ReceiveRipples = this;
|
||||
if (this->Flags & T3D_MESH_WAVESTEXTURE) { // Legge informazioni sulle onde
|
||||
this->WavesSpeed = (t3dF32)stream.readSint32LE() / 10000.0f;
|
||||
@ -155,9 +155,9 @@ t3dMESH::t3dMESH(t3dBODY *b, Common::SeekableReadStream &stream, t3dMESH *&Recei
|
||||
this->BBox[normal].p = t3dV3F(stream) * SCALEFACTOR;
|
||||
}//__for_normal
|
||||
if ((this->BBox[0].p == this->BBox[4].p) && // Se non ha spessore
|
||||
(this->BBox[1].p == this->BBox[5].p) &&
|
||||
(this->BBox[2].p == this->BBox[6].p) &&
|
||||
(this->BBox[3].p == this->BBox[7].p)) {
|
||||
(this->BBox[1].p == this->BBox[5].p) &&
|
||||
(this->BBox[2].p == this->BBox[6].p) &&
|
||||
(this->BBox[3].p == this->BBox[7].p)) {
|
||||
t3dV3F sub;
|
||||
sub.x = sub.y = sub.z = 5.0f;
|
||||
t3dVectSub(&this->BBox[0].p, &this->BBox[0].p, &sub); // Aggiunge 5 di spessore
|
||||
|
@ -30,7 +30,9 @@ namespace Watchmaker {
|
||||
struct t3dMESH {
|
||||
Common::String name; // mesh name
|
||||
Common::String portalName; // dest room name (if portal)
|
||||
uint16 NumFaces() { return FList.size(); }; // faces number
|
||||
uint16 NumFaces() {
|
||||
return FList.size();
|
||||
}; // faces number
|
||||
uint16 NumVerts = 0; // verts number
|
||||
uint16 NumNormals = 0; // face normals number
|
||||
uint16 NumVerticesNormals = 0; // verts normals number
|
||||
@ -69,7 +71,7 @@ struct t3dMESH {
|
||||
|
||||
uint32 Flags; // Flags
|
||||
t3dBODY *PortalList; // Pointer to portal connected
|
||||
Common::Array<t3dMESH*> RejectedMeshes; // rejected mesh from portal
|
||||
Common::Array<t3dMESH *> RejectedMeshes; // rejected mesh from portal
|
||||
|
||||
void saveVertexBuffer() { // Scorre le mesh
|
||||
this->VBptr = this->VertexBuffer;
|
||||
@ -98,9 +100,9 @@ struct t3dMESH {
|
||||
alphaval = 0xfe;
|
||||
Face.flags |= T3D_MATERIAL_CLIPMAP; // lo setta sulla faccia
|
||||
/* Face->flags&=~T3D_MATERIAL_OPACITY;
|
||||
Face->flags&=~T3D_MATERIAL_GLASS;
|
||||
Material->Flags&=~T3D_MATERIAL_OPACITY;
|
||||
Material->Flags&=~T3D_MATERIAL_GLASS;*/
|
||||
Face->flags&=~T3D_MATERIAL_GLASS;
|
||||
Material->Flags&=~T3D_MATERIAL_OPACITY;
|
||||
Material->Flags&=~T3D_MATERIAL_GLASS;*/
|
||||
// r=g=b=0;
|
||||
}
|
||||
if (Material->hasFlag(T3D_MATERIAL_OPACITY)) { // Se il materiale e' opacity
|
||||
|
@ -35,8 +35,8 @@ namespace Watchmaker {
|
||||
class WGame;
|
||||
// Texture structs
|
||||
struct gTexture {
|
||||
Common::String name;
|
||||
Texture *texture = nullptr;
|
||||
Common::String name;
|
||||
Texture *texture = nullptr;
|
||||
int RealDimX = 0; // original dimensions
|
||||
int RealDimY = 0; // original dimensions
|
||||
int DimX = 0; // current dimensions
|
||||
|
@ -59,32 +59,32 @@ public:
|
||||
t3dV3F operator+(const t3dV3F &rhs) const {
|
||||
return t3dV3F(
|
||||
x + rhs.x,
|
||||
y + rhs.y,
|
||||
z + rhs.z
|
||||
);
|
||||
y + rhs.y,
|
||||
z + rhs.z
|
||||
);
|
||||
}
|
||||
t3dV3F operator-(const t3dV3F &rhs) const {
|
||||
return t3dV3F(
|
||||
x + rhs.x,
|
||||
y + rhs.y,
|
||||
z + rhs.z
|
||||
x + rhs.x,
|
||||
y + rhs.y,
|
||||
z + rhs.z
|
||||
);
|
||||
}
|
||||
t3dV3F operator-() const {
|
||||
return t3dV3F(
|
||||
-x,
|
||||
-y,
|
||||
-z
|
||||
-x,
|
||||
-y,
|
||||
-z
|
||||
);
|
||||
}
|
||||
t3dV3F operator*(float scalar) const {
|
||||
return t3dV3F(
|
||||
x * scalar,
|
||||
y * scalar,
|
||||
z * scalar
|
||||
x * scalar,
|
||||
y * scalar,
|
||||
z * scalar
|
||||
);
|
||||
}
|
||||
t3dV3F& operator*=(float scalar) {
|
||||
t3dV3F &operator*=(float scalar) {
|
||||
this->x *= scalar;
|
||||
this->y *= scalar;
|
||||
this->z *= scalar;
|
||||
|
@ -652,8 +652,8 @@ void ProcessCamera(WGame &game) {
|
||||
|
||||
// Parte Morte Victoria se esce dalla r49 per andare nella r48 prima di aver attivato le leylines
|
||||
if (
|
||||
(game._gameVars.getCurRoomId() == r48) && (foxOldRoom == r49)
|
||||
&& (!(init.Dialog[dR491].flags & DIALOG_DONE))
|
||||
(game._gameVars.getCurRoomId() == r48) && (foxOldRoom == r49)
|
||||
&& (!(init.Dialog[dR491].flags & DIALOG_DONE))
|
||||
&& (!(LoaderFlags & T3D_DEBUGMODE))
|
||||
&& (!bDialogActive)
|
||||
) {
|
||||
|
@ -46,20 +46,19 @@
|
||||
|
||||
namespace Watchmaker {
|
||||
|
||||
t3dF32 AngleX,AngleY,AngleSpeed;
|
||||
t3dF32 AngleX, AngleY, AngleSpeed;
|
||||
char bFastAnim = 0;
|
||||
int32 PlayAnim=351;
|
||||
char bBilinear=1;
|
||||
char bForceDebug=0;
|
||||
int32 PlayAnim = 351;
|
||||
char bBilinear = 1;
|
||||
char bForceDebug = 0;
|
||||
unsigned char KeyTable[256];
|
||||
|
||||
uint16 bnd_lev;
|
||||
|
||||
extern int16 NextDlg; //from doDialog.c
|
||||
extern uint8 tasti_per_sfx1; //from main.c
|
||||
extern int16 NextDlg; //from doDialog.c
|
||||
extern uint8 tasti_per_sfx1; //from main.c
|
||||
|
||||
void ProcessKBInput()
|
||||
{
|
||||
void ProcessKBInput() {
|
||||
// TODO: Currently we're polling this in the PollEvent flow.
|
||||
return;
|
||||
#if 0
|
||||
@ -70,11 +69,10 @@ void ProcessKBInput()
|
||||
KeyTable[i] = keyState[i];
|
||||
}
|
||||
|
||||
for (int i=0; i<numKeys; i++ )
|
||||
{
|
||||
if( keyState[i] )
|
||||
for (int i = 0; i < numKeys; i++) {
|
||||
if (keyState[i])
|
||||
KeyTable[i] = 0x80;
|
||||
else if( ( KeyTable[i] != 0 ) && ( !keyState[i] ) )
|
||||
else if ((KeyTable[i] != 0) && (!keyState[i]))
|
||||
KeyTable[i] = 0x10;
|
||||
else
|
||||
KeyTable[i] = 0x00;
|
||||
@ -82,37 +80,31 @@ void ProcessKBInput()
|
||||
#endif
|
||||
}
|
||||
|
||||
bool KeyDown(unsigned char key)
|
||||
{
|
||||
if(KeyTable[(key)] & 0x80)
|
||||
bool KeyDown(unsigned char key) {
|
||||
if (KeyTable[(key)] & 0x80)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool KeyUp(unsigned char key)
|
||||
{
|
||||
if(KeyTable[(key)] & 0x10)
|
||||
{
|
||||
KeyTable[(key)]=0;
|
||||
bool KeyUp(unsigned char key) {
|
||||
if (KeyTable[(key)] & 0x10) {
|
||||
KeyTable[(key)] = 0;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void KeyClear(unsigned char key)
|
||||
{
|
||||
KeyTable[(key)]=0;
|
||||
void KeyClear(unsigned char key) {
|
||||
KeyTable[(key)] = 0;
|
||||
}
|
||||
|
||||
bool DInputExclusiveMouse()
|
||||
{
|
||||
bool DInputExclusiveMouse() {
|
||||
#if 0
|
||||
HWND hwnd=GetForegroundWindow();
|
||||
HWND hwnd = GetForegroundWindow();
|
||||
|
||||
g_pMouse->lpVtbl->Unacquire(g_pMouse);
|
||||
if( FAILED( g_pMouse->lpVtbl->SetCooperativeLevel( g_pMouse, hwnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND) ) )
|
||||
if (FAILED(g_pMouse->lpVtbl->SetCooperativeLevel(g_pMouse, hwnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND)))
|
||||
return FALSE;
|
||||
g_pMouse->lpVtbl->Acquire(g_pMouse);
|
||||
#endif
|
||||
@ -121,13 +113,12 @@ bool DInputExclusiveMouse()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool DInputNonExclusiveMouse()
|
||||
{
|
||||
bool DInputNonExclusiveMouse() {
|
||||
#if 0
|
||||
HWND hwnd=GetForegroundWindow();
|
||||
HWND hwnd = GetForegroundWindow();
|
||||
|
||||
g_pMouse->lpVtbl->Unacquire(g_pMouse);
|
||||
if( FAILED( g_pMouse->lpVtbl->SetCooperativeLevel( g_pMouse, hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND) ) )
|
||||
if (FAILED(g_pMouse->lpVtbl->SetCooperativeLevel(g_pMouse, hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND)))
|
||||
return FALSE;
|
||||
g_pMouse->lpVtbl->Acquire(g_pMouse);
|
||||
#endif
|
||||
@ -137,106 +128,99 @@ bool DInputNonExclusiveMouse()
|
||||
}
|
||||
|
||||
/* -----------------25/08/98 10.42-------------------
|
||||
* HandleFirstPerson
|
||||
* HandleFirstPerson
|
||||
* --------------------------------------------------*/
|
||||
void HandleFirstPersonView( void )
|
||||
{
|
||||
void HandleFirstPersonView(void) {
|
||||
t3dF32 dist;
|
||||
t3dV3F d,n;
|
||||
t3dV3F d, n;
|
||||
|
||||
if( ( !Player ) || ( !t3dCurCamera ) || ( bLockCamera ) ) return;
|
||||
if ((!Player) || (!t3dCurCamera) || (bLockCamera)) return;
|
||||
|
||||
if( KeyDown(Common::KEYCODE_a) ) // Alza testa
|
||||
{
|
||||
if( ( dist = CurFloorY+MAX_HEIGHT - ( t3dCurCamera->Source.y + 10*SCALEFACTOR ) ) > 0 )
|
||||
{
|
||||
if( dist > 10*SCALEFACTOR ) dist = 10*SCALEFACTOR;
|
||||
t3dVectInit( &d, 0.0f, dist, 0.0f );
|
||||
t3dMoveAndCheck1stCamera( t3dCurRoom, t3dCurCamera, &d );
|
||||
if (KeyDown(Common::KEYCODE_a)) { // Alza testa
|
||||
if ((dist = CurFloorY + MAX_HEIGHT - (t3dCurCamera->Source.y + 10 * SCALEFACTOR)) > 0) {
|
||||
if (dist > 10 * SCALEFACTOR) dist = 10 * SCALEFACTOR;
|
||||
t3dVectInit(&d, 0.0f, dist, 0.0f);
|
||||
t3dMoveAndCheck1stCamera(t3dCurRoom, t3dCurCamera, &d);
|
||||
}
|
||||
}
|
||||
else if( KeyDown(Common::KEYCODE_z) ) // Abbassa Testa
|
||||
{
|
||||
if( ( dist = CurFloorY+KNEE_HEIGHT - ( t3dCurCamera->Source.y - 10*SCALEFACTOR ) ) < 0 )
|
||||
{
|
||||
if( dist < -10*SCALEFACTOR ) dist = -10*SCALEFACTOR;
|
||||
t3dVectInit( &d, 0.0f, dist, 0.0f );
|
||||
t3dMoveAndCheck1stCamera( t3dCurRoom, t3dCurCamera, &d );
|
||||
} else if (KeyDown(Common::KEYCODE_z)) { // Abbassa Testa
|
||||
if ((dist = CurFloorY + KNEE_HEIGHT - (t3dCurCamera->Source.y - 10 * SCALEFACTOR)) < 0) {
|
||||
if (dist < -10 * SCALEFACTOR) dist = -10 * SCALEFACTOR;
|
||||
t3dVectInit(&d, 0.0f, dist, 0.0f);
|
||||
t3dMoveAndCheck1stCamera(t3dCurRoom, t3dCurCamera, &d);
|
||||
}
|
||||
}
|
||||
|
||||
// Se tengo premuto lo shift o un tasto del mouse
|
||||
if( KeyDown(Common::KEYCODE_LSHIFT) || KeyDown(Common::KEYCODE_RSHIFT) || ( ( bLPressed || bRPressed ) && (mMove>10) ) )
|
||||
{
|
||||
t3dVectSub( &d, &t3dCurCamera->Target, &t3dCurCamera->Source );d.y = 0.0f;
|
||||
t3dVectNormalize( &d );
|
||||
n.x = -d.z;n.y = 0.0f;n.z = d.x;
|
||||
if (KeyDown(Common::KEYCODE_LSHIFT) || KeyDown(Common::KEYCODE_RSHIFT) || ((bLPressed || bRPressed) && (mMove > 10))) {
|
||||
t3dVectSub(&d, &t3dCurCamera->Target, &t3dCurCamera->Source);
|
||||
d.y = 0.0f;
|
||||
t3dVectNormalize(&d);
|
||||
n.x = -d.z;
|
||||
n.y = 0.0f;
|
||||
n.z = d.x;
|
||||
|
||||
dist = (t3dF32)( (t3dF32)mMoveY / (t3dF32)( MainDy/2 ) )*100.0f;
|
||||
if( KeyDown(Common::KEYCODE_UP) )
|
||||
d *= (5*SCALEFACTOR );
|
||||
else if( KeyDown(Common::KEYCODE_DOWN) )
|
||||
d *= (-5*SCALEFACTOR );
|
||||
else if( ( (bLPressed) || (bRPressed) ) && (mMoveY) && !bClock33 )
|
||||
d *= (-dist*SCALEFACTOR );
|
||||
dist = (t3dF32)((t3dF32)mMoveY / (t3dF32)(MainDy / 2)) * 100.0f;
|
||||
if (KeyDown(Common::KEYCODE_UP))
|
||||
d *= (5 * SCALEFACTOR);
|
||||
else if (KeyDown(Common::KEYCODE_DOWN))
|
||||
d *= (-5 * SCALEFACTOR);
|
||||
else if (((bLPressed) || (bRPressed)) && (mMoveY) && !bClock33)
|
||||
d *= (-dist * SCALEFACTOR);
|
||||
else
|
||||
t3dVectFill( &d, 0.0f );
|
||||
t3dVectFill(&d, 0.0f);
|
||||
|
||||
dist = (t3dF32)( (t3dF32)mMoveX / (t3dF32)( MainDx/2 ) )*100.0f;
|
||||
if( KeyDown(Common::KEYCODE_LEFT) )
|
||||
n *= (5*SCALEFACTOR );
|
||||
else if( KeyDown(Common::KEYCODE_RIGHT) )
|
||||
n *= (-5*SCALEFACTOR );
|
||||
else if( ( (bLPressed) || (bRPressed) ) && (mMoveX) && !bClock33 )
|
||||
n *= (-dist*SCALEFACTOR );
|
||||
dist = (t3dF32)((t3dF32)mMoveX / (t3dF32)(MainDx / 2)) * 100.0f;
|
||||
if (KeyDown(Common::KEYCODE_LEFT))
|
||||
n *= (5 * SCALEFACTOR);
|
||||
else if (KeyDown(Common::KEYCODE_RIGHT))
|
||||
n *= (-5 * SCALEFACTOR);
|
||||
else if (((bLPressed) || (bRPressed)) && (mMoveX) && !bClock33)
|
||||
n *= (-dist * SCALEFACTOR);
|
||||
else
|
||||
t3dVectFill( &n, 0.0f );
|
||||
t3dVectFill(&n, 0.0f);
|
||||
|
||||
t3dVectAdd( &d, &d, &n );
|
||||
t3dMoveAndCheck1stCamera( t3dCurRoom, t3dCurCamera, &d );
|
||||
}
|
||||
else
|
||||
{
|
||||
int32 x,y;
|
||||
t3dVectAdd(&d, &d, &n);
|
||||
t3dMoveAndCheck1stCamera(t3dCurRoom, t3dCurCamera, &d);
|
||||
} else {
|
||||
int32 x, y;
|
||||
x = 0;
|
||||
y = 0;
|
||||
|
||||
if( KeyDown(Common::KEYCODE_UP) )
|
||||
if (KeyDown(Common::KEYCODE_UP))
|
||||
y = -10;
|
||||
else if( KeyDown(Common::KEYCODE_DOWN) )
|
||||
y = MainDy+10;
|
||||
if( KeyDown(Common::KEYCODE_LEFT) )
|
||||
else if (KeyDown(Common::KEYCODE_DOWN))
|
||||
y = MainDy + 10;
|
||||
if (KeyDown(Common::KEYCODE_LEFT))
|
||||
x = -10;
|
||||
else if( KeyDown(Common::KEYCODE_RIGHT) )
|
||||
x = MainDx+10;
|
||||
else if (KeyDown(Common::KEYCODE_RIGHT))
|
||||
x = MainDx + 10;
|
||||
|
||||
if( x || y )
|
||||
{
|
||||
t3dF32 diffx,diffy;
|
||||
if (x || y) {
|
||||
t3dF32 diffx, diffy;
|
||||
diffx = 0.f;
|
||||
diffy = 0.f;
|
||||
|
||||
if( x > MainDx ) diffx = (t3dF32)((t3dF32)( x-MainDx )/3.0f);
|
||||
else if( x < 0 ) diffx = (t3dF32)((t3dF32)x / 3.0f );
|
||||
if( y > MainDy ) diffy = (t3dF32)((t3dF32)( y-MainDy )/3.0f );
|
||||
else if( y < 0 ) diffy = (t3dF32)((t3dF32)y / 3.0f );
|
||||
if (x > MainDx) diffx = (t3dF32)((t3dF32)(x - MainDx) / 3.0f);
|
||||
else if (x < 0) diffx = (t3dF32)((t3dF32)x / 3.0f);
|
||||
if (y > MainDy) diffy = (t3dF32)((t3dF32)(y - MainDy) / 3.0f);
|
||||
else if (y < 0) diffy = (t3dF32)((t3dF32)y / 3.0f);
|
||||
|
||||
MoveHeadAngles(diffx,diffy);
|
||||
MoveHeadAngles(diffx, diffy);
|
||||
}
|
||||
}
|
||||
|
||||
// Corregge Camera
|
||||
t3dVectCopy( &d, &Player->Mesh->Trasl );
|
||||
t3dVectCopy(&d, &Player->Mesh->Trasl);
|
||||
d.y = t3dCurCamera->Source.y;
|
||||
dist = KNEE_HEIGHT - t3dVectDistance( &t3dCurCamera->Source, &d );
|
||||
if( dist < 0.0f )
|
||||
{
|
||||
t3dVectSub( &d, &t3dCurCamera->Source, &d );d.y = 0.0f;
|
||||
t3dVectNormalize( &d );
|
||||
dist = KNEE_HEIGHT - t3dVectDistance(&t3dCurCamera->Source, &d);
|
||||
if (dist < 0.0f) {
|
||||
t3dVectSub(&d, &t3dCurCamera->Source, &d);
|
||||
d.y = 0.0f;
|
||||
t3dVectNormalize(&d);
|
||||
d *= dist;
|
||||
|
||||
t3dVectAdd( &t3dCurCamera->Source, &t3dCurCamera->Source, &d );
|
||||
t3dVectAdd( &t3dCurCamera->Target, &t3dCurCamera->Target, &d );
|
||||
t3dVectAdd(&t3dCurCamera->Source, &t3dCurCamera->Source, &d);
|
||||
t3dVectAdd(&t3dCurCamera->Target, &t3dCurCamera->Target, &d);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ void doMouseButton(WGame &game) {
|
||||
CurObj = WhatObj(game, TheMessage->wparam1, TheMessage->wparam2, TheMessage->event);
|
||||
// Se sono su albero e clicco fuori dal nido, simulo un cambio portale
|
||||
if (bPlayerSuBasamento &&
|
||||
(CurObj != oXT14ALBERO) && (CurObj != oXT14BASAMENTO) && (CurObj != oXT14NIDO_da_sopra_il_basamento) && (CurObj != oXT14OCCHIALI)) {
|
||||
(CurObj != oXT14ALBERO) && (CurObj != oXT14BASAMENTO) && (CurObj != oXT14NIDO_da_sopra_il_basamento) && (CurObj != oXT14OCCHIALI)) {
|
||||
NextPortalObj = CurObj;
|
||||
NextPortalAnim = a145;
|
||||
}
|
||||
@ -283,7 +283,7 @@ void doMouseUpdate(WGame &game) {
|
||||
if ((bLPressed) && (InvStatus & INV_MODE2)) {
|
||||
t3dM3X3F t;
|
||||
t3dMatRot(&t, ((t3dF32)(TheMessage->lparam[1]) / (t3dF32)(BigIconRect.y2 - BigIconRect.y1))*T3D_PI * 2.0f,
|
||||
((t3dF32)(TheMessage->lparam[0]) / (t3dF32)(BigIconRect.x1 - BigIconRect.x2))*T3D_PI * 2.0f, 0.0f);
|
||||
((t3dF32)(TheMessage->lparam[0]) / (t3dF32)(BigIconRect.x1 - BigIconRect.x2))*T3D_PI * 2.0f, 0.0f);
|
||||
t3dMatMul(&BigIconM, &t, &BigIconM);
|
||||
CurInvObj = BigInvObj;
|
||||
} else {
|
||||
|
@ -363,9 +363,8 @@ bool PlayMusic(int32 index, uint32 FadeOutTime, uint32 FadeInTime) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool StopSounds()
|
||||
{
|
||||
if( !sStopAllSounds() ) return false;
|
||||
bool StopSounds() {
|
||||
if (!sStopAllSounds()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "watchmaker/file_utils.h"
|
||||
#include "watchmaker/t3d.h"
|
||||
|
||||
Common::String readT3dString(Common::SeekableReadStream& stream) {
|
||||
Common::String readT3dString(Common::SeekableReadStream &stream) {
|
||||
char strbuf[T3D_NAMELEN + 1] = {};
|
||||
for (int i = 0; i < T3D_NAMELEN; i++) {
|
||||
strbuf[i] = stream.readByte();
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "common/stream.h"
|
||||
|
||||
Common::String readT3dString(Common::SeekableReadStream& stream);
|
||||
Common::String readT3dString(Common::SeekableReadStream &stream);
|
||||
// TODO: This can probably just be replaced with .hasSuffixIgnoreCase
|
||||
bool hasFileExtension(const Common::String &str, const Common::String &extension);
|
||||
bool hasFileExtension(const char *str, Common::String extension);
|
||||
|
@ -31,11 +31,11 @@ Fonts::~Fonts() {
|
||||
}
|
||||
}
|
||||
|
||||
uint16* Fonts::setupFontTable(Common::SeekableReadStream &stream) {
|
||||
uint16 *Fonts::setupFontTable(Common::SeekableReadStream &stream) {
|
||||
uint32 dim = stream.size();
|
||||
uint16 *tab = new uint16[dim]{};
|
||||
uint16 *tab = new uint16[dim] {};
|
||||
|
||||
for (int i=0; i<dim/sizeof(uint16); i++) {
|
||||
for (int i = 0; i < dim / sizeof(uint16); i++) {
|
||||
tab[i] = stream.readUint16LE();
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ void Fonts::getTextDim(char *s, FontKind font, int *x, int *y) {
|
||||
int i = 0;
|
||||
int nextx = 0, nexty = 0;
|
||||
byte c = 0;
|
||||
while ( (c=s[i]) != 0) {
|
||||
while ((c = s[i]) != 0) {
|
||||
i++;
|
||||
|
||||
nextx += fontTable->table[c * 4 + 2];
|
||||
|
@ -35,13 +35,13 @@ enum class FontKind {
|
||||
};
|
||||
|
||||
struct SFont {
|
||||
uint16 *table = nullptr;
|
||||
int32 color[MAX_FONT_COLORS] = {};
|
||||
uint16 *table = nullptr;
|
||||
int32 color[MAX_FONT_COLORS] = {};
|
||||
};
|
||||
|
||||
class WGame;
|
||||
class Fonts {
|
||||
Common::Array<uint16*> _tables;
|
||||
Common::Array<uint16 *> _tables;
|
||||
uint16 *setupFontTable(Common::SeekableReadStream &stream);
|
||||
void loadFont(WGame &game, struct SFont *f, const Common::String &n);
|
||||
public:
|
||||
|
@ -1698,8 +1698,8 @@ void StopObjAnim(WGame &game, int32 obj) {
|
||||
// Se esiste gia' un'animazione sullo stesso oggetto base, la termina
|
||||
for (int32 b = 0; b < MAX_ACTIVE_ANIMS; b++)
|
||||
if ((ActiveAnim[b].index) && (ActiveAnim[b].CurFrame >= 0)/* && !( ActiveAnim[b].flags & ANIM_PAUSED )*/ &&
|
||||
((Common::String((const char*)init.Anim[ActiveAnim[b].index].meshlink[0].rawArray()).equalsIgnoreCase((const char*)init.Obj[obj].meshlink[0])) || (ActiveAnim[b].obj == obj) ||
|
||||
((CurPlayer == obj - ocDARRELL) && (Common::String((const char*)init.Anim[ActiveAnim[b].index].meshlink[0].rawArray()).equalsIgnoreCase((const char*)init.Obj[ocCURPLAYER].meshlink[0]))
|
||||
((Common::String((const char *)init.Anim[ActiveAnim[b].index].meshlink[0].rawArray()).equalsIgnoreCase((const char *)init.Obj[obj].meshlink[0])) || (ActiveAnim[b].obj == obj) ||
|
||||
((CurPlayer == obj - ocDARRELL) && (Common::String((const char *)init.Anim[ActiveAnim[b].index].meshlink[0].rawArray()).equalsIgnoreCase((const char *)init.Obj[ocCURPLAYER].meshlink[0]))
|
||||
&& (ActiveAnim[b].sub[0].ptr) && Player && Player->Mesh && (ActiveAnim[b].sub[0].ptr == Player->Mesh))))
|
||||
StopAnim(game, ActiveAnim[b].index);
|
||||
}
|
||||
|
@ -299,55 +299,48 @@ uint8 t3dVectMeshInters(t3dMESH *m, t3dV3F start, t3dV3F end, t3dV3F *inters) {
|
||||
|
||||
|
||||
/* -----------------19/05/00 12.43-------------------
|
||||
* t3dMoveAndCheck1stCamera
|
||||
* t3dMoveAndCheck1stCamera
|
||||
* --------------------------------------------------*/
|
||||
bool t3dMoveAndCheck1stCamera( t3dBODY *rr, t3dCAMERA *cc, t3dV3F *mm )
|
||||
{
|
||||
bool t3dMoveAndCheck1stCamera(t3dBODY *rr, t3dCAMERA *cc, t3dV3F *mm) {
|
||||
t3dWALK *w;
|
||||
t3dV3F tmp;
|
||||
int32 i,j;
|
||||
int32 i, j;
|
||||
|
||||
if ( !Character[ocCURPLAYER] ) return FALSE;
|
||||
w=&Character[ocCURPLAYER]->Walk;
|
||||
if (!Character[ocCURPLAYER]) return FALSE;
|
||||
w = &Character[ocCURPLAYER]->Walk;
|
||||
|
||||
t3dVectAdd( &tmp, &cc->Source, mm );
|
||||
t3dVectAdd(&tmp, &cc->Source, mm);
|
||||
// Controlla che non sia dentro un Bounding Box
|
||||
for ( i=0; i<(int32)rr->NumMeshes(); i++ )
|
||||
{
|
||||
for (i = 0; i < (int32)rr->NumMeshes(); i++) {
|
||||
t3dMESH &mesh = rr->MeshTable[i];
|
||||
if( !( mesh.Flags & T3D_MESH_HIDDEN ) )
|
||||
{
|
||||
if (!(mesh.Flags & T3D_MESH_HIDDEN)) {
|
||||
// Se il punto di destinazione e' dentro il bound box (allargato dell'altezza del ginocchio)
|
||||
for ( j=0; j<6; j++ )
|
||||
if( t3dVectPlaneDistance( tmp, mesh.BBoxNormal[j] ) < -KNEE_HEIGHT )
|
||||
for (j = 0; j < 6; j++)
|
||||
if (t3dVectPlaneDistance(tmp, mesh.BBoxNormal[j]) < -KNEE_HEIGHT)
|
||||
break;
|
||||
|
||||
if ( j >= 6 )
|
||||
{
|
||||
if (j >= 6) {
|
||||
// Prima controlla che non sia dentro i bounds
|
||||
for ( j=0; j<w->PanelNum; j++ )
|
||||
{
|
||||
if ( PointInside( ocCURPLAYER, j, (double)tmp.x, (double)tmp.z ) != 0 )
|
||||
{
|
||||
warning( "Inters %s", mesh.name.c_str() ); // TODO: Debug
|
||||
for (j = 0; j < w->PanelNum; j++) {
|
||||
if (PointInside(ocCURPLAYER, j, (double)tmp.x, (double)tmp.z) != 0) {
|
||||
warning("Inters %s", mesh.name.c_str()); // TODO: Debug
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
warning( "Saved by bounds" ); // TODO: Debug
|
||||
warning("Saved by bounds"); // TODO: Debug
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// evito che si entri nell'altro personaggio giocante
|
||||
i = (CurPlayer ^ 1);
|
||||
if ( Character[i+ocDARRELL] && Character[i+ocDARRELL]->Mesh && t3dCurRoom->name.equalsIgnoreCase(PlayerStand[i].roomName ) ) // Used to be stricmp
|
||||
{
|
||||
t3dF32 d=t3dVectDistance( &tmp, &Character[i+ocDARRELL]->Mesh->Trasl );
|
||||
if( d < 435.f ) return FALSE;
|
||||
if (Character[i + ocDARRELL] && Character[i + ocDARRELL]->Mesh && t3dCurRoom->name.equalsIgnoreCase(PlayerStand[i].roomName)) { // Used to be stricmp
|
||||
t3dF32 d = t3dVectDistance(&tmp, &Character[i + ocDARRELL]->Mesh->Trasl);
|
||||
if (d < 435.f) return FALSE;
|
||||
}
|
||||
|
||||
t3dVectAdd( &cc->Source, &cc->Source, mm );
|
||||
t3dVectAdd( &cc->Target, &cc->Target, mm );
|
||||
t3dVectAdd(&cc->Source, &cc->Source, mm);
|
||||
t3dVectAdd(&cc->Target, &cc->Target, mm);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -726,7 +719,7 @@ void AddMeshModifier(const Common::String &name, int16 com, void *p) {
|
||||
|
||||
case MM_ANIM_BLOCK:
|
||||
if (mm->animName.empty())
|
||||
mm->animName = (char*)p;
|
||||
mm->animName = (char *)p;
|
||||
else
|
||||
mm->animName.clear();
|
||||
break;
|
||||
|
@ -46,7 +46,7 @@ void ChangeHaloesStatus(t3dBODY *b, int8 op);
|
||||
uint8 t3dVectMeshInters(t3dMESH *m, t3dV3F start, t3dV3F end, t3dV3F *inters);
|
||||
void t3dLightRoom(Init &init, t3dBODY *b, t3dV3F *p, t3dF32 NearRange, t3dF32 FarRange, t3dF32 IperRange);
|
||||
void t3dUpdateExplosion(t3dMESH *m, t3dF32 scale);
|
||||
bool t3dMoveAndCheck1stCamera( t3dBODY *rr, t3dCAMERA *cc, t3dV3F *mm );
|
||||
bool t3dMoveAndCheck1stCamera(t3dBODY *rr, t3dCAMERA *cc, t3dV3F *mm);
|
||||
|
||||
} // End of namespace Watchmaker
|
||||
|
||||
|
@ -143,29 +143,28 @@ void ProcessMouse(WGame &game) {
|
||||
/* -----------------19/10/98 15.18-------------------
|
||||
* DInputMouseGetCoords
|
||||
* --------------------------------------------------*/
|
||||
void HandleMouseChanges()
|
||||
{
|
||||
void HandleMouseChanges() {
|
||||
// Mouse movement will have been accumulated prior to calling this function.
|
||||
// Button flags may also have been changed, this function then applies the button changes.
|
||||
int curX, curY;
|
||||
|
||||
//warning("L: %d %d R: %d %d", bLPressed, bLPressedPrev, bRPressed, bRPressedPrev);
|
||||
// Button 0 pressed or released
|
||||
if( bLPressed != bLPressedPrev )
|
||||
{
|
||||
if (bLPressed != bLPressedPrev) {
|
||||
// se ha rilasciato e non ha mosso il mouse
|
||||
if( ( !bLPressed ) && ( !bSkipped ) && ( ( mMove < 10 ) || ( !( InvStatus & INV_MODE2 ) && !bFirstPerson && !bT2DActive ) ) )
|
||||
{ Event(EventClass::MC_MOUSE, ME_MLEFT, MP_DEFAULT, (int16)mPosx, (int16)mPosy, bRPressed, NULL, NULL, NULL); bSkipped = FALSE; }
|
||||
else if( bLPressed && ( mMove >= 10 ) && ( InvStatus & INV_MODE2 ) && ( bSomeOneSpeak ) )
|
||||
{ bSkipTalk = TRUE; bSkipped = TRUE; }
|
||||
else if( !bLPressed )
|
||||
if ((!bLPressed) && (!bSkipped) && ((mMove < 10) || (!(InvStatus & INV_MODE2) && !bFirstPerson && !bT2DActive))) {
|
||||
Event(EventClass::MC_MOUSE, ME_MLEFT, MP_DEFAULT, (int16)mPosx, (int16)mPosy, bRPressed, NULL, NULL, NULL);
|
||||
bSkipped = FALSE;
|
||||
} else if (bLPressed && (mMove >= 10) && (InvStatus & INV_MODE2) && (bSomeOneSpeak)) {
|
||||
bSkipTalk = TRUE;
|
||||
bSkipped = TRUE;
|
||||
} else if (!bLPressed)
|
||||
bSkipped = FALSE;
|
||||
mMove = 0;
|
||||
}
|
||||
// Button 1 pressed or released
|
||||
if( bRPressed != bRPressedPrev )
|
||||
{
|
||||
if( ( !bRPressed ) && ( ( mMove < 10 ) || ( !bFirstPerson && !bT2DActive ) ) )
|
||||
if (bRPressed != bRPressedPrev) {
|
||||
if ((!bRPressed) && ((mMove < 10) || (!bFirstPerson && !bT2DActive)))
|
||||
Event(EventClass::MC_MOUSE, ME_MRIGHT, MP_DEFAULT, (int16)mPosx, (int16)mPosy, bLPressed, NULL, NULL, NULL);
|
||||
mMove = 0;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ Common::SharedPtr<Common::SeekableReadStream> openFile(const Common::String &fil
|
||||
SearchMan.listMatchingMembers(files, adjustedPath);
|
||||
|
||||
for (Common::ArchiveMemberList::iterator it = files.begin(); it != files.end(); ++it) {
|
||||
if ((*it)->getName().equalsIgnoreCase(lastPathComponent(adjustedPath,'/'))) {
|
||||
if ((*it)->getName().equalsIgnoreCase(lastPathComponent(adjustedPath, '/'))) {
|
||||
file = (*it)->createReadStream();
|
||||
break;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ int16 getRoomFromStr(Init &init, const Common::String &s) {
|
||||
Common::String str = s.substr(start, end - start);
|
||||
|
||||
for (int a = 0; a < MAX_ROOMS; a++)
|
||||
if (str.equalsIgnoreCase((const char*)init.Room[a].name))
|
||||
if (str.equalsIgnoreCase((const char *)init.Room[a].name))
|
||||
return a;
|
||||
|
||||
return (0);
|
||||
|
@ -159,7 +159,7 @@ void Render3DEnvironment(WGame &game) {
|
||||
int32 i;
|
||||
// Cancella buffers
|
||||
//if (!rClearBuffers(0, rCLEARBACKBUFFER | rCLEARZBUFFER))
|
||||
// DebugLogWindow("Unable to clear backbuffers\n");
|
||||
// DebugLogWindow("Unable to clear backbuffers\n");
|
||||
t3dResetPipeline();
|
||||
// Update mouse coordinates and project them in 3D
|
||||
HandleMouseChanges();
|
||||
|
@ -27,8 +27,12 @@
|
||||
|
||||
namespace Watchmaker {
|
||||
|
||||
const char *WatchmakerGame::getGameId() const { return _gameDescription->gameId; }
|
||||
Common::Platform WatchmakerGame::getPlatform() const { return _gameDescription->platform; }
|
||||
const char *WatchmakerGame::getGameId() const {
|
||||
return _gameDescription->gameId;
|
||||
}
|
||||
Common::Platform WatchmakerGame::getPlatform() const {
|
||||
return _gameDescription->platform;
|
||||
}
|
||||
} // End of namespace Watchmaker
|
||||
|
||||
class WatchmakerMetaEngine : public AdvancedMetaEngine {
|
||||
|
@ -114,8 +114,13 @@ struct gBatchBlock {
|
||||
signed short int Texture1 = 0, Texture2 = 0; // texture ID
|
||||
unsigned int Flags1 = 0, Flags2 = 0; // flags
|
||||
signed short int ViewMatrixNum = 0; // view matrix num
|
||||
unsigned short int NumFaces() { return FacesList.size(); } // faces number
|
||||
unsigned short int NumVerts() { if (VBO) return VBO->_buffer.size(); else return 0; } // verts number
|
||||
unsigned short int NumFaces() {
|
||||
return FacesList.size(); // faces number
|
||||
}
|
||||
unsigned short int NumVerts() {
|
||||
if (VBO) return VBO->_buffer.size(); // verts number
|
||||
else return 0;
|
||||
}
|
||||
Common::Array<uint16> FacesList; // pointer to faces list
|
||||
Common::SharedPtr<VertexBuffer> VBO = nullptr;
|
||||
// LPDIRECT3DVERTEXBUFFER7 VB; // block VB
|
||||
|
@ -127,7 +127,7 @@ void Renderer::setCurCameraViewport(t3dF32 fov, uint8 sup) {
|
||||
int32 sx = windowInfo.width;
|
||||
int32 sy = windowInfo.height;
|
||||
|
||||
t3dF32 SuperView = 50.0f * (sup^1);
|
||||
t3dF32 SuperView = 50.0f * (sup ^ 1);
|
||||
|
||||
t3dCurCamera->Center.x = (t3dF32)(cx);
|
||||
t3dCurCamera->Center.y = (t3dF32)(cy);
|
||||
@ -137,24 +137,24 @@ void Renderer::setCurCameraViewport(t3dF32 fov, uint8 sup) {
|
||||
|
||||
warning("TODO: Set projection matrix");
|
||||
|
||||
setProjectionMatrix( (float)(sx),
|
||||
(float)(sy),
|
||||
fov,
|
||||
10.0f + SuperView, 90000.0f);
|
||||
setProjectionMatrix((float)(sx),
|
||||
(float)(sy),
|
||||
fov,
|
||||
10.0f + SuperView, 90000.0f);
|
||||
|
||||
//Set Clipplanes
|
||||
t3dV3F c0;
|
||||
t3dVectFill(&c0,0.0f);
|
||||
t3dVectFill(&c0, 0.0f);
|
||||
t3dV3F v1(screenSpaceToCameraSpace(0.0f, 0.0f));
|
||||
t3dV3F v2(screenSpaceToCameraSpace((t3dF32)sx, 0.0f));
|
||||
t3dV3F v3(screenSpaceToCameraSpace(0.0f, (t3dF32)sy));
|
||||
t3dV3F v3(screenSpaceToCameraSpace(0.0f, (t3dF32)sy));
|
||||
t3dV3F v4(screenSpaceToCameraSpace((t3dF32)sx, (t3dF32)sy));
|
||||
|
||||
#if 0
|
||||
t3dPlaneNormal(&ClipPlanes[LEFTCLIP], &c0, &v1, &v3);
|
||||
t3dPlaneNormal(&ClipPlanes[RIGHTCLIP], &c0, &v4, &v2);
|
||||
t3dPlaneNormal(&ClipPlanes[TOPCLIP], &c0, &v2, &v1);
|
||||
t3dPlaneNormal(&ClipPlanes[BOTTOMCLIP], &c0, &v3, &v4);
|
||||
t3dPlaneNormal(&ClipPlanes[LEFTCLIP], &c0, &v1, &v3);
|
||||
t3dPlaneNormal(&ClipPlanes[RIGHTCLIP], &c0, &v4, &v2);
|
||||
t3dPlaneNormal(&ClipPlanes[TOPCLIP], &c0, &v2, &v1);
|
||||
t3dPlaneNormal(&ClipPlanes[BOTTOMCLIP], &c0, &v3, &v4);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -176,21 +176,21 @@ int Renderer::rInvFitY(int y) {
|
||||
}
|
||||
|
||||
void gPrintText(WGame &game, const char *s, uint32 d, uint32 src, uint16 *FontTable, short x, short y) {
|
||||
int16 i=0,nextx,nexty;
|
||||
int16 i = 0, nextx, nexty;
|
||||
unsigned char c;
|
||||
|
||||
uint32 AddFlag=0,NumRetries=0;
|
||||
uint32 AddFlag = 0, NumRetries = 0;
|
||||
|
||||
nextx = nexty = 0;
|
||||
while ( (c=s[i])!=0) {
|
||||
while ((c = s[i]) != 0) {
|
||||
i++;
|
||||
int16 posx, posy, dimx, dimy;
|
||||
posx = FontTable[c*4+0];
|
||||
posy = FontTable[c*4+1];
|
||||
dimx = FontTable[c*4+2];
|
||||
dimy = FontTable[c*4+3];
|
||||
posx = FontTable[c * 4 + 0];
|
||||
posy = FontTable[c * 4 + 1];
|
||||
dimx = FontTable[c * 4 + 2];
|
||||
dimy = FontTable[c * 4 + 3];
|
||||
|
||||
rBlitter(game, d, src, x + nextx,y + nexty, posx, posy, dimx, dimy);
|
||||
rBlitter(game, d, src, x + nextx, y + nexty, posx, posy, dimx, dimy);
|
||||
|
||||
nextx += dimx;
|
||||
}
|
||||
@ -200,7 +200,7 @@ void Renderer::printText(const char *s, unsigned int dst, FontKind font, FontCol
|
||||
auto f = _fonts->fontForKind(font);
|
||||
uint32 src = f->color[color];
|
||||
|
||||
if (dst==0)
|
||||
if (dst == 0)
|
||||
gPrintText(*_game, s, NULL, src, f->table, x, y);
|
||||
else
|
||||
gPrintText(*_game, s, dst, src, f->table, x, y);
|
||||
@ -224,8 +224,8 @@ Math::Vector3d vector3Matrix4Mult(Math::Vector3d &vec, const Math::Matrix4 &m) {
|
||||
// since the w component is un-interesting that would be 4 unneccesary mults.
|
||||
const float *d = m.getData();
|
||||
return Math::Vector3d(vec.x() * d[0] + vec.y() * d[3] + vec.z() * d[6],
|
||||
vec.x() * d[1] + vec.y() * d[4] + vec.z() * d[7],
|
||||
vec.x() * d[2] + vec.y() * d[5] + vec.z() * d[8]);
|
||||
vec.x() * d[1] + vec.y() * d[4] + vec.z() * d[7],
|
||||
vec.x() * d[2] + vec.y() * d[5] + vec.z() * d[8]);
|
||||
}
|
||||
|
||||
Math::Vector3d Renderer::screenSpaceToCameraSpace(float x, float y) {
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "watchmaker/windows_hacks.h"
|
||||
#include <cstdlib>
|
||||
|
||||
#define WM_SAVEFILE_VERSION 0x17 // Don't know what changed though.
|
||||
#define WM_SAVEFILE_VERSION 0x17 // Don't know what changed though.
|
||||
|
||||
namespace Watchmaker {
|
||||
|
||||
@ -322,7 +322,7 @@ bool DataLoad(WGame &game, const Common::String &FileName, uint8 slot) {
|
||||
if (!FileName.equalsIgnoreCase("WmStart.dat"))
|
||||
if (
|
||||
(bPlayerInAnim && (bT2DActive != tOPTIONS))
|
||||
|| bUseWith || bDialogActive || bDialogMenuActive || bMovingCamera || bGolfActive || InvStatus
|
||||
|| bUseWith || bDialogActive || bDialogMenuActive || bMovingCamera || bGolfActive || InvStatus
|
||||
)
|
||||
return FALSE;
|
||||
|
||||
|
@ -115,7 +115,7 @@ void InitMessageSystem() {
|
||||
memset(&WaitingMsg[i], 0, sizeof(WaitingMsg[i]));
|
||||
}
|
||||
|
||||
const char* eventToString(EventClass classe) {
|
||||
const char *eventToString(EventClass classe) {
|
||||
|
||||
switch (classe) {
|
||||
case EventClass::MC_IDLE: return "MC_IDLE";
|
||||
@ -136,7 +136,7 @@ const char* eventToString(EventClass classe) {
|
||||
* Event
|
||||
* --------------------------------------------------*/
|
||||
void Event(EventClass classe, uint8 event, uint16 flags, int16 wparam1, int16 wparam2,
|
||||
uint8 bparam, void *p0, void *p1, void *p2) {
|
||||
uint8 bparam, void *p0, void *p1, void *p2) {
|
||||
pqueue *lq;
|
||||
message *lm;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
namespace Watchmaker {
|
||||
|
||||
void Event(EventClass classe, uint8 event, uint16 flags, int16 wparam1, int16 wparam2,
|
||||
uint8 bparam, void *p0, void *p1, void *p2);
|
||||
uint8 bparam, void *p0, void *p1, void *p2);
|
||||
|
||||
void InitMessageSystem();
|
||||
void Scheduler();
|
||||
|
@ -73,37 +73,38 @@ void sdl_wrapper::pollSDL() {
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
switch (event.type) {
|
||||
case SDL_QUIT:
|
||||
shouldQuit = true;
|
||||
case SDL_QUIT:
|
||||
shouldQuit = true;
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
switch (event.button.button) {
|
||||
case SDL_BUTTON_LEFT:
|
||||
bLPressed = true;
|
||||
warning("LEFT PRESSED");
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
switch (event.button.button) {
|
||||
case SDL_BUTTON_LEFT:
|
||||
bLPressed = true;
|
||||
warning("LEFT PRESSED");
|
||||
break;
|
||||
case SDL_BUTTON_RIGHT:
|
||||
bRPressed = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}*/
|
||||
/*
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
switch (event.button.button) {
|
||||
case SDL_BUTTON_LEFT:
|
||||
bLPressed = false;
|
||||
warning("LEFT RELEASED");
|
||||
break;
|
||||
case SDL_BUTTON_RIGHT:
|
||||
bRPressed = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}*/
|
||||
case SDL_KEYUP:
|
||||
KeyTable[event.key.keysym.scancode] = 0x10;
|
||||
case SDL_BUTTON_RIGHT:
|
||||
bRPressed = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
* /
|
||||
/*
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
switch (event.button.button) {
|
||||
case SDL_BUTTON_LEFT:
|
||||
bLPressed = false;
|
||||
warning("LEFT RELEASED");
|
||||
break;
|
||||
case SDL_BUTTON_RIGHT:
|
||||
bRPressed = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}*/
|
||||
case SDL_KEYUP:
|
||||
KeyTable[event.key.keysym.scancode] = 0x10;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -185,7 +185,9 @@ struct t3dCAMERAGRID {
|
||||
};
|
||||
|
||||
struct t3dCAMERAPATH {
|
||||
uint16 NumPoints() { return PList.size(); } // num points in path
|
||||
uint16 NumPoints() {
|
||||
return PList.size(); // num points in path
|
||||
}
|
||||
Common::Array<t3dV3F> PList; // points list
|
||||
uint32 CarrelloDist = 0; // if carrello: max distance from the target
|
||||
public:
|
||||
@ -201,7 +203,9 @@ struct t3dCAMERA {
|
||||
t3dV2F Center; // cam center
|
||||
t3dM3X3F Matrix; // cam view matrix
|
||||
t3dF32 NearClipPlane = 0.0f, FarClipPlane = 0.0f; // camera planes
|
||||
uint8 NumAvailablePaths() const { return CameraPaths.size(); } // num camera paths
|
||||
uint8 NumAvailablePaths() const {
|
||||
return CameraPaths.size(); // num camera paths
|
||||
}
|
||||
uint8 Index = 0; // cam index 9in room
|
||||
Common::Array<t3dPathCamera> CameraPaths; // paths list
|
||||
public:
|
||||
@ -246,8 +250,10 @@ public:
|
||||
};
|
||||
|
||||
struct t3dAnimLight {
|
||||
Common::Array<gVertex*> VisVerts; // pointer to visible vertices from lights
|
||||
uint16 NumVisVerts() const { return VisVerts.size(); } // num visible vertices from lights
|
||||
Common::Array<gVertex *> VisVerts; // pointer to visible vertices from lights
|
||||
uint16 NumVisVerts() const {
|
||||
return VisVerts.size(); // num visible vertices from lights
|
||||
}
|
||||
//t3dU32 *SavedLightColor; // pointer to original vartex illumination
|
||||
int8 LastRandomizer; // randomizer for flicker effects
|
||||
};
|
||||
@ -275,7 +281,7 @@ private:
|
||||
void setupVisibleVerticesFromLight(t3dBODY *b);
|
||||
void SetVisibleFromLight(gVertex *v);
|
||||
};
|
||||
typedef t3dLIGHT* LightPtr;
|
||||
typedef t3dLIGHT *LightPtr;
|
||||
|
||||
struct t3dPLIGHT {
|
||||
uint8 Num = 0; // index positional light in room
|
||||
|
@ -43,19 +43,17 @@ int32 NumCurve;
|
||||
void FixupCurAction(int32 oc);
|
||||
|
||||
/* -----------------28/04/98 17.51-------------------
|
||||
* SlideChar
|
||||
* SlideChar
|
||||
* --------------------------------------------------*/
|
||||
void SlideChar(int32 oc )
|
||||
{
|
||||
t3dCHARACTER *Ch=Character[oc];
|
||||
t3dWALK *w=&Ch->Walk;
|
||||
t3dF32 r,len,x1,x2,z1,z2;
|
||||
void SlideChar(int32 oc) {
|
||||
t3dCHARACTER *Ch = Character[oc];
|
||||
t3dWALK *w = &Ch->Walk;
|
||||
t3dF32 r, len, x1, x2, z1, z2;
|
||||
int16 nf;
|
||||
t3dV3F v;
|
||||
|
||||
if( /*!( w->Check & CLICKINTO ) &&*/ ( w->CurPanel < 0 ) )
|
||||
{
|
||||
CharStop( oc );
|
||||
if (/*!( w->Check & CLICKINTO ) &&*/ (w->CurPanel < 0)) {
|
||||
CharStop(oc);
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -67,46 +65,37 @@ void SlideChar(int32 oc )
|
||||
z1 = w->Panel[w->CurPanel].z1;
|
||||
x2 = w->Panel[w->CurPanel].x2;
|
||||
z2 = w->Panel[w->CurPanel].z2;
|
||||
if( ( len = (x1-x2)*(x1-x2) + (z1-z2)*(z1-z2) ) == 0 )
|
||||
{
|
||||
CharStop( oc );
|
||||
if ((len = (x1 - x2) * (x1 - x2) + (z1 - z2) * (z1 - z2)) == 0) {
|
||||
CharStop(oc);
|
||||
return ;
|
||||
}
|
||||
|
||||
r = ((z1-v.z)*(z1-z2)-(x1-v.x)*(x2-x1)) / len;
|
||||
r = ((z1 - v.z) * (z1 - z2) - (x1 - v.x) * (x2 - x1)) / len;
|
||||
|
||||
if( r>1.0f ) // a destra di 2
|
||||
{
|
||||
if (r > 1.0f) { // a destra di 2
|
||||
x1 = x2;
|
||||
z1 = z2;
|
||||
}
|
||||
else if( r>0.0f ) // dentro 1..2
|
||||
{
|
||||
x1 += r*(x2-x1);
|
||||
z1 += r*(z2-z1);
|
||||
} else if (r > 0.0f) { // dentro 1..2
|
||||
x1 += r * (x2 - x1);
|
||||
z1 += r * (z2 - z1);
|
||||
}
|
||||
|
||||
nf = w->CurFrame+1;
|
||||
if( ( w->CurAction == aWALK_START ) || ( w->CurAction == aWALK_LOOP ) || ( w->CurAction == aWALK_END ) )
|
||||
{
|
||||
if ( nf >= (ActionStart[aWALK_LOOP]+ActionLen[aWALK_LOOP]) )
|
||||
nf = w->CurFrame + 1;
|
||||
if ((w->CurAction == aWALK_START) || (w->CurAction == aWALK_LOOP) || (w->CurAction == aWALK_END)) {
|
||||
if (nf >= (ActionStart[aWALK_LOOP] + ActionLen[aWALK_LOOP]))
|
||||
nf = ActionStart[aWALK_LOOP];
|
||||
}
|
||||
else if( ( w->CurAction == aBACK_START ) || ( w->CurAction == aBACK_LOOP ) || ( w->CurAction == aBACK_END ) )
|
||||
{
|
||||
if ( nf >= (ActionStart[aBACK_LOOP]+ActionLen[aBACK_LOOP]) )
|
||||
} else if ((w->CurAction == aBACK_START) || (w->CurAction == aBACK_LOOP) || (w->CurAction == aBACK_END)) {
|
||||
if (nf >= (ActionStart[aBACK_LOOP] + ActionLen[aBACK_LOOP]))
|
||||
nf = ActionStart[aBACK_LOOP];
|
||||
}
|
||||
else if( ( w->CurAction == aRUN_START ) || ( w->CurAction == aRUN_LOOP ) || ( w->CurAction == aRUN_END ) )
|
||||
{
|
||||
if ( nf >= (ActionStart[aRUN_LOOP]+ActionLen[aRUN_LOOP]) )
|
||||
} else if ((w->CurAction == aRUN_START) || (w->CurAction == aRUN_LOOP) || (w->CurAction == aRUN_END)) {
|
||||
if (nf >= (ActionStart[aRUN_LOOP] + ActionLen[aRUN_LOOP]))
|
||||
nf = ActionStart[aRUN_LOOP];
|
||||
}
|
||||
|
||||
w->NumPathNodes = w->CurrentStep = 0;
|
||||
|
||||
w->WalkSteps[0].curp = w->CurPanel;
|
||||
w->WalkSteps[0].Angle = SinCosAngle( Ch->Dir.x, Ch->Dir.z );
|
||||
w->WalkSteps[0].Angle = SinCosAngle(Ch->Dir.x, Ch->Dir.z);
|
||||
w->WalkSteps[0].Frame = nf;
|
||||
|
||||
w->WalkSteps[0].Pos.x = x1;
|
||||
@ -119,79 +108,72 @@ void SlideChar(int32 oc )
|
||||
}
|
||||
|
||||
/* -----------------07/05/98 11.15-------------------
|
||||
* UpdateChar
|
||||
* UpdateChar
|
||||
* --------------------------------------------------*/
|
||||
void UpdateChar(WGame &game, int32 oc, t3dF32 Speed, t3dF32 Rot )
|
||||
{
|
||||
t3dCHARACTER *Char=Character[oc];
|
||||
t3dWALK *w=&Char->Walk;
|
||||
t3dV3F Pos,tmp;
|
||||
void UpdateChar(WGame &game, int32 oc, t3dF32 Speed, t3dF32 Rot) {
|
||||
t3dCHARACTER *Char = Character[oc];
|
||||
t3dWALK *w = &Char->Walk;
|
||||
t3dV3F Pos, tmp;
|
||||
t3dM3X3F mx;
|
||||
|
||||
if( !Char ) return ;
|
||||
if (!Char) return ;
|
||||
|
||||
if( ( Speed == 0.0f ) && ( w->NumSteps == 0 ) && ( ( w->CurAction != aROT_DX && w->CurAction != aROT_SX ) || ( Rot == 0.0f ) ) )
|
||||
{
|
||||
if( ( Char->Mesh->Flags & T3D_MESH_DEFAULTANIM ) )
|
||||
CharStop( oc );
|
||||
if ((Speed == 0.0f) && (w->NumSteps == 0) && ((w->CurAction != aROT_DX && w->CurAction != aROT_SX) || (Rot == 0.0f))) {
|
||||
if ((Char->Mesh->Flags & T3D_MESH_DEFAULTANIM))
|
||||
CharStop(oc);
|
||||
return;
|
||||
}
|
||||
|
||||
Event(EventClass::MC_MOUSE,ME_MOUSEHIDE,MP_DEFAULT,0,0,0,NULL,NULL,NULL);
|
||||
if ( Char && Speed )
|
||||
CharNextFrame( game, oc );
|
||||
Event(EventClass::MC_MOUSE, ME_MOUSEHIDE, MP_DEFAULT, 0, 0, 0, NULL, NULL, NULL);
|
||||
if (Char && Speed)
|
||||
CharNextFrame(game, oc);
|
||||
|
||||
// Ruota l'omino
|
||||
t3dVectCopy( &tmp, &Char->Dir );tmp.z = -tmp.z; tmp.y = 0.0f;
|
||||
t3dVectAdd( &tmp, &Char->Pos, &tmp );
|
||||
t3dVectCopy(&tmp, &Char->Dir);
|
||||
tmp.z = -tmp.z;
|
||||
tmp.y = 0.0f;
|
||||
t3dVectAdd(&tmp, &Char->Pos, &tmp);
|
||||
t3dMatView(&Char->Mesh->Matrix, &Char->Pos, &tmp);
|
||||
t3dMatRot( &mx, 0.0f, Rot, 0.0f );
|
||||
t3dMatMul( &Char->Mesh->Matrix, &mx, &Char->Mesh->Matrix );
|
||||
t3dMatRot(&mx, 0.0f, Rot, 0.0f);
|
||||
t3dMatMul(&Char->Mesh->Matrix, &mx, &Char->Mesh->Matrix);
|
||||
Char->Mesh->Matrix.Flags &= ~T3D_MATRIX_IDENTITY;
|
||||
|
||||
t3dVectInit( &Char->Dir, 0.0f, 0.0f, -1.0f );
|
||||
t3dVectTransform( &Char->Dir, &Char->Dir, &Char->Mesh->Matrix ); //rotate by Character angle
|
||||
t3dVectInit(&Char->Dir, 0.0f, 0.0f, -1.0f);
|
||||
t3dVectTransform(&Char->Dir, &Char->Dir, &Char->Mesh->Matrix); //rotate by Character angle
|
||||
|
||||
if( Speed )
|
||||
{
|
||||
if (Speed) {
|
||||
FloorHit = 1;
|
||||
Pos.y = CurFloorY;
|
||||
if( Speed > 0.0f )
|
||||
{
|
||||
if ( bFastWalk )
|
||||
{
|
||||
if( ( w->CurFrame >= ActionStart[aRUN_END] ) || ( w->CurFrame < ActionStart[aRUN_START] ) )
|
||||
if (Speed > 0.0f) {
|
||||
if (bFastWalk) {
|
||||
if ((w->CurFrame >= ActionStart[aRUN_END]) || (w->CurFrame < ActionStart[aRUN_START]))
|
||||
w->CurFrame = ActionStart[aRUN_START];
|
||||
}
|
||||
else if( ( w->CurFrame >= ActionStart[aWALK_END] ) || ( w->CurFrame < ActionStart[aWALK_START] ) )
|
||||
} else if ((w->CurFrame >= ActionStart[aWALK_END]) || (w->CurFrame < ActionStart[aWALK_START]))
|
||||
w->CurFrame = ActionStart[aWALK_START];
|
||||
}
|
||||
else if( ( Speed < 0.0f ) && ( ( w->CurFrame >= ActionStart[aBACK_END] ) || ( w->CurFrame < ActionStart[aBACK_START] ) ) )
|
||||
} else if ((Speed < 0.0f) && ((w->CurFrame >= ActionStart[aBACK_END]) || (w->CurFrame < ActionStart[aBACK_START])))
|
||||
w->CurFrame = ActionStart[aBACK_START];
|
||||
Speed = - Char->Mesh->DefaultAnim.Dist[w->CurFrame+1] + Char->Mesh->DefaultAnim.Dist[w->CurFrame];
|
||||
FixupCurAction( ocCURPLAYER );
|
||||
Speed = - Char->Mesh->DefaultAnim.Dist[w->CurFrame + 1] + Char->Mesh->DefaultAnim.Dist[w->CurFrame];
|
||||
FixupCurAction(ocCURPLAYER);
|
||||
|
||||
tmp = Char->Dir * Speed;
|
||||
t3dVectAdd( &Pos, &Char->Pos, &tmp );
|
||||
PlayerPos[CurPlayer+ocDARRELL] = 0;
|
||||
PlayerGotoPos[CurPlayer+ocDARRELL] = 0;
|
||||
CheckCharacterWithBounds( game, oc, &Pos, 0, (uint8)((Speed < 0.0f ) ? 2 : (bFastWalk ? 1 : 0) ) );
|
||||
if( !( Char->Walk.Check & CLICKINTO ) && ( Char->Walk.NumSteps ) )
|
||||
{
|
||||
// fa solo 2 frames: il primo come l'attuale
|
||||
Char->Walk.WalkSteps[1].curp = Char->Walk.WalkSteps[Char->Walk.NumSteps-1].curp;
|
||||
Char->Walk.WalkSteps[0].curp = Char->Walk.WalkSteps[Char->Walk.NumSteps-1].curp;
|
||||
t3dVectAdd(&Pos, &Char->Pos, &tmp);
|
||||
PlayerPos[CurPlayer + ocDARRELL] = 0;
|
||||
PlayerGotoPos[CurPlayer + ocDARRELL] = 0;
|
||||
CheckCharacterWithBounds(game, oc, &Pos, 0, (uint8)((Speed < 0.0f) ? 2 : (bFastWalk ? 1 : 0)));
|
||||
if (!(Char->Walk.Check & CLICKINTO) && (Char->Walk.NumSteps)) {
|
||||
// fa solo 2 frames: il primo come l'attuale
|
||||
Char->Walk.WalkSteps[1].curp = Char->Walk.WalkSteps[Char->Walk.NumSteps - 1].curp;
|
||||
Char->Walk.WalkSteps[0].curp = Char->Walk.WalkSteps[Char->Walk.NumSteps - 1].curp;
|
||||
Char->Walk.WalkSteps[1].Angle = Char->Walk.WalkSteps[0].Angle;
|
||||
Char->Walk.WalkSteps[0].Angle = Char->Walk.WalkSteps[0].Angle;
|
||||
Char->Walk.WalkSteps[2].Act = 0;
|
||||
Char->Walk.NumSteps = 2;
|
||||
Char->Walk.CurrentStep = 0;
|
||||
}
|
||||
else
|
||||
SlideChar( oc );
|
||||
} else
|
||||
SlideChar(oc);
|
||||
|
||||
RemoveEvent( &Game, EventClass::MC_PLAYER, ME_ALL );
|
||||
Event(EventClass::MC_PLAYER,ME_PLAYERGOTO,MP_DEFAULT,0,0,0,NULL,NULL,NULL);
|
||||
RemoveEvent(&Game, EventClass::MC_PLAYER, ME_ALL);
|
||||
Event(EventClass::MC_PLAYER, ME_PLAYERGOTO, MP_DEFAULT, 0, 0, 0, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ bool CharGotoPosition(WGame &game, int32 oc, uint8 pos, uint8 back, int32 anim);
|
||||
void FixPos(int32 oc);
|
||||
void UpdateLook(int32 oc);
|
||||
void BuildStepList(int32 oc, uint8 dp, uint8 back);
|
||||
void UpdateChar(WGame &game, int32 oc, t3dF32 Speed, t3dF32 Rot );
|
||||
void UpdateChar(WGame &game, int32 oc, t3dF32 Speed, t3dF32 Rot);
|
||||
|
||||
} // End of namespace Watchmaker
|
||||
|
||||
|
@ -247,12 +247,12 @@ void UpdateBall(WGame &game, struct SPhys *p) {
|
||||
DisplayDDBitmap(*game._renderer, GopherMap, windowInfo.width - rGetBitmapRealDimX(GopherMap), 0, 0, 0, 0, 0);
|
||||
for (i = 0; i < MAX_GOPHERS; i++)
|
||||
DisplayDDBitmap(*game._renderer, GopherPos[i], windowInfo.width - rGetBitmapRealDimX(GopherMap) +
|
||||
130 + (int32)(Character[i + 1]->Mesh->Trasl.x / 255.0f * 0.341f) - rGetBitmapRealDimX(GopherPos[i]) / 2,
|
||||
146 - (int32)(Character[i + 1]->Mesh->Trasl.z / 255.0f * 0.341f) - rGetBitmapRealDimY(GopherPos[i]) / 2, 0, 0, 0, 0);
|
||||
130 + (int32)(Character[i + 1]->Mesh->Trasl.x / 255.0f * 0.341f) - rGetBitmapRealDimX(GopherPos[i]) / 2,
|
||||
146 - (int32)(Character[i + 1]->Mesh->Trasl.z / 255.0f * 0.341f) - rGetBitmapRealDimY(GopherPos[i]) / 2, 0, 0, 0, 0);
|
||||
if (bGolfMode)
|
||||
DisplayDDBitmap(*game._renderer, GopherBall, windowInfo.width - rGetBitmapRealDimX(GopherMap) +
|
||||
130 + (int32)(Palla50->Mesh->Trasl.x / 255.0f * 0.341f) - rGetBitmapRealDimX(GopherBall) / 2,
|
||||
146 - (int32)(Palla50->Mesh->Trasl.z / 255.0f * 0.341f) - rGetBitmapRealDimY(GopherBall) / 2, 0, 0, 0, 0);
|
||||
130 + (int32)(Palla50->Mesh->Trasl.x / 255.0f * 0.341f) - rGetBitmapRealDimX(GopherBall) / 2,
|
||||
146 - (int32)(Palla50->Mesh->Trasl.z / 255.0f * 0.341f) - rGetBitmapRealDimY(GopherBall) / 2, 0, 0, 0, 0);
|
||||
if ((bGolfMode == 0) || (bGolfMode == 1)) {
|
||||
DebugVideo(*game._renderer, 10, 32, "TimeLeft: %d", (int32)p->TimeLeft);
|
||||
p->TimeLeft -= p->Td;
|
||||
|
@ -26,7 +26,7 @@
|
||||
namespace Watchmaker {
|
||||
|
||||
WatchmakerGame::WatchmakerGame(OSystem *syst, const ADGameDescription *gameDesc) :
|
||||
Engine(syst), _gameDescription(gameDesc), _console(nullptr) {
|
||||
Engine(syst), _gameDescription(gameDesc), _console(nullptr) {
|
||||
}
|
||||
|
||||
WatchmakerGame::~WatchmakerGame() {
|
||||
|
Loading…
Reference in New Issue
Block a user