home *** CD-ROM | disk | FTP | other *** search
/ Desktop Works 1995 - 1996 / desktopworks1995-1996.iso / scrnsave / worm / global.c < prev    next >
C/C++ Source or Header  |  1996-01-01  |  2KB  |  82 lines

  1.  
  2.  
  3. #include "worm.h"
  4.  
  5. static int _size  = DEFAULT_SIZE;
  6. static int _speed = DEFAULT_SPEED;
  7. static int _step  = DEFAULT_STEP;
  8. static int _rings = DEFAULT_RINGS;
  9.  
  10. /* ------------------------------------------------- */
  11.  
  12. void InitGlobalDataFromIniFile(void)
  13. {
  14.    extern HANDLE hInst;
  15.    char fullpath[_MAX_PATH];
  16.    char drive[_MAX_DRIVE];
  17.    char dir[_MAX_DIR];
  18.    char fname[_MAX_FNAME];
  19.    char ext[_MAX_EXT];
  20.  
  21.    GetModuleFileName(hInst, fullpath, _MAX_PATH);
  22.  
  23.    _splitpath(fullpath, drive, dir, fname, ext);
  24.    *fullpath=0;
  25.    strcat(fullpath, drive);
  26.    strcat(fullpath, dir);
  27.    strcat(fullpath, fname);
  28.    strcat(fullpath, ".INI");
  29.  
  30.    if(!(_speed = GetPrivateProfileInt("WORM", "Speed", _speed, fullpath)))
  31.       ErrorBox("Error reading the WORM.INI file!");
  32.    _size  = GetPrivateProfileInt("WORM", "Size",  _size,  fullpath);
  33.    _step  = GetPrivateProfileInt("WORM", "Step",  _step,  fullpath);
  34.    _rings = GetPrivateProfileInt("WORM", "Rings", _rings, fullpath);
  35.  
  36. }
  37.  
  38. /* --------------------------------------------------------------------------- */
  39.  
  40.  
  41. int GetSize(void)
  42. { return _size; }
  43.  
  44. /* ------------------------------------------------- */
  45.  
  46. int GetSpeed(void)
  47. {  return _speed; }
  48.  
  49. /* ------------------------------------------------- */
  50.  
  51. int GetStep(void)
  52. { return _step; }
  53.  
  54. /* ------------------------------------------------- */
  55.  
  56. int GetRings(void)
  57. { return _rings; }
  58.  
  59. /* ------------------------------------------------- */
  60.  
  61. void SetSize( int newSize)
  62. { _size = newSize; }
  63.  
  64. /* ------------------------------------------------- */
  65.  
  66. void SetSpeed( int newSpeed)
  67. { _speed = newSpeed; }
  68.  
  69. /* ------------------------------------------------- */
  70.  
  71. void SetStep( int newStep)
  72. { _step = newStep; }
  73.  
  74. /* ------------------------------------------------- */
  75.  
  76. void SetRings( int newRings)
  77. { _rings = newRings; }
  78.  
  79. /* ------------------------------------------------- */
  80.  
  81. /* EOF */
  82.