]> Shamusworld >> Repos - thunder/blobdiff - src/gui.cpp
Code cleanup.
[thunder] / src / gui.cpp
index df8275cf05e8826f1fe7c5cc89292c3dad96f346..a84ab6f19124f932120095fcd48c5cd7b54298fc 100644 (file)
@@ -1,10 +1,10 @@
 //
 // Thunder Graphic User Interface
 //
-// by James L. Hammons
-// (c) 2004, 2009 Underground Software
+// by James Hammons
+// (c) 2004, 2014 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // WHO  WHEN        WHAT
 // ---  ----------  ------------------------------------------------------------
@@ -25,34 +25,34 @@ using namespace std;                                        // Yes!
 
 extern SDL_Surface * screen;
 
-extern uint8 my_scr[0x14000];                                                  // Screen buffer...
-extern uint8 gram1[];                                                                  // Game RAM (do here??)
-extern uint8 hScrollOffset;                                                            // Horizontal scroll offset
-extern uint8 vScrollOffset;                                                            // Vertical scroll offset
-extern uint32 voffsets[8];
-extern uint8 voice_rom[];                                                              // PCM data pointer
+extern uint8_t my_scr[0x14000];                                                        // Screen buffer...
+extern uint8_t gram1[];                                                                        // Game RAM (do here??)
+extern uint8_t hScrollOffset;                                                          // Horizontal scroll offset
+extern uint8_t vScrollOffset;                                                          // Vertical scroll offset
+extern uint32_t voffsets[8];
+extern uint8_t voice_rom[];                                                            // PCM data pointer
 extern fstream tr;                                                                             // Tracelog
 
 // Global shit
 
-uint16 text_life;          // How long text is visible
+uint16_t text_life;          // How long text is visible
 bool show_text;          // Whether or not to show text
-uint16 show_which_msg;     // Which message to show
+uint16_t show_which_msg;     // Which message to show
 bool show_gui;           // Whether or not to show GUI
-uint16 selection;          // Which GUI item currently selected
-uint16 snd_num;
-uint16 gui_debounce;       // GUI key debounce value
-uint16 num_coins;          // Number of coins dropped
-uint16 blink = 0;          // Used to blink player 1 & 2 start buttons
-uint16 flash = 23;         // Used to flash GUI lights
-uint16 iline = 0;          // Used to roll line
-uint16 dcurcol = 179;      // dipswitch cursor color
+uint16_t selection;          // Which GUI item currently selected
+uint16_t snd_num;
+uint16_t gui_debounce;       // GUI key debounce value
+uint16_t num_coins;          // Number of coins dropped
+uint16_t blink = 0;          // Used to blink player 1 & 2 start buttons
+uint16_t flash = 23;         // Used to flash GUI lights
+uint16_t iline = 0;          // Used to roll line
+uint16_t dcurcol = 179;      // dipswitch cursor color
 int  dcurdir = 1;        // Initially going up...
 bool blink_on = false;
 bool game_refresh;       // Refresh rate user set
 bool do_decrement;       // Flag to handle decrement...
 bool user_selected_something;  // Flag for well, you know...
-uint16 dswitch;            // Which dipswitch is selected...
+uint16_t dswitch;            // Which dipswitch is selected...
 
 // The following are global for the sound routines...
 
@@ -60,27 +60,27 @@ const float sampleBase = 22050.0/6000.0;  // Btwn 5512.5 and 6000
 bool snd_go = false;
 bool chan1_go = false, chan2_go = false, chan3_go = false;
 bool chan4_go = false, chan5_go = false, chan6_go = false;
-uint8 * sndp1, * sndp2, * sndp3, * sndp4, * sndp5, * sndp6;
-uint32 rom_pos, end_pos;
-uint32 spos1, end_pos1;
-uint32 spos2, end_pos2;
-uint32 spos3, end_pos3;
-uint32 spos4, end_pos4;
-uint32 spos5, end_pos5;
-uint32 spos6, end_pos6;
+uint8_t * sndp1, * sndp2, * sndp3, * sndp4, * sndp5, * sndp6;
+uint32_t rom_pos, end_pos;
+uint32_t spos1, end_pos1;
+uint32_t spos2, end_pos2;
+uint32_t spos3, end_pos3;
+uint32_t spos4, end_pos4;
+uint32_t spos5, end_pos5;
+uint32_t spos6, end_pos6;
 float sample1;
-uint8 prevSamp1;
-int8 delta_x1;
+uint8_t prevSamp1;
+int8_t delta_x1;
 float sample2;
-uint8 prevSamp2;
-int8 delta_x2;
+uint8_t prevSamp2;
+int8_t delta_x2;
 
-uint8 * snd_array[3] = { sunknown, scya, scamera }; // From RESOURCE.H
-uint32 snd_lens[3]   = { sunknownlen, scyalen, scameralen };
+uint8_t * snd_array[3] = { sunknown, scya, scamera }; // From RESOURCE.H
+uint32_t snd_lens[3]   = { sunknownlen, scyalen, scameralen };
 
 // Bitmaps
 
-uint8 bmp1[] = {
+uint8_t bmp1[] = {
   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,1,1,0,0,0,1,1,0,0,1,0,0,1,0,0,0,0,0,0,
   0,1,0,0,0,0,1,0,0,1,0,1,0,0,1,0,1,1,1,1,0,
@@ -89,7 +89,7 @@ uint8 bmp1[] = {
   0,0,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,1,1,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
   };
-uint8 bmp2[] = {
+uint8_t bmp2[] = {
   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,1,1,1,0,0,0,1,1,0,0,1,0,0,1,0,0,0,0,0,0,
   0,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,1,1,1,0,
@@ -98,7 +98,7 @@ uint8 bmp2[] = {
   0,1,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,1,1,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
   };
-uint8 bmp3[] = {
+uint8_t bmp3[] = {
   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,1,0,0,0,0,1,1,1,0,0,0,1,1,0,0,1,1,1,0,0,
@@ -107,7 +107,7 @@ uint8 bmp3[] = {
   0,1,1,1,0,0,1,0,0,1,0,0,1,1,1,0,1,1,1,0,0,
   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0
   };
-uint8 boptions[] = { // 35x9
+uint8_t boptions[] = { // 35x9
   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
   0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -118,7 +118,7 @@ uint8 boptions[] = { // 35x9
   0,0,1,1,0,0,1,1,1,0,0,0,0,1,1,0,1,1,1,0,0,1,1,0,0,1,0,0,1,0,0,1,1,0,0,
   0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
   };
-uint8 bn0[] = {
+uint8_t bn0[] = {
   0,0,0,0,0,0,
   0,0,1,1,0,0,
   0,1,0,0,1,0,
@@ -127,7 +127,7 @@ uint8 bn0[] = {
   0,0,1,1,0,0,
   0,0,0,0,0,0
   };
-uint8 bn1[] = {
+uint8_t bn1[] = {
   0,0,0,0,0,0,
   0,0,1,0,0,0,
   0,1,1,0,0,0,
@@ -136,7 +136,7 @@ uint8 bn1[] = {
   0,1,1,1,0,0,
   0,0,0,0,0,0
   };
-uint8 bn2[] = {
+uint8_t bn2[] = {
   0,0,0,0,0,0,
   0,1,1,1,0,0,
   0,0,0,0,1,0,
@@ -145,7 +145,7 @@ uint8 bn2[] = {
   0,1,1,1,1,0,
   0,0,0,0,0,0
   };
-uint8 bn3[] = {
+uint8_t bn3[] = {
   0,0,0,0,0,0,
   0,1,1,1,0,0,
   0,0,0,0,1,0,
@@ -154,7 +154,7 @@ uint8 bn3[] = {
   0,1,1,1,0,0,
   0,0,0,0,0,0
   };
-uint8 bn4[] = {
+uint8_t bn4[] = {
   0,0,0,0,0,0,
   0,0,0,1,0,0,
   0,1,0,1,0,0,
@@ -163,7 +163,7 @@ uint8 bn4[] = {
   0,0,0,1,0,0,
   0,0,0,0,0,0
   };
-uint8 bn5[] = {
+uint8_t bn5[] = {
   0,0,0,0,0,0,
   0,1,1,1,1,0,
   0,1,0,0,0,0,
@@ -172,7 +172,7 @@ uint8 bn5[] = {
   0,1,1,1,0,0,
   0,0,0,0,0,0
   };
-uint8 bn6[] = {
+uint8_t bn6[] = {
   0,0,0,0,0,0,
   0,0,1,1,0,0,
   0,1,0,0,0,0,
@@ -181,7 +181,7 @@ uint8 bn6[] = {
   0,0,1,1,0,0,
   0,0,0,0,0,0
   };
-uint8 bn7[] = {
+uint8_t bn7[] = {
   0,0,0,0,0,0,
   0,1,1,1,1,0,
   0,0,0,0,1,0,
@@ -190,7 +190,7 @@ uint8 bn7[] = {
   0,0,1,0,0,0,
   0,0,0,0,0,0
   };
-uint8 bn8[] = {
+uint8_t bn8[] = {
   0,0,0,0,0,0,
   0,0,1,1,0,0,
   0,1,0,0,1,0,
@@ -199,7 +199,7 @@ uint8 bn8[] = {
   0,0,1,1,0,0,
   0,0,0,0,0,0
   };
-uint8 bn9[] = {
+uint8_t bn9[] = {
   0,0,0,0,0,0,
   0,0,1,1,0,0,
   0,1,0,0,1,0,
@@ -208,7 +208,7 @@ uint8 bn9[] = {
   0,0,1,1,0,0,
   0,0,0,0,0,0
   };
-uint8 bnA[] = {
+uint8_t bnA[] = {
   0,0,0,0,0,0,
   0,0,1,1,0,0,
   0,1,0,0,1,0,
@@ -217,7 +217,7 @@ uint8 bnA[] = {
   0,1,0,0,1,0,
   0,0,0,0,0,0
   };
-uint8 bnB[] = {
+uint8_t bnB[] = {
   0,0,0,0,0,0,
   0,1,1,1,0,0,
   0,1,0,0,1,0,
@@ -226,7 +226,7 @@ uint8 bnB[] = {
   0,1,1,1,0,0,
   0,0,0,0,0,0
   };
-uint8 bnC[] = {
+uint8_t bnC[] = {
   0,0,0,0,0,0,
   0,0,1,1,0,0,
   0,1,0,0,1,0,
@@ -235,7 +235,7 @@ uint8 bnC[] = {
   0,0,1,1,0,0,
   0,0,0,0,0,0
   };
-uint8 bnD[] = {
+uint8_t bnD[] = {
   0,0,0,0,0,0,
   0,1,1,1,0,0,
   0,1,0,0,1,0,
@@ -244,7 +244,7 @@ uint8 bnD[] = {
   0,1,1,1,0,0,
   0,0,0,0,0,0
   };
-uint8 bnE[] = {
+uint8_t bnE[] = {
   0,0,0,0,0,0,
   0,1,1,1,1,0,
   0,1,0,0,0,0,
@@ -253,7 +253,7 @@ uint8 bnE[] = {
   0,1,1,1,1,0,
   0,0,0,0,0,0
   };
-uint8 bnF[] = {
+uint8_t bnF[] = {
   0,0,0,0,0,0,
   0,1,1,1,1,0,
   0,1,0,0,0,0,
@@ -322,16 +322,16 @@ void DeactivateGUI(void)  { show_gui = false; }
 //
 // Draw the small icons...
 //
-void DrawSmallIcons(uint16 icon_not_to_draw)
+void DrawSmallIcons(uint16_t icon_not_to_draw)
 {
-  uint8 * iconmem;
-  uint8 xl, yl;
-  uint8 * sIcons[12] = { inoguis, icoinus, ipl1sts, ipl2sts, ii30hzs, ii60hzs,
+  uint8_t * iconmem;
+  uint8_t xl, yl;
+  uint8_t * sIcons[12] = { inoguis, icoinus, ipl1sts, ipl2sts, ii30hzs, ii60hzs,
                         idipsws, ichecks, ikeycns, isnapss, iresets, ibyebys };
-  uint8 xlens[12] = { 31, 18, 32, 35, 37, 37, 29, 23, 28, 32, 19, 19 };
-  uint8 ylens[12] = { 31, 18, 19, 19, 21, 21, 23, 20, 16, 17, 20, 23 };
-  uint8 xpos[11] = { 33, 48, 63, 78, 104, 0, 184, 210, 225, 240, 255 };
-  uint8 iconidx[11] = { 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 6 };
+  uint8_t xlens[12] = { 31, 18, 32, 35, 37, 37, 29, 23, 28, 32, 19, 19 };
+  uint8_t ylens[12] = { 31, 18, 19, 19, 21, 21, 23, 20, 16, 17, 20, 23 };
+  uint8_t xpos[11] = { 33, 48, 63, 78, 104, 0, 184, 210, 225, 240, 255 };
+  uint8_t iconidx[11] = { 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 6 };
 
   if (game_refresh)  iconidx[9] = 5;       // 60 Hz...
 
@@ -339,44 +339,44 @@ void DrawSmallIcons(uint16 icon_not_to_draw)
 
   for(int i=0; i<5; i++)
   {
-    uint16 idx = i + icon_not_to_draw;          // Get correct start pos.
+    uint16_t idx = i + icon_not_to_draw;          // Get correct start pos.
     if (idx > 10)  idx -= 11;
 
     iconmem = sIcons[iconidx[idx]];
     xl = xlens[iconidx[idx]];  yl = ylens[iconidx[idx]];
 
-    uint32 scadr = hScrollOffset + voffsets[vScrollOffset];
+    uint32_t scadr = hScrollOffset + voffsets[vScrollOffset];
     scadr += 320*((224-yl)/2);                // Center vertically
     scadr += xpos[i] - (xl/2);                // Center around horiz. pos.
-    uint16 bmpptr = 0;
+    uint16_t bmpptr = 0;
 
     for(int yy=0; yy<yl; yy++)
     {
       for(int xx=0; xx<xl; xx++)
       {
-        uint8 b = iconmem[bmpptr++];
+        uint8_t b = iconmem[bmpptr++];
         if (b)  my_scr[scadr+xx+yy*320] = b;
       }
     }
   }
   for(int i=10; i>5; i--)
   {
-    uint16 idx = i + icon_not_to_draw;          // Get correct start pos.
+    uint16_t idx = i + icon_not_to_draw;          // Get correct start pos.
     if (idx > 10)  idx -= 11;
 
     iconmem = sIcons[iconidx[idx]];
     xl = xlens[iconidx[idx]];  yl = ylens[iconidx[idx]];
 
-    uint32 scadr = hScrollOffset + voffsets[vScrollOffset];
+    uint32_t scadr = hScrollOffset + voffsets[vScrollOffset];
     scadr += 320*((224-yl)/2);                // Center vertically
     scadr += xpos[i] - (xl/2);     // Center around horiz. pos.
-    uint16 bmpptr = 0;
+    uint16_t bmpptr = 0;
 
     for(int yy=0; yy<yl; yy++)
     {
       for(int xx=0; xx<xl; xx++)
       {
-        uint8 b = iconmem[bmpptr++];
+        uint8_t b = iconmem[bmpptr++];
         if (b)  my_scr[scadr+xx+yy*320] = b;
       }
     }
@@ -386,16 +386,16 @@ void DrawSmallIcons(uint16 icon_not_to_draw)
 //
 // Draw the large (selected) icon
 //
-void DrawLargeIcon(uint16 icon)
+void DrawLargeIcon(uint16_t icon)
 {
-  uint8 * iconmem;
-  uint8 xl, yl;
-  uint8 * lIcons[11] = { inoguib, icoinub, ipl1stb, ipl2stb, ii30hzb, ii60hzb,
+  uint8_t * iconmem;
+  uint8_t xl, yl;
+  uint8_t * lIcons[11] = { inoguib, icoinub, ipl1stb, ipl2stb, ii30hzb, ii60hzb,
                         idipswb, ikeycnb, isnapsb, iresetb, ibyebyb };
-  uint8 xlens[11] = { 44, 45, 50, 52, 59, 59, 42, 45, 48, 58, 42 };
-  uint8 ylens[11] = { 44, 40, 33, 29, 52, 52, 34, 45, 37, 40, 50 };
+  uint8_t xlens[11] = { 44, 45, 50, 52, 59, 59, 42, 45, 48, 58, 42 };
+  uint8_t ylens[11] = { 44, 40, 33, 29, 52, 52, 34, 45, 37, 40, 50 };
 
-  uint8 gsubs1[24] = { 21, 21, 20, 19, 168, 168, 31, 155, 68, 68, 67, 66,
+  uint8_t gsubs1[24] = { 21, 21, 20, 19, 168, 168, 31, 155, 68, 68, 67, 66,
                       36, 36, 35, 34, 188, 188, 183, 181, 81, 81, 85, 80 },
        gsubs2[24] = { 20, 20, 19, 19, 31,  31,  155, 155, 67, 67, 66, 66,
                       35, 35, 34, 34, 183, 183, 181, 181, 85, 85, 80, 80 },
@@ -424,16 +424,16 @@ void DrawLargeIcon(uint16 icon)
     xl = xlens[6];  yl = ylens[6];
   }
 
-  uint32 scadr = hScrollOffset + voffsets[vScrollOffset];
+  uint32_t scadr = hScrollOffset + voffsets[vScrollOffset];
   scadr += 320*((224-yl)/2);                // Center vertically
   scadr += (288-xl)/2;                      // Center horizontally
-  uint16 bmpptr = 0;
+  uint16_t bmpptr = 0;
 
   for(int yy=0; yy<yl; yy++)
   {
     for(int xx=0; xx<xl; xx++)
     {
-      uint8 b = iconmem[bmpptr++];
+      uint8_t b = iconmem[bmpptr++];
       if (b)
       {
         if ((icon == PL1START) && (b == 235) && (num_coins) && !blink_on)
@@ -443,7 +443,7 @@ void DrawLargeIcon(uint16 icon)
                                 36,35,34; 188,183,181; 81,85,80 */
         if (icon == NOGUI)
         {
-          uint8 fln = (23 - flash) + 1; // Want to go forward (maybe fix it?)
+          uint8_t fln = (23 - flash) + 1; // Want to go forward (maybe fix it?)
           switch (b)
           {
             case 36:   { b = gsubs1[fln];  break; }
@@ -472,21 +472,21 @@ void DrawLargeIcon(uint16 icon)
 //
 void DrawDipswitch(void)
 {
-  uint8 dseloff[16] = { 0, 1, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 11, 11, 12 };
-  uint8 * dtxt[13] = { idstext1, idstext2, idstext3, idstext4, idstext5,
+  uint8_t dseloff[16] = { 0, 1, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 11, 11, 12 };
+  uint8_t * dtxt[13] = { idstext1, idstext2, idstext3, idstext4, idstext5,
                       idstext2, idstext6, idstext7, idstext8, idstext9,
                       idstext10, idstext11, idstext12 };
 
-  uint8 dtx[13] = { 48, 80, 96, 82, 60, 80, 76, 57, 33, 50, 62, 65, 63 },
+  uint8_t dtx[13] = { 48, 80, 96, 82, 60, 80, 76, 57, 33, 50, 62, 65, 63 },
        dty[13] = { 7, 9, 7, 9, 7, 9, 7, 7, 7, 9, 7, 9, 7 };
-  uint32 dtxtoff[13] = { 4*320+24, 14*320-78, 25*320+24, 32*320-80,
+  uint32_t dtxtoff[13] = { 4*320+24, 14*320-78, 25*320+24, 32*320-80,
                         39*320+24, 49*320-78,
                         4*320+24, 11*320-55, 18*320+24, 25*320-48,
                         32*320+24, 42*320-63, 53*320+24 };
-  uint32 scadr, bmpptr;
+  uint32_t scadr, bmpptr;
   //dsx = //26x65
 
-  uint32 dbase = hScrollOffset + voffsets[vScrollOffset];
+  uint32_t dbase = hScrollOffset + voffsets[vScrollOffset];
   dbase += (288-26)/2;                 // Center horizontally
   dbase += 320*((224-((65*2)+8))/2);   // Center vertically
 
@@ -496,7 +496,7 @@ void DrawDipswitch(void)
   {
     for(int xx=0; xx<26; xx++)
     {
-      uint8 b = idswitch[bmpptr++];
+      uint8_t b = idswitch[bmpptr++];
       if (b)  my_scr[scadr+xx+yy*320] = b;
     }
   }
@@ -506,7 +506,7 @@ void DrawDipswitch(void)
   {
     for(int xx=0; xx<26; xx++)
     {
-      uint8 b = idswitch[bmpptr++];
+      uint8_t b = idswitch[bmpptr++];
       if (b)  my_scr[scadr+xx+yy*320] = b;
     }
   }
@@ -525,7 +525,7 @@ void DrawDipswitch(void)
       scadr += 315; // Adjust position...
     }
   }
-  uint8 dselected_text = dseloff[dswitch];
+  uint8_t dselected_text = dseloff[dswitch];
   for(int i=0; i<13; i++)
   {
     if (dselected_text != i)
@@ -537,7 +537,7 @@ void DrawDipswitch(void)
       {
         for(int xx=0; xx<dtx[i]; xx++)
         {
-          uint8 b = dtxt[i][bmpptr++];
+          uint8_t b = dtxt[i][bmpptr++];
           if (b)  my_scr[scadr] = b;
           scadr++;
         }
@@ -552,7 +552,7 @@ void DrawDipswitch(void)
   {
     for(int xx=0; xx<dtx[dselected_text]; xx++)
     {
-      uint8 b = dtxt[dselected_text][bmpptr++];
+      uint8_t b = dtxt[dselected_text][bmpptr++];
       if (b)  my_scr[scadr] = 125;
       scadr++;
     }
@@ -680,9 +680,9 @@ void SelectDown(void)
 //
 // User selected something! Handle it!
 //
-uint8 UserSelectedSomething(void)
+uint8_t UserSelectedSomething(void)
 {
-  //extern uint8 * gram1;
+  //extern uint8_t * gram1;
 
   if (!gui_debounce)
   {
@@ -774,12 +774,12 @@ uint8 UserSelectedSomething(void)
 //
 void ShowNumbers(int number)
 {
-  uint8 * bnarray[16] = { bn0, bn1, bn2, bn3, bn4, bn5, bn6, bn7, bn8, bn9,
+  uint8_t * bnarray[16] = { bn0, bn1, bn2, bn3, bn4, bn5, bn6, bn7, bn8, bn9,
     bnA, bnB, bnC, bnD, bnE, bnF };
-  uint32 scadr = hScrollOffset + voffsets[vScrollOffset] + 642 + 2560;
-  uint16 bmpptr = 0;
+  uint32_t scadr = hScrollOffset + voffsets[vScrollOffset] + 642 + 2560;
+  uint16_t bmpptr = 0;
 
-  uint8 first_dig = number>>4, second_dig = number&0x0F;
+  uint8_t first_dig = number>>4, second_dig = number&0x0F;
   for(int y=0; y<7; y++)
   {
     for(int x=0; x<6; x++)
@@ -802,7 +802,7 @@ void ShowNumbers(int number)
 //
 // Spawn a message
 //
-void SpawnMsg(uint8 msg)
+void SpawnMsg(uint8_t msg)
 {
        text_life = 60;                                                                         // 1 second...
        show_text = true;                                                                       // Show the damn thing...
@@ -823,8 +823,8 @@ void DrawText(void)
        text_life--;                                                                            // Your life force is running out...
 
        // Draw the message here...
-       uint32 scadr = hScrollOffset + voffsets[vScrollOffset] + 642;
-       uint16 bmpptr = 0;
+       uint32_t scadr = hScrollOffset + voffsets[vScrollOffset] + 642;
+       uint16_t bmpptr = 0;
 
        for(int y=0; y<7; y++)
        {
@@ -863,12 +863,12 @@ void DrawText(void)
 //
 void SpawnSound(int type, int snd, int channel/* = 0*/)
 {
-       extern uint32 psg_lens[16];
-       extern uint8 * psg_adrs[16];
-       extern uint32 voc_lens[32];
-       extern uint8 * voc_adrs[32];
-       extern uint32 fm_lens[14];
-       extern uint8 * fm_adrs[14];
+       extern uint32_t psg_lens[16];
+       extern uint8_t * psg_adrs[16];
+       extern uint32_t voc_lens[32];
+       extern uint8_t * voc_adrs[32];
+       extern uint32_t fm_lens[14];
+       extern uint8_t * fm_adrs[14];
 
        snd_num = snd;
        SpawnMsg(MSHOWNUMS);
@@ -880,7 +880,7 @@ void SpawnSound(int type, int snd, int channel/* = 0*/)
                if (channel == 0)
                {
                        // 00 nn ss (nn # of repeats of sample ss)
-                       uint32 st = 0;
+                       uint32_t st = 0;
 
                        if (snd & 0x40)
                        {
@@ -896,7 +896,7 @@ void SpawnSound(int type, int snd, int channel/* = 0*/)
                }
                else
                {
-                       uint32 st = 0;
+                       uint32_t st = 0;
 
                        if (snd & 0x40)
                        {
@@ -958,9 +958,9 @@ void SpawnSound(int type, int snd, int channel/* = 0*/)
 //
 void SoundFunc(void * userdata, Uint8 * buff, int num)
 {
-       uint16 cnt = 0, sample;                                                         // 0-22 different sounds...
-       uint8 start_samp1, end_samp1, start_samp2, end_samp2;
-       uint8 samp1 = 128, samp2 = 128, samp3 = 128,
+       uint16_t cnt = 0, sample;                                                               // 0-22 different sounds...
+       uint8_t start_samp1, end_samp1, start_samp2, end_samp2;
+       uint8_t samp1 = 128, samp2 = 128, samp3 = 128,
                samp4 = 128, samp5 = 128, samp6 = 128;                  // Zero samples...
 
        memset(buff, 128, num);                                                         // Kill sound...