Don't have an account? Register now to chat, post, use our tools, and much more.
Online Users
There are 112 users online: 6 members, 98 guests and 8 bots.
Members: charlessprinkle, FINAL, flyingfisch, FrozenFire49, LuxenD.
Bots: Spinn3r (1), MSN/Bing (2), Magpie Crawler (3), Googlebot (2).
SAX
 » Goto page 1, 2, 3, 4, 5  Next
Author Message
zeldaking

Expert

Joined: 31 Jul 2011
Posts: 604
Location: Utah

 Posted: 25 Apr 2012 07:45:31 pm    Post subject: [Prizm] Asteroids Hey all. I am wanting to make this into Prizm C (C for the Prizm) and have this basic code as an outline for an Asteroids clone. This is a computer C project but I wanted the Prizm to see it also. I just need some help translating the code. If you help considerably you will be in the credits. Here is the code: Code: ``` #include #include #include #include #include typedef struct   {   float x, y;    // 2D coordinates, a float so we can store fractional values   } POINT; typedef struct   {   int    NumPoints;   POINT  Point[ 3 ];   // Three is enough for now but will have to make   } SHAPE;             // this more flexible later. typedef struct   {   POINT  Loc;             // Location on the screen   int    ViewAngle;       // Angle at which the object is facing   POINT  Direction;       // Direction which the object is moving, in pixels   SHAPE  Shape;           // The shape of the object   SHAPE  Screen;          // Actual points it occupies on the screen   } OBJECT; struct   {   OBJECT Ship;            // The players spaceship   } g; // Translates a point by rotating it (using simple trig). void TranslatePoint( POINT *Dest, POINT *Src, int Angle )   {   double Radians;   Radians = Angle * 0.01745;   Dest->x = Src->x * cos( Radians ) - Src->y * sin( Radians );   Dest->y = Src->x * sin( Radians ) + Src->y * cos( Radians );   } // Translates an object's relative coordinates to actual // screen coordinates. void TranslateObject( OBJECT *Object )   {   int i;   for( i = 0; i < Object->Shape.NumPoints; i++ )     {     // First, account for rotation     TranslatePoint( &Object->Screen.Point[ i ], &Object->Shape.Point[ i ], Object->ViewAngle );     // Now make it relative to the screen location     Object->Screen.Point[ i ].x += Object->Loc.x;     Object->Screen.Point[ i ].y += Object->Loc.y;     }   } // Goes through the list of points in an object // and connects them all with lines. void DrawObject( OBJECT *Object )   {   int i;   for( i = 1; i < Object->Shape.NumPoints; i++ )     {     line( Object->Screen.Point[ i - 1 ].x, Object->Screen.Point[ i - 1 ].y,           Object->Screen.Point[ i     ].x, Object->Screen.Point[ i     ].y );     }   line( Object->Screen.Point[ i - 1 ].x, Object->Screen.Point[ i - 1 ].y,         Object->Screen.Point[ 0     ].x, Object->Screen.Point[ 0     ].y );   } // Moves an object along its direction. void MoveObject( OBJECT *Object )   {   Object->Loc.x += Object->Direction.x;   Object->Loc.y += Object->Direction.y;   // Handle screen wrap-around   if( Object->Loc.x < 0 )    Object->Loc.x = Object->Loc.x + 640;   if( Object->Loc.x > 639 )  Object->Loc.x = Object->Loc.x - 640;   if( Object->Loc.y < 0 )    Object->Loc.y = Object->Loc.y + 480;   if( Object->Loc.y > 479 )  Object->Loc.y = Object->Loc.y - 480;   } // This routine just waits until the display is // in a vertical retrace cycle.  This is useful // for two things: to perform drawing during retrace // when it can't be seen and (more importantly) // to provide a method of synchronizing the animation // with the game play so that it runs at a constant // speed on virtually every machine. void SyncToVerticalRetrace( void )   {   // If we happen to be in the middle of a vertical retrace   // period wait until its over.   while( inp( 0x3da ) & 8 )     ;   // Wait until we begin vertical retrace.   while( !(inp( 0x3da ) & 8) )     ;   } #define ROTATE_STEP  3       // Number of degrees to rotate #define SPEED        0.12    // Speed control #define FRICTION     0.995   // Speed reduction per frame void Supervisor( void )   {   unsigned short KeyboardStatus;   int c = 0, EraseFlag = 1, Color = WHITE;   while( c != 'q' && c != 'Q' )     {     TranslateObject( &g.Ship );     DrawObject( &g.Ship );   // Draw the ship     // Get the keyboard status bits from the BIOS data area     KeyboardStatus = *(unsigned short far *)MK_FP( 0x40, 0x17 );     MoveObject( &g.Ship );     // Simulate friction.     g.Ship.Direction.x *= FRICTION;     g.Ship.Direction.y *= FRICTION;     // If a real keystroke is waiting get it     if( kbhit() )       {       c = getch();       if( c == 'e' || c == 'E' )         {         EraseFlag = !EraseFlag;    // Toggle erase flag         }       }     if( KeyboardStatus & 0x0002 )    // left shift, rotate left       {       g.Ship.ViewAngle -= ROTATE_STEP;       if( g.Ship.ViewAngle < 0 )  g.Ship.ViewAngle = 360 - ROTATE_STEP;       }     if( KeyboardStatus & 0x0001 )    // right shift, rotate right       {       g.Ship.ViewAngle += ROTATE_STEP;       if( g.Ship.ViewAngle > 359 )  g.Ship.ViewAngle = 0 + ROTATE_STEP;       }     if( KeyboardStatus & 0x4000 )    // shift-lock, fire       {       // Not supported yet.       }     if( KeyboardStatus & 0x0008 )    // alt, thrust       {       double Radians;       Radians = g.Ship.ViewAngle * 0.01745;       g.Ship.Direction.x += sin( Radians ) * SPEED;       g.Ship.Direction.y -= cos( Radians ) * SPEED;       }     SyncToVerticalRetrace();     // Pause until vertical retrace     if( EraseFlag )  DrawObject( &g.Ship );    // Erase the ship     if( c == 'c' || c == 'C' )   // Change color       {       Color ^= (WHITE ^ LIGHTGREEN);       setcolor( Color );       c = 0;       }     }   } // Initialization code. void Init( void )   {   int GraphicsDriver = VGA;     // assume VGA graphics card   int GraphicsMode = VGAHI;     // use VGA 640x480 16 color mode   initgraph( &GraphicsDriver, &GraphicsMode, NULL );   setwritemode( XOR_PUT );   g.Ship.Shape.NumPoints = 3;   g.Ship.Shape.Point[ 0 ].x =   0;   g.Ship.Shape.Point[ 0 ].y = -16;   g.Ship.Shape.Point[ 1 ].x =  -8;   g.Ship.Shape.Point[ 1 ].y =  +8;   g.Ship.Shape.Point[ 2 ].x =  +8;   g.Ship.Shape.Point[ 2 ].y =  +8;   g.Ship.ViewAngle = 0;   g.Ship.Loc.x = 320;   g.Ship.Loc.y = 240;   g.Ship.Direction.x = 0;   g.Ship.Direction.y = 0;   } void Cleanup( void )   {   closegraph();   } void main( int Argc, char *Argv[] )   {   puts( "\n\n" );   puts( "Asteroids.  April 2012, \"What's the Code?\"\n" );   puts( "Left shift:   Rotate left" );   puts( "Right shift:  Rotate right" );   puts( "Alt:          Thrust" );   puts( "E:            Toggle 'erase' mode" );   puts( "C:            Toggle color between white and green" );   puts( "Q:            Quit\n" );   puts( "Press any key to begin..." );   getch();   Init();   Supervisor();   Cleanup();   } ``` I know this might be a little bit of work, but thanks for helping. Also notice this is not a workable game yet so give some advice. Thanks_________________Last edited by zeldaking on 26 Apr 2012 08:58:27 pm; edited 2 times in total
Spenceboy98

Super-Expert

Joined: 06 Jan 2012
Posts: 902
Location: In the TARDIS

 Posted: 25 Apr 2012 07:57:14 pm    Post subject: I'm pretty sure I know what Asteroids is, but I'm not quite sure. It would be cool to clone for the Prizm. I would, but you already know that I am not very good with C.
krazylegodrummer56

Power User

Joined: 20 Nov 2011
Posts: 448

 Posted: 25 Apr 2012 08:03:18 pm    Post subject: cool! can't wait._________________Projects: Learn how to program in Prizm C First C program! Tic-Tac-Toe: Get it HERE!
zeldaking

Expert

Joined: 31 Jul 2011
Posts: 604
Location: Utah

 Posted: 25 Apr 2012 08:04:27 pm    Post subject: Notice the Help Me sign? Thanks for the support guys._________________
seana11

Super-Expert

Joined: 23 May 2011
Posts: 836
Location: Well, the sign says "You are here"...

Posted: 25 Apr 2012 08:17:01 pm    Post subject:

 Spenceboy98 wrote: I'm pretty sure I know what Asteroids is, but I'm not quite sure. It would be cool to clone for the Prizm. I would, but you already know that I am not very good with C.

Today's youth...
_________________

Code:
```-----BEGIN GEEK CODE BLOCK----- GCS d- s+: a---@ C+++ UL++ P L+++ E- W++ N o? K? w--- O? M-- V- PS++(--) PE- Y+ PGP t 5? X(+) R tv-- b++(+++) DI+(++) D(+) G e-(*)>++@ h! r!>+++ y? ------END GEEK CODE BLOCK------```
decoded
elfprince13

OVER NINE THOUSAND!

Joined: 23 May 2005
Posts: 10567
Location: A galaxy far far away......

Posted: 25 Apr 2012 11:37:28 pm    Post subject:

 Spenceboy98 wrote: I'm pretty sure I know what Asteroids is, but I'm not quite sure.

What is this, I don't even? Although.....I guess the correct meme would be "I'm -1-2- 14 and what is this?"

I'm suddenly very sad that the vast majority of our new users will no longer have any claim on having participated in 90s culture.
_________________
StickFigure Graphic Productions || VSHI: Vermont Sustainable Heating Initiative

Such ashy church, much Burzum

Joined: 01 Dec 2010
Posts: 2453
Location: There lived a certain man in Russia long ago

Posted: 26 Apr 2012 06:04:57 am    Post subject:

I spy, with my little eye... a lot of floating point math you'll have to convert. I would ping KermM about his FP library, you'll need it if you want to port this as-is.

elfprince13 wrote:
 Spenceboy98 wrote: I'm suddenly very sad that the vast majority of our new users will no longer have any claim on having participated in 90s culture.

Wouldn't that be more of 80's culture? Either way, agreed, I find the question "What is Asteroids" incredibly saddening.
_________________
IT IS NOTHING BUT BLACK METAL NOVEMBER

YOU HAVE NO EXCUSES
flyingfisch

Super-Expert

Joined: 02 Feb 2012
Posts: 970
Location: Akron, OH

 Posted: 26 Apr 2012 09:23:39 am    Post subject: I know what asteroids is... love it!_________________
KermMartian

Joined: 14 Mar 2005
Posts: 57348

 Posted: 26 Apr 2012 09:42:47 am    Post subject: ANYWAY, getting back on topic. You'll need: 1) My trig routines 2) The built-in floating point support or my FP library. I recommend the former. 3) Line routines and such, which we certainly have._________________
zeldaking

Expert

Joined: 31 Jul 2011
Posts: 604
Location: Utah

 Posted: 26 Apr 2012 09:59:46 am    Post subject: Where can I get the FP library? I will start by changing the line routines into the prizm type. I should have time today._________________
KermMartian

Joined: 14 Mar 2005
Posts: 57348

Posted: 26 Apr 2012 10:20:37 am    Post subject:

 zeldaking wrote: Where can I get the FP library? I will start by changing the line routines into the prizm type. I should have time today.
I think it would be better to use our software floating point support than my FP library for this; I will send you my sin/cos/tan routines that use them.
_________________

zeldaking

Expert

Joined: 31 Jul 2011
Posts: 604
Location: Utah

 Posted: 26 Apr 2012 10:46:16 am    Post subject: Oh okay, sorry I mistunderstood you._________________
KermMartian

Joined: 14 Mar 2005
Posts: 57348

 Posted: 26 Apr 2012 03:57:41 pm    Post subject: Here's my sinfcosf.c file: Code: ``` extern  float  __sinf(float); extern  float  __tanf(float); #include "gcas2.h" #define EXTRA_PRECISION float __sinf(float x) {    while (x > PI) x-=(2.f*PI);    while (x < -PI) x+=(2.f*PI);     const float B = 4/PI;     const float C = -4/(PISQUARED);     float y = B * x + C * x * fabsf(x);     #ifdef EXTRA_PRECISION     //  const float Q = 0.7775;         const float P = 0.224008178776;         y = P * (y * fabsf(y) - y) + y;   // Q * y + P * y * abs(y)     #endif        return y; } float __tanf(float x) {    float y = __sinf(x);    return y/((PIOVERTWO)-y); } ``` You probably also need these, from my gcas2.h: Code: ```#define PIOVERTWO 1.570796327f #define PI 3.141592654f #define PISQUARED 9.869604401f float __sinf(float); float __tanf(float); #define __cosf(x) __sinf((PIOVERTWO)+(x)) #define msinf __sinf #define mcosf __cosf #define mtanf __tanf ``` Then just use msinf, mcosf, and mtanf in your code!_________________
zeldaking

Expert

Joined: 31 Jul 2011
Posts: 604
Location: Utah

 Posted: 26 Apr 2012 08:56:24 pm    Post subject: I noticed this: Code: ``` #include "gcas2.h" ``` Where is this file? Is it in the sdk already? Or do I make it and add the code above (the bottom section)?_________________
PierrotLL

Joined: 29 Nov 2011
Posts: 72
Location: France

 Posted: 26 Apr 2012 09:12:54 pm    Post subject: If you need it, I made a tiny fixed-point lib : fixed.h Code: ```#ifndef FIXED_H #define FIXED_H // Bit lenght of the decimal part, change it to change the precision : #define DB 15 typedef int fix; // Fixed dot manipulations functions and macros : #define FIX(x) ((x)<>DB) char* fixtostr (fix n, char* string); fix ftofix(float f); float fixtof(fix f); fix fdiv(fix x, fix y); fix fmul(fix x, fix y); fix fsqrt(fix f); fix fsin(fix a); fix fcos(fix a); fix ftan(fix a); #endif // FIXED_H ``` fixed.c Code: ```#include "fixed.h" char* fixtostr (fix f, char* string) {    int n;    int  i;    int  cpt;    int start = 0;    n = UNFIX(f);             if (n<0) {       start=1;       string[0] = '-';       n *= -1;    }    for (i = 1, cpt = 1; n / i >= 10; i *= 10, cpt++);    for (cpt = start; i; cpt++, i /= 10) string[cpt] = (n / i) % 10 + '0';    string[cpt] = '\0';    return string; } fix ftofix(float f) {    return f*(1<> DB); #else    if (y>(1<<(2*DB-2))) return x/(y>>DB);    return fmul(x, ((1<<(2*DB))/y)); #endif } fix fmul(fix x, fix y) { #ifdef _64bits    return (fix) ((((long long)x) << DB) / y); #else    int d1, d2, e1, e2;    e1 = x >> DB;    e2 = y >> DB;    d1 = x & (0xFFFFFFFF>>(32-DB));    d2 = y & (0xFFFFFFFF>>(32-DB));    return ((e1*e2)<>DB); #endif } fix fsqrt(fix f) {    int i, s;    s = (f + (1<> 1;    /* 6 iterations to converge */    for (i = 0; i < 6; i++)       s = (s + fdiv(f, s)) >> 1;    return s; } // Precomputed table of sinus value, between 0 and 90° inclued with step of 0.1°. // Values are in fixed 30 bits of decimal. int precalc_sin[901] = {    0,         1874032,   3748058,   5622073,   7496071,   9370046,   11243993,    13117905,   14991777,   16865604,   18739378,   20613096,   22486752,   24360338,    26233852,   28107284,   29980632,   31853888,   33727044,   35600100,   37473048,    39345884,   41218596,   43091184,   44963640,   46835960,   48708136,   50580168,    52452040,   54323756,   56195304,   58066684,   59937884,   61808904,   63679732,    65550372,   67420808,   69291040,   71161056,   73030864,   74900440,   76769800,    78638912,   80507792,   82376432,   84244816,   86112936,   87980800,   89848400,    91715720,   93582768,   95449528,   97315992,   99182160,   101048032,   102913592,    104778840,   106643768,   108508376,   110372648,   112236584,   114100176,   115963424,    117826320,   119688856,   121551024,   123412824,   125274248,   127135296,   128995952,    130856208,   132716072,   134575536,   136434592,   138293216,   140151424,   142009216,    143866576,   145723488,   147579952,   149435984,   151291552,   153146656,   155001296,    156855456,   158709152,   160562352,   162415072,   164267296,   166119008,   167970224,    169820928,   171671120,   173520784,   175369920,   177218512,   179066576,   180914096,    182761056,   184607472,   186453312,   188298592,   190143296,   191987424,   193830960,    195673904,   197516256,   199358016,   201199152,   203039680,   204879600,   206718880,    208557552,   210395568,   212232960,   214069696,   215905776,   217741200,   219575968,    221410064,   223243472,   225076224,   226908272,   228739632,   230570304,   232400272,    234229520,   236058064,   237885888,   239712992,   241539360,   243364992,   245189872,    247014032,   248837424,   250660048,   252481920,   254303024,   256123344,   257942896,    259761664,   261579632,   263396800,   265213168,   267028736,   268843488,   270657408,    272470528,   274282784,   276094240,   277904832,   279714592,   281523488,   283331520,    285138720,   286945024,   288750464,   290555008,   292358688,   294161472,   295963360,    297764352,   299564416,   301363584,   303161824,   304959168,   306755552,   308551008,    310345536,   312139104,   313931712,   315723392,   317514112,   319303840,   321092608,    322880384,   324667200,   326453024,   328237824,   330021664,   331804480,   333586272,    335367072,   337146848,   338925568,   340703296,   342479936,   344255584,   346030144,    347803680,   349576160,   351347552,   353117888,   354887136,   356655296,   358422400,    360188384,   361953280,   363717088,   365479744,   367241344,   369001792,   370761120,    372519328,   374276384,   376032320,   377787104,   379540736,   381293184,   383044512,    384794656,   386543616,   388291424,   390038048,   391783456,   393527680,   395270720,    397012544,   398753184,   400492576,   402230752,   403967712,   405703456,   407437952,    409171200,   410903200,   412633952,   414363456,   416091680,   417818656,   419544352,    421268768,   422991904,   424713760,   426434304,   428153568,   429871488,   431588128,    433303456,   435017472,   436730144,   438441504,   440151520,   441860192,   443567488,    445273472,   446978112,   448681344,   450383232,   452083776,   453782912,   455480672,    457177024,   458872000,   460565600,   462257760,   463948544,   465637888,   467325824,    469012352,   470697440,   472381088,   474063296,   475744064,   477423392,   479101248,    480777664,   482452608,   484126080,   485798080,   487468576,   489137632,   490805152,    492471200,   494135744,   495798784,   497460320,   499120352,   500778848,   502435808,    504091264,   505745152,   507397536,   509048352,   510697600,   512345312,   513991456,    515636064,   517279072,   518920512,   520560352,   522198624,   523835328,   525470400,    527103904,   528735776,   530366048,   531994688,   533621728,   535247136,   536870912,    538493056,   540113536,   541732416,   543349632,   544965184,   546579072,   548191296,    549801856,   551410752,   553017920,   554623424,   556227264,   557829376,   559429824,    561028544,   562625600,   564220864,   565814464,   567406336,   568996480,   570584896,    572171520,   573756480,   575339648,   576921088,   578500736,   580078656,   581654784,    583229120,   584801728,   586372544,   587941504,   589508736,   591074176,   592637824,    594199680,   595759680,   597317888,   598874240,   600428800,   601981568,   603532416,    605081472,   606628672,   608174080,   609717568,   611259264,   612799040,   614336960,    615873024,   617407168,   618939456,   620469888,   621998400,   623525056,   625049792,    626572608,   628093504,   629612544,   631129600,   632644800,   634158016,   635669312,    637178688,   638686080,   640191616,   641695104,   643196672,   644696320,   646193984,    647689664,   649183360,   650675072,   652164864,   653652608,   655138368,   656622144,    658103936,   659583680,   661061504,   662537216,   664010944,   665482688,   666952320,    668420032,   669885632,   671349184,   672810688,   674270208,   675727616,   677182976,    678636288,   680087552,   681536704,   682983808,   684428800,   685871744,   687312576,    688751296,   690187968,   691622464,   693054912,   694485248,   695913472,   697339520,    698763520,   700185344,   701605056,   703022592,   704438016,   705851264,   707262400,    708671424,   710078208,   711482880,   712885312,   714285632,   715683776,   717079744,    718473536,   719865088,   721254464,   722641664,   724026688,   725409472,   726790016,    728168384,   729544576,   730918464,   732290176,   733659648,   735026880,   736391872,    737754624,   739115072,   740473344,   741829312,   743183104,   744534528,   745883776,    747230656,   748575360,   749917696,   751257792,   752595584,   753931072,   755264320,    756595200,   757923840,   759250112,   760574080,   761895808,   763215104,   764532160,    765846848,   767159168,   768469248,   769776896,   771082240,   772385216,   773685888,    774984128,   776280064,   777573632,   778864832,   780153600,   781440064,   782724096,    784005760,   785285056,   786561920,   787836416,   789108544,   790378240,   791645504,    792910400,   794172864,   795432896,   796690496,   797945664,   799198464,   800448768,    801696640,   802942080,   804185088,   805425600,   806663744,   807899328,   809132544,    810363264,   811591488,   812817280,   814040576,   815261376,   816479680,   817695552,    818908864,   820119744,   821328128,   822533952,   823737280,   824938176,   826136512,    827332288,   828525568,   829716352,   830904576,   832090304,   833273472,   834454144,    835632192,   836807744,   837980800,   839151232,   840319104,   841484416,   842647232,    843807424,   844965056,   846120128,   847272576,   848422464,   849569792,   850714496,    851856640,   852996224,   854133120,   855267456,   856399232,   857528320,   858654848,    859778752,   860900032,   862018688,   863134720,   864248128,   865358912,   866467008,    867572544,   868675392,   869775616,   870873152,   871968064,   873060288,   874149888,    875236800,   876321088,   877402624,   878481600,   879557824,   880631360,   881702272,    882770432,   883835968,   884898752,   885958848,   887016320,   888070976,   889123008,    890172288,   891218880,   892262784,   893303936,   894342400,   895378112,   896411072,    897441344,   898468864,   899493632,   900515648,   901534976,   902551488,   903565312,    904576384,   905584640,   906590208,   907592960,   908593024,   909590208,   910584704,    911576384,   912565312,   913551488,   914534848,   915515392,   916493184,   917468160,    918440384,   919409792,   920376384,   921340160,   922301184,   923259328,   924214720,    925167296,   926116992,   927063936,   928008000,   928949248,   929887680,   930823296,    931756032,   932686016,   933613056,   934537344,   935458688,   936377280,   937292928,    938205760,   939115776,   940022848,   940927104,   941828544,   942727040,   943622720,    944515456,   945405376,   946292352,   947176512,   948057728,   948936128,   949811584,    950684160,   951553856,   952420608,   953284480,   954145472,   955003584,   955858752,    956710976,   957560320,   958406720,   959250240,   960090816,   960928448,   961763200,    962594944,   963423808,   964249792,   965072768,   965892800,   966709888,   967524096,    968335296,   969143552,   969948864,   970751232,   971550656,   972347072,   973140608,    973931072,   974718656,   975503232,   976284864,   977063488,   977839104,   978611840,    979381504,   980148224,   980911936,   981672704,   982430464,   983185216,   983936960,    984685760,   985431552,   986174272,   986914048,   987650816,   988384576,   989115328,    989843008,   990567744,   991289408,   992008064,   992723776,   993436352,   994145984,    994852544,   995556096,   996256576,   996954048,   997648512,   998339904,   999028288,    999713600,   1000395840,   1001075072,   1001751232,   1002424320,   1003094400,   1003761408,    1004425408,   1005086272,   1005744128,   1006398848,   1007050560,   1007699200,   1008344768,    1008987264,   1009626688,   1010263040,   1010896320,   1011526464,   1012153600,   1012777600,    1013398528,   1014016384,   1014631168,   1015242816,   1015851392,   1016456896,   1017059264,    1017658560,   1018254784,   1018847872,   1019437824,   1020024704,   1020608512,   1021189184,    1021766720,   1022341120,   1022912448,   1023480704,   1024045760,   1024607744,   1025166592,    1025722304,   1026274944,   1026824384,   1027370752,   1027913984,   1028454080,   1028991040,    1029524864,   1030055552,   1030583104,   1031107520,   1031628736,   1032146880,   1032661888,    1033173696,   1033682368,   1034187904,   1034690304,   1035189568,   1035685632,   1036178560,    1036668352,   1037154944,   1037638400,   1038118720,   1038595840,   1039069824,   1039540608,    1040008256,   1040472704,   1040934016,   1041392128,   1041847104,   1042298880,   1042747520,    1043192896,   1043635200,   1044074240,   1044510144,   1044942848,   1045372416,   1045798720,    1046221888,   1046641856,   1047058624,   1047472256,   1047882624,   1048289856,   1048693888,    1049094720,   1049492352,   1049886784,   1050278016,   1050666048,   1051050880,   1051432512,    1051810944,   1052186112,   1052558144,   1052926976,   1053292608,   1053654976,   1054014144,    1054370112,   1054722880,   1055072448,   1055418816,   1055761920,   1056101824,   1056438528,    1056771968,   1057102272,   1057429248,   1057753088,   1058073664,   1058391040,   1058705152,    1059016128,   1059323776,   1059628288,   1059929472,   1060227520,   1060522304,   1060813824,    1061102144,   1061387200,   1061669056,   1061947712,   1062223104,   1062495232,   1062764160,    1063029824,   1063292224,   1063551424,   1063807424,   1064060096,   1064309568,   1064555840,    1064798784,   1065038528,   1065275072,   1065508288,   1065738304,   1065965056,   1066188608,    1066408896,   1066625856,   1066839680,   1067050176,   1067257472,   1067461440,   1067662208,    1067859776,   1068054016,   1068245056,   1068432768,   1068617280,   1068798528,   1068976512,    1069151232,   1069322752,   1069490944,   1069655936,   1069817600,   1069976064,   1070131264,    1070283200,   1070431808,   1070577216,   1070719360,   1070858240,   1070993856,   1071126272,    1071255360,   1071381184,   1071503744,   1071623040,   1071739072,   1071851840,   1071961344,    1072067584,   1072170560,   1072270272,   1072366720,   1072459904,   1072549824,   1072636480,    1072719872,   1072800000,   1072876800,   1072950400,   1073020672,   1073087744,   1073151488,    1073211968,   1073269248,   1073323200,   1073373888,   1073421312,   1073465472,   1073506304,    1073543936,   1073578304,   1073609344,   1073637184,   1073661696,   1073682944,   1073700928,    1073715648,   1073727104,   1073735296,   1073740160,   1073741824   }; fix fsin(fix a) {    int v;    if(a<0) v = 3600+UNFIX(a*10)%3600;    else v = UNFIX(a*10)%3600;    if (v<=900) return precalc_sin[v]>>(30-DB);    if (v<=1800) return precalc_sin[1800-v]>>(30-DB);    if (v<=2700) return -(precalc_sin[v-1800]>>(30-DB));    return -(precalc_sin[3600-v]>>(30-DB)); } fix fcos(fix a) {    return fsin(FIX(90)-a); } fix ftan(fix a) {    return fdiv(fsin(a), fcos(a)); } ```_________________My fx-9860G & Prizm games My fx-9860G graphic library, MonochromeLib
KermMartian

Joined: 14 Mar 2005
Posts: 57348

Posted: 26 Apr 2012 10:57:05 pm    Post subject:

 zeldaking wrote: I noticed this: Code: ``` #include "gcas2.h" ``` Where is this file? Is it in the sdk already? Or do I make it and add the code above (the bottom section)?
The latter thing. Might as well call it sinfcosf.h.

Pierrot: My fixed-point library looks very very similar to that. We should compare notes one day.
_________________

Eiyeron

Member

Joined: 12 Dec 2011
Posts: 158

Posted: 27 Apr 2012 03:50:54 am    Post subject:

 PierrotLL wrote: If you need it, I made a tiny fixed-point lib : --snip--

I already saw that source in the Kristaba's 3d engine. It was yours?
_________________
KermMartian

Joined: 14 Mar 2005
Posts: 57348

Posted: 27 Apr 2012 08:32:58 am    Post subject:

Eiyeron wrote:
 PierrotLL wrote: If you need it, I made a tiny fixed-point lib : --snip--

I already saw that source in the Kristaba's 3d engine. It was yours?
What's Kirstaba's 3D Engine, and why isn't it here? We're getting off-topic, though; let's stick with helping Zeldaking get his Asteroids game ported over. We should share our fixed-point and trig libraries in the Useful Prizm Routines topic.
_________________

PierrotLL

Joined: 29 Nov 2011
Posts: 72
Location: France

Posted: 27 Apr 2012 10:21:56 am    Post subject:

 Eiyeron wrote: I already saw that source in the Kristaba's 3d engine. It was yours?

It's my improvement of the Kristaba's snippet

@Kerm, I think all fixed-point libraries look alike ^^
Do you have more functions in yours, like asin/acos/atan or sinh/cosh/tanh ? :p
_________________
My fx-9860G & Prizm games
My fx-9860G graphic library, MonochromeLib
KermMartian

Joined: 14 Mar 2005
Posts: 57348

 Posted: 27 Apr 2012 10:24:17 am    Post subject: Sadly, I have neither the inverse nor hyperbolic trigonometric functions in mine. I didn't really bother updating my library anymore once the PrizmSDK got working software floats._________________
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
 » Goto page 1, 2, 3, 4, 5  Next Page 1 of 5 » All times are GMT - 5 Hours

 Jump to: Select a forum Announcements----------------Cemetech AnnouncementsCemetech LabsContests General Discussion----------------Technology & Calculator Open Topic-- Electronics/Hardware Development-- Calculator HardwareYour ProjectsGeneral Open Topic-- Politics & Rants-- Reviews-- Humour/Jokes Cemetech's Projects----------------Doors CS and Doors CSESourceCoderMember Features-- TI-Freak8x-- Merthsoft-- GrammerOther & Upcoming Projects-- The BASIC Elite-- mobileTunes-- CALCnet 2.2-- SuggestionsProgramming the TI-83 Plus/TI-84 PlusUsing the TI-83 Plus/TI-84 PlusWebsite Programming & Design----------------General Programmingz80 AssemblyTI-BASICCasio Prizm/FX Development & ProgrammingWebsite Markup & ScriptingGraphics1337 Programming Tips Building with Blocks----------------FreeBuild, LEGO, and Minecraft-- FreeBuild General-- Suggestions & Troubleshooting-- Content & Gallery-- Servers & Activities
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.064665 seconds.