├── .gitignore ├── CMakeLists.txt ├── LICENSE.md ├── README.md ├── cmake └── modules │ ├── GitWatcher.cmake │ ├── GlobUtil.cmake │ └── ProjectFilters.cmake ├── edb ├── GAME.EDB └── README.md ├── pdb ├── GAME.pdb └── README.md └── src ├── abstract.h ├── abstracttype.h ├── addon.h ├── aircraft.h ├── aircrafttype.cpp ├── aircrafttype.h ├── aitrigger.h ├── aitrigtype.cpp ├── aitrigtype.h ├── alphashape.h ├── anim.h ├── animtype.cpp ├── animtype.h ├── audio ├── dsaudio.h ├── soscodec.h └── wwaud.h ├── base.h ├── base ├── always.h ├── endiantype.h ├── intrinsics.h └── macros.h ├── blit ├── blitblit.h ├── blitter.h ├── blitter_misc.h ├── bsurface.h ├── clipline.h ├── convert.cpp ├── convert.h ├── drawbuff.h ├── dsurface.cpp ├── dsurface.h ├── rleblitter.h ├── surface.h ├── xsurface.cpp ├── xsurface.h └── zbuffer.h ├── bounce.h ├── brain.h ├── building.h ├── buildinglight.h ├── buildingtype.cpp ├── buildingtype.h ├── buildnum.h ├── bullet.h ├── bullettype.cpp ├── bullettype.h ├── campaign.cpp ├── campaign.h ├── cargo.h ├── cc_cast.h ├── ccfile.h ├── ccini.cpp ├── ccini.h ├── cctooltip.h ├── cd.h ├── cell.cpp ├── cell.h ├── colorscheme.h ├── combat.h ├── command.cpp ├── command.h ├── coord.h ├── crate.h ├── credits.h ├── crew.h ├── crt └── newdel.h ├── display.h ├── door.h ├── drawshape.h ├── dropship.h ├── empulse.h ├── endgame.h ├── event.cpp ├── event.h ├── facing.h ├── factory.h ├── fatal.h ├── findmake.h ├── flasher.h ├── foggedobject.h ├── foot.h ├── fuse.h ├── graphicmenu.h ├── gscreen.h ├── house.h ├── housetype.cpp ├── housetype.h ├── infantry.h ├── infantrytype.cpp ├── infantrytype.h ├── interfaces ├── iaihouse.h ├── iapplication.h ├── iblockcipher.h ├── idescription.h ├── iflycontrol.h ├── igamemap.h ├── ihouse.h ├── ilinkstream.h ├── ilocomotion.h ├── ipiggyback.h ├── ipowerevents.h ├── ipublichouse.h ├── irttitypeinfo.h └── iswizzle.h ├── iomap.h ├── ionblast.h ├── ionstorm.h ├── isotile.h ├── isotiletype.cpp ├── isotiletype.h ├── language.h ├── laserdraw.h ├── layer.h ├── lib ├── abuffer.h ├── array.h ├── b64pipe.h ├── b64straw.h ├── base64.h ├── bfiofile.h ├── buff.h ├── buffpipe.h ├── buffstraw.h ├── cdctrl.h ├── cdfile.cpp ├── cdfile.h ├── connpoint.h ├── counter.h ├── crc32.cpp ├── crc32.h ├── crcpipe.h ├── crcstraw.h ├── critsection.cpp ├── critsection.h ├── cstraw.h ├── cstream.h ├── dict.h ├── fetchres.h ├── ffactory.cpp ├── ffactory.h ├── filepcx.h ├── filepipe.h ├── filestraw.h ├── fixed.cpp ├── fixed.h ├── ftimer.h ├── hsv.h ├── ini.cpp ├── ini.h ├── lcw.h ├── lcwpipe.h ├── lcwstraw.h ├── listnode.h ├── lzo.h ├── lzopipe.h ├── lzostraw.h ├── lzw.cpp ├── lzw.h ├── lzwpipe.cpp ├── lzwpipe.h ├── lzwstraw.cpp ├── lzwstraw.h ├── noinit.h ├── palette.h ├── pipe.h ├── pk.h ├── point.h ├── priorityqueue.h ├── ramfile.h ├── random.cpp ├── random.h ├── rawfile.h ├── readline.h ├── rect.h ├── rgb.cpp ├── rgb.h ├── rle.h ├── rndstraw.h ├── search.h ├── sha.h ├── shapipe.h ├── shastraw.h ├── smartptr.h ├── sprite.h ├── spritecollection.cpp ├── spritecollection.h ├── stimer.h ├── straw.h ├── strtrim.h ├── systimer.cpp ├── systimer.h ├── tclassfactory.h ├── textfile.cpp ├── textfile.h ├── tooltip.h ├── ttimer.h ├── typelist.h ├── vector.h ├── winfont.h ├── wstring.cpp ├── wstring.h ├── wwcrc.cpp ├── wwcrc.h ├── wwfile.cpp ├── wwfile.h ├── wwfont.h ├── wwkeyboard.h └── wwmouse.h ├── lightconvert.h ├── lightsource.h ├── loadoptions.h ├── locomotors ├── drivelocomotion.h ├── droppodlocomotion.h ├── flylocomotion.h ├── hoverlocomotion.h ├── jumpjetlocomotion.h ├── levitatelocomotion.h ├── locomotion.h ├── mechlocomotion.h ├── teleportlocomotion.h ├── tunnellocomotion.h └── walklocomotion.h ├── logic.h ├── map.cpp ├── map.h ├── math ├── fastmath.h ├── int.cpp ├── int.h ├── matrix3d.cpp ├── matrix3d.h ├── quat.h ├── vector2.h ├── vector3.h ├── vector4.h ├── wwmath.cpp ├── wwmath.h └── xmp.h ├── mission.h ├── mixfile.h ├── mono.h ├── mouse.h ├── movie.h ├── msengine.h ├── msgbox.h ├── msglist.h ├── multimiss.h ├── multiscore.h ├── net ├── combuf.h ├── connect.h ├── connmgr.h ├── field.h ├── ipx.h ├── ipxaddr.h ├── ipxconn.h ├── ipxgconn.h ├── ipxmgr.h ├── packet.h ├── wspipx.h ├── wsproto.h └── wspudp.h ├── newmenu.h ├── object.cpp ├── object.h ├── objecttype.h ├── options.h ├── overlay.h ├── overlaytype.cpp ├── overlaytype.h ├── ownrdraw.h ├── particle.h ├── particlesys.h ├── particlesystype.cpp ├── particlesystype.h ├── particletype.cpp ├── particletype.h ├── playmovie.h ├── power.h ├── preview.h ├── progressscreen.h ├── queue.h ├── radar.h ├── radarevent.h ├── radio.h ├── region.h ├── reinf.h ├── restate.h ├── rules.cpp ├── rules.h ├── saveload ├── saveload.h ├── savever.h └── swizzle.h ├── scenario.h ├── scenarioini.h ├── script.h ├── scripttype.cpp ├── scripttype.h ├── scroll.h ├── sendfile.h ├── session.h ├── shapeset.h ├── side.cpp ├── side.h ├── sidebar.h ├── smudge.h ├── smudgetype.cpp ├── smudgetype.h ├── special.h ├── spotlight.h ├── stage.h ├── storage.h ├── super.h ├── supertype.cpp ├── supertype.h ├── tab.h ├── tactical.h ├── taction.cpp ├── taction.h ├── tag.h ├── tagtype.cpp ├── tagtype.h ├── target.cpp ├── target.h ├── taskforce.cpp ├── taskforce.h ├── team.cpp ├── team.h ├── teamtype.cpp ├── teamtype.h ├── techno.h ├── technotype.cpp ├── technotype.h ├── terrain.h ├── terraintype.cpp ├── terraintype.h ├── tevent.cpp ├── tevent.h ├── textprint.cpp ├── textprint.h ├── theme.h ├── tiberium.cpp ├── tiberium.h ├── tibsun ├── tibsun_defines.h ├── tibsun_functions.cpp ├── tibsun_functions.h ├── tibsun_globals.h ├── tibsun_inline.h ├── tibsun_resource.h ├── tibsun_util.cpp └── tibsun_util.h ├── tracker.h ├── trigger.h ├── triggertype.cpp ├── triggertype.h ├── tspp ├── tspp.h ├── tspp_assert.cpp ├── tspp_assert.h ├── tspp_audio_intercept.cpp ├── tspp_audio_intercept.h ├── tspp_definitions.cpp ├── tspp_defs.asm ├── tspp_gitinfo.cpp.in └── tspp_gitinfo.h ├── tube.h ├── ui ├── checkbox.h ├── cheklist.h ├── colrlist.h ├── dial8.h ├── drop.h ├── edit.h ├── gadget.h ├── gauge.h ├── gcntrl.h ├── link.h ├── list.h ├── pcxbtn.cpp ├── pcxbtn.h ├── shapebtn.h ├── slider.h ├── statbtn.h ├── textbtn.h ├── toggle.h └── txtlabel.h ├── unit.h ├── unittype.cpp ├── unittype.h ├── utracker.h ├── veinholemonster.h ├── version.h ├── veterancy.h ├── voc.h ├── vox.h ├── voxel ├── motionlib.h ├── staticbuffer.h ├── voxel.hh ├── voxeldraw.h ├── voxelglobals.h ├── voxelinit.h ├── voxellib.h ├── voxelnormal.h ├── voxelobj.h └── voxelpal.h ├── voxelanim.h ├── voxelanimtype.cpp ├── voxelanimtype.h ├── vqa ├── ahandle.h └── vqa.h ├── warheadtype.cpp ├── warheadtype.h ├── wave.h ├── waypoint.h ├── waypointpath.h ├── weapontype.cpp ├── weapontype.h ├── windialog.h └── wolapi └── wolapi.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | # MSVC 35 | build/ 36 | build_*/ 37 | *.vs 38 | *.user 39 | *.spec 40 | *.ncb 41 | *.sdf 42 | *.suo 43 | *.sln 44 | *.vcxproj 45 | *.filters 46 | *.aps 47 | 48 | # CMake 49 | CMakeFiles/ 50 | CMakeCache.txt 51 | CMakeUserPresets.json 52 | *.dir 53 | 54 | # Windows 55 | thumbs.db 56 | desktop.ini 57 | 58 | # Misc 59 | *.tmp 60 | *.bak 61 | *.idb 62 | *.id0 63 | *.id1 64 | *.id2 65 | *.nam 66 | *.til 67 | *.json 68 | -------------------------------------------------------------------------------- /edb/GAME.EDB: -------------------------------------------------------------------------------- 1 | ;============================================================================== 2 | ; Tiberian Sun Exception Database. 3 | ;============================================================================== 4 | ; 5 | ; This file contains all the know exceptions and their cause. Each line must 6 | ; be in the format of; 7 | ; 8 | ; "Address,CanContinue,Ignore,Description". 9 | ; 10 | ; NOTE: This file must end with a blank line! 11 | ; 12 | ; Address = The EIP of the exception. 13 | ; CanContinue = Can the game continue after this exception (1 = true, 0 = false)? 14 | ; Ignore = Should the game silently continue after this exception (1 = true, 0 = false)? 15 | ; Description = Description of the exception, max 1024 characters. 16 | ; 17 | 0x004C1678,0,0,The AI attempted to produce a Harvester but HarvesterUnit= has an invalid or non-existant UnitType defined. 18 | 0x004BAF10,0,0,The AI attempted to produce a Harvester but HarvesterUnit= has an invalid or non-existant UnitType defined. 19 | 0x004D2BC6,0,0,An InfantryType is missing Sequence= from its ART.INI image section. 20 | -------------------------------------------------------------------------------- /edb/README.md: -------------------------------------------------------------------------------- 1 | Contains the plain text database for known common exception addresses and a helpful description. -------------------------------------------------------------------------------- /pdb/GAME.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vinifera-Developers/TSpp/6fb02f4175c687160a4876bf8ead8844cee9d7e0/pdb/GAME.pdb -------------------------------------------------------------------------------- /pdb/README.md: -------------------------------------------------------------------------------- 1 | This PDB file is generated by using; 2 | https://github.com/Mixaill/FakePDB 3 | -------------------------------------------------------------------------------- /src/addon.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file ADDON.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Expansion pack / addon utility functions. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "tibsun_defines.h" 32 | 33 | extern int &InstalledMode; 34 | extern int &EnabledMode; 35 | 36 | bool Detect_Addons(); 37 | bool Is_Addon_Available(AddonType addon); 38 | bool Is_Addon_Enabled(AddonType addon); 39 | void Enable_Addon(AddonType addon); 40 | void Disable_Addon(AddonType addon); 41 | bool Is_Required_Addon(AddonType addon); 42 | AddonType Get_Required_Addon(); 43 | void Set_Required_Addon(AddonType addon); 44 | -------------------------------------------------------------------------------- /src/aitrigger.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file AITRIGGER.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief AI trigger object class. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "object.h" 31 | 32 | 33 | class DECLSPEC_UUID("03C4CE76-4CF5-11D2-BC26-00104B8FB04D") 34 | AITriggerClass : public AbstractClass 35 | { 36 | public: 37 | /** 38 | * IPersist 39 | */ 40 | IFACEMETHOD(GetClassID)(CLSID *pClassID); 41 | 42 | /** 43 | * IPersistStream 44 | */ 45 | IFACEMETHOD(Load)(IStream *pStm); 46 | IFACEMETHOD(Save)(IStream *pStm, BOOL fClearDirty); 47 | 48 | public: 49 | AITriggerClass(); 50 | AITriggerClass(NoInitClass &noinit); 51 | virtual ~AITriggerClass(); 52 | }; 53 | -------------------------------------------------------------------------------- /src/audio/wwaud.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file WWAUD.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Westwoo AUD format header. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | #define AUD_CHUNK_MAGIC_ID 0xDEAF 34 | 35 | #define AUD_FLAG_STEREO 1 36 | #define AUD_FLAG_16BIT 2 37 | 38 | #pragma pack(push, 1) 39 | typedef struct AUDHeaderType 40 | { 41 | unsigned short Rate; // Playback rate (hertz). 42 | int Size; // Size of data (bytes). 43 | int UncompSize; // Size of data (bytes). 44 | unsigned char Flags; // Holds flags for info 45 | // 1: Is the sample stereo? 46 | // 2: Is the sample 16 bits? 47 | unsigned char Compression; // What kind of compression for this sample? 48 | } AUDHeaderType; 49 | #pragma pack(pop) 50 | -------------------------------------------------------------------------------- /src/base/intrinsics.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file INTRINSICS.H 8 | * 9 | * @authors OmniBlade 10 | * 11 | * @brief Centralises intrinsic includes and implements standard C 12 | * fallbacks or inline asm when needed. 13 | * 14 | * @license TS++ is free software: you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation, either version 17 | * 3 of the License, or (at your option) any later version. 18 | * 19 | * TS++ is distributed in the hope that it will be 20 | * useful, but WITHOUT ANY WARRANTY; without even the implied 21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 22 | * PURPOSE. See the GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public 25 | * License along with this program. 26 | * If not, see . 27 | * 28 | ******************************************************************************/ 29 | #pragma once 30 | 31 | #include "macros.h" 32 | #include 33 | #include 34 | 35 | // CPUID instructions. 36 | //#define __cpuidex(regs, cpuid_type, count) __cpuid_count(cpuid_type, count, regs[0], regs[1], regs[2], regs[3]) 37 | 38 | // GCC and MSVC use the same name but have different signatures so we use a new common name. 39 | #define __cpuidc __cpuid 40 | 41 | // Rotate instructions 42 | #define __rotl8 _rotl8 43 | #define __rotl16 _rotl16 44 | #define __rotr8 _rotr8 45 | #define __rotr16 _rotr16 46 | #define __rotl32 _rotl 47 | #define __rotr32 _rotr 48 | #define __rotl64 _rotr64 49 | #define __rotr64 _rotr64 50 | -------------------------------------------------------------------------------- /src/blit/blitter.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file BLITTER.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Base class for the templated blitters. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class Blitter 34 | { 35 | public: 36 | Blitter() {} 37 | virtual ~Blitter() {} 38 | 39 | virtual void entry_4(void *dest, void *source, unsigned length, unsigned short z_min = 0x8000, int *z_buff = nullptr, int* alpha_buff = nullptr, int alpha_level = 1000, int warp_offset = 0) = 0; 40 | virtual void entry_8(void *dest, void *source, unsigned length, unsigned short z_min = 0x8000, int *z_buff = nullptr, int *alpha_buff = nullptr, int alpha_level = 1000) = 0; 41 | }; 42 | -------------------------------------------------------------------------------- /src/blit/blitter_misc.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- P R O J E C T T S Y R ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file BLITTER_MISC.H 8 | * 9 | * @author tomsons26 10 | * 11 | * @contributors CHyper 12 | * 13 | * @brief Miscellaneous utility blit functions. 14 | * 15 | * @license TS++ is free software: you can redistribute it and/or 16 | * modify it under the terms of the GNU General Public License 17 | * as published by the Free Software Foundation, either version 18 | * 3 of the License, or (at your option) any later version. 19 | * 20 | * TS++ is distributed in the hope that it will be 21 | * useful, but WITHOUT ANY WARRANTY; without even the implied 22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 23 | * PURPOSE. See the GNU General Public License for more details. 24 | * 25 | * You should have received a copy of the GNU General Public 26 | * License along with this program. 27 | * If not, see . 28 | * 29 | ******************************************************************************/ 30 | #pragma once 31 | 32 | #include "always.h" 33 | 34 | 35 | void __cdecl Brighten_555(unsigned char *add_buffer, unsigned short *buffer, int addbuff_width, int buff_width, int width, int height); 36 | void __cdecl Brighten_556(unsigned char *add_buffer, unsigned short *buffer, int addbuff_width, int buff_width, int width, int height); 37 | void __cdecl Brighten_565(unsigned char *add_buffer, unsigned short *buffer, int addbuff_width, int buff_width, int width, int height); 38 | void __cdecl Brighten_655(unsigned char *add_buffer, unsigned short *buffer, int addbuff_width, int buff_width, int width, int height); 39 | -------------------------------------------------------------------------------- /src/blit/bsurface.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file BSURFACE.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Buffered data surface class. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "xsurface.h" 31 | #include "buff.h" 32 | 33 | 34 | class BSurface : public XSurface 35 | { 36 | public: 37 | BSurface(); 38 | BSurface(int width, int height, int bpp, void *buffer = nullptr); 39 | virtual ~BSurface(); 40 | 41 | virtual void *Lock(int x = 0, int y = 0) override; 42 | virtual int Get_Bytes_Per_Pixel() const override; 43 | virtual int Get_Pitch() const override; 44 | 45 | void *Get_Buffer_Ptr() const { return BufferPtr.Get_Buffer(); } 46 | void *Get_Buffer_Ptr(int x, int y) { return (unsigned char *)BufferPtr.Get_Buffer() + (x * Get_Bytes_Per_Pixel()) + (y * Get_Pitch()); } 47 | 48 | public: 49 | Buffer BufferPtr; 50 | }; 51 | -------------------------------------------------------------------------------- /src/blit/clipline.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file CLIPLINE.H 8 | * 9 | * @authors tomsons26 10 | * 11 | * @brief Cohen-Sutherland line clipping algorithm. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "rect.h" 32 | 33 | 34 | bool Clip_Line(Point2D &point1, Point2D &point2, const Rect &rect); 35 | -------------------------------------------------------------------------------- /src/blit/rleblitter.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file RLEBLITTER.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief RLE Blitter base class. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class RLEBlitter 34 | { 35 | public: 36 | RLEBlitter() {} 37 | virtual ~RLEBlitter() {} 38 | 39 | virtual void entry_4(void *dest, void *source, unsigned length, unsigned rle_length, int a5, int a6, int a7, int a8, int a9, int a10) = 0; 40 | }; 41 | -------------------------------------------------------------------------------- /src/cargo.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file CARGO.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Class that handles the basic cargo logic. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "noinit.h" 32 | 33 | 34 | class FootClass; 35 | 36 | 37 | class CargoClass 38 | { 39 | public: 40 | CargoClass(); 41 | CargoClass(const NoInitClass &noinit); 42 | ~CargoClass(); 43 | 44 | void AI(); 45 | 46 | void Attach(FootClass *object); 47 | FootClass *Attached_Object() const; 48 | FootClass *Detach_Object(); 49 | void Detach(FootClass *object); 50 | 51 | unsigned How_Many() const { return Quantity; } 52 | bool Is_Something_Attached() const { return CargoHold != nullptr; } 53 | 54 | public: 55 | unsigned Quantity; 56 | FootClass *CargoHold; 57 | }; 58 | -------------------------------------------------------------------------------- /src/cc_cast.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file CC_CAST.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Runtime casting within the C&C Engine. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "tibsun_defines.h" 32 | 33 | 34 | /** 35 | * Perform a runtime C&C engine cast. 36 | * 37 | * @author: CCHyper 38 | */ 39 | template TDerived * CC_Dynamic_Cast(AbstractClass * abstract) 40 | { 41 | /** 42 | * Check if the desired class is really derived from AbstractClass 43 | */ 44 | if (!std::is_base_of()) { 45 | return nullptr; 46 | } 47 | 48 | /** 49 | * Base class sanity check. 50 | */ 51 | if (abstract == nullptr) { 52 | return nullptr; 53 | } 54 | 55 | /** 56 | * Invalid RTTI type, return null. 57 | */ 58 | if (abstract->Fetch_RTTI() == RTTI_NONE || !(abstract->Fetch_RTTI() < RTTI_COUNT)) { 59 | return nullptr; 60 | } 61 | 62 | /** 63 | * Passed validity checks, cast to the derived class. 64 | */ 65 | return reinterpret_cast(abstract); 66 | } 67 | -------------------------------------------------------------------------------- /src/cctooltip.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file CCTOOLTIP.H 8 | * 9 | * @authors CCHyper, tomsons26 10 | * 11 | * @brief Game tooltip handler. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "tooltip.h" 32 | #include "textprint.h" 33 | 34 | 35 | class CCToolTip : public ToolTipManager 36 | { 37 | public: 38 | CCToolTip(HWND hWnd); 39 | virtual ~CCToolTip(); 40 | 41 | virtual bool Update(const ToolTipText *text); 42 | virtual void Reset(const ToolTipText *text); 43 | virtual void Force_Redraw(bool sidebar = false); 44 | virtual void Draw(const ToolTipText *text); 45 | virtual const char *ToolTip_Text(int id); 46 | 47 | protected: 48 | bool DrawOnSidebar; 49 | TextPrintType Style; 50 | }; 51 | -------------------------------------------------------------------------------- /src/cd.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file CD.H 8 | * 9 | * @author CCHyper 10 | * 11 | * @brief CD access interface. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "tibsun_defines.h" 32 | 33 | 34 | class CD 35 | { 36 | public: 37 | CD(); 38 | 39 | virtual bool Is_Available(DiskID disk); 40 | virtual bool Insert_Disk(DiskID disk); 41 | virtual bool Init_Swap(DiskID disk); 42 | 43 | bool Force_Available(DiskID disk); 44 | 45 | static DiskID Get_Volume_Index(); 46 | static void Set_Required_CD(DiskID disk); 47 | 48 | static DiskID Get_CD_Index(int cd_drive, int timeout); 49 | 50 | public: 51 | static bool &IsFilesLocal; 52 | static DiskID& RequiredCD; 53 | 54 | public: 55 | ThemeType ThemePlaying; 56 | }; 57 | -------------------------------------------------------------------------------- /src/combat.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file COMBAT.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief General damage and combat routines. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "tibsun_defines.h" 31 | 32 | 33 | class TechnoClass; 34 | class WarheadTypeClass; 35 | class AnimTypeClass; 36 | 37 | 38 | int Modify_Damage(int damage, const WarheadTypeClass * warhead, ArmorType armor, int distance); 39 | void Chain_Reaction_Damage(const Cell &cell); 40 | void Explosion_Damage(const Coordinate &coord, int strength, TechnoClass * source, const WarheadTypeClass * warhead, bool do_chain_reaction = true); 41 | const AnimTypeClass * Combat_Anim(int damage, const WarheadTypeClass * warhead, LandType land, const Coordinate *coord); 42 | void Combat_Lighting(Coordinate coord, int damage, WarheadTypeClass const * warhead, bool a4 = false); 43 | void Wide_Area_Damage(const Coordinate &coord, LEPTON radius, int rawdamage, TechnoClass * source, const WarheadTypeClass * warhead); 44 | int Get_Explosion_Z(Coordinate coord); 45 | -------------------------------------------------------------------------------- /src/coord.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file COORD.H 8 | * 9 | * @authors tomsons26 10 | * 11 | * @brief Coord utility functions. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "tibsun_defines.h" 32 | 33 | 34 | Coordinate Coord_Move(const Coordinate& start, DirType &facing, unsigned distance); 35 | Coordinate Coord_Scatter(const Coordinate& coord, unsigned distance, bool lock = false); 36 | Coordinate Adjacent_Coord_With_Height(const Coordinate& coord, FacingType facing); 37 | 38 | inline Cell Cell_Move(Cell const& start, DirType const& dir, short distance) 39 | { 40 | double radians = dir.Get_Radian(); 41 | return Cell((start.X + cos(radians) * distance), (start.Y - sin(radians) * distance)); 42 | } 43 | -------------------------------------------------------------------------------- /src/crate.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file CRATE.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Instance of a goodie crate on the map. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include 31 | #include "ttimer.h" 32 | #include "ftimer.h" 33 | #include "tibsun_defines.h" 34 | 35 | 36 | class CrateClass 37 | { 38 | public: 39 | CrateClass(); 40 | ~CrateClass(); 41 | 42 | void Init(); 43 | bool Create_Crate(Cell &cell); 44 | bool Is_Here(Cell &cell) const; 45 | bool Remove_It(); 46 | 47 | bool Is_Expired() const; 48 | bool Is_Valid() const; 49 | void Make_Invalid(); 50 | 51 | static bool Put_Crate(Cell &cell); 52 | static bool Get_Crate(Cell &cell); 53 | 54 | private: 55 | CDTimerClass Timer; 56 | Cell Location; 57 | }; 58 | -------------------------------------------------------------------------------- /src/credits.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file CREDITS.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief The animating credit counter display. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class NoInitClass; 34 | 35 | 36 | class CreditClass 37 | { 38 | public: 39 | CreditClass(); 40 | CreditClass(const NoInitClass &x); 41 | ~CreditClass(); 42 | 43 | void Update(bool forced = false, bool redraw = false); 44 | void Graphic_Logic(bool forced = false); 45 | void AI(bool forced = false); 46 | 47 | public: 48 | long Credits; 49 | long Current; 50 | bool IsToRedraw; 51 | bool IsUp; 52 | bool IsAudible; 53 | int Countdown; 54 | }; 55 | -------------------------------------------------------------------------------- /src/crew.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file CREW.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Unit crew and kill tracker. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class NoInitClass; 34 | 35 | 36 | class CrewClass 37 | { 38 | public: 39 | CrewClass() {} 40 | CrewClass(const NoInitClass &noinit) {} 41 | ~CrewClass() {} 42 | 43 | int Made_A_Kill() 44 | { 45 | Kills++; 46 | return Kills; 47 | }; 48 | 49 | public: 50 | unsigned short Kills; 51 | }; 52 | -------------------------------------------------------------------------------- /src/crt/newdel.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file NEWDEL.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief The new and delete operators. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | 31 | #include "always.h" 32 | #include 33 | 34 | 35 | void *__cdecl operator_new(unsigned int size); 36 | void __cdecl operator_delete(void *ptr); 37 | -------------------------------------------------------------------------------- /src/endgame.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file ENDGAME.H 8 | * 9 | * @author CCHyper 10 | * 11 | * @brief Carryover values to the next mission. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "tibsun_defines.h" 32 | 33 | 34 | struct IStream; 35 | 36 | 37 | class EndGameClass 38 | { 39 | public: 40 | EndGameClass(); 41 | ~EndGameClass(); 42 | 43 | void Record(); 44 | void Apply(); 45 | 46 | void Load(IStream *pStm); 47 | void Save(IStream *pStm); 48 | 49 | public: 50 | bool Globals[50]; 51 | int Credits; 52 | int MissionTimer; 53 | int Difficulty; 54 | unsigned short Stage; 55 | }; 56 | -------------------------------------------------------------------------------- /src/event.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file EVENT.CPP 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Event class is used to contain all game events that are 12 | * transferred between computers in multiplayer games. 13 | * 14 | * @license TS++ is free software: you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation, either version 17 | * 3 of the License, or (at your option) any later version. 18 | * 19 | * TS++ is distributed in the hope that it will be 20 | * useful, but WITHOUT ANY WARRANTY; without even the implied 21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 22 | * PURPOSE. See the GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public 25 | * License along with this program. 26 | * If not, see . 27 | * 28 | ******************************************************************************/ 29 | #include "event.h" 30 | #include "tibsun_globals.h" 31 | #include "tibsun_defines.h" 32 | 33 | 34 | const char *EventClass::Event_Name(EventType event) 35 | { 36 | TSPP_ASSERT(event < EVENT_COUNT); 37 | 38 | return EventNames[event]; 39 | } 40 | 41 | 42 | unsigned char EventClass::Event_Length(EventType event) 43 | { 44 | TSPP_ASSERT(event < EVENT_COUNT); 45 | 46 | return EventLength[event]; 47 | } 48 | -------------------------------------------------------------------------------- /src/fatal.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file FATAL.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Functions for fatal errors. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | void Fatal(const char *why, ...); 34 | void Emergency_Exit(int code); 35 | -------------------------------------------------------------------------------- /src/flasher.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file FLASHER.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Unit target flash handler. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class NoInitClass; 34 | 35 | 36 | class FlasherClass 37 | { 38 | public: 39 | FlasherClass() : FlashCount(0), IsBlushing(false) {} 40 | FlasherClass(const NoInitClass &noinit) {} 41 | ~FlasherClass() {} 42 | 43 | bool Process() 44 | { 45 | if (FlashCount) { 46 | FlashCount--; 47 | IsBlushing = false; 48 | 49 | if (FlashCount & 0x01) { 50 | IsBlushing = true; 51 | } 52 | return true; 53 | } 54 | return false; 55 | } 56 | 57 | public: 58 | unsigned FlashCount; 59 | bool IsBlushing; 60 | }; 61 | -------------------------------------------------------------------------------- /src/fuse.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file FUSE.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief The fuse is used by projectiles. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "ttimer.h" 32 | #include "ftimer.h" 33 | #include "tibsun_defines.h" 34 | 35 | 36 | class NoInitClass; 37 | class FileClass; 38 | 39 | 40 | enum FuseResultType 41 | { 42 | FUSE_DONT_IGNITE, 43 | FUSE_IGNITE, 44 | FUSE_2, 45 | }; 46 | 47 | 48 | class FuseClass { 49 | public: 50 | FuseClass(); 51 | FuseClass(const NoInitClass &noinit); 52 | ~FuseClass(); 53 | 54 | void Arm_Fuse(Coordinate &location, Coordinate &target, int time = 255, int arming = 0); 55 | FuseResultType Fuse_Checkup(Coordinate &newlocation); 56 | 57 | Coordinate Fuse_Target() 58 | { 59 | return HeadTo; 60 | } 61 | 62 | public: 63 | CDTimerClass Timer; 64 | 65 | private: 66 | CDTimerClass Arming; 67 | Coordinate HeadTo; 68 | int Proximity; 69 | }; 70 | 71 | -------------------------------------------------------------------------------- /src/graphicmenu.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file GRAPHICMENU.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Graphic menu instance class. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "msengine.h" 32 | #include "vector.h" 33 | 34 | 35 | class GraphicMenuItem; 36 | 37 | 38 | class GraphicMenu 39 | { 40 | public: 41 | GraphicMenu(); 42 | virtual ~GraphicMenu(); 43 | 44 | public: 45 | MSEngine Engine; 46 | char *Background; 47 | char *Theme; 48 | int field_54; 49 | DynamicVectorClass Items; 50 | }; 51 | -------------------------------------------------------------------------------- /src/interfaces/iaihouse.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file IAIHOUSE.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief IAIHouse interface. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "ihouse.h" 32 | #include 33 | #include 34 | 35 | 36 | /******************************************************************************* 37 | * @class IAIHouse 38 | * 39 | * @brief AI for House. 40 | */ 41 | DECLARE_INTERFACE_IID_(IAIHouse, IUnknown, "96F02EC4-6FE8-11D1-B6FD-00A024DDAFD1") 42 | { 43 | /** 44 | * Links house to an advisor object. 45 | */ 46 | STDMETHOD_(LONG, Link_House)(IHouse *house) PURE; 47 | 48 | /** 49 | * AI processing entry function. 50 | */ 51 | STDMETHOD_(LONG, AI)(long *framedelay) PURE; 52 | }; 53 | 54 | /** 55 | * IAIHouse com smart pointer declaration. 56 | */ 57 | _COM_SMARTPTR_TYPEDEF(IAIHouse, __uuidof(IAIHouse)); 58 | -------------------------------------------------------------------------------- /src/interfaces/idescription.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file IDESCRIPTION.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief IDescription interface. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include 32 | 33 | 34 | /******************************************************************************* 35 | * @class IDescription 36 | * 37 | * @brief Textual description of house AI. 38 | */ 39 | DECLARE_INTERFACE_IID_(IDescription, IUnknown, "3C13CFA0-8886-11D1-B707-00A024DDAFD1") 40 | { 41 | /** 42 | * Name of AI. 43 | */ 44 | STDMETHOD_(BSTR, Short_Name)() PURE; 45 | 46 | /** 47 | * Description of AI. 48 | */ 49 | STDMETHOD_(BSTR, Description)() PURE; 50 | }; 51 | -------------------------------------------------------------------------------- /src/interfaces/iflycontrol.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file IFLYCONTROL.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief IFlyControl interface. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include 32 | 33 | 34 | /******************************************************************************* 35 | * @class IFlyControl 36 | * 37 | * @brief Flyer feedback to flying locomotor. 38 | */ 39 | DECLARE_INTERFACE_IID_(IFlyControl, IUnknown, "820F501C-4F39-11D2-9B70-00104B972FE8") 40 | { 41 | /** 42 | * Landing altitude. 43 | */ 44 | STDMETHOD_(LONG, Landing_Altitude)() PURE; 45 | 46 | /** 47 | * Landing direction. 48 | */ 49 | STDMETHOD_(LONG, Landing_Direction)() PURE; 50 | 51 | /** 52 | * Loaded with cargo? 53 | */ 54 | STDMETHOD_(BOOL, Is_Loaded)() PURE; 55 | 56 | /** 57 | * Does it strafe over the target rather than hover? 58 | */ 59 | STDMETHOD_(LONG, Is_Strafe)() PURE; 60 | 61 | /** 62 | * Is the aircraft locked into straight flight? 63 | */ 64 | STDMETHOD_(LONG, Is_Locked)() PURE; 65 | }; 66 | -------------------------------------------------------------------------------- /src/interfaces/igamemap.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file IGAMEMAP.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief IGameMap interface. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "tibsun_defines.h" 32 | #include 33 | 34 | 35 | /******************************************************************************* 36 | * @class IGameMap 37 | * 38 | * @brief Map interface. 39 | */ 40 | DECLARE_INTERFACE_IID_(IGameMap, IUnknown, "96F02EC7-6FE8-11D1-B6FD-00A024DDAFD1") 41 | { 42 | /** 43 | * Is location visible? 44 | */ 45 | STDMETHOD_(BOOL, Is_Visible)(Cell cell) PURE; 46 | }; 47 | -------------------------------------------------------------------------------- /src/interfaces/ilinkstream.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file ILINKSTREAM.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief ILinkStream interface. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include 32 | 33 | 34 | /******************************************************************************* 35 | * @class ILinkStream 36 | * 37 | * @brief Link one stream to another. 38 | */ 39 | DECLARE_INTERFACE_IID_(ILinkStream, IUnknown, "0D5CD78E-6470-11D2-9B74-00104B972FE8") 40 | { 41 | /** 42 | * Link base stream. 43 | */ 44 | STDMETHOD(Link_Stream(IUnknown *stream)) PURE; 45 | 46 | /** 47 | * Unlink stream. 48 | */ 49 | STDMETHOD(Unlink_Stream(IUnknown **stream)) PURE; 50 | }; 51 | -------------------------------------------------------------------------------- /src/interfaces/ipowerevents.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file IPOWEREVENTS.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief IPowerEvents interface. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include 32 | 33 | 34 | /******************************************************************************* 35 | * @class IPowerEvents 36 | * 37 | * @brief Power event callback interface. 38 | */ 39 | DECLARE_INTERFACE_IID_(IPowerEvents, IUnknown, "56272740-89BB-11D1-B707-00A024DDAFD1") 40 | { 41 | /** 42 | * Triggered when power first becomes sufficient. 43 | */ 44 | STDMETHOD_(LONG, Power_Activated)() PURE; 45 | 46 | /** 47 | * Triggered when power first becomes insufficient. 48 | */ 49 | STDMETHOD_(LONG, Power_Lost)() PURE; 50 | }; 51 | -------------------------------------------------------------------------------- /src/interfaces/irttitypeinfo.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file IRTTITYPEINFO.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief IRTTITypeInfo interface. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include 32 | 33 | 34 | /******************************************************************************* 35 | * @class IRTTITypeInfo 36 | * 37 | * @brief RTTI Type Info Interface. 38 | */ 39 | DECLARE_INTERFACE_IID_(IRTTITypeInfo, IUnknown, "170DAC82-12E4-11D2-8175-006008055BB5") 40 | { 41 | /** 42 | * Fetch the RTTI type ID number. 43 | */ 44 | STDMETHOD_(int, What_Am_I)() const PURE; 45 | 46 | /** 47 | * Fetch unique ID number for this RTTI typed object. 48 | */ 49 | STDMETHOD_(int, Fetch_ID)() const PURE; 50 | 51 | /** 52 | * Create unique ID number for this RTTI typed object. 53 | */ 54 | STDMETHOD_(VOID, Create_ID)() PURE; 55 | }; 56 | -------------------------------------------------------------------------------- /src/iomap.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file IOMAP.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Provides access to the map IO interface. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "tibsun_globals.h" 31 | #include "mouse.h" 32 | 33 | 34 | /** 35 | * This is a simple utility header to provide access to the "Map" global 36 | * and include any headers required to access it and its classes. 37 | */ 38 | -------------------------------------------------------------------------------- /src/ionblast.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file IONBLAST.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Ion cannon blast handler. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "tibsun_defines.h" 31 | 32 | 33 | class IonBlastClass 34 | { 35 | public: 36 | IonBlastClass(Coordinate coord); 37 | ~IonBlastClass(); 38 | 39 | void AI(); 40 | void Draw_It(); 41 | 42 | static void Update_All(); 43 | static void Draw_All(); 44 | static void One_Time(); 45 | static void Clear_All(); 46 | 47 | public: 48 | Coordinate Coord; 49 | int field_0C; // ripple related? or lifetime? 50 | bool field_10; // disable beam anim? 51 | }; 52 | -------------------------------------------------------------------------------- /src/ionstorm.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file IONSTORM.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Ion storm functions. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "tibsun_defines.h" 31 | 32 | 33 | struct IStream; 34 | 35 | 36 | void IonStorm_Set_Active(bool active); 37 | bool IonStorm_Is_Active(); 38 | void IonStorm_Start(int duration, int warning = 0); 39 | void IonStorm_Stop(); 40 | void IonStorm_AI(); 41 | void IonStorm_Lightning_Strike_At(Cell where); 42 | void IonStorm_Do_Screen_Static(); 43 | void IonStorm_Init(bool start = false); 44 | void IonStorm_Init_Clear(); 45 | HRESULT IonStorm_Save(IStream *pStm); 46 | HRESULT IonStorm_Load(IStream *pStm); 47 | 48 | extern bool &IonStorm_IsActive; 49 | // 007F50E8 countdown? 50 | extern int &IonStorm_StaticLoopCounter; 51 | extern int &IonStorm_StartFrame; 52 | extern int &IonStorm_Duration; 53 | extern ThemeType &IonStorm_RestoreTheme; 54 | -------------------------------------------------------------------------------- /src/language.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vinifera-Developers/TSpp/6fb02f4175c687160a4876bf8ead8844cee9d7e0/src/language.h -------------------------------------------------------------------------------- /src/layer.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file LAYER.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Layer object tracker. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "vector.h" 31 | #include "tibsun_defines.h" 32 | #include 33 | 34 | 35 | class Straw; 36 | class Pipe; 37 | class ObjectClass; 38 | 39 | 40 | class LayerClass : public DynamicVectorClass 41 | { 42 | using VectorClass::Vector; 43 | using VectorClass::VectorMax; 44 | using VectorClass::IsAllocated; 45 | 46 | public: 47 | LayerClass(); 48 | virtual ~LayerClass(); 49 | 50 | virtual bool Submit(ObjectClass const *object, bool sort = false); 51 | virtual void Init(); 52 | virtual void One_Time(); 53 | 54 | void Sort(); 55 | bool Sorted_Add(ObjectClass const *object); 56 | void Remove(ObjectClass *object); 57 | 58 | HRESULT Save(IStream *pStm); 59 | HRESULT Load(IStream *pStm); 60 | }; 61 | -------------------------------------------------------------------------------- /src/lib/array.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file ARRAY.H 8 | * 9 | * @authors OmniBlade 10 | * 11 | * @brief Simple array container. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | 31 | template 32 | class Array 33 | { 34 | public: 35 | inline Array() {} 36 | 37 | inline Array(T val) 38 | { 39 | for (int i = 0; i < N; ++i) 40 | Data[i] = val; 41 | } 42 | 43 | inline const int Size() const 44 | { 45 | return N; 46 | } 47 | 48 | inline T& operator [](int idx) 49 | { 50 | return Data[idx]; 51 | } 52 | 53 | inline T operator [](int idx) const 54 | { 55 | return Data[idx]; 56 | } 57 | 58 | private: 59 | T Data[N]; 60 | }; 61 | -------------------------------------------------------------------------------- /src/lib/base64.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file BASE64.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Base64 implementation. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | int Base64_Encode(const void * source, int slen, void * dest, int dlen); 33 | int Base64_Decode(const void * source, int slen, void * dest, int dlen); 34 | -------------------------------------------------------------------------------- /src/lib/buff.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file BUFF.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief A general purpose buffer object. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class Buffer 34 | { 35 | public: 36 | Buffer(char *ptr, long size = 0); 37 | Buffer(void *ptr = nullptr, long size = 0); 38 | Buffer(const void * ptr, long size = 0); 39 | Buffer(long size); 40 | Buffer(const Buffer & buffer); 41 | ~Buffer(); 42 | 43 | Buffer & operator = (const Buffer & buffer); 44 | 45 | operator void * () const { return BufferPtr; } 46 | operator char * () const { return (char *)BufferPtr; } 47 | 48 | void Reset(); 49 | void * Get_Buffer() const { return BufferPtr; } 50 | long Get_Size() const { return Size; } 51 | bool Is_Valid() const { return BufferPtr != nullptr; } 52 | 53 | protected: 54 | void * BufferPtr; 55 | long Size; 56 | bool IsAllocated; 57 | }; 58 | -------------------------------------------------------------------------------- /src/lib/crc32.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file CRC32.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Standard CRC32 routines. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | uint32_t CRC32_Memory(const void *data, uint32_t bytes, uint32_t prev_crc = 0); 34 | uint32_t CRC32_String(const char *string, uint32_t prev_crc = 0); 35 | -------------------------------------------------------------------------------- /src/lib/crcpipe.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file CRCPIPE.H 8 | * 9 | * @author Joe L. Bostic (see notes below) 10 | * 11 | * @contributors CCHyper 12 | * 13 | * @brief CRC based data stream pipe using the Westwood CRC engine. 14 | * 15 | * @license TS++ is free software: you can redistribute it and/or 16 | * modify it under the terms of the GNU General Public License 17 | * as published by the Free Software Foundation, either version 18 | * 3 of the License, or (at your option) any later version. 19 | * 20 | * TS++ is distributed in the hope that it will be 21 | * useful, but WITHOUT ANY WARRANTY; without even the implied 22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 23 | * PURPOSE. See the GNU General Public License for more details. 24 | * 25 | * You should have received a copy of the GNU General Public 26 | * License along with this program. 27 | * If not, see . 28 | * 29 | * @note This file contains heavily modified code from the source code 30 | * released by Electronic Arts for the C&C Remastered Collection 31 | * under the GPL3 license. Source: 32 | * https://github.com/ElectronicArts/CnC_Remastered_Collection 33 | * 34 | ******************************************************************************/ 35 | #pragma once 36 | 37 | #include "pipe.h" 38 | #include "wwcrc.h" 39 | 40 | 41 | class CRCPipe : public Pipe 42 | { 43 | public: 44 | CRCPipe() {} 45 | ~CRCPipe() {} 46 | 47 | virtual int Put(const void *source, int slen); 48 | 49 | long Result() const; 50 | 51 | protected: 52 | CRCEngine CRC; 53 | 54 | private: 55 | CRCPipe(CRCPipe &) = delete; 56 | CRCPipe & operator = (const CRCPipe &) = delete; 57 | }; 58 | -------------------------------------------------------------------------------- /src/lib/crcstraw.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file CRCSTRAW.H 8 | * 9 | * @author Joe L. Bostic (see notes below) 10 | * 11 | * @contributors CCHyper 12 | * 13 | * @brief CRC based data stream straw using the Westwood CRC engine. 14 | * 15 | * @license TS++ is free software: you can redistribute it and/or 16 | * modify it under the terms of the GNU General Public License 17 | * as published by the Free Software Foundation, either version 18 | * 3 of the License, or (at your option) any later version. 19 | * 20 | * TS++ is distributed in the hope that it will be 21 | * useful, but WITHOUT ANY WARRANTY; without even the implied 22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 23 | * PURPOSE. See the GNU General Public License for more details. 24 | * 25 | * You should have received a copy of the GNU General Public 26 | * License along with this program. 27 | * If not, see . 28 | * 29 | * @note This file contains heavily modified code from the source code 30 | * released by Electronic Arts for the C&C Remastered Collection 31 | * under the GPL3 license. Source: 32 | * https://github.com/ElectronicArts/CnC_Remastered_Collection 33 | * 34 | ******************************************************************************/ 35 | #pragma once 36 | 37 | #include "straw.h" 38 | #include "wwcrc.h" 39 | 40 | 41 | class CRCStraw : public Straw 42 | { 43 | public: 44 | CRCStraw() {} 45 | ~CRCStraw() {} 46 | 47 | virtual int Get(void *source, int slen); 48 | 49 | long Result() const; 50 | 51 | protected: 52 | CRCEngine CRC; 53 | 54 | private: 55 | CRCStraw(CRCStraw &) = delete; 56 | CRCStraw & operator = (const CRCStraw &) = delete; 57 | }; 58 | -------------------------------------------------------------------------------- /src/lib/dict.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file DICT.H 8 | * 9 | * @authors CCHyper, tomsons26 10 | * 11 | * @brief Hash table using a dictionary type. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "wstring.h" 32 | 33 | 34 | class Dictionary 35 | { 36 | public: 37 | Dictionary(); 38 | ~Dictionary(); 39 | 40 | static unsigned CRC(Wstring &string); 41 | 42 | public: 43 | void *Entries; // 0x00 44 | int EntryCount; // 0x04 45 | int field_8; 46 | int field_0C; 47 | int field_10; 48 | bool field_14; 49 | void *CRC_Function; // 0x18 50 | int field_1C; 51 | double field_20; 52 | double field_28; 53 | double field_30; 54 | }; 55 | -------------------------------------------------------------------------------- /src/lib/fetchres.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file FETCHRES.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Fetching resources from the executable. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | const char *Fetch_String(ULONG id); 34 | HGLOBAL Fetch_Resource(const char *id, const char *type); 35 | -------------------------------------------------------------------------------- /src/lib/ftimer.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file FTIMER.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Timer interface which uses the game frame. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "ttimer.h" 31 | 32 | 33 | extern long &Frame; 34 | 35 | 36 | class FrameTimerClass 37 | { 38 | public: 39 | long operator () (void) const { return Frame; } 40 | operator long (void) const { return Frame; } 41 | }; 42 | -------------------------------------------------------------------------------- /src/lib/lcw.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vinifera-Developers/TSpp/6fb02f4175c687160a4876bf8ead8844cee9d7e0/src/lib/lcw.h -------------------------------------------------------------------------------- /src/lib/noinit.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file NOINIT.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Dummy Parameter to a constructor that does absolutely no 12 | * initialization to the object being constructed. 13 | * 14 | * @license TS++ is free software: you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation, either version 17 | * 3 of the License, or (at your option) any later version. 18 | * 19 | * TS++ is distributed in the hope that it will be 20 | * useful, but WITHOUT ANY WARRANTY; without even the implied 21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 22 | * PURPOSE. See the GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public 25 | * License along with this program. 26 | * If not, see . 27 | * 28 | ******************************************************************************/ 29 | #pragma once 30 | 31 | 32 | class NoInitClass 33 | { 34 | public: 35 | void operator()() const {} 36 | }; 37 | -------------------------------------------------------------------------------- /src/lib/pipe.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file PIPE.H 8 | * 9 | * @author CCHyper 10 | * 11 | * @brief Basic demand driven data carrier. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class Pipe 34 | { 35 | Pipe(const Pipe &) = delete; 36 | Pipe & operator = (const Pipe &) = delete; 37 | 38 | public: 39 | Pipe(); 40 | virtual ~Pipe(); 41 | 42 | virtual int Flush(); 43 | virtual int End(); 44 | virtual void Put_To(Pipe *pipe); 45 | virtual int Put(const void *source, int slen); 46 | 47 | inline void Put_To(Pipe &pipe) { Put_To(&pipe); } 48 | 49 | public: 50 | Pipe *ChainTo; 51 | Pipe *ChainFrom; 52 | }; 53 | -------------------------------------------------------------------------------- /src/lib/readline.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file READLINE.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Utility functions for reading lines from FileClass and 12 | * Straw interfaces. 13 | * 14 | * @license TS++ is free software: you can redistribute it and/or 15 | * modify it under the terms of the GNU General Public License 16 | * as published by the Free Software Foundation, either version 17 | * 3 of the License, or (at your option) any later version. 18 | * 19 | * TS++ is distributed in the hope that it will be 20 | * useful, but WITHOUT ANY WARRANTY; without even the implied 21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 22 | * PURPOSE. See the GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public 25 | * License along with this program. 26 | * If not, see . 27 | * 28 | ******************************************************************************/ 29 | #pragma once 30 | 31 | #include "always.h" 32 | 33 | 34 | class FileClass; 35 | class Straw; 36 | 37 | 38 | int Read_Line(FileClass &file, char *buffer, int len, bool &eof); 39 | int Read_Line(Straw &file, char *buffer, int len, bool &eof); 40 | -------------------------------------------------------------------------------- /src/lib/rgb.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file RGB.CPP 8 | * 9 | * @authors CCHyper, tomsons26 10 | * 11 | * @brief RGB color container class. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "rgb.h" 31 | #include 32 | 33 | 34 | RGBClass RGBClass::Interpolate(RGBClass &from, RGBClass &towards, float amount) 35 | { 36 | RGBClass tmp; 37 | tmp.Red = std::clamp(from.Red * (1.0f - amount) + towards.Red * amount, 0.0f, 255.0f); 38 | tmp.Green = std::clamp(from.Green * (1.0f - amount) + towards.Green * amount, 0.0f, 255.0f); 39 | tmp.Blue = std::clamp(from.Blue * (1.0f - amount) + towards.Blue * amount, 0.0f, 255.0f); 40 | return tmp; 41 | } 42 | -------------------------------------------------------------------------------- /src/lib/rle.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file RLE.H 8 | * 9 | * @authors tomsons26 10 | * 11 | * @brief Run-length encoding (RLE) implementation. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "buff.h" 32 | 33 | 34 | class RLEClass 35 | { 36 | public: 37 | RLEClass() {} 38 | 39 | int Compress(void *source, void *dest, int length); 40 | int Uncompress(void *source, void *dest); 41 | }; 42 | 43 | 44 | inline int RLE_Compress(const Buffer &inbuff, const Buffer &outbuff) 45 | { 46 | RLEClass rle; 47 | return rle.Compress(inbuff, outbuff, inbuff.Get_Size()); 48 | } 49 | 50 | 51 | inline int RLE_Uncompress(const Buffer &inbuff, const Buffer &outbuff) 52 | { 53 | RLEClass rle; 54 | return rle.Uncompress(inbuff, outbuff); 55 | } 56 | -------------------------------------------------------------------------------- /src/lib/shapipe.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file SHAPIPE.H 8 | * 9 | * @author Joe L. Bostic (see notes below) 10 | * 11 | * @contributors CCHyper 12 | * 13 | * @brief Secure Hash pipe. 14 | * 15 | * @license TS++ is free software: you can redistribute it and/or 16 | * modify it under the terms of the GNU General Public License 17 | * as published by the Free Software Foundation, either version 18 | * 3 of the License, or (at your option) any later version. 19 | * 20 | * TS++ is distributed in the hope that it will be 21 | * useful, but WITHOUT ANY WARRANTY; without even the implied 22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 23 | * PURPOSE. See the GNU General Public License for more details. 24 | * 25 | * You should have received a copy of the GNU General Public 26 | * License along with this program. 27 | * If not, see . 28 | * 29 | * @note This file contains heavily modified code from the source code 30 | * released by Electronic Arts for the C&C Remastered Collection 31 | * under the GPL3 license. Source: 32 | * https://github.com/ElectronicArts/CnC_Remastered_Collection 33 | * 34 | ******************************************************************************/ 35 | #pragma once 36 | 37 | #include "pipe.h" 38 | #include "sha.h" 39 | 40 | 41 | class SHAPipe : public Pipe 42 | { 43 | public: 44 | SHAPipe(); 45 | ~SHAPipe(); 46 | 47 | virtual int Put(const void *source, int slen) override; 48 | 49 | int Result(void * result) const; 50 | 51 | protected: 52 | SHAEngine SHA; 53 | 54 | private: 55 | SHAPipe(const SHAPipe &) = delete; 56 | SHAPipe & operator = (const SHAPipe &) = delete; 57 | }; 58 | -------------------------------------------------------------------------------- /src/lib/shastraw.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file SHASTRAW.H 8 | * 9 | * @author Joe L. Bostic (see notes below) 10 | * 11 | * @contributors CCHyper 12 | * 13 | * @brief Secure Hash straw. 14 | * 15 | * @license TS++ is free software: you can redistribute it and/or 16 | * modify it under the terms of the GNU General Public License 17 | * as published by the Free Software Foundation, either version 18 | * 3 of the License, or (at your option) any later version. 19 | * 20 | * TS++ is distributed in the hope that it will be 21 | * useful, but WITHOUT ANY WARRANTY; without even the implied 22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 23 | * PURPOSE. See the GNU General Public License for more details. 24 | * 25 | * You should have received a copy of the GNU General Public 26 | * License along with this program. 27 | * If not, see . 28 | * 29 | * @note This file contains heavily modified code from the source code 30 | * released by Electronic Arts for the C&C Remastered Collection 31 | * under the GPL3 license. Source: 32 | * https://github.com/ElectronicArts/CnC_Remastered_Collection 33 | * 34 | ******************************************************************************/ 35 | #pragma once 36 | 37 | #include "straw.h" 38 | #include "sha.h" 39 | 40 | 41 | class SHAStraw : public Straw 42 | { 43 | public: 44 | SHAStraw(bool bypass_sha = false); 45 | ~SHAStraw(); 46 | 47 | virtual int Get(void * source, int slen) override; 48 | 49 | int Result(void * result) const; 50 | 51 | protected: 52 | bool BypassSHA; 53 | SHAEngine SHA; 54 | 55 | private: 56 | SHAStraw(const SHAStraw &) = delete; 57 | SHAStraw & operator = (const SHAStraw &) = delete; 58 | }; 59 | -------------------------------------------------------------------------------- /src/lib/sprite.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file SPRITE.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Functions for blitting, scaling, and rotating bitmaps. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "point.h" 32 | 33 | 34 | class Surface; 35 | 36 | 37 | class BitmapClass 38 | { 39 | public: 40 | BitmapClass(int w, int h, unsigned char *data) : Width(w), Height(h), Data(data) {} 41 | 42 | public: 43 | int Width; 44 | int Height; 45 | unsigned char *Data; 46 | }; 47 | 48 | 49 | /** 50 | * Using Bi-Linear Interpolation, draws a scaled and rotated 51 | * bitmap onto the buffer. No clipping is performed, so beware! 52 | * 53 | * bmp - bitmap to draw. 54 | * pt - desired position of the center. 55 | * scale - scale factor. 56 | * angle - 8bit angle (0=0deg, 255=360deg) 57 | * 58 | */ 59 | bool Scale_Rotate(Surface &src, BitmapClass &bmp, TPoint2D &pt, int scale, unsigned char angle); 60 | -------------------------------------------------------------------------------- /src/lib/stimer.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file STIMER.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Basic Windows system timer interfaces. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | 31 | #include "always.h" 32 | #include 33 | #include 34 | 35 | 36 | class SystemTimerClass 37 | { 38 | public: 39 | long operator () () const { return timeGetTime() / 16; } 40 | operator long () const { return timeGetTime() / 16; } 41 | }; 42 | 43 | 44 | /** 45 | * Higher precision system timer (1ms). 46 | */ 47 | class MSTimerClass 48 | { 49 | public: 50 | MSTimerClass() { timeBeginPeriod(1); } 51 | ~MSTimerClass() { timeEndPeriod(1); } 52 | 53 | long operator () () const { return timeGetTime(); } 54 | operator long () const { return timeGetTime(); } 55 | }; 56 | -------------------------------------------------------------------------------- /src/lib/straw.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file STRAW.H 8 | * 9 | * @author CCHyper 10 | * 11 | * @brief Basic demand driven data carrier. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class Straw 34 | { 35 | Straw(const Straw &) = delete; 36 | Straw & operator = (const Straw &) = delete; 37 | 38 | public: 39 | Straw(); 40 | virtual ~Straw(); 41 | 42 | virtual void Get_From(Straw *pipe); 43 | virtual int Get(void *buffer, int slen); 44 | 45 | inline void Get_From(Straw &pipe) { Get_From(&pipe); } 46 | 47 | public: 48 | Straw *ChainTo; 49 | Straw *ChainFrom; 50 | }; 51 | -------------------------------------------------------------------------------- /src/lib/strtrim.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file STRTRIM.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Classes providing critical section behavior. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | char *strtrim(char *buffer); 31 | -------------------------------------------------------------------------------- /src/lib/systimer.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file SYSTIMER.CPP 8 | * 9 | * @authors OmniBlade, CCHyper 10 | * 11 | * @brief Simple interface for tracking system time. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #include "systimer.h" 29 | #include 30 | #include 31 | 32 | 33 | // Global timer instance. 34 | SysTimeClass SystemTime; 35 | 36 | 37 | SysTimeClass::SysTimeClass() : 38 | StartTime(0), 39 | NegTime(0) 40 | { 41 | timeBeginPeriod(1); 42 | } 43 | 44 | 45 | SysTimeClass::~SysTimeClass() 46 | { 47 | timeEndPeriod(1); 48 | } 49 | 50 | 51 | void SysTimeClass::Reset() 52 | { 53 | int time = timeGetTime(); 54 | StartTime = time; 55 | NegTime = -time; 56 | } 57 | 58 | 59 | int SysTimeClass::Get() 60 | { 61 | static bool _is_init = false; 62 | 63 | if (!_is_init) { 64 | Reset(); 65 | _is_init = true; 66 | } 67 | 68 | int time = timeGetTime(); 69 | 70 | if (time < StartTime) { 71 | return NegTime + time; 72 | } 73 | 74 | return time - StartTime; 75 | } 76 | 77 | 78 | bool SysTimeClass::Is_Getting_Late() 79 | { 80 | return Get() >= 0x70000000; 81 | } 82 | -------------------------------------------------------------------------------- /src/lib/systimer.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file SYSTIMER.H 8 | * 9 | * @authors OmniBlade, CCHyper 10 | * 11 | * @brief Simple interface for tracking system time. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class SysTimeClass 34 | { 35 | public: 36 | SysTimeClass(); 37 | ~SysTimeClass(); 38 | 39 | int Get(); 40 | bool Is_Getting_Late(); 41 | 42 | private: 43 | void Reset(); 44 | 45 | private: 46 | int StartTime; 47 | int NegTime; 48 | }; 49 | 50 | extern SysTimeClass SystemTime; 51 | -------------------------------------------------------------------------------- /src/lib/textfile.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file TEXTFILE.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Text file i/o class. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "rawfile.h" 32 | 33 | 34 | class TextFileClass : public RawFileClass 35 | { 36 | public: 37 | enum { 38 | MAX_LINE_LENGTH = 128 39 | }; 40 | 41 | public: 42 | TextFileClass() : RawFileClass() {} 43 | TextFileClass(char const *filename) : RawFileClass(filename) {} 44 | TextFileClass(Wstring const &filename); 45 | virtual ~TextFileClass() {} 46 | 47 | int Read_Line(char *string, bool &last_line); 48 | int Write_Line(char *string); 49 | int Write_Line_Format(char *string, ...); 50 | }; 51 | -------------------------------------------------------------------------------- /src/lib/winfont.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file WINFONT.H 8 | * 9 | * @authors CCHyper, tomsons26 10 | * 11 | * @brief Easy windows font creation. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | /** 34 | * Available font attribute styles. 35 | */ 36 | #define WINFONT_ATTR_BOLD 1 37 | #define WINFONT_ATTR_ITALIC 2 38 | #define WINFONT_ATTR_UNDERLINE 4 39 | #define WINFONT_ATTR_STRIKEOUT 8 40 | 41 | 42 | HFONT WinCreateFont(HDC hdc, TCHAR * szFaceName, int iDeciPtWidth, int iDeciPtHeight, int iAttributes); 43 | -------------------------------------------------------------------------------- /src/lib/wwcrc.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file WWCRC.CPP 8 | * 9 | * @authors CCHyper, tomsons26 10 | * 11 | * @brief Westwood CRC engine. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #include "wwcrc.h" 29 | 30 | 31 | long CRCEngine::Value() const 32 | { 33 | if (Buffer_Needs_Data()) { 34 | 35 | /** 36 | * Pad the buffer. 37 | */ 38 | ((char &)StagingBuffer.Buffer[Index]) = Index; 39 | for (int i = Index + 1; i < sizeof(long); ++i) { 40 | ((char &)StagingBuffer.Buffer[i]) = StagingBuffer.Buffer[0]; 41 | } 42 | 43 | return CRC_Memory(&StagingBuffer, sizeof(long), CRC); 44 | } 45 | 46 | return CRC; 47 | }; 48 | -------------------------------------------------------------------------------- /src/lightconvert.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file LIGHTCONVERT.H 8 | * 9 | * @authors tomsons26 10 | * 11 | * @brief Palette drawer. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "convert.h" 31 | 32 | 33 | class Surface; 34 | class PaletteClass; 35 | 36 | 37 | class LightConvertClass : public ConvertClass 38 | { 39 | public: 40 | LightConvertClass(PaletteClass *pal1, PaletteClass *pal2, Surface *surface, int r = -1, int g = -1, int b = -1, bool a8 = false, bool *a9 = nullptr, int a10 = 63); 41 | LightConvertClass(const NoInitClass &noinit); 42 | virtual ~LightConvertClass(); 43 | 44 | virtual void Adjust(int r, int g, int b, bool a4); 45 | 46 | private: 47 | PaletteClass *field_190; 48 | PaletteClass *field_194; 49 | bool * field_198; // mask? 50 | int field_19C; // ref count? 51 | int field_1A0; 52 | int field_1A4; 53 | int field_1A8; 54 | int field_1AC; 55 | int field_1B0; 56 | int field_1B4; 57 | bool field_1B8; 58 | }; 59 | -------------------------------------------------------------------------------- /src/logic.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file LOGIC.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Game logic processing. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "layer.h" 31 | 32 | 33 | class ObjectClass; 34 | class AbstractClass; 35 | 36 | 37 | class LogicClass : public LayerClass 38 | { 39 | public: 40 | LogicClass(); 41 | virtual ~LogicClass(); 42 | 43 | /** 44 | * LogicClass 45 | */ 46 | virtual bool Submit(ObjectClass const *object, bool sort = false); 47 | virtual void Init(); 48 | virtual void One_Time(); 49 | 50 | virtual void Detach(AbstractClass * target, bool all = true); 51 | 52 | void AI(); 53 | void func_507210(); // looks like an older version of AI()? 54 | void Remove(ObjectClass *const object); 55 | 56 | static void func_507470(); 57 | 58 | public: 59 | static unsigned &FramesPerSecond; 60 | }; 61 | -------------------------------------------------------------------------------- /src/math/fastmath.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file FASTMATH.H 8 | * 9 | * @authors tomsons26 10 | * 11 | * @brief Basic math functions. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | namespace FastMath 34 | { 35 | 36 | float __cdecl Sqrt(double val); 37 | float __cdecl Sin(double val); 38 | float __cdecl Cos(double val); 39 | float __cdecl Tan(double val); 40 | float __cdecl Asin(double val); 41 | float __cdecl Acos(double val); 42 | float __cdecl Atan(double val); 43 | float __cdecl Atan2(double y, double x); 44 | 45 | float __stdcall Sqrtf(float val); 46 | float __stdcall Sinf(float val); 47 | float __stdcall Cosf(float val); 48 | float __stdcall Tanf(float val); 49 | float __stdcall Asinf(float val); 50 | float __stdcall Acosf(float val); 51 | float __stdcall Atanf(float val); 52 | float __stdcall Atan2f(float y, float x); 53 | 54 | //int __cdecl ftol(double f); 55 | //__int64 __cdecl ftol64(double f); 56 | 57 | }; 58 | -------------------------------------------------------------------------------- /src/math/int.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file INT.CPP 8 | * 9 | * @author Joe L. Bostic (see notes below) 10 | * 11 | * @contributors CCHyper 12 | * 13 | * @brief An arbitrary precision integer class. 14 | * 15 | * @license TS++ is free software: you can redistribute it and/or 16 | * modify it under the terms of the GNU General Public License 17 | * as published by the Free Software Foundation, either version 18 | * 3 of the License, or (at your option) any later version. 19 | * 20 | * TS++ is distributed in the hope that it will be 21 | * useful, but WITHOUT ANY WARRANTY; without even the implied 22 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 23 | * PURPOSE. See the GNU General Public License for more details. 24 | * 25 | * You should have received a copy of the GNU General Public 26 | * License along with this program. 27 | * If not, see . 28 | * 29 | * @note This file contains heavily modified code from the source code 30 | * released by Electronic Arts for the C&C Remastered Collection 31 | * under the GPL3 license. Source: 32 | * https://github.com/ElectronicArts/CnC_Remastered_Collection 33 | * 34 | ******************************************************************************/ 35 | #include "int.h" 36 | 37 | 38 | int BigInt::Error = 0; 39 | bool BigInt::Carry = false; 40 | bool BigInt::Borrow = false; 41 | BigInt BigInt::Remainder = BigInt(); 42 | -------------------------------------------------------------------------------- /src/movie.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file MOVIE.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Ingame movie tracker and player. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "rect.h" 32 | #include "tibsun_defines.h" 33 | 34 | 35 | class VQAClass; 36 | class XSurface; 37 | 38 | class MovieClass; 39 | 40 | 41 | struct VQHandle 42 | { 43 | MovieClass *Movie; 44 | int field_4; 45 | int field_8; 46 | }; 47 | 48 | class MovieClass 49 | { 50 | public: 51 | VQAClass *VQMovie; 52 | int field_4; 53 | XSurface *MovieSurface; 54 | int field_C; 55 | int field_10; 56 | int field_14; 57 | int field_18; 58 | int field_1C; 59 | int field_20; 60 | Rect VideoRect; 61 | Rect StretchRect; 62 | bool field_44; 63 | bool field_45; 64 | }; 65 | -------------------------------------------------------------------------------- /src/msengine.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file GRAPHICMENU.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Graphic menu instance class. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "rect.h" 32 | #include "vector.h" 33 | 34 | 35 | class MSAnim; 36 | class MSSfx; 37 | 38 | 39 | class MSEngine 40 | { 41 | public: 42 | MSEngine(); 43 | virtual ~MSEngine(); 44 | 45 | public: 46 | int field_4; 47 | VectorClass> Rects; 48 | DynamicVectorClass Anims; 49 | DynamicVectorClass Sounds; 50 | }; 51 | -------------------------------------------------------------------------------- /src/msgbox.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file MSGBOX.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Message boxes that use the game ui. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "tibsun_defines.h" 31 | #include "language.h" 32 | 33 | 34 | class WWMessageBox 35 | { 36 | public: 37 | WWMessageBox(int caption = TXT_NONE); 38 | 39 | int Process(const char *msg, int a2, const char *b1txt, const char *b2txt = nullptr, const char *b3txt = nullptr, bool preserve = false); 40 | int Process(int msg, int a2, int b1txt = TXT_OK, int b2txt = TXT_NONE, int b3txt = TXT_NONE, bool preserve = false); 41 | int Process(char const *msg, int a2, int b1txt = TXT_OK, int b2txt = TXT_NONE, int b3txt = TXT_NONE, bool preserve = false); 42 | 43 | private: 44 | int Caption; 45 | }; 46 | 47 | -------------------------------------------------------------------------------- /src/multimiss.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file MULTIMISS.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Multiplayer mission definition class. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "tibsun_defines.h" 32 | #include "typelist.h" 33 | 34 | 35 | class INIClass; 36 | 37 | 38 | class MultiMission 39 | { 40 | public: 41 | MultiMission(INIClass &ini, const char * filename); 42 | MultiMission(const char *filename = nullptr, const char *description = nullptr, const char *digest = nullptr, bool official = true); 43 | ~MultiMission(); 44 | 45 | bool Is_Available(DiskID disk); 46 | DiskID Get_Disk() const; 47 | 48 | void Set_Description(const char *description); 49 | void Set_Filename(const char *filename); 50 | void Set_Digest(const char *digest); 51 | void Set_Official(bool official); 52 | 53 | public: 54 | char ScenarioDescription[DESCRIP_MAX]; 55 | char Filename[NAME_MAX]; 56 | char Digest[32]; 57 | bool IsOfficial; 58 | int MinPlayers; 59 | int MaxPlayers; 60 | TypeList Disks; 61 | }; 62 | -------------------------------------------------------------------------------- /src/multiscore.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file MULTISCORE.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Multiplayer score screen. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class MultiScore 34 | { 35 | public: 36 | static void Presentation(); 37 | 38 | public: 39 | }; 40 | -------------------------------------------------------------------------------- /src/net/wspipx.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file WSPIPX.H 8 | * 9 | * @authors tomsons26 10 | * 11 | * @brief Class to provide an interface to Winsock IPX protocol. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "wsproto.h" 31 | #include 32 | 33 | 34 | class IPXInterfaceClass : public WinsockInterfaceClass 35 | { 36 | public: 37 | IPXInterfaceClass(); 38 | virtual ~IPXInterfaceClass(); 39 | 40 | virtual ProtocolEnum Get_Protocol() override; 41 | virtual int Protocol_Event_Message() override; 42 | virtual bool Open_Socket(SOCKET socketnum) override; 43 | virtual LRESULT Message_Handler(HWND hWnd, UINT uMsg, UINT wParam, LONG lParam) override; 44 | 45 | bool Get_Network_Card_Address(int card_number, SOCKADDR_IPX *addr); 46 | bool Get_Network_Card_Address_String(int card_number, char *buffer, int size); 47 | 48 | private: 49 | unsigned char BroadcastNet[4]; 50 | unsigned char BroadcastNode[6]; 51 | unsigned char MyNode[6]; 52 | SOCKET IPXSocketNumber; 53 | }; 54 | -------------------------------------------------------------------------------- /src/newmenu.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file CELL.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Representation of a cell on the game world map. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "ccfile.h" 32 | 33 | 34 | class NewMenuClass 35 | { 36 | public: 37 | NewMenuClass(); 38 | //~NewMenuClass(); 39 | 40 | static void Blit(); 41 | static NewMenuClass *Get(); 42 | 43 | bool Is_Loaded() const { return Mix != nullptr; } 44 | const char *Background_Image() const { return BackgroundImage; } 45 | 46 | public: 47 | MFCC *Mix; 48 | int GameMode; 49 | const char * BackgroundImage; 50 | }; 51 | -------------------------------------------------------------------------------- /src/ownrdraw.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file OWNRDRAW.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Owner draw user interface. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | namespace OwnerDraw 34 | { 35 | void Init_Glow_Colors(); 36 | void Load_Graphics(); 37 | void Init_UI_Color_Stuff_58F060(); 38 | 39 | extern bool& UIInitialized; 40 | 41 | }; // OwnerDraw namespace 42 | -------------------------------------------------------------------------------- /src/playmovie.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file PLAYMOVIE.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Functions for playing movies. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "tibsun_defines.h" 32 | 33 | 34 | void Play_Movie(char const *name, ThemeType theme = THEME_NONE, bool clear_before = true, bool stretch_allowed = true, bool clear_after = true); 35 | void Play_Movie(VQType name, ThemeType theme = THEME_NONE, bool clear_screen = true, bool stretch_allowed = false); 36 | void Play_Fullscreen_Movie(char const *name, ThemeType theme); 37 | void Play_Ingame_Movie(char const *name); 38 | void Play_Ingame_Movie(VQType name); 39 | void End_Ingame_Movie(); 40 | -------------------------------------------------------------------------------- /src/preview.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file PREVIEW.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Map preview functions. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class XSurface; 34 | class CCINIClass; 35 | 36 | 37 | typedef struct PreviewDataStruct { 38 | int Width; 39 | int Height; 40 | char Data[1]; 41 | } PreviewDataStruct; 42 | 43 | 44 | class PreviewClass 45 | { 46 | public: 47 | PreviewClass(); 48 | ~PreviewClass(); 49 | 50 | void Render_Preview(HWND hWnd); 51 | void Draw_Map(); 52 | bool Write_Preview_INI(CCINIClass &ini); 53 | bool Read_Preview_INI(CCINIClass &ini); 54 | bool Read_PCX_Preview(const char *filename); 55 | bool Read_INI_Preview(const char *filename); 56 | PreviewDataStruct *Create_Paletted_Preview(int a1, int &size_bytes); 57 | void Create_Preview_Surface(PreviewDataStruct *a1); 58 | 59 | private: 60 | XSurface *ImageSurface; 61 | }; 62 | -------------------------------------------------------------------------------- /src/region.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file REGION.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Map threat region tracker. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class RegionClass 34 | { 35 | public: 36 | RegionClass() { Threat = 0; } 37 | ~RegionClass() {} 38 | 39 | int operator != (RegionClass const & region) { return std::memcmp(this, ®ion, sizeof(RegionClass)); } 40 | int operator == (RegionClass const & region) { return !std::memcmp(this, ®ion, sizeof(RegionClass)); } 41 | int operator > (RegionClass const & region) { return std::memcmp(this, ®ion, sizeof(RegionClass)) > 0; } 42 | int operator < (RegionClass const & region) { return std::memcmp(this, ®ion, sizeof(RegionClass)) < 0; } 43 | 44 | void Reset_Threat() { Threat = 0; } 45 | void Adjust_Threat(int threat, int neg) { if (neg) Threat -= threat; else Threat+= threat; } 46 | int Threat_Value() const { return Threat; } 47 | 48 | protected: 49 | long Threat; 50 | }; 51 | -------------------------------------------------------------------------------- /src/reinf.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file REINF.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Special case reinforcements. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "tibsun_defines.h" 32 | 33 | 34 | class AircraftClass; 35 | class FootClass; 36 | class TeamTypeClass; 37 | class TechnoClass; 38 | class HouseClass; 39 | class AircraftClass; 40 | class TechnoTypeClass; 41 | 42 | 43 | bool Need_To_Take(const AircraftClass *air); 44 | bool Do_Reinforcements(const TeamTypeClass *team, WaypointType wp = WAYPOINT_NONE); 45 | bool Pop_Group_Out_Of_Object(FootClass *group, TechnoClass *object); 46 | int Create_Tunnel_Reinforcement(const TeamTypeClass *teamtype, FootClass *object, Cell &cell, bool a4 = false); 47 | bool Create_Special_Reinforcement(HouseClass *house, const TechnoTypeClass *type, const TechnoTypeClass *another, ScriptMissionType mission = SMISSION_NONE, int argument = 0); 48 | int Create_Air_Reinforcement(HouseClass *house, AircraftType air, int number, MissionType mission, AbstractClass * tarcom, AbstractClass * navcom, InfantryType passenger = INFANTRY_NONE); 49 | -------------------------------------------------------------------------------- /src/restate.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file RESTATE.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Restate mission briefing interface. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class ScenarioClass; 34 | 35 | 36 | void Restate_Mission(ScenarioClass *scenario); 37 | -------------------------------------------------------------------------------- /src/rules.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file RULES.CPP 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief General rules that control the game. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #include "rules.h" 29 | #include "tibsun_globals.h" 30 | #include "addon.h" 31 | #include "ccfile.h" 32 | #include "ccini.h" 33 | 34 | 35 | /** 36 | * Loads the contents of ARTFS.INI into the art ini database. 37 | * 38 | * @author: CCHyper 39 | */ 40 | void RulesClass::Load_ArtFS_INI() 41 | { 42 | if (!Is_Addon_Available(ADDON_FIRESTORM)) { 43 | return; 44 | } 45 | 46 | CCFileClass file("ARTFS.INI"); 47 | if (file.Is_Available()) { 48 | ArtINI.Load(file, false); 49 | } 50 | } 51 | 52 | 53 | /** 54 | * Loads the contents of FIRESTRM.INI into its ini database. 55 | * 56 | * @author: CCHyper 57 | */ 58 | void RulesClass::Load_FSRule_INI() 59 | { 60 | if (!Is_Addon_Available(ADDON_FIRESTORM)) { 61 | return; 62 | } 63 | 64 | CCFileClass file("FIRESTRM.INI"); 65 | if (file.Is_Available()) { 66 | FSRuleINI.Load(file, false); 67 | } 68 | } -------------------------------------------------------------------------------- /src/scenarioini.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file SCENARIOINI.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Scenario read and write functions. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | bool Read_Scenario_INI(const char* root, bool fresh = true); 31 | bool Load_Scenario(CCINIClass& ini, bool random = false); 32 | void Scenario_MP_Fixups(bool official); 33 | void Write_Scenario_INI(const char* root, bool a2 = false); 34 | -------------------------------------------------------------------------------- /src/sendfile.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file SENDFILE.H 8 | * 9 | * @authors CCHyper, tomsons26 10 | * 11 | * @brief Functions for scenario file transfer between machines. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | bool Get_Scenario_File_From_Host(char *return_name, int gametype, bool show_progress); 34 | bool Receive_Remote_File(const char *file_name, unsigned int file_length, int gametype, bool show_progress); 35 | bool Send_Remote_File(const char *file_name, int gametype, bool a3, bool show_progress); 36 | bool Find_Local_Scenario(const char *file_name, unsigned int file_length, char *digest, bool official, bool a5); 37 | -------------------------------------------------------------------------------- /src/spotlight.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file SPOTLIGHT.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Alpha spotlights. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class SpotlightClass 34 | { 35 | public: 36 | SpotlightClass(Coordinate coord, int spotlight_size); 37 | ~SpotlightClass(); 38 | 39 | void Remove_If_Large(); 40 | void Draw_It(); 41 | 42 | static void Update_All(); 43 | static void One_Time(); 44 | static void Clear_All(); 45 | static void Draw_All(); 46 | 47 | private: 48 | Coordinate Coord; 49 | int Radius; 50 | int Size; 51 | }; 52 | -------------------------------------------------------------------------------- /src/stage.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file STAGE.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Staged timer used by animations. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "ttimer.h" 31 | #include "ftimer.h" 32 | 33 | 34 | class StageClass 35 | { 36 | public: 37 | StageClass() : Stage(0), Timer(0), Rate(0), Step(1) {} 38 | StageClass(const NoInitClass & x) : Timer(x) {} 39 | 40 | int Fetch_Stage() const { return Stage; } 41 | int Fetch_Rate() const { return Rate; } 42 | int Fetch_Step() const { return Step; } 43 | 44 | void Set_Stage(int stage) { Stage = stage; } 45 | void Set_Rate(int rate) { Timer = rate; Rate = rate; } 46 | void Set_Step(int step) { Step = step; } 47 | 48 | void AI() {} 49 | bool About_To_Change() const { return Timer.Expired() && Rate != 0; } 50 | 51 | bool Graphic_Logic() 52 | { 53 | if (About_To_Change()) { 54 | Stage += Step; 55 | Timer = Rate; 56 | return true; 57 | } 58 | return false; 59 | }; 60 | 61 | private: 62 | unsigned Stage; 63 | CDTimerClass Timer; 64 | int Rate; 65 | int Step; 66 | }; 67 | -------------------------------------------------------------------------------- /src/storage.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file INI.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Tiberium storage container class. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "tibsun_defines.h" 32 | 33 | 34 | class NoInitClass; 35 | 36 | 37 | class StorageClass 38 | { 39 | public: 40 | StorageClass(); 41 | StorageClass(const NoInitClass &noinit); 42 | ~StorageClass(); 43 | 44 | int Get_Total_Value() const; 45 | int Get_Total_Amount() const; 46 | int Get_Amount(TiberiumType tib) const; 47 | int Increase_Amount(int by, TiberiumType tib); 48 | int Decrease_Amount(int by, TiberiumType tib); 49 | int First_Used_Slot() const; 50 | 51 | StorageClass operator+(StorageClass &that) const; 52 | StorageClass operator+=(StorageClass &that); 53 | StorageClass operator-(StorageClass &that) const; 54 | StorageClass operator-=(StorageClass &that); 55 | 56 | private: 57 | int Types[TIBERIUM_COUNT]; 58 | }; 59 | -------------------------------------------------------------------------------- /src/team.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file TEAM.cPP 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Unit team object class. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #include "team.h" 29 | #include "foot.h" 30 | #include "tibsun_globals.h" 31 | 32 | 33 | /** 34 | * Checks to see if unit is an active team member. 35 | * 36 | * @author: 03/11/1996 JLB 37 | */ 38 | bool Is_It_Breathing(const FootClass *object) 39 | { 40 | if (object == nullptr || !object->IsActive || object->Strength == 0) { 41 | return false; 42 | } 43 | 44 | if (!ScenarioInit && object->IsInLimbo) { 45 | return false; 46 | } 47 | 48 | return true; 49 | } 50 | 51 | 52 | /** 53 | * Determines if unit is active and an initiated team member. 54 | * 55 | * @author: 03/11/1996 JLB 56 | */ 57 | bool Is_It_Playing(const FootClass *object) 58 | { 59 | if (!Is_It_Breathing(object)) { 60 | return false; 61 | } 62 | 63 | if (!object->IsInitiated && object->Fetch_RTTI() != RTTI_AIRCRAFT) { 64 | return false; 65 | } 66 | 67 | return true; 68 | } 69 | -------------------------------------------------------------------------------- /src/technotype.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file TECHNOTYPE.CPP 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Class which all buildable game object types derive from. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #include "technotype.h" 29 | #include "tibsun_globals.h" 30 | #include "tspp_assert.h" 31 | 32 | 33 | const TechnoTypeClass &TechnoTypeClass::As_Reference(const char *name) 34 | { 35 | return *From_Name(name); 36 | } 37 | 38 | 39 | const TechnoTypeClass *TechnoTypeClass::As_Pointer(const char *name) 40 | { 41 | return From_Name(name); 42 | } 43 | 44 | 45 | const TechnoTypeClass *TechnoTypeClass::From_Name(const char *name) 46 | { 47 | TSPP_ASSERT(name != nullptr); 48 | 49 | if (!strcasecmp(name, "") || !strcasecmp(name, "none")) { 50 | return nullptr; 51 | } 52 | 53 | if (name != nullptr) { 54 | for (int index = 0; index < TechnoTypes.Count(); ++index) { 55 | const TechnoTypeClass *ttype = TechnoTypes[index]; 56 | if (!strcasecmp(ttype->Name(), name)) { 57 | return ttype; 58 | } 59 | } 60 | } 61 | 62 | return nullptr; 63 | } 64 | -------------------------------------------------------------------------------- /src/tibsun/tibsun_resource.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file TIBSUN_RESOURCE.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Resource defines and constant. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | /** 34 | * Icons 35 | */ 36 | #define IDI_TIBSUN 93 37 | #define IDI_CHECKBOX_ON 160 38 | #define IDI_CHECKBOX_OFF 161 39 | #define IDI_CHECKBOX_DISABLED 162 40 | 41 | 42 | /** 43 | * Cursors 44 | */ 45 | #define IDC_TIBSUN_ARROW 104 46 | #define IDC_TIBSUN_GREEN_ARROW 248 47 | 48 | 49 | /** 50 | * Strings 51 | */ 52 | //#define IDS 53 | // See language.h 54 | 55 | 56 | /** 57 | * Menus 58 | */ 59 | #define IDM_RESOLUTION 160 60 | -------------------------------------------------------------------------------- /src/tibsun/tibsun_util.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file TIBSUN_UTIL.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Game world utility functions. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "tibsun_defines.h" 31 | #include "wwkeyboard.h" 32 | 33 | 34 | Cell Get_Cell_Under_Mouse(); 35 | Coordinate Get_Coord_Under_Mouse(); 36 | 37 | bool Simple_YesNo_WWMessageBox(const char *msg); 38 | 39 | FacingType KN_To_Facing(KeyNumType input); 40 | -------------------------------------------------------------------------------- /src/tracker.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file TRACKER.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Detach target from all known trackers/heaps. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "tibsun_defines.h" 32 | 33 | 34 | /** 35 | * Remove from targeting computers. 36 | */ 37 | void Detach_This_From_All(AbstractClass * target, bool all = true); 38 | 39 | void Remove_All_Inactive(); 40 | -------------------------------------------------------------------------------- /src/tspp/tspp_audio_intercept.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file TSPP_AUDIO_INTERCEPT.CPP 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Installable functions for overriding audio calls in TS++. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #include "tspp_audio_intercept.h" 29 | #include "tibsun_globals.h" 30 | 31 | 32 | int (*TSPP_Play_Sample_Function_Ptr)(const void *sample, int priority, int volume) = nullptr; 33 | bool (*TSPP_Is_Sample_Playing_Function_Ptr)(const void *sample) = nullptr; 34 | 35 | 36 | int TSPP_Play_Sample(const void *sample, int priority, int volume) 37 | { 38 | if (TSPP_Play_Sample_Function_Ptr) { 39 | return TSPP_Play_Sample_Function_Ptr(sample, priority, volume); 40 | } else { 41 | return Audio.Play_Sample(sample, priority, volume); 42 | } 43 | } 44 | 45 | 46 | bool TSPP_Is_Sample_Playing(const void *sample) 47 | { 48 | if (TSPP_Is_Sample_Playing_Function_Ptr) { 49 | return TSPP_Is_Sample_Playing_Function_Ptr(sample); 50 | } else { 51 | return Audio.Is_Sample_Playing(sample); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/tspp/tspp_audio_intercept.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file TSPP_AUDIO_INTERCEPT.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Installable functions for overriding audio calls in TS++. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "dsaudio.h" 32 | 33 | 34 | extern int (*TSPP_Play_Sample_Function_Ptr)(const void *sample, int priority, int volume); 35 | extern bool (*TSPP_Is_Sample_Playing_Function_Ptr)(const void *sample); 36 | 37 | 38 | int TSPP_Play_Sample(const void *sample, int priority = PRIORITY_MAX, int volume = VOLUME_MAX); 39 | bool TSPP_Is_Sample_Playing(const void *sample); 40 | -------------------------------------------------------------------------------- /src/tspp/tspp_gitinfo.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file TSPP_GITINFO.H 8 | * 9 | * @authors OmniBlade, CCHyper 10 | * 11 | * @brief Globals for accessing git version information from the build system. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | 31 | const char *TSPP_Git_Hash(); 32 | const char *TSPP_Git_Hash_Short(); 33 | const char *TSPP_Git_Author(); 34 | const char *TSPP_Git_Branch(); 35 | const char *TSPP_Git_DateTime(); 36 | bool TSPP_Git_Uncommitted_Changes(); 37 | const char *TSPP_Git_Version_String(); 38 | -------------------------------------------------------------------------------- /src/ui/checkbox.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file CHECKBOX.H 8 | * 9 | * @authors CCHyper, tomsons26 10 | * 11 | * @brief Like a Windows CheckBox structure. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "toggle.h" 31 | 32 | 33 | class CheckBoxClass : public ToggleClass 34 | { 35 | public: 36 | CheckBoxClass(unsigned id, int x, int y); 37 | virtual ~CheckBoxClass(); 38 | 39 | virtual bool Draw_Me(bool forced = false) override; 40 | virtual bool Action(unsigned flags, KeyNumType & key) override; 41 | }; 42 | -------------------------------------------------------------------------------- /src/ui/dial8.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file DIAL8.H 8 | * 9 | * @authors CCHyper, tomsons26 10 | * 11 | * @brief Dial gadget with 8 directions. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "gcntrl.h" 31 | 32 | 33 | class Dial8Class : public ControlClass 34 | { 35 | public: 36 | Dial8Class(int id, int x, int y, int w, int h, Dir256 dir); 37 | virtual ~Dial8Class(); 38 | 39 | virtual bool Draw_Me(bool forced = false) override; 40 | virtual bool Action(unsigned flags, KeyNumType &key) override; 41 | 42 | Dir256 Get_Direction() const; 43 | void Set_Direction(Dir256 dir); 44 | 45 | public: 46 | int FaceX; 47 | int FaceY; 48 | int FacePoint[8][2]; 49 | int FaceLine[8][2]; 50 | Dir256 Direction; 51 | FacingType Facing; 52 | FacingType OldFacing; 53 | }; 54 | -------------------------------------------------------------------------------- /src/ui/gcntrl.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file CONTROL.H 8 | * 9 | * @authors CCHyper, tomsons26 10 | * 11 | * @brief The gui region tracking class. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "gadget.h" 31 | 32 | 33 | class ControlClass : public GadgetClass 34 | { 35 | public: 36 | ControlClass(unsigned id, int x, int y, int w, int h, unsigned flags = LEFTPRESS|RIGHTPRESS, bool sticky = false); 37 | ControlClass(const ControlClass &control); 38 | ControlClass(const NoInitClass &x); 39 | 40 | virtual void Make_Peer(GadgetClass &gadget); 41 | virtual bool Draw_Me(bool forced = false) override; 42 | virtual unsigned Get_ID() const override; 43 | virtual bool Action(unsigned flags, KeyNumType &key) override; 44 | 45 | public: 46 | unsigned ID; 47 | GadgetClass *Peer; 48 | }; 49 | -------------------------------------------------------------------------------- /src/ui/link.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file LINK.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief A simple linked list. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include 31 | 32 | 33 | class NoInitClass; 34 | 35 | 36 | class LinkClass 37 | { 38 | public: 39 | LinkClass(); 40 | LinkClass(const NoInitClass &x); 41 | LinkClass(const LinkClass &link); 42 | virtual ~LinkClass(); 43 | 44 | LinkClass & operator=(const LinkClass & link); 45 | 46 | virtual LinkClass * Get_Next() const; 47 | virtual LinkClass * Get_Prev() const; 48 | virtual LinkClass & Add(LinkClass & object); 49 | virtual LinkClass & Add_Tail(LinkClass & object); 50 | virtual LinkClass & Add_Head(LinkClass & object); 51 | virtual LinkClass & Head_Of_List(); 52 | virtual LinkClass & Tail_Of_List(); 53 | virtual void Zap(); 54 | virtual LinkClass * Remove(); 55 | 56 | private: 57 | LinkClass *Next; 58 | LinkClass *Prev; 59 | }; 60 | -------------------------------------------------------------------------------- /src/ui/pcxbtn.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file PCXIMGBTN.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief PCX image button. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "toggle.h" 31 | 32 | 33 | class BSurface; 34 | 35 | 36 | class PCXButtonClass : public ToggleClass 37 | { 38 | public: 39 | PCXButtonClass(); 40 | PCXButtonClass(unsigned id, const char *image_fname, int x, int y, int w = -1, int h = -1); 41 | ~PCXButtonClass(); 42 | 43 | virtual bool Draw_Me(bool forced = false) override; 44 | 45 | bool Load_Image(const char *filename); 46 | 47 | public: 48 | BSurface *ImageSurface; 49 | }; 50 | -------------------------------------------------------------------------------- /src/ui/shapebtn.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file SHAPEBTN.H 8 | * 9 | * @authors CCHyper, tomsons26 10 | * 11 | * @brief Shape image button. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "toggle.h" 31 | 32 | 33 | class ConvertClass; 34 | class ShapeSet; 35 | 36 | 37 | class ShapeButtonClass : public ToggleClass 38 | { 39 | public: 40 | ShapeButtonClass(); 41 | ShapeButtonClass(unsigned id, const ShapeSet *shapes, int x, int y, int w = 0, int h = 0, bool alpha = false); 42 | virtual ~ShapeButtonClass(); 43 | 44 | virtual bool Draw_Me(bool forced = false) override; 45 | 46 | virtual void Set_Shape(const ShapeSet *data, int width = 0, int height = 0); 47 | 48 | const ShapeSet *Get_Shape_Data() { return ShapeData; } 49 | 50 | public: 51 | bool ReflectButtonState; 52 | int DrawX; 53 | int DrawY; 54 | bool DrawnOnSidebarSurface; 55 | ConvertClass *ShapeDrawer; 56 | bool IsDrawn; 57 | bool DrawAlpha; 58 | const ShapeSet *ShapeData; 59 | }; 60 | -------------------------------------------------------------------------------- /src/ui/statbtn.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file STATBTN.H 8 | * 9 | * @authors CCHyper, tomsons26 10 | * 11 | * @brief 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "gadget.h" 31 | #include "buff.h" 32 | #include "textprint.h" 33 | 34 | 35 | class StaticButtonClass : public GadgetClass 36 | { 37 | public: 38 | StaticButtonClass(); 39 | StaticButtonClass(unsigned id, const char *text, TextPrintType style, int x, int y, int w = -1, int h = -1); 40 | virtual ~StaticButtonClass(); 41 | 42 | virtual bool Draw_Me(bool forced = false) override; 43 | 44 | virtual void Set_Text(const char *text, bool resize = false); 45 | virtual void Draw_Background(); 46 | virtual void Draw_Text(const char *text); 47 | 48 | public: 49 | Buffer Background; 50 | char *String; 51 | TextPrintType PrintFlags; 52 | }; 53 | -------------------------------------------------------------------------------- /src/ui/toggle.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file TOGGLE.H 8 | * 9 | * @authors CCHyper, tomsons26 10 | * 11 | * @brief Gadgets that behave like the Windows buttons. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "gcntrl.h" 31 | 32 | 33 | class ToggleClass : public ControlClass 34 | { 35 | public: 36 | ToggleClass(unsigned id, int x, int y, int w, int h); 37 | ~ToggleClass(); 38 | 39 | virtual bool Action(unsigned flags, KeyNumType &key) override; 40 | 41 | void Turn_On(); 42 | void Turn_Off(); 43 | 44 | public: 45 | bool IsPressed; 46 | bool IsOn; 47 | bool IsToggleType; 48 | }; 49 | -------------------------------------------------------------------------------- /src/ui/txtlabel.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file TXTLABEL.H 8 | * 9 | * @authors CCHyper, tomsons26 10 | * 11 | * @brief Text label gadget. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "gadget.h" 31 | #include "colorscheme.h" 32 | #include "textprint.h" 33 | 34 | 35 | class TextLabelClass : public GadgetClass 36 | { 37 | public: 38 | TextLabelClass(const char *txt, int x, int y, ColorSchemeType color, TextPrintType style); 39 | ~TextLabelClass(); 40 | 41 | virtual bool Draw_Me(bool forced = false) override; 42 | 43 | virtual void Set_Text(const char *txt); 44 | 45 | public: 46 | unsigned long UserData1; 47 | unsigned long UserData2; 48 | TextPrintType Style; 49 | const char *Text; 50 | ColorSchemeType Color; 51 | int PixWidth; 52 | }; 53 | -------------------------------------------------------------------------------- /src/veterancy.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file VETERANCY.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Unit veterancy level. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "tibsun_defines.h" 32 | 33 | 34 | class NoInitClass; 35 | 36 | 37 | class VeterancyClass 38 | { 39 | public: 40 | VeterancyClass(); 41 | VeterancyClass(const NoInitClass &noinit); 42 | ~VeterancyClass(); 43 | 44 | void Gain_Experience(int cost, int value); 45 | 46 | bool Is_Veteran() const; 47 | bool Is_Rookie() const; 48 | bool Is_Dumbass() const; 49 | bool Is_Elite() const; 50 | 51 | double sub_664440(double a1); 52 | 53 | void Set_Dumbass(bool dumbass); 54 | void Set_Rookie(bool a1); 55 | void Set_Veteran(bool force); 56 | void Set_Elite(bool force); 57 | 58 | // Used for Read/Write INI. 59 | int To_Integer(); 60 | void From_Integer(int value); 61 | 62 | private: 63 | double Level; 64 | }; 65 | -------------------------------------------------------------------------------- /src/vox.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file VOX.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief EVA speech. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "ttimer.h" 31 | #include "stimer.h" 32 | #include "tibsun_defines.h" 33 | #include "tspp.h" 34 | 35 | 36 | void Speak(VoxType voice, bool a2 = false); 37 | void Speak_AI(); 38 | void Stop_Speaking(); 39 | bool Is_Speaking(); 40 | void Set_Speech_Volume(int vol); 41 | 42 | 43 | extern int &SpeechVolume; 44 | extern bool &IsSpeechAllowed; 45 | 46 | extern CDTimerClass &SpeakTimer; 47 | 48 | ARRAY_DEC(void *, SpeechBuffer, 2); 49 | ARRAY_DEC(VoxType, SpeechRecord, 2); 50 | extern VoxType &SpeakQueue; 51 | extern VoxType &CurrentVoice; 52 | 53 | ARRAY_DEC(char const *, Speech, VOX_COUNT); 54 | 55 | -------------------------------------------------------------------------------- /src/voxel/motionlib.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file MOTIONLIB.H 8 | * 9 | * @authors tomsons26, CCHyper 10 | * 11 | * @brief 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | class FileClass; 34 | class Matrix3D; 35 | 36 | 37 | class MotionLibraryClass 38 | { 39 | public: 40 | MotionLibraryClass(); 41 | MotionLibraryClass(FileClass *file); 42 | ~MotionLibraryClass(); 43 | 44 | void Clear(); 45 | bool Read_File(FileClass *file); 46 | void Scale(float scale); 47 | 48 | bool Load_Failed() const { return LoadFailed; } 49 | int Get_Section_Count() const { return LayerCount; } 50 | int Get_Layer_Count() const { return FrameCount; } 51 | const Matrix3D &Get_Layer_Matrices() const { return *LayerMatrices; } 52 | 53 | private: 54 | bool LoadFailed; 55 | int LayerCount; 56 | int FrameCount; 57 | Matrix3D *LayerMatrices; 58 | }; 59 | -------------------------------------------------------------------------------- /src/voxel/staticbuffer.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file STATICBUFFER.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "tibsun_defines.h" 32 | #include "rect.h" 33 | #include "point.h" 34 | 35 | 36 | class BSurface; 37 | 38 | 39 | struct DataStruct 40 | { 41 | TRect Area; 42 | void * BufferPos; 43 | }; 44 | 45 | struct AreaStruct 46 | { 47 | Point2D Pos; 48 | Rect Size; 49 | }; 50 | 51 | 52 | class StaticBufferClass 53 | { 54 | public: 55 | StaticBufferClass(unsigned int size); 56 | ~StaticBufferClass(); 57 | 58 | DataStruct * Write_To_Surface(BSurface &surface, AreaStruct &bounds); 59 | DataStruct * Write_To_Surface(BSurface &surface, Rect &rect, TPoint2D); 60 | 61 | public: 62 | int BufferSize; 63 | void * BufferPtr; 64 | void * CurrentBufferPtr; 65 | }; 66 | -------------------------------------------------------------------------------- /src/voxel/voxeldraw.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file VOXELDRAW.H 8 | * 9 | * @authors tomsons26, CCHyper 10 | * 11 | * @brief Functions for drawing voxels to surfaces. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | -------------------------------------------------------------------------------- /src/voxel/voxelglobals.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file VOXELGLOBALS.H 8 | * 9 | * @authors tomsons26, CCHyper 10 | * 11 | * @brief Various globals for the voxel system. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "voxel.hh" 32 | 33 | 34 | extern int VPL_RemapStart; 35 | extern int VPL_RemapEnd; 36 | extern int VPL_SectionCount; 37 | extern int VPL_field_C; 38 | 39 | 40 | extern RGBStruct Voxel_Palette[VOXEL_PALETTE_SIZE]; 41 | extern unsigned char Voxel_PaletteLookup[MAX_PALETTE_LOOKUP_ENTRIES][VOXEL_PALETTE_SIZE]; 42 | -------------------------------------------------------------------------------- /src/voxel/voxelinit.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file VOXELINIT.H 8 | * 9 | * @authors tomsons26, CCHyper 10 | * 11 | * @brief 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "voxel.hh" 32 | 33 | 34 | class FileClass; 35 | 36 | 37 | void Init_Voxel_Lighting(float theta); 38 | void Init_Voxel_Projections(); 39 | bool Init_Voxel_Palette(FileClass *file); 40 | -------------------------------------------------------------------------------- /src/voxel/voxelnormal.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file VOXELNORMAL.H 8 | * 9 | * @authors tomsons26, CCHyper 10 | * 11 | * @brief Functions for applying lighting to a voxel based on its source. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | #include "voxel.hh" 32 | 33 | 34 | class Vector3; 35 | 36 | 37 | /** 38 | * The available normal shading table types. 39 | */ 40 | typedef enum VoxelNormalType 41 | { 42 | NORMAL_NONE, 43 | 44 | NORMAL_1, // Low 45 | NORMAL_2, 46 | NORMAL_3, 47 | NORMAL_4, // High 48 | 49 | NORMAL_COUNT 50 | }; 51 | 52 | 53 | void Voxel_Calc_Normal_To_Pal_Indexes(const Vector3 &voxel, int normal_type); 54 | void Voxel_Calc_Normal_To_Pal_Indexes(const Vector3 &light, const Vector3 &voxel, float value, int normal_type); 55 | int Voxel_Find_Best_Normal_Index(const Vector3 &voxel, int normal_type); 56 | void Init_Voxel_Normal_Indexes(); 57 | -------------------------------------------------------------------------------- /src/waypoint.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file WAYPOINT.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Waypoint location container. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | 31 | #include "always.h" 32 | #include "abstract.h" 33 | #include "vector.h" 34 | 35 | 36 | class WaypointClass 37 | { 38 | public: 39 | WaypointClass(); 40 | ~WaypointClass(); 41 | 42 | bool operator==(const WaypointClass &that) const { return Coord == that.Coord; } 43 | bool operator!=(const WaypointClass &that) const { return Coord != that.Coord; } 44 | 45 | public: 46 | Coordinate Coord; 47 | }; 48 | 49 | 50 | const char *Waypoint_As_String(int num); 51 | int Waypoint_From_String(const char *string); 52 | -------------------------------------------------------------------------------- /src/windialog.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | /* O P E N S O U R C E -- T S + + ** 3 | /******************************************************************************* 4 | * 5 | * @project TS++ 6 | * 7 | * @file WINDIALOG.H 8 | * 9 | * @authors CCHyper 10 | * 11 | * @brief Functions for handling the games owner draw dialogs. 12 | * 13 | * @license TS++ is free software: you can redistribute it and/or 14 | * modify it under the terms of the GNU General Public License 15 | * as published by the Free Software Foundation, either version 16 | * 3 of the License, or (at your option) any later version. 17 | * 18 | * TS++ is distributed in the hope that it will be 19 | * useful, but WITHOUT ANY WARRANTY; without even the implied 20 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 21 | * PURPOSE. See the GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public 24 | * License along with this program. 25 | * If not, see . 26 | * 27 | ******************************************************************************/ 28 | #pragma once 29 | 30 | #include "always.h" 31 | 32 | 33 | namespace WinDialogClass 34 | { 35 | 36 | void Display_Dialog(HWND hWnd); 37 | void End_Dialog(HWND hWnd); 38 | HWND Do_Message_Box(const char* button1, const char* button2, bool* state); 39 | bool Dialog_Move(HWND hWnd, WPARAM wParam, LPARAM lParam, UINT uMsg); 40 | bool Center_Window(HWND dialog); 41 | bool Center_Window_Within(HWND dialog, HWND window); 42 | 43 | extern HWND &CurrentWindowHandle; 44 | 45 | }; 46 | --------------------------------------------------------------------------------