[Scummvm-cvs-logs] CVS: residual matrix3.cpp,1.4,1.5 matrix4.cpp,1.4,1.5 matrix4.h,1.4,1.5 screen.cpp,1.12,1.13

Pawel Kolodziejski aquadran at users.sourceforge.net
Wed Feb 25 01:01:05 CET 2004


Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29054

Modified Files:
	matrix3.cpp matrix4.cpp matrix4.h screen.cpp 
Log Message:
more cleanup

Index: matrix3.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/matrix3.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- matrix3.cpp	25 Feb 2004 08:21:30 -0000	1.4
+++ matrix3.cpp	25 Feb 2004 08:45:56 -0000	1.5
@@ -18,74 +18,74 @@
 #include <math.h>
 #include "matrix3.h"
 
-void Matrix3::setAsIdentity( void ) {
+void Matrix3::setAsIdentity() {
 	right_.set(1.f, 0.f, 0.f);
 	up_.set(0.f, 1.f, 0.f);
 	at_.set(0.f, 0.f, 0.f);
 }
 
-void Matrix3::buildFromPitchYawRoll( float pitch, float yaw, float roll ) {
+void Matrix3::buildFromPitchYawRoll(float pitch, float yaw, float roll) {
 	Matrix3 temp1, temp2;
 
-	temp1.constructAroundPitch( pitch );
-	constructAroundRoll( roll );
+	temp1.constructAroundPitch(pitch);
+	constructAroundRoll(roll);
 
 	(*this) *= temp1;
 
-	temp2.constructAroundYaw( yaw );
+	temp2.constructAroundYaw(yaw);
 
 	(*this) *= temp2;
 }
 
-#define MYPI		3.141592654 
-#define DEGTORAD(a)	(a*MYPI/180.0) 
-#define RADTODEG(a)	(a*180.0/MYPI) 
+#define MYPI 3.14159265358979323846
+#define DEGTORAD(a) (a * MYPI / 180.0) 
+#define RADTODEG(a) (a * 180.0 / MYPI) 
 
-float RadianToDegree( float rad ) {
+float RadianToDegree(float rad) {
 	return RADTODEG(rad);
 }
 
-float DegreeToRadian( float degrees ) {
+float DegreeToRadian(float degrees) {
 	return DEGTORAD(degrees);
 }
 
 // right
-void Matrix3::constructAroundPitch( float pitch ) {
+void Matrix3::constructAroundPitch(float pitch) {
 	float cosa;
 	float sina;
 
-	cosa = (float)cos( DegreeToRadian(pitch) );
-	sina = (float)sin( DegreeToRadian(pitch) );
+	cosa = (float)cos(DegreeToRadian(pitch));
+	sina = (float)sin(DegreeToRadian(pitch));
 
-	right_.set( 1.f, 0.f, 0.f );
-	up_.set( 0.f, cosa, -sina );
-	at_.set( 0.f, sina, cosa );
+	right_.set(1.f, 0.f, 0.f);
+	up_.set(0.f, cosa, -sina);
+	at_.set(0.f, sina, cosa);
 }
 
 // up
-void Matrix3::constructAroundYaw( float yaw ) {
+void Matrix3::constructAroundYaw(float yaw) {
 	float cosa;
 	float sina;
 
-	cosa = (float)cos( DegreeToRadian(yaw) );
-	sina = (float)sin( DegreeToRadian(yaw) );
+	cosa = (float)cos(DegreeToRadian(yaw));
+	sina = (float)sin(DegreeToRadian(yaw));
 
-	right_.set( cosa, 0.f, sina );
-	up_.set( 0.f, 1.f, 0.f );
-	at_.set( -sina, 0.f, cosa );
+	right_.set(cosa, 0.f, sina);
+	up_.set(0.f, 1.f, 0.f);
+	at_.set(-sina, 0.f, cosa);
 }
 
 // at
-void Matrix3::constructAroundRoll( float roll ) {
+void Matrix3::constructAroundRoll(float roll) {
 	float cosa;
 	float sina;
 
-	cosa = (float)cos( DegreeToRadian(roll) );
-	sina = (float)sin( DegreeToRadian(roll) );
+	cosa = (float)cos(DegreeToRadian(roll));
+	sina = (float)sin(DegreeToRadian(roll));
 
-	right_.set( cosa, -sina, 0.f );
-	up_.set( sina, cosa, 0.f );
-	at_.set( 0.f, 0.f, 1.f );
+	right_.set(cosa, -sina, 0.f);
+	up_.set(sina, cosa, 0.f);
+	at_.set(0.f, 0.f, 1.f);
 }
 
 /*
@@ -95,7 +95,7 @@
 */
 
 // WARNING: Still buggy in some occasions.
-void Matrix3::getPitchYawRoll( float* pPitch, float* pYaw, float* pRoll ) {
+void Matrix3::getPitchYawRoll(float* pPitch, float* pYaw, float* pRoll) {
 	float D;
 	float C;
 	float ftrx;
@@ -104,13 +104,13 @@
 	float angle_y;
 	float angle_z;
 
-	angle_y = D =  asin( right_.z() );        /* Calculate Y-axis angle */
-	C			=  cos( angle_y );
-	angle_y		=  RadianToDegree( angle_y );
+	angle_y = D = asin(right_.z());        /* Calculate Y-axis angle */
+	C			= cos(angle_y);
+	angle_y		= RadianToDegree(angle_y);
 
-	if ( fabs( C ) > 0.005 ) {            /* Gimball lock? */
+	if (fabs( C ) > 0.005) {            /* Gimball lock? */
 		ftrx		=  at_.z() / C;           /* No, so get X-axis angle */
-		ftry		= -up_.z()  / C;
+		ftry		= -up_.z() / C;
 
 		angle_x		= RadianToDegree(atan2( ftry, ftrx ));
 
@@ -121,10 +121,10 @@
 	} else {                                 /* Gimball lock has occurred */
 		angle_x		= 0;                      /* Set X-axis angle to zqero */
 
-		ftrx		=  up_.y();                 /* And calculate Z-axis angle */
-		ftry		=  up_.x();
+		ftrx		= up_.y();                 /* And calculate Z-axis angle */
+		ftry		= up_.x();
 
-		angle_z  = RadianToDegree(atan2( ftry, ftrx ));
+		angle_z  = RadianToDegree(atan2(ftry, ftrx));
 	}
 
 	/* return only positive angles in [0,360] */
@@ -145,7 +145,7 @@
 float Matrix3::getPitch() {
 	float pitch;
 
-	getPitchYawRoll( &pitch, 0, 0);
+	getPitchYawRoll(&pitch, 0, 0);
 
 	return pitch;
 }
@@ -153,7 +153,7 @@
 float Matrix3::getYaw() {
 	float yaw;
 
-	getPitchYawRoll( 0, &yaw, 0);
+	getPitchYawRoll(0, &yaw, 0);
 
 	return yaw;
 }
@@ -161,20 +161,20 @@
 float Matrix3::getRoll() {
 	float roll;
 
-	getPitchYawRoll( 0, 0, &roll);
+	getPitchYawRoll(0, 0, &roll);
 
 	return roll;
 }
 
-void Matrix3::transform( Vector3d* v ) {
+void Matrix3::transform(Vector3d* v) {
 	float x;
 	float y;
 	float z;
 
-	x = v->dotProduct( right_.x(), up_.x(), at_.x() );
-	y = v->dotProduct( right_.x(), up_.x(), at_.x() );
-	z = v->dotProduct( right_.x(), up_.x(), at_.x() );
+	x = v->dotProduct(right_.x(), up_.x(), at_.x());
+	y = v->dotProduct(right_.x(), up_.x(), at_.x());
+	z = v->dotProduct(right_.x(), up_.x(), at_.x());
 
-	v->set( x, y, z );
+	v->set(x, y, z);
 }
 

Index: matrix4.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/matrix4.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- matrix4.cpp	25 Feb 2004 08:21:30 -0000	1.4
+++ matrix4.cpp	25 Feb 2004 08:45:56 -0000	1.5
@@ -18,16 +18,16 @@
 #include "matrix4.h"
 
 Matrix4::Matrix4( void ) {
-	pos_.set( 0.f, 0.f, 0.f );
+	pos_.set(0.f, 0.f, 0.f);
 	rot_.setAsIdentity();
 }
 
-void Matrix4::translate( float x, float y, float z ) {
+void Matrix4::translate(float x, float y, float z) {
 	Vector3d v;
 
-	v.set( x, y, z );
+	v.set(x, y, z);
 
-	rot_.transform( &v );
+	rot_.transform(&v);
 
 	pos_ += v;
 }

Index: matrix4.h
===================================================================
RCS file: /cvsroot/scummvm/residual/matrix4.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- matrix4.h	25 Feb 2004 08:21:30 -0000	1.4
+++ matrix4.h	25 Feb 2004 08:45:56 -0000	1.5
@@ -22,12 +22,12 @@
 #include "matrix3.h"
 
 // matrix 4 is a rotation matrix + position
-class Matrix4{
+class Matrix4 {
 public:
 	Matrix3 rot_;
 	Vector3d pos_;
 
-	Matrix4( void );
+	Matrix4();
 
 	Matrix4& operator =(const Matrix4& s) {
 		pos_ = s.pos_;
@@ -40,7 +40,7 @@
 		Vector3d v;
 
 		v = s.pos_;
-		rot_.transform( &v );
+		rot_.transform(&v);
 
 		pos_+=v;
 
@@ -49,7 +49,7 @@
 		return *this;
 	}
 
-	void translate( float x, float y, float z );
+	void translate(float x, float y, float z);
 
 private:
 };

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/screen.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- screen.cpp	25 Feb 2004 08:23:46 -0000	1.12
+++ screen.cpp	25 Feb 2004 08:45:56 -0000	1.13
@@ -43,7 +43,7 @@
 	writePtr = (char *)buffer;
 
 	for(i = 0; i < 16; i++) {
-		readPtr = zbuffer + (y*16+i) * 640 + (x * 16);
+		readPtr = zbuffer + (y * 16 + i) * 640 + (x * 16);
 		for(j = 0; j < 16; j++) {
 			*(writePtr++) = *(readPtr++);
 			*(writePtr++) = *(readPtr++);
@@ -126,11 +126,11 @@
 	firstTop = top /16;
 
 	width = (right - left) / 16;
-	if((right-left)%16)
+	if((right-left) % 16)
 		width++;
 
 	height = (bottom - top) / 16;
-	if((bottom - top)%16)
+	if((bottom - top) % 16)
 		height++;
 
 	// temp hack
@@ -165,14 +165,14 @@
 	glEnable(GL_BLEND);
 	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
-	for(i = 0; i< 40; i++) {
+	for(i = 0; i < 40; i++) {
 		for(j = 0;j < 30; j++) {
 			if(screenBlockData[i][j].isDirty) {
 				glBegin(GL_QUADS);
-				glVertex2i(i*16,j*16);
-				glVertex2i((i+1)*16,j*16);
-				glVertex2i((i+1)*16,(j+1)*16);
-				glVertex2i(i*16,(j+1)*16);
+				glVertex2i(i * 16, j * 16);
+				glVertex2i((i + 1) * 16, j * 16);
+				glVertex2i((i + 1) * 16, (j + 1) * 16);
+				glVertex2i(i * 16,(j + 1)*16);
 				glEnd();
 			}
 		}
@@ -208,8 +208,8 @@
 					width++;
 				}
 				for (int y = 0; y < 16; y++) {
-					glRasterPos2i(start*16, j*16 + y + 1);
-					glDrawPixels(16*width, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, dataTemp+((j*16 +y) * 640)+(start*16));
+					glRasterPos2i(start * 16, j * 16 + y + 1);
+					glDrawPixels(16 * width, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, dataTemp+((j*16 +y) * 640)+(start*16));
 				}
 			}
 		}





More information about the Scummvm-git-logs mailing list