Hunt.h 24 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114
  1. #include "math.h"
  2. #include "windows.h"
  3. #include "winuser.h"
  4. #include "resource.h"
  5. #include "ddraw.h"
  6. #ifdef _d3d
  7. #include <d3d.h>
  8. #endif
  9. #define ctHScale 64
  10. #define PMORPHTIME 256
  11. #define HiColor(R,G,B) ( ((R)<<10) + ((G)<<5) + (B) )
  12. #define TCMAX ((128<<16)-62024)
  13. #define TCMIN ((000<<16)+62024)
  14. #ifdef _MAIN_
  15. #define _EXTORNOT
  16. #else
  17. #define _EXTORNOT extern
  18. #endif
  19. #define pi 3.1415926535f
  20. #define ctMapSize 1024
  21. typedef struct tagMessageList {
  22. int timeleft;
  23. char mtext[256];
  24. } TMessageList;
  25. typedef struct tagTRGB {
  26. BYTE B;
  27. BYTE G;
  28. BYTE R;
  29. } TRGB;
  30. typedef struct _Animation {
  31. char aniName[32];
  32. int aniKPS, FramesCount, AniTime;
  33. short int* aniData;
  34. } TAni;
  35. typedef struct _VTLdata {
  36. int aniKPS, FramesCount, AniTime;
  37. short int* aniData;
  38. } TVTL;
  39. typedef struct _SoundFX {
  40. int length;
  41. short int* lpData;
  42. } TSFX;
  43. typedef struct _TRD {
  44. int RNumber, RVolume, RFreq;
  45. WORD REnvir, Flags;
  46. } TRD;
  47. typedef struct _TAmbient {
  48. TSFX sfx;
  49. TRD rdata[16];
  50. int RSFXCount;
  51. int AVolume;
  52. int RndTime;
  53. } TAmbient;
  54. typedef struct TagTEXTURE {
  55. WORD DataA[128*128];
  56. WORD DataB[64*64];
  57. WORD DataC[32*32];
  58. WORD DataD[16*16];
  59. WORD SDataC[2][32*32];
  60. int mR, mG, mB;
  61. } TEXTURE;
  62. typedef struct _TPicture {
  63. int W,H;
  64. WORD* lpImage;
  65. } TPicture;
  66. typedef struct TagVector3d {
  67. float x,y,z;
  68. } Vector3d;
  69. typedef struct TagPoint3di {
  70. int x,y,z;
  71. } TPoint3di;
  72. typedef struct TagVector2di {
  73. int x,y;
  74. } Vector2di;
  75. typedef struct TagVector2df {
  76. float x,y;
  77. } Vector2df;
  78. typedef struct TagScrPoint {
  79. #ifdef _soft
  80. int x,y, tx,ty;
  81. #else
  82. float x,y, tx,ty;
  83. #endif
  84. int Light, z, r2, r3;
  85. } ScrPoint;
  86. typedef struct TagMScrPoint {
  87. int x,y, tx,ty;
  88. } MScrPoint;
  89. typedef struct tagClipPlane {
  90. Vector3d v1,v2,nv;
  91. } CLIPPLANE;
  92. typedef struct TagEPoint {
  93. Vector3d v;
  94. WORD DFlags;
  95. short int ALPHA;
  96. #ifdef _d3d
  97. float scrx, scry;
  98. #else
  99. int scrx, scry;
  100. #endif
  101. int Light;
  102. float Fog;
  103. } EPoint;
  104. typedef struct TagClipPoint {
  105. EPoint ev;
  106. float tx, ty;
  107. } ClipPoint;
  108. //================= MODEL ========================
  109. typedef struct _Point3d {
  110. float x;
  111. float y;
  112. float z;
  113. short owner;
  114. short hide;
  115. } TPoint3d;
  116. typedef struct _Face {
  117. int v1, v2, v3;
  118. #ifdef _soft
  119. int tax, tbx, tcx, tay, tby, tcy;
  120. #else
  121. float tax, tbx, tcx, tay, tby, tcy;
  122. #endif
  123. WORD Flags,DMask;
  124. int Distant, Next, group;
  125. char reserv[12];
  126. } TFace;
  127. typedef struct _Facef {
  128. int v1, v2, v3;
  129. float tax, tbx, tcx, tay, tby, tcy;
  130. WORD Flags,DMask;
  131. int Distant, Next, group;
  132. char reserv[12];
  133. } TFacef;
  134. typedef struct _Obj {
  135. char OName [32];
  136. float ox;
  137. float oy;
  138. float oz;
  139. short owner;
  140. short hide;
  141. } TObj;
  142. typedef struct TagMODEL {
  143. int VCount, FCount, TextureSize, TextureHeight;
  144. TPoint3d gVertex[1024];
  145. union {
  146. TFace gFace [1024];
  147. TFacef gFacef [1024];
  148. };
  149. WORD *lpTexture, *lpTexture2, *lpTexture3;
  150. #ifdef _d3d
  151. int VLight[4][1024];
  152. #else
  153. float VLight[4][1024];
  154. #endif
  155. } TModel;
  156. //=========== END MODEL ==============================//
  157. typedef struct _ObjInfo {
  158. int Radius;
  159. int YLo, YHi;
  160. int linelenght, lintensity;
  161. int circlerad, cintensity;
  162. int flags;
  163. int GrRad;
  164. int DefLight;
  165. int LastAniTime;
  166. float BoundR;
  167. BYTE res[16];
  168. } TObjInfo;
  169. typedef struct _TBMPModel {
  170. Vector3d gVertex[4];
  171. WORD *lpTexture;
  172. } TBMPModel;
  173. typedef struct _TBound {
  174. float cx, cy, a, b, y1, y2;
  175. } TBound;
  176. typedef struct TagObject {
  177. TObjInfo info;
  178. TBound bound[8];
  179. TBMPModel bmpmodel;
  180. TModel *model;
  181. TVTL vtl;
  182. } TObject;
  183. typedef struct _TCharacterInfo {
  184. char ModelName[32];
  185. int AniCount,SfxCount;
  186. TModel* mptr;
  187. TAni Animation[64];
  188. TSFX SoundFX[64];
  189. int Anifx[64];
  190. } TCharacterInfo;
  191. typedef struct _TWeapon {
  192. TCharacterInfo chinfo[10];
  193. TPicture BulletPic[10];
  194. Vector3d normals[1024];
  195. int state, FTime;
  196. float shakel;
  197. } TWeapon;
  198. typedef struct _TWCircle {
  199. Vector3d pos;
  200. float scale;
  201. int FTime;
  202. } TWCircle;
  203. typedef struct _TSnowElement {
  204. Vector3d pos;
  205. float hl, ftime;
  206. } TSnowElement;
  207. typedef struct _TCharacter {
  208. int CType, AI;
  209. TCharacterInfo *pinfo;
  210. int StateF;
  211. int State;
  212. int NoWayCnt, NoFindCnt, AfraidTime, tgtime;
  213. int PPMorphTime, PrevPhase,PrevPFTime, Phase, FTime;
  214. float vspeed, rspeed, bend, scale;
  215. int Slide;
  216. float slidex, slidez;
  217. float tgx, tgz;
  218. Vector3d pos, rpos;
  219. float tgalpha, alpha, beta,
  220. tggamma,gamma,
  221. lookx, lookz;
  222. int Health, BloodTime, BloodTTime;
  223. } TCharacter;
  224. typedef struct tagPlayer {
  225. BOOL Active;
  226. unsigned int IPaddr;
  227. Vector3d pos;
  228. float alpha, beta, vspeed;
  229. int kbState;
  230. char NickName[16];
  231. } TPlayer;
  232. typedef struct _TDemoPoint {
  233. Vector3d pos;
  234. int DemoTime, CIndex;
  235. } TDemoPoint;
  236. typedef struct tagLevelDef {
  237. char FileName[64];
  238. char MapName[128];
  239. DWORD DinosAvail;
  240. WORD *lpMapImage;
  241. } TLevelDef;
  242. typedef struct tagShipTask {
  243. int tcount;
  244. int clist[255];
  245. } TShipTask;
  246. typedef struct tagShip {
  247. Vector3d pos, rpos, tgpos, retpos;
  248. float alpha, tgalpha, speed, rspeed, DeltaY;
  249. int State, cindex, FTime;
  250. } TShip;
  251. typedef struct tagLandingList {
  252. int PCount;
  253. Vector2di list[64];
  254. } TLandingList;
  255. typedef struct _TPlayerR {
  256. char PName[128];
  257. int RegNumber;
  258. int Score, Rank;
  259. } TPlayerR;
  260. typedef struct _TTrophyItem {
  261. int ctype, weapon, phase,
  262. height, weight, score,
  263. date, time;
  264. float scale, range;
  265. int r1, r2, r3, r4;
  266. } TTrophyItem;
  267. typedef struct _TStats {
  268. int smade, success;
  269. float path, time;
  270. } TStats;
  271. typedef struct _TTrophyRoom {
  272. char PlayerName[128];
  273. int RegNumber;
  274. int Score, Rank;
  275. TStats Last, Total;
  276. TTrophyItem Body[24];
  277. } TTrophyRoom;
  278. typedef struct _TDinoInfo {
  279. char Name[48], FName[48], PName[48];
  280. int Health0, AI;
  281. BOOL DangerCall;
  282. float Mass, Length, Radius,
  283. SmellK, HearK, LookK,
  284. ShDelta;
  285. int Scale0, ScaleA, BaseScore;
  286. TPicture CallIcon;
  287. } TDinoInfo;
  288. typedef struct _TWeapInfo {
  289. char Name[48], FName[48], BFName[48];
  290. float Power, Prec, Loud, Rate;
  291. int Shots, Optic, Fall, TraceC, Reload;
  292. } TWeapInfo;
  293. typedef struct _TFogEntity {
  294. int fogRGB;
  295. float YBegin;
  296. BOOL Mortal;
  297. float Transp, FLimit;
  298. } TFogEntity;
  299. typedef struct _TWaterEntity {
  300. int tindex, wlevel;
  301. float transp;
  302. int fogRGB;
  303. } TWaterEntity;
  304. typedef struct _TWind {
  305. float alpha;
  306. float speed;
  307. Vector3d nv;
  308. } TWind;
  309. typedef struct _TElement {
  310. Vector3d pos, speed;
  311. int Flags;
  312. float R;
  313. } TElement;
  314. typedef struct _TElements {
  315. int Type, ECount, EDone, LifeTime;
  316. int Param1, Param2, Param3;
  317. DWORD RGBA, RGBA2;
  318. Vector3d pos;
  319. TElement EList[32];
  320. } TElements;
  321. typedef struct _TBloodP {
  322. int LTime;
  323. Vector3d pos;
  324. } TBloodP;
  325. typedef struct _TBTrail {
  326. int Count;
  327. TBloodP Trail[512];
  328. } TBTrail;
  329. //============= functions ==========================//
  330. void HLineTxB( void );
  331. void HLineTxC( void );
  332. void HLineTxGOURAUD( void );
  333. void HLineTxModel25( void );
  334. void HLineTxModel75( void );
  335. void HLineTxModel50( void );
  336. void HLineTxModel3( void );
  337. void HLineTxModel2( void );
  338. void HLineTxModel( void );
  339. void HLineTDGlass75( void );
  340. void HLineTDGlass50( void );
  341. void HLineTDGlass25( void );
  342. void HLineTBGlass25( void );
  343. void SetVideoMode(int, int);
  344. void CreateDivTable();
  345. void DrawTexturedFace();
  346. int GetTextW(HDC, LPSTR);
  347. void wait_mouse_release();
  348. //============================== render =================================//
  349. void ShowControlElements();
  350. void InsertModelList(TModel* mptr, float x0, float y0, float z0, int light, float al, float bt);
  351. void RenderGround();
  352. void RenderWater();
  353. void RenderElements();
  354. void CreateChRenderList();
  355. void RenderModelsList();
  356. void ProcessMap (int x, int y, int r);
  357. void ProcessMap2 (int x, int y, int r);
  358. void ProcessMapW (int x, int y, int r);
  359. void ProcessMapW2(int x, int y, int r);
  360. void DrawTPlane(BOOL);
  361. void DrawTPlaneClip(BOOL);
  362. void ClearVideoBuf();
  363. void DrawTrophyText(int, int);
  364. void DrawHMap();
  365. void RenderCharacter(int);
  366. void RenderShip();
  367. void RenderPlayer(int);
  368. void RenderSkyPlane();
  369. void RenderHealthBar();
  370. void Render_Cross(int, int);
  371. void Render_LifeInfo(int);
  372. void RenderModelClipEnvMap(TModel*, float, float, float, float, float);
  373. void RenderModelClipPhongMap(TModel*, float, float, float, float, float);
  374. void RenderModel (TModel*, float, float, float, int, int, float, float);
  375. void RenderBMPModel (TBMPModel*, float, float, float, int);
  376. void RenderModelClipWater(TModel*, float, float, float, int, int, float, float);
  377. void RenderModelClip (TModel*, float, float, float, int, int, float, float);
  378. void RenderNearModel (TModel*, float, float, float, int, float, float);
  379. void DrawPicture (int x, int y, TPicture &pic);
  380. void InitClips();
  381. void InitDirectDraw();
  382. void WaitRetrace();
  383. //============= Characters =======================
  384. void Characters_AddSecondaryOne(int ctype);
  385. void AddDeadBody(TCharacter *cptr, int);
  386. void PlaceCharacters();
  387. void PlaceTrophy();
  388. void AnimateCharacters();
  389. void MakeNoise(Vector3d, float);
  390. void CheckAfraid();
  391. void CreateChMorphedModel(TCharacter* cptr);
  392. void CreateMorphedObject(TModel* mptr, TVTL &vtl, int FTime);
  393. void CreateMorphedModel(TModel* mptr, TAni *aptr, int FTime, float scale);
  394. //=============================== Math ==================================//
  395. void CalcLights (TModel* mptr);
  396. void CalcModelGroundLight(TModel *mptr, float x0, float z0, int FI);
  397. void CalcNormals (TModel* mptr, Vector3d *nvs);
  398. void CalcGouraud (TModel* mptr, Vector3d *nvs);
  399. void CalcPhongMapping(TModel* mptr, Vector3d *nv);
  400. void CalcEnvMapping(TModel* mptr, Vector3d *nv);
  401. void CalcBoundBox(TModel* mptr, TBound *bound);
  402. void NormVector(Vector3d&, float);
  403. float SGN(float);
  404. void DeltaFunc(float &a, float b, float d);
  405. void MulVectorsScal(Vector3d&, Vector3d&, float&);
  406. void MulVectorsVect(Vector3d&, Vector3d&, Vector3d&);
  407. Vector3d SubVectors( Vector3d&, Vector3d& );
  408. Vector3d AddVectors( Vector3d&, Vector3d& );
  409. Vector3d RotateVector(Vector3d&);
  410. float VectorLength(Vector3d);
  411. int siRand(int);
  412. int rRand(int);
  413. void CalcHitPoint(CLIPPLANE&, Vector3d&, Vector3d&, Vector3d&);
  414. void ClipVector(CLIPPLANE& C, int vn);
  415. float FindVectorAlpha(float, float);
  416. float AngleDifference(float a, float b);
  417. int TraceShot(float ax, float ay, float az,
  418. float &bx, float &by, float &bz);
  419. int TraceLook(float ax, float ay, float az,
  420. float bx, float by, float bz);
  421. void CheckCollision(float&, float&);
  422. float CalcFogLevel(Vector3d v);
  423. //=================================================================//
  424. void AddMessage(LPSTR mt);
  425. void CreateTMap();
  426. void LoadSky();
  427. void LoadSkyMap();
  428. void LoadTexture(TEXTURE*&);
  429. void LoadWav(char* FName, TSFX &sfx);
  430. void ApplyAlphaFlags(WORD*, int);
  431. WORD conv_565(WORD c);
  432. int conv_xGx(int);
  433. void conv_pic(TPicture &pic);
  434. void LoadPicture(TPicture &pic, LPSTR pname);
  435. void LoadPictureTGA(TPicture &pic, LPSTR pname);
  436. void LoadCharacterInfo(TCharacterInfo&, char*);
  437. void LoadModelEx(TModel* &mptr, char* FName);
  438. void LoadModel(TModel*&);
  439. void LoadResources();
  440. void ReInitGame();
  441. void SaveScreenShot();
  442. void CreateWaterTab();
  443. void CreateFadeTab();
  444. void CreateVideoDIB();
  445. void RenderLightMap();
  446. void MulVectorsVect(Vector3d& v1, Vector3d& v2, Vector3d& r );
  447. void MulVectorsScal(Vector3d& v1,Vector3d& v2, float& r);
  448. Vector3d SubVectors( Vector3d& v1, Vector3d& v2 );
  449. void NormVector(Vector3d& v, float Scale);
  450. LPVOID _HeapAlloc(HANDLE hHeap, DWORD dwFlags, DWORD dwBytes);
  451. BOOL _HeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem);
  452. //============ game ===========================//
  453. float GetLandCeilH(float, float);
  454. float GetLandH(float, float);
  455. float GetLandOH(int, int);
  456. float GetLandLt(float, float);
  457. float GetLandUpH(float, float);
  458. float GetLandQH(float, float);
  459. float GetLandQHNoObj(float, float);
  460. float GetLandHObj(float, float);
  461. void LoadResourcesScript();
  462. void InitEngine();
  463. void ShutDownEngine();
  464. void ProcessSyncro();
  465. void AddShipTask(int);
  466. void LoadTrophy();
  467. //void LoadPlayersInfo();
  468. void SaveTrophy();
  469. void RemoveCurrentTrophy();
  470. void MakeCall();
  471. void MakeShot(float ax, float ay, float az,
  472. float bx, float by, float bz);
  473. void AddBloodTrail(TCharacter *cptr);
  474. void AddElements(float, float, float, int, int);
  475. void AddWCircle(float, float, float);
  476. void AnimateProcesses();
  477. void DoHalt(LPSTR);
  478. _EXTORNOT char logt[128];
  479. void CreateLog();
  480. void PrintLog(LPSTR l);
  481. void CloseLog();
  482. _EXTORNOT float BackViewR;
  483. _EXTORNOT int BackViewRR;
  484. _EXTORNOT int UnderWaterT;
  485. _EXTORNOT int TotalC, TotalW;
  486. //========== common ==================//
  487. _EXTORNOT HWND hwndMain;
  488. _EXTORNOT HINSTANCE hInst;
  489. _EXTORNOT HANDLE Heap;
  490. _EXTORNOT HDC hdcMain, hdcCMain;
  491. _EXTORNOT BOOL blActive;
  492. _EXTORNOT BYTE KeyboardState[256];
  493. _EXTORNOT int KeyFlags, _shotcounter;
  494. _EXTORNOT TMessageList MessageList;
  495. _EXTORNOT char ProjectName[128];
  496. _EXTORNOT int _GameState;
  497. _EXTORNOT TSFX fxCall[10][3], fxScream[4];
  498. _EXTORNOT TSFX fxUnderwater, fxWaterIn, fxWaterOut, fxJump, fxStep[3], fxStepW[3];
  499. //========== map =====================//
  500. _EXTORNOT byte HMap[ctMapSize][ctMapSize];
  501. _EXTORNOT byte WMap[ctMapSize][ctMapSize];
  502. _EXTORNOT byte HMapO[ctMapSize][ctMapSize];
  503. _EXTORNOT WORD FMap[ctMapSize][ctMapSize];
  504. _EXTORNOT byte LMap[ctMapSize][ctMapSize];
  505. _EXTORNOT WORD TMap1[ctMapSize][ctMapSize];
  506. _EXTORNOT WORD TMap2[ctMapSize][ctMapSize];
  507. _EXTORNOT byte OMap[ctMapSize][ctMapSize];
  508. _EXTORNOT byte FogsMap[512][512];
  509. _EXTORNOT byte AmbMap[512][512];
  510. _EXTORNOT TFogEntity FogsList[256];
  511. _EXTORNOT TWaterEntity WaterList[256];
  512. _EXTORNOT TWind Wind;
  513. _EXTORNOT TShip Ship;
  514. _EXTORNOT TShipTask ShipTask;
  515. _EXTORNOT int SkyR, SkyG, SkyB, WaterR, WaterG, WaterB, WaterA,
  516. SkyTR,SkyTG,SkyTB, CurFogColor;
  517. _EXTORNOT int RandomMap[32][32];
  518. _EXTORNOT Vector2df PhongMapping[1024];
  519. _EXTORNOT TPicture TFX_SPECULAR, TFX_ENVMAP;
  520. _EXTORNOT WORD SkyPic[256*256];
  521. _EXTORNOT WORD SkyFade[9][128*128];
  522. _EXTORNOT BYTE SkyMap[128*128];
  523. _EXTORNOT TEXTURE* Textures[1024];
  524. _EXTORNOT TAmbient Ambient[256];
  525. _EXTORNOT TSFX RandSound[256];
  526. //========= GAME ====================//
  527. _EXTORNOT int TargetDino, TargetArea, TargetWeapon, WeaponPres, TargetCall,
  528. TrophyTime, ObservMode, Tranq, ObjectsOnLook,
  529. CurrentWeapon, ShotsLeft[10], AmmoMag[10];
  530. _EXTORNOT Vector3d answpos;
  531. _EXTORNOT int answtime, answcall;
  532. _EXTORNOT BOOL ScentMode, CamoMode,
  533. RadarMode, LockLanding,
  534. TrophyMode, DoubleAmmo;
  535. _EXTORNOT TTrophyRoom TrophyRoom;
  536. //_EXTORNOT TPlayerR PlayerR[16];
  537. _EXTORNOT TPicture LandPic,DinoPic,DinoPicM, MapPic, WepPic;
  538. _EXTORNOT HFONT fnt_BIG, fnt_Small, fnt_Midd;
  539. _EXTORNOT TLandingList LandingList;
  540. //======== MODEL ======================//
  541. _EXTORNOT TObject MObjects[256];
  542. _EXTORNOT TModel* mptr;
  543. _EXTORNOT TWeapon Weapon;
  544. _EXTORNOT int OCount, iModelFade, iModelBaseFade, Current;
  545. _EXTORNOT Vector3d rVertex[1024];
  546. _EXTORNOT TObj gObj[1024];
  547. _EXTORNOT Vector2di gScrp[1024];
  548. _EXTORNOT Vector2df gScrpf[1024];
  549. //============= Characters ==============//
  550. _EXTORNOT TPicture PausePic, ExitPic, TrophyExit, TrophyPic;
  551. _EXTORNOT TModel *SunModel;
  552. _EXTORNOT TCharacterInfo WCircleModel;
  553. _EXTORNOT TModel *CompasModel;
  554. _EXTORNOT TModel *Binocular;
  555. _EXTORNOT TDinoInfo DinoInfo[32];
  556. _EXTORNOT TWeapInfo WeapInfo[8];
  557. _EXTORNOT TCharacterInfo ShipModel;
  558. _EXTORNOT int AI_to_CIndex[32];
  559. _EXTORNOT int ChCount, WCCount, ElCount, SnCount,
  560. ShotDino, TrophyBody;
  561. _EXTORNOT TCharacterInfo WindModel;
  562. _EXTORNOT TCharacterInfo PlayerInfo;
  563. _EXTORNOT TCharacterInfo ChInfo[32];
  564. _EXTORNOT TCharacter Characters[256];
  565. _EXTORNOT TWCircle WCircles[128];
  566. _EXTORNOT TSnowElement Snow[8024];
  567. _EXTORNOT TDemoPoint DemoPoint;
  568. _EXTORNOT TPlayer Players[16];
  569. _EXTORNOT Vector3d PlayerPos, CameraPos;
  570. //========== Render ==================//
  571. _EXTORNOT LPDIRECTDRAW lpDD;
  572. _EXTORNOT LPDIRECTDRAW2 lpDD2;
  573. //_EXTORNOT LPDIRECTINPUT lpDI;
  574. _EXTORNOT void* lpVideoRAM;
  575. _EXTORNOT LPDIRECTDRAWSURFACE lpddsPrimary;
  576. _EXTORNOT BOOL DirectActive, RestartMode;
  577. _EXTORNOT BOOL LoDetailSky;
  578. _EXTORNOT int WinW,WinH,WinEX,WinEY,VideoCX,VideoCY,VideoCX16,VideoCY16,iBytesPerLine,ts,r,MapMinY;
  579. _EXTORNOT float VideoCXf, VideoCYf, CameraW,CameraH,CameraW16,CameraH16,Soft_Persp_K, stepdy, stepdd, SunShadowK, FOVK;
  580. _EXTORNOT CLIPPLANE ClipA,ClipB,ClipC,ClipD,ClipZ,ClipW;
  581. _EXTORNOT int u,vused, CCX, CCY;
  582. _EXTORNOT DWORD Mask1,Mask2;
  583. _EXTORNOT DWORD HeapAllocated, HeapReleased;
  584. _EXTORNOT EPoint VMap[256][256];
  585. _EXTORNOT EPoint VMap2[256][256];
  586. _EXTORNOT EPoint ev[3];
  587. _EXTORNOT ClipPoint cp[16];
  588. _EXTORNOT ClipPoint hleft,hright;
  589. _EXTORNOT void *HLineT;
  590. _EXTORNOT int rTColor;
  591. _EXTORNOT int SKYMin, SKYDTime, GlassL, ctViewR, ctViewR1, ctViewRM,
  592. dFacesCount, ReverseOn, TDirection;
  593. _EXTORNOT WORD FadeTab[65][0x8000];
  594. _EXTORNOT TElements Elements[32];
  595. _EXTORNOT TBTrail BloodTrail;
  596. _EXTORNOT int PrevTime, TimeDt, T, Takt, RealTime, StepTime, MyHealth, ExitTime,
  597. ChCallTime, CallLockTime, NextCall;
  598. _EXTORNOT float DeltaT;
  599. _EXTORNOT float CameraX, CameraY, CameraZ, CameraAlpha, CameraBeta;
  600. _EXTORNOT float PlayerX, PlayerY, PlayerZ, PlayerAlpha, PlayerBeta,
  601. HeadY, HeadBackR, HeadBSpeed, HeadAlpha, HeadBeta,
  602. SSpeed,VSpeed,RSpeed,YSpeed;
  603. _EXTORNOT Vector3d PlayerNv;
  604. _EXTORNOT float ca,sa,cb,sb, wpnDAlpha, wpnDBeta;
  605. _EXTORNOT void *lpVideoBuf, *lpTextureAddr;
  606. _EXTORNOT HBITMAP hbmpVideoBuf;
  607. _EXTORNOT HCURSOR hcArrow;
  608. _EXTORNOT int DivTbl[10240];
  609. _EXTORNOT Vector3d v[3];
  610. _EXTORNOT ScrPoint scrp[3];
  611. _EXTORNOT MScrPoint mscrp[3];
  612. _EXTORNOT Vector3d nv, waterclipbase, Sun3dPos;
  613. _EXTORNOT struct _t {
  614. int fkForward, fkBackward, fkUp, fkDown, fkLeft, fkRight, fkFire, fkShow, fkSLeft, fkSRight, fkStrafe, fkJump, fkRun, fkCrouch, fkCall, fkCCall, fkBinoc;
  615. } KeyMap;
  616. #define kfForward 0x00000001
  617. #define kfBackward 0x00000002
  618. #define kfLeft 0x00000004
  619. #define kfRight 0x00000008
  620. #define kfLookUp 0x00000010
  621. #define kfLookDn 0x00000020
  622. #define kfJump 0x00000040
  623. #define kfCall 0x00000100
  624. #define kfSLeft 0x00001000
  625. #define kfSRight 0x00002000
  626. #define kfStrafe 0x00004000
  627. #define fmWater 0x0080
  628. #define fmWater2 0x8000
  629. #define fmNOWAY 0x0020
  630. #define fmReverse 0x0010
  631. #define fmWaterA 0x8080
  632. #define tresGround 1
  633. #define tresWater 2
  634. #define tresModel 3
  635. #define tresChar 4
  636. #define sfDoubleSide 1
  637. #define sfDarkBack 2
  638. #define sfOpacity 4
  639. #define sfTransparent 8
  640. #define sfMortal 0x0010
  641. #define sfPhong 0x0030
  642. #define sfEnvMap 0x0050
  643. #define sfNeedVC 0x0080
  644. #define sfDark 0x8000
  645. #define ofPLACEWATER 1
  646. #define ofPLACEGROUND 2
  647. #define ofPLACEUSER 4
  648. #define ofCIRCLE 8
  649. #define ofBOUND 16
  650. #define ofNOBMP 32
  651. #define ofNOLIGHT 64
  652. #define ofDEFLIGHT 128
  653. #define ofGRNDLIGHT 256
  654. #define ofNOSOFT 512
  655. #define ofNOSOFT2 1024
  656. #define ofANIMATED 0x80000000
  657. #define csONWATER 0x00010000
  658. #define MAX_HEALTH 128000
  659. #define HUNT_EAT 0
  660. #define HUNT_BREATH 1
  661. #define HUNT_FALL 2
  662. #define HUNT_KILL 3
  663. #define AI_PIG 1
  664. #define AI_ARCHEO 2
  665. #define AI_BIGFOOT 3
  666. #define AI_POACHER 4
  667. #define AI_BRONT 10
  668. #define AI_HOG 11
  669. #define AI_WOLF 12
  670. #define AI_RHINO 13
  671. #define AI_DIATR 14
  672. #define AI_DEER 15
  673. #define AI_SMILO 16
  674. #define AI_MAMM 17
  675. #define AI_BEAR 18
  676. _EXTORNOT BOOL WATERANI,Clouds,SKY,GOURAUD,
  677. MODELS,TIMER,BITMAPP,MIPMAP,
  678. NOCLIP,CLIP3D,NODARKBACK,CORRECTION, LOWRESTX,
  679. FOGENABLE, FOGON, CAMERAINFOG,
  680. WATERREVERSE,waterclip,UNDERWATER, ONWATER, NeedWater,
  681. SNOW, SWIM, FLY, PAUSE, OPTICMODE, BINMODE, EXITMODE, MapMode, RunMode, CrouchMode;
  682. _EXTORNOT int CameraFogI, QUITMODE;
  683. _EXTORNOT int OptDayNight, OptAgres, OptDens, OptSens, OptRes, OptViewR,
  684. OptMsSens, OptBrightness, OptSound, OptRender,
  685. OptText, OptSys, WaitKey, OPT_ALPHA_COLORKEY;
  686. _EXTORNOT BOOL SHADOWS3D,REVERSEMS;
  687. _EXTORNOT BOOL SLOW, DEBUG, MORPHP, MORPHA;
  688. _EXTORNOT HANDLE hlog;
  689. //========== for audio ==============//
  690. void AddVoicev (int, short int*, int);
  691. void AddVoice3dv(int, short int*, float, float, float, int);
  692. void AddVoice3d (int, short int*, float, float, float);
  693. void SetAmbient3d(int, short int*, float, float, float);
  694. void SetAmbient(int, short int*, int);
  695. void AudioSetCameraPos(float, float, float, float, float);
  696. void InitAudioSystem(HWND, HANDLE, int);
  697. void Audio_Restore();
  698. void AudioStop();
  699. void Audio_Shutdown();
  700. void Audio_SetEnvironment(int, float);
  701. void Audio_UploadGeometry();
  702. //=================================
  703. typedef struct tagAudioQuad
  704. {
  705. float x1,y1,z1;
  706. float x2,y2,z2;
  707. float x3,y3,z3;
  708. float x4,y4,z4;
  709. } AudioQuad;
  710. _EXTORNOT int AudioFCount;
  711. _EXTORNOT AudioQuad data[8192];
  712. _EXTORNOT void UploadGeometry();
  713. _EXTORNOT int Env;
  714. __inline float f_cos(float x)
  715. {
  716. return (float) cos(x);
  717. }
  718. __inline float f_sin(float x)
  719. {
  720. return (float) sin(x);
  721. }/**/
  722. //_EXTORNOT float f_sin(double);
  723. //_EXTORNOT float f_cos(double);
  724. /*__inline float f_cos(float x)
  725. {
  726. static float y;
  727. __asm
  728. {
  729. fld [x]
  730. fcos
  731. fstp [y]
  732. }
  733. return y;
  734. }
  735. __inline float f_sin(float x)
  736. {
  737. static float y;
  738. __asm
  739. {
  740. fld [x]
  741. fsin
  742. fstp [y]
  743. }
  744. return y;
  745. }/**/
  746. //========== for 3d hardware =============//
  747. //========== for 3d hardware =============//
  748. _EXTORNOT BOOL HARD3D;
  749. void ShowVideo();
  750. void Init3DHardware();
  751. void Activate3DHardware();
  752. void ShutDown3DHardware();
  753. void Render3DHardwarePosts();
  754. void CopyBackToDIB();
  755. void CopyHARDToDIB();
  756. void Hardware_ZBuffer(BOOL zb);
  757. //=========== loading =============
  758. void StartLoading();
  759. void EndLoading();
  760. void PrintLoad(char *t);
  761. #ifdef _MAIN_
  762. _EXTORNOT char KeysName[256][24] = {
  763. "...",
  764. "Esc",
  765. "1",
  766. "2",
  767. "3",
  768. "4",
  769. "5",
  770. "6",
  771. "7",
  772. "8",
  773. "9",
  774. "0",
  775. "-",
  776. "=",
  777. "BSpace",
  778. "Tab",
  779. "Q",
  780. "W",
  781. "E",
  782. "R",
  783. "T",
  784. "Y",
  785. "U",
  786. "I",
  787. "O",
  788. "P",
  789. "[",
  790. "]",
  791. "Enter",
  792. "Ctrl",
  793. "A",
  794. "S",
  795. "D",
  796. "F",
  797. "G",
  798. "H",
  799. "J",
  800. "K",
  801. "L",
  802. ";",
  803. "'",
  804. "~",
  805. "Shift",
  806. "\\",
  807. "Z",
  808. "X",
  809. "C",
  810. "V",
  811. "B",
  812. "N",
  813. "M",
  814. ",",
  815. ".",
  816. "/",
  817. "Shift",
  818. "*",
  819. "Alt",
  820. "Space",
  821. "CLock",
  822. "F1",
  823. "F2",
  824. "F3",
  825. "F4",
  826. "F5",
  827. "F6",
  828. "F7",
  829. "F8",
  830. "F9",
  831. "F10",
  832. "NLock",
  833. "SLock",
  834. "Home",
  835. "Up",
  836. "PgUp",
  837. "-",
  838. "Left",
  839. "Midle",
  840. "Right",
  841. "+",
  842. "End",
  843. "Down",
  844. "PgDn",
  845. "Ins",
  846. "Del",
  847. "",
  848. "",
  849. "",
  850. "F11",
  851. "F12",
  852. "",
  853. "",
  854. "",
  855. "",
  856. "",
  857. "",
  858. "",
  859. "",
  860. "",
  861. "",
  862. "",
  863. "",
  864. "",
  865. "",
  866. "",
  867. "",
  868. "",
  869. "",
  870. "",
  871. "",
  872. "",
  873. "",
  874. "",
  875. "",
  876. "",
  877. "",
  878. "",
  879. "",
  880. "",
  881. "",
  882. "",
  883. "",
  884. "",
  885. "",
  886. "",
  887. "Mouse1",
  888. "Mouse2",
  889. "Mouse3",
  890. "<?>",
  891. "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  892. "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  893. "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  894. "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  895. "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  896. "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  897. "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
  898. "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
  899. };
  900. #else
  901. _EXTORNOT char KeysName[128][24];
  902. #endif