123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- #include "game.h"
- #include "JoyStick.h"
- #include "sort.h"
- #include "sine.h"
- extern byte walls[8][65][2];
- word INPUTMETHOD, FIN;
- struct BLOCKTYPE Level_One[ NbrBlocks+1 ] =
- {
- { 1,1,2,1, NORTH,NULL},
- { 0,0,3,1, NORTH,NULL},
- { 0,0,4,1, NORTH,NULL},
- { 1,1,5,2, WEST,NULL},
- { 0,0,5,3, WEST,NULL},
- { 0,0,4,4, WEST|SOUTH|NORTH,NULL},
- { 1,1,5,5, WEST,NULL},
- { 0,0,5,6, WEST,NULL},
- { 0,0,5,7, WEST,NULL},
- { 1,1,4,8, SOUTH,NULL},
- { 0,0,3,7, WEST|EAST|SOUTH,NULL},
- { 0,0,2,8, SOUTH,NULL},
- { 1,1,1,7, EAST,NULL},
- { 0,0,1,6, EAST,NULL},
- { 0,0,1,5, EAST,NULL},
- { 0,1,2,4, EAST|SOUTH|NORTH,NULL},
- { 0,0,1,3, EAST,NULL},
- { 0,0,1,2, EAST,NULL},
- { 1,1,3,4, DOOR|NORTH|SOUTH,NULL},
- };
- struct DOORTYPE myDoor;
- struct PLAYER player1 = { 0,0,0,0,0,0 };
- struct xBUFFTYPE xBUFFER[DISPLAY_WIDTH];
- word zBUFFER[NbrBlocks + NbrObjects][2];
- void WOLF3D( void );
- void WOLF3D(void)
- {
- register word index;
-
- word count;
- unsigned long frame = 0,start,seconds;
- unsigned int clock[2];
-
-
-
-
-
- COSINE = &SINE[90*2];
- INPUTMETHOD = JOYSTICK;
- FIN = 0;
-
- timer(clock);
- start = clock[0];
-
-
- for(index = 0; index < NbrBlocks; index++)
- {
- Level_One[index].x *= 64;
- Level_One[index].z *= 64;
- };
-
-
-
- SetAPen(RASTPORT,13);
- RectFill(RASTPORT,0,0,DISPLAY_WIDTH-1,DISPLAY_HEIGHT-1);
- player1.X = (long)(128) << FFPBitSize;
- player1.Z = (long)(128) << FFPBitSize;
- player1.Xcopy = (word)(player1.X >> FFPBitSize);
- player1.Zcopy = (word)(player1.Z >> FFPBitSize);
-
-
-
-
-
-
-
- while(! FIN )
- {
-
-
-
-
- TransformBlocks( &player1 );
-
-
-
-
- count = CreateZbuffer();
- SORTWORLD(zBUFFER, count);
-
-
-
- CreateXbuffer(count);
-
-
-
- AsmClearBackground((long *)fBUFFER,151587081L,134744072L);
- AsmRenderMaze((long *)&xBUFFER[VIEW_LEFT],(long *)fBUFFER);
-
-
-
- if(DISPLAY_DEPTH == 4)
- {
- AsmChunky2Planar((long *)fBUFFER,(long *)RASTPORT->BitMap->Planes[0]);
- }
- else if(DISPLAY_DEPTH != 4)
- {
- chunky2planar((long *)fBUFFER,(long *)RASTPORT->BitMap->Planes[0]);
- };
-
-
-
- FetchEvaluateInput( &player1 );
- UpdatePlayerPosition( &player1 );
-
-
- frame++;
- };
- timer(clock);
- seconds = clock[0] - start;
- if(! seconds) seconds = 1;
-
- printf("Frames: %d & Seconds: %d\n",frame,seconds);
- printf("Est Frames per second: %d\n",frame/seconds);
- }
-
-
|