Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.27 KB | None | 0 0
  1. /************************************************************
  2.  **
  3.  ** File:     Fire.c
  4.  ** Author:   flype, 2016
  5.  ** Compiler: VBCC 0.904
  6.  **
  7.  ************************************************************/
  8.  
  9. #include <string.h>
  10. #include <time.h>
  11. #include <dos/stdio.h>
  12. #include <exec/exec.h>
  13. #include <exec/types.h>
  14.  
  15. #include "ChunkyStartup.h"
  16. #include "Fire.h"
  17.  
  18. #define RND(a) (rand() % a)
  19.  
  20. UBYTE VersionID[] = "$VER: Fire 0.1 (2016-02-13) ® 2016 Apollo Team\b\n\0";
  21.  
  22. int main(void)
  23. {
  24.   //---------------------------------------------------------
  25.   // Inits
  26.   //---------------------------------------------------------
  27.  
  28.   int *FBBASE=0xDFF1EC;
  29.   int frames=0, ticks=0, w=0;
  30.   struct CSAllocCell *palette;
  31.  
  32.   if (ChunkyStartupInit(0, 0) == 0) {
  33.     ex_out("Error: Init screen.");
  34.   }
  35.  
  36.   if ((palette = LoadRmb("Fire.LoadRGB32")) == 0L) {
  37.     ex_out("Error: Init palette.");
  38.   }
  39.  
  40.   SetScreenPalette((ULONG*)(palette->csac_Buffer));
  41.  
  42.   FireInit();
  43.  
  44.   FireClear(0);
  45.  
  46.   srand(time(NULL));
  47.  
  48.   *FBBASE = (int)FireChunky;
  49.  
  50.   ResetTaskTime();
  51.  
  52.   //---------------------------------------------------------
  53.   // Run
  54.   //---------------------------------------------------------
  55.  
  56.   w = FireWidth - 1;
  57.  
  58.   while ( ListenEnd() == 0 ) {
  59.    
  60.     FireUpdate();
  61.    
  62.     FireFuel( RND(w), RND(210) );
  63.     FireFuel( RND(w), RND(210) );
  64.     FireFuel( RND(w), RND(210) );
  65.     FireFuel( RND(w), RND(210) );
  66.    
  67.     FireDraw();
  68.    
  69.     /*
  70.     ticks = GetTaskTime();
  71.     if(ticks % 500 == 0) {
  72.       FireClear(RND(255));
  73.     }
  74.     */
  75.    
  76. //  ScreenRefresh(FireChunky);
  77. //  Delay(1);
  78.    
  79.     frames++;
  80.   }
  81.  
  82.   //---------------------------------------------------------
  83.   // Exit
  84.   //---------------------------------------------------------
  85.  
  86.   ticks = GetTaskTime();
  87.  
  88.   printf("Frames:  %u\n", frames);
  89.   printf("Seconds: %u\n", ticks/50);
  90.   printf("FPS:     %u\n", frames/(ticks/50));
  91.  
  92.   FireClose();
  93.  
  94.   *FBBASE = (int)0xFB00000;
  95.  
  96.   ex_out(NULL);
  97.   return(0L);
  98. }
  99.  
  100. void ex_out(char *errorstring) {
  101.   Exitmessage = errorstring;
  102.   ChunkyStartupClose();
  103.   exit(0);
  104. }
  105.  
  106. /************************************************************
  107.  **
  108.  ** End
  109.  **
  110.  ************************************************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement