diff options
| author | SND\dario86_cp <SND\dario86_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-03-12 18:54:28 +0000 |
|---|---|---|
| committer | SND\dario86_cp <SND\dario86_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-03-12 18:54:28 +0000 |
| commit | a58cfdac407bc1d8fedc11acd924b275ba28cc51 (patch) | |
| tree | b4c2e08c34ef1bfe0ba947ef8eed931c9a43fc0e /plugins/peopsxgl/prim.c | |
| parent | 9bdd06684bcc627c06ddcf4c406f6b48f0dfe389 (diff) | |
| download | pcsxr-a58cfdac407bc1d8fedc11acd924b275ba28cc51.tar.gz | |
Commited patch in issue #8171 (by darktjm).
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@64524 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins/peopsxgl/prim.c')
| -rw-r--r-- | plugins/peopsxgl/prim.c | 1869 |
1 files changed, 935 insertions, 934 deletions
diff --git a/plugins/peopsxgl/prim.c b/plugins/peopsxgl/prim.c index 323b1d81..3ee37c27 100644 --- a/plugins/peopsxgl/prim.c +++ b/plugins/peopsxgl/prim.c @@ -1,21 +1,21 @@ -/***************************************************************************
- prim.c - description
- -------------------
- begin : Sun Mar 08 2009
- copyright : (C) 1999-2009 by Pete Bernert
- web : www.pbernert.com
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. See also the license.txt file for *
- * additional informations. *
- * *
- ***************************************************************************/
-
+/*************************************************************************** + prim.c - description + ------------------- + begin : Sun Mar 08 2009 + copyright : (C) 1999-2009 by Pete Bernert + web : www.pbernert.com + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. See also the license.txt file for * + * additional informations. * + * * + ***************************************************************************/ + #include "stdafx.h" #define _IN_PRIMDRAW @@ -25,6 +25,7 @@ #include "draw.h" #include "soft.h" #include "texture.h" +#include "prim.h" //////////////////////////////////////////////////////////////////////// // defines @@ -37,77 +38,77 @@ // globals //////////////////////////////////////////////////////////////////////// -BOOL bDrawTextured; // current active drawing states
+BOOL bDrawTextured; // current active drawing states BOOL bDrawSmoothShaded; BOOL bOldSmoothShaded; BOOL bDrawNonShaded; BOOL bDrawMultiPass; int iOffscreenDrawing; int iDrawnSomething=0; -
-BOOL bRenderFrontBuffer=FALSE; // flag for front buffer rendering
- -GLubyte ubGloAlpha; // texture alpha
-GLubyte ubGloColAlpha; // color alpha
-int iFilterType; // type of filter
-BOOL bFullVRam=FALSE; // sign for tex win
-BOOL bDrawDither; // sign for dither
-BOOL bUseMultiPass; // sign for multi pass
-GLuint gTexName; // binded texture
-BOOL bTexEnabled; // texture enable flag
-BOOL bBlendEnable; // blend enable flag
-PSXRect_t xrUploadArea; // rect to upload
-PSXRect_t xrUploadAreaIL; // rect to upload
-PSXRect_t xrUploadAreaRGB24; // rect to upload rgb24
-int iSpriteTex=0; // flag for "hey, it's a sprite"
-unsigned short usMirror; // mirror, mirror on the wall
- -BOOL bNeedUploadAfter=FALSE; // sign for uploading in next frame
-BOOL bNeedUploadTest=FALSE; // sign for upload test
-BOOL bUsingTWin=FALSE; // tex win active flag
-BOOL bUsingMovie=FALSE; // movie active flag
-PSXRect_t xrMovieArea; // rect for movie upload
-short sSprite_ux2; // needed for sprire adjust
-short sSprite_vy2; //
-uint32_t ulOLDCOL=0; // active color
-uint32_t ulClutID; // clut
- -uint32_t dwCfgFixes; // game fixes
-uint32_t dwActFixes=0;
+ +BOOL bRenderFrontBuffer=FALSE; // flag for front buffer rendering + +GLubyte ubGloAlpha; // texture alpha +GLubyte ubGloColAlpha; // color alpha +int iFilterType; // type of filter +BOOL bFullVRam=FALSE; // sign for tex win +BOOL bDrawDither; // sign for dither +BOOL bUseMultiPass; // sign for multi pass +GLuint gTexName; // binded texture +BOOL bTexEnabled; // texture enable flag +BOOL bBlendEnable; // blend enable flag +PSXRect_t xrUploadArea; // rect to upload +PSXRect_t xrUploadAreaIL; // rect to upload +PSXRect_t xrUploadAreaRGB24; // rect to upload rgb24 +int iSpriteTex=0; // flag for "hey, it's a sprite" +unsigned short usMirror; // mirror, mirror on the wall + +BOOL bNeedUploadAfter=FALSE; // sign for uploading in next frame +BOOL bNeedUploadTest=FALSE; // sign for upload test +BOOL bUsingTWin=FALSE; // tex win active flag +BOOL bUsingMovie=FALSE; // movie active flag +PSXRect_t xrMovieArea; // rect for movie upload +short sSprite_ux2; // needed for sprire adjust +short sSprite_vy2; // +uint32_t ulOLDCOL=0; // active color +uint32_t ulClutID; // clut + +uint32_t dwCfgFixes; // game fixes +uint32_t dwActFixes=0; uint32_t dwEmuFixes=0; -BOOL bUseFixes;
+BOOL bUseFixes; -int drawX,drawY,drawW,drawH; // offscreen drawing checkers
+int drawX,drawY,drawW,drawH; // offscreen drawing checkers short sxmin,sxmax,symin,symax; //////////////////////////////////////////////////////////////////////// // Update global TP infos //////////////////////////////////////////////////////////////////////// -void UpdateGlobalTP(unsigned short gdata) +static void UpdateGlobalTP(unsigned short gdata) { GlobalTextAddrX = (gdata << 6) & 0x3c0; - if(iGPUHeight==1024) // ZN mode
- {
- if(dwGPUVersion==2) // very special zn gpu
- {
- GlobalTextAddrY =((gdata & 0x60 ) << 3);
- GlobalTextIL =(gdata & 0x2000) >> 13;
- GlobalTextABR = (unsigned short)((gdata >> 7) & 0x3);
- GlobalTextTP = (gdata >> 9) & 0x3;
- if(GlobalTextTP==3) GlobalTextTP=2;
- GlobalTexturePage = (GlobalTextAddrX>>6)+(GlobalTextAddrY>>4);
- usMirror =0;
- STATUSREG = (STATUSREG & 0xffffe000 ) | (gdata & 0x1fff );
- return;
- }
- else // "enhanced" psx gpu
- {
- GlobalTextAddrY = (unsigned short)(((gdata << 4) & 0x100) | ((gdata >> 2) & 0x200));
- }
- }
- else GlobalTextAddrY = (gdata << 4) & 0x100; // "normal" psx gpu
+ if(iGPUHeight==1024) // ZN mode + { + if(dwGPUVersion==2) // very special zn gpu + { + GlobalTextAddrY =((gdata & 0x60 ) << 3); + GlobalTextIL =(gdata & 0x2000) >> 13; + GlobalTextABR = (unsigned short)((gdata >> 7) & 0x3); + GlobalTextTP = (gdata >> 9) & 0x3; + if(GlobalTextTP==3) GlobalTextTP=2; + GlobalTexturePage = (GlobalTextAddrX>>6)+(GlobalTextAddrY>>4); + usMirror =0; + STATUSREG = (STATUSREG & 0xffffe000 ) | (gdata & 0x1fff ); + return; + } + else // "enhanced" psx gpu + { + GlobalTextAddrY = (unsigned short)(((gdata << 4) & 0x100) | ((gdata >> 2) & 0x200)); + } + } + else GlobalTextAddrY = (gdata << 4) & 0x100; // "normal" psx gpu usMirror=gdata&0x3000; @@ -121,7 +122,7 @@ void UpdateGlobalTP(unsigned short gdata) STATUSREG|=(gdata & 0x07ff); // set the necessary bits } -unsigned int DoubleBGR2RGB (unsigned int BGR) +static unsigned int DoubleBGR2RGB (unsigned int BGR) { unsigned int ebx,eax,edx; @@ -137,7 +138,7 @@ unsigned int DoubleBGR2RGB (unsigned int BGR) return (ebx|eax|edx); } -unsigned short BGR24to16 (uint32_t BGR) +static unsigned short BGR24to16 (uint32_t BGR) { return ((BGR>>3)&0x1f)|((BGR&0xf80000)>>9)|((BGR&0xf800)>>6); } @@ -146,7 +147,7 @@ unsigned short BGR24to16 (uint32_t BGR) // OpenGL primitive drawing commands //////////////////////////////////////////////////////////////////////// -__inline void PRIMdrawTexturedQuad(OGLVertex* vertex1, OGLVertex* vertex2, +static __inline void PRIMdrawTexturedQuad(OGLVertex* vertex1, OGLVertex* vertex2, OGLVertex* vertex3, OGLVertex* vertex4) { glBegin(GL_TRIANGLE_STRIP); @@ -166,7 +167,7 @@ __inline void PRIMdrawTexturedQuad(OGLVertex* vertex1, OGLVertex* vertex2, ///////////////////////////////////////////////////////// -__inline void PRIMdrawTexturedTri(OGLVertex* vertex1, OGLVertex* vertex2, +static __inline void PRIMdrawTexturedTri(OGLVertex* vertex1, OGLVertex* vertex2, OGLVertex* vertex3) { glBegin(GL_TRIANGLES); @@ -183,7 +184,7 @@ __inline void PRIMdrawTexturedTri(OGLVertex* vertex1, OGLVertex* vertex2, ///////////////////////////////////////////////////////// -__inline void PRIMdrawTexGouraudTriColor(OGLVertex* vertex1, OGLVertex* vertex2, +static __inline void PRIMdrawTexGouraudTriColor(OGLVertex* vertex1, OGLVertex* vertex2, OGLVertex* vertex3) { glBegin(GL_TRIANGLES); @@ -204,7 +205,7 @@ __inline void PRIMdrawTexGouraudTriColor(OGLVertex* vertex1, OGLVertex* vertex2, ///////////////////////////////////////////////////////// -__inline void PRIMdrawTexGouraudTriColorQuad(OGLVertex* vertex1, OGLVertex* vertex2, +static __inline void PRIMdrawTexGouraudTriColorQuad(OGLVertex* vertex1, OGLVertex* vertex2, OGLVertex* vertex3, OGLVertex* vertex4) { glBegin(GL_TRIANGLE_STRIP); @@ -228,7 +229,7 @@ __inline void PRIMdrawTexGouraudTriColorQuad(OGLVertex* vertex1, OGLVertex* vert ///////////////////////////////////////////////////////// -__inline void PRIMdrawTri(OGLVertex* vertex1, OGLVertex* vertex2, OGLVertex* vertex3) +static __inline void PRIMdrawTri(OGLVertex* vertex1, OGLVertex* vertex2, OGLVertex* vertex3) { glBegin(GL_TRIANGLES); glVertex3fv(&vertex1->x); @@ -239,7 +240,7 @@ __inline void PRIMdrawTri(OGLVertex* vertex1, OGLVertex* vertex2, OGLVertex* ver ///////////////////////////////////////////////////////// -__inline void PRIMdrawTri2(OGLVertex* vertex1, OGLVertex* vertex2, +static __inline void PRIMdrawTri2(OGLVertex* vertex1, OGLVertex* vertex2, OGLVertex* vertex3, OGLVertex* vertex4) { glBegin(GL_TRIANGLE_STRIP); @@ -252,7 +253,7 @@ __inline void PRIMdrawTri2(OGLVertex* vertex1, OGLVertex* vertex2, ///////////////////////////////////////////////////////// -__inline void PRIMdrawGouraudTriColor(OGLVertex* vertex1, OGLVertex* vertex2, +static __inline void PRIMdrawGouraudTriColor(OGLVertex* vertex1, OGLVertex* vertex2, OGLVertex* vertex3) { glBegin(GL_TRIANGLES); @@ -269,7 +270,7 @@ __inline void PRIMdrawGouraudTriColor(OGLVertex* vertex1, OGLVertex* vertex2, ///////////////////////////////////////////////////////// -__inline void PRIMdrawGouraudTri2Color(OGLVertex* vertex1, OGLVertex* vertex2, +static __inline void PRIMdrawGouraudTri2Color(OGLVertex* vertex1, OGLVertex* vertex2, OGLVertex* vertex3, OGLVertex* vertex4) { glBegin(GL_TRIANGLE_STRIP); @@ -289,7 +290,7 @@ __inline void PRIMdrawGouraudTri2Color(OGLVertex* vertex1, OGLVertex* vertex2, ///////////////////////////////////////////////////////// -__inline void PRIMdrawFlatLine(OGLVertex* vertex1, OGLVertex* vertex2,OGLVertex* vertex3, OGLVertex* vertex4) +static __inline void PRIMdrawFlatLine(OGLVertex* vertex1, OGLVertex* vertex2,OGLVertex* vertex3, OGLVertex* vertex4) { glBegin(GL_QUADS); @@ -304,7 +305,7 @@ __inline void PRIMdrawFlatLine(OGLVertex* vertex1, OGLVertex* vertex2,OGLVertex* ///////////////////////////////////////////////////////// -__inline void PRIMdrawGouraudLine(OGLVertex* vertex1, OGLVertex* vertex2,OGLVertex* vertex3, OGLVertex* vertex4) +static __inline void PRIMdrawGouraudLine(OGLVertex* vertex1, OGLVertex* vertex2,OGLVertex* vertex3, OGLVertex* vertex4) { glBegin(GL_QUADS); @@ -324,7 +325,7 @@ __inline void PRIMdrawGouraudLine(OGLVertex* vertex1, OGLVertex* vertex2,OGLVert ///////////////////////////////////////////////////////// -__inline void PRIMdrawQuad(OGLVertex* vertex1, OGLVertex* vertex2, +static __inline void PRIMdrawQuad(OGLVertex* vertex1, OGLVertex* vertex2, OGLVertex* vertex3, OGLVertex* vertex4) { glBegin(GL_QUADS); @@ -354,12 +355,12 @@ SemiTransParams TransSets[4]= {GL_SRC_ALPHA,GL_SRC_ALPHA, 127}, {GL_ONE, GL_ONE, 255}, {GL_ZERO, GL_ONE_MINUS_SRC_COLOR,255}, - {GL_ONE_MINUS_SRC_ALPHA,GL_ONE, 192}
+ {GL_ONE_MINUS_SRC_ALPHA,GL_ONE, 192} }; //////////////////////////////////////////////////////////////////////// -void SetSemiTrans(void) +static void SetSemiTrans(void) { /* * 0.5 x B + 0.5 x F @@ -372,7 +373,7 @@ void SetSemiTrans(void) { if(bBlendEnable) {glDisable(GL_BLEND);bBlendEnable=FALSE;} // -> don't wanna blend - ubGloAlpha=ubGloColAlpha=255; // -> full alpha
+ ubGloAlpha=ubGloColAlpha=255; // -> full alpha return; // -> and bye } @@ -388,7 +389,7 @@ void SetSemiTrans(void) { obm1=TransSets[GlobalTextABR].srcFac; obm2=TransSets[GlobalTextABR].dstFac; - glBlendFunc(obm1,obm2); // set blend func
+ glBlendFunc(obm1,obm2); // set blend func } else if(TransSets[GlobalTextABR].dstFac !=GL_ONE_MINUS_SRC_COLOR) @@ -397,19 +398,19 @@ void SetSemiTrans(void) glBlendEquationEXTEx(FUNC_ADD_EXT); obm1=TransSets[GlobalTextABR].srcFac; obm2=TransSets[GlobalTextABR].dstFac; - glBlendFunc(obm1,obm2); // set blend func
+ glBlendFunc(obm1,obm2); // set blend func } else { glBlendEquationEXTEx(FUNC_REVERSESUBTRACT_EXT); obm1=TransSets[GlobalTextABR].srcFac; obm2=TransSets[GlobalTextABR].dstFac; - glBlendFunc(GL_ONE,GL_ONE); // set blend func
+ glBlendFunc(GL_ONE,GL_ONE); // set blend func } } } -void SetScanTrans(void) // blending for scan lines
+void SetScanTrans(void) // blending for scan lines { if(glBlendEquationEXTEx!=NULL) { @@ -419,10 +420,10 @@ void SetScanTrans(void) // blending for scan line obm1=TransSets[0].srcFac; obm2=TransSets[0].dstFac; - glBlendFunc(obm1,obm2); // set blend func
+ glBlendFunc(obm1,obm2); // set blend func } -void SetScanTexTrans(void) // blending for scan mask texture
+void SetScanTexTrans(void) // blending for scan mask texture { if(glBlendEquationEXTEx!=NULL) { @@ -432,7 +433,7 @@ void SetScanTexTrans(void) // blending for scan mask obm1=TransSets[2].srcFac; obm2=TransSets[2].dstFac; - glBlendFunc(obm1,obm2); // set blend func
+ glBlendFunc(obm1,obm2); // set blend func } //////////////////////////////////////////////////////////////////////// @@ -471,7 +472,7 @@ SemiTransParams MultiColTransSets[4]= //////////////////////////////////////////////////////////////////////// -void SetSemiTransMulti(int Pass) +static void SetSemiTransMulti(int Pass) { static GLenum bm1=GL_ZERO; static GLenum bm2=GL_ONE; @@ -512,11 +513,11 @@ void SetSemiTransMulti(int Pass) } if(!bBlendEnable) - {glEnable(GL_BLEND);bBlendEnable=TRUE;} // wanna blend
+ {glEnable(GL_BLEND);bBlendEnable=TRUE;} // wanna blend if(bm1!=obm1 || bm2!=obm2) { - glBlendFunc(bm1,bm2); // set blend func
+ glBlendFunc(bm1,bm2); // set blend func obm1=bm1;obm2=bm2; } } @@ -525,7 +526,7 @@ void SetSemiTransMulti(int Pass) // Set several rendering stuff including blending //////////////////////////////////////////////////////////////////////// -__inline void SetZMask3O(void) +static __inline void SetZMask3O(void) { if(iUseMask && DrawSemiTrans && !iSetMask) { @@ -534,7 +535,7 @@ __inline void SetZMask3O(void) } } -__inline void SetZMask3(void) +static __inline void SetZMask3(void) { if(iUseMask) { @@ -548,7 +549,7 @@ __inline void SetZMask3(void) } } -__inline void SetZMask3NT(void) +static __inline void SetZMask3NT(void) { if(iUseMask) { @@ -564,7 +565,7 @@ __inline void SetZMask3NT(void) //////////////////////////////////////////////////////////////////////// -__inline void SetZMask4O(void) +static __inline void SetZMask4O(void) { if(iUseMask && DrawSemiTrans && !iSetMask) { @@ -573,7 +574,7 @@ __inline void SetZMask4O(void) } } -__inline void SetZMask4(void) +static __inline void SetZMask4(void) { if(iUseMask) { @@ -587,7 +588,7 @@ __inline void SetZMask4(void) } } -__inline void SetZMask4NT(void) +static __inline void SetZMask4NT(void) { if(iUseMask) { @@ -600,29 +601,29 @@ __inline void SetZMask4NT(void) } } } -
-__inline void SetZMask4SP(void)
-{
- if(iUseMask)
- {
- if(iSetMask==1)
- {vertex[0].z=vertex[1].z=vertex[2].z=vertex[3].z=0.95f;}
- else
- {
- if(bCheckMask)
- {
- vertex[0].z=vertex[1].z=vertex[2].z=vertex[3].z=gl_z;
- gl_z+=0.00004f;
- }
- else
- {vertex[0].z=vertex[1].z=vertex[2].z=vertex[3].z=0.95f;}
- }
- }
-}
-
+ +static __inline void SetZMask4SP(void) +{ + if(iUseMask) + { + if(iSetMask==1) + {vertex[0].z=vertex[1].z=vertex[2].z=vertex[3].z=0.95f;} + else + { + if(bCheckMask) + { + vertex[0].z=vertex[1].z=vertex[2].z=vertex[3].z=gl_z; + gl_z+=0.00004f; + } + else + {vertex[0].z=vertex[1].z=vertex[2].z=vertex[3].z=0.95f;} + } + } +} + //////////////////////////////////////////////////////////////////////// -__inline void SetRenderState(uint32_t DrawAttributes) +static __inline void SetRenderState(uint32_t DrawAttributes) { bDrawNonShaded = (SHADETEXBIT(DrawAttributes)) ? TRUE : FALSE; DrawSemiTrans = (SEMITRANSBIT(DrawAttributes)) ? TRUE : FALSE; @@ -630,7 +631,7 @@ __inline void SetRenderState(uint32_t DrawAttributes) //////////////////////////////////////////////////////////////////////// -__inline void SetRenderColor(uint32_t DrawAttributes) +static __inline void SetRenderColor(uint32_t DrawAttributes) { if(bDrawNonShaded) {g_m1=g_m2=g_m3=128;} else @@ -643,7 +644,7 @@ __inline void SetRenderColor(uint32_t DrawAttributes) //////////////////////////////////////////////////////////////////////// -void SetRenderMode(uint32_t DrawAttributes, BOOL bSCol) +static void SetRenderMode(uint32_t DrawAttributes, BOOL bSCol) { if((bUseMultiPass) && (bDrawTextured) && !(bDrawNonShaded)) {bDrawMultiPass = TRUE; SetSemiTransMulti(0);} @@ -671,24 +672,24 @@ void SetRenderMode(uint32_t DrawAttributes, BOOL bSCol) if((dwActFixes&4) && ((DrawAttributes&0x00ffffff)==0)) DrawAttributes|=0x007f7f7f; - if(bDrawNonShaded) // -> non shaded?
+ if(bDrawNonShaded) // -> non shaded? { - if(bGLBlend) vertex[0].c.lcol=0x7f7f7f; // --> solid color...
+ if(bGLBlend) vertex[0].c.lcol=0x7f7f7f; // --> solid color... else vertex[0].c.lcol=0xffffff; } else // -> shaded? { - if(!bUseMultiPass && !bGLBlend) // --> given color...
+ if(!bUseMultiPass && !bGLBlend) // --> given color... vertex[0].c.lcol=DoubleBGR2RGB(DrawAttributes); else vertex[0].c.lcol=DrawAttributes; } - vertex[0].c.col[3]=ubGloAlpha; // -> set color with
+ vertex[0].c.col[3]=ubGloAlpha; // -> set color with SETCOL(vertex[0]); // texture alpha } - if(bDrawSmoothShaded!=bOldSmoothShaded) // shading changed?
+ if(bDrawSmoothShaded!=bOldSmoothShaded) // shading changed? { - if(bDrawSmoothShaded) glShadeModel(GL_SMOOTH); // -> set actual shading
+ if(bDrawSmoothShaded) glShadeModel(GL_SMOOTH); // -> set actual shading else glShadeModel(GL_FLAT); bOldSmoothShaded=bDrawSmoothShaded; } @@ -698,9 +699,9 @@ void SetRenderMode(uint32_t DrawAttributes, BOOL bSCol) // Set Opaque multipass color //////////////////////////////////////////////////////////////////////// -void SetOpaqueColor(uint32_t DrawAttributes) +static void SetOpaqueColor(uint32_t DrawAttributes) { - if(bDrawNonShaded) return; // no shading? bye
+ if(bDrawNonShaded) return; // no shading? bye DrawAttributes=DoubleBGR2RGB(DrawAttributes); // multipass is just half color, so double it on opaque pass vertex[0].c.lcol=DrawAttributes|0xff000000; @@ -711,7 +712,7 @@ void SetOpaqueColor(uint32_t DrawAttributes) // Fucking stupid screen coord checking //////////////////////////////////////////////////////////////////////// -BOOL ClipVertexListScreen(void) +static BOOL ClipVertexListScreen(void) { if (lx0 >= PSXDisplay.DisplayEnd.x) goto NEXTSCRTEST; if (ly0 >= PSXDisplay.DisplayEnd.y) goto NEXTSCRTEST; @@ -733,7 +734,7 @@ NEXTSCRTEST: //////////////////////////////////////////////////////////////////////// -BOOL bDrawOffscreenFront(void) +static BOOL bDrawOffscreenFront(void) { if(sxmin < PSXDisplay.DisplayPosition.x) return FALSE; // must be complete in front if(symin < PSXDisplay.DisplayPosition.y) return FALSE; @@ -742,7 +743,7 @@ BOOL bDrawOffscreenFront(void) return TRUE; } -BOOL bOnePointInFront(void) +static BOOL bOnePointInFront(void) { if(sxmax< PSXDisplay.DisplayPosition.x) return FALSE; @@ -760,7 +761,7 @@ BOOL bOnePointInFront(void) } -BOOL bOnePointInBack(void) +static BOOL bOnePointInBack(void) { if(sxmax< PreviousPSXDisplay.DisplayPosition.x) return FALSE; @@ -777,7 +778,7 @@ BOOL bOnePointInBack(void) return TRUE; } -BOOL bDrawOffscreen4(void) +static BOOL bDrawOffscreen4(void) { BOOL bFront;short sW,sH; @@ -832,12 +833,12 @@ BOOL bDrawOffscreen4(void) vertex[2].y=ly2 - PSXDisplay.DisplayPosition.y+PreviousPSXDisplay.Range.y0; vertex[3].y=ly3 - PSXDisplay.DisplayPosition.y+PreviousPSXDisplay.Range.y0; - if(iOffscreenDrawing==4 && !(dwActFixes&1)) // -> frontbuffer wanted
+ if(iOffscreenDrawing==4 && !(dwActFixes&1)) // -> frontbuffer wanted { bRenderFrontBuffer=TRUE; //return TRUE; } - return bFullVRam; // -> but no od
+ return bFullVRam; // -> but no od } return TRUE; @@ -845,7 +846,7 @@ BOOL bDrawOffscreen4(void) //////////////////////////////////////////////////////////////////////// -BOOL bDrawOffscreen3(void) +static BOOL bDrawOffscreen3(void) { BOOL bFront;short sW,sH; @@ -858,7 +859,7 @@ BOOL bDrawOffscreen3(void) symin=min(ly0,min(ly1,ly2)); if(symin>drawH) return FALSE; - if(PSXDisplay.Disabled) return TRUE; // disabled? ever
+ if(PSXDisplay.Disabled) return TRUE; // disabled? ever if(iOffscreenDrawing==1) return bFullVRam; @@ -876,7 +877,7 @@ BOOL bDrawOffscreen3(void) if(bFront) { - if(PSXDisplay.InterlacedTest) return bFullVRam; // -> ok, no need for adjust
+ if(PSXDisplay.InterlacedTest) return bFullVRam; // -> ok, no need for adjust vertex[0].x=lx0 - PSXDisplay.DisplayPosition.x+PreviousPSXDisplay.Range.x0; vertex[1].x=lx1 - PSXDisplay.DisplayPosition.x+PreviousPSXDisplay.Range.x0; @@ -885,13 +886,13 @@ BOOL bDrawOffscreen3(void) vertex[1].y=ly1 - PSXDisplay.DisplayPosition.y+PreviousPSXDisplay.Range.y0; vertex[2].y=ly2 - PSXDisplay.DisplayPosition.y+PreviousPSXDisplay.Range.y0; - if(iOffscreenDrawing==4) // -> frontbuffer wanted
+ if(iOffscreenDrawing==4) // -> frontbuffer wanted { bRenderFrontBuffer=TRUE; // return TRUE; } - return bFullVRam; // -> but no od
+ return bFullVRam; // -> but no od } return TRUE; @@ -947,7 +948,7 @@ BOOL CheckAgainstScreen(short imageX0,short imageY0,short imageX1,short imageY1) { imageX1 += imageX0; imageY1 += imageY0; -
+ if (imageX0 < PreviousPSXDisplay.DisplayPosition.x) xrUploadArea.x0 = PreviousPSXDisplay.DisplayPosition.x; else @@ -1099,7 +1100,7 @@ void PrepareFullScreenUpload (int Position) // lClearOnSwap=0; } else - if(PSXDisplay.Interlaced && PreviousPSXDisplay.RGB24<2) // in interlaced mode we upload at least two full frames (GT1 menu)
+ if(PSXDisplay.Interlaced && PreviousPSXDisplay.RGB24<2) // in interlaced mode we upload at least two full frames (GT1 menu) { PreviousPSXDisplay.RGB24++; } @@ -1152,92 +1153,90 @@ void PrepareFullScreenUpload (int Position) // Upload screen (MDEC and such) //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// -
-unsigned char * LoadDirectMovieFast(void);
-
-void UploadScreenEx(int Position)
-{
- short ya,yb,xa,xb,x, y, YStep, XStep, U, UStep,ux[4],vy[4];
-
- if(!PSXDisplay.DisplayMode.x) return;
- if(!PSXDisplay.DisplayMode.y) return;
-
- glDisable(GL_SCISSOR_TEST);
- glShadeModel(GL_FLAT);
- bOldSmoothShaded=FALSE;
- glDisable(GL_BLEND);
- bBlendEnable=FALSE;
- glDisable(GL_TEXTURE_2D);
- bTexEnabled=FALSE;
- glDisable(GL_ALPHA_TEST);
-
- glPixelZoom(((float)rRatioRect.right)/((float)PSXDisplay.DisplayMode.x),
- -1.0f*(((float)rRatioRect.bottom)/((float)PSXDisplay.DisplayMode.y)));
-
- //----------------------------------------------------//
-
- YStep = 256; // max texture size
- XStep = 256;
- UStep = (PSXDisplay.RGB24 ? 128 : 0);
- ya = xrUploadArea.y0;
- yb = xrUploadArea.y1;
- xa = xrUploadArea.x0;
- xb = xrUploadArea.x1;
-
- for(y=ya;y<=yb;y+=YStep) // loop y
- {
- U = 0;
- for(x=xa;x<=xb;x+=XStep) // loop x
- {
- ly0 = ly1 = y; // -> get y coords
- ly2 = y + YStep;
- if (ly2 > yb) ly2 = yb;
- ly3 = ly2;
-
- lx0 = lx3 = x; // -> get x coords
- lx1 = x + XStep;
- if (lx1 > xb) lx1 = xb;
-
- lx2 = lx1;
-
- ux[0]=ux[3]=(xa - x); // -> set tex x coords
- if (ux[0] < 0) ux[0]=ux[3]=0;
- ux[2]=ux[1]=(xb - x);
- if (ux[2] > 256) ux[2]=ux[1]=256;
-
- vy[0]=vy[1]=(ya - y); // -> set tex y coords
- if (vy[0] < 0) vy[0]=vy[1]=0;
- vy[2]=vy[3]=(yb - y);
- if (vy[2] > 256) vy[2]=vy[3]=256;
-
- if ((ux[0] >= ux[2]) || // -> cheaters never win...
- (vy[0] >= vy[2])) continue; // (but winners always cheat...)
-
- xrMovieArea.x0=lx0+U; xrMovieArea.y0=ly0;
- xrMovieArea.x1=lx2+U; xrMovieArea.y1=ly2;
-
- offsetScreenUpload(Position);
-
- glRasterPos2f(vertex[0].x,vertex[0].y);
-
- glDrawPixels(xrMovieArea.x1-xrMovieArea.x0,
- xrMovieArea.y1-xrMovieArea.y0,
- GL_RGBA,GL_UNSIGNED_BYTE,
- LoadDirectMovieFast());
-
- U+=UStep;
- }
- }
-
- //----------------------------------------------------//
-
- glPixelZoom(1.0F,1.0F);
-
- glEnable(GL_ALPHA_TEST);
- glEnable(GL_SCISSOR_TEST);
-}
-
-////////////////////////////////////////////////////////////////////////
+ +static void UploadScreenEx(int Position) +{ + short ya,yb,xa,xb,x, y, YStep, XStep, U, UStep,ux[4],vy[4]; + + if(!PSXDisplay.DisplayMode.x) return; + if(!PSXDisplay.DisplayMode.y) return; + + glDisable(GL_SCISSOR_TEST); + glShadeModel(GL_FLAT); + bOldSmoothShaded=FALSE; + glDisable(GL_BLEND); + bBlendEnable=FALSE; + glDisable(GL_TEXTURE_2D); + bTexEnabled=FALSE; + glDisable(GL_ALPHA_TEST); + + glPixelZoom(((float)rRatioRect.right)/((float)PSXDisplay.DisplayMode.x), + -1.0f*(((float)rRatioRect.bottom)/((float)PSXDisplay.DisplayMode.y))); + + //----------------------------------------------------// + + YStep = 256; // max texture size + XStep = 256; + UStep = (PSXDisplay.RGB24 ? 128 : 0); + ya = xrUploadArea.y0; + yb = xrUploadArea.y1; + xa = xrUploadArea.x0; + xb = xrUploadArea.x1; + + for(y=ya;y<=yb;y+=YStep) // loop y + { + U = 0; + for(x=xa;x<=xb;x+=XStep) // loop x + { + ly0 = ly1 = y; // -> get y coords + ly2 = y + YStep; + if (ly2 > yb) ly2 = yb; + ly3 = ly2; + + lx0 = lx3 = x; // -> get x coords + lx1 = x + XStep; + if (lx1 > xb) lx1 = xb; + + lx2 = lx1; + + ux[0]=ux[3]=(xa - x); // -> set tex x coords + if (ux[0] < 0) ux[0]=ux[3]=0; + ux[2]=ux[1]=(xb - x); + if (ux[2] > 256) ux[2]=ux[1]=256; + + vy[0]=vy[1]=(ya - y); // -> set tex y coords + if (vy[0] < 0) vy[0]=vy[1]=0; + vy[2]=vy[3]=(yb - y); + if (vy[2] > 256) vy[2]=vy[3]=256; + + if ((ux[0] >= ux[2]) || // -> cheaters never win... + (vy[0] >= vy[2])) continue; // (but winners always cheat...) + + xrMovieArea.x0=lx0+U; xrMovieArea.y0=ly0; + xrMovieArea.x1=lx2+U; xrMovieArea.y1=ly2; + + offsetScreenUpload(Position); + + glRasterPos2f(vertex[0].x,vertex[0].y); + + glDrawPixels(xrMovieArea.x1-xrMovieArea.x0, + xrMovieArea.y1-xrMovieArea.y0, + GL_RGBA,GL_UNSIGNED_BYTE, + LoadDirectMovieFast()); + + U+=UStep; + } + } + + //----------------------------------------------------// + + glPixelZoom(1.0F,1.0F); + + glEnable(GL_ALPHA_TEST); + glEnable(GL_SCISSOR_TEST); +} + +//////////////////////////////////////////////////////////////////////// void UploadScreen(int Position) { @@ -1246,26 +1245,26 @@ void UploadScreen(int Position) if(xrUploadArea.x0>1023) xrUploadArea.x0=1023; if(xrUploadArea.x1>1024) xrUploadArea.x1=1024; - if(xrUploadArea.y0>iGPUHeightMask) xrUploadArea.y0=iGPUHeightMask;
- if(xrUploadArea.y1>iGPUHeight) xrUploadArea.y1=iGPUHeight;
+ if(xrUploadArea.y0>iGPUHeightMask) xrUploadArea.y0=iGPUHeightMask; + if(xrUploadArea.y1>iGPUHeight) xrUploadArea.y1=iGPUHeight; if(xrUploadArea.x0==xrUploadArea.x1) return; if(xrUploadArea.y0==xrUploadArea.y1) return; if(PSXDisplay.Disabled && iOffscreenDrawing<4) return; -
- iDrawnSomething = 2;
- iLastRGB24=PSXDisplay.RGB24+1;
-
- if(bSkipNextFrame) return;
-
- if(dwActFixes & 2) {UploadScreenEx(Position);return;}
+ + iDrawnSomething = 2; + iLastRGB24=PSXDisplay.RGB24+1; + + if(bSkipNextFrame) return; + + if(dwActFixes & 2) {UploadScreenEx(Position);return;} bUsingMovie = TRUE; - bDrawTextured = TRUE; // just doing textures
+ bDrawTextured = TRUE; // just doing textures bDrawSmoothShaded = FALSE; - if(bGLBlend) vertex[0].c.lcol=0xff7f7f7f; // set solid col
+ if(bGLBlend) vertex[0].c.lcol=0xff7f7f7f; // set solid col else vertex[0].c.lcol=0xffffffff; SETCOL(vertex[0]); @@ -1281,10 +1280,10 @@ void UploadScreen(int Position) xa=xrUploadArea.x0; xb=xrUploadArea.x1; - for(y=ya;y<=yb;y+=YStep) // loop y
+ for(y=ya;y<=yb;y+=YStep) // loop y { U = 0; - for(x=xa;x<=xb;x+=XStep) // loop x
+ for(x=xa;x<=xb;x+=XStep) // loop x { ly0 = ly1 = y; // -> get y coords ly2 = y + YStep; @@ -1297,17 +1296,17 @@ void UploadScreen(int Position) lx2 = lx1; - ux[0]=ux[3]=(xa - x); // -> set tex x coords
+ ux[0]=ux[3]=(xa - x); // -> set tex x coords if (ux[0] < 0) ux[0]=ux[3]=0; ux[2]=ux[1]=(xb - x); if (ux[2] > 256) ux[2]=ux[1]=256; - vy[0]=vy[1]=(ya - y); // -> set tex y coords
+ vy[0]=vy[1]=(ya - y); // -> set tex y coords if (vy[0] < 0) vy[0]=vy[1]=0; vy[2]=vy[3]=(yb - y); if (vy[2] > 256) vy[2]=vy[3]=256; - if ((ux[0] >= ux[2]) || // -> cheaters never win...
+ if ((ux[0] >= ux[2]) || // -> cheaters never win... (vy[0] >= vy[2])) continue; // (but winners always cheat...) xrMovieArea.x0=lx0+U; xrMovieArea.y0=ly0; @@ -1331,7 +1330,7 @@ void UploadScreen(int Position) } } - bUsingMovie=FALSE; // done...
+ bUsingMovie=FALSE; // done... bDisplayNotSet = TRUE; } @@ -1339,7 +1338,7 @@ void UploadScreen(int Position) // Detect next screen //////////////////////////////////////////////////////////////////////// -BOOL IsCompleteInsideNextScreen(short x, short y, short xoff, short yoff) +static BOOL IsCompleteInsideNextScreen(short x, short y, short xoff, short yoff) { if (x > PSXDisplay.DisplayPosition.x+1) return FALSE; if ((x + xoff) < PSXDisplay.DisplayEnd.x-1) return FALSE; @@ -1355,7 +1354,7 @@ BOOL IsCompleteInsideNextScreen(short x, short y, short xoff, short yoff) return TRUE; } -BOOL IsPrimCompleteInsideNextScreen(short x, short y, short xoff, short yoff) +static BOOL IsPrimCompleteInsideNextScreen(short x, short y, short xoff, short yoff) { x+=PSXDisplay.DrawOffset.x; if (x > PSXDisplay.DisplayPosition.x+1) return FALSE; @@ -1368,7 +1367,8 @@ BOOL IsPrimCompleteInsideNextScreen(short x, short y, short xoff, short yoff) return TRUE; } -BOOL IsInsideNextScreen(short x, short y, short xoff, short yoff) +#if 0 +static BOOL IsInsideNextScreen(short x, short y, short xoff, short yoff) { if (x > PSXDisplay.DisplayEnd.x) return FALSE; if (y > PSXDisplay.DisplayEnd.y) return FALSE; @@ -1376,6 +1376,7 @@ BOOL IsInsideNextScreen(short x, short y, short xoff, short yoff) if ((y + yoff) < PSXDisplay.DisplayPosition.y) return FALSE; return TRUE; } +#endif //////////////////////////////////////////////////////////////////////// // mask stuff... @@ -1384,7 +1385,7 @@ BOOL IsInsideNextScreen(short x, short y, short xoff, short yoff) //Mask1 Set mask bit while drawing. 1 = on //Mask2 Do not draw to mask areas. 1= on -void cmdSTP(unsigned char * baseAddr) +static void cmdSTP(unsigned char * baseAddr) { uint32_t gdata = ((uint32_t*)baseAddr)[0]; @@ -1392,32 +1393,32 @@ void cmdSTP(unsigned char * baseAddr) STATUSREG|=((gdata & 0x03) << 11); // set the current bits if(!iUseMask) return; -
- if(gdata&1) {sSetMask=0x8000;lSetMask=0x80008000;iSetMask=1;}
- else {sSetMask=0; lSetMask=0; iSetMask=0;}
-
- if(gdata&2)
- {
- if(!(gdata&1)) iSetMask=2;
- bCheckMask=TRUE;
- if(iDepthFunc==0) return;
- iDepthFunc=0;
- glDepthFunc(GL_LESS);
- }
- else
- {
- bCheckMask=FALSE;
- if(iDepthFunc==1) return;
- glDepthFunc(GL_ALWAYS);
- iDepthFunc=1;
- }
+ + if(gdata&1) {sSetMask=0x8000;lSetMask=0x80008000;iSetMask=1;} + else {sSetMask=0; lSetMask=0; iSetMask=0;} + + if(gdata&2) + { + if(!(gdata&1)) iSetMask=2; + bCheckMask=TRUE; + if(iDepthFunc==0) return; + iDepthFunc=0; + glDepthFunc(GL_LESS); + } + else + { + bCheckMask=FALSE; + if(iDepthFunc==1) return; + glDepthFunc(GL_ALWAYS); + iDepthFunc=1; + } } //////////////////////////////////////////////////////////////////////// // cmd: Set texture page infos //////////////////////////////////////////////////////////////////////// -void cmdTexturePage(unsigned char * baseAddr) +static void cmdTexturePage(unsigned char * baseAddr) { uint32_t gdata = ((uint32_t *)baseAddr)[0]; UpdateGlobalTP((unsigned short)gdata); @@ -1428,59 +1429,59 @@ void cmdTexturePage(unsigned char * baseAddr) // cmd: turn on/off texture window //////////////////////////////////////////////////////////////////////// -void cmdTextureWindow(unsigned char *baseAddr) +static void cmdTextureWindow(unsigned char *baseAddr) { - uint32_t gdata = ((uint32_t *)baseAddr)[0];
- uint32_t YAlign,XAlign;
-
- ulGPUInfoVals[INFO_TW]=gdata&0xFFFFF;
-
- if(gdata & 0x020)
- TWin.Position.y1 = 8; // xxxx1
- else if (gdata & 0x040)
- TWin.Position.y1 = 16; // xxx10
- else if (gdata & 0x080)
- TWin.Position.y1 = 32; // xx100
- else if (gdata & 0x100)
- TWin.Position.y1 = 64; // x1000
- else if (gdata & 0x200)
- TWin.Position.y1 = 128; // 10000
- else
- TWin.Position.y1 = 256; // 00000
-
- // Texture window size is determined by the least bit set of the relevant 5 bits
-
- if (gdata & 0x001)
- TWin.Position.x1 = 8; // xxxx1
- else if (gdata & 0x002)
- TWin.Position.x1 = 16; // xxx10
- else if (gdata & 0x004)
- TWin.Position.x1 = 32; // xx100
- else if (gdata & 0x008)
- TWin.Position.x1 = 64; // x1000
- else if (gdata & 0x010)
- TWin.Position.x1 = 128; // 10000
- else
- TWin.Position.x1 = 256; // 00000
-
- // Re-calculate the bit field, because we can't trust what is passed in the data
-
- YAlign = (uint32_t)(32 - (TWin.Position.y1 >> 3));
- XAlign = (uint32_t)(32 - (TWin.Position.x1 >> 3));
-
- // Absolute position of the start of the texture window
-
- TWin.Position.y0 = (short)(((gdata >> 15) & YAlign) << 3);
- TWin.Position.x0 = (short)(((gdata >> 10) & XAlign) << 3);
- - if((TWin.Position.x0 == 0 && // tw turned off
+ uint32_t gdata = ((uint32_t *)baseAddr)[0]; + uint32_t YAlign,XAlign; + + ulGPUInfoVals[INFO_TW]=gdata&0xFFFFF; + + if(gdata & 0x020) + TWin.Position.y1 = 8; // xxxx1 + else if (gdata & 0x040) + TWin.Position.y1 = 16; // xxx10 + else if (gdata & 0x080) + TWin.Position.y1 = 32; // xx100 + else if (gdata & 0x100) + TWin.Position.y1 = 64; // x1000 + else if (gdata & 0x200) + TWin.Position.y1 = 128; // 10000 + else + TWin.Position.y1 = 256; // 00000 + + // Texture window size is determined by the least bit set of the relevant 5 bits + + if (gdata & 0x001) + TWin.Position.x1 = 8; // xxxx1 + else if (gdata & 0x002) + TWin.Position.x1 = 16; // xxx10 + else if (gdata & 0x004) + TWin.Position.x1 = 32; // xx100 + else if (gdata & 0x008) + TWin.Position.x1 = 64; // x1000 + else if (gdata & 0x010) + TWin.Position.x1 = 128; // 10000 + else + TWin.Position.x1 = 256; // 00000 + + // Re-calculate the bit field, because we can't trust what is passed in the data + + YAlign = (uint32_t)(32 - (TWin.Position.y1 >> 3)); + XAlign = (uint32_t)(32 - (TWin.Position.x1 >> 3)); + + // Absolute position of the start of the texture window + + TWin.Position.y0 = (short)(((gdata >> 15) & YAlign) << 3); + TWin.Position.x0 = (short)(((gdata >> 10) & XAlign) << 3); + + if((TWin.Position.x0 == 0 && // tw turned off TWin.Position.y0 == 0 && TWin.Position.x1 == 0 && TWin.Position.y1 == 0) || (TWin.Position.x1 == 256 && TWin.Position.y1 == 256)) { - bUsingTWin = FALSE; // -> just do it
+ bUsingTWin = FALSE; // -> just do it #ifdef OWNSCALE TWin.UScaleFactor = 1.0f; @@ -1533,7 +1534,7 @@ void cmdTextureWindow(unsigned char *baseAddr) TWin.UScaleFactor = (float)TWin.Position.x1; TWin.VScaleFactor = (float)TWin.Position.y1; #else - TWin.UScaleFactor = ((float)TWin.Position.x1)/256.0f; // -> set scale factor
+ TWin.UScaleFactor = ((float)TWin.Position.x1)/256.0f; // -> set scale factor TWin.VScaleFactor = ((float)TWin.Position.y1)/256.0f; #endif } @@ -1542,7 +1543,7 @@ void cmdTextureWindow(unsigned char *baseAddr) //////////////////////////////////////////////////////////////////////// // mmm, Lewpy uses that in TileS ... I don't ;) //////////////////////////////////////////////////////////////////////// -
+ /* void ClampToPSXDrawAreaOffset(short *x0, short *y0, short *x1, short *y1) { @@ -1580,13 +1581,13 @@ void ClampToPSXDrawAreaOffset(short *x0, short *y0, short *x1, short *y1) if ((*y1 + *y0) > PSXDisplay.DrawArea.y1) *y1 = (PSXDisplay.DrawArea.y1 - *y0 + 1); } -*/
+*/ //////////////////////////////////////////////////////////////////////// // Check draw area dimensions //////////////////////////////////////////////////////////////////////// -void ClampToPSXScreen(short *x0, short *y0, short *x1, short *y1) +static void ClampToPSXScreen(short *x0, short *y0, short *x1, short *y1) { if (*x0 < 0) *x0 = 0; else @@ -1598,18 +1599,18 @@ void ClampToPSXScreen(short *x0, short *y0, short *x1, short *y1) if (*y0 < 0) *y0 = 0; else - if (*y0 > iGPUHeightMask) *y0 = iGPUHeightMask;
+ if (*y0 > iGPUHeightMask) *y0 = iGPUHeightMask; if (*y1 < 0) *y1 = 0; else - if (*y1 > iGPUHeightMask) *y1 = iGPUHeightMask;
+ if (*y1 > iGPUHeightMask) *y1 = iGPUHeightMask; } //////////////////////////////////////////////////////////////////////// // Used in Load Image and Blk Fill //////////////////////////////////////////////////////////////////////// -void ClampToPSXScreenOffset(short *x0, short *y0, short *x1, short *y1) +static void ClampToPSXScreenOffset(short *x0, short *y0, short *x1, short *y1) { if (*x0 < 0) { *x1 += *x0; *x0 = 0; } @@ -1620,8 +1621,8 @@ void ClampToPSXScreenOffset(short *x0, short *y0, short *x1, short *y1) if (*y0 < 0) { *y1 += *y0; *y0 = 0; } else - if (*y0 > iGPUHeightMask)
- { *y0 = iGPUHeightMask; *y1 = 0; }
+ if (*y0 > iGPUHeightMask) + { *y0 = iGPUHeightMask; *y1 = 0; } if (*x1 < 0) *x1 = 0; @@ -1629,37 +1630,37 @@ void ClampToPSXScreenOffset(short *x0, short *y0, short *x1, short *y1) if (*y1 < 0) *y1 = 0; - if ((*y1 + *y0) > iGPUHeight) *y1 = (iGPUHeight - *y0);
+ if ((*y1 + *y0) > iGPUHeight) *y1 = (iGPUHeight - *y0); } //////////////////////////////////////////////////////////////////////// // cmd: start of drawing area... primitives will be clipped inside //////////////////////////////////////////////////////////////////////// -void cmdDrawAreaStart(unsigned char * baseAddr) +static void cmdDrawAreaStart(unsigned char * baseAddr) { uint32_t gdata = ((uint32_t *)baseAddr)[0]; -
- drawX = gdata & 0x3ff; // for soft drawing
- if(drawX>=1024) drawX=1023;
- - if(dwGPUVersion==2)
- {
- ulGPUInfoVals[INFO_DRAWSTART]=gdata&0x3FFFFF;
- drawY = (gdata>>12)&0x3ff;
- }
- else
- {
- ulGPUInfoVals[INFO_DRAWSTART]=gdata&0xFFFFF;
- drawY = (gdata>>10)&0x3ff;
- }
-
- if(drawY>=iGPUHeight) drawY=iGPUHeightMask;
+ + drawX = gdata & 0x3ff; // for soft drawing + if(drawX>=1024) drawX=1023; + + if(dwGPUVersion==2) + { + ulGPUInfoVals[INFO_DRAWSTART]=gdata&0x3FFFFF; + drawY = (gdata>>12)&0x3ff; + } + else + { + ulGPUInfoVals[INFO_DRAWSTART]=gdata&0xFFFFF; + drawY = (gdata>>10)&0x3ff; + } + + if(drawY>=iGPUHeight) drawY=iGPUHeightMask; PreviousPSXDisplay.DrawArea.y0=PSXDisplay.DrawArea.y0; PreviousPSXDisplay.DrawArea.x0=PSXDisplay.DrawArea.x0; - PSXDisplay.DrawArea.y0 = (short)drawY; // for OGL drawing
+ PSXDisplay.DrawArea.y0 = (short)drawY; // for OGL drawing PSXDisplay.DrawArea.x0 = (short)drawX; } @@ -1667,27 +1668,27 @@ void cmdDrawAreaStart(unsigned char * baseAddr) // cmd: end of drawing area... primitives will be clipped inside //////////////////////////////////////////////////////////////////////// -void cmdDrawAreaEnd(unsigned char * baseAddr) +static void cmdDrawAreaEnd(unsigned char * baseAddr) { uint32_t gdata = ((uint32_t *)baseAddr)[0]; -
+ drawW = gdata & 0x3ff; // for soft drawing if(drawW>=1024) drawW=1023; -
- if(dwGPUVersion==2)
- {
- ulGPUInfoVals[INFO_DRAWEND]=gdata&0x3FFFFF;
- drawH = (gdata>>12)&0x3ff;
- }
- else
- {
- ulGPUInfoVals[INFO_DRAWEND]=gdata&0xFFFFF;
- drawH = (gdata>>10)&0x3ff;
- }
-
- if(drawH>=iGPUHeight) drawH=iGPUHeightMask;
- - PSXDisplay.DrawArea.y1 = (short)drawH; // for OGL drawing
+ + if(dwGPUVersion==2) + { + ulGPUInfoVals[INFO_DRAWEND]=gdata&0x3FFFFF; + drawH = (gdata>>12)&0x3ff; + } + else + { + ulGPUInfoVals[INFO_DRAWEND]=gdata&0xFFFFF; + drawH = (gdata>>10)&0x3ff; + } + + if(drawH>=iGPUHeight) drawH=iGPUHeightMask; + + PSXDisplay.DrawArea.y1 = (short)drawH; // for OGL drawing PSXDisplay.DrawArea.x1 = (short)drawW; ClampToPSXScreen(&PSXDisplay.DrawArea.x0, // clamp @@ -1702,28 +1703,28 @@ void cmdDrawAreaEnd(unsigned char * baseAddr) // cmd: draw offset... will be added to prim coords //////////////////////////////////////////////////////////////////////// -void cmdDrawOffset(unsigned char * baseAddr) +static void cmdDrawOffset(unsigned char * baseAddr) { uint32_t gdata = ((uint32_t *)baseAddr)[0]; -
+ PreviousPSXDisplay.DrawOffset.x = - PSXDisplay.DrawOffset.x = (short)(gdata & 0x7ff);
-
- if (dwGPUVersion == 2)
- {
- ulGPUInfoVals[INFO_DRAWOFF] = gdata&0x7FFFFF;
- PSXDisplay.DrawOffset.y = (short)((gdata>>12) & 0x7ff);
- }
- else
- {
- ulGPUInfoVals[INFO_DRAWOFF]=gdata&0x3FFFFF;
- PSXDisplay.DrawOffset.y = (short)((gdata>>11) & 0x7ff);
- }
+ PSXDisplay.DrawOffset.x = (short)(gdata & 0x7ff); + + if (dwGPUVersion == 2) + { + ulGPUInfoVals[INFO_DRAWOFF] = gdata&0x7FFFFF; + PSXDisplay.DrawOffset.y = (short)((gdata>>12) & 0x7ff); + } + else + { + ulGPUInfoVals[INFO_DRAWOFF]=gdata&0x3FFFFF; + PSXDisplay.DrawOffset.y = (short)((gdata>>11) & 0x7ff); + } PSXDisplay.DrawOffset.x=(short)(((int)PSXDisplay.DrawOffset.x<<21)>>21); PSXDisplay.DrawOffset.y=(short)(((int)PSXDisplay.DrawOffset.y<<21)>>21); - PSXDisplay.CumulOffset.x = // new OGL prim offsets
+ PSXDisplay.CumulOffset.x = // new OGL prim offsets PSXDisplay.DrawOffset.x - PSXDisplay.GDrawOffset.x + PreviousPSXDisplay.Range.x0; PSXDisplay.CumulOffset.y = PSXDisplay.DrawOffset.y - PSXDisplay.GDrawOffset.y + PreviousPSXDisplay.Range.y0; @@ -1733,7 +1734,7 @@ void cmdDrawOffset(unsigned char * baseAddr) // cmd: load image to vram //////////////////////////////////////////////////////////////////////// -void primLoadImage(unsigned char * baseAddr) +static void primLoadImage(unsigned char * baseAddr) { unsigned short *sgpuData = ((unsigned short *) baseAddr); @@ -1752,7 +1753,7 @@ void primLoadImage(unsigned char * baseAddr) //////////////////////////////////////////////////////////////////////// -void PrepareRGB24Upload(void) +static void PrepareRGB24Upload(void) { VRAMWrite.x=(VRAMWrite.x*2)/3; VRAMWrite.Width=(VRAMWrite.Width*2)/3; @@ -1856,7 +1857,7 @@ void CheckWriteUpdate() } return; } -
+ if(!bNeedUploadAfter) { bNeedUploadAfter = TRUE; @@ -1872,16 +1873,16 @@ void CheckWriteUpdate() xrUploadArea.y0=min(xrUploadArea.y0,VRAMWrite.y); xrUploadArea.y1=max(xrUploadArea.y1,VRAMWrite.y+VRAMWrite.Height); } -
- if(dwActFixes&0x8000)
- {
- if((xrUploadArea.x1-xrUploadArea.x0)>=(PSXDisplay.DisplayMode.x-32) &&
- (xrUploadArea.y1-xrUploadArea.y0)>=(PSXDisplay.DisplayMode.y-32))
- {
- UploadScreen(-1);
- updateFrontDisplay();
- }
- }
+ + if(dwActFixes&0x8000) + { + if((xrUploadArea.x1-xrUploadArea.x0)>=(PSXDisplay.DisplayMode.x-32) && + (xrUploadArea.y1-xrUploadArea.y0)>=(PSXDisplay.DisplayMode.y-32)) + { + UploadScreen(-1); + updateFrontDisplay(); + } + } } } } @@ -1890,7 +1891,7 @@ void CheckWriteUpdate() // cmd: vram -> psx mem //////////////////////////////////////////////////////////////////////// -void primStoreImage(unsigned char * baseAddr) +static void primStoreImage(unsigned char * baseAddr) { unsigned short *sgpuData = ((unsigned short *) baseAddr); @@ -1902,7 +1903,7 @@ void primStoreImage(unsigned char * baseAddr) VRAMRead.ImagePtr = psxVuw + (VRAMRead.y<<10) + VRAMRead.x; VRAMRead.RowsRemaining = VRAMRead.Width; VRAMRead.ColsRemaining = VRAMRead.Height; -
+ iDataReadMode = DR_VRAMTRANSFER; STATUSREG |= GPUSTATUS_READYFORVRAM; @@ -1912,7 +1913,7 @@ void primStoreImage(unsigned char * baseAddr) // cmd: blkfill - NO primitive! Doesn't care about draw areas... //////////////////////////////////////////////////////////////////////// -void primBlkFill(unsigned char * baseAddr) +static void primBlkFill(unsigned char * baseAddr) { uint32_t *gpuData = ((uint32_t *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -1922,9 +1923,9 @@ void primBlkFill(unsigned char * baseAddr) sprtX = sgpuData[2]; sprtY = sgpuData[3]; sprtW = sgpuData[4] & 0x3ff; - sprtH = sgpuData[5] & iGPUHeightMask;
-
- sprtW = (sprtW + 15) & ~15;
+ sprtH = sgpuData[5] & iGPUHeightMask; + + sprtW = (sprtW + 15) & ~15; // Increase H & W if they are one short of full values, because they never can be full values if (sprtH == iGPUHeightMask) sprtH=iGPUHeight; @@ -1938,7 +1939,7 @@ void primBlkFill(unsigned char * baseAddr) offsetBlk(); - if(ClipVertexListScreen())
+ if(ClipVertexListScreen()) { PSXDisplay_t * pd; if(PSXDisplay.InterlacedTest) pd=&PSXDisplay; @@ -1979,7 +1980,7 @@ void primBlkFill(unsigned char * baseAddr) } if(ly2<pd->DisplayEnd.y) { - vertex[0].x=0;vertex[0].y=(pd->DisplayEnd.y-pd->DisplayPosition.y)-(pd->DisplayEnd.y-ly2);
+ vertex[0].x=0;vertex[0].y=(pd->DisplayEnd.y-pd->DisplayPosition.y)-(pd->DisplayEnd.y-ly2); vertex[1].x=pd->DisplayEnd.x-pd->DisplayPosition.x;vertex[1].y=vertex[0].y; vertex[2].x=vertex[1].x;vertex[2].y=pd->DisplayEnd.y; vertex[3].x=0;vertex[3].y=vertex[2].y; @@ -2029,7 +2030,7 @@ void primBlkFill(unsigned char * baseAddr) // cmd: move image vram -> vram //////////////////////////////////////////////////////////////////////// -void MoveImageWrapped(short imageX0,short imageY0, +static void MoveImageWrapped(short imageX0,short imageY0, short imageX1,short imageY1, short imageSX,short imageSY) { @@ -2109,7 +2110,7 @@ void MoveImageWrapped(short imageX0,short imageY0, //////////////////////////////////////////////////////////////////////// -void primMoveImage(unsigned char * baseAddr) +static void primMoveImage(unsigned char * baseAddr) { short *sgpuData = ((short *) baseAddr); short imageY0,imageX0,imageY1,imageX1,imageSX,imageSY,i,j; @@ -2124,8 +2125,8 @@ void primMoveImage(unsigned char * baseAddr) if((imageX0 == imageX1) && (imageY0 == imageY1)) return; if(imageSX<=0) return; if(imageSY<=0) return; -
- if(iGPUHeight==1024 && sgpuData[7]>1024) return;
+ + if(iGPUHeight==1024 && sgpuData[7]>1024) return; if((imageY0+imageSY)>iGPUHeight || (imageX0+imageSX)>1024 || @@ -2268,7 +2269,7 @@ void primMoveImage(unsigned char * baseAddr) // cmd: draw free-size Tile //////////////////////////////////////////////////////////////////////// -void primTileS(unsigned char * baseAddr) +static void primTileS(unsigned char * baseAddr) { uint32_t *gpuData = ((uint32_t *)baseAddr); short *sgpuData = ((short *) baseAddr); @@ -2285,8 +2286,8 @@ void primTileS(unsigned char * baseAddr) offsetST(); - if((dwActFixes&1) && // FF7 special game gix (battle cursor)
- sprtX==0 && sprtY==0 && sprtW==24 && sprtH==16)
+ if((dwActFixes&1) && // FF7 special game gix (battle cursor) + sprtX==0 && sprtY==0 && sprtW==24 && sprtH==16) return; bDrawTextured = FALSE; @@ -2297,7 +2298,7 @@ void primTileS(unsigned char * baseAddr) if(iOffscreenDrawing) { if(IsPrimCompleteInsideNextScreen(lx0,ly0,lx2,ly2) || - (ly0==-6 && ly2==10)) // OH MY GOD... I DIDN'T WANT TO DO IT... BUT I'VE FOUND NO OTHER WAY... HACK FOR GRADIUS SHOOTER :(
+ (ly0==-6 && ly2==10)) // OH MY GOD... I DIDN'T WANT TO DO IT... BUT I'VE FOUND NO OTHER WAY... HACK FOR GRADIUS SHOOTER :( { lClearOnSwapColor = COLOR(gpuData[0]); lClearOnSwap = 1; @@ -2305,12 +2306,12 @@ void primTileS(unsigned char * baseAddr) offsetPSX4(); if(bDrawOffscreen4()) - {
- if(!(iTileCheat && sprtH==32 && gpuData[0]==0x60ffffff)) // special cheat for certain ZiNc games
+ { + if(!(iTileCheat && sprtH==32 && gpuData[0]==0x60ffffff)) // special cheat for certain ZiNc games { InvalidateTextureAreaEx(); FillSoftwareAreaTrans(lx0,ly0,lx2,ly2, - BGR24to16(gpuData[0]));
+ BGR24to16(gpuData[0])); } } } @@ -2333,7 +2334,7 @@ void primTileS(unsigned char * baseAddr) // cmd: draw 1 dot Tile (point) //////////////////////////////////////////////////////////////////////// -void primTile1(unsigned char * baseAddr) +static void primTile1(unsigned char * baseAddr) { uint32_t *gpuData = ((uint32_t *)baseAddr); short *sgpuData = ((short *)baseAddr); @@ -2380,7 +2381,7 @@ void primTile1(unsigned char * baseAddr) // cmd: draw 8 dot Tile (small rect) //////////////////////////////////////////////////////////////////////// -void primTile8(unsigned char * baseAddr) +static void primTile8(unsigned char * baseAddr) { uint32_t *gpuData = ((uint32_t *)baseAddr); short *sgpuData = ((short *) baseAddr); @@ -2427,7 +2428,7 @@ void primTile8(unsigned char * baseAddr) // cmd: draw 16 dot Tile (medium rect) //////////////////////////////////////////////////////////////////////// -void primTile16(unsigned char * baseAddr) +static void primTile16(unsigned char * baseAddr) { uint32_t *gpuData = ((uint32_t *)baseAddr); short *sgpuData = ((short *)baseAddr); @@ -2508,7 +2509,7 @@ void DrawMultiBlur(void) #define POFF 0.375f -void DrawMultiFilterSprite(void) +static void DrawMultiFilterSprite(void) { int lABR,lDST; @@ -2520,8 +2521,8 @@ void DrawMultiFilterSprite(void) lABR=GlobalTextABR; lDST=DrawSemiTrans; - vertex[0].c.col[3]=ubGloAlpha/2; // -> set color with
- SETCOL(vertex[0]); // texture alpha
+ vertex[0].c.col[3]=ubGloAlpha/2; // -> set color with + SETCOL(vertex[0]); // texture alpha PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]); vertex[0].x+=POFF;vertex[1].x+=POFF; vertex[2].x+=POFF;vertex[3].x+=POFF; @@ -2539,7 +2540,7 @@ void DrawMultiFilterSprite(void) // cmd: small sprite (textured rect) //////////////////////////////////////////////////////////////////////// -void primSprt8(unsigned char * baseAddr) +static void primSprt8(unsigned char * baseAddr) { uint32_t *gpuData = ((uint32_t *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -2558,30 +2559,30 @@ void primSprt8(unsigned char * baseAddr) offsetST(); // do texture stuff - gl_ux[0]=gl_ux[3]=baseAddr[8];//gpuData[2]&0xff;
-
- if(usMirror & 0x1000)
- {
- s=gl_ux[0];
- s-=sprtW-1;
- if(s<0) {s=0;}
- gl_ux[0]=gl_ux[3]=s;
- }
+ gl_ux[0]=gl_ux[3]=baseAddr[8];//gpuData[2]&0xff; + + if(usMirror & 0x1000) + { + s=gl_ux[0]; + s-=sprtW-1; + if(s<0) {s=0;} + gl_ux[0]=gl_ux[3]=s; + } sSprite_ux2=s=gl_ux[0]+sprtW; if(s) s--; if(s>255) s=255; gl_ux[1]=gl_ux[2]=s; // Y coords - gl_vy[0]=gl_vy[1]=baseAddr[9];//(gpuData[2]>>8)&0xff;
-
- if(usMirror & 0x2000)
- {
- s=gl_vy[0];
- s-=sprtH-1;
- if(s<0) {s=0;}
- gl_vy[0]=gl_vy[1]=s;
- }
+ gl_vy[0]=gl_vy[1]=baseAddr[9];//(gpuData[2]>>8)&0xff; + + if(usMirror & 0x2000) + { + s=gl_vy[0]; + s-=sprtH-1; + if(s<0) {s=0;} + gl_vy[0]=gl_vy[1]=s; + } sSprite_vy2=s=gl_vy[0]+sprtH; if(s) s--; @@ -2604,12 +2605,12 @@ void primSprt8(unsigned char * baseAddr) SetRenderColor(gpuData[0]); lx0-=PSXDisplay.DrawOffset.x; ly0-=PSXDisplay.DrawOffset.y; -
+ if(bUsingTWin) DrawSoftwareSpriteTWin(baseAddr,8,8); else if(usMirror) DrawSoftwareSpriteMirror(baseAddr,8,8); else - DrawSoftwareSprite(baseAddr,8,8,baseAddr[8],baseAddr[9]);
+ DrawSoftwareSprite(baseAddr,8,8,baseAddr[8],baseAddr[9]); } } @@ -2636,17 +2637,17 @@ void primSprt8(unsigned char * baseAddr) { SetZMask4O(); if(bUseMultiPass) SetOpaqueColor(gpuData[0]); - DEFOPAQUEON
-
- if(bSmallAlpha && iFilterType<=2)
- {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- SetZMask4O();
- }
+ DEFOPAQUEON + + if(bSmallAlpha && iFilterType<=2) + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + SetZMask4O(); + } PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]); DEFOPAQUEOFF @@ -2660,7 +2661,7 @@ void primSprt8(unsigned char * baseAddr) // cmd: medium sprite (textured rect) //////////////////////////////////////////////////////////////////////// -void primSprt16(unsigned char * baseAddr) +static void primSprt16(unsigned char * baseAddr) { uint32_t *gpuData = ((uint32_t *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -2679,30 +2680,30 @@ void primSprt16(unsigned char * baseAddr) offsetST(); // do texture stuff - gl_ux[0]=gl_ux[3]=baseAddr[8];//gpuData[2]&0xff;
-
- if(usMirror & 0x1000)
- {
- s=gl_ux[0];
- s-=sprtW-1;
- if(s<0) {s=0;}
- gl_ux[0]=gl_ux[3]=s;
- }
+ gl_ux[0]=gl_ux[3]=baseAddr[8];//gpuData[2]&0xff; + + if(usMirror & 0x1000) + { + s=gl_ux[0]; + s-=sprtW-1; + if(s<0) {s=0;} + gl_ux[0]=gl_ux[3]=s; + } sSprite_ux2=s=gl_ux[0]+sprtW; if(s) s--; if(s>255) s=255; gl_ux[1]=gl_ux[2]=s; // Y coords - gl_vy[0]=gl_vy[1]=baseAddr[9];//(gpuData[2]>>8)&0xff;
-
- if(usMirror & 0x2000)
- {
- s=gl_vy[0];
- s-=sprtH-1;
- if(s<0) {s=0;}
- gl_vy[0]=gl_vy[1]=s;
- }
+ gl_vy[0]=gl_vy[1]=baseAddr[9];//(gpuData[2]>>8)&0xff; + + if(usMirror & 0x2000) + { + s=gl_vy[0]; + s-=sprtH-1; + if(s<0) {s=0;} + gl_vy[0]=gl_vy[1]=s; + } sSprite_vy2=s=gl_vy[0]+sprtH; if(s) s--; @@ -2729,7 +2730,7 @@ void primSprt16(unsigned char * baseAddr) else if(usMirror) DrawSoftwareSpriteMirror(baseAddr,16,16); else - DrawSoftwareSprite(baseAddr,16,16,baseAddr[8],baseAddr[9]);
+ DrawSoftwareSprite(baseAddr,16,16,baseAddr[8],baseAddr[9]); } } @@ -2757,16 +2758,16 @@ void primSprt16(unsigned char * baseAddr) SetZMask4O(); if(bUseMultiPass) SetOpaqueColor(gpuData[0]); DEFOPAQUEON -
- if(bSmallAlpha && iFilterType<=2)
- {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- SetZMask4O();
- }
+ + if(bSmallAlpha && iFilterType<=2) + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + SetZMask4O(); + } PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]); DEFOPAQUEOFF @@ -2780,7 +2781,7 @@ void primSprt16(unsigned char * baseAddr) // cmd: free-size sprite (textured rect) //////////////////////////////////////////////////////////////////////// -void primSprtSRest(unsigned char * baseAddr,unsigned short type) +static void primSprtSRest(unsigned char * baseAddr,unsigned short type) { uint32_t *gpuData = ((uint32_t *)baseAddr); short *sgpuData = ((short *) baseAddr); @@ -2853,12 +2854,12 @@ void primSprtSRest(unsigned char * baseAddr,unsigned short type) s-=sprtW-1;if(s<0) s=0; gl_ux[0]=gl_ux[3]=s; } - if(usMirror & 0x2000)
- {
- s=gl_vy[0];
- s-=sprtH-1;if(s<0) {s=0;}
- gl_vy[0]=gl_vy[1]=s;
- }
+ if(usMirror & 0x2000) + { + s=gl_vy[0]; + s-=sprtH-1;if(s<0) {s=0;} + gl_vy[0]=gl_vy[1]=s; + } sSprite_ux2=s=gl_ux[0]+sprtW; if(s>255) s=255; @@ -2900,7 +2901,7 @@ void primSprtSRest(unsigned char * baseAddr,unsigned short type) else if(usMirror) DrawSoftwareSpriteMirror(baseAddr,sprtW,sprtH); else - DrawSoftwareSprite(baseAddr,sprtW,sprtH,baseAddr[8],baseAddr[9]);
+ DrawSoftwareSprite(baseAddr,sprtW,sprtH,baseAddr[8],baseAddr[9]); } } @@ -2927,17 +2928,17 @@ void primSprtSRest(unsigned char * baseAddr,unsigned short type) { SetZMask4O(); if(bUseMultiPass) SetOpaqueColor(gpuData[0]); - DEFOPAQUEON
-
- if(bSmallAlpha && iFilterType<=2)
- {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- SetZMask4O();
- }
+ DEFOPAQUEON + + if(bSmallAlpha && iFilterType<=2) + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + SetZMask4O(); + } PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]); DEFOPAQUEOFF @@ -2951,7 +2952,7 @@ void primSprtSRest(unsigned char * baseAddr,unsigned short type) } } -void primSprtS(unsigned char * baseAddr) +static void primSprtS(unsigned char * baseAddr) { uint32_t *gpuData = ((uint32_t *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -2980,13 +2981,13 @@ void primSprtS(unsigned char * baseAddr) if(s<0) {s=0;} gl_ux[0]=gl_ux[3]=s; } - if(usMirror & 0x2000)
- {
- s=gl_vy[0];
- s-=sprtH-1;
- if(s<0) {s=0;}
- gl_vy[0]=gl_vy[1]=s;
- }
+ if(usMirror & 0x2000) + { + s=gl_vy[0]; + s-=sprtH-1; + if(s<0) {s=0;} + gl_vy[0]=gl_vy[1]=s; + } sSprite_ux2=s=gl_ux[0]+sprtW; if(s) s--; @@ -3030,7 +3031,7 @@ void primSprtS(unsigned char * baseAddr) else if(usMirror) DrawSoftwareSpriteMirror(baseAddr,sprtW,sprtH); else - DrawSoftwareSprite(baseAddr,sprtW,sprtH,baseAddr[8],baseAddr[9]);
+ DrawSoftwareSprite(baseAddr,sprtW,sprtH,baseAddr[8],baseAddr[9]); } } @@ -3060,17 +3061,17 @@ void primSprtS(unsigned char * baseAddr) { SetZMask4O(); if(bUseMultiPass) SetOpaqueColor(gpuData[0]); - DEFOPAQUEON
-
- if(bSmallAlpha && iFilterType<=2)
- {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- SetZMask4O();
- }
+ DEFOPAQUEON + + if(bSmallAlpha && iFilterType<=2) + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + SetZMask4O(); + } PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[2], &vertex[3]); DEFOPAQUEOFF @@ -3091,7 +3092,7 @@ void primSprtS(unsigned char * baseAddr) // cmd: flat shaded Poly4 //////////////////////////////////////////////////////////////////////// -void primPolyF4(unsigned char *baseAddr) +static void primPolyF4(unsigned char *baseAddr) { uint32_t *gpuData = ((uint32_t *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -3138,7 +3139,7 @@ void primPolyF4(unsigned char *baseAddr) void primPolyG4(unsigned char * baseAddr); -BOOL bDrawOffscreenFrontFF9G4(void) +static BOOL bDrawOffscreenFrontFF9G4(void) { if(lx0< PSXDisplay.DisplayPosition.x) return FALSE; // must be complete in front if(lx0> PSXDisplay.DisplayEnd.x) return FALSE; @@ -3169,16 +3170,16 @@ BOOL bCheckFF9G4(unsigned char * baseAddr) if(iFF9Fix==0) { if(bDrawOffscreenFrontFF9G4()) - {
- short *sgpuData = ((short *) pFF9G4Cache);
- iFF9Fix=2;
- memcpy(pFF9G4Cache,baseAddr,32);
-
- if(sgpuData[2]==142)
- {
- sgpuData[2] +=65;
- sgpuData[10]+=65;
- }
+ { + short *sgpuData = ((short *) pFF9G4Cache); + iFF9Fix=2; + memcpy(pFF9G4Cache,baseAddr,32); + + if(sgpuData[2]==142) + { + sgpuData[2] +=65; + sgpuData[10]+=65; + } return TRUE; } else iFF9Fix=1; @@ -3253,7 +3254,7 @@ void primPolyG4(unsigned char * baseAddr) // cmd: flat shaded Texture3 //////////////////////////////////////////////////////////////////////// -BOOL DoLineCheck(uint32_t *gpuData) +static BOOL DoLineCheck(uint32_t *gpuData) { BOOL bQuad=FALSE;short dx,dy; @@ -3418,7 +3419,7 @@ BOOL DoLineCheck(uint32_t *gpuData) //////////////////////////////////////////////////////////////////////// -void primPolyFT3(unsigned char * baseAddr) +static void primPolyFT3(unsigned char * baseAddr) { uint32_t *gpuData = ((uint32_t *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -3491,370 +3492,370 @@ void primPolyFT3(unsigned char * baseAddr) //////////////////////////////////////////////////////////////////////// // cmd: flat shaded Texture4 //////////////////////////////////////////////////////////////////////// -
-#define ST_FAC 255.99f
-
-void RectTexAlign(void)
-{
- int UFlipped = FALSE;
- int VFlipped = FALSE;
-
- if(gTexName==gTexFrameName) return;
-
- if(ly0==ly1)
- {
- if(!((lx1==lx3 && ly3==ly2 && lx2==lx0) ||
- (lx1==lx2 && ly2==ly3 && lx3==lx0)))
- return;
-
- if(ly0<ly2)
- {
- if (vertex[0].tow > vertex[2].tow)
- VFlipped = 1;
- }
- else
- {
- if (vertex[0].tow < vertex[2].tow)
- VFlipped = 2;
- }
- }
- else
- if(ly0==ly2)
- {
- if(!((lx2==lx3 && ly3==ly1 && lx1==lx0) ||
- (lx2==lx1 && ly1==ly3 && lx3==lx0)))
- return;
-
- if(ly0<ly1)
- {
- if (vertex[0].tow > vertex[1].tow)
- VFlipped = 3;
- }
- else
- {
- if (vertex[0].tow < vertex[1].tow)
- VFlipped = 4;
- }
- }
- else
- if(ly0==ly3)
- {
- if(!((lx3==lx2 && ly2==ly1 && lx1==lx0) ||
- (lx3==lx1 && ly1==ly2 && lx2==lx0)))
- return;
-
- if(ly0<ly1)
- {
- if (vertex[0].tow > vertex[1].tow)
- VFlipped = 5;
- }
- else
- {
- if (vertex[0].tow < vertex[1].tow)
- VFlipped = 6;
- }
- }
- else return;
-
- if(lx0==lx1)
- {
- if(lx0<lx2)
- {
- if (vertex[0].sow > vertex[2].sow)
- UFlipped = 1;
- }
- else
- {
- if (vertex[0].sow < vertex[2].sow)
- UFlipped = 2;
- }
- }
- else
- if(lx0==lx2)
- {
- if(lx0<lx1)
- {
- if (vertex[0].sow > vertex[1].sow)
- UFlipped = 3;
- }
- else
- {
- if (vertex[0].sow < vertex[1].sow)
- UFlipped = 4;
- }
- }
- else
- if(lx0==lx3)
- {
- if(lx0<lx1)
- {
- if (vertex[0].sow > vertex[1].sow)
- UFlipped = 5;
- }
- else
- {
- if (vertex[0].sow < vertex[1].sow)
- UFlipped = 6;
- }
- }
-
- if (UFlipped)
- {
-#ifdef OWNSCALE
- if(bUsingTWin)
- {
- switch(UFlipped)
- {
- case 1:
- vertex[2].sow+=0.95f/TWin.UScaleFactor;
- vertex[3].sow+=0.95f/TWin.UScaleFactor;
- break;
- case 2:
- vertex[0].sow+=0.95f/TWin.UScaleFactor;
- vertex[1].sow+=0.95f/TWin.UScaleFactor;
- break;
- case 3:
- vertex[1].sow+=0.95f/TWin.UScaleFactor;
- vertex[3].sow+=0.95f/TWin.UScaleFactor;
- break;
- case 4:
- vertex[0].sow+=0.95f/TWin.UScaleFactor;
- vertex[2].sow+=0.95f/TWin.UScaleFactor;
- break;
- case 5:
- vertex[1].sow+=0.95f/TWin.UScaleFactor;
- vertex[2].sow+=0.95f/TWin.UScaleFactor;
- break;
- case 6:
- vertex[0].sow+=0.95f/TWin.UScaleFactor;
- vertex[3].sow+=0.95f/TWin.UScaleFactor;
- break;
- }
- }
- else
- {
- switch(UFlipped)
- {
- case 1:
- vertex[2].sow+=1.0f/ST_FAC;
- vertex[3].sow+=1.0f/ST_FAC;
- break;
- case 2:
- vertex[0].sow+=1.0f/ST_FAC;
- vertex[1].sow+=1.0f/ST_FAC;
- break;
- case 3:
- vertex[1].sow+=1.0f/ST_FAC;
- vertex[3].sow+=1.0f/ST_FAC;
- break;
- case 4:
- vertex[0].sow+=1.0f/ST_FAC;
- vertex[2].sow+=1.0f/ST_FAC;
- break;
- case 5:
- vertex[1].sow+=1.0f/ST_FAC;
- vertex[2].sow+=1.0f/ST_FAC;
- break;
- case 6:
- vertex[0].sow+=1.0f/ST_FAC;
- vertex[3].sow+=1.0f/ST_FAC;
- break;
- }
- }
-#else
- if(bUsingTWin)
- {
- switch(UFlipped)
- {
- case 1:
- vertex[2].sow+=1.0f/TWin.UScaleFactor;
- vertex[3].sow+=1.0f/TWin.UScaleFactor;
- break;
- case 2:
- vertex[0].sow+=1.0f/TWin.UScaleFactor;
- vertex[1].sow+=1.0f/TWin.UScaleFactor;
- break;
- case 3:
- vertex[1].sow+=1.0f/TWin.UScaleFactor;
- vertex[3].sow+=1.0f/TWin.UScaleFactor;
- break;
- case 4:
- vertex[0].sow+=1.0f/TWin.UScaleFactor;
- vertex[2].sow+=1.0f/TWin.UScaleFactor;
- break;
- case 5:
- vertex[1].sow+=1.0f/TWin.UScaleFactor;
- vertex[2].sow+=1.0f/TWin.UScaleFactor;
- break;
- case 6:
- vertex[0].sow+=1.0f/TWin.UScaleFactor;
- vertex[3].sow+=1.0f/TWin.UScaleFactor;
- break;
- }
- }
- else
- {
- switch(UFlipped)
- {
- case 1:
- vertex[2].sow+=1.0f;
- vertex[3].sow+=1.0f;
- break;
- case 2:
- vertex[0].sow+=1.0f;
- vertex[1].sow+=1.0f;
- break;
- case 3:
- vertex[1].sow+=1.0f;
- vertex[3].sow+=1.0f;
- break;
- case 4:
- vertex[0].sow+=1.0f;
- vertex[2].sow+=1.0f;
- break;
- case 5:
- vertex[1].sow+=1.0f;
- vertex[2].sow+=1.0f;
- break;
- case 6:
- vertex[0].sow+=1.0f;
- vertex[3].sow+=1.0f;
- break;
- }
- }
-#endif
- }
-
- if (VFlipped)
- {
-#ifdef OWNSCALE
- if(bUsingTWin)
- {
- switch(VFlipped)
- {
- case 1:
- vertex[2].tow+=0.95f/TWin.VScaleFactor;
- vertex[3].tow+=0.95f/TWin.VScaleFactor;
- break;
- case 2:
- vertex[0].tow+=0.95f/TWin.VScaleFactor;
- vertex[1].tow+=0.95f/TWin.VScaleFactor;
- break;
- case 3:
- vertex[1].tow+=0.95f/TWin.VScaleFactor;
- vertex[3].tow+=0.95f/TWin.VScaleFactor;
- break;
- case 4:
- vertex[0].tow+=0.95f/TWin.VScaleFactor;
- vertex[2].tow+=0.95f/TWin.VScaleFactor;
- break;
- case 5:
- vertex[1].tow+=0.95f/TWin.VScaleFactor;
- vertex[2].tow+=0.95f/TWin.VScaleFactor;
- break;
- case 6:
- vertex[0].tow+=0.95f/TWin.VScaleFactor;
- vertex[3].tow+=0.95f/TWin.VScaleFactor;
- break;
- }
- }
- else
- {
- switch(VFlipped)
- {
- case 1:
- vertex[2].tow+=1.0f/ST_FAC;
- vertex[3].tow+=1.0f/ST_FAC;
- break;
- case 2:
- vertex[0].tow+=1.0f/ST_FAC;
- vertex[1].tow+=1.0f/ST_FAC;
- break;
- case 3:
- vertex[1].tow+=1.0f/ST_FAC;
- vertex[3].tow+=1.0f/ST_FAC;
- break;
- case 4:
- vertex[0].tow+=1.0f/ST_FAC;
- vertex[2].tow+=1.0f/ST_FAC;
- break;
- case 5:
- vertex[1].tow+=1.0f/ST_FAC;
- vertex[2].tow+=1.0f/ST_FAC;
- break;
- case 6:
- vertex[0].tow+=1.0f/ST_FAC;
- vertex[3].tow+=1.0f/ST_FAC;
- break;
- }
- }
-#else
- if(bUsingTWin)
- {
- switch(VFlipped)
- {
- case 1:
- vertex[2].tow+=1.0f/TWin.VScaleFactor;
- vertex[3].tow+=1.0f/TWin.VScaleFactor;
- break;
- case 2:
- vertex[0].tow+=1.0f/TWin.VScaleFactor;
- vertex[1].tow+=1.0f/TWin.VScaleFactor;
- break;
- case 3:
- vertex[1].tow+=1.0f/TWin.VScaleFactor;
- vertex[3].tow+=1.0f/TWin.VScaleFactor;
- break;
- case 4:
- vertex[0].tow+=1.0f/TWin.VScaleFactor;
- vertex[2].tow+=1.0f/TWin.VScaleFactor;
- break;
- case 5:
- vertex[1].tow+=1.0f/TWin.VScaleFactor;
- vertex[2].tow+=1.0f/TWin.VScaleFactor;
- break;
- case 6:
- vertex[0].tow+=1.0f/TWin.VScaleFactor;
- vertex[3].tow+=1.0f/TWin.VScaleFactor;
- break;
- }
- }
- else
- {
- switch(VFlipped)
- {
- case 1:
- vertex[2].tow+=1.0f;
- vertex[3].tow+=1.0f;
- break;
- case 2:
- vertex[0].tow+=1.0f;
- vertex[1].tow+=1.0f;
- break;
- case 3:
- vertex[1].tow+=1.0f;
- vertex[3].tow+=1.0f;
- break;
- case 4:
- vertex[0].tow+=1.0f;
- vertex[2].tow+=1.0f;
- break;
- case 5:
- vertex[1].tow+=1.0f;
- vertex[2].tow+=1.0f;
- break;
- case 6:
- vertex[0].tow+=1.0f;
- vertex[3].tow+=1.0f;
- break;
- }
- }
-#endif
- }
-
-}
- -void primPolyFT4(unsigned char * baseAddr) + +#define ST_FAC 255.99f + +static void RectTexAlign(void) +{ + int UFlipped = FALSE; + int VFlipped = FALSE; + + if(gTexName==gTexFrameName) return; + + if(ly0==ly1) + { + if(!((lx1==lx3 && ly3==ly2 && lx2==lx0) || + (lx1==lx2 && ly2==ly3 && lx3==lx0))) + return; + + if(ly0<ly2) + { + if (vertex[0].tow > vertex[2].tow) + VFlipped = 1; + } + else + { + if (vertex[0].tow < vertex[2].tow) + VFlipped = 2; + } + } + else + if(ly0==ly2) + { + if(!((lx2==lx3 && ly3==ly1 && lx1==lx0) || + (lx2==lx1 && ly1==ly3 && lx3==lx0))) + return; + + if(ly0<ly1) + { + if (vertex[0].tow > vertex[1].tow) + VFlipped = 3; + } + else + { + if (vertex[0].tow < vertex[1].tow) + VFlipped = 4; + } + } + else + if(ly0==ly3) + { + if(!((lx3==lx2 && ly2==ly1 && lx1==lx0) || + (lx3==lx1 && ly1==ly2 && lx2==lx0))) + return; + + if(ly0<ly1) + { + if (vertex[0].tow > vertex[1].tow) + VFlipped = 5; + } + else + { + if (vertex[0].tow < vertex[1].tow) + VFlipped = 6; + } + } + else return; + + if(lx0==lx1) + { + if(lx0<lx2) + { + if (vertex[0].sow > vertex[2].sow) + UFlipped = 1; + } + else + { + if (vertex[0].sow < vertex[2].sow) + UFlipped = 2; + } + } + else + if(lx0==lx2) + { + if(lx0<lx1) + { + if (vertex[0].sow > vertex[1].sow) + UFlipped = 3; + } + else + { + if (vertex[0].sow < vertex[1].sow) + UFlipped = 4; + } + } + else + if(lx0==lx3) + { + if(lx0<lx1) + { + if (vertex[0].sow > vertex[1].sow) + UFlipped = 5; + } + else + { + if (vertex[0].sow < vertex[1].sow) + UFlipped = 6; + } + } + + if (UFlipped) + { +#ifdef OWNSCALE + if(bUsingTWin) + { + switch(UFlipped) + { + case 1: + vertex[2].sow+=0.95f/TWin.UScaleFactor; + vertex[3].sow+=0.95f/TWin.UScaleFactor; + break; + case 2: + vertex[0].sow+=0.95f/TWin.UScaleFactor; + vertex[1].sow+=0.95f/TWin.UScaleFactor; + break; + case 3: + vertex[1].sow+=0.95f/TWin.UScaleFactor; + vertex[3].sow+=0.95f/TWin.UScaleFactor; + break; + case 4: + vertex[0].sow+=0.95f/TWin.UScaleFactor; + vertex[2].sow+=0.95f/TWin.UScaleFactor; + break; + case 5: + vertex[1].sow+=0.95f/TWin.UScaleFactor; + vertex[2].sow+=0.95f/TWin.UScaleFactor; + break; + case 6: + vertex[0].sow+=0.95f/TWin.UScaleFactor; + vertex[3].sow+=0.95f/TWin.UScaleFactor; + break; + } + } + else + { + switch(UFlipped) + { + case 1: + vertex[2].sow+=1.0f/ST_FAC; + vertex[3].sow+=1.0f/ST_FAC; + break; + case 2: + vertex[0].sow+=1.0f/ST_FAC; + vertex[1].sow+=1.0f/ST_FAC; + break; + case 3: + vertex[1].sow+=1.0f/ST_FAC; + vertex[3].sow+=1.0f/ST_FAC; + break; + case 4: + vertex[0].sow+=1.0f/ST_FAC; + vertex[2].sow+=1.0f/ST_FAC; + break; + case 5: + vertex[1].sow+=1.0f/ST_FAC; + vertex[2].sow+=1.0f/ST_FAC; + break; + case 6: + vertex[0].sow+=1.0f/ST_FAC; + vertex[3].sow+=1.0f/ST_FAC; + break; + } + } +#else + if(bUsingTWin) + { + switch(UFlipped) + { + case 1: + vertex[2].sow+=1.0f/TWin.UScaleFactor; + vertex[3].sow+=1.0f/TWin.UScaleFactor; + break; + case 2: + vertex[0].sow+=1.0f/TWin.UScaleFactor; + vertex[1].sow+=1.0f/TWin.UScaleFactor; + break; + case 3: + vertex[1].sow+=1.0f/TWin.UScaleFactor; + vertex[3].sow+=1.0f/TWin.UScaleFactor; + break; + case 4: + vertex[0].sow+=1.0f/TWin.UScaleFactor; + vertex[2].sow+=1.0f/TWin.UScaleFactor; + break; + case 5: + vertex[1].sow+=1.0f/TWin.UScaleFactor; + vertex[2].sow+=1.0f/TWin.UScaleFactor; + break; + case 6: + vertex[0].sow+=1.0f/TWin.UScaleFactor; + vertex[3].sow+=1.0f/TWin.UScaleFactor; + break; + } + } + else + { + switch(UFlipped) + { + case 1: + vertex[2].sow+=1.0f; + vertex[3].sow+=1.0f; + break; + case 2: + vertex[0].sow+=1.0f; + vertex[1].sow+=1.0f; + break; + case 3: + vertex[1].sow+=1.0f; + vertex[3].sow+=1.0f; + break; + case 4: + vertex[0].sow+=1.0f; + vertex[2].sow+=1.0f; + break; + case 5: + vertex[1].sow+=1.0f; + vertex[2].sow+=1.0f; + break; + case 6: + vertex[0].sow+=1.0f; + vertex[3].sow+=1.0f; + break; + } + } +#endif + } + + if (VFlipped) + { +#ifdef OWNSCALE + if(bUsingTWin) + { + switch(VFlipped) + { + case 1: + vertex[2].tow+=0.95f/TWin.VScaleFactor; + vertex[3].tow+=0.95f/TWin.VScaleFactor; + break; + case 2: + vertex[0].tow+=0.95f/TWin.VScaleFactor; + vertex[1].tow+=0.95f/TWin.VScaleFactor; + break; + case 3: + vertex[1].tow+=0.95f/TWin.VScaleFactor; + vertex[3].tow+=0.95f/TWin.VScaleFactor; + break; + case 4: + vertex[0].tow+=0.95f/TWin.VScaleFactor; + vertex[2].tow+=0.95f/TWin.VScaleFactor; + break; + case 5: + vertex[1].tow+=0.95f/TWin.VScaleFactor; + vertex[2].tow+=0.95f/TWin.VScaleFactor; + break; + case 6: + vertex[0].tow+=0.95f/TWin.VScaleFactor; + vertex[3].tow+=0.95f/TWin.VScaleFactor; + break; + } + } + else + { + switch(VFlipped) + { + case 1: + vertex[2].tow+=1.0f/ST_FAC; + vertex[3].tow+=1.0f/ST_FAC; + break; + case 2: + vertex[0].tow+=1.0f/ST_FAC; + vertex[1].tow+=1.0f/ST_FAC; + break; + case 3: + vertex[1].tow+=1.0f/ST_FAC; + vertex[3].tow+=1.0f/ST_FAC; + break; + case 4: + vertex[0].tow+=1.0f/ST_FAC; + vertex[2].tow+=1.0f/ST_FAC; + break; + case 5: + vertex[1].tow+=1.0f/ST_FAC; + vertex[2].tow+=1.0f/ST_FAC; + break; + case 6: + vertex[0].tow+=1.0f/ST_FAC; + vertex[3].tow+=1.0f/ST_FAC; + break; + } + } +#else + if(bUsingTWin) + { + switch(VFlipped) + { + case 1: + vertex[2].tow+=1.0f/TWin.VScaleFactor; + vertex[3].tow+=1.0f/TWin.VScaleFactor; + break; + case 2: + vertex[0].tow+=1.0f/TWin.VScaleFactor; + vertex[1].tow+=1.0f/TWin.VScaleFactor; + break; + case 3: + vertex[1].tow+=1.0f/TWin.VScaleFactor; + vertex[3].tow+=1.0f/TWin.VScaleFactor; + break; + case 4: + vertex[0].tow+=1.0f/TWin.VScaleFactor; + vertex[2].tow+=1.0f/TWin.VScaleFactor; + break; + case 5: + vertex[1].tow+=1.0f/TWin.VScaleFactor; + vertex[2].tow+=1.0f/TWin.VScaleFactor; + break; + case 6: + vertex[0].tow+=1.0f/TWin.VScaleFactor; + vertex[3].tow+=1.0f/TWin.VScaleFactor; + break; + } + } + else + { + switch(VFlipped) + { + case 1: + vertex[2].tow+=1.0f; + vertex[3].tow+=1.0f; + break; + case 2: + vertex[0].tow+=1.0f; + vertex[1].tow+=1.0f; + break; + case 3: + vertex[1].tow+=1.0f; + vertex[3].tow+=1.0f; + break; + case 4: + vertex[0].tow+=1.0f; + vertex[2].tow+=1.0f; + break; + case 5: + vertex[1].tow+=1.0f; + vertex[2].tow+=1.0f; + break; + case 6: + vertex[0].tow+=1.0f; + vertex[3].tow+=1.0f; + break; + } + } +#endif + } + +} + +static void primPolyFT4(unsigned char * baseAddr) { uint32_t *gpuData = ((uint32_t *)baseAddr); short *sgpuData = ((short *) baseAddr); @@ -3918,17 +3919,17 @@ void primPolyFT4(unsigned char * baseAddr) { SetZMask4O(); if(bUseMultiPass) SetOpaqueColor(gpuData[0]); - DEFOPAQUEON
-
- if(bSmallAlpha && iFilterType<=2)
- {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[3], &vertex[2]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- SetZMask4O();
- }
+ DEFOPAQUEON + + if(bSmallAlpha && iFilterType<=2) + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[3], &vertex[2]); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + SetZMask4O(); + } PRIMdrawTexturedQuad(&vertex[0], &vertex[1], &vertex[3], &vertex[2]); DEFOPAQUEOFF @@ -3941,7 +3942,7 @@ void primPolyFT4(unsigned char * baseAddr) // cmd: smooth shaded Texture3 //////////////////////////////////////////////////////////////////////// -void primPolyGT3(unsigned char *baseAddr) +static void primPolyGT3(unsigned char *baseAddr) { uint32_t *gpuData = ((uint32_t *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4050,7 +4051,7 @@ void primPolyGT3(unsigned char *baseAddr) // cmd: smooth shaded Poly3 //////////////////////////////////////////////////////////////////////// -void primPolyG3(unsigned char *baseAddr) +static void primPolyG3(unsigned char *baseAddr) { uint32_t *gpuData = ((uint32_t *)baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4095,7 +4096,7 @@ void primPolyG3(unsigned char *baseAddr) // cmd: smooth shaded Texture4 //////////////////////////////////////////////////////////////////////// -void primPolyGT4(unsigned char *baseAddr) +static void primPolyGT4(unsigned char *baseAddr) { uint32_t *gpuData = ((uint32_t *)baseAddr); short *sgpuData = ((short *)baseAddr); @@ -4215,7 +4216,7 @@ void primPolyGT4(unsigned char *baseAddr) // cmd: smooth shaded Poly3 //////////////////////////////////////////////////////////////////////// -void primPolyF3(unsigned char *baseAddr) +static void primPolyF3(unsigned char *baseAddr) { uint32_t *gpuData = ((uint32_t *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4259,7 +4260,7 @@ void primPolyF3(unsigned char *baseAddr) // cmd: skipping shaded polylines //////////////////////////////////////////////////////////////////////// -void primLineGSkip(unsigned char *baseAddr) +static void primLineGSkip(unsigned char *baseAddr) { uint32_t *gpuData = ((uint32_t *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4268,8 +4269,8 @@ void primLineGSkip(unsigned char *baseAddr) lx1 = sgpuData[2]; ly1 = sgpuData[3]; -
- while(!(((gpuData[i] & 0xF000F000) == 0x50005000) && i>=4))
+ + while(!(((gpuData[i] & 0xF000F000) == 0x50005000) && i>=4)) { i++; @@ -4284,7 +4285,7 @@ void primLineGSkip(unsigned char *baseAddr) // cmd: shaded polylines //////////////////////////////////////////////////////////////////////// -void primLineGEx(unsigned char *baseAddr) +static void primLineGEx(unsigned char *baseAddr) { uint32_t *gpuData = ((uint32_t *) baseAddr); int iMax=255; @@ -4302,11 +4303,11 @@ void primLineGEx(unsigned char *baseAddr) lx1 = (short)(gpuData[1] & 0xffff); i=2; -
+ //while((gpuData[i]>>24)!=0x55) - //while((gpuData[i]&0x50000000)!=0x50000000)
- // currently best way to check for poly line end:
- while(!(((gpuData[i] & 0xF000F000) == 0x50005000) && i>=4))
+ //while((gpuData[i]&0x50000000)!=0x50000000) + // currently best way to check for poly line end: + while(!(((gpuData[i] & 0xF000F000) == 0x50005000) && i>=4)) { ly0 = ly1;lx0=lx1; vertex[1].c.lcol=vertex[2].c.lcol=vertex[0].c.lcol; @@ -4317,8 +4318,8 @@ void primLineGEx(unsigned char *baseAddr) ly1 = (short)((gpuData[i]>>16) & 0xffff); lx1 = (short)(gpuData[i] & 0xffff); -
- if(offsetline()) bDraw=FALSE; else bDraw=TRUE;
+ + if(offsetline()) bDraw=FALSE; else bDraw=TRUE; if (bDraw && ((lx0 != lx1) || (ly0 != ly1))) { @@ -4348,7 +4349,7 @@ void primLineGEx(unsigned char *baseAddr) // cmd: shaded polyline2 //////////////////////////////////////////////////////////////////////// -void primLineG2(unsigned char *baseAddr) +static void primLineG2(unsigned char *baseAddr) { uint32_t *gpuData = ((uint32_t *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4393,7 +4394,7 @@ void primLineG2(unsigned char *baseAddr) // cmd: skipping flat polylines //////////////////////////////////////////////////////////////////////// -void primLineFSkip(unsigned char *baseAddr) +static void primLineFSkip(unsigned char *baseAddr) { uint32_t *gpuData = ((uint32_t *) baseAddr); int i=2,iMax=255; @@ -4401,7 +4402,7 @@ void primLineFSkip(unsigned char *baseAddr) ly1 = (short)((gpuData[1]>>16) & 0xffff); lx1 = (short)(gpuData[1] & 0xffff); - while(!(((gpuData[i] & 0xF000F000) == 0x50005000) && i>=3))
+ while(!(((gpuData[i] & 0xF000F000) == 0x50005000) && i>=3)) { ly1 = (short)((gpuData[i]>>16) & 0xffff); lx1 = (short)(gpuData[i] & 0xffff); @@ -4413,7 +4414,7 @@ void primLineFSkip(unsigned char *baseAddr) // cmd: drawing flat polylines //////////////////////////////////////////////////////////////////////// -void primLineFEx(unsigned char *baseAddr) +static void primLineFEx(unsigned char *baseAddr) { uint32_t *gpuData = ((uint32_t *) baseAddr); int iMax; @@ -4439,13 +4440,13 @@ void primLineFEx(unsigned char *baseAddr) // while((gpuData[i]>>24)!=0x55) // while((gpuData[i]&0x50000000)!=0x50000000) // currently best way to check for poly line end: - while(!(((gpuData[i] & 0xF000F000) == 0x50005000) && i>=3))
+ while(!(((gpuData[i] & 0xF000F000) == 0x50005000) && i>=3)) { ly0 = ly1;lx0=lx1; ly1 = (short)((gpuData[i]>>16) & 0xffff); lx1 = (short)(gpuData[i] & 0xffff); -
- if(!offsetline())
+ + if(!offsetline()) { if(iOffscreenDrawing) { @@ -4459,7 +4460,7 @@ void primLineFEx(unsigned char *baseAddr) lx0=cx0;lx1=cx1;ly0=cy0;ly1=cy1; } PRIMdrawFlatLine(&vertex[0], &vertex[1], &vertex[2], &vertex[3]); - }
+ } i++;if(i>iMax) break; } @@ -4471,7 +4472,7 @@ void primLineFEx(unsigned char *baseAddr) // cmd: drawing flat polyline2 //////////////////////////////////////////////////////////////////////// -void primLineF2(unsigned char *baseAddr) +static void primLineF2(unsigned char *baseAddr) { uint32_t *gpuData = ((uint32_t *) baseAddr); short *sgpuData = ((short *) baseAddr); @@ -4512,7 +4513,7 @@ void primLineF2(unsigned char *baseAddr) // cmd: well, easiest command... not implemented //////////////////////////////////////////////////////////////////////// -void primNI(unsigned char *bA) +static void primNI(unsigned char *bA) { } |
