FUNCTION.H 31 KB

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