Hunt.h 23 KB

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