Advertisement
Nightseeker

Motocross Championship (32X) code fragment

Mar 10th, 2020
1,593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.59 KB | None | 0 0
  1. to limit the # of lines that need to be drawn
  2.     DrawScrollPlane(2, &CopyOfCamera2, camDX, lineCountForBackGround);
  3. #endif
  4.            
  5. #endif
  6.  
  7.         DrawObjects (CopyOfCamera2.currentTile, NumberOfTiles, RoadDistances,
  8.         TileScreenPositionArray, SM);
  9.  
  10.      DrawPlayerLapFlag(2);
  11.  
  12. #ifdef MARS
  13.     if (SM == MASTER)
  14. #endif
  15.     {
  16.         Camera1Data = CopyOfCamera1;
  17.         Camera2Data = CopyOfCamera2;
  18.     }
  19.  
  20.  
  21.     }
  22.     else /* Not split screen. */
  23.     {
  24.     CopyOfCamera1 = Camera1Data; /* Copy the whole structure. */
  25.  
  26. #ifdef DEBUGSPEED
  27.     WindowWidth = SMALLWINDOWWIDTH;
  28.     HalfWindowWidth = WindowWidth / 2;
  29.     WindowX = SCREENWIDTH / 2 - HalfWindowWidth;
  30.     WindowY = SCREENHEIGHT / 2 - SMALLWINDOWHEIGHT / 2;
  31.     WindowHeight = SMALLWINDOWHEIGHT;
  32.     WindowScaleFactor = 2;
  33. #else
  34.     WindowX = WINDOWXMARGIN;
  35.     WindowWidth = SCREENWIDTH - (WINDOWXMARGIN * 2);
  36.     HalfWindowWidth = WindowWidth / 2;
  37.     WindowY = 4;
  38.     WindowHeight = SCREENHEIGHT - (WINDOWYMARGIN * 2) - 4;
  39.     WindowScaleFactor = 1;
  40. #endif
  41.  
  42. #ifdef PC
  43.     /* PC background is a full screen and must be drawn first. */
  44.     drawBackground (FALSE, 0, 0, SM);
  45. #endif
  46.  
  47.     NumberOfTiles = CalculateTileAndCameraPositions (TileScreenPositionArray,
  48.     &CopyOfCamera1, &camDX, &camDY);
  49.  
  50. // .......... calc the difference in absolute heights between the bike and camera
  51.     heightDiffForHorizon =
  52.         (CopyOfCamera1.SubjectBikeTileHeight + CopyOfCamera1.subjectBike->bottomY) -
  53.         (CopyOfCamera1.absoluteTileHeight + CopyOfCamera1.yOffset);
  54.  
  55.     lineCountForBackGround = DrawGround (NumberOfTiles, RoadDistances,
  56.     TileScreenPositionArray, SM);
  57.  
  58. #ifdef MARS
  59. // .......... 32X background gets drawn after, to limit the # of lines that need to be drawn
  60.     DrawScrollPlane(1, &CopyOfCamera1, camDX, lineCountForBackGround);
  61.                    
  62. #endif
  63.     DrawObjects (CopyOfCamera1.currentTile, NumberOfTiles, RoadDistances,
  64.     TileScreenPositionArray, SM);
  65.  
  66.     DrawPlayerLapFlag(1);
  67.  
  68. #if 0
  69.     ShowNum(heightDiffForHorizon);
  70. #endif
  71.  
  72. #ifdef MARS
  73.     if (SM == MASTER)
  74. #endif
  75.     {
  76.         Camera1Data = CopyOfCamera1;
  77.     }
  78.  
  79. }
  80.  
  81.  
  82. #if 0
  83. #ifdef DEBUG
  84.     /* Print out the debug value. */
  85.     if (SM == MASTER)
  86.     {
  87.         char TempString [40];
  88.  
  89.         #ifdef DEBUGSPEED
  90.         #else
  91.         IntToAscii ((int) DebugValue, TempString, 10);
  92.         PutString (0, 0, "Debug value:", WHITECOLOUR);
  93.         PutString (120, 0, TempString, WHITECOLOUR);
  94.         #endif
  95.     }
  96. #endif
  97. #endif
  98. }
  99.  
  100. void ShowNum(int num)
  101. {
  102.     char String1[100],String2[20];
  103.  
  104.    StringCopy (String1,"Number: ");
  105.     IntToAscii (num, String2,10);
  106.  
  107.     StringCat(String1,String2);
  108.  
  109. #ifdef MARS
  110.    ColorAreaNOCLIP(50,50,100,20,0,0);
  111. #endif
  112.    PutString(50,50,String1,100);
  113. }
  114.  
  115. void ShowAbsoluteTileHeight(CameraDataRecord CopyOfCamera)
  116. {
  117.     char String1[100],String2[20];
  118.  
  119.    StringCopy (String1,"TileHeight: ");
  120.     IntToAscii ((int) CopyOfCamera.absoluteTileHeight, String2,10);
  121.  
  122.     StringCat(String1,String2);
  123. #ifdef MARS
  124.     ColorAreaNOCLIP(90,30,100,20,0,0);
  125. #endif
  126.    PutString(10,30,String1,100);
  127. }
  128.  
  129.  
  130. void ShowSegment(void)
  131. {
  132.     trackTilePointer   CurrentTilePtr;
  133.     char String1[100],String2[20];
  134.  
  135.     CurrentTilePtr = GetTrackTileForNumber (Camera1Data.currentTile);
  136.  
  137.     StringCopy (String1,"Segment # ");
  138.     IntToAscii ((int) CurrentTilePtr->segmentNumber, String2,10);
  139.  
  140.     StringCat(String1,String2);
  141.  
  142.     PutString(10,30,String1,100);
  143. }
  144.  
  145.  
  146.  
  147. /****************************************************************************
  148.  * Draw the race track and objects on it to the screen.
  149.  */
  150.  
  151. void Render (void)
  152. {
  153.     RenderTrackAndObjectsToRamScreen ();
  154.     DisplayStatusInfo ();
  155.  
  156.     //ShowSegment();
  157.  
  158. sendBuffersToScreen ();
  159. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement