FUNCTION.H 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: /CounterStrike/FUNCTION.H 2 3/13/97 2:05p Steve_tall $*/
  15. /***********************************************************************************************
  16. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : FUNCTION.H *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : May 27, 1994 *
  26. * *
  27. * Last Update : May 27, 1994 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  32. #ifndef FUNCTION_H
  33. #define FUNCTION_H
  34. /*
  35. ** !!!DEFINE!!! "NDEBUG" if the assertion code is to be !!!REMOVED!!! from the project.
  36. */
  37. //#define NDEBUG // ST - 5/13/2019
  38. //#pragma warn -hid
  39. #ifdef NEVER
  40. Map (screen) class heirarchy.
  41. MapeditClass (most derived class) -- scenario editor
  42. ³
  43. MouseClass -- handles mouse animation and display control
  44. ³
  45. ScrollClass -- map scroll handler
  46. ³
  47. HelpClass -- pop-up help text handler
  48. ³
  49. TabClass -- file folder tab screen mode control dispatcher
  50. ³
  51. SidebarClass -- displays and controls construction list sidebar
  52. ³
  53. PowerClass -- display power production/consumption bargraph
  54. ³
  55. RadarClass -- displays and controls radar map
  56. ³
  57. DisplayClass -- general tactical map display handler
  58. ³
  59. MapClass -- general tactical map data handler
  60. ³
  61. GScreenClass (pure virtual base class) -- generic screen control
  62. AbstractClass
  63. ³
  64. ³
  65. ³
  66. ³
  67. ObjectClass
  68. ³
  69. ÚÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄ¿
  70. AnimClass ³ TemplateClass ³ ÃÄ FuseClass ³ TerrainClass
  71. ³ ³ ÃÄ FlyClass ³
  72. ³ ³ BulletClass ³
  73. OverlayClass MissionClass SmudgeClass
  74. ³
  75. RadioClass
  76. ³
  77. ÃÄ CrewClass
  78. ÃÄ FlasherClass
  79. ÃÄ StageClass
  80. ÃÄ CargoClass
  81. TechnoClass
  82. ³
  83. ÚÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
  84. FootClass BuildingClass
  85. ³
  86. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÁÂÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
  87. DriveClass InfantryClass ÃÄ FlyClass
  88. ³ AircraftClass
  89. ÚÄÁÄÄÄÄÄÄÄÄÄ¿
  90. ³ ³
  91. ³ VesselClass
  92. ³
  93. UnitClass
  94. AbstractTypeClass
  95. ³
  96. ObjectTypeClass
  97. ³
  98. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
  99. ³ ³ ³ ³
  100. TechnoTypeClass ³ ³ ³
  101. ³ BulletTypeClass ³ ³
  102. ³ TemplateTypeClass ³
  103. ÚÄÄÄÄÄÄÄÄÁÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿ TerrainTypeClass
  104. ³ ³ ³ ³ ³
  105. UnitTypeClass ³ BuildingTypeClass ³ VesselTypeClass
  106. ³ ³
  107. AircraftTypeClass InfantryTypeClass
  108. #endif
  109. #include "watcom.h"
  110. #include "lint.h"
  111. #ifdef WIN32
  112. //#define WIN32_LEAN_AND_MEAN
  113. #include <windows.h>
  114. #define WWFILE_H
  115. #define RAWFILE_H
  116. #define MONOC_H
  117. #define _MAX_NAME _MAX_FNAME
  118. #endif
  119. /*
  120. ** The "bool" integral type was defined by the C++ comittee in
  121. ** November of '94. Until the compiler supports this, use the following
  122. ** definition.
  123. */
  124. #if (0)
  125. #ifndef __BORLANDC__
  126. #ifndef TRUE_FALSE_DEFINED
  127. #define TRUE_FALSE_DEFINED
  128. enum {false=0,true=1};
  129. typedef int bool;
  130. #endif
  131. #endif
  132. #endif
  133. #ifndef BITMAPCLASS
  134. #define BITMAPCLASS
  135. class BitmapClass
  136. {
  137. public:
  138. BitmapClass(int w, int h, unsigned char * data) :
  139. Width(w), Height(h), Data(data) {};
  140. int Width;
  141. int Height;
  142. unsigned char * Data;
  143. };
  144. class TPoint2D
  145. {
  146. public:
  147. TPoint2D(int xx, int yy) : x(xx), y(yy) {};
  148. TPoint2D(void) : x(0), y(0) {};
  149. int x;
  150. int y;
  151. };
  152. #endif
  153. /**********************************************************************
  154. ** This class is solely used as a parameter to a constructor that does
  155. ** absolutely no initialization to the object being constructed. By using
  156. ** this method, it is possible to load and save data directly from a
  157. ** class that has virtual functions. The construction process automatically
  158. ** takes care of initializing the virtual function table pointer and the
  159. ** rest of the constructor doesn't initialize any data members. After loading
  160. ** into a class object, simply perform an in-place new operation.
  161. */
  162. #ifndef NOINITCLASS
  163. #define NOINITCLASS
  164. struct NoInitClass {
  165. public:
  166. void operator () (void) const {};
  167. };
  168. #endif
  169. #define FILE_H
  170. #define WWMEM_H
  171. #ifndef WIN32
  172. #define TIMER_H
  173. #endif
  174. #ifdef WIN32
  175. #include "key.h"
  176. #endif
  177. #include <wwlib32.h>
  178. #include "mpu.h"
  179. #include "bench.h"
  180. #include "rect.h"
  181. #include "jshell.h"
  182. #include "buff.h"
  183. #include "face.h"
  184. #include "random.h"
  185. #include "crc.h"
  186. #include "compat.h"
  187. #include "fixed.h"
  188. #include "base64.h"
  189. #include "pipe.h"
  190. #include "xpipe.h"
  191. #include "ramfile.h"
  192. #include "lcw.h"
  193. #include "lzw.h"
  194. #include "lcwpipe.h"
  195. #include "lzwpipe.h"
  196. #include "lzopipe.h"
  197. #include "crcpipe.h"
  198. #include "shapipe.h"
  199. #include "b64pipe.h"
  200. #include "straw.h"
  201. #include "xstraw.h"
  202. #include "b64straw.h"
  203. #include "lcwstraw.h"
  204. #include "lzwstraw.h"
  205. #include "lzostraw.h"
  206. #include "crcstraw.h"
  207. #include "shastraw.h"
  208. #include "rndstraw.h"
  209. // Should be part of WWLIB.H. This is used in JSHELL.CPP.
  210. typedef struct {
  211. unsigned char SourceColor;
  212. unsigned char DestColor;
  213. unsigned char Fading;
  214. unsigned char reserved;
  215. } TLucentType;
  216. #include <string.h>
  217. #include <stdlib.h>
  218. #include <stdio.h>
  219. #include <stddef.h>
  220. //#include <mem.h>
  221. //#include <dos.h>
  222. #include <direct.h>
  223. #include <stdarg.h>
  224. #include <ctype.h>
  225. #include <assert.h>
  226. #include <process.h>
  227. //#include <new.h>
  228. #ifdef WIN32
  229. #define int386x(a,b,c,d) 0
  230. #define int386(a,b,c) 0
  231. #endif
  232. /*
  233. ** VQ player specific includes.
  234. */
  235. //#include <vqa32\vqaplay.h>
  236. //#include <vqa32\vqafile.h>
  237. extern bool GameActive;
  238. extern long LParam;
  239. #include <assert.h>
  240. #include "vector.h"
  241. #include "heap.h"
  242. #include "ccfile.h"
  243. #include "monoc.h"
  244. #include "conquer.h"
  245. //#include "debug.h"
  246. #include "special.h"
  247. #include "defines.h"
  248. #include "ccini.h"
  249. #include "ccptr.h"
  250. #include "bar.h"
  251. /*
  252. ** Greenleaf specific includes.
  253. */
  254. //#include <modem.h>
  255. //#include <fast.h>
  256. extern long Frame;
  257. CELL Coord_Cell(COORDINATE coord);
  258. #include "utracker.h"
  259. #include "crate.h"
  260. #include "rules.h"
  261. #include "ini.h"
  262. #include "int.h"
  263. #include "pk.h"
  264. #include "pkpipe.h"
  265. #include "pkstraw.h"
  266. #include "sha.h"
  267. #include "blowfish.h"
  268. #include "blowpipe.h"
  269. #include "blwstraw.h"
  270. #include "language.h"
  271. #include "hsv.h"
  272. #include "rgb.h"
  273. #include "palette.h"
  274. #include "palettec.h" //ST 5/13/2019
  275. #include "version.h"
  276. #include "facing.h"
  277. #include "ftimer.h"
  278. #include "theme.h"
  279. #include "link.h"
  280. #include "gadget.h"
  281. #include "control.h"
  282. #include "toggle.h"
  283. #include "checkbox.h"
  284. #include "shapebtn.h"
  285. #include "textbtn.h"
  286. #include "statbtn.h"
  287. #include "slider.h"
  288. #include "list.h"
  289. #include "drop.h"
  290. #include "cheklist.h"
  291. #include "colrlist.h"
  292. #include "edit.h"
  293. #include "gauge.h"
  294. #include "msgbox.h"
  295. #include "dial8.h"
  296. #include "txtlabel.h"
  297. #include "loaddlg.h"
  298. #include "super.h"
  299. #include "house.h"
  300. #include "gscreen.h"
  301. #include "map.h"
  302. #include "display.h"
  303. #include "radar.h"
  304. #include "power.h"
  305. #include "sidebar.h"
  306. #include "tab.h"
  307. #include "help.h"
  308. #include "mouse.h"
  309. #include "help.h"
  310. #include "target.h"
  311. #include "theme.h"
  312. #include "team.h" // Team objects.
  313. #include "warhead.h"
  314. #include "weapon.h"
  315. #include "trigtype.h"
  316. #include "teamtype.h" // Team type objects.
  317. #include "taction.h"
  318. #include "tevent.h"
  319. #include "trigger.h" // Trigger event objects.
  320. #include "mapedit.h" // map editor class
  321. #include "abstract.h"
  322. #include "object.h"
  323. #include "mission.h"
  324. #include "door.h"
  325. #include "bullet.h" // Bullet objects.
  326. #include "terrain.h" // Terrain objects.
  327. #include "anim.h" // Animation objects.
  328. #include "template.h" // Icon template objects.
  329. #include "overlay.h" // Overlay objects.
  330. #include "smudge.h" // Stains on the terrain objects.
  331. #include "aircraft.h" // Aircraft objects.
  332. #include "unit.h" // Ground unit objects.
  333. #include "vessel.h" // Sea unit objects.
  334. #include "infantry.h" // Infantry objects.
  335. #include "credits.h" // Credit counter class.
  336. #include "score.h" // Scoring system class.
  337. #include "factory.h" // Production manager class.
  338. #include "intro.h"
  339. #include "ending.h"
  340. #include "logic.h"
  341. #include "queue.h"
  342. #include "event.h"
  343. #include "base.h" // defines the AI's pre-built base
  344. #include "carry.h"
  345. #include "scenario.h"
  346. #include "msglist.h" // Multiplayer chat message system
  347. #include "session.h" // Multiplayer session class
  348. //#include "phone.h" // Phone list manager
  349. #include "ipxmgr.h" // IPX connection manager
  350. //#include "nullmgr.h" // Modem connection manager
  351. #include "readline.h"
  352. #include "vortex.h"
  353. #include "egos.h"
  354. #ifdef WIN32
  355. //#include "pcx.h"
  356. #endif
  357. #if(TEN)
  358. #include "tenmgr.h"
  359. #endif
  360. #if(MPATH)
  361. #ifdef WIN32
  362. #include "mpmgrw.h"
  363. #else
  364. #include "mpmgrd.h"
  365. #endif
  366. #endif
  367. // Denzil 5/18/98 - Mpeg movie playback
  368. #ifdef MPEGMOVIE
  369. bool InitDDraw(void);
  370. bool PlayMpegMovie(const char* name);
  371. #endif
  372. #include "externs.h"
  373. extern int Get_CD_Drive(void);
  374. extern void Fatal(char const *message, ...);
  375. #ifdef WIN32
  376. /*
  377. ** For WIN32, replace the assert macro so we get an error on the debugger screen
  378. ** where we can see it.
  379. **
  380. */
  381. #ifndef __BORLANDC__
  382. #ifdef assert
  383. #undef assert
  384. #endif //assert
  385. void Assert_Failure (char *expression, int line, char *file);
  386. #ifdef NDEBUG
  387. #define assert(__ignore) ((void)0)
  388. #else
  389. #define assert(expr) ((expr)?(void)0:Assert_Failure(#expr,__LINE__,__FILE__))
  390. #endif //NDEBUG
  391. #endif //__BORLANDC__
  392. extern void Free_Interpolated_Palettes(void);
  393. extern int Load_Interpolated_Palettes(char const *filename, BOOL add=FALSE);
  394. extern void Rebuild_Interpolated_Palette(unsigned char *interpal);
  395. extern void Interpolate_2X_Scale( GraphicBufferClass *source, GraphicViewPortClass *dest ,char const *palette_file_name);
  396. void Increase_Palette_Luminance (unsigned char *palette , int red_percentage , int green_percentage , int blue_percentage ,int cap);
  397. #endif
  398. /*
  399. ** ADATA.CPP
  400. */
  401. char const * Anim_Name(AnimType anim);
  402. /*
  403. ** AIRCRAFT.CPP
  404. */
  405. bool Building_Check(void);
  406. /*
  407. ** ANIM.CPP
  408. */
  409. void Shorten_Attached_Anims(ObjectClass * obj);
  410. AnimType Anim_From_Name(char const * name);
  411. /*
  412. ** AUDIO.CPP
  413. */
  414. VocType Voc_From_Name(char const * name);
  415. char const * Speech_Name(VoxType speech);
  416. char const * Voc_Name(VocType voc);
  417. int Sound_Effect(VocType voc, fixed volume=1, int variation=1, signed short panvalue=0, HousesType house=HOUSE_NONE);
  418. // void Speak(VoxType voice); // MBL 02.06.2020
  419. void Speak(VoxType voice, HouseClass *house=NULL, COORDINATE coord=0);
  420. void Speak_AI(void);
  421. void Stop_Speaking(void);
  422. void Sound_Effect(VocType voc, COORDINATE coord, int variation=1, HousesType house=HOUSE_NONE);
  423. bool Is_Speaking(void);
  424. /*
  425. ** CDFILE.CPP
  426. */
  427. #ifdef WIN32
  428. int harderr_handler(unsigned, unsigned, unsigned *);
  429. #else
  430. int harderr_handler(unsigned, unsigned, unsigned __far *);
  431. #endif
  432. /*
  433. ** COMBAT.CPP
  434. */
  435. int Modify_Damage(int damage, WarheadType warhead, ArmorType armor, int distance);
  436. void Explosion_Damage(COORDINATE coord, int strength, TechnoClass * source, WarheadType warhead);
  437. AnimType Combat_Anim(int damage, WarheadType warhead, LandType land);
  438. void Wide_Area_Damage(COORDINATE coord, LEPTON radius, int damage, TechnoClass * source, WarheadType warhead);
  439. /*
  440. ** CONQUER.CPP
  441. */
  442. void List_Copy(short const * source, int len, short * dest);
  443. int Get_CD_Index (int cd_drive, int timeout);
  444. int Owner_From_Name(char const * text);
  445. CrateType Crate_From_Name(char const * name);
  446. Rect const Shape_Dimensions(void const * shapedata, int shapenum);
  447. void IPX_Call_Back(void);
  448. bool Is_Counterstrike_Installed (void);
  449. #ifdef FIXIT_CSII // checked - ajw 9/28/98
  450. bool Is_Aftermath_Installed (void);
  451. #endif
  452. #if(TEN)
  453. void Ten_Call_Back(void);
  454. #endif // TEN
  455. #if(MPATH)
  456. void MPATH_Call_Back(void);
  457. #endif // MPATH
  458. #define ALWAYS_RELOAD_CD 1000
  459. void Center_About_Objects(void);
  460. bool Force_CD_Available(int cd);
  461. void Handle_View(int view, int action=0);
  462. void Handle_Team(int team, int action=0);
  463. TechnoTypeClass const * Fetch_Techno_Type(RTTIType type, int id);
  464. char const * Fading_Table_Name(char const * base, TheaterType theater);
  465. void Unselect_All(void);
  466. void Unselect_All_Except(ObjectClass* object);
  467. void Play_Movie(char const * name, ThemeType theme=THEME_NONE, bool clrscrn=true, bool immediate = false);
  468. void Play_Movie(VQType name, ThemeType theme=THEME_NONE, bool clrscrn=true, bool immediate=false);
  469. bool Main_Loop(void);
  470. TheaterType Theater_From_Name(char const * name);
  471. void Main_Game(int argc, char * argv[]);
  472. long VQ_Call_Back(unsigned char * buffer=NULL, long frame=0);
  473. void Call_Back(void);
  474. char const *Language_Name(char const * basename);
  475. SourceType Source_From_Name(char const * name);
  476. char const *Name_From_Source(SourceType source);
  477. FacingType KN_To_Facing(int input);
  478. void const *Get_Radar_Icon(void const * shapefile, int shapenum, int frames, int zoomfactor);
  479. //void CC_Draw_Shape(ObjectClass *object, void const * shapefile, int shapenum, int x, int y, WindowNumberType window, ShapeFlags_Type flags, void const * fadingdata=0, void const * ghostdata=0, DirType rotation=DIR_N, long scale=0x0100);
  480. void CC_Draw_Shape(void const * shapefile, int shapenum, int x, int y, WindowNumberType window, ShapeFlags_Type flags, void const * fadingdata = 0, void const * ghostdata = 0, DirType rotation = DIR_N);
  481. // Added for draw intercept. ST - 1/17/2019 12:31PM
  482. void CC_Draw_Shape(const ObjectClass *object, void const * shapefile, int shapenum, int x, int y, WindowNumberType window, ShapeFlags_Type flags, void const * fadingdata = 0, void const * ghostdata = 0, DirType rotation = DIR_N, long virtualscale = 0x0100, int width = 0, int height = 0);
  483. void CC_Draw_Shape(const ObjectClass *object, const char *shape_file_name, void const * shapefile, int shapenum, int x, int y, WindowNumberType window, ShapeFlags_Type flags, void const * fadingdata = 0, void const * ghostdata = 0, DirType rotation = DIR_N, long virtualscale = 0x0100, char override_owner = HOUSE_NONE);
  484. // Added for pip draw intercept - SKY
  485. void CC_Draw_Pip(const ObjectClass *object, void const * shapefile, int shapenum, int x, int y, WindowNumberType window, ShapeFlags_Type flags, void const * fadingdata = 0, void const * ghostdata = 0, DirType rotation = DIR_N);
  486. void Go_Editor(bool flag);
  487. //long MixFileHandler(VQAHandle * vqa, long action, void * buffer, long nbytes);
  488. char *CC_Get_Shape_Filename(void const * shapeptr );
  489. void CC_Add_Shape_To_Global(void const * shapeptr, char * filename, char code );
  490. void Bubba_Print(char * format,...);
  491. void Heap_Dump_Check(char * string );
  492. void Dump_Heap_Pointers(void);
  493. unsigned long Disk_Space_Available(void);
  494. void * Hires_Load(char * name);
  495. void Shake_The_Screen(int shakes, HousesType house = HOUSE_NONE);
  496. /*
  497. ** COORD.CPP
  498. */
  499. short const * Coord_Spillage_List(COORDINATE coord, Rect const & rect, bool nocenter=true);
  500. void Normal_Move_Point(short &x, short &y, register DirType dir, unsigned short distance);
  501. void Move_Point(short &x, short &y, register DirType dir, unsigned short distance);
  502. COORDINATE Coord_Move(COORDINATE start, DirType facing, unsigned short distance);
  503. COORDINATE Coord_Scatter(COORDINATE coord, unsigned distance, bool lock=false);
  504. DirType Direction(CELL cell1, CELL cell2);
  505. DirType Direction(COORDINATE coord1, COORDINATE coord2);
  506. DirType Direction256(COORDINATE coord1, COORDINATE coord2);
  507. DirType Direction8(COORDINATE coord1, COORDINATE coord2);
  508. int Distance(COORDINATE coord1, COORDINATE coord2);
  509. int Distance(TARGET target1, TARGET target2);
  510. short const * Coord_Spillage_List(COORDINATE coord, int maxsize);
  511. /*
  512. ** DEBUG.CPP
  513. */
  514. void Log_Event(char const *text, ...);
  515. void Debug_Key(unsigned input);
  516. void Self_Regulate(void);
  517. /*
  518. ** DIALOG.CPP
  519. */
  520. void Draw_Caption(int text, int x, int y, int w);
  521. void Draw_Caption(char const * text, int x, int y, int w);
  522. int Format_Window_String(char * string, int maxlinelen, int & width, int & height);
  523. extern void Dialog_Box(int x, int y, int w, int h);
  524. void Conquer_Clip_Text_Print(char const *, unsigned x, unsigned y, RemapControlType * fore, unsigned back=(unsigned)TBLACK, TextPrintType flag=TPF_8POINT|TPF_DROPSHADOW, int width=-1, int const * tabs=0);
  525. void Draw_Box(int x, int y, int w, int h, BoxStyleEnum up, bool filled);
  526. int cdecl Dialog_Message(char *errormsg, ...);
  527. void Window_Box(WindowNumberType window, BoxStyleEnum style);
  528. void Fancy_Text_Print(char const *text, unsigned x, unsigned y, RemapControlType * fore, unsigned back, TextPrintType flag, ...);
  529. void Fancy_Text_Print(int text, unsigned x, unsigned y, RemapControlType * fore, unsigned back, TextPrintType flag, ...);
  530. void Simple_Text_Print(char const *text, unsigned x, unsigned y, RemapControlType * fore, unsigned back, TextPrintType flag);
  531. void Plain_Text_Print(int text, unsigned x, unsigned y, unsigned fore, unsigned back, TextPrintType flag, ...);
  532. void Plain_Text_Print(char const *text, unsigned x, unsigned y, unsigned fore, unsigned back, TextPrintType flag, ...);
  533. /*
  534. ** DISPLAY.CPP
  535. */
  536. ObjectClass* Best_Object_With_Action(DynamicVectorClass<ObjectClass*>& objects, const ObjectClass* object);
  537. ObjectClass* Best_Object_With_Action(DynamicVectorClass<ObjectClass*>& objects, CELL cell);
  538. ActionType Best_Object_Action(DynamicVectorClass<ObjectClass*>& objects, const ObjectClass* object);
  539. ActionType Best_Object_Action(DynamicVectorClass<ObjectClass*>& objects, CELL cell);
  540. ObjectClass* Best_Object_With_Action(const ObjectClass* object);
  541. ObjectClass* Best_Object_With_Action(CELL cell);
  542. ActionType Best_Object_Action(const ObjectClass* object);
  543. ActionType Best_Object_Action(CELL cell);
  544. /*
  545. ** ENDING.CPP
  546. */
  547. void GDI_Ending(void);
  548. void Nod_Ending(void);
  549. /*
  550. ** EXPAND.CPP
  551. */
  552. bool Expansion_Present(void);
  553. bool Expansion_Dialog(void);
  554. bool Expansion_CS_Present(void);
  555. #ifdef FIXIT_CSII // checked - ajw 9/28/98
  556. bool Expansion_AM_Present(void);
  557. #endif
  558. /*
  559. ** FINDPATH.CPP
  560. */
  561. int Optimize_Moves(PathType *path, int (*callback)(CELL, FacingType), int threshhold);
  562. /*
  563. ** GOPTIONS.CPP
  564. */
  565. /*
  566. ** INI.CPP
  567. */
  568. void Write_Scenario_INI(char *root);
  569. bool Read_Scenario_INI(char *root, bool fresh=true);
  570. int Scan_Place_Object(ObjectClass *obj, CELL cell);
  571. void Assign_Houses(void);
  572. /*
  573. ** INIBIN.CPP
  574. */
  575. unsigned long Ini_Binary_Version( void );
  576. bool Read_Scenario_INB( CCFileClass *file, char *root, bool fresh );
  577. bool Valid_Scenario_INB( CCFileClass *file );
  578. /*
  579. ** INICODE.CPP
  580. */
  581. bool Read_Scenario_INI_Write_INB( char *root, bool fresh );
  582. /*
  583. ** INIT.CPP
  584. */
  585. void Load_Title_Page(bool visible=false);
  586. long Obfuscate(char const * string);
  587. void Anim_Init(void);
  588. bool Init_Game(int argc, char *argv[]);
  589. bool Select_Game(bool fade = false);
  590. bool Parse_Command_Line(int argc, char *argv[]);
  591. void Parse_INI_File(void);
  592. /*
  593. ** INTERPAL.CPP
  594. */
  595. #define SIZE_OF_PALETTE 256
  596. extern "C" unsigned char *InterpolationPalette;
  597. extern BOOL InterpolationPaletteChanged;
  598. extern void Interpolate_2X_Scale( GraphicBufferClass *source, GraphicViewPortClass *dest ,char const *palette_file_name);
  599. void Read_Interpolation_Palette (char const *palette_file_name);
  600. void Write_Interpolation_Palette (char const *palette_file_name);
  601. void Increase_Palette_Luminance(unsigned char *InterpolationPalette , int RedPercentage ,int GreenPercentage ,int BluePercentage ,int cap);
  602. extern "C"{
  603. extern unsigned char PaletteInterpolationTable[SIZE_OF_PALETTE][SIZE_OF_PALETTE];
  604. extern unsigned char *InterpolationPalette;
  605. void __cdecl Asm_Create_Palette_Interpolation_Table(void);
  606. }
  607. /*
  608. ** JSHELL.CPP
  609. */
  610. int Load_Picture(char const *filename, BufferClass& scratchbuf, BufferClass& destbuf, unsigned char *palette, PicturePlaneType format);
  611. void * Conquer_Build_Fading_Table(PaletteClass const & palette, void *dest, int color, int frac);
  612. void * Small_Icon(void const * iconptr, int iconnum);
  613. void Set_Window(int window, int x, int y, int w, int h);
  614. void * Load_Alloc_Data(FileClass &file);
  615. long Load_Uncompress(FileClass &file, BuffType &uncomp_buff, BuffType &dest_buff, void *reserved_data);
  616. long Translucent_Table_Size(int count);
  617. void *Build_Translucent_Table(PaletteClass const & palette, TLucentType const *control, int count, void *buffer);
  618. void *Conquer_Build_Translucent_Table(PaletteClass const & palette, TLucentType const *control, int count, void *buffer);
  619. void * Make_Fading_Table(PaletteClass const & palette, void * dest, int color, int frac);
  620. /*
  621. ** KEYFBUFF.ASM
  622. */
  623. extern "C" {
  624. long __cdecl Buffer_Frame_To_Page(int x, int y, int w, int h, void *Buffer, GraphicViewPortClass &view, int flags, ...);
  625. }
  626. /*
  627. ** KEYFRAME.CPP
  628. */
  629. unsigned long Build_Frame(void const *dataptr, unsigned short framenumber, void *buffptr);
  630. unsigned short Get_Build_Frame_Count(void const *dataptr);
  631. unsigned short Get_Build_Frame_X(void const *dataptr);
  632. unsigned short Get_Build_Frame_Y(void const *dataptr);
  633. unsigned short Get_Build_Frame_Width(void const *dataptr);
  634. unsigned short Get_Build_Frame_Height(void const *dataptr);
  635. bool Get_Build_Frame_Palette(void const *dataptr, void *palette);
  636. int Get_Last_Frame_Length(void);
  637. /*
  638. ** MAP.CPP
  639. */
  640. int Terrain_Cost(CELL cell, FacingType facing);
  641. int Coord_Spillage_Number(COORDINATE coord, int maxsize);
  642. /*
  643. ** MENUS.CPP
  644. */
  645. void Setup_Menu(int menu, char const *text[], unsigned long field, int index, int skip);
  646. int Check_Menu(int menu, char const *text[], char *selection, long field, int index);
  647. int Do_Menu(char const **strings, bool blue);
  648. extern int UnknownKey;
  649. int Main_Menu(unsigned long timeout);
  650. /*
  651. ** MPLAYER.CPP
  652. */
  653. GameType Select_MPlayer_Game (void);
  654. void Clear_Listbox(ListClass *list);
  655. void Clear_Vector(DynamicVectorClass <NodeNameType *> *vector);
  656. void Computer_Message(void);
  657. int Surrender_Dialog(int text);
  658. #ifdef FIXIT_VERSION_3 // Stalemate games.
  659. int Surrender_Dialog(const char* text);
  660. bool Determine_If_Using_DVD();
  661. bool Using_DVD();
  662. #endif
  663. int Abort_Dialog(void);
  664. #if(TEN)
  665. int Read_TEN_Game_Options(void);
  666. #endif // TEN
  667. #if(MPATH)
  668. int Read_MPATH_Game_Options(void);
  669. #endif // MPATH
  670. #if(TEN)
  671. /*
  672. ** CCTEN.CPP
  673. */
  674. int Init_TEN(void);
  675. void Shutdown_TEN(void);
  676. void Connect_TEN(void);
  677. void Destroy_TEN_Connection(int id, int error);
  678. void Send_TEN_Win_Packet(void);
  679. void Send_TEN_Alliance(char *whom, int ally);
  680. void Send_TEN_Out_Of_Sync(void);
  681. void Send_TEN_Packet_Too_Late(void);
  682. #endif // TEN
  683. #if(MPATH)
  684. /*
  685. ** CCMPATH.CPP
  686. */
  687. int Init_MPATH(void);
  688. void Shutdown_MPATH(void);
  689. void Connect_MPATH(void);
  690. void Destroy_MPATH_Connection(int id, int error);
  691. #endif // MPATH
  692. /*
  693. ** NETDLG.CPP
  694. */
  695. bool Init_Network (void);
  696. void Shutdown_Network (void);
  697. bool Remote_Connect (void);
  698. void Destroy_Connection(int id, int error);
  699. bool Process_Global_Packet(GlobalPacketType *packet, IPXAddressClass *address);
  700. unsigned long Compute_Name_CRC(char *name);
  701. void Net_Reconnect_Dialog(int reconn, int fresh, int oldest_index, unsigned long timeval);
  702. /*
  703. ** NULLDLG.CPP
  704. */
  705. int Init_Null_Modem( SerialSettingsType *settings );
  706. void Shutdown_Modem( void );
  707. void Modem_Signoff( void );
  708. int Test_Null_Modem( void );
  709. int Reconnect_Modem( void );
  710. void Destroy_Null_Connection(int id, int error);
  711. GameType Select_Serial_Dialog( void );
  712. int Com_Scenario_Dialog(bool skirmish=false);
  713. int Com_Show_Scenario_Dialog(void);
  714. void Smart_Printf( char *format, ... );
  715. void Hex_Dump_Data( char *buffer, int length );
  716. void itoh( int i, char *s);
  717. void Log_Start_Time( char *string );
  718. void Log_End_Time( char *string );
  719. void Log_Time( char *string );
  720. void Log_Start_Nest_Time( char *string );
  721. void Log_End_Nest_Time( char *string );
  722. /*
  723. ** OBJECT.CPP
  724. */
  725. /*
  726. ** PROFILE.CPP
  727. */
  728. int WWGetPrivateProfileInt(char const *section, char const *entry, int def, char *profile);
  729. bool WWWritePrivateProfileInt(char const *section, char const *entry, int value, char *profile);
  730. bool WWWritePrivateProfileString(char const *section, char const *entry, char const *string, char *profile);
  731. char * WWGetPrivateProfileString(char const *section, char const *entry, char const *def, char *retbuffer, int retlen, char const * profile);
  732. unsigned WWGetPrivateProfileHex (char const *section, char const *entry, char * profile);
  733. char *Read_Bin_Buffer( void );
  734. bool Read_Bin_Init( char *buffer, int length );
  735. int Read_Bin_Length( char *buffer );
  736. bool Read_Bin_Num( void *num, int length, char *buffer );
  737. int Read_Bin_Pos( char *buffer );
  738. int Read_Bin_PosSet( unsigned int pos, char *buffer );
  739. bool Read_Bin_String( char *string, char *buffer );
  740. char *Write_Bin_Buffer( void );
  741. bool Write_Bin_Init( char *buffer, int length );
  742. int Write_Bin_Length( char *buffer );
  743. bool Write_Bin_Num( void *num, int length, char *buffer );
  744. int Write_Bin_Pos( char *buffer );
  745. int Write_Bin_PosSet( unsigned int pos, char *buffer );
  746. bool Write_Bin_String( char *string, int length, char *buffer );
  747. /*
  748. ** QUEUE.CPP
  749. */
  750. bool Queue_Target(TargetClass whom, TARGET target);
  751. bool Queue_Destination(TargetClass whom, TARGET target);
  752. bool Queue_Mission(TargetClass whom, MissionType mission);
  753. bool Queue_Mission(TargetClass whom, MissionType mission, TARGET target, TARGET destination);
  754. bool Queue_Mission(TargetClass whom, MissionType mission, TARGET target, TARGET destination, SpeedType speed, MPHType maxspeed);
  755. bool Queue_Options(void);
  756. bool Queue_Exit(void);
  757. void Queue_AI(void);
  758. void Add_CRC(unsigned long *crc, unsigned long val);
  759. /*
  760. ** RANDOM.CPP
  761. */
  762. /*
  763. ** REINF.CPP
  764. */
  765. bool Do_Reinforcements(TeamTypeClass const * team);
  766. bool Create_Special_Reinforcement(HouseClass * house, TechnoTypeClass const * type, TechnoTypeClass const * another, TeamMissionType mission = TMISSION_NONE, int argument =0);
  767. int Create_Air_Reinforcement(HouseClass *house, AircraftType air, int number, MissionType mission, TARGET tarcom, TARGET navcom, InfantryType passenger=INFANTRY_NONE);
  768. /*
  769. ** ROTBMP.CPP
  770. */
  771. int Rotate_Bitmap(GraphicViewPortClass *srcvp,GraphicViewPortClass *destvp,int angle);
  772. /*
  773. ** RULES.CPP
  774. */
  775. bool Is_MCV_Deploy();
  776. /*
  777. ** SAVELOAD.CPP
  778. */
  779. bool Load_Misc_Values(Straw & file);
  780. bool Save_Misc_Values(Pipe & file);
  781. bool Load_MPlayer_Values(Straw & file);
  782. bool Save_MPlayer_Values(Pipe & file);
  783. bool Get_Savefile_Info(int id, char * buf, unsigned * scenp, HousesType * housep);
  784. bool Load_Game(int id);
  785. bool Load_Game(const char *file_name);
  786. //bool Read_Object (void * ptr, int base_size, int class_size, FileClass & file, void * vtable); // Original Read_Object prototype. ST - 9/17/2019 12:50PM
  787. bool Read_Object(void *ptr, int class_size, FileClass & file, bool has_vtable);
  788. bool Save_Game(int id, char const * descr, bool bargraph=false);
  789. bool Save_Game(const char *file_name, const char *descr);
  790. bool Write_Object (void * ptr, int class_size, FileClass & file);
  791. void Code_All_Pointers(void);
  792. void Decode_All_Pointers(void);
  793. void Dump(void);
  794. /*
  795. ** SCENARIO.CPP
  796. */
  797. void Disect_Scenario_Name(char const * name, int & scenario, ScenarioPlayerType & player, ScenarioDirType & dir, ScenarioVarType & var);
  798. void Post_Load_Game(int load_net);
  799. bool End_Game(void);
  800. bool Read_Scenario(char *root);
  801. bool Start_Scenario(char *root, bool briefing=true);
  802. void Set_Scenario_Difficulty(int difficulty);
  803. HousesType Select_House(void);
  804. void Clear_Scenario(void);
  805. void Do_Briefing(char const * text);
  806. void Do_Lose(void);
  807. void Do_Win(void);
  808. void Do_Restart(void);
  809. void Fill_In_Data(void);
  810. bool Restate_Mission(char const * name, int button1, int button2);
  811. int BGMessageBox(char const *text, int button1, int button2);
  812. /*
  813. ** SCORE.CPP
  814. */
  815. char const * Map_Selection(void);
  816. void Bit_It_In(int x, int y, int w, int h, GraphicBufferClass *src, GraphicBufferClass *dest, int delay=0, int dagger=0);
  817. void Call_Back_Delay(int time);
  818. int Alloc_Object(ScoreAnimClass *obj);
  819. /*
  820. ** SPECIAL.CPP
  821. */
  822. void Special_Dialog(bool simple=false);
  823. char const * Fetch_Password(int caption, int message, int btext=TXT_OK);
  824. #ifdef FIXIT_CSII // checked - ajw 9/28/98
  825. int Fetch_Difficulty(bool amath=false);
  826. #else
  827. int Fetch_Difficulty(void);
  828. #endif
  829. /*
  830. ** STARTUP.CPP
  831. */
  832. void Print_Error_End_Exit(char *string);
  833. void Emergency_Exit ( int code );
  834. /*
  835. ** SUPPORT.ASM
  836. */
  837. /*
  838. ** TARGET.CPP
  839. */
  840. TechnoTypeClass const * As_TechnoType(TARGET target);
  841. COORDINATE As_Movement_Coord(TARGET target);
  842. AircraftClass * As_Aircraft(TARGET target, bool check_active = true);
  843. AnimClass * As_Animation(TARGET target, bool check_active = true);
  844. BuildingClass * As_Building(TARGET target, bool check_active = true);
  845. BulletClass * As_Bullet(TARGET target, bool check_active = true);
  846. CELL As_Cell(TARGET target);
  847. COORDINATE As_Coord(TARGET target);
  848. InfantryClass * As_Infantry(TARGET target, bool check_active = true);
  849. TeamClass * As_Team(TARGET target, bool check_active = true);
  850. TeamTypeClass * As_TeamType(TARGET target);
  851. TechnoClass * As_Techno(TARGET target, bool check_active = true);
  852. TriggerClass * As_Trigger(TARGET target, bool check_active = true);
  853. TriggerTypeClass * As_TriggerType(TARGET target);
  854. UnitClass * As_Unit(TARGET target, bool check_active = true);
  855. VesselClass * As_Vessel(TARGET target, bool check_active = true);
  856. bool Target_Legal(TARGET target);
  857. ObjectClass * As_Object(TARGET target, bool check_active = true);
  858. /*
  859. ** TEAMTYPE.CPP
  860. */
  861. NeedType TeamMission_Needs(TeamMissionType tmtype);
  862. /*
  863. ** TRACKER.CPP
  864. */
  865. void Detach_This_From_All(TARGET target, bool all=true);
  866. /*
  867. ** TRIGGER.CPP
  868. */
  869. TriggerClass * Find_Or_Make(TriggerTypeClass * trigtype);
  870. /*
  871. ** ULOGIC.CPP
  872. */
  873. int Terrain_Cost(CELL cell, FacingType facing);
  874. /*
  875. ** VERSION.CPP
  876. */
  877. char const * Version_Name(void);
  878. /*
  879. ** WEAPON.CPP
  880. */
  881. WeaponType Weapon_From_Name(char const * name);
  882. ArmorType Armor_From_Name(char const * name);
  883. /*
  884. ** Winstub.cpp
  885. */
  886. void Load_Title_Screen(char *name, GraphicViewPortClass *video_page, unsigned char *palette);
  887. /*
  888. ** Egos.CPP
  889. */
  890. void Show_Who_Was_Responsible (void);
  891. //
  892. // We need to know when the visible page changes
  893. // ST - 1/4/2019 10:31AM
  894. //
  895. void Blit_Hid_Page_To_Seen_Buff(void);
  896. extern bool RunningAsDLL;
  897. extern bool RunningFromEditor;
  898. #include "inline.h"
  899. /*
  900. ** These declarations ensure that the templates will be expanded for these specified
  901. ** types. Doing this is required because some of the body functions for this template class
  902. ** are located in a .CPP module. Doing so results in faster compilation but requires declarations
  903. ** such as this for all types that will be required. There are no actual objects of with these
  904. ** names ever created, however there are other objects of this type (with different names) that
  905. ** are created.
  906. */
  907. extern CCPtr<AircraftClass> _wefwefy1; // Previus definition was function???
  908. extern CCPtr<AnimClass> y2;
  909. extern CCPtr<BuildingClass> y3;
  910. extern CCPtr<BulletClass> y4;
  911. extern CCPtr<FactoryClass> y5;
  912. extern CCPtr<HouseClass> y6;
  913. extern CCPtr<InfantryClass> y7;
  914. extern CCPtr<OverlayClass> y8;
  915. extern CCPtr<SmudgeClass> y9;
  916. extern CCPtr<TeamClass> y10;
  917. extern CCPtr<TeamTypeClass> y11;
  918. extern CCPtr<TemplateClass> y12;
  919. extern CCPtr<TerrainClass> y13;
  920. extern CCPtr<TriggerClass> y14;
  921. extern CCPtr<TriggerTypeClass> y15;
  922. extern CCPtr<HouseTypeClass> y16;
  923. extern CCPtr<BuildingTypeClass> y17;
  924. extern CCPtr<AircraftTypeClass> y18;
  925. extern CCPtr<InfantryTypeClass> y19;
  926. extern CCPtr<BulletTypeClass> y20;
  927. extern CCPtr<AnimTypeClass> y21;
  928. extern CCPtr<UnitTypeClass> y22;
  929. extern CCPtr<VesselTypeClass> y23;
  930. extern CCPtr<TemplateTypeClass> y24;
  931. extern CCPtr<TerrainTypeClass> y25;
  932. extern CCPtr<OverlayTypeClass> y26;
  933. extern CCPtr<SmudgeTypeClass> y27;
  934. template <> class DynamicVectorClass<CCPtr<TeamTypeClass> >;
  935. extern DynamicVectorClass<CCPtr<TeamTypeClass> > y002;
  936. template <>class DynamicVectorClass<CCPtr<TriggerTypeClass> >;
  937. extern DynamicVectorClass<CCPtr<TriggerTypeClass> > y001;
  938. template <>class DynamicVectorClass<TeamMissionClass *>;
  939. extern DynamicVectorClass<TeamMissionClass *> xxx1;
  940. template <>class DynamicVectorClass<EventChoiceClass *>;
  941. extern DynamicVectorClass<EventChoiceClass *> xxx2;
  942. template <>class DynamicVectorClass<ActionChoiceClass *>;
  943. extern DynamicVectorClass<ActionChoiceClass *> xxx3;
  944. template <>class DynamicVectorClass<EgoClass *>;
  945. extern DynamicVectorClass<EgoClass *> whatever;
  946. /*
  947. ** Debug output. ST - 6/27/2019 10:00PM
  948. */
  949. void GlyphX_Debug_Print(const char *debug_text);
  950. void Disable_Uncompressed_Shapes (void);
  951. void Enable_Uncompressed_Shapes (void);
  952. /*
  953. ** Achievement event. ST - 11/11/2019 11:39AM
  954. */
  955. void On_Achievement_Event(const HouseClass* player_ptr, const char *achievement_type, const char *achievement_reason);
  956. #endif