Skip to content

Commit

Permalink
math and fileformats are now ready
Browse files Browse the repository at this point in the history
  • Loading branch information
psi29a committed Apr 4, 2018
1 parent 0a5f81f commit 5096fcb
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion fileformats/CellLoader_Daggerfall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,8 @@ Sector *CellLoader_Daggerfall::LoadBlock_Ext(IDriver3D *pDriver, u32 uLength, ch
Matrix mBlockRot;
float zAngle = -(float)pBlockPos[j].Angle * MATH_PI_OVER_2/512.0f;
mBlockRot.Identity();
mBlockRot.AxisAngle( Vector3(0, 0, 1), zAngle );
Vector3 vAngel = Vector3(0, 0, 1);
mBlockRot.AxisAngle( vAngel , zAngle );
Vector3 vBlockOffs = Vector3((float)pBlockPos[j].XPos2 * fFP_Scale, (float)pBlockPos[j].YPos2 * fFP_Scale, 0.0f);
Vector3 vOutPos = mBlockRot.TransformVector(vPos);
vPos = vOutPos + vBlockOffs;
Expand Down
4 changes: 2 additions & 2 deletions fileformats/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ bool Parser::SearchKeyword_Str(const char *pszKeyword, char *pszOut, bool bEndOn
bCommentStarted = false;
}
}
else if ( bCommentStarted == false && _strnicmp(&m_pMemory[c], pszKeyword, strlen(pszKeyword)) == 0 )
else if ( bCommentStarted == false && strnicmp(&m_pMemory[c], pszKeyword, strlen(pszKeyword)) == 0 )
{
//now search for a number or end of the line.
for (cc=c+(s32)strlen(pszKeyword), i=0; m_pMemory[cc] != '\r' && m_pMemory[cc] != '#' && ((m_pMemory[cc] != ' ' && m_pMemory[cc] != 9) || !bStartSpace || (!bEndOnSpace && nSpaceCnt<maxSpaceCnt)); cc++)
Expand Down Expand Up @@ -171,7 +171,7 @@ bool Parser::SearchKeyword_F1(const char *pszKeyword, f32& rfValue)
s32 i, c, cc;
for (c=(s32)m_uFilePtr; c<(s32)m_uLength; c++)
{
if ( (!pszKeyword) || _strnicmp(&m_pMemory[c], pszKeyword, strlen(pszKeyword)) == 0 )
if ( (!pszKeyword) || strnicmp(&m_pMemory[c], pszKeyword, strlen(pszKeyword)) == 0 )
{
//now search for a number or end of the line.
for (cc=c+(int)strlen(pszKeyword), i=0; m_pMemory[cc] != '\r' && m_pMemory[cc] != '#' && ((m_pMemory[cc] != ' ' && m_pMemory[cc] != 9) || !bStartSpace); cc++, i++)
Expand Down
1 change: 1 addition & 0 deletions fileformats/TextureConv_IMG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "../fileformats/TextureLoader.h"
#include "../math/Math.h"
#include <assert.h>
#include <cstring>

enum
{
Expand Down
1 change: 1 addition & 0 deletions fileformats/TextureConv_PCX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "../memory/ScratchPad.h"
#include "../fileformats/TextureLoader.h"
#include <assert.h>
#include <cstring>

TextureConv_PCX::TextureConv_PCX() : TextureConverter()
{
Expand Down
3 changes: 2 additions & 1 deletion fileformats/TextureLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "../memory/ScratchPad.h"
#include "../ui/XL_Console.h"
#include <assert.h>
#include <cstring>

#define MAX_PAL_COUNT 32
#define MAX_COLORMAP_COUNT 32
Expand Down Expand Up @@ -226,7 +227,7 @@ bool TextureLoader::LoadTexture_Mem(const u8 *pImgBuffer, u32 uPalIndex, u32 wid
u32 uDataSize = width*height;
if ( m_uTexColorDepth == 32 ) uDataSize *= 4;
m_pConvertedData = (u8 *)ScratchPad::AllocMem( uDataSize );
if ( m_pConvertedData == false )
if ( !(m_pConvertedData != NULL) )
return false;

if ( m_uTexColorDepth == 32 )
Expand Down
9 changes: 6 additions & 3 deletions math/Matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,12 @@ void Matrix::AxisAngle(Vector3& axis, f32 angle)

void Matrix::EulerToMatrix(f32 yaw, f32 pitch, f32 roll)
{
this->AxisAngle( Vector3(1,0,0), -pitch );
this->AxisAngle( Vector3(0,1,0), yaw );
this->AxisAngle( Vector3(0,0,1), roll );
Vector3 vPitch = Vector3(1,0,0);
Vector3 vYaw = Vector3(0,1,0);
Vector3 vRoll = Vector3(0,0,1);
this->AxisAngle( vPitch, -pitch );
this->AxisAngle( vYaw, yaw );
this->AxisAngle( vRoll, roll );
}

void Matrix::Scale(Vector3& scale)
Expand Down

0 comments on commit 5096fcb

Please sign in to comment.