Applied patch by zeromus. It seems ok to me so I giving him CVS

write access.
This commit is contained in:
yabause 2008-08-25 19:53:20 +00:00
parent a72d446ba6
commit 88611b638e
2 changed files with 57 additions and 13 deletions

View File

@ -2,7 +2,7 @@ Installation Instructions
************************* *************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006 Free Software Foundation, Inc. 2006, 2007 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it. unlimited permission to copy, distribute and modify it.
@ -67,6 +67,9 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came all sorts of other programs in order to regenerate files that came
with the distribution. with the distribution.
6. Often, you can also type `make uninstall' to remove the installed
files again.
Compilers and Options Compilers and Options
===================== =====================

View File

@ -406,28 +406,51 @@ void NDS_glLoadMatrix4x3(signed long v)
void NDS_glStoreMatrix(unsigned long v) void NDS_glStoreMatrix(unsigned long v)
{ {
MatrixStackLoadMatrix (&mtxStack[mode], v&31, mtxCurrent[mode]); //this command always works on both pos and vector when either pos or pos-vector are the current mtx mode
short mymode = (mode==1?2:mode);
//for the projection matrix, the provided value is supposed to be reset to zero
if(mymode==0)
v = 0;
MatrixStackLoadMatrix (&mtxStack[mymode], v&31, mtxCurrent[mymode]);
if(mymode==2)
MatrixStackLoadMatrix (&mtxStack[1], v&31, mtxCurrent[1]);
} }
void NDS_glRestoreMatrix(unsigned long v) void NDS_glRestoreMatrix(unsigned long v)
{ {
MatrixCopy (mtxCurrent[mode], MatrixStackGetPos(&mtxStack[mode], v&31)); //this command always works on both pos and vector when either pos or pos-vector are the current mtx mode
short mymode = (mode==1?2:mode);
if (mode == 2) //for the projection matrix, the provided value is supposed to be reset to zero
MatrixCopy (mtxCurrent[1], mtxCurrent[2]); if(mymode==0)
v = 0;
MatrixCopy (mtxCurrent[mymode], MatrixStackGetPos(&mtxStack[mymode], v&31));
if (mymode == 2)
MatrixCopy (mtxCurrent[1], MatrixStackGetPos(&mtxStack[1], v&31));
} }
void NDS_glPushMatrix (void) void NDS_glPushMatrix (void)
{ {
MatrixStackPushMatrix (&mtxStack[mode], mtxCurrent[mode]); //this command always works on both pos and vector when either pos or pos-vector are the current mtx mode
short mymode = (mode==1?2:mode);
MatrixStackPushMatrix (&mtxStack[mymode], mtxCurrent[mymode]);
if(mymode==2)
MatrixStackPushMatrix (&mtxStack[1], mtxCurrent[1]);
} }
void NDS_glPopMatrix(signed long i) void NDS_glPopMatrix(signed long i)
{ {
//this command always works on both pos and vector when either pos or pos-vector are the current mtx mode
short mymode = (mode==1?2:mode);
MatrixCopy (mtxCurrent[mode], MatrixStackPopMatrix (&mtxStack[mode], i)); MatrixCopy (mtxCurrent[mode], MatrixStackPopMatrix (&mtxStack[mode], i));
if (mode == 2) if (mymode == 2)
MatrixCopy (mtxCurrent[1], mtxCurrent[2]); MatrixCopy (mtxCurrent[1], MatrixStackPopMatrix (&mtxStack[1], i));
} }
void NDS_glTranslate(signed long v) void NDS_glTranslate(signed long v)
@ -449,6 +472,8 @@ void NDS_glTranslate(signed long v)
void NDS_glScale(signed long v) void NDS_glScale(signed long v)
{ {
short mymode = (mode==2?1:mode);
scale[scaleind] = fix2float(v); scale[scaleind] = fix2float(v);
++scaleind; ++scaleind;
@ -458,10 +483,13 @@ void NDS_glScale(signed long v)
scaleind = 0; scaleind = 0;
MatrixScale (mtxCurrent[mode], scale); MatrixScale (mtxCurrent[mymode], scale);
if (mode == 2) //note: pos-vector mode should not cause both matrices to scale.
MatrixScale (mtxCurrent[1], scale); //the whole purpose is to keep the vector matrix orthogonal
//so, I am leaving this commented out as an example of what not to do.
//if (mode == 2)
// MatrixScale (mtxCurrent[1], scale);
} }
void NDS_glMultMatrix3x3(signed long v) void NDS_glMultMatrix3x3(signed long v)
@ -778,7 +806,17 @@ __forceinline void SetupTexture (unsigned int format, unsigned int palette)
} }
} }
} }
} }
//zero debug - dump tex4x4 to verify contents
//{
// static int ctr = 0;
// char fname[100];
// FILE* outf;
// sprintf(fname,"d:\\dump\\%d.bmp", ctr);
// ctr++;
// NDS_WriteBMP_32bppBuffer(sizeX,sizeY,texMAP,fname);
//}
break; break;
} }
@ -954,6 +992,9 @@ static __inline void SetVertex()
MatrixMultVec4x4 (mtxCurrent[1], coordTransformed); MatrixMultVec4x4 (mtxCurrent[1], coordTransformed);
glVertex3fv (coordTransformed); glVertex3fv (coordTransformed);
//zero - helpful in making sure vertex colors or lighting arent broken
//glColor3ub(rand()&255,rand()&255,rand()&255);
numVertex++; numVertex++;
} }
@ -1372,7 +1413,7 @@ void NDS_glCallList(unsigned long v)
NDS_glLoadIdentity(); NDS_glLoadIdentity();
--clInd; --clInd;
clCmd>>=8; clCmd>>=8;
break; continue;
} }
case 0x41: case 0x41: