CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

DELAY.CPP (2370B)


      1 //
      2 // Copyright 2020 Electronic Arts Inc.
      3 //
      4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 
      5 // software: you can redistribute it and/or modify it under the terms of 
      6 // the GNU General Public License as published by the Free Software Foundation, 
      7 // either version 3 of the License, or (at your option) any later version.
      8 
      9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 // in the hope that it will be useful, but with permitted additional restrictions 
     11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 // distributed with this program. You should have received a copy of the 
     13 // GNU General Public License along with permitted additional restrictions 
     14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
     15 
     16 /***************************************************************************
     17  **   C O N F I D E N T I A L --- W E S T W O O D   A S S O C I A T E S   **
     18  ***************************************************************************
     19  *                                                                         *
     20  *                 Project Name : LIBRARY                                  *
     21  *                                                                         *
     22  *                    File Name : DELAY.C                                  *
     23  *                                                                         *
     24  *                   Programmer : Christopher Yates                        *
     25  *                                                                         *
     26  *                  Last Update : 27 March, 1991   [CY]                    *
     27  *                                                                         *
     28  *-------------------------------------------------------------------------*
     29  * Functions:                                                              *
     30  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     31 
     32 #include	"wwstd.h"
     33 #include <timer.h>
     34 
     35 void Delay(int duration)
     36 {
     37 	unsigned long count;
     38 	TimerClass timer(BT_SYSTEM,TRUE);
     39 
     40 	while (duration--) {
     41 		count = timer.Time() + 1L;
     42 		while (count >= (unsigned)timer.Time()) {
     43 			;
     44 		}
     45 	}
     46 
     47 #if(FALSE)
     48 	while (duration--)
     49 		Wait_Vert_Blank(VertBlank);
     50 #endif
     51 }
     52 
     53 #if(FALSE)
     54 void Vsync()
     55 {
     56 	Wait_Vert_Blank(VertBlank);
     57 }
     58 #endif
     59