Skip to content

Commit

Permalink
Move nds trig functions to ds-trig.c
Browse files Browse the repository at this point in the history
  • Loading branch information
bl0ckeduser committed Nov 30, 2011
1 parent 4ab3e47 commit afd781b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
Binary file modified clown3d-DS.elf
Binary file not shown.
Binary file modified clown3d-DS.nds
Binary file not shown.
24 changes: 24 additions & 0 deletions ds-trig.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef PC_TARGET

#include <nds.h>

/*
NDS trigonometry routines.
Copied from sin() and cos() in nehe11.cpp, written by Dovoto.
*/

float my_sin(float angle)
{
int32 s = sinLerp((int)((angle * DEGREES_IN_CIRCLE) / 360.0));

return f32tofloat(s);
}

float my_cos(float angle)
{
int32 c = cosLerp((int)((angle * DEGREES_IN_CIRCLE) / 360.0));

return f32tofloat(c);
}

#endif
23 changes: 0 additions & 23 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,26 +489,3 @@ void runGameFrame(void)

gc_collect();
}

#ifndef PC_TARGET

/* The following routines were copied from
nehe11.cpp, written by Dovoto, and renamed
from sin, cos to my_sin, my_cos because
it didn't seem to build otherwise */

float my_sin(float angle)
{
int32 s = sinLerp((int)((angle * DEGREES_IN_CIRCLE) / 360.0));

return f32tofloat(s);
}

float my_cos(float angle)
{
int32 c = cosLerp((int)((angle * DEGREES_IN_CIRCLE) / 360.0));

return f32tofloat(c);
}

#endif

0 comments on commit afd781b

Please sign in to comment.