/more/ whitespace cleanup

This commit is contained in:
csBlueChip 2009-09-03 03:09:02 +00:00
parent 1951835c9d
commit c81b5bacb3

View file

@ -27,6 +27,8 @@ THE SOFTWARE.
extern GRRLIB_drawSettings GRRLIB_Settings; extern GRRLIB_drawSettings GRRLIB_Settings;
extern Mtx GXmodelView2D; extern Mtx GXmodelView2D;
static guVector axis = (guVector){0, 0, 1};
/** /**
* Draw a texture. * Draw a texture.
* @param xpos Specifies the x-coordinate of the upper-left corner. * @param xpos Specifies the x-coordinate of the upper-left corner.
@ -44,8 +46,6 @@ void GRRLIB_DrawImg (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
u16 width, height; u16 width, height;
Mtx m, m1, m2, mv; Mtx m, m1, m2, mv;
guVector axis = (guVector){0, 0, 1};
if (tex == NULL || tex->data == NULL) return ; if (tex == NULL || tex->data == NULL) return ;
GX_InitTexObj(&texObj, tex->data, tex->w, tex->h, GX_InitTexObj(&texObj, tex->data, tex->w, tex->h,
@ -59,14 +59,14 @@ void GRRLIB_DrawImg (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE); GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT); GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
width = tex->w * 0.5;
height = tex->h * 0.5;
guMtxIdentity (m1); guMtxIdentity (m1);
guMtxScaleApply(m1, m1, scaleX, scaleY, 1.0); guMtxScaleApply(m1, m1, scaleX, scaleY, 1.0);
guMtxRotAxisDeg(m2, &axis, degrees); guMtxRotAxisDeg(m2, &axis, degrees);
guMtxConcat (m2, m1, m); guMtxConcat (m2, m1, m);
width = tex->w * 0.5;
height = tex->h * 0.5;
guMtxTransApply(m, m, guMtxTransApply(m, m,
xpos +width +tex->handlex xpos +width +tex->handlex
-tex->offsetx +( scaleX *(-tex->handley *sin(-DegToRad(degrees)) -tex->offsetx +( scaleX *(-tex->handley *sin(-DegToRad(degrees))
@ -95,10 +95,10 @@ void GRRLIB_DrawImg (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
GX_Color1u32 (color); GX_Color1u32 (color);
GX_TexCoord2f32(0, 1); GX_TexCoord2f32(0, 1);
GX_End(); GX_End();
GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0); GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE); GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
} }
/** /**
@ -112,8 +112,6 @@ void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex,
GXTexObj texObj; GXTexObj texObj;
Mtx m, m1, m2, mv; Mtx m, m1, m2, mv;
guVector axis = (guVector){0, 0, 1};
if (tex == NULL || tex->data == NULL) return ; if (tex == NULL || tex->data == NULL) return ;
GX_InitTexObj(&texObj, tex->data, tex->w, tex->h, GX_InitTexObj(&texObj, tex->data, tex->w, tex->h,
@ -131,8 +129,7 @@ void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex,
guMtxScaleApply(m1, m1, 1, 1, 1.0); guMtxScaleApply(m1, m1, 1, 1, 1.0);
guMtxRotAxisDeg(m2, &axis, 0); guMtxRotAxisDeg(m2, &axis, 0);
guMtxConcat (m2, m1, m); guMtxConcat (m2, m1, m);
guMtxConcat (GXmodelView2D, m, mv);
guMtxConcat(GXmodelView2D, m, mv);
GX_LoadPosMtxImm(mv, GX_PNMTX0); GX_LoadPosMtxImm(mv, GX_PNMTX0);
GX_Begin(GX_QUADS, GX_VTXFMT0, 4); GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
@ -152,10 +149,10 @@ void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex,
GX_Color1u32 (color); GX_Color1u32 (color);
GX_TexCoord2f32(0, 1); GX_TexCoord2f32(0, 1);
GX_End(); GX_End();
GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0); GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE); GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
} }
/** /**
@ -175,17 +172,15 @@ void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
GXTexObj texObj; GXTexObj texObj;
f32 width, height; f32 width, height;
Mtx m, m1, m2, mv; Mtx m, m1, m2, mv;
f32 s1, s2, t1, t2;
guVector axis = (guVector){0, 0, 1};
if (tex == NULL || tex->data == NULL) return ; if (tex == NULL || tex->data == NULL) return ;
// Frame Correction by spiffen // The 0.001f/x is the frame correction formula by spiffen
f32 FRAME_CORR = 0.001f; s1 = (( (frame %tex->nbtilew) ) /(f32)tex->nbtilew) +(0.001f /tex->w);
f32 s1 = (( (frame%tex->nbtilew) ) /(f32)tex->nbtilew) +(FRAME_CORR/tex->w); s2 = (( (frame %tex->nbtilew) +1) /(f32)tex->nbtilew) -(0.001f /tex->w);
f32 s2 = (( (frame%tex->nbtilew)+1) /(f32)tex->nbtilew) -(FRAME_CORR/tex->w); t1 = (((int)(frame /tex->nbtilew) ) /(f32)tex->nbtileh) +(0.001f /tex->h);
f32 t1 = (((int)(frame/tex->nbtilew) ) /(f32)tex->nbtileh) +(FRAME_CORR/tex->h); t2 = (((int)(frame /tex->nbtilew) +1) /(f32)tex->nbtileh) -(0.001f /tex->h);
f32 t2 = (((int)(frame/tex->nbtilew)+1) /(f32)tex->nbtileh) -(FRAME_CORR/tex->h);
GX_InitTexObj(&texObj, tex->data, GX_InitTexObj(&texObj, tex->data,
tex->tilew * tex->nbtilew, tex->tileh * tex->nbtileh, tex->tilew * tex->nbtilew, tex->tileh * tex->nbtileh,
@ -215,6 +210,7 @@ void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
-tex->offsety +( scaleX *(-tex->handley *cos(-DegToRad(degrees)) -tex->offsety +( scaleX *(-tex->handley *cos(-DegToRad(degrees))
+tex->handlex *sin(-DegToRad(degrees))) ), +tex->handlex *sin(-DegToRad(degrees))) ),
0); 0);
guMtxConcat(GXmodelView2D, m, mv); guMtxConcat(GXmodelView2D, m, mv);
GX_LoadPosMtxImm(mv, GX_PNMTX0); GX_LoadPosMtxImm(mv, GX_PNMTX0);
@ -235,10 +231,10 @@ void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex,
GX_Color1u32 (color); GX_Color1u32 (color);
GX_TexCoord2f32(s1, t2); GX_TexCoord2f32(s1, t2);
GX_End(); GX_End();
GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0); GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE); GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
} }
/** /**
@ -252,17 +248,15 @@ void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex,
const u32 color, const int frame) { const u32 color, const int frame) {
GXTexObj texObj; GXTexObj texObj;
Mtx m, m1, m2, mv; Mtx m, m1, m2, mv;
f32 s1, s2, t1, t2;
guVector axis = (guVector){0, 0, 1};
if (tex == NULL || tex->data == NULL) return ; if (tex == NULL || tex->data == NULL) return ;
// Frame Correction by spiffen // The 0.001f/x is the frame correction formula by spiffen
f32 FRAME_CORR = 0.001f; s1 = (( (frame %tex->nbtilew) ) /(f32)tex->nbtilew) +(0.001f /tex->w);
f32 s1 = (( (frame%tex->nbtilew) ) /(f32)tex->nbtilew) +(FRAME_CORR/tex->w); s2 = (( (frame %tex->nbtilew) +1) /(f32)tex->nbtilew) -(0.001f /tex->w);
f32 s2 = (( (frame%tex->nbtilew)+1) /(f32)tex->nbtilew) -(FRAME_CORR/tex->w); t1 = (((int)(frame /tex->nbtilew) ) /(f32)tex->nbtileh) +(0.001f /tex->h);
f32 t1 = (((int)(frame/tex->nbtilew) ) /(f32)tex->nbtileh) +(FRAME_CORR/tex->h); t2 = (((int)(frame /tex->nbtilew) +1) /(f32)tex->nbtileh) -(0.001f /tex->h);
f32 t2 = (((int)(frame/tex->nbtilew)+1) /(f32)tex->nbtileh) -(FRAME_CORR/tex->h);
GX_InitTexObj(&texObj, tex->data, GX_InitTexObj(&texObj, tex->data,
tex->tilew * tex->nbtilew, tex->tileh * tex->nbtileh, tex->tilew * tex->nbtilew, tex->tileh * tex->nbtileh,
@ -279,9 +273,8 @@ void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex,
guMtxIdentity (m1); guMtxIdentity (m1);
guMtxScaleApply(m1, m1, 1, 1, 1.0f); guMtxScaleApply(m1, m1, 1, 1, 1.0f);
guMtxRotAxisDeg(m2, &axis, 0); guMtxRotAxisDeg(m2, &axis, 0);
guMtxConcat(m2, m1, m); guMtxConcat (m2, m1, m);
guMtxConcat (GXmodelView2D, m, mv);
guMtxConcat(GXmodelView2D, m, mv);
GX_LoadPosMtxImm(mv, GX_PNMTX0); GX_LoadPosMtxImm(mv, GX_PNMTX0);
GX_Begin(GX_QUADS, GX_VTXFMT0, 4); GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
@ -301,10 +294,10 @@ void GRRLIB_DrawTileQuad (const guVector pos[4], GRRLIB_texImg *tex,
GX_Color1u32 (color); GX_Color1u32 (color);
GX_TexCoord2f32(s1, t2); GX_TexCoord2f32(s1, t2);
GX_End(); GX_End();
GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0); GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE); GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR);
GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
} }
/** /**