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