home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / acksrc.zip / ACKUSER.C < prev    next >
Text File  |  1993-06-18  |  3KB  |  139 lines

  1. /*           ACK-3D ( Animation Construction Kit 3D )              */
  2. /* User routines      */
  3. /* Author: Lary Myers */
  4.  
  5. #include <stdlib.h>
  6. #include <stdio.h>
  7. #include <dos.h>
  8. #include <mem.h>
  9. #include <alloc.h>
  10. #include <io.h>
  11. #include <fcntl.h>
  12. #include <time.h>
  13. #include <string.h>
  14. #include <sys\stat.h>
  15. #include "ack3d.h"
  16. #include "ackext.h"
  17.  
  18.  
  19. typedef struct {
  20.     unsigned    char    UseMouse;
  21.     unsigned    char    UseFlash;
  22.     unsigned    char    CenterRow;
  23.     unsigned    char    SkyColor;
  24.     unsigned    char    FloorColor;
  25.     unsigned    char    FlashColor;
  26.     unsigned    char    DoorSpeed;
  27.         int    StartX;
  28.         int    StartY;
  29.         int    StartAngle;
  30.         int    StartLevel;
  31.         char    *MasterFile
  32. } INITENGINE;
  33.  
  34.  
  35.  
  36.  
  37.  
  38. typedef struct {
  39.         int        xPlayer;
  40.         int        yPlayer;
  41.         int        PlayerAngle;
  42.         int        MapPosn;
  43. unsigned    int        cbCondition;
  44. unsigned    int        Condition;
  45.         int        (*cbFnc)(void);
  46. } PLAYER;
  47.  
  48.  
  49.  
  50. #define CB_LEFTMOUSE    0x8000
  51. #define CB_RIGHTMOUSE    0x4000
  52. #define CB_PREDRAW    0x2000
  53. #define CB_POSTDRAW    0x1000
  54. #define CB_PREDOOR    0x0800
  55. #define CB_POSTDOOR    0x0400
  56. #define CB_MOVESQUARE    0x0200
  57. #define CB_UPSQUARE    0x0100
  58. #define CB_DOWNSQUARE    0x0080
  59. #define CB_GOALSQUARE    0x0040
  60. #define CB_HITWALL    0x0020
  61. #define CB_HITOBJECT    0x0010
  62.  
  63.  
  64. static    unsigned char    DoFlash;
  65.  
  66.  
  67. /****************************************************************************
  68. **                                       **
  69. ****************************************************************************/
  70. int InitializeEngine(INITENGINE *ie)
  71. {
  72.  
  73. DoFlash         = ie->UseFlash;
  74. TopColor     = SkyColor = ie->SkyColor;
  75. BottomColor  = FloorColor = ie->FloorColor;
  76. FlashColor   = ie->FlashColor;
  77. CenterRow    = ie->CenterRow;
  78. if (CenterRow < 100 || CenterRow > 160)
  79.     CenterRow = 120;
  80.  
  81. MaxObjects   = 0;
  82. DoorSpeed    = ie->DoorSpeed;
  83. if (!DoorSpeed)
  84.     DoorSpeed = DEFAULT_DOOR_SPEED;
  85.  
  86. StartX         = ie->StartX;
  87. StartY         = ie->StartY;
  88. StartAngle   = ie->StartAngle;
  89. CurrentLevel = ie->StartLevel;
  90.  
  91. if (BuildTables())
  92.     return(-1);
  93.  
  94. if (ReadMasterFile(ie->MasterFile))
  95.     return(-2);
  96.  
  97. if (ReadMapFile())
  98.     return(-3);
  99.  
  100. BuildXYgrid();
  101.  
  102. TopColor    = SkyColor;
  103. BottomColor = FloorColor;
  104. xPlayer        = StartX;
  105. yPlayer        = StartY;
  106. PlayerAngle = StartAngle;
  107. CosAngle    = CosTable[PlayerAngle];
  108. SinAngle    = SinTable[PlayerAngle];
  109.  
  110. ObjList[0].Sides  = 0;
  111. ObjList[0].VidRow = CenterRow;
  112.  
  113. if (ie->UseMouse)
  114.     InitializeMouse();
  115.  
  116.  
  117. keyBoardInit();
  118. oldvec=getvect(KEYBD);
  119. setvect(KEYBD,myInt);
  120.  
  121. graphinit();
  122.  
  123. PageNum = 1;
  124. usepage(PageNum);
  125.  
  126. LoadPalette(PalFile);
  127. NoWalls = 0;
  128.  
  129. return(0);
  130. }
  131.  
  132.  
  133. /****************************************************************************
  134. **                                       **
  135. ****************************************************************************/
  136. int RunEngine(PLAYER *p)
  137.  
  138.  
  139.