diff --git a/fdemo/FDEMO.C b/fdemo/FDEMO.C index 25a7bea..3c6a26f 100644 --- a/fdemo/FDEMO.C +++ b/fdemo/FDEMO.C @@ -63,9 +63,6 @@ typedef struct { #define MAX_STR_AMOUNT 128 #define MAX_STR_HALF_AMOUNT 64 -extern long AckMemUsed; // Running total of memory used -extern short AckDisplayErrors; // 1 = sw to text mode and display error - extern long mFactor; extern long dFactor; @@ -73,6 +70,8 @@ extern UCHAR colordat[]; ACKENG *ae; +// These are the ranges used for distance shading. Will need to be modified +// for the new color palette used. ColorRange ranges[64] = { 16,15, 32,16, @@ -167,10 +166,6 @@ volatile short cframes=0, count=0, ticks=0; }; -void AckRegisterStructure(ACKENG *ae); -void AckSpeedUp(short); -void AckSlowDown(void); - //============================================================================= // //============================================================================= @@ -1466,6 +1461,115 @@ typedef struct { short near long_sqrt(long v); +//============================================================================= +// +//============================================================================= +void DoTest(void) +{ + int done,cnt,Total; + int xp,yp,ColX; + long dx,dy; + UCHAR *Video; + AWALL aw[2]; + short i,minAngle,maxAngle,objAngle; + +AckRegisterStructure(ae); + +memset(ae->xGrid,0,(GRID_ARRAY*2)); +memset(ae->yGrid,0,(GRID_ARRAY*2)); +memset(Grid,0,(GRID_ARRAY*2)); + +aw[0].x1 = 64; +aw[0].y1 = 128; +aw[0].x2 = 128; +aw[0].y2 = 128; + +aw[1].x1 = 128; +aw[1].y1 = 128; +aw[1].x2 = 128; +aw[1].y2 = 64; +Total = 2; +Video = (UCHAR *)0xA0000; +done = 0; +xp = yp = 256; + + +while (!done) + { + memset(ae->ScreenBuffer,0,64000); + minAngle = ae->PlayerAngle - (INT_ANGLE_32 + 10); + if (minAngle < 0) + minAngle += INT_ANGLE_360; + + maxAngle = ae->PlayerAngle + (INT_ANGLE_32 + 10); + if (maxAngle >= INT_ANGLE_360) + maxAngle -= INT_ANGLE_360; + + xp = ae->xPlayer; + yp = ae->yPlayer; + + for (cnt = 0; cnt < Total; cnt++) + { + dx = aw[cnt].x1 - xp; + dy = aw[cnt].y1 - yp; + aw[cnt].d1 = long_sqrt((dx*dx)+(dy*dy)); + objAngle = AckGetObjectAngle(dx,dy); + dx = aw[cnt].x2 - xp; + dy = aw[cnt].y2 - yp; + aw[cnt].d2 = long_sqrt((dx*dx)+(dy*dy)); + + if (minAngle > maxAngle) + { + if (objAngle >= minAngle) + ColX = objAngle - minAngle; + else + ColX = (objAngle+INT_ANGLE_360) - minAngle; + } + else + { + ColX = objAngle - minAngle; + } + + if (ColX > -40 && ColX < 320) + DrawBmpBox(ColX,100,aw[cnt].x2,100,aw[cnt].d1,aw[cnt].d2); + } + memmove(Video,ae->ScreenBuffer,64000); + + if (AckKeys[ESCAPE_KEY]) + break; + + if (AckKeys[LEFT_ARROW_KEY]) + { + ae->PlayerAngle--; + if (ae->PlayerAngle < 0) + ae->PlayerAngle += INT_ANGLE_360; + } + + if (AckKeys[RIGHT_ARROW_KEY]) + { + ae->PlayerAngle++; + if (ae->PlayerAngle >= INT_ANGLE_360) + ae->PlayerAngle -= INT_ANGLE_360; + } + + if (AckKeys[UP_ARROW_KEY]) + { + AckMovePOV(ae->PlayerAngle,16); + } + + if (AckKeys[DOWN_ARROW_KEY]) + { + i = ae->PlayerAngle + INT_ANGLE_180; + if (i >= INT_ANGLE_360) + i -= INT_ANGLE_360; + + AckMovePOV(i,16); + } + + } + + +} //============================================================================= // @@ -1584,8 +1688,11 @@ Shooting = 0; MagAmount = MAX_MAG_AMOUNT; StrAmount = MAX_STR_AMOUNT; +// Setup keyboard and timer interrupts AckSetupKeyboard(); AckSetupTimer(); +AckTmDelay = 3; +AckSpeedUp(AckTmDelay); // Set the timer interrupt at 3 times normal StartBGmusic(); @@ -1610,7 +1717,7 @@ SetMouseCursor(120,160); fpos = 64; DemoFlag = 0; if (DemoPtr != NULL) DemoFlag = 1; -TimerEnd = AckTimerCounter + 18; +TimerEnd = AckTimerCounter + 180; // MUST register each ACKENG structure once before use and after AckInitialize @@ -1716,14 +1823,14 @@ while (!done) { AckSetObjectType(ae,j,NO_WALK); ae->ObjList[j]->Flags &= ~OF_ANIMDONE; - ObjCounter[j] = AckTimerCounter + 18 + (rand() % 20); + ObjCounter[j] = AckTimerCounter + 18 + (rand() % 120); } if (AckTimerCounter > ObjCounter[j]) { - ObjCounter[j] = AckTimerCounter + 18 + (rand() % 18); + ObjCounter[j] = AckTimerCounter + 180 + (rand() % 180); if (ae->ObjList[j]->CurrentType == NO_WALK) AckSetObjectType(ae,j,NO_ATTACK); else @@ -1751,7 +1858,7 @@ while (!done) if (AckTimerCounter > TimerEnd) { DemoFlag++; - TimerEnd = AckTimerCounter + 54; + TimerEnd = AckTimerCounter + 540; } break; @@ -1760,7 +1867,7 @@ while (!done) if (AckTimerCounter > TimerEnd) { DemoFlag = 1; - TimerEnd = AckTimerCounter + 216; + TimerEnd = AckTimerCounter + 2160; } break; @@ -1849,7 +1956,7 @@ while (!done) AckDisplayScreen(); // Copy ScrnBuffer to actual video CkEnd = AckTimerCounter - CkStart; - if (!CkEnd) CkEnd = 4; + if (!CkEnd) CkEnd = 1; TurnFactor = INT_ANGLE_1 * CkEnd; MoveFactor = 3 * CkEnd; @@ -2065,6 +2172,7 @@ while (!done) EndBGmusic(); ShutDownFlag = 1; +AckSlowDown(); // Set the timer back to normal speed AckWrapUp(ae); AckSetTextmode();