id
int64
0
877k
file_name
stringlengths
3
109
file_path
stringlengths
13
185
content
stringlengths
31
9.38M
size
int64
31
9.38M
language
stringclasses
1 value
extension
stringclasses
11 values
total_lines
int64
1
340k
avg_line_length
float64
2.18
149k
max_line_length
int64
7
2.22M
alphanum_fraction
float64
0
1
repo_name
stringlengths
6
66
repo_stars
int64
94
47.3k
repo_forks
int64
0
12k
repo_open_issues
int64
0
3.4k
repo_license
stringclasses
11 values
repo_extraction_date
stringclasses
197 values
exact_duplicates_redpajama
bool
2 classes
near_duplicates_redpajama
bool
2 classes
exact_duplicates_githubcode
bool
2 classes
exact_duplicates_stackv2
bool
1 class
exact_duplicates_stackv1
bool
2 classes
near_duplicates_githubcode
bool
2 classes
near_duplicates_stackv1
bool
2 classes
near_duplicates_stackv2
bool
1 class
1,542,723
fontshooks.h
VladimirMakeev_D2ModdingToolset/mss32/include/fontshooks.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2023 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FONTSHOOKS_H #define FONTSHOOKS_H namespace game { struct FontCacheData; } namespace hooks { bool __stdcall loadFontFilesHooked(const char* interfFolder); void __fastcall fontCacheDataDtorHooked(game::FontCacheData* thisptr, int /*%edx*/); } // namespace hooks #endif // FONTSHOOKS_H
1,111
C++
.h
28
37.821429
84
0.771375
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,724
umattack.h
VladimirMakeev_D2ModdingToolset/mss32/include/umattack.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2020 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UMATTACK_H #define UMATTACK_H #include "attackmodified.h" #include "textandid.h" #include "ummodifier.h" #include "ussoldier.h" #include "usunit.h" #include <cstddef> namespace game { struct CUmAttackData; struct GlobalData; struct CDBTable; struct CUmAttack { IUsUnit usUnit; IUsSoldier usSoldier; CUmModifier umModifier; CUmAttackData* data; }; assert_size(CUmAttack, 24); struct CUmAttackData { ModifierValue qtyDamage; ModifierValue power; ModifierValue initiative; ModifierValue attackDrain; TextAndId desc; CAttackModified attackModified; }; assert_size(CUmAttackData, 52); static inline CUmAttack* castSoldierToUmAttack(const IUsSoldier* soldier) { return reinterpret_cast<CUmAttack*>((std::uintptr_t)soldier - offsetof(CUmAttack, usSoldier)); } namespace CUmAttackApi { struct Api { using Constructor = CUmAttack*(__thiscall*)(CUmAttack* thisptr, const CMidgardID* modifierId, CDBTable* dbTable, const GlobalData** globalData); Constructor constructor; using CopyConstructor = CUmAttack*(__thiscall*)(CUmAttack* thisptr, const CUmAttack* src); CopyConstructor copyConstructor; using DataConstructor = CUmAttackData*(__thiscall*)(CUmAttackData* thisptr); DataConstructor dataConstructor; using DataCopyConstructor = CUmAttackData*(__thiscall*)(CUmAttackData* thisptr, const CUmAttackData* src); DataCopyConstructor dataCopyConstructor; using ReadData = void(__stdcall*)(CDBTable* dbTable, CUmAttackData* value, const GlobalData** globalData); ReadData readData; }; Api& get(); struct Vftable { const IUsUnitVftable* usUnit; const IUsSoldierVftable* usSoldier; const CUmModifierVftable* umModifier; }; Vftable& vftable(); } // namespace CUmAttackApi } // namespace game #endif // UMATTACK_H
2,914
C++
.h
83
29.120482
98
0.698932
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,725
cursorhandle.h
VladimirMakeev_D2ModdingToolset/mss32/include/cursorhandle.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef CURSORHANDLE_H #define CURSORHANDLE_H #include "d2list.h" #include "mqpoint.h" #include "mqrect.h" #include "smartptr.h" namespace game { struct IMqImage2; struct CursorHandleNodeData { SmartPtr<IMqImage2> image; CMqPoint imageHalfSize; CMqRect area; int unknown; }; assert_size(CursorHandleNodeData, 36); struct CursorHandleData { List<CursorHandleNodeData> list; CMqRect area; }; assert_size(CursorHandleData, 32); struct CursorHandle { CursorHandleData* data; }; assert_size(CursorHandle, 4); /** Cursor types supported in game and their image names. */ enum class CursorType : int { Default, /**< DEFAULT */ Wait, /**< WAIT */ Alliance, /**< ALLIANCE */ Battle, /**< BATTLE */ Negotiate, /**< NEGO */ EnterCity, /**< ENTERCITY */ Move, /**< MOVE */ SelectUnit, /**< SELECTUNIT */ SelectCity, /**< SELECTCITY */ ViewCity, /**< VIEWCITY */ ManageStack, /**< MANAGESTK */ ScrollValid, /**< SCROLLVAL */ ScrollInvalid, /**< SCROLLINV */ SpellValid, /**< SPELLVAL */ SpellInvalid, /**< SPELLINV */ TakBag, /**< TAKEBAG */ Exchange, /**< EXCHANGE */ Visit, /**< VISIT */ DropBag, /**< DROPBAG */ DropRodValid, /**< DROPRODVAL */ DropRodInvalid, /**< DROPRODINV */ BreakRod, /**< BREAKROD */ NoDragDrop, /**< NODRAGDROP */ DismissValid, /**< DISMISSVAL */ DismissInvalid, /**< DISMISSINV */ HealValid, /**< HEALVAL */ HealInvalid, /**< HEALINV */ ReviveValid, /**< REVIVEVAL */ ReviveInvalid, /**< REVIVEINV */ DynLevelValid, /**< DYNLEVELVAL */ DynLevelInvalid, /**< DYNLEVELINV */ }; namespace CursorHandleApi { struct Api { /** Creates CursorHandle from specified cursorType. */ using Create = CursorHandle*(__stdcall*)(const CursorType* cursorType); Create create; }; Api& get(); } // namespace CursorHandleApi } // namespace game #endif // CURSORHANDLE_H
2,923
C++
.h
91
28.945055
75
0.647247
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,726
pickupdropinterf.h
VladimirMakeev_D2ModdingToolset/mss32/include/pickupdropinterf.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PICKUPDROPINTERF_H #define PICKUPDROPINTERF_H #include "middatacache.h" #include "middragdropinterf.h" #include "resetstackext.h" #include "smartptr.h" #include <cstddef> namespace game { struct CPickUpDropInterfData { CMidgardID stackId; int unknown; int unknown2; CMidgardID bagId; char unknown3[56]; }; assert_size(CPickUpDropInterfData, 72); /** * Shows window of exchange between stack and treasure chest. * Represents DLG_PICKUP_DROP from Interf.dlg. */ struct CPickUpDropInterf : public CMidDataCache2::INotify { IResetStackExt resetStackExt; CMidDragDropInterf dragDropInterf; CPickUpDropInterfData* data; }; assert_size(CPickUpDropInterf, 40); assert_offset(CPickUpDropInterf, dragDropInterf, 8); namespace CPickUpDropInterfApi { struct Api { using Constructor = CPickUpDropInterf*(__thiscall*)(CPickUpDropInterf* thisptr, void* taskOpenInterf, CPhaseGame* phaseGame, CMidgardID* stackId, CMidgardID* bagId); Constructor constructor; struct ButtonCallback { using Callback = void(__thiscall*)(CPickUpDropInterf* thisptr); Callback callback; int unknown; }; using CreateButtonFunctor = SmartPointer*(__stdcall*)(SmartPointer* functor, int a2, CPickUpDropInterf* pickupInterf, ButtonCallback* callback); CreateButtonFunctor createButtonFunctor; }; Api& get(); } // namespace CPickUpDropInterfApi } // namespace game #endif // PICKUPDROPINTERF_H
2,673
C++
.h
72
28.930556
90
0.654932
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,727
midcondscript.h
VladimirMakeev_D2ModdingToolset/mss32/include/midcondscript.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MIDCONDSCRIPT_H #define MIDCONDSCRIPT_H namespace game { struct CMidEvCondition; struct String; struct IMidgardObjectMap; struct LEventCondCategory; struct ITask; struct CMidgardID; struct ITestCondition; namespace editor { struct CCondInterf; } } // namespace game namespace hooks { game::CMidEvCondition* createMidCondScript(); void __stdcall midCondScriptGetInfoString(game::String* info, const game::IMidgardObjectMap* objectMap, const game::CMidEvCondition* eventCondition); game::editor::CCondInterf* createCondScriptInterf(game::ITask* task, void* a2, const game::CMidgardID* eventId); game::ITestCondition* createTestScript(game::CMidEvCondition* eventCondition); } // namespace hooks #endif // MIDCONDSCRIPT_H
1,734
C++
.h
43
34.395349
87
0.710119
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,728
menurandomscenariosingle.h
VladimirMakeev_D2ModdingToolset/mss32/include/menurandomscenariosingle.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2023 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MENURANDOMSCENARIOSINGLE_H #define MENURANDOMSCENARIOSINGLE_H namespace game { struct CMenuBase; struct CMenuPhase; } // namespace game namespace hooks { game::CMenuBase* __stdcall createMenuRandomScenarioSingle(game::CMenuPhase* menuPhase); } // namespace hooks #endif // MENURANDOMSCENARIOSINGLE_H
1,126
C++
.h
28
38.392857
87
0.782051
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,729
roomscallback.h
VladimirMakeev_D2ModdingToolset/mss32/include/roomscallback.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ROOMSCALLBACK_H #define ROOMSCALLBACK_H #ifdef __INTEGRATE_LOBBY2_WITH_ROOMS_PLUGIN #include <RoomsPlugin.h> #endif namespace hooks { class RoomsLoggingCallback : public SLNet::RoomsCallback { public: RoomsLoggingCallback() = default; ~RoomsLoggingCallback() override = default; void CreateRoom_Callback(const SLNet::SystemAddress& senderAddress, SLNet::CreateRoom_Func* callResult) override; void EnterRoom_Callback(const SLNet::SystemAddress& senderAddress, SLNet::EnterRoom_Func* callResult) override; void LeaveRoom_Callback(const SLNet::SystemAddress& senderAddress, SLNet::LeaveRoom_Func* callResult) override; void RoomMemberLeftRoom_Callback(const SLNet::SystemAddress& senderAddress, SLNet::RoomMemberLeftRoom_Notification* notification) override; void RoomMemberJoinedRoom_Callback( const SLNet::SystemAddress& senderAddress, SLNet::RoomMemberJoinedRoom_Notification* notification) override; }; } // namespace hooks #endif // ROOMSCALLBACK_H
1,949
C++
.h
43
39.813953
100
0.73562
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,730
midunitdescriptor.h
VladimirMakeev_D2ModdingToolset/mss32/include/midunitdescriptor.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MIDUNITDESCRIPTOR_H #define MIDUNITDESCRIPTOR_H #include "encunitdescriptor.h" #include "midgardid.h" namespace game { struct IAttack; struct IUsSoldier; struct IMidgardObjectMap; struct CMidUnit; struct CMidUnitDescriptor : public IEncUnitDescriptor { IMidgardObjectMap* objectMap; CMidgardID* playerId; CMidgardID unitId; CMidgardID groupId; CMidUnit* unit; }; assert_size(CMidUnitDescriptor, 24); namespace CMidUnitDescriptorApi { struct Api { using Constructor = CMidUnitDescriptor*(__thiscall*)(CMidUnitDescriptor* thisptr, const IMidgardObjectMap* objectMap, const CMidgardID* unitId, const CMidgardID* playerId); Constructor constructor; using GetSoldier = IUsSoldier*(__thiscall*)(const CMidUnitDescriptor* thisptr); GetSoldier getSoldier; using GetAttack = IAttack*(__thiscall*)(const CMidUnitDescriptor* thisptr); GetAttack getAttack; using GetAltAttack = IAttack*(__thiscall*)(const CMidUnitDescriptor* thisptr); GetAltAttack getAltAttack; }; Api& get(); const IEncUnitDescriptorVftable* vftable(); } // namespace CMidUnitDescriptorApi } // namespace game #endif // MIDUNITDESCRIPTOR_H
2,157
C++
.h
56
32.946429
92
0.718945
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,731
interfdialog.h
VladimirMakeev_D2ModdingToolset/mss32/include/interfdialog.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2020 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef INTERFDIALOG_H #define INTERFDIALOG_H #include "interface.h" #include <cstddef> namespace game { struct CInterfDialog : public CInterface { int unknown; }; assert_offset(CInterfDialog, unknown, 8); } // namespace game #endif // INTERFDIALOG_H
1,074
C++
.h
30
33.866667
72
0.766635
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,732
encparamidplayer.h
VladimirMakeev_D2ModdingToolset/mss32/include/encparamidplayer.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2023 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ENCPARAMPLAYERID_H #define ENCPARAMPLAYERID_H #include "encparambase.h" #include "midgardid.h" namespace game { struct CEncParamIDPlayer : CEncParamBase { CMidgardID objectId; CMidgardID* playerId; }; assert_size(CEncParamIDPlayer, 16); } // namespace game #endif // ENCPARAMPLAYERID_H
1,122
C++
.h
31
34.16129
72
0.77214
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,733
mqimage2surface16.h
VladimirMakeev_D2ModdingToolset/mss32/include/mqimage2surface16.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MQIMAGE2SURFACE16_H #define MQIMAGE2SURFACE16_H #include "mqimage2.h" #include "mqtexture.h" #include "smartptr.h" #include "texturehandle.h" #include <cstddef> namespace game { struct CMqPresentationManager; struct CMqImage2Surface16 : public IMqImage2 , public IMqTexture { SmartPtr<CMqPresentationManager> presentationMgr; TextureHandle textureHandle; CMqPoint size; bool dirty; char padding[3]; }; assert_size(CMqImage2Surface16, 44); assert_offset(CMqImage2Surface16, size, 32); namespace CMqImage2Surface16Api { struct Api { using Constructor = CMqImage2Surface16*(__thiscall*)(CMqImage2Surface16* thisptr, std::uint32_t width, std::uint32_t height, int hint, int opacity); Constructor constructor; }; Api& get(); } // namespace CMqImage2Surface16Api } // namespace game #endif // MQIMAGE2SURFACE16_H
1,903
C++
.h
53
29.377358
85
0.680087
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,734
umattackhooks.h
VladimirMakeev_D2ModdingToolset/mss32/include/umattackhooks.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UMATTACKHOOKS_H #define UMATTACKHOOKS_H namespace game { struct CMidgardID; struct GlobalData; struct CDBTable; struct IAttack; struct IUsSoldier; struct CUmAttack; struct CAttackModified; } // namespace game namespace hooks { game::CAttackModified* getAltAttackModified(const game::CUmAttack* umAttack); game::CUmAttack* __fastcall umAttackCtorHooked(game::CUmAttack* thisptr, int /*%edx*/, const game::CMidgardID* modifierId, game::CDBTable* dbTable, const game::GlobalData** globalData); game::CUmAttack* __fastcall umAttackCopyCtorHooked(game::CUmAttack* thisptr, int /*%edx*/, const game::CUmAttack* src); } // namespace hooks #endif // UMATTACKHOOKS_H
1,777
C++
.h
41
34.658537
84
0.65162
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,735
terraincat.h
VladimirMakeev_D2ModdingToolset/mss32/include/terraincat.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TERRAINCAT_H #define TERRAINCAT_H #include "categories.h" namespace game { struct LTerrainCategoryTable : public CEnumConstantTable<TerrainId> { }; struct LTerrainCategory : public Category<TerrainId> { }; namespace TerrainCategories { struct Categories { LTerrainCategory* human; LTerrainCategory* heretic; LTerrainCategory* dwarf; LTerrainCategory* undead; LTerrainCategory* neutral; LTerrainCategory* elf; }; Categories& get(); /** Returns address of LTerrainCategory::vftable used in game. */ const void* vftable(); } // namespace TerrainCategories namespace LTerrainCategoryTableApi { using Api = CategoryTableApi::Api<LTerrainCategoryTable, LTerrainCategory>; Api& get(); /** Returns address of LTerrainCategoryTable::vftable used in game. */ const void* vftable(); } // namespace LTerrainCategoryTableApi } // namespace game #endif // TERRAINCAT_H
1,716
C++
.h
48
33.541667
75
0.77771
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,736
borderedimg.h
VladimirMakeev_D2ModdingToolset/mss32/include/borderedimg.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2023 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef BORDEREDIMG_H #define BORDEREDIMG_H #include "d2vector.h" #include "mqimage2.h" #include "mqpoint.h" namespace game { struct CBorderedImgData; struct CBorderedImg : public IMqImage2 { CBorderedImgData* data; }; assert_size(CBorderedImg, 8); struct CBorderedImgData { CMqPoint borderSize; Vector<IMqImage2*> images; }; assert_size(CBorderedImgData, 24); /** Corresponds to border image from Icons.ff. */ enum class BorderType : int { None = 0, UnitSmall, // BORDERUNITSMALL UnitLarge, // BORDERUNITLARGE LordSmall, // BORDERLORDSMALL LordLarge, // BORDERLORDLARGE Item, // BORDERITEM }; namespace CBorderedImgApi { struct Api { using Constructor = CBorderedImg*(__thiscall*)(CBorderedImg* thisptr, BorderType borderType); Constructor constructor; using AddImage = void(__thiscall*)(CBorderedImg* thisptr, IMqImage2* image); AddImage addImage; }; Api& get(); } // namespace CBorderedImgApi } // namespace game #endif // BORDEREDIMG_H
1,826
C++
.h
58
29.017241
97
0.755708
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,737
surfacedecompressdata.h
VladimirMakeev_D2ModdingToolset/mss32/include/surfacedecompressdata.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SURFACEDECOMPRESSDATA_H #define SURFACEDECOMPRESSDATA_H #include "d2color.h" #include "mqrect.h" #include <cstdint> #include <windows.h> namespace game { /** 'BlitObject' in Verok's DisciplesGL. */ struct SurfaceDecompressData { int noPalette; /**< Value of zero means paletteEntries contain valid data. */ void* surfaceMemory; /**< Initialized from DDSURFACEDESC2::lpSurface value. */ CMqRect textureArea; /** * Initialized from DDSURFACEDESC2::lPitch value. * Specifies the number of bytes between the beginnings of two adjacent scan lines; * that is, the number of bytes to add to the beginning address of one scan line * to reach the beginning address of the next scan line below it. */ int pitch; Color convertedColor; PALETTEENTRY paletteEntries[256]; std::uint32_t rBitMask; std::uint32_t gBitMask; std::uint32_t bBitMask; std::uint32_t alphaBitMask; }; assert_size(SurfaceDecompressData, 1072); namespace SurfaceDecompressDataApi { struct Api { /** Converts 32-bit color to 16-bit according to surface data settings. */ using ConvertColor = std::uint16_t(__thiscall*)(const SurfaceDecompressData* thisptr, const Color* color); ConvertColor convertColor; /** Fills specified area with plain color. */ using FillArea = void(__thiscall*)(SurfaceDecompressData* thisptr, std::uint16_t convertedColor, const CMqRect* area); FillArea fillArea; using SetColor = void(__thiscall*)(SurfaceDecompressData* thisptr, Color color); SetColor setColor; /** * Draws text string into surface. * Text string can contain color and font specificators. * @param[in] text text string to draw. * @param[in] area area which text should occupy. * @param[in] pos top-left starting position of text inside area. * @param a5 meaning unknown. */ using DrawTextString = void(__stdcall*)(SurfaceDecompressData* surfaceData, const char* text, const CMqRect* area, const CMqPoint* pos, bool a5); DrawTextString drawTextString; }; Api& get(); } // namespace SurfaceDecompressDataApi } // namespace game #endif // SURFACEDECOMPRESSDATA_H
3,305
C++
.h
79
34.696203
89
0.671233
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,738
interfborderdisplay.h
VladimirMakeev_D2ModdingToolset/mss32/include/interfborderdisplay.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef INTERFBORDERDISPLAY_H #define INTERFBORDERDISPLAY_H #include "d2assert.h" namespace game { struct IInterfBorderDisplayVftable; struct IMqRenderer2; struct IInterfBorderDisplay { IInterfBorderDisplayVftable* vftable; }; struct IInterfBorderDisplayVftable { using Destructor = void(__thiscall*)(IInterfBorderDisplay* thisptr, char flags); Destructor destructor; using Draw = void(__thiscall*)(IInterfBorderDisplay* thisptr, IMqRenderer2* renderer); Draw draw; }; assert_vftable_size(IInterfBorderDisplayVftable, 2); } // namespace game #endif // INTERFBORDERDISPLAY_H
1,416
C++
.h
38
35.026316
90
0.782895
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,739
modifierutils.h
VladimirMakeev_D2ModdingToolset/mss32/include/modifierutils.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MODIFIERUTILS_H #define MODIFIERUTILS_H #include "battlemsgdata.h" #include "idlist.h" #include "immunecat.h" #include "midgardid.h" #include <set> namespace game { struct IMidgardObjectMap; struct IUsUnit; struct CMidUnit; struct UnitInfo; struct TUnitModifier; struct CUmModifier; struct CUmUnit; struct CUmAttack; struct CUmStack; struct LAttackSource; struct LAttackClass; struct IAttack; enum class ModifierElementTypeFlag : int; } // namespace game namespace hooks { bool unitCanBeModified(game::BattleMsgData* battleMsgData, game::CMidgardID* targetUnitId); game::CUmUnit* castUmModifierToUmUnit(game::CUmModifier* modifier); game::CUmAttack* castUmModifierToUmAttack(game::CUmModifier* modifier); game::CUmStack* castUmModifierToUmStack(game::CUmModifier* modifier); game::IUsUnit* castUmModifierToUnit(game::CUmModifier* modifier); game::CUmModifier* castUnitToUmModifier(const game::IUsUnit* unit); game::CUmModifier* getFirstUmModifier(const game::IUsUnit* unit); const game::TUnitModifier* getUnitModifier(const game::CMidgardID* modifierId); void getModifierAttackSource(game::CUmUnit* modifier, game::LAttackSource* value); void getModifierAttackClass(game::CUmUnit* modifier, game::LAttackClass* value); bool isUnitAttackSourceWardRemoved(game::AttackSourceImmunityStatusesPatched immunityStatuses, const game::LAttackSource* attackSource); void resetUnitAttackSourceWard(game::BattleMsgData* battleMsgData, const game::CMidgardID* unitId, game::CUmUnit* modifier); bool isUnitAttackClassWardRemoved(std::uint32_t immunityStatuses, const game::LAttackClass* attackClass); void resetUnitAttackClassWard(game::BattleMsgData* battleMsgData, const game::CMidgardID* unitId, game::CUmUnit* modifier); bool canApplyImmunityModifier(game::BattleMsgData* battleMsgData, const game::CMidUnit* targetUnit, game::CUmUnit* modifier, game::ImmuneId immuneId); bool canApplyImmunityclassModifier(game::BattleMsgData* battleMsgData, const game::CMidUnit* targetUnit, game::CUmUnit* modifier, game::ImmuneId immuneId); bool canApplyModifier(game::BattleMsgData* battleMsgData, const game::CMidUnit* targetUnit, const game::CMidgardID* modifierId); bool canApplyAnyModifier(game::IAttack* attack, game::IMidgardObjectMap* objectMap, game::BattleMsgData* battleMsgData, game::CMidgardID* targetUnitId); void resetModifiedUnitsInfo(game::UnitInfo* unitInfo); bool addModifiedUnitInfo(const game::CMidgardID* unitId, game::BattleMsgData* battleMsgData, game::CMidUnit* targetUnit, const game::CMidgardID* modifierId); bool applyModifier(const game::CMidgardID* unitId, game::BattleMsgData* battleMsgData, game::CMidUnit* targetUnit, const game::CMidgardID* modifierId); void removeModifier(game::BattleMsgData* battleMsgData, game::CMidUnit* unit, const game::CMidgardID* modifierId); void removeModifiers(game::BattleMsgData* battleMsgData, game::IMidgardObjectMap* objectMap, game::UnitInfo* unitInfo, const game::CMidgardID* modifiedUnitId); std::set<game::CMidgardID> getModifiedUnitIds(game::UnitInfo* unitInfo); std::set<game::CMidgardID> getUnitModifierIds(game::UnitInfo* unitInfo, const game::CMidgardID* modifiedUnitId); game::IAttack* wrapAltAttack(const game::IUsUnit* unit, game::IAttack* attack); void getEditorModifiers(const game::CMidUnit* unit, game::IdList* value); int applyModifiers(int base, const game::IdList& modifiers, game::ModifierElementTypeFlag type); bool isImmunityModifier(const game::CMidgardID* modifierId, const game::LAttackSource* source, game::ImmuneId immuneId); bool isImmunityclassModifier(const game::CMidgardID* modifierId, const game::LAttackClass* class_, game::ImmuneId immuneId); void notifyModifiersChanged(const game::IUsUnit* unitImpl); bool addModifier(game::CMidUnit* unit, const game::CMidgardID* modifierId, bool checkCanApply); bool hasModifier(const game::IUsUnit* unitImpl, const game::CMidgardID* modifierId); } // namespace hooks #endif // MODIFIERUTILS_H
5,664
C++
.h
109
42.256881
96
0.689937
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,740
mqnetplayer.h
VladimirMakeev_D2ModdingToolset/mss32/include/mqnetplayer.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MQNETPLAYER_H #define MQNETPLAYER_H #include "d2assert.h" namespace game { struct String; struct IMqNetSession; struct IMqNetSystem; struct NetMessageHeader; struct IMqNetPlayerVftable; template <typename T = IMqNetPlayerVftable> struct IMqNetPlayerT { const T* vftable; }; /** * Interface for network players. * Player can be client or a server. * Single player and hotseat game logic also uses this interface. */ struct IMqNetPlayer : public IMqNetPlayerT<> { }; struct IMqNetPlayerVftable { using Destructor = void(__thiscall*)(IMqNetPlayer* thisptr, char flags); Destructor destructor; /** Returns player name. */ using GetName = String*(__thiscall*)(IMqNetPlayer* thisptr, String* string); GetName getName; /** Returns player network id. */ using GetNetId = int(__thiscall*)(IMqNetPlayer* thisptr); GetNetId getNetId; /** Returns the session the player is currently in. */ using GetSession = IMqNetSession*(__thiscall*)(IMqNetPlayer* thisptr); GetSession getSession; /** * Returns number of network messages in queue for player. * CNetDPlayPlayer calls IDirectPlay4::GetMessageCount here. */ using GetMessageCount = int(__thiscall*)(IMqNetPlayer* thisptr); GetMessageCount getMessageCount; /** * Sends network message to player with specified id. * CNetDPlayPlayer calls IDirectPlay4::SendEx here. * @returns true if the message was sent successfully. */ using SendNetMessage = bool(__thiscall*)(IMqNetPlayer* thisptr, int idTo, const NetMessageHeader* message); SendNetMessage sendMessage; /** * Receives network messages addressed to this player. * CNetDPlayPlayer calls IDirectPlay4::Receive with DPRECEIVE_TOPLAYER | DPRECEIVE_ALL here. * @param[inout] idFrom pointer to store network id of messages sender. * @param[inout] buffer buffer to receive messages. Must be at least 512Kb. */ using ReceiveMessage = int(__thiscall*)(IMqNetPlayer* thisptr, int* idFrom, NetMessageHeader* buffer); ReceiveMessage receiveMessage; /** Sets netSystem proxy for this player. */ using SetNetSystem = void(__thiscall*)(IMqNetPlayer* thisptr, IMqNetSystem* netSystem); SetNetSystem setNetSystem; using Method8 = int(__thiscall*)(IMqNetPlayer* thisptr, int a2); Method8 method8; }; assert_vftable_size(IMqNetPlayerVftable, 9); } // namespace game #endif // MQNETPLAYER_H
3,447
C++
.h
86
34.651163
96
0.706551
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,741
citystackinterfhooks.h
VladimirMakeev_D2ModdingToolset/mss32/include/citystackinterfhooks.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2023 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef CITYSTACKINTERFHOOKS_H #define CITYSTACKINTERFHOOKS_H namespace game { struct CCityStackInterf; struct IMidScenarioObject; } // namespace game namespace hooks { void __fastcall cityStackInterfOnObjectChangedHooked(game::CCityStackInterf* thisptr, int /*%edx*/, game::IMidScenarioObject* obj); } // namespace hooks #endif // CITYSTACKINTERFHOOKS_H
1,280
C++
.h
30
37.366667
85
0.716238
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,742
unitstovalidate.h
VladimirMakeev_D2ModdingToolset/mss32/include/unitstovalidate.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2023 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UNITSTOVALIDATE_H #define UNITSTOVALIDATE_H #include "midgardid.h" #include <set> namespace hooks { using UnitsToValidate = std::set<game::CMidgardID>; UnitsToValidate& getUnitsToValidate(); } // namespace hooks #endif // UNITSTOVALIDATE_H
1,068
C++
.h
27
37.666667
72
0.77176
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,743
mquikernel.h
VladimirMakeev_D2ModdingToolset/mss32/include/mquikernel.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MQUIKERNEL_H #define MQUIKERNEL_H #include "d2assert.h" #define WIN32_LEAN_AND_MEAN #include <Windows.h> #include <cstdint> namespace game { struct IMqUIKernelVftable; struct CMqPoint; struct CMqRect; struct IMqUIController; struct IMqUIKernel { IMqUIKernelVftable* vftable; }; struct IMqUIKernelVftable { using Destructor = void(__thiscall*)(IMqUIKernel* thisptr, char flags); Destructor destructor; using SetWindowPosition = bool(__thiscall*)(IMqUIKernel* thisptr, const CMqPoint* position); SetWindowPosition setWindowPosition; /** Dispatches messages, updates window, processes IMqUIController. */ using ProcessMessages = WPARAM(__thiscall*)(IMqUIKernel* thisptr); ProcessMessages processMessages; /** * Closes the application. * CMqUIKernelSimple posts WM_CLOSE message here. */ using Close = void(__thiscall*)(IMqUIKernel* thisptr); Close close; using SetUiController = void(__thiscall*)(IMqUIKernel* thisptr, IMqUIController* uiController); SetUiController setUiController; using GetUiController = IMqUIController*(__thiscall*)(const IMqUIKernel* thisptr); GetUiController getUiController; /** Usage case unknown.*/ using ShowEmptyMessage = int(__thiscall*)(const IMqUIKernel* thisptr, int a2, std::uint32_t type); ShowEmptyMessage showEmptyMessage; /** * Shows message box with specified text. * @param type determines contents and behaviour of the message box. One of the 'MB_' Windows * api macros. * CMqUIKernelSimple calls MessageBoxA here. */ using ShowMessage = int(__thiscall*)(const IMqUIKernel* thisptr, const char* text, std::uint32_t type); ShowMessage showMessage; using GetWindowTitle = const char*(__thiscall*)(const IMqUIKernel* thisptr); GetWindowTitle getWindowTitle; /** Flashes window to inform the user that window requires attention. */ using FlashNotification = bool(__thiscall*)(IMqUIKernel* thisptr, bool changeWndState); FlashNotification flashNotification; /** Returns handle of a game window. */ using GetWindowHandle = HWND(__thiscall*)(const IMqUIKernel* thisptr); GetWindowHandle getWindowHandle; using GetInstance = HINSTANCE(__thiscall*)(const IMqUIKernel* thisptr); /** Returns application instance. */ GetInstance getInstance; /** Assumption: returns copy of application instance. */ GetInstance getInstanceCopy; using SetInstanceCopy = void(__thiscall*)(IMqUIKernel* thisptr, HINSTANCE instance); SetInstanceCopy setInstanceCopy; /** * Returns system time in milliseconds. * CMqUIKernelSimple returns systemTime acquired from timeGetTime() in a message loop. */ using GetTime = int(__thiscall*)(const IMqUIKernel* thisptr); GetTime getTime; using GetMousePosition = CMqPoint*(__thiscall*)(const IMqUIKernel* thisptr, CMqPoint* mousePosition); /** Assumption: returns mouse position in client coordinates. */ GetMousePosition getMousePosClient; /** Assumption: returns mouse position in screen coordinates. */ GetMousePosition getMousePosScreen; /** * Sets current mouse position according to specified client coordinates. * CMqUIKernelSimple updates client and screen coordinates, sends WM_MOUSEMOVE message. */ using SetMousePosition = void(__thiscall*)(IMqUIKernel* thisptr, const CMqPoint* mousePosClient); SetMousePosition setMousePosition; /** Clips mouse cursor using specified area. */ using ClipCursor = void(__thiscall*)(IMqUIKernel* thisptr, const CMqRect* area); ClipCursor clipCursor; /** * Meaning unknown. * CMqUIKernelSimple sets unknown17 to false. */ using ResetUnknown17 = void(__thiscall*)(IMqUIKernel* thisptr); ResetUnknown17 resetUnknown17; /** Returns game window area. */ using GetClientArea = CMqRect*(__thiscall*)(const IMqUIKernel* thisptr, CMqRect* clientArea); GetClientArea getClientArea; /** Returns true if window has focus and is not minimised. */ using HasFocusAndShown = bool(__thiscall*)(const IMqUIKernel* thisptr); HasFocusAndShown hasFocusAndShown; /** Returns true if specified virtual key is pressed. */ using IsKeyDown = bool(__thiscall*)(const IMqUIKernel* thistr, int key); IsKeyDown isKeyDown; using InvalidateAndUpdate = void(__thiscall*)(IMqUIKernel* thisptr); InvalidateAndUpdate invalidateAndUpdate; /** * Registers new window message. * CMqUIKernelSimple calls RegisterWindowMessageA here. */ using RegisterMessage = std::uint32_t(__thiscall*)(IMqUIKernel* thisptr, const char* message); RegisterMessage registerMessage; /** * Posts specified message. * CMqUIKernelSimple calls PostMessageA here. */ using PostWndMessage = bool(__thiscall*)(const IMqUIKernel* thisptr, UINT Msg, WPARAM wParam, LPARAM lParam); PostWndMessage postMessage; /** * Adds timer with specified timout value in milliseconds. * CMqUIKernelSimple calls SetTimer here. * @returns id of created timer. */ using AddTimer = std::uint32_t(__thiscall*)(IMqUIKernel* thisptr, std::uint32_t timeoutMs); AddTimer addTimer; /** * Removes timer with specfied id. * CMqUIKernelSimple calls KillTimer here. */ using RemoveTimer = void(__thiscall*)(IMqUIKernel* thisptr, std::uint32_t timerId); RemoveTimer removeTimer; }; assert_vftable_size(IMqUIKernelVftable, 28); } // namespace game #endif // MQUIKERNEL_H
6,779
C++
.h
153
37.339869
99
0.694478
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,744
aispellcat.h
VladimirMakeev_D2ModdingToolset/mss32/include/aispellcat.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AISPELLCAT_H #define AISPELLCAT_H #include "categories.h" namespace game { struct LAiSpellCategoryTable : public CEnumConstantTable<AiSpellId> { }; struct LAiSpellCategory : public Category<AiSpellId> { }; } // namespace game #endif // AISPELLCAT_H
1,076
C++
.h
28
36.571429
72
0.771374
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,745
racetype.h
VladimirMakeev_D2ModdingToolset/mss32/include/racetype.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2020 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef RACETYPE_H #define RACETYPE_H #include "currency.h" #include "idvector.h" #include "midgardid.h" #include "midobject.h" #include "racecategory.h" #include "textandid.h" namespace game { struct GlobalData; struct LeaderName { char name[31]; bool male; }; assert_size(LeaderName, 32); /** Holds leader names read from TLeader.dbf. */ struct CRaceLeaderNames { void* vftable; CMidgardID raceId; Vector<LeaderName> names; }; assert_size(CRaceLeaderNames, 24); /** * Holds player descriptions read from TPlayer.dbf. * Must be 18 bytes according to TRaceType constructor. */ struct CRacePlayerDesc { char unknown[18]; }; /** Holds city information read from GCityInf.dbf. */ struct TRaceTypeCityInformation; struct TRaceTypeData { LRaceCategory raceType; TextAndId name; bool playable; char padding[3]; CMidgardID guardianUnitId; CMidgardID nobleUnitId; IdVector leaders; IdVector soldiers; int regen; int scout; Bank income; CMidgardID protectionModifierId; CRaceLeaderNames* leaderNames; CRacePlayerDesc* playerDesc1; CRacePlayerDesc* playerDesc2; TRaceTypeCityInformation* cityInfo; }; assert_size(TRaceTypeData, 104); /** Holds race information read from Grace.dbf. */ struct TRaceType : public IMidObject { TRaceTypeData* data; }; assert_size(TRaceType, 12); struct TRaceTypeVftable : public IMidObjectVftable { /** * Validates contents of TRaceType object. * Throws exception if race has invalid units, leaders or guardian. * Also checks for validity of unit branches and city protection modifiers. */ using Validate = void(__thiscall*)(TRaceType* thisptr, GlobalData** globalData); Validate validate; }; assert_vftable_size(TRaceTypeVftable, 2); } // namespace game #endif // RACETYPE_H
2,653
C++
.h
91
26.373626
84
0.756289
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,746
midsubrace.h
VladimirMakeev_D2ModdingToolset/mss32/include/midsubrace.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MIDSUBRACE_H #define MIDSUBRACE_H #include "midgardid.h" #include "midscenarioobject.h" #include "stringandid.h" #include "subracecat.h" namespace game { /** Represents subrace in scenario file and game. */ struct CMidSubRace : public IMidScenarioObject { LSubRaceCategory subraceCategory; CMidgardID playerId; StringAndId name; int banner; }; assert_size(CMidSubRace, 40); } // namespace game #endif // MIDSUBRACE_H
1,260
C++
.h
36
32.888889
72
0.767461
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,747
d2map.h
VladimirMakeev_D2ModdingToolset/mss32/include/d2map.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef D2MAP_H #define D2MAP_H #include "d2pair.h" #include "d2tree.h" namespace game { /** Implementation of std::map<K, T> used in game. */ template <typename K, typename T, typename Allocator = void*> using Map = Tree<Pair<K, T>, Allocator>; template <typename K, typename T> using MapNode = TreeNode<Pair<K, T>>; template <typename K, typename T> using MapIterator = TreeIterator<Pair<K, T>>; } // namespace game #endif // D2MAP_H
1,257
C++
.h
32
37.5
72
0.751027
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,748
ordercat.h
VladimirMakeev_D2ModdingToolset/mss32/include/ordercat.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2020 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ORDERCAT_H #define ORDERCAT_H #include "categories.h" namespace game { struct LOrderCategoryTable : public CEnumConstantTable<OrderId> { }; struct LOrderCategory : public Category<OrderId> { }; namespace OrderCategories { struct Categories { LOrderCategory* bezerk; LOrderCategory* normal; LOrderCategory* defendLocation; LOrderCategory* assist; LOrderCategory* guard; LOrderCategory* moveToLocation; LOrderCategory* roam; LOrderCategory* defendCity; LOrderCategory* defendStack; LOrderCategory* secureCity; LOrderCategory* steal; LOrderCategory* attackStack; LOrderCategory* stand; }; Categories& get(); } // namespace OrderCategories } // namespace game #endif // ORDERCAT_H
1,560
C++
.h
47
30.489362
72
0.768975
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,749
objectinterf.h
VladimirMakeev_D2ModdingToolset/mss32/include/objectinterf.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2024 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef OBJECTINTERF_H #define OBJECTINTERF_H #include "isoview.h" namespace game { namespace editor { struct CObjectInterfData { int selectedMode; }; assert_size(CObjectInterfData, 4); /** Represents DLG_OBJECTS from ScenEdit.dlg. */ struct CObjectInterf : public CIsoView { CObjectInterfData* objInterfData; }; assert_size(CObjectInterf, 24); } // namespace editor } // namespace game #endif // OBJECTINTERF_H
1,243
C++
.h
37
31.621622
72
0.769874
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,750
itemexspell.h
VladimirMakeev_D2ModdingToolset/mss32/include/itemexspell.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ITEMEXSPELL_H #define ITEMEXSPELL_H namespace game { struct IItemExSpell { void* vftable; }; } // namespace game #endif // ITEMEXSPELL_H
966
C++
.h
27
33.814815
72
0.762313
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,751
itemspell.h
VladimirMakeev_D2ModdingToolset/mss32/include/itemspell.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ITEMSPELL_H #define ITEMSPELL_H #include "itembase.h" #include "itemexspell.h" #include <cstddef> namespace game { /** Base class for all spell related items. */ struct CItemSpell : public IItemExSpell , public CItemBase { CMidgardID spellId; }; assert_size(CItemSpell, 20); assert_offset(CItemSpell, CItemSpell::IItemExSpell::vftable, 0); assert_offset(CItemSpell, CItemSpell::CItemBase::vftable, 4); assert_offset(CItemSpell, spellId, 16); } // namespace game #endif // ITEMSPELL_H
1,323
C++
.h
37
33.783784
72
0.76466
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,752
aiattitudes.h
VladimirMakeev_D2ModdingToolset/mss32/include/aiattitudes.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2023 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AIATTITUDES_H #define AIATTITUDES_H #include "categories.h" #include "d2assert.h" #include "textandid.h" namespace game { struct CAiAttitudesVftable; struct CAiAttitudesData; struct CAiAttitudes { CAiAttitudesVftable* vftable; CAiAttitudesData* data; }; assert_size(CAiAttitudes, 8); struct CAiAttitudesVftable { using Destructor = void(__thiscall*)(CAiAttitudes* thisptr, char flags); Destructor destructor; }; assert_vftable_size(CAiAttitudesVftable, 1); struct CAiAttitudesData { LAttitudesCategory attitudeCategory; TextAndId name; TextAndId description; int bUnits; int bLeaders; int bCap; int bCities; int bSpellR; int bSpellC; int bIso; int lMin; int lMax; int pctFighter; int tMin; int tMax; int pctThief; int rMin; int rMax; int pctRod; int iCitiesN; int iCitiesR; int iCitiesP; int iStacksN; int iStacksR; int iStacksP; int iBags; int iRuins; int iTowers; int iMerchant; int iHUnits; int iHMercs; int iHeal; int iNCities; int iNStack; int iPRod; int iARod; int iTrainer; int iObjM; int dEasyM; int dAvgM; int dHardM; int dVHardM; int dEasyXp; int dAvgXp; int dHardXp; int dVHardXp; int hpStayMin; int hpHealMin; int castChance; int castChance2; int castDblMin; int spell1Chance; int spell2Chance; int spell3Chance; int splHW; int splHC; int splMW; int splMC; int splLW; int splLC; int splL5Pow; int splL4Pow; int splL3Pow; int splL2Pow; int sritSplW1; int sritSplC1; int sritSplW2; int sritSplC2; int sritSplW3; int sritSplC3; int sritSplW4; int sritSplC4; }; assert_size(CAiAttitudesData, 304); } // namespace game #endif // AIATTITUDES_H
2,687
C++
.h
116
19.293103
76
0.713169
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,753
imagelayerlist.h
VladimirMakeev_D2ModdingToolset/mss32/include/imagelayerlist.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef IMAGELAYERLIST_H #define IMAGELAYERLIST_H #include "d2list.h" #include "d2pair.h" namespace game { struct IMqImage2; struct CIsoLayer; struct CFortification; struct IMidgardObjectMap; struct CMidgardID; using ImageLayerPair = Pair<IMqImage2*, const CIsoLayer*>; using ImageLayerList = List<ImageLayerPair>; namespace ImageLayerListApi { struct Api { /** Adds pair to the end of the list. */ using PushBack = void(__thiscall*)(ImageLayerList* thisptr, const ImageLayerPair* pair); PushBack pushBack; /** Clears list contents. */ using Clear = void(__thiscall*)(ImageLayerList* thisptr); Clear clear; /** * Adds shield image and iso layer pair to the list. * Shield image is shown above city entrance when there is stack guarding it. */ using AddShieldImageLayer = void(__stdcall*)(ImageLayerList* list, const CFortification* fortification, int capital, const IMidgardObjectMap* objectMap, const CMidgardID* playerId); AddShieldImageLayer addShieldImageLayer; }; Api& get(); } // namespace ImageLayerListApi } // namespace game #endif // IMAGELAYERLIST_H
2,133
C++
.h
54
33.37037
92
0.690707
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,754
rendertypes.h
VladimirMakeev_D2ModdingToolset/mss32/include/rendertypes.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef RENDERTYPES_H #define RENDERTYPES_H #include "d2assert.h" #include "d2list.h" #include "d2pair.h" #include "d2set.h" #include "mqrect.h" #include "texturehandle.h" #include <Windows.h> #include <cstdint> struct IDirectDrawSurface7; struct IDirectDrawPalette; namespace game { struct IMqTexture; struct RenderData22 { IMqTexture* texture; CMqPoint textureSize; std::uint32_t paletteKey; /**< Used for CRendererImpl::paletteEntryMap search. * Value of zero reserved for 'default' palette. */ std::uint32_t hint; /**< Can be 0, 1 or 2. * Passed through IMqTexturer2::addTexture, for example. * Used in IMqRasterizer::createOffscreenSurface. */ bool hasCustomPalette; /**< paletteKey is not zero, valid palette should be passed to * IMqRasterizer::createSurfaceDecomp. */ char padding; std::int16_t opacity; }; assert_size(RenderData22, 24); /** Maps texture handles to IMqTextures. */ struct RenderData40 { TextureHandle textureHandle; RenderData22 data22; }; assert_size(RenderData40, 40); using RenderData40SetIntPair = Pair<Set<RenderData40>, std::uint32_t /* free texture handle index */>; /** Name chosen according to log message in 0x519000. */ struct TextureSurface { int surfacesCount; IDirectDrawSurface7* surfaces[20]; /**< Used in 0x519000 for alpha blend. */ CMqRect areas[20]; bool unknown2; char padding[3]; int batchNumber; /**< Can be set to -1. See IMqTexturer2::Method6 or 0x51b3b0 calls. */ std::uint32_t hint; /**< Same as RenderData22::hint. * Used in IMqRasterizer::createOffscreenSurface. */ }; assert_size(TextureSurface, 416); using PaletteEntryPair = Pair<::tagPALETTEENTRY[256], IDirectDrawPalette*>; assert_size(PaletteEntryPair, 1028); struct RenderOperation { /** Operation type. */ enum class Type : int { Draw, /**< Calls IMqRasterizer::alphaBlend. */ StartScaling, /**< Calls IMqRasterizer::startScaling. */ EndScaling, /**< Calls IMqRasterizer::endScaling. */ }; Type type; TextureHandle textureHandle; CMqPoint offset; CMqPoint start; CMqPoint size; CMqRect area; /** * Holds opacity or negative value. * In case of negative value, RenderData22::opacity is used for alpha blend. */ int maybeOpacity; }; assert_size(RenderOperation, 64); assert_offset(RenderOperation, offset, 20); /** Stores rendering operations that later will be packed into a batch. */ struct RenderQueue { RenderOperation* operations; int operationsCount; /**< Current number of operations in queue. */ int maxOperations; /**< Set to 3072 in c-tor. */ CMqRect windowClientArea; List<CMqRect> rectList; List<CMqRect> rectList2; int unknown; }; assert_size(RenderQueue, 64); struct RenderBatchElement { TextureHandle textureHandle; /** * True if there is a TextureSurface found in CRendererImpl::textureSurfaceMap. * It means there is no need to create texture surface for this batch operation. */ bool textureSurfaceExist; /** * True if: * - one of the TextureSurface::surfaces was lost and restored * - TextureSurface was created for this batch * - RenderData22 found by textureHandle returned texture->isDirty(). */ bool dirtyOrRestored; char padding[2]; }; assert_size(RenderBatchElement, 20); /** * Stores batch elements to render. * Populated from RenderQueue using RenderOperations with type Draw. */ struct RenderBatch { RenderBatchElement* array; int elementCount; int maxElements; }; assert_size(RenderBatch, 12); } // namespace game #endif // RENDERTYPES_H
4,799
C++
.h
141
28.758865
94
0.68379
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,755
encparambase.h
VladimirMakeev_D2ModdingToolset/mss32/include/encparambase.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ENCPARAMBASE_H #define ENCPARAMBASE_H #include "d2map.h" #include "encparam.h" #include "smartptr.h" namespace game { struct CMidgardID; struct BattleMsgData; typedef int CEncParamBaseDataStatuses; // clang-format off enum class CEncParamBaseDataStatus : int { Unknown1 = 0b0000000000000001, Unknown2 = 0b0000000000000010, Unknown3 = 0b0000000000000100, // Correspond to BattleMsgData::BattleStatus BoostDamageLvl1 = 0b0000000000001000, BoostDamageLvl2 = 0b0000000000010000, BoostDamageLvl3 = 0b0000000000100000, BoostDamageLvl4 = 0b0000000001000000, LowerDamageLvl1 = 0b0000000010000000, LowerDamageLvl2 = 0b0000000100000000, LowerInitiative = 0b0000001000000000, Unknown4 = 0b0000010000000000, Unknown5 = 0b0000100000000000, }; // clang-format on enum class CEncParamBaseDataKey : int { // Used by CBattleViewerInterf ShatteredArmor = 1, FortificationArmor = 2, // Used by CDDMageInventory, CDDMageInvDisplay, CDDMerchantInventory, CDDMerchantInvDisplay LowerCost = ShatteredArmor, // Used by encParamBaseAddUnitBattleInfoHooked // Correspond to BattleMsgData::UnitInfo immunity statuses AttackSourceImmunityStatuses = 3, AttackClassImmunityStatuses = 4, }; struct CEncParamBaseData { int type; CEncParamBaseDataStatuses statuses; SmartPointer functor; Map<CEncParamBaseDataKey, int> values; }; assert_size(CEncParamBaseData, 44); /** Base class for ingame encyclopedia parameters. */ struct CEncParamBase : public IEncParam { CEncParamBaseData* data; }; assert_size(CEncParamBase, 8); namespace CEncParamBaseApi { struct Api { using AddUnitBattleInfo = void(__stdcall*)(CEncParamBase* param, const CMidgardID* unitId, const BattleMsgData* battleMsgData); AddUnitBattleInfo addUnitBattleInfo; using GetData = int(__thiscall*)(const CEncParamBase* thisptr, CEncParamBaseDataKey key, int def); GetData getData; using SetData = void(__thiscall*)(CEncParamBase* thisptr, CEncParamBaseDataKey key, int value); SetData setData; }; Api& get(); } // namespace CEncParamBaseApi } // namespace game #endif // ENCPARAMBASE_H
3,192
C++
.h
89
31.067416
99
0.728748
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,756
log.h
VladimirMakeev_D2ModdingToolset/mss32/include/log.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2020 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef LOG_H #define LOG_H #include <string> namespace hooks { /** Prints message to the file only if debug mode setting is enabled. */ void logDebug(const std::string& logFile, const std::string& message); /** Prints message to the file. */ void logError(const std::string& logFile, const std::string& message); } // namespace hooks #endif // LOG_H
1,170
C++
.h
28
39.928571
72
0.755066
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,757
interffullscreen.h
VladimirMakeev_D2ModdingToolset/mss32/include/interffullscreen.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2020 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef INTERFFULLSCREEN_H #define INTERFFULLSCREEN_H #include "interface.h" namespace game { /** * Assumption: base class for all full screen ui elements. * Actual size unknown. */ struct CInterfFullScreen : public CInterface { }; } // namespace game #endif // INTERFFULLSCREEN_H
1,102
C++
.h
30
34.866667
72
0.765478
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,758
unitmodifierhooks.h
VladimirMakeev_D2ModdingToolset/mss32/include/unitmodifierhooks.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UNITMODIFIERHOOKS_H #define UNITMODIFIERHOOKS_H namespace game { struct GlobalData; struct CDBTable; struct TUnitModifier; } // namespace game namespace hooks { struct CustomModifierFunctions; const CustomModifierFunctions& getCustomModifierFunctions(const game::TUnitModifier* unitModifier); game::TUnitModifier* __fastcall unitModifierCtorHooked(game::TUnitModifier* thisptr, int /*%edx*/, const game::CDBTable* dbTable, const char* globalsFolderPath, void* codeBaseEnvProxy, const game::GlobalData** globalData); void __fastcall unitModifierDtorHooked(game::TUnitModifier* thisptr, int /*%edx*/, char flags); } // namespace hooks #endif // UNITMODIFIERHOOKS_H
1,768
C++
.h
37
38.648649
99
0.664925
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,759
viewexportedleaderinterf.h
VladimirMakeev_D2ModdingToolset/mss32/include/viewexportedleaderinterf.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef VIEWEXPORTEDLEADERINTERF_H #define VIEWEXPORTEDLEADERINTERF_H #include "interffullscreen.h" #include "leaderunitdescriptor.h" namespace game { struct CDialogInterf; struct CViewExportedLeaderInterfData { CDialogInterf* dialog; CLeaderUnitDescriptorData descriptorData; int unknown; int unknown2; int unknown3; int unknown4; int unknown5; }; assert_size(CViewExportedLeaderInterfData, 316); struct CViewExportedLeaderInterf : public CInterfFullScreen { CViewExportedLeaderInterfData* data; }; assert_size(CViewExportedLeaderInterf, 12); } // namespace game #endif // VIEWEXPORTEDLEADERINTERF_H
1,456
C++
.h
42
32.261905
72
0.788462
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,760
mqstream.h
VladimirMakeev_D2ModdingToolset/mss32/include/mqstream.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MQSTREAM_H #define MQSTREAM_H #include "d2assert.h" namespace game { struct CMqStreamVftable; struct CMqStream { const CMqStreamVftable* vftable; bool read; char padding[3]; }; assert_size(CMqStream, 8); struct CMqStreamVftable { using Destructor = void(__thiscall*)(CMqStream* thisptr, char flags); Destructor destructor; using Serialize = void(__thiscall*)(CMqStream* thisptr, const void* data, int count); Serialize serialize; void* methods[3]; }; assert_vftable_size(CMqStreamVftable, 5); } // namespace game #endif // MQSTREAM_H
1,399
C++
.h
41
31.634146
89
0.755572
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,761
terrainnamemap.h
VladimirMakeev_D2ModdingToolset/mss32/include/terrainnamemap.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TERRAINNAMEMAP_H #define TERRAINNAMEMAP_H #include "d2map.h" #include "terraincat.h" namespace game { /** Holds terrain categories and their abbreviations. */ using TerrainNameMap = Map<LTerrainCategory, char[3]>; using TerrainNameMapNode = MapNode<LTerrainCategory, char[3]>; using TerrainNameMapIterator = MapIterator<LTerrainCategory, char[3]>; assert_size(TerrainNameMapNode, 32); namespace TerrainNameMapApi { struct Api { /** * Returns terrain name map. * Initializes list on the first access. */ using Get = TerrainNameMap* (*)(); Get get; /** Adds new node to the list with specified terrain and abbreviation. */ using Add = TerrainNameMapIterator*(__thiscall*)(TerrainNameMap* thisptr, TerrainNameMapIterator* iterator, const LTerrainCategory* terrain, const char* abbreviation); Add add; }; Api& get(); } // namespace TerrainNameMapApi } // namespace game #endif // TERRAINNAMEMAP_H
1,923
C++
.h
48
34.333333
86
0.695115
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,762
netdplayplayerenum.h
VladimirMakeev_D2ModdingToolset/mss32/include/netdplayplayerenum.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef NETDPLAYPLAYERENUM_H #define NETDPLAYPLAYERENUM_H #include "d2string.h" #include "mqnetplayerenum.h" namespace game { /** Thin wrapper of player data for Direct Play. */ struct CNetDPlayPlayerEnum : public IMqNetPlayerEnum { int playerNetId; String name; }; assert_size(CNetDPlayPlayerEnum, 24); } // namespace game #endif // NETDPLAYPLAYERENUM_H
1,182
C++
.h
32
34.9375
72
0.770779
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,763
menunewskirmishhotseathooks.h
VladimirMakeev_D2ModdingToolset/mss32/include/menunewskirmishhotseathooks.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2023 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MENUNEWSKIRMISHHOTSEATHOOKS_H #define MENUNEWSKIRMISHHOTSEATHOOKS_H namespace game { struct CMenuNewSkirmishHotseat; struct CMenuPhase; } // namespace game namespace hooks { game::CMenuNewSkirmishHotseat* __fastcall menuNewSkirmishHotseatCtorHooked( game::CMenuNewSkirmishHotseat* thisptr, int /*%edx*/, game::CMenuPhase* menuPhase); } #endif // MENUNEWSKIRMISHHOTSEATHOOKS_H
1,214
C++
.h
31
37.032258
75
0.781648
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,764
midanim2base.h
VladimirMakeev_D2ModdingToolset/mss32/include/midanim2base.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MIDANIM2BASE_H #define MIDANIM2BASE_H #include "midanim2.h" namespace game { struct CMidAnim2BaseData { bool smoothScroll; bool unknown; }; assert_size(CMidAnim2BaseData, 2); struct CMidAnim2Base : public IMidAnim2 { CMidAnim2BaseData* baseData; }; assert_size(CMidAnim2Base, 8); } // namespace game #endif // MIDANIM2BASE_H
1,166
C++
.h
35
31.228571
72
0.769162
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,765
itempotionrevive.h
VladimirMakeev_D2ModdingToolset/mss32/include/itempotionrevive.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ITEMPOTIONREVIVE_H #define ITEMPOTIONREVIVE_H #include "itembase.h" namespace game { struct CItemPotionRevive : public CItemBase { }; assert_size(CItemPotionRevive, 12); } // namespace game #endif // ITEMPOTIONREVIVE_H
1,046
C++
.h
27
36.851852
72
0.771739
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,766
lordcat.h
VladimirMakeev_D2ModdingToolset/mss32/include/lordcat.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2020 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef LORDCAT_H #define LORDCAT_H #include "categories.h" namespace game { struct LLordCategoryTable : public CEnumConstantTable<LordId> { }; struct LLordCategory : public Category<LordId> { }; namespace LordCategories { struct Categories { LLordCategory* mage; LLordCategory* warrior; LLordCategory* diplomat; }; Categories& get(); } // namespace LordCategories } // namespace game #endif // LORDCAT_H
1,240
C++
.h
37
31.432432
72
0.767617
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,767
originalfunctions.h
VladimirMakeev_D2ModdingToolset/mss32/include/originalfunctions.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ORIGINALFUNCTIONS_H #define ORIGINALFUNCTIONS_H #include "attackimpl.h" #include "battlemsgdata.h" #include "citystackinterf.h" #include "commandmsg.h" #include "condinterf.h" #include "d2osexception.h" #include "ddcarryoveritems.h" #include "effectinterf.h" #include "effectresult.h" #include "enclayoutcity.h" #include "enclayoutruin.h" #include "enclayoutspell.h" #include "enclayoutstack.h" #include "enclayoutunit.h" #include "exchangeinterf.h" #include "game.h" #include "gameimages.h" #include "menubase.h" #include "menuload.h" #include "menunewskirmishhotseat.h" #include "menunewskirmishmulti.h" #include "menunewskirmishsingle.h" #include "menuphase.h" #include "menuprotocol.h" #include "midevcondition.h" #include "mideveffect.h" #include "midevent.h" #include "midgardscenariomap.h" #include "midmsgsender.h" #include "midunit.h" #include "mqnetplayer.h" #include "netmsg.h" #include "pickupdropinterf.h" #include "sitemerchantinterf.h" #include "testcondition.h" namespace hooks { struct OriginalFunctions { game::ComputePlayerDailyIncome computePlayerDailyIncome; game::CreateBatAttack createBatAttack; game::GetAttackClassWardFlagPosition getAttackClassWardFlagPosition; game::AttackClassToString attackClassToString; game::MarkMapPosition markMapPosition; game::LoadScenarioMap loadScenarioMap; game::CMidgardScenarioMapApi::Api::Stream scenarioMapStream; game::CCityStackInterfApi::Api::Constructor cityStackInterfCtor; game::CExchangeInterfApi::Api::Constructor exchangeInterfCtor; game::CPickUpDropInterfApi::Api::Constructor pickupDropInterfCtor; game::CSiteMerchantInterfApi::Api::Constructor siteMerchantInterfCtor; game::CDDCarryOverItemsApi::Api::Constructor carryOverItemsCtor; game::CEncLayoutSpellApi::Api::Constructor encLayoutSpellCtor; game::os_exceptionApi::Api::ThrowException throwException; game::BattleMsgDataApi::Api::FindAttackTarget findAttackTarget; game::BattleMsgDataApi::Api::Constructor battleMsgDataCtor; game::GetSoldierImmunityAiRating getSoldierImmunityAiRating; game::GetAttackSourceWardFlagPosition getAttackSourceWardFlagPosition; game::BattleMsgDataApi::Api::AddUnitToBattleMsgData addUnitToBattleMsgData; game::CNetMsgVftable::Serialize stackBattleActionMsgSerialize; game::CNetMsgVftable::Serialize cmdBattleStartMsgSerialize; game::CNetMsgVftable::Serialize cmdBattleChooseActionMsgSerialize; game::CNetMsgVftable::Serialize cmdBattleResultMsgSerialize; game::CNetMsgVftable::Serialize cmdBattleEndMsgSerialize; game::CCommandMsgApi::Api::Destructor commandMsgDtor; game::CNetMsgApi::Api::Destructor netMsgDtor; game::CAttackImplApi::Api::Constructor2 attackImplCtor2; game::IAttackVftable::GetData attackImplGetData; game::CMidEvConditionApi::Api::CreateFromCategory createEventConditionFromCategory; game::CMidEvConditionApi::Api::GetInfoString eventConditionGetInfoString; game::CMidEvConditionApi::Api::GetDescription eventConditionGetDescription; game::CMidEvConditionApi::Api::GetDescription eventConditionGetBrief; game::editor::CCondInterfApi::Api::CreateFromCategory createCondInterfFromCategory; game::ITestConditionApi::Api::Create createTestCondition; game::CMidEventApi::Api::CheckValid checkEventValid; game::BattleMsgDataApi::Api::BeforeBattleRound beforeBattleRound; game::CMidUnitVftable::InitWithSoldierImpl initWithSoldierImpl; game::CMidEvEffectApi::Api::CreateFromCategory createEventEffectFromCategory; game::CMidEvEffectApi::Api::GetInfoString eventEffectGetInfoString; game::CMidEvEffectApi::Api::GetDescription eventEffectGetDescription; game::CMidEvEffectApi::Api::GetDescription eventEffectGetBrief; game::editor::CEffectInterfApi::Api::CreateFromCategory createEffectInterfFromCategory; game::IEffectResultApi::Api::Create createEffectResult; game::CMenuPhaseApi::Api::Constructor menuPhaseCtor; game::IMqNetSystemVftable::Destructor menuPhaseDtor; game::CMenuPhaseApi::Api::SetTransition menuPhaseSetTransition; game::CMenuProtocolApi::Api::DisplayCallback menuProtocolDisplayCallback; game::CMenuProtocolApi::Api::ButtonHandler menuProtocolContinueHandler; game::CMenuBaseApi::Api::ButtonCallback menuNewSkirmishLoadScenario; game::CMenuNewSkirmishMultiApi::Api::CreateServer menuNewSkirmishMultiCreateServer; game::CMenuLoadApi::Api::ButtonCallback menuLoadSkirmishMultiLoadScenario; game::CMenuLoadApi::Api::CreateHostPlayer menuLoadSkirmishMultiCreateHostPlayer; game::GameImagesApi::Api::GetCityPreviewLargeImageNames getCityPreviewLargeImageNames; game::GameImagesApi::Api::GetCityIconImageNames getCityIconImageNames; game::CEncLayoutUnitApi::Api::Initialize encLayoutUnitInitialize; game::CEncLayoutUnitApi::Api::Update encLayoutUnitUpdate; game::CEncLayoutStackApi::Api::Update encLayoutStackUpdate; game::CEncLayoutCityApi::Api::Update encLayoutCityUpdate; game::CEncLayoutRuinApi::Api::Update encLayoutRuinUpdate; game::IMidMsgSenderVftable::SendObjectsChanges midServerLogicSendObjectsChanges; game::CMenuNewSkirmishSingleApi::Api::Constructor menuNewSkirmishSingleCtor; game::CMenuNewSkirmishHotseatApi::Api::Constructor menuNewSkirmishHotseatCtor; game::CMenuNewSkirmishMultiApi::Api::Constructor menuNewSkirmishMultiCtor; game::IMqNetPlayerVftable::SendNetMessage netSinglePlayerSendMessage; game::CMidDataCache2::INotifyVftable::OnObjectChanged manageStkInterfOnObjectChanged; game::CMidDataCache2::INotifyVftable::OnObjectChanged exchangeInterfOnObjectChanged; game::CMidDataCache2::INotifyVftable::OnObjectChanged cityStackInterfOnObjectChanged; game::CMidDataCache2::INotifyVftable::OnObjectChanged siteMerchantInterfOnObjectChanged; }; OriginalFunctions& getOriginalFunctions(); } // namespace hooks #endif // ORIGINALFUNCTIONS_H
6,753
C++
.h
130
48.530769
92
0.823583
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,768
batattackbestowwards.h
VladimirMakeev_D2ModdingToolset/mss32/include/batattackbestowwards.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2020 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef BATATTACKBESTOWWARDS_H #define BATATTACKBESTOWWARDS_H #include "batattack.h" #include "midgardid.h" namespace game { struct IAttack; /** * Grants attack source wards (and potentially any modifiers) for a battle round. * Healers of Elven Alliance use this attack. */ struct CBatAttackBestowWards : public CBatAttackBase { CMidgardID unitId; CMidgardID attackImplUnitId; int attackNumber; /**< 1 if this is a unit's primary attack, 2 for secondary. */ IAttack* attackImpl; IAttack* attack2Impl; bool attack2Initialized; char padding[3]; int attackImplMagic; }; assert_size(CBatAttackBestowWards, 32); namespace CBatAttackBestowWardsApi { IBatAttackVftable* vftable(); } // namespace CBatAttackBestowWardsApi } // namespace game #endif // BATATTACKBESTOWWARDS_H
1,625
C++
.h
45
33.711111
84
0.771829
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,769
fffactory.h
VladimirMakeev_D2ModdingToolset/mss32/include/fffactory.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2023 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FFFACTORY_H #define FFFACTORY_H #include "imgfactory.h" #include "imgpacker.h" #include "imgstore2.h" namespace game { struct MQDBImageDataWrapper; struct CFFFactory : public CImgFactory::FactoryLoader { CImgStore2::Store2Loader store2Loader; CImgPacker::PackerLoader packerLoader; MQDBImageDataWrapper* imgData2; IdManagerSmartPtr idManager; }; assert_size(CFFFactory, 24); } // namespace game #endif // FFFACTORY_H
1,261
C++
.h
35
33.857143
72
0.775862
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,770
displaysettings.h
VladimirMakeev_D2ModdingToolset/mss32/include/displaysettings.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DISPLAYSETTINGS_H #define DISPLAYSETTINGS_H #include "d2assert.h" namespace game { struct DisplaySettings { int height; int width; int bitsPerPixel; }; assert_size(DisplaySettings, 12); } // namespace game #endif // DISPLAYSETTINGS_H
1,073
C++
.h
31
32.451613
72
0.764251
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,771
batattackutils.h
VladimirMakeev_D2ModdingToolset/mss32/include/batattackutils.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef BATATTACKUTILS_H #define BATATTACKUTILS_H #include "attack.h" #include "battlemsgdata.h" #include "midunit.h" namespace game { struct IBatAttack; } // namespace game namespace hooks { bool canHeal(game::IAttack* attack, game::IMidgardObjectMap* objectMap, game::BattleMsgData* battleMsgData, game::CMidgardID* targetUnitId); int heal(game::IMidgardObjectMap* objectMap, game::BattleMsgData* battleMsgData, game::CMidUnit* targetUnit, int qtyHeal); const game::CMidgardID* getUnitId(const game::IBatAttack* batAttack); const game::CMidgardID* getItemId(const game::IBatAttack* batAttack); } // namespace hooks #endif // BATATTACKUTILS_H
1,535
C++
.h
39
35.923077
72
0.749326
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,772
effectresult.h
VladimirMakeev_D2ModdingToolset/mss32/include/effectresult.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef EFFECTRESULT_H #define EFFECTRESULT_H #include "d2list.h" namespace game { struct IEffectResultVftable; struct String; struct IMidgardObjectMap; struct IEventEffect; struct CMidgardID; struct CMidEvEffect; /** * Event effect results interface. * Effect results are created depending on CMidEvEffect::category. */ struct IEffectResult { IEffectResultVftable* vftable; }; struct IEffectResultVftable { using Destructor = void(__thiscall*)(IEffectResult* thisptr, char flags); Destructor destructor; /** * Applies event effect result. * Wraps event effect logic by creating one or more * IEventEffect objects and adding them to the effects list * for later processing by game. * @param[inout] str unused by the game. Assumption: was used for debugging. * @param[in] objectMap used to search scenario objects. * @param[inout] effects list of effects that will be executed by the game. * @param[in] playerId affected player id. * @param[in] triggererId id of stack that triggered event. * @param[in] playingStackId id of stack currently playing. Assumption: not used and empty. */ using Apply = void(__thiscall*)(const IEffectResult* thisptr, String* str, IMidgardObjectMap* objectMap, List<IEventEffect*>* effects, const CMidgardID* playerId, const CMidgardID* triggererId, const CMidgardID* playingStackId); Apply apply; /** * Returns true to indicate that further events and effects processing should stop. * Only CEffectResultBattle is known to return true from this method. */ using StopProcessing = bool(__thiscall*)(const IEffectResult* thisptr); StopProcessing stopProcessing; }; assert_vftable_size(IEffectResultVftable, 3); namespace IEffectResultApi { struct Api { using Create = IEffectResult*(__stdcall*)(const CMidEvEffect* eventEffect); Create create; }; Api& get(); } // namespace IEffectResultApi } // namespace game #endif // EFFECTRESULT_H
3,022
C++
.h
78
33.064103
95
0.702287
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,773
unitcat.h
VladimirMakeev_D2ModdingToolset/mss32/include/unitcat.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2020 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UNITCAT_H #define UNITCAT_H #include "categories.h" namespace game { struct LUnitCategoryTable : public CEnumConstantTable<UnitId> { }; struct LUnitCategory : public Category<UnitId> { }; namespace UnitCategories { struct Categories { LUnitCategory* soldier; LUnitCategory* noble; LUnitCategory* leader; LUnitCategory* summon; LUnitCategory* illusion; LUnitCategory* guardian; }; Categories& get(); /** Returns address of LUnitCategory::vftable used in game. */ const void* vftable(); } // namespace UnitCategories } // namespace game #endif // UNITCAT_H
1,411
C++
.h
42
31.333333
72
0.764186
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,774
imgstore2.h
VladimirMakeev_D2ModdingToolset/mss32/include/imgstore2.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2023 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef IMGSTORE2_H #define IMGSTORE2_H #include "d2set.h" #include <Windows.h> namespace game { struct SurfaceDecompressData; struct CMqPoint; struct CImgStore2 { struct Store2LoaderVftable; struct Store2Loader { Store2LoaderVftable* vftable; }; struct ImageVftable; struct Image { ImageVftable* vftable; }; }; struct CImgStore2::Store2LoaderVftable { using Destructor = void(__thiscall*)(CImgStore2::Store2Loader* thisptr, char flags); Destructor destructor; using GetIndexOptRecordIds = Set<int>*(__thiscall*)(CImgStore2::Store2Loader* thisptr, Set<int>* recordIds); GetIndexOptRecordIds getIndexOptRecordIds; using GetImageClassSize = std::uint32_t(__thiscall*)(CImgStore2::Store2Loader* thisptr, const char* imageName, int a2); GetImageClassSize getImageClassSize; /** Creates FFImg, for example. */ using CreateImageObject = CImgStore2::Image*(__thiscall*)(CImgStore2::Store2Loader* thisptr, int idValue, int a2, void* objectMemory); CreateImageObject createImageObject; }; assert_vftable_size(CImgStore2::Store2LoaderVftable, 4); struct CImgStore2::ImageVftable { using Destructor = void(__thiscall*)(CImgStore2::Image* thisptr, char flags); Destructor destructor; using GetImageSize = CMqPoint*(__thiscall*)(CImgStore2::Image* thisptr, CMqPoint* size); GetImageSize getImageSize; using GetOpacity = std::uint16_t(__thiscall*)(const CImgStore2::Image* thisptr); GetOpacity getOpacity; using GetPalette = ::tagPALETTEENTRY*(__thiscall*)(CImgStore2::Image* thisptr, ::tagPALETTEENTRY* entries); GetPalette getPalette; using Draw = void(__thiscall*)(CImgStore2::Image* thisptr, SurfaceDecompressData* decompressData); Draw draw; }; assert_vftable_size(CImgStore2::ImageVftable, 5); struct CImgStore2LoaderWeakDup : public CImgStore2::Store2Loader { CImgStore2::Store2Loader* store2Loader; }; assert_size(CImgStore2LoaderWeakDup, 8); } // namespace game #endif // IMGSTORE2_H
3,288
C++
.h
80
32.425
96
0.654945
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,775
dynupgrade.h
VladimirMakeev_D2ModdingToolset/mss32/include/dynupgrade.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DYNUPGRADE_H #define DYNUPGRADE_H #include "currency.h" #include "midgardid.h" #include <cstddef> namespace game { /** Holds dynamic upgrade data read from GDynUpgr.dbf. */ struct CDynUpgrade { CMidgardID upgradeId; Bank enrollCost; int hp; int armor; int regen; Bank reviveCost; Bank healCost; Bank trainingCost; int xpKilled; int xpNext; int move; int negotiate; int initiative; int power; int damage; int heal; }; assert_size(CDynUpgrade, 96); assert_offset(CDynUpgrade, xpKilled, 64); } // namespace game #endif // DYNUPGRADE_H
1,423
C++
.h
48
26.8125
72
0.741228
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,776
menunewskirmishmulti.h
VladimirMakeev_D2ModdingToolset/mss32/include/menunewskirmishmulti.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MENUNEWSKIRMISHMULTI_H #define MENUNEWSKIRMISHMULTI_H #include "menunewskirmish.h" namespace game { /** * Multiplayer skirmish menu. * Represents DLG_HOST from Interf.dlg. */ struct CMenuNewSkirmishMulti : public CMenuNewSkirmish { }; assert_size(CMenuNewSkirmishMulti, 12); namespace CMenuNewSkirmishMultiApi { struct Api { // Declare thisptr here as CMenuBase // to simplify loading random scenarios for multiplayer games. // This function doesn't access data from CMenuNewSkirmishMulti or CMenuNewSkirmish using CreateServer = bool(__thiscall*)(CMenuBase* thisptr); CreateServer createServer; using Constructor = CMenuNewSkirmishMulti*(__thiscall*)(CMenuNewSkirmishMulti* thisptr, CMenuPhase* menuPhase); Constructor constructor; }; Api& get(); } // namespace CMenuNewSkirmishMultiApi } // namespace game #endif // MENUNEWSKIRMISHMULTI_H
1,764
C++
.h
45
35.533333
91
0.751611
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,777
sitetrainingcampinterf.h
VladimirMakeev_D2ModdingToolset/mss32/include/sitetrainingcampinterf.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SITETRAININGCAMPINTERF_H #define SITETRAININGCAMPINTERF_H #include "idvector.h" #include "middatacache.h" #include "middragdropinterf.h" #include "resetstackext.h" namespace game { struct CDDStackGroup; struct CTrainingUnit; struct CSiteTrainingCampInterfData { CMidgardID stackId; CDDStackGroup* stackGroup; CMidgardID trainingCampId; ITask* taskOpenInterf; CPhaseGame* phaseGame; CTrainingUnit* trainingUnit; IdVector trainableUnitIds; CMqRect rSlotImageArea; int unk9; }; assert_size(CSiteTrainingCampInterfData, 60); struct CSiteTrainingCampInterf : public CMidDataCache2::INotify , public IResetStackExt , public CMidDragDropInterf { CSiteTrainingCampInterfData* trainingCampData; }; assert_size(CSiteTrainingCampInterf, 40); } // namespace game #endif // SITETRAININGCAMPINTERF_H
1,668
C++
.h
50
30.78
72
0.786692
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,778
avoidflickerimage.h
VladimirMakeev_D2ModdingToolset/mss32/include/avoidflickerimage.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AVOIDFLICKERIMAGE_H #define AVOIDFLICKERIMAGE_H #include "mqimage2surface16.h" namespace game { // Actual size unknown struct CAvoidFlickerImage : public CMqImage2Surface16 { }; } // namespace game #endif // AVOIDFLICKERIMAGE_H
1,054
C++
.h
27
37.185185
72
0.774731
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,779
gameimagedata.h
VladimirMakeev_D2ModdingToolset/mss32/include/gameimagedata.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2023 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef GAMEIMAGEDATA_H #define GAMEIMAGEDATA_H #include "d2assert.h" #include "imgfactory.h" namespace game { struct MQDBDataWrapper; struct MQDBImageDataWrapper; struct CFFFactory; struct ImgPackerStoreLoaderWrapper; struct GameImageData { MQDBDataWrapper* imagesData; MQDBImageDataWrapper* unkImgData2; CImgFactory::FactoryLoader* ffFactory; ImgPackerStoreLoaderWrapper* packerStoreLoader; IdManagerSmartPtr idManager; }; assert_size(GameImageData, 24); struct GameImageDataWrapper { GameImageData* data; }; assert_size(GameImageDataWrapper, 4); } // namespace game #endif // GAMEIMAGEDATA_H
1,441
C++
.h
43
31.325581
72
0.789625
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,780
isogroundindexer.h
VladimirMakeev_D2ModdingToolset/mss32/include/isogroundindexer.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ISOGROUNDINDEXER_H #define ISOGROUNDINDEXER_H #include <cstdint> namespace game { struct IIsoGroundIndexerVftable; struct CMqPoint; struct IIsoGroundIndexer { IIsoGroundIndexerVftable* vftable; }; struct IIsoGroundIndexerVftable { using Destructor = void(__thiscall*)(IIsoGroundIndexer* thisptr, char flags); Destructor destructor; using UpdateData = void(__thiscall*)(IIsoGroundIndexer* thisptr); UpdateData updateData; using GetData = std::uint8_t(__thiscall*)(const IIsoGroundIndexer* thisptr, const CMqPoint* position); GetData getData; }; } // namespace game #endif // ISOGROUNDINDEXER_H
1,497
C++
.h
40
33.9
81
0.749136
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,781
tileview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/tileview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TILEVIEW_H #define TILEVIEW_H #include <cstdint> namespace sol { class state; } namespace bindings { class TileView { public: TileView(std::uint32_t tile); static void bind(sol::state& lua); int getTerrain() const; int getGround() const; private: std::uint32_t tile; }; } // namespace bindings #endif // TILEVIEW_H
1,165
C++
.h
37
29.216216
72
0.751342
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,782
stackview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/stackview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef STACKVIEW_H #define STACKVIEW_H #include "groupview.h" #include "idview.h" #include "playerview.h" #include "point.h" #include <optional> #include <vector> namespace sol { class state; } namespace game { struct CMidStack; struct IMidgardObjectMap; enum EquippedItemIdx; } // namespace game namespace bindings { class FortView; class UnitView; class ItemView; class StackView { public: StackView(const game::CMidStack* stack, const game::IMidgardObjectMap* objectMap); static void bind(sol::state& lua); IdView getId() const; Point getPosition() const; std::optional<PlayerView> getOwner() const; std::optional<FortView> getInside() const; /** Returns stack units as a group. */ GroupView getGroup() const; /** Returns stack leader. */ std::optional<UnitView> getLeader() const; /** Returns stack current movement points. */ int getMovement() const; /** Returns stack subrace category id. */ int getSubrace() const; bool isInvisible() const; int getBattlesWon() const; std::vector<ItemView> getInventoryItems() const; std::optional<ItemView> getLeaderEquippedItem(const game::EquippedItemIdx& idx) const; private: const game::CMidStack* stack; const game::IMidgardObjectMap* objectMap; }; } // namespace bindings #endif // STACKVIEW_H
2,148
C++
.h
65
30.338462
90
0.748671
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,783
point.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/point.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef POINTBINDING_H #define POINTBINDING_H #include <ostream> namespace sol { class state; } namespace game { struct CMqPoint; } namespace bindings { struct Point { Point(); Point(int x, int y); Point(const game::CMqPoint& point); static void bind(sol::state& lua); int x; int y; }; /** Overloaded operator allows calling 'tostring()' with Point in lua scripts. */ static inline std::ostream& operator<<(std::ostream& os, const Point& point) { os << '(' << point.x << ", " << point.y << ')'; return os; } } // namespace bindings #endif // POINTBINDING_H
1,412
C++
.h
45
29.044444
81
0.726401
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,784
diplomacyview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/diplomacyview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2023 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DIPLOMACYVIEW_H #define DIPLOMACYVIEW_H #include <cstdint> namespace sol { class state; } namespace game { struct CMidDiplomacy; } namespace bindings { enum class RelationType : int { War, Neutral, Peace, }; class DiplomacyView { public: DiplomacyView(const game::CMidDiplomacy* diplomacy); static void bind(sol::state& lua); std::uint32_t getCurrentRelation(int race1CategoryId, int race2CategoryId) const; std::uint32_t getPreviousRelation(int race1CategoryId, int race2CategoryId) const; bool getAlliance(int race1CategoryId, int race2CategoryId) const; std::uint32_t getAllianceTurn(int race1CategoryId, int race2CategoryId) const; bool getAlwaysAtWar(int race1CategoryId, int race2CategoryId) const; bool getAiCouldNotBreakAlliance(int race1CategoryId, int race2CategoryId) const; int getRelationType(std::uint32_t relations) const; private: const game::CMidDiplomacy* diplomacy; }; } #endif // DIPLOMACYVIEW_H
1,806
C++
.h
51
32.705882
86
0.777778
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,785
idview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/idview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef IDVIEW_H #define IDVIEW_H #include "midgardid.h" #include "utils.h" #include <ostream> namespace sol { class state; } namespace bindings { struct IdView { IdView(const char* id); IdView(const std::string& id); IdView(const game::CMidgardID* id); IdView(const game::CMidgardID& id); bool operator==(const IdView& other) const { return id == other.id; } bool operator!=(const IdView& other) const { return id != other.id; } operator const game::CMidgardID&() const { return id; } static void bind(sol::state& lua); // For Lua hash table int getValue() const; int getTypeIndex() const; static IdView getEmptyId(); game::CMidgardID id; }; /** Overloaded operator allows calling 'tostring()' with IdView in lua scripts. */ static inline std::ostream& operator<<(std::ostream& os, const IdView& id) { os << hooks::idToString(&id.id); return os; } } // namespace bindings #endif // IDVIEW_H
1,827
C++
.h
60
27.116667
82
0.708904
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,786
modifierview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/modifierview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MODIFIERVIEW_H #define MODIFIERVIEW_H #include "idview.h" namespace sol { class state; } namespace game { struct CUmModifier; } // namespace game namespace bindings { class ModifierView { public: ModifierView(const game::CUmModifier* modifier); static void bind(sol::state& lua); IdView getId() const; private: const game::CUmModifier* modifier; }; } // namespace bindings #endif // MODIFIERVIEW_H
1,246
C++
.h
39
29.820513
72
0.763378
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,787
fogview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/fogview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2023 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FOGVIEW_H #define FOGVIEW_H #include "idview.h" namespace sol { class state; } namespace game { struct CMidgardMapFog; } namespace bindings { struct Point; class FogView { public: FogView(const game::CMidgardMapFog* mapFog); static void bind(sol::state& lua); IdView getId() const; bool getFogByCoordinates(int x, int y) const; bool getFogByPoint(const Point& p) const; private: const game::CMidgardMapFog* mapFog; }; } // namespace bindings #endif // FOGVIEW_H
1,319
C++
.h
42
29.119048
72
0.758703
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,788
groupview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/groupview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef GROUPVIEW_H #define GROUPVIEW_H #include "idview.h" #include <vector> namespace sol { class state; } namespace game { struct CMidUnitGroup; struct IMidgardObjectMap; } // namespace game namespace bindings { class UnitView; class UnitSlotView; class GroupView { public: using GroupSlots = std::vector<UnitSlotView>; using GroupUnits = std::vector<UnitView>; GroupView(const game::CMidUnitGroup* group, const game::IMidgardObjectMap* objectMap, const game::CMidgardID* groupId); static void bind(sol::state& lua); IdView getId() const; /** Returns group as array of 6 unit slots. */ GroupSlots getSlots() const; GroupUnits getUnits() const; bool hasUnit(const bindings::UnitView& unit) const; bool hasUnitById(const bindings::IdView& unitId) const; protected: const game::CMidUnitGroup* group; const game::IMidgardObjectMap* objectMap; game::CMidgardID groupId; }; } // namespace bindings #endif // GROUPVIEW_H
1,824
C++
.h
54
30.703704
72
0.748148
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,789
unitviewbase.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/unitviewbase.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UNITVIEWBASE_H #define UNITVIEWBASE_H #include "idview.h" #include <optional> #include <vector> namespace sol { class state; } namespace game { struct IUsUnit; } // namespace game namespace bindings { class UnitImplView; class ModifierView; class UnitViewBase { public: /** Returns unit current implementation. */ std::optional<UnitImplView> getImpl() const; /** Returns unit base implementation. */ std::optional<UnitImplView> getBaseImpl() const; /** Returns unit leveled implementation (without modifiers). */ std::optional<UnitImplView> getLeveledImpl() const; std::vector<ModifierView> getModifiers() const; IdView getId() const; /** Returns unit's current experience points. */ int getXp() const; int getHp() const; int getHpMax() const; /** Returns leader category id. */ int getLeaderCategory() const; /** Returns leader maximum movement points. */ int getMovement() const; /** Returns leader scouting range. */ int getScout() const; /** Returns current leadership value. */ int getLeadership() const; /** Returns true if leader has LLeaderAbility with specified id. */ bool hasAbility(int abilityId) const; /** Returns true if leader has movement bonus on LGroundCategory with specified id. */ bool hasMoveBonus(int groundId) const; protected: virtual game::CMidgardID getIdInternal() const = 0; virtual const game::IUsUnit* getImplInternal() const = 0; virtual int getXpInternal() const = 0; virtual int getHpInternal() const = 0; virtual int getHpMaxInternal() const = 0; }; } // namespace bindings #endif // UNITVIEWBASE_H
2,484
C++
.h
68
33.382353
90
0.735331
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,790
unitimplview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/unitimplview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UNITIMPLVIEW_H #define UNITIMPLVIEW_H #include "idview.h" #include <optional> #include <vector> namespace sol { class state; } namespace game { struct IUsUnit; } namespace bindings { class DynUpgradeView; class AttackView; class ModifierView; class UnitImplView { public: UnitImplView(const game::IUsUnit* unitImpl); static void bind(sol::state& lua); IdView getId() const; /** Returns unit implementation level. */ int getLevel() const; /** Returns experience points needed for next level. */ int getXpNext() const; /** Returns level after which dynUpgrade2 rules are applied. */ int getDynUpgLevel() const; int getXpKilled() const; int getHitPoint() const; int getArmor() const; int getRegen() const; int getRace() const; int getSubRace() const; bool isSmall() const; bool isMale() const; bool isWaterOnly() const; bool attacksTwice() const; int getUnitCategory() const; /** Returns BASE_UNIT specified in Gunits.dbf. */ std::optional<UnitImplView> getBaseUnit() const; std::optional<UnitImplView> getGlobal() const; std::optional<UnitImplView> getGenerated() const; std::vector<ModifierView> getModifiers() const; bool hasModifier(const std::string& id) const; bool hasModifierById(const IdView& id) const; /* Have to implement leader properties here because sol does not support down-casting * (https://sol2.readthedocs.io/en/latest/api/usertype.html#inheritance). * This means that derived class members cannot be accessed from base reference. * For example, if script function argument has type of UnitImplView, and you pass inherited * LeaderImplView instance, then there is no way to access leader members. */ /** Returns leader category id. */ int getLeaderCategory() const; /** Returns leader maximum movement points. */ int getMovement() const; /** Returns leader scouting range. */ int getScout() const; /** Returns current leadership value. */ int getLeadership() const; /** Returns true if leader has LLeaderAbility with specified id. */ bool hasAbility(int abilityId) const; /** Returns true if leader has movement bonus on LGroundCategory with specified id. */ bool hasMoveBonus(int groundId) const; /** Returns dynamic upgrade 1. */ std::optional<DynUpgradeView> getDynUpgrade1() const; /** Returns dynamic upgrade 2. */ std::optional<DynUpgradeView> getDynUpgrade2() const; /** Returns primary attack. */ std::optional<AttackView> getAttack() const; /** Returns secondary attack. */ std::optional<AttackView> getAttack2() const; /** Returns alternative attack. */ std::optional<AttackView> getAltAttack() const; /** Returns immune category id for specified attack class id. */ int getImmuneToAttackClass(int attackClassId) const; /** Returns immune category id for specified attack source id. */ int getImmuneToAttackSource(int attackSourceId) const; protected: std::optional<DynUpgradeView> getDynUpgrade(int upgradeNumber) const; private: const game::IUsUnit* impl; }; } // namespace bindings #endif // UNITIMPLVIEW_H
4,020
C++
.h
101
36.039604
96
0.733145
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,791
dynupgradeview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/dynupgradeview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DYNUPGRADEVIEW_H #define DYNUPGRADEVIEW_H namespace sol { class state; } namespace game { struct CDynUpgrade; } namespace bindings { class DynUpgradeView { public: DynUpgradeView(const game::CDynUpgrade* upgrade); static void bind(sol::state& lua); /** Returns number of experience points added with each dynamic upgrade. */ int getXpNext() const; private: const game::CDynUpgrade* upgrade; }; } // namespace bindings #endif // DYNUPGRADEVIEW_H
1,295
C++
.h
39
31
79
0.764045
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,792
rodview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/rodview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef RODVIEW_H #define RODVIEW_H #include "idview.h" #include "point.h" #include <optional> namespace sol { class state; } namespace game { struct CMidRod; struct IMidgardObjectMap; } // namespace game namespace bindings { class PlayerView; class RodView { public: RodView(const game::CMidRod* rod, const game::IMidgardObjectMap* objectMap); static void bind(sol::state& lua); IdView getId() const; Point getPosition() const; std::optional<PlayerView> getOwner() const; private: const game::CMidRod* rod; const game::IMidgardObjectMap* objectMap; }; } // namespace bindings #endif // RODVIEW_H
1,449
C++
.h
46
29.26087
80
0.759166
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,793
ruinview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/ruinview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef RUINVIEW_H #define RUINVIEW_H #include "currencyview.h" #include "groupview.h" #include "idview.h" #include "point.h" #include <optional> namespace sol { class state; } namespace game { struct CMidRuin; struct IMidgardObjectMap; } // namespace game namespace bindings { class PlayerView; class ItemView; class RuinView { public: RuinView(const game::CMidRuin* ruin, const game::IMidgardObjectMap* objectMap); static void bind(sol::state& lua); IdView getId() const; Point getPosition() const; std::optional<PlayerView> getLooter() const; GroupView getGroup() const; std::optional<ItemView> getItem() const; CurrencyView getCash() const; private: const game::CMidRuin* ruin; const game::IMidgardObjectMap* objectMap; }; } // namespace bindings #endif // RUINVIEW_H
1,637
C++
.h
52
29.153846
83
0.759695
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,794
currencyview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/currencyview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef CURRENCYVIEW_H #define CURRENCYVIEW_H #include "currency.h" #include <ostream> namespace sol { class state; } namespace bindings { class CurrencyView { public: CurrencyView(const game::Bank& value); bool operator==(const CurrencyView& value) const; bool operator<(const CurrencyView& value) const; bool operator<=(const CurrencyView& value) const; static void bind(sol::state& lua); int getInfernalMana() const; void setInfernalMana(int value); int getLifeMana() const; void setLifeMana(int value); int getDeathMana() const; void setDeathMana(int value); int getRunicMana() const; void setRunicMana(int value); int getGroveMana() const; void setGroveMana(int value); int getGold() const; void setGold(int value); game::Bank bank; }; /** Overloaded operator allows calling 'tostring()' with CurrencyView in lua scripts. */ static inline std::ostream& operator<<(std::ostream& os, const CurrencyView& value) { char buffer[36] = {0}; os << game::BankApi::get().toString(&value.bank, buffer); return os; } } // namespace bindings #endif // CURRENCYVIEW_H
1,967
C++
.h
57
31.54386
88
0.73881
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,795
scenarioview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/scenarioview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SCENARIOVIEW_H #define SCENARIOVIEW_H #include <optional> #include <string> namespace sol { class state; } namespace game { struct CMidgardID; struct IMidgardObjectMap; enum class IdType : int; } // namespace game namespace bindings { struct IdView; struct Point; class LocationView; class ScenVariablesView; class TileView; class StackView; class FortView; class RuinView; class UnitView; class PlayerView; class RodView; class DiplomacyView; /** * Returns stub values if objectMap is null. * This handles cases where some scripts can be called while the map is in a loading state. * See getScenarioMap utility for details. */ class ScenarioView { public: ScenarioView(const game::IMidgardObjectMap* objectMap); static void bind(sol::state& lua); /** Searches for location by id string. */ std::optional<LocationView> getLocation(const std::string& id) const; /** Searches for location by id. */ std::optional<LocationView> getLocationById(const IdView& id) const; /** Returns scenario variables, if present. */ std::optional<ScenVariablesView> getScenVariables() const; /** Returns tile by coordinate pair. */ std::optional<TileView> getTile(int x, int y) const; /** Returns tile by specified point. */ std::optional<TileView> getTileByPoint(const Point& p) const; /** Searches for stack by id string. */ std::optional<StackView> getStack(const std::string& id) const; /** Searches for stack by id. */ std::optional<StackView> getStackById(const IdView& id) const; /** Searches for stack by coordinate pair. */ std::optional<StackView> getStackByCoordinates(int x, int y) const; /** Searches for stack at specified point. */ std::optional<StackView> getStackByPoint(const Point& p) const; /** Searches for fort by id string. */ std::optional<FortView> getFort(const std::string& id) const; /** Searches for fort by id. */ std::optional<FortView> getFortById(const IdView& id) const; /** Searches for fort by coordinate pair. */ std::optional<FortView> getFortByCoordinates(int x, int y) const; /** Searches for fort at specified point. */ std::optional<FortView> getFortByPoint(const Point& p) const; /** Searches for ruin by id string. */ std::optional<RuinView> getRuin(const std::string& id) const; /** Searches for ruin by id. */ std::optional<RuinView> getRuinById(const IdView& id) const; /** Searches for ruin by coordinate pair. */ std::optional<RuinView> getRuinByCoordinates(int x, int y) const; /** Searches for ruin at specified point. */ std::optional<RuinView> getRuinByPoint(const Point& p) const; /** Searches for rod by id string. */ std::optional<RodView> getRod(const std::string& id) const; /** Searches for rod by id. */ std::optional<RodView> getRodById(const IdView& id) const; /** Searches for rod by coordinate pair. */ std::optional<RodView> getRodByCoordinates(int x, int y) const; /** Searches for rod at specified point. */ std::optional<RodView> getRodByPoint(const Point& p) const; /** Searches for player by id string. */ std::optional<PlayerView> getPlayer(const std::string& id) const; /** Searches for player by id. */ std::optional<PlayerView> getPlayerById(const IdView& id) const; /** Searches for unit by id string. */ std::optional<UnitView> getUnit(const std::string& id) const; /** Searches for unit by id. */ std::optional<UnitView> getUnitById(const IdView& id) const; /** Searches for stack that has specified unit among all the stacks in the whole scenario. */ std::optional<StackView> findStackByUnit(const UnitView& unit) const; std::optional<StackView> findStackByUnitId(const IdView& unitId) const; std::optional<StackView> findStackByUnitIdString(const std::string& unitId) const; /** * Searches for fort that has specified unit in its garrison among all the forts in the whole * scenario. Only garrison units are counted, visiting stack is ignored. */ std::optional<FortView> findFortByUnit(const UnitView& unit) const; std::optional<FortView> findFortByUnitId(const IdView& unitId) const; std::optional<FortView> findFortByUnitIdString(const std::string& unitId) const; /** Searches for ruin that has specified unit among all the ruins in the whole scenario. */ std::optional<RuinView> findRuinByUnit(const UnitView& unit) const; std::optional<RuinView> findRuinByUnitId(const IdView& unitId) const; std::optional<RuinView> findRuinByUnitIdString(const std::string& unitId) const; int getCurrentDay() const; int getSize() const; std::optional<DiplomacyView> getDiplomacy() const; private: const game::CMidgardID* getObjectId(int x, int y, game::IdType type) const; const game::IMidgardObjectMap* objectMap; }; } // namespace bindings #endif // SCENARIOVIEW_H
5,755
C++
.h
127
41.653543
97
0.732953
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,796
itembaseview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/itembaseview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ITEMBASEVIEW_H #define ITEMBASEVIEW_H #include "currencyview.h" #include "idview.h" #include <optional> namespace sol { class state; } namespace game { struct CItemBase; } // namespace game namespace bindings { class UnitImplView; class AttackView; class ItemBaseView { public: ItemBaseView(const game::CItemBase* item); static void bind(sol::state& lua); IdView getId() const; int getCategory() const; CurrencyView getValue() const; std::optional<UnitImplView> getUnitImpl() const; std::optional<AttackView> getAttack() const; private: const game::CItemBase* item; }; } // namespace bindings #endif // ITEMBASEVIEW_H
1,483
C++
.h
47
29.255319
72
0.761236
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,797
unitslotview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/unitslotview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UNITSLOTVIEW_H #define UNITSLOTVIEW_H #include "midgardid.h" #include <optional> namespace sol { class state; } namespace game { struct CMidUnit; } // namespace game namespace bindings { class UnitView; class UnitSlotView { public: UnitSlotView(const game::CMidUnit* unit, int position, const game::CMidgardID* groupId); bool operator==(const UnitSlotView& value) const; static void bind(sol::state& lua); std::optional<UnitView> getUnitView() const; int getPosition() const; int getLine() const; int getColumn() const; bool isFrontline() const; bool isBackline() const; int getDistance(const UnitSlotView& to) const; game::CMidgardID getUnitId() const; const game::CMidUnit* getUnit() const; private: const game::CMidUnit* unit; int position; game::CMidgardID groupId; }; } // namespace bindings #endif // UNITSLOTVIEW_H
1,716
C++
.h
52
30.269231
92
0.750454
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,798
attackview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/attackview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ATTACKVIEW_H #define ATTACKVIEW_H #include "idview.h" namespace sol { class state; } namespace game { struct IAttack; } namespace bindings { class ModifierView; class AttackView { public: AttackView(const game::IAttack* attack); static void bind(sol::state& lua); IdView getId() const; /** Returns attack class id. */ int getAttackClass() const; /** Returns attack source id. */ int getAttackSource() const; /** Returns attack initiative value. */ int getInitiative() const; /** Returns attack power (accuracy). */ int getPower() const; /** Returns attack reach id. */ int getReach() const; /** Returns damage the attack can inflict. */ int getDamage() const; /** Returns healing the attack can apply. */ int getHeal() const; /** Returns true if attack has long effect duration. */ bool isInfinite() const; /** Returns true if attack can apply critical damage. */ bool canCrit() const; /** Returns level for boost damage, lower damage and lower initiative attacks. */ int getLevel() const; /** Returns list of modifiers applied by bestow wards attack. */ std::vector<ModifierView> getWards() const; /** Custom attack data. */ bool isMelee() const; int maxTargets() const; int critDamage() const; int critPower() const; int damageRatio() const; bool damageRatioPerTarget() const; bool damageSplit() const; private: const game::IAttack* attack; }; } // namespace bindings #endif // ATTACKVIEW_H
2,362
C++
.h
70
30.371429
85
0.71391
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,799
itemview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/itemview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ITEMVIEW_H #define ITEMVIEW_H #include "currencyview.h" #include "idview.h" #include "midgardid.h" #include <optional> namespace sol { class state; } namespace game { struct IMidgardObjectMap; } // namespace game namespace bindings { class ItemBaseView; class ItemView { public: ItemView(const game::CMidgardID* itemId, const game::IMidgardObjectMap* objectMap); static void bind(sol::state& lua); IdView getId() const; std::optional<ItemBaseView> getBase() const; CurrencyView getSellValue() const; private: game::CMidgardID itemId; const game::IMidgardObjectMap* objectMap; }; } // namespace bindings #endif // ITEMVIEW_H
1,485
C++
.h
46
30.043478
87
0.764541
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,800
locationview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/locationview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef LOCATIONVIEW_H #define LOCATIONVIEW_H #include "idview.h" #include "point.h" namespace sol { class state; } namespace game { struct CMidLocation; } namespace bindings { class LocationView { public: LocationView(const game::CMidLocation* location); static void bind(sol::state& lua); IdView getId() const; Point getPosition() const; int getRadius() const; private: const game::CMidLocation* location; }; } // namespace bindings #endif // LOCATIONVIEW_H
1,307
C++
.h
42
28.880952
72
0.759968
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,801
playerview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/playerview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PLAYERVIEW_H #define PLAYERVIEW_H #include "currencyview.h" #include "idview.h" #include <optional> namespace sol { class state; } namespace game { struct CMidPlayer; struct IMidgardObjectMap; } // namespace game namespace bindings { class FogView; class PlayerView { public: PlayerView(const game::CMidPlayer* player, const game::IMidgardObjectMap* objectMap); static void bind(sol::state& lua); IdView getId() const; int getRaceCategoryId() const; int getLordCategoryId() const; CurrencyView getBank() const; bool isHuman() const; bool isAlwaysAi() const; std::optional<FogView> getFog() const; private: const game::CMidPlayer* player; const game::IMidgardObjectMap* objectMap; }; } // namespace bindings #endif // PLAYERVIEW_H
1,608
C++
.h
50
29.68
89
0.759871
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,802
fortview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/fortview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FORTVIEW_H #define FORTVIEW_H #include "groupview.h" #include "idview.h" #include "playerview.h" #include "point.h" #include <optional> #include <vector> namespace sol { class state; } namespace game { struct CFortification; struct IMidgardObjectMap; } // namespace game namespace bindings { class StackView; class ItemView; class FortView { public: FortView(const game::CFortification* fort, const game::IMidgardObjectMap* objectMap); static void bind(sol::state& lua); IdView getId() const; Point getPosition() const; std::optional<PlayerView> getOwner() const; GroupView getGroup() const; std::optional<StackView> getVisitor() const; int getSubrace() const; std::vector<ItemView> getInventoryItems() const; bool isCapital() const; int getTier() const; private: const game::CFortification* fort; const game::IMidgardObjectMap* objectMap; }; } // namespace bindings #endif // FORTVIEW_H
1,774
C++
.h
56
29.214286
89
0.757771
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,803
battlemsgdataview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/battlemsgdataview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef BATTLEMSGDATAVIEW_H #define BATTLEMSGDATAVIEW_H #include <optional> namespace sol { class state; } namespace game { struct BattleMsgData; struct IMidgardObjectMap; struct CMidgardID; } // namespace game namespace bindings { struct IdView; class PlayerView; class StackView; class GroupView; class BattleMsgDataView { public: BattleMsgDataView(const game::BattleMsgData* battleMsgData, const game::IMidgardObjectMap* objectMap); static void bind(sol::state& lua); bool getUnitStatus(const IdView& unitId, int status) const; int getCurrentRound() const; bool getAutoBattle() const; std::optional<PlayerView> getAttackerPlayer() const; std::optional<PlayerView> getDefenderPlayer() const; std::optional<StackView> getAttacker() const; std::optional<GroupView> getDefender() const; private: std::optional<PlayerView> getPlayer(const game::CMidgardID& playerId) const; const game::BattleMsgData* battleMsgData; const game::IMidgardObjectMap* objectMap; }; } // namespace bindings #endif // BATTLEMSGDATAVIEW_H
1,912
C++
.h
54
32.5
80
0.76873
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,804
scenvariablesview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/scenvariablesview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SCENVARIABLESVIEW_H #define SCENVARIABLESVIEW_H #include "midscenvariables.h" #include <optional> #include <string> #include <unordered_map> namespace sol { class state; } namespace bindings { class ScenarioVariableView; class ScenVariablesView { public: ScenVariablesView(const game::CMidScenVariables* scenVariables); static void bind(sol::state& lua); std::optional<ScenarioVariableView> getScenarioVariable(const std::string& name) const; private: std::unordered_map<std::string, const game::ScenarioVariable*> variables; const game::CMidScenVariables* scenVariables; }; } // namespace bindings #endif // SCENVARIABLESVIEW_H
1,480
C++
.h
41
33.926829
91
0.779412
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,805
unitview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/unitview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UNITVIEW_H #define UNITVIEW_H #include "unitviewbase.h" namespace sol { class state; } namespace game { struct CMidUnit; } // namespace game namespace bindings { class UnitViewDummy; class UnitView : public UnitViewBase { public: UnitView(const game::CMidUnit* unit); UnitView(const game::CMidUnit* unit, const game::IUsUnit* unitImpl); static void bind(sol::state& lua); std::optional<UnitViewDummy> getOriginal() const; std::vector<ModifierView> getOriginalModifiers() const; protected: game::CMidgardID getIdInternal() const; const game::IUsUnit* getImplInternal() const; int getXpInternal() const; int getHpInternal() const; int getHpMaxInternal() const; const game::CMidUnit* unit; const game::IUsUnit* unitImpl; }; } // namespace bindings #endif // UNITVIEW_H
1,647
C++
.h
48
31.6875
72
0.75662
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,806
unitviewdummy.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/unitviewdummy.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2022 Stanislav Egorov. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UNITVIEWDUMMY_H #define UNITVIEWDUMMY_H #include "unitviewbase.h" namespace sol { class state; } namespace bindings { class UnitViewDummy : public UnitViewBase { public: UnitViewDummy(const game::CMidgardID& id, const game::IUsUnit* impl, int xp, int hp, int hpMax); static void bind(sol::state& lua); protected: game::CMidgardID getIdInternal() const; const game::IUsUnit* getImplInternal() const; int getXpInternal() const; int getHpInternal() const; int getHpMaxInternal() const; const game::CMidgardID id; const game::IUsUnit* impl; int xp; int hp; int hpMax; }; } // namespace bindings #endif // UNITVIEWDUMMY_H
1,496
C++
.h
44
31.295455
100
0.749653
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,807
scenariovariableview.h
VladimirMakeev_D2ModdingToolset/mss32/include/bindings/scenariovariableview.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2021 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SCENARIOVARIABLEVIEW_H #define SCENARIOVARIABLEVIEW_H #include "midscenvariables.h" #include <string> namespace sol { class state; } namespace bindings { class ScenarioVariableView { public: ScenarioVariableView(const game::ScenarioVariable* variable); static void bind(sol::state& lua); std::string getName() const; int getValue() const; private: const game::ScenarioVariable* variable; }; } // namespace bindings #endif // SCENARIOVARIABLEVIEW_H
1,298
C++
.h
38
31.921053
72
0.7704
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,808
dbfrecord.h
VladimirMakeev_D2ModdingToolset/mss32/include/dbf/dbfrecord.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2020 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DBFRECORD_H #define DBFRECORD_H #include "dbfcolumn.h" #include <cstdint> #include <gsl/span> #include <string> namespace utils { class DbfFile; class DbfRecord { public: using RecordData = gsl::span<const std::uint8_t>; DbfRecord() = default; DbfRecord(const DbfFile* dbf, RecordData recordData, bool deleted); // Characters fields access bool value(std::string& result, std::uint32_t columnIndex) const; bool value(std::string& result, const std::string& columnName) const; bool value(std::string& result, const DbfColumn& column) const; // Numeric fields access bool value(int& result, std::uint32_t columnIndex) const; bool value(int& result, const std::string& columnName) const; bool value(int& result, const DbfColumn& column) const; // Logical fields access bool value(bool& result, std::uint32_t columnIndex) const; bool value(bool& result, const std::string& columnName) const; bool value(bool& result, const DbfColumn& column) const; bool isDeleted() const; private: const DbfFile* dbf{}; RecordData data{}; bool deleted{}; }; } // namespace utils #endif // DBFRECORD_H
1,990
C++
.h
52
35.230769
73
0.73974
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,809
dbffile.h
VladimirMakeev_D2ModdingToolset/mss32/include/dbf/dbffile.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2020 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DBFFILE_H #define DBFFILE_H #include "dbfcolumn.h" #include "dbfheader.h" #include "dbfrecord.h" #include <filesystem> #include <fstream> #include <string> #include <unordered_map> #include <vector> namespace utils { class DbfFile { public: DbfFile() = default; bool open(const std::filesystem::path& file); bool isValid() const { return valid; } CodePage language() const; std::uint32_t columnsTotal() const; std::uint32_t recordsTotal() const; /** Returns nullptr in case of invalid index. */ const DbfColumn* column(std::uint32_t index) const; /** Returns nullptr if column with specified name can not be found. */ const DbfColumn* column(const std::string& name) const; /** * Creates thin wrapper for record data access. * Created records must not outlive DbfFile object that created them. * @returns false in case of invalid index. */ bool record(DbfRecord& result, std::uint32_t index) const; private: bool readHeader(std::ifstream& stream); bool readColumns(std::ifstream& stream); bool readColumn(std::ifstream& stream, DbfColumn& column); using Columns = std::vector<DbfColumn>; using ColumnIndexMap = std::unordered_map<std::string, std::uint32_t>; DbfHeader header{}; Columns columns; ColumnIndexMap columnIndices; std::vector<std::uint8_t> recordsData; bool valid{}; }; } // namespace utils #endif // DBFFILE_H
2,281
C++
.h
65
31.707692
74
0.726612
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,810
dbfheader.h
VladimirMakeev_D2ModdingToolset/mss32/include/dbf/dbfheader.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2020 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DBFHEADER_H #define DBFHEADER_H #include "d2assert.h" #include <cstddef> #include <cstdint> namespace utils { enum class CodePage : std::uint8_t { DosUsa = 1, /**< Code page 437 */ DosMultilingual = 2, /**< Code page 850 */ WinAnsi = 3, /**< Code page 1252 */ StandardMac = 4, EEMsDos = 0x64, /**< Code page 852 */ NordicMsDos = 0x65, /**< Code page 865 */ RussianMsDos = 0x66, /**< Code page 866 */ IcelandicMsDos = 0x67, CzechMsDos = 0x68, PolishMsDos = 0x69, GreekMsDos = 0x6a, TurkishMsDos = 0x6b, RussianMac = 0x96, EEMac = 0x97, GreekMac = 0x98, WinEE = 0xc8, /**< Code page 1250 */ RussianWin = 0xc9, TurkishWin = 0xca, GreekWin = 0xcb }; struct DbfHeader { union Version { struct { std::uint8_t version : 3; std::uint8_t memoFile : 1; std::uint8_t sqlTable : 3; std::uint8_t dbtFlag : 1; } parts; std::uint8_t data; } version; struct UpdateTime { std::uint8_t year; /**< Added to a base year of 1900. */ std::uint8_t month; std::uint8_t day; } lastUpdate; std::uint32_t recordsTotal; std::uint16_t headerLength; std::uint16_t recordLength; char reserved[2]; bool incompleteTransaction; bool encryption; char multiUserReserved[12]; bool mdxPresent; CodePage language; char reserved2[2]; }; assert_size(DbfHeader, 32); assert_offset(DbfHeader, recordsTotal, 4); assert_offset(DbfHeader, language, 29); } // namespace utils #endif // DBFHEADER_H
2,454
C++
.h
81
25.876543
72
0.661858
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,811
dbfcolumn.h
VladimirMakeev_D2ModdingToolset/mss32/include/dbf/dbfcolumn.h
/* * This file is part of the modding toolset for Disciples 2. * (https://github.com/VladimirMakeev/D2ModdingToolset) * Copyright (C) 2020 Vladimir Makeev. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DBFCOLUMN_H #define DBFCOLUMN_H #include "d2assert.h" #include <cstddef> #include <cstdint> namespace utils { enum class ColumnType : char { Character = 'C', Number = 'N', Logical = 'L' }; struct DbfColumn { char name[11]; ColumnType type; std::uint32_t dataAddress; /**< Offset from the start of the record. */ std::uint8_t length; /**< Length of the data in bytes. */ std::uint8_t decimalCount; /**< Number of digits after decimal point. */ char multiUserReserved[2]; std::uint8_t workAreaId; char multiUserReserved2[2]; bool setFields; char reserved[7]; bool indexField; }; assert_size(DbfColumn, 32); assert_offset(DbfColumn, dataAddress, 12); assert_offset(DbfColumn, workAreaId, 20); } // namespace utils #endif // DBFCOLUMN_H
1,630
C++
.h
49
30.469388
76
0.728608
VladimirMakeev/D2ModdingToolset
32
13
15
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,813
DLInjector-GUI.h
fatihsnsy_DLInjector-GUI/DLInjector-GUI/DLInjector-GUI.h
#include <iostream> #include <windows.h> #include <string> #include <tlhelp32.h> #include <comdef.h> #include <vcclr.h> namespace DLInjectorGUI { using namespace System; using namespace System::ComponentModel; using namespace System::Threading; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace System::Runtime::InteropServices; using namespace std; public ref class MyForm : public System::Windows::Forms::Form { public: MyForm(void) { InitializeComponent(); } HANDLE FindHandle(const wchar_t* procName) { PROCESSENTRY32 entry; entry.dwSize = sizeof(PROCESSENTRY32); HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL); if (snapshot == INVALID_HANDLE_VALUE) { infoBox->Text += "Snapshot failed! Error Code: " + GetLastError() + "\n"; return NULL; } if (Process32First(snapshot, &entry) == TRUE) { while (Process32Next(snapshot, &entry) == TRUE) { if (_wcsicmp(entry.szExeFile, procName) == 0) { infoBox->Text += "Found the process! \n"; HANDLE ProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID); if (ProcHandle == NULL) { infoBox->Text += "ProcHandle Failed! Error Code: " + GetLastError() + "\n"; return NULL; } return ProcHandle; } } } return NULL; } protected: ~MyForm() { if (components) { delete components; } } public: System::Windows::Forms::TextBox^ targetExe; protected: protected: private: System::Windows::Forms::Label^ label1; private: System::Windows::Forms::Label^ label2; public: System::Windows::Forms::TextBox^ injectedDll; private: System::Windows::Forms::Button^ doButton; public: System::Windows::Forms::RichTextBox^ infoBox; private: System::ComponentModel::BackgroundWorker^ backgroundWorker1; private: System::Windows::Forms::Button^ cancelBut; public: private: protected: private: System::ComponentModel::Container^ components; #pragma region Windows Form Designer generated code void InitializeComponent(void) { System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(MyForm::typeid)); this->targetExe = (gcnew System::Windows::Forms::TextBox()); this->label1 = (gcnew System::Windows::Forms::Label()); this->label2 = (gcnew System::Windows::Forms::Label()); this->injectedDll = (gcnew System::Windows::Forms::TextBox()); this->doButton = (gcnew System::Windows::Forms::Button()); this->infoBox = (gcnew System::Windows::Forms::RichTextBox()); this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker()); this->cancelBut = (gcnew System::Windows::Forms::Button()); this->SuspendLayout(); // // targetExe // this->targetExe->Location = System::Drawing::Point(195, 27); this->targetExe->Name = L"targetExe"; this->targetExe->RightToLeft = System::Windows::Forms::RightToLeft::No; this->targetExe->Size = System::Drawing::Size(210, 20); this->targetExe->TabIndex = 0; this->targetExe->Text = L"Enter process name with .exe"; this->targetExe->TextAlign = System::Windows::Forms::HorizontalAlignment::Center; this->targetExe->GotFocus += gcnew System::EventHandler(this, &MyForm::targetExe_Enter); this->targetExe->LostFocus += gcnew System::EventHandler(this, &MyForm::targetExe_Leave); // // label1 // this->label1->AutoSize = true; this->label1->BackColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(64)), static_cast<System::Int32>(static_cast<System::Byte>(64)), static_cast<System::Int32>(static_cast<System::Byte>(64))); this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9, System::Drawing::FontStyle::Bold)); this->label1->ForeColor = System::Drawing::SystemColors::ButtonHighlight; this->label1->Location = System::Drawing::Point(12, 27); this->label1->Name = L"label1"; this->label1->Size = System::Drawing::Size(149, 15); this->label1->TabIndex = 1; this->label1->Text = L"Target Process Name "; // // label2 // this->label2->AutoSize = true; this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(162))); this->label2->ForeColor = System::Drawing::SystemColors::ButtonHighlight; this->label2->Location = System::Drawing::Point(12, 67); this->label2->Name = L"label2"; this->label2->Size = System::Drawing::Size(124, 15); this->label2->TabIndex = 2; this->label2->Text = L"DLL to be Injected"; this->label2->Click += gcnew System::EventHandler(this, &MyForm::label2_Click); // // injectedDll // this->injectedDll->Location = System::Drawing::Point(194, 66); this->injectedDll->Name = L"injectedDll"; this->injectedDll->Size = System::Drawing::Size(210, 20); this->injectedDll->TabIndex = 3; this->injectedDll->Text = L"Enter DLL path with .dll"; this->injectedDll->TextAlign = System::Windows::Forms::HorizontalAlignment::Center; this->injectedDll->GotFocus += gcnew System::EventHandler(this, &MyForm::injectedDll_Enter); this->injectedDll->LostFocus += gcnew System::EventHandler(this, &MyForm::injectedDll_Leave); // // doButton // this->doButton->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(162))); this->doButton->Location = System::Drawing::Point(66, 103); this->doButton->Name = L"doButton"; this->doButton->Size = System::Drawing::Size(113, 38); this->doButton->TabIndex = 5; this->doButton->Text = L"Let\'s Inject!"; this->doButton->UseVisualStyleBackColor = true; this->doButton->Click += gcnew System::EventHandler(this, &MyForm::doButton_Click); // // infoBox // this->infoBox->BackColor = System::Drawing::Color::White; this->infoBox->Cursor = System::Windows::Forms::Cursors::IBeam; this->infoBox->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(162))); this->infoBox->Location = System::Drawing::Point(15, 163); this->infoBox->Name = L"infoBox"; this->infoBox->ReadOnly = true; this->infoBox->Size = System::Drawing::Size(389, 150); this->infoBox->TabIndex = 6; this->infoBox->Text = L"--- DLInjector GUI InfoBox ---"; // // backgroundWorker1 // this->backgroundWorker1->DoWork += gcnew System::ComponentModel::DoWorkEventHandler(this, &MyForm::backgroundWorker1_DoWork); // // cancelBut // this->cancelBut->Enabled = false; this->cancelBut->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(162))); this->cancelBut->Location = System::Drawing::Point(249, 103); this->cancelBut->Name = L"cancelBut"; this->cancelBut->Size = System::Drawing::Size(113, 38); this->cancelBut->TabIndex = 7; this->cancelBut->Text = L"Cancel"; this->cancelBut->UseVisualStyleBackColor = true; this->cancelBut->Click += gcnew System::EventHandler(this, &MyForm::cancelBut_Click); // // MyForm // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->BackColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(64)), static_cast<System::Int32>(static_cast<System::Byte>(64)), static_cast<System::Int32>(static_cast<System::Byte>(64))); this->ClientSize = System::Drawing::Size(417, 325); this->Controls->Add(this->cancelBut); this->Controls->Add(this->infoBox); this->Controls->Add(this->doButton); this->Controls->Add(this->injectedDll); this->Controls->Add(this->label2); this->Controls->Add(this->label1); this->Controls->Add(this->targetExe); this->Icon = (cli::safe_cast<System::Drawing::Icon^>(resources->GetObject(L"$this.Icon"))); this->MaximizeBox = false; this->Name = L"MyForm"; this->Text = L"DLInjector [GUI]"; this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load); this->ResumeLayout(false); this->PerformLayout(); } #pragma endregion private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) { } // targetExe Textbox Placeholder private: System::Void targetExe_Enter(System::Object^ sender, System::EventArgs^ e) { if (targetExe->Text == "Enter process name with .exe") { targetExe->Text = ""; targetExe->ForeColor = Color::Black; } } private: System::Void targetExe_Leave(System::Object^ sender, System::EventArgs^ e) { if (targetExe->Text == "") { targetExe->Text = "Enter process name with .exe"; targetExe->ForeColor = Color::Gray; } } //Injected DLL Textbox Placeholder private: System::Void injectedDll_Enter(System::Object^ sender, System::EventArgs^ e) { if (injectedDll->Text == "Enter DLL path with .dll") { injectedDll->Text = ""; injectedDll->ForeColor = Color::Black; } } private: System::Void injectedDll_Leave(System::Object^ sender, System::EventArgs^ e) { if (injectedDll->Text == "") { injectedDll->Text = "Enter DLL path with .dll"; injectedDll->ForeColor = Color::Gray; } } private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) { } private: System::Void label2_Click(System::Object^ sender, System::EventArgs^ e) { } private: System::Void doButton_Click(System::Object^ sender, System::EventArgs^ e) { this->cancelBut->Enabled = true; backgroundWorker1->RunWorkerAsync(1); } private: System::Void cancelBut_Click(System::Object^ sender, System::EventArgs^ e) { backgroundWorker1->CancelAsync(); } private: System::Void backgroundWorker1_DoWork(System::Object^ sender, System::ComponentModel::DoWorkEventArgs^ e) { backgroundWorker1->WorkerSupportsCancellation = true; HANDLE retHandle = NULL; PVOID buffer; PTHREAD_START_ROUTINE loadlibrary; pin_ptr<const wchar_t> dllstr = PtrToStringChars(injectedDll->Text); size_t convertedChars = 0; size_t sizeInBytes = ((injectedDll->Text->Length + 1) * 2); char* dllpath = (char*)malloc(sizeInBytes); wcstombs_s(&convertedChars, dllpath, sizeInBytes, dllstr, sizeInBytes); bool result; infoBox->Text = "Started the process\n"; while (retHandle == NULL) { if (backgroundWorker1->CancellationPending) // Cancel isteði geldiðinde { e->Cancel = true; break; } pin_ptr<const wchar_t> wch = PtrToStringChars(targetExe->Text); retHandle = FindHandle(wch); if (retHandle == NULL) { infoBox->Text += "Waiting open the " + targetExe->Text + "\n"; infoBox->ScrollToCaret(); Thread::Sleep(1000); } } if (e->Cancel == true) { infoBox->Text += "Operation is cancelled!\n"; this->cancelBut->Enabled = false; return; } infoBox->Text = "Allocating memory!" + "\n"; buffer = VirtualAllocEx(retHandle, NULL, strlen(dllpath), MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); if (buffer == NULL) { infoBox->Text += "Error allocte memory! Error Code: " + GetLastError() + "\n"; return; } infoBox->Text += "Writing memory!\n"; result = WriteProcessMemory(retHandle, buffer, dllpath, strlen(dllpath), NULL); if (!result) { infoBox->Text += "Error writing memory! Error Code: " + GetLastError() + "\n"; return; } loadlibrary = (PTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle(L"kernel32.dll"), "LoadLibraryA"); if (loadlibrary == NULL) { infoBox->Text += "Error GetProcAddress! Error Code: " + GetLastError() + "\n"; return; } if ((CreateRemoteThread(retHandle, NULL, 0, loadlibrary, buffer, 0, NULL)) == NULL) { infoBox->Text += "Error CreateRemoteThread! Error Code: " + GetLastError() + "\n"; return; } CloseHandle(retHandle); infoBox->Text += "All operations success! \n"; } }; }
12,259
C++
.h
295
37.671186
179
0.700034
fatihsnsy/DLInjector-GUI
32
15
1
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,814
matrix.cpp
DinoZ1729_Renderer/matrix.cpp
#include "util.h" class matrix { public: int nrow; int ncol; double **m; matrix() { nrow = 2; ncol = 2; m = (double**)malloc(nrow*sizeof(double*)); for(int i=0; i<nrow; i++) { m[i] = (double*)malloc(ncol*sizeof(double)); } for(int i=0; i<nrow; i++) for(int j=0; j<ncol; j++) m[i][j] = 0; } matrix(int r, int c) { nrow = r; ncol = c; m = (double**)malloc(nrow*sizeof(double*)); // allocate mem for(int i=0; i<nrow; i++) { m[i] = (double*)malloc(ncol*sizeof(double)); } for(int i=0; i<nrow; i++) // init as identity { for(int j=0; j<ncol; j++) { if(i == j) m[i][j] = 1; else m[i][j] = 0; } } } // matrix(vec v) // { // nrow = 1; ncol = 4; // m = (double**)malloc(nrow*sizeof(double*)); // allocate mem // for(int i=0; i<nrow; i++) // { // m[i] = (double*)malloc(ncol*sizeof(double)); // } // m[0][0] = v.x; // m[0][1] = v.y; // m[0][2] = v.z; // m[0][3] = 1; // } ~matrix() { // printf("destructor:\n"); for(int i=0; i<nrow; i++) { free(m[i]); } free(m); } matrix(const matrix& that) { // printf("copy constructor\n"); this->nrow = that.nrow; this->ncol = that.ncol; this->m = (double**)malloc(nrow*sizeof(double*)); // allocate mem for(int i=0; i<this->nrow; i++) { m[i] = (double*)malloc(ncol*sizeof(double)); } for(int i=0; i<that.nrow; i++) for(int j=0; j<that.ncol; j++) this->m[i][j] = that.m[i][j]; } double* operator[](int x) { return m[x]; } void operator=(const matrix &that) { // printf("= operator\n"); for(int i=0; i<nrow; i++) // clear current m { free(m[i]); } free(m); this->nrow = that.nrow; this->ncol = that.ncol; this->m = (double**)malloc(nrow*sizeof(double*)); // allocate mem for(int i=0; i<this->nrow; i++) { m[i] = (double*)malloc(ncol*sizeof(double)); } for(int i=0; i<that.nrow; i++) for(int j=0; j<that.ncol; j++) this->m[i][j] = that.m[i][j]; } matrix operator*(const matrix& that) { matrix ans(this->nrow, that.ncol); for(int i=0; i<this->nrow; i++) { for(int j=0; j<that.ncol; j++) { double x = 0; for(int k=0; k<this->ncol; k++) { x += (this->m[i][k])*(that.m[k][j]); } ans[i][j] = x; } } return ans; } matrix cofactor(int r, int c) // returns cofactor of a[r][c] { matrix ans(nrow-1, ncol-1); int x = 0, y = 0; for(int i=0; i<nrow; i++) { if(i == r) continue; y = 0; for(int j=0; j<ncol; j++) { if(j == c) continue; ans.m[x][y] = m[i][j]; y++; } x++; } return ans; } double det() { if(nrow != ncol) { printf("non-square matrix: (%d, %d)\n\n", nrow, ncol); exit(1); } if(nrow == 1) return m[0][0]; if(nrow == 2) { // printf("det 2x2:\n"); // show(); double ans = m[0][0]*m[1][1] - m[1][0]*m[0][1]; return ans; } double ans = 0; int sign = 1; for(int i=0; i<nrow; i++) { matrix c(2, 2); c = cofactor(i, 0); double v = c.det(); ans += (m[i][0]*sign*v); // if(nrow == 4) // printf("det row:%d coef:%lf cofac:%lf tmp_ans:%lf\n", i, m[i][0], v, ans); sign = sign*(-1); } return ans; } void transpose() { matrix ans(ncol, nrow); // tmp ans matrix for(int i=0; i<nrow; i++) { for(int j=0; j<ncol; j++) { ans[j][i] = m[i][j]; } } for(int i=0; i<nrow; i++) // free current m free(m[i]); free(m); this->nrow = ans.nrow; this->ncol = ans.ncol; m = (double**)malloc(nrow*sizeof(double*)); // allocate mem for(int i=0; i<nrow; i++) m[i] = (double*)malloc(ncol*sizeof(double)); for(int i=0; i<nrow; i++) // copy from tmp ans matrix for(int j=0; j<ncol; j++) m[i][j] = ans[i][j]; } matrix adjugate() { matrix ans(nrow, ncol); for(int i=0; i<nrow; i++) { for(int j=0; j<ncol; j++) { matrix c = cofactor(i, j); int sign = ((i+j)%2)?-1:1; ans.m[i][j] = sign*c.det(); } } // ans.show("Adjugate Transpose"); ans.transpose(); // ans.show("Adjugate"); return ans; } matrix inv() { double d = det(); if(d == 0) { printf("INV: determinant = 0\n"); exit(1); } matrix ans = adjugate(); for(int i=0; i<ans.nrow; i++) for(int j=0; j<ans.ncol; j++) ans[i][j] = ans[i][j]/d; return ans; } void show(string s = "Matrix") { printf(" %s:\n", s.c_str()); for(int i=0; i<nrow; i++) { printf(" "); for(int j=0; j<ncol; j++) { show_util(m[i][j]); } printf("\n"); } printf("\n"); } }; /* int main() { matrix c(3, 3); c[0][0] = 2; c[0][1] = -3; c[0][2] = 1; c[1][0] = 2; c[1][1] = 0; c[1][2] = -1; c[2][0] = 1; c[2][1] = 4; c[2][2] = 5; c.show(); printf("determinant: %lf\n\n", c.det()); matrix a = c.adjugate(); a.show("Adjugate"); matrix i = c.inv(); i.show("Inv"); c = c*i; c.show("Matirx * Inverse"); return 0; } */
4,886
C++
.cpp
245
16.714286
80
0.517834
DinoZ1729/Renderer
31
4
0
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,815
main2.cpp
DinoZ1729_Renderer/main2.cpp
#include <iostream> #include <cstring> #include <unistd.h> #include <windows.h> #include "draw.h" #define PI 3.14159265358979323846 using namespace std; class tetrahedron { public: double x[4]={-1,1,0,0}, y[4]={0,0,-1,1}, z[4]={-1/sqrt(2),-1/sqrt(2),1/sqrt(2),1/sqrt(2)}; tetrahedron(double tx,double ty,double tz,double a) { for(int i=0;i<4;i++) { x[i]=a*x[i]/sqrt(2)+tx; y[i]=a*y[i]/sqrt(2)+ty; z[i]=a*z[i]/sqrt(2)+tz; } } }; class camera { public: double x,y,z; double matrix[16],inv[16]; camera(double r,double alfa,double beta) { //alfa is camera's angle along the xy plane. //beta is camera's angle along z axis //r is the distance from the camera to the origin double a=sin(alfa),b=cos(alfa),c=sin(beta),d=cos(beta); x=r*b*d; y=r*a*d; z=r*c; //matrix matrix[3]=matrix[7]=matrix[11]=0; matrix[15]=1; //x matrix[0]=a; matrix[1]=-b; matrix[2]=0; //y matrix[4]=b*c; matrix[5]=a*c; matrix[6]=-d; //z matrix[8]=b*d; matrix[9]=a*d; matrix[10]=c; matrix[12]=x; matrix[13]=y; matrix[14]=z; //invert invert(inv,matrix); } int convert(int cooInt[2],double tx,double ty,double tz) { //converts from world to pixel coordinates //returns 0 if the point is invisible to the camera double vec[3]={tx,ty,tz}; transformVector(vec,inv); if(vec[2]>0) return 0; double xI=-vec[0]/vec[2]; double yI=-vec[1]/vec[2]; xI*=WIDTH/dW/2; yI*=WIDTH/dH/2; xI+=WIDTH/dW/2; yI+=HEIGHT/dH/2; int A=(int)xI,B=(int)yI; cooInt[0]=A; cooInt[1]=B; return 1; } //rendering void renderPoint(char platno[HEIGHT/dH][WIDTH/dW],double tx,double ty,double tz,char c) { int vec[2]; convert(vec,tx,ty,tz); drawPoint(platno,vec[0],vec[1],c); } void renderLine(char platno[HEIGHT/dH][WIDTH/dW],double tx1,double ty1,double tz1,double tx2,double ty2,double tz2,char c) { int vec1[2],vec2[2]; convert(vec1,tx1,ty1,tz1); convert(vec2,tx2,ty2,tz2); drawLine(platno,vec1[0],vec1[1],vec2[0],vec2[1],c); } void renderTriangle(char platno[HEIGHT/dH][WIDTH/dW],double Ax,double Ay,double Az,double Bx,double By,double Bz,double Cx,double Cy,double Cz) { double A[3]={Ax,Ay,Az}, //vertices B[3]={Bx,By,Bz}, C[3]={Cx,Cy,Cz}, L[3]={0,4,-4}; //light source double n[3]; //normal vector normal(n,A,B,C); //I'm not sure why, but the program doesn't work unless I flip the normal vector n[0]*=-1; n[1]*=-1; n[2]*=-1; int p0[2],p1[2],p2[2]; if(!convert(p0,Ax,Ay,Az)) return; if(!convert(p1,Bx,By,Bz)) return; if(!convert(p2,Cx,Cy,Cz)) return; //shoot the ray through every pixel for(int xi=0;xi<WIDTH/dW;xi++){ for(int yi=0;yi<HEIGHT/dH;yi++){ double pi[2]={(double)xi+0.5,(double)yi+0.5}; //if the ray doesn't hit the triangle then continue if(!inTriangle(pi,p0,p1,p2)) continue; //point is the vector in camera's coordinate system double point[3]= { -(double)(xi-WIDTH/dW/2)/(double)(WIDTH/dW/2), -(double)(yi-HEIGHT/dH/2)/(double)(WIDTH/dH/2), 1 }; //we transform it so it is in global coordinate system transformVector(point,matrix); //intersection between the triangle and the ray double intersection[3], coordinates[3]={x,y,z};//coordinates of the camera rayPlane(intersection,A,n,coordinates,point); double l[3]; //unit vector pointing from intersection to light source vector(l,L,intersection); normalize(l); double luminance=clamp(dot(n,l),0,1); int color=(int)(luminance*(double)(strlen(palette)-1)); drawPoint(platno,xi,yi,palette[color]); }} } void renderTetra(char platno[HEIGHT/dH][WIDTH/dW],tetrahedron tetra,char c1,char c2) { //search Painter's Algorithm for info int index[4]={0,1,2,3}; double koo[4][3]= { {tetra.x[0],tetra.y[0],tetra.z[0]}, {tetra.x[1],tetra.y[1],tetra.z[1]}, {tetra.x[2],tetra.y[2],tetra.z[2]}, {tetra.x[3],tetra.y[3],tetra.z[3]} }; transformVector(koo[0],inv); transformVector(koo[1],inv); transformVector(koo[2],inv); transformVector(koo[3],inv); double depth[4]= { (koo[0][2]+koo[1][2]+koo[2][2])/3, (koo[0][2]+koo[1][2]+koo[3][2])/3, (koo[0][2]+koo[2][2]+koo[3][2])/3, (koo[1][2]+koo[2][2]+koo[3][2])/3 }; //sort by depth for(int i=3;i>0;i--) { for(int j=0;j<i;j++) { if(depth[j]<depth[j+1]) { int t=index[j]; index[j]=index[j+1]; index[j+1]=t; double temp=depth[j]; depth[j]=depth[j+1]; depth[j+1]=temp; } } } int point[4][2]; for(int i=0;i<4;i++) { if(!convert(point[i],tetra.x[i],tetra.y[i],tetra.z[i])) return; } int faces[4][3]= { {0,1,2}, {0,1,3}, {0,2,3}, {1,2,3} }; //commented part is without shading for(int i=0;i<4;i++) renderTriangle(platno,tetra.x[faces[index[i]][0]],tetra.y[faces[index[i]][0]],tetra.z[faces[index[i]][0]],tetra.x[faces[index[i]][1]],tetra.y[faces[index[i]][1]],tetra.z[faces[index[i]][1]],tetra.x[faces[index[i]][2]],tetra.y[faces[index[i]][2]],tetra.z[faces[index[i]][2]]); /* for(int i=0;i<4;i++) drawTriangle(platno,point[faces[index[i]][0]],point[faces[index[i]][1]],point[faces[index[i]][2]],c1,c2,' '); */ } }; int main() { tetrahedron tetra(0,0,0,1); //camera angles double alfa=PI/3,beta=0; //drawing loop: while(1) { camera cam(2,alfa,beta); char platno[HEIGHT/dH][WIDTH/dW]; for(int i=0;i<HEIGHT/dH;i++){ for(int j=0;j<WIDTH/dW;j++){ platno[i][j]=0; }} cam.renderTetra(platno,tetra,'@',','); //display: for(int i=0;i<HEIGHT/dH;i++){ for(int j=0;j<WIDTH/dW;j++){ printf("%c",platno[i][j]); } printf("\n"); } //instead of system("cls") i used this because it looks smoother gotoxy(0,0); //update camera position alfa+=0.01*PI; beta+=0.02*PI; } return 0; }
6,065
C++
.cpp
225
22.457778
280
0.610811
DinoZ1729/Renderer
31
4
0
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,816
draw.h
DinoZ1729_Renderer/draw.h
#include <iostream> #include <windows.h> #include "functions.h" //screen dimensions #define WIDTH 800 #define HEIGHT 608 //width and height of each character in pixels const int dW=4,dH=8; //set cursor at start to avoid flickering void gotoxy ( short x, short y ) { COORD coord = {x, y}; SetConsoleCursorPosition ( GetStdHandle ( STD_OUTPUT_HANDLE ), coord ); } char palette[]=".,-~:;=!*#OB8%&"; //declaration void plotLineLow(char platno[HEIGHT/dH][WIDTH/dW],int x0,int y0,int x1,int y1,char c); void plotLineHigh(char platno[HEIGHT/dH][WIDTH/dW],int x0,int y0,int x1,int y1,char c); void drawPoint(char platno[HEIGHT/dH][WIDTH/dW],int A,int B,char c); void drawLine(char platno[HEIGHT/dH][WIDTH/dW],int A,int B,int C,int D,char c); void drawTriangleInterior(char platno[HEIGHT/dH][WIDTH/dW],int A[2],int B[2],int C[2],char c); void drawTriangle(char platno[HEIGHT/dH][WIDTH/dW],int A[2],int B[2],int C[2],char c1,char c2,char c3); //functions void drawPoint(char platno[HEIGHT/dH][WIDTH/dW],int A,int B,char c) { if(A<0||B<0||A>=WIDTH/dW||B>=HEIGHT/dH) return; platno[B][A]=c; } void drawLine(char platno[HEIGHT/dH][WIDTH/dW],int A,int B,int C,int D,char c) { //Bresenham's line algorithm //sort points so the first one is to the left if(A>C) { int t; t=A; A=C; C=t; t=B; B=D; D=t; } //in case points are outside the screen if(C<0||(B<0&&D<0)||A>=WIDTH/dW||(B>=HEIGHT/dH&&D>=HEIGHT/dH)) return; if(A<0) B-=A*D/C; if(C>=WIDTH/dW) D-=(C-WIDTH/dW+1)*B/A; if(B<0) A-=B*C/D; if(D<0) C-=D*A/B; if(B>HEIGHT/dH) A-=(B-HEIGHT/dH+1)*C/B; if(D>HEIGHT/dH) A-=(D-HEIGHT/dH+1)*A/B; if(B==D) { for(int i=A;i<=C;i++) platno[B][i]=c; return; } if(A==C) { int min=B,max=D; if(D<B) { min=D; max=B; } for(int i=min;i<=max;i++) platno[i][A]=c; return; } if(abs(D-B)<abs(C-A)) plotLineLow(platno,A,B,C,D,c); else { if(B>D) plotLineHigh(platno,C,D,A,B,c); else plotLineHigh(platno,A,B,C,D,c); } } void plotLineLow(char platno[HEIGHT/dH][WIDTH/dW],int x0,int y0,int x1,int y1,char c) { int dx = x1 - x0, dy = y1 - y0, yi = 1; if (dy < 0) { yi = -1; dy = -dy; } int D = 2*dy - dx; int y = y0; for (int x=x0;x<=x1;x++) { platno[y][x]=c; if( D > 0) { y += yi; D -= 2*dx; } D += 2*dy; } } void plotLineHigh(char platno[HEIGHT/dH][WIDTH/dW],int x0,int y0,int x1,int y1,char c) { int dx = x1 - x0, dy = y1 - y0, xi = 1; if (dx < 0) { xi = -1; dx = -dx; } int D = 2*dx - dy; int x = x0; for (int y=y0;y<=y1;y++) { platno[y][x]=c; if( D > 0) { x += xi; D -= 2*dy; } D += 2*dx; } } void drawTriangleInterior(char platno[HEIGHT/dH][WIDTH/dW],int A[2],int B[2],int C[2],char c) { for(int i=0;i<WIDTH/dW;i++){ for(int j=0;j<WIDTH/dW;j++){ double p[2]={(double)i+0.5,(double)j+0.5}; if(inTriangle(p,A,B,C)) drawPoint(platno,i,j,c); }} } void drawTriangle(char platno[HEIGHT/dH][WIDTH/dW],int A[2],int B[2],int C[2],char c1,char c2,char c3) { drawTriangleInterior(platno,A,B,C,c3); drawLine(platno,A[0],A[1],B[0],B[1],c2); drawLine(platno,A[0],A[1],C[0],C[1],c2); drawLine(platno,C[0],C[1],B[0],B[1],c2); drawPoint(platno,A[0],A[1],c1); drawPoint(platno,B[0],B[1],c1); drawPoint(platno,C[0],C[1],c1); }
3,533
C++
.h
136
21.551471
104
0.579714
DinoZ1729/Renderer
31
4
0
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,817
functions.h
DinoZ1729_Renderer/functions.h
#include <cmath> //deklaracija funkcija void cross(double r[3],double a[3],double b[3]); double magnitute(double r[3]); void normalize(double r[3]); double dot(double a[3], double b[3]); void transformVector(double vec[3],const double m[16]); void invert(double inv[16],const double matrix[16]); float sign(float Ax,float Ay,float Bx,float By,float Cx,float Cy); int orientation(int p[2], int q[2], int r[2]); void transformVector(double vec[3],const double m[16]) { double tx=vec[0]*m[0]+vec[1]*m[4]+vec[2]*m[8]+m[12], ty=vec[0]*m[1]+vec[1]*m[5]+vec[2]*m[9]+m[13], tz=vec[0]*m[2]+vec[1]*m[6]+vec[2]*m[10]+m[14]; vec[0]=tx; vec[1]=ty; vec[2]=tz; } void invert(double inv[16],const double matrix[16]) { double det; int i; inv[0] = matrix[5] * matrix[10] * matrix[15] - matrix[5] * matrix[11] * matrix[14] - matrix[9] * matrix[6] * matrix[15] + matrix[9] * matrix[7] * matrix[14] + matrix[13] * matrix[6] * matrix[11] - matrix[13] * matrix[7] * matrix[10]; inv[4] = -matrix[4] * matrix[10] * matrix[15] + matrix[4] * matrix[11] * matrix[14] + matrix[8] * matrix[6] * matrix[15] - matrix[8] * matrix[7] * matrix[14] - matrix[12] * matrix[6] * matrix[11] + matrix[12] * matrix[7] * matrix[10]; inv[8] = matrix[4] * matrix[9] * matrix[15] - matrix[4] * matrix[11] * matrix[13] - matrix[8] * matrix[5] * matrix[15] + matrix[8] * matrix[7] * matrix[13] + matrix[12] * matrix[5] * matrix[11] - matrix[12] * matrix[7] * matrix[9]; inv[12] = -matrix[4] * matrix[9] * matrix[14] + matrix[4] * matrix[10] * matrix[13] + matrix[8] * matrix[5] * matrix[14] - matrix[8] * matrix[6] * matrix[13] - matrix[12] * matrix[5] * matrix[10] + matrix[12] * matrix[6] * matrix[9]; inv[1] = -matrix[1] * matrix[10] * matrix[15] + matrix[1] * matrix[11] * matrix[14] + matrix[9] * matrix[2] * matrix[15] - matrix[9] * matrix[3] * matrix[14] - matrix[13] * matrix[2] * matrix[11] + matrix[13] * matrix[3] * matrix[10]; inv[5] = matrix[0] * matrix[10] * matrix[15] - matrix[0] * matrix[11] * matrix[14] - matrix[8] * matrix[2] * matrix[15] + matrix[8] * matrix[3] * matrix[14] + matrix[12] * matrix[2] * matrix[11] - matrix[12] * matrix[3] * matrix[10]; inv[9] = -matrix[0] * matrix[9] * matrix[15] + matrix[0] * matrix[11] * matrix[13] + matrix[8] * matrix[1] * matrix[15] - matrix[8] * matrix[3] * matrix[13] - matrix[12] * matrix[1] * matrix[11] + matrix[12] * matrix[3] * matrix[9]; inv[13] = matrix[0] * matrix[9] * matrix[14] - matrix[0] * matrix[10] * matrix[13] - matrix[8] * matrix[1] * matrix[14] + matrix[8] * matrix[2] * matrix[13] + matrix[12] * matrix[1] * matrix[10] - matrix[12] * matrix[2] * matrix[9]; inv[2] = matrix[1] * matrix[6] * matrix[15] - matrix[1] * matrix[7] * matrix[14] - matrix[5] * matrix[2] * matrix[15] + matrix[5] * matrix[3] * matrix[14] + matrix[13] * matrix[2] * matrix[7] - matrix[13] * matrix[3] * matrix[6]; inv[6] = -matrix[0] * matrix[6] * matrix[15] + matrix[0] * matrix[7] * matrix[14] + matrix[4] * matrix[2] * matrix[15] - matrix[4] * matrix[3] * matrix[14] - matrix[12] * matrix[2] * matrix[7] + matrix[12] * matrix[3] * matrix[6]; inv[10] = matrix[0] * matrix[5] * matrix[15] - matrix[0] * matrix[7] * matrix[13] - matrix[4] * matrix[1] * matrix[15] + matrix[4] * matrix[3] * matrix[13] + matrix[12] * matrix[1] * matrix[7] - matrix[12] * matrix[3] * matrix[5]; inv[14] = -matrix[0] * matrix[5] * matrix[14] + matrix[0] * matrix[6] * matrix[13] + matrix[4] * matrix[1] * matrix[14] - matrix[4] * matrix[2] * matrix[13] - matrix[12] * matrix[1] * matrix[6] + matrix[12] * matrix[2] * matrix[5]; inv[3] = -matrix[1] * matrix[6] * matrix[11] + matrix[1] * matrix[7] * matrix[10] + matrix[5] * matrix[2] * matrix[11] - matrix[5] * matrix[3] * matrix[10] - matrix[9] * matrix[2] * matrix[7] + matrix[9] * matrix[3] * matrix[6]; inv[7] = matrix[0] * matrix[6] * matrix[11] - matrix[0] * matrix[7] * matrix[10] - matrix[4] * matrix[2] * matrix[11] + matrix[4] * matrix[3] * matrix[10] + matrix[8] * matrix[2] * matrix[7] - matrix[8] * matrix[3] * matrix[6]; inv[11] = -matrix[0] * matrix[5] * matrix[11] + matrix[0] * matrix[7] * matrix[9] + matrix[4] * matrix[1] * matrix[11] - matrix[4] * matrix[3] * matrix[9] - matrix[8] * matrix[1] * matrix[7] + matrix[8] * matrix[3] * matrix[5]; inv[15] = matrix[0] * matrix[5] * matrix[10] - matrix[0] * matrix[6] * matrix[9] - matrix[4] * matrix[1] * matrix[10] + matrix[4] * matrix[2] * matrix[9] + matrix[8] * matrix[1] * matrix[6] - matrix[8] * matrix[2] * matrix[5]; det = matrix[0] * inv[0] + matrix[1] * inv[4] + matrix[2] * inv[8] + matrix[3] * inv[12]; det = 1.0 / det; for (i = 0; i < 16; i++) inv[i] *= det; } void cross(double r[3],double a[3],double b[3]) { r[0]=a[1]*b[2]-a[2]*b[1]; r[1]=a[2]*b[0]-a[0]*b[2]; r[2]=a[0]*b[1]-a[1]*b[0]; } double magnitute(double r[3]) { return sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]); } void normalize(double r[3]) { double len=magnitute(r); r[0]/=len; r[1]/=len; r[2]/=len; } double dot(double a[3], double b[3]) { return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]; } float sign(float Ax,float Ay,float Bx,float By,float Cx,float Cy) { return (Ax - Cx) * (By - Cy) - (Bx - Cx) * (Ay - Cy); } int orientation(int p[2], int q[2], int r[2]) { int val = (q[1] - p[1]) * (r[0] - q[0]) - (q[0] - p[0]) * (r[1] - q[1]); if (val == 0) return 0; return (val > 0)? 1: 2; } int inTriangle(int x[2],int a[2],int b[2],int c[2]) { int has_neg,has_pos; float d1, d2, d3; d1 = sign((float)x[0],(float)x[1],(float)a[0],(float)a[1],(float)b[0],(float)b[1]); d2 = sign((float)x[0],(float)x[1],(float)b[0],(float)b[1],(float)c[0],(float)c[1]); d3 = sign((float)x[0],(float)x[1],(float)c[0],(float)c[1],(float)a[0],(float)a[1]); has_neg = (d1 < 0) || (d2 < 0) || (d3 < 0); has_pos = (d1 > 0) || (d2 > 0) || (d3 > 0); return !(has_neg&&has_pos); } int inTriangle(double x[2],int a[2],int b[2],int c[2]) { int has_neg,has_pos; float d1, d2, d3; d1 = sign(x[0],x[1],(float)a[0],(float)a[1],(float)b[0],(float)b[1]); d2 = sign(x[0],x[1],(float)b[0],(float)b[1],(float)c[0],(float)c[1]); d3 = sign(x[0],x[1],(float)c[0],(float)c[1],(float)a[0],(float)a[1]); has_neg = (d1 < 0) || (d2 < 0) || (d3 < 0); has_pos = (d1 > 0) || (d2 > 0) || (d3 > 0); return !(has_neg&&has_pos); } void vector(double a[3],double b[3],double c[3]) { a[0]=b[0]-c[0]; a[1]=b[1]-c[1]; a[2]=b[2]-c[2]; } //calculate surface normal void normal(double n[3],double a[3],double b[3],double c[3]) { double e1[3],e2[3]; vector(e1,b,a); vector(e2,c,a); cross(n,e1,e2); normalize(n); } double clamp(double x,double min,double max) { if (x < min) x = min; else if (x > max) x = max; return x; } //ray plane intersection void rayPlane(double p[3],double p0[3],double n[3],double l0[3],double l[3]) { double diff[3]; vector(diff,p0,l0); double d=dot(diff,n)/dot(l,n); p[0]=l0[0]+d*l[0]; p[1]=l0[1]+d*l[1]; p[2]=l0[2]+d*l[2]; }
8,480
C++
.h
211
31.251185
94
0.483104
DinoZ1729/Renderer
31
4
0
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,818
Sigma.cpp
RCameron93_FehlerFabrik/src/Sigma.cpp
// Basic preset adder/subtractor // Ross Cameron 2020/06/05 // Title font - AppleMyunjo // Main font - Jost // https://indestructibletype.com/Jost.html #include "plugin.hpp" struct Sigma : Module { enum ParamIds { NUM_PARAMS }; enum InputIds { IN_INPUT, NUM_INPUTS }; enum OutputIds { MINUS4_OUTPUT, MINUS3_OUTPUT, MINUS2_OUTPUT, MINUS1_OUTPUT, ADD1_OUTPUT, ADD2_OUTPUT, ADD3_OUTPUT, ADD4_OUTPUT, NUM_OUTPUTS }; enum LightIds { NUM_LIGHTS }; Sigma() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); configInput(IN_INPUT, "Main"); std::string offsets[8] = {"-4", "-3", "-2", "-1", "+1", "+2", "+3", "+4"}; for (int i = 0; i < 8; ++i) { configOutput(MINUS4_OUTPUT + i, offsets[i] + "v"); configBypass(IN_INPUT, MINUS4_OUTPUT + i); } } void process(const ProcessArgs &args) override { int channels = inputs[IN_INPUT].getChannels(); for (int c = 0; c < channels; ++c) { float input = inputs[IN_INPUT].getPolyVoltage(c); for (int i = 0; i < 4; ++i) { float outAdd = input + 4 - i; float outMinus = input - 4 + i; // out = clamp(out, -10.f, 10.f); outputs[MINUS4_OUTPUT + i].setVoltage(outMinus, c); outputs[ADD4_OUTPUT - i].setVoltage(outAdd, c); } } for (int i = 0; i < NUM_OUTPUTS; ++i) { outputs[MINUS4_OUTPUT + i].setChannels(channels); } } }; struct SigmaWidget : ModuleWidget { SigmaWidget(Sigma *module) { setModule(module); setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Sigma.svg"))); addChild(createWidget<FFHexScrew>(Vec(0, 0))); addChild(createWidget<FFHexScrew>(Vec(box.size.x - 1 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(10.16, 65.896)), module, Sigma::IN_INPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(10.16, 113.225)), module, Sigma::MINUS4_OUTPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(10.16, 101.393)), module, Sigma::MINUS3_OUTPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(10.16, 89.561)), module, Sigma::MINUS2_OUTPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(10.16, 77.728)), module, Sigma::MINUS1_OUTPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(10.16, 54.064)), module, Sigma::ADD1_OUTPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(10.16, 42.231)), module, Sigma::ADD2_OUTPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(10.16, 30.399)), module, Sigma::ADD3_OUTPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(10.16, 18.567)), module, Sigma::ADD4_OUTPUT)); } }; Model *modelSigma = createModel<Sigma, SigmaWidget>("Sigma");
3,120
C++
.cpp
85
28.964706
118
0.600265
RCameron93/FehlerFabrik
30
3
7
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,819
Monte.cpp
RCameron93_FehlerFabrik/src/Monte.cpp
// Probabalistic Gate Sequencer // Ross Cameron 2020/05/26 // Title font - ITC Santa Fe // Main font - Jost // https://indestructibletype.com/Jost.html #include "plugin.hpp" struct Monte : Module { enum ParamIds { INTCLOCK_PARAM, STEPS_PARAM, ENUMS(PROB1_PARAM, 8), NUM_PARAMS }; enum InputIds { INTCLOCK_INPUT, EXTCLOCK_INPUT, STEPS_INPUT, RESET_INPUT, ENUMS(PROB1_INPUT, 8), NUM_INPUTS }; enum OutputIds { ENUMS(GATE1_OUTPUT, 8), MAIN_OUTPUT, NUM_OUTPUTS }; enum LightIds { ENUMS(GATE1_LIGHT, 8), MAIN_LIGHT, NUM_LIGHTS }; dsp::SchmittTrigger clockTrigger; dsp::SchmittTrigger resetTrigger; float phase = 0.f; // Phase of internal LFO int index = 0; // Sequencer index int seqPos = 0; // Which of the 8 literal gate outputs is currently active. if index = 12, seqPos = 12 % 8 = 4 (fifth gate) int steps = 8; bool gates[8] = {}; bool out = false; Monte() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); configParam(INTCLOCK_PARAM, -2.f, 6.f, 2.f, "Clock Rate", "BPM", 2.f, 60.f); configParam(STEPS_PARAM, 1.f, 16.f, 8.f, "Sequencer Steps"); configInput(INTCLOCK_INPUT, "Internal Clock CV"); configInput(EXTCLOCK_INPUT, "External Clock Trigger"); configInput(STEPS_INPUT, "Steps CV"); configInput(RESET_INPUT, "Reset Trigger"); configOutput(MAIN_OUTPUT, "Combined"); configLight(MAIN_LIGHT, "Output"); for (int i = 0; i < 8; ++i) { configParam(PROB1_PARAM + i, 0.f, 1.f, 0.5f, string::f("Step %d Probability", i + 1), "%", 0.f, 100.f, 0.f); configInput(PROB1_INPUT + i, string::f("Step %d", i + 1)); configOutput(GATE1_OUTPUT + i, string::f("Step %d", i + 1)); configLight(GATE1_LIGHT + i, string::f("Step %d", i + 1)); } configBypass(EXTCLOCK_INPUT, MAIN_OUTPUT); } int getSteps() { int steps = (int)params[STEPS_PARAM].getValue(); steps += (int)inputs[STEPS_INPUT].getVoltage(); steps = clamp(steps, 1, 32); return steps; } float getProb(int i) { float prob = params[PROB1_PARAM + i].getValue(); prob += 0.1f * inputs[PROB1_INPUT + i].getVoltage(); prob = clamp(prob, 0.f, 1.f); return prob; } void resetSeq() { index = -1; } void advanceIndex() { // Advance sequence ++index; // Reset if we've reached the max number of steps if (!(index < steps)) { index = 0; } seqPos = index % 8; // Get probability that this step will trigger a gate float prob = getProb(seqPos); // Set all gates to zero for (int i = 0; i < 8; ++i) { gates[i] = false; } // Determine if we have a gate this step gates[seqPos] = prob > random::uniform(); } float getRate() { float rate = std::pow(2.f, params[INTCLOCK_PARAM].getValue() + inputs[INTCLOCK_INPUT].getVoltage()); return rate; } bool lfoPhase(float rate, float delta) { // Accumulate phase phase += rate * delta; // After one cycle advance the sequencer index if (phase >= 1.f) { advanceIndex(); phase = 0.f; } // Outputs a squarewave with 50% duty cycle bool lfo = phase < 0.5f; return lfo; } void process(const ProcessArgs &args) override { // Get number of steps steps = getSteps(); // Check for a reset if (resetTrigger.process(inputs[RESET_INPUT].getVoltage())) { resetSeq(); } if (inputs[EXTCLOCK_INPUT].isConnected()) { // External Clock if (clockTrigger.process(inputs[EXTCLOCK_INPUT].getVoltage())) { advanceIndex(); } out = clockTrigger.isHigh(); } else { // Internal Clock (LFO) float clockRate = getRate(); // Accumulate LFO Phase & advance index out = lfoPhase(clockRate, args.sampleTime); } // Output main gate out = (gates[seqPos] && out); outputs[MAIN_OUTPUT].setVoltage(int(out * 10)); lights[MAIN_LIGHT].setBrightness(int(out)); // Output individual gates for (int i = 0; i < 8; ++i) { int gateOut = (int)(gates[i] && out); outputs[GATE1_OUTPUT + i].setVoltage(gateOut * 10); lights[GATE1_LIGHT + i].setBrightness(gateOut); } } }; struct MonteWidget : ModuleWidget { MonteWidget(Monte *module) { setModule(module); setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Monte.svg"))); addChild(createWidget<FFHexScrew>(Vec(RACK_GRID_WIDTH, 0))); addChild(createWidget<FFHexScrew>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); addChild(createWidget<FFHexScrew>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); addChild(createWidget<FFHexScrew>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); addParam(createParamCentered<FF08GKnob>(mm2px(Vec(20.215, 49.089)), module, Monte::INTCLOCK_PARAM)); addParam(createParamCentered<FF08GSnapKnob>(mm2px(Vec(20.215, 87.568)), module, Monte::STEPS_PARAM)); for (int i = 0; i < 8; ++i) { float delta = 12.83; addParam(createParamCentered<FF08GKnob>(mm2px(Vec(46.624, 23.428 + i * delta)), module, Monte::PROB1_PARAM + i)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(34.043, 23.428 + i * delta)), module, Monte::PROB1_INPUT + i)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(60.924, 23.428 + i * delta)), module, Monte::GATE1_OUTPUT + i)); addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(67.705, 23.418 + i * delta)), module, Monte::GATE1_LIGHT + i)); } addInput(createInputCentered<FF01JKPort>(mm2px(Vec(20.215, 61.928)), module, Monte::INTCLOCK_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(20.215, 23.417)), module, Monte::EXTCLOCK_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(20.215, 100.092)), module, Monte::STEPS_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(20.215, 36.251)), module, Monte::RESET_INPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(20.214, 113.263)), module, Monte::MAIN_OUTPUT)); addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(20.214, 120.263)), module, Monte::MAIN_LIGHT)); } }; Model *modelMonte = createModel<Monte, MonteWidget>("Monte");
6,984
C++
.cpp
188
28.898936
137
0.587835
RCameron93/FehlerFabrik
30
3
7
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,820
Botzinger.cpp
RCameron93_FehlerFabrik/src/Botzinger.cpp
// Arbitrary Rhythm Generator // Ross Cameron 2021/09/25 // Title font - Moche Regular // https://www.pepite.world/fonderie/moche/ // Main font - Jost // https://indestructibletype.com/Jost.html #include "plugin.hpp" #include "ffCommon.hpp" struct Botzinger : Module { enum ParamIds { ENUMS(TIME_PARAM, 8), ENUMS(REPEAT_PARAM, 8), ENUMS(WIDTH_PARAM, 8), RATE_PARAM, START_PARAM, DIRECTION_PARAM, NUM_PARAMS }; enum InputIds { ENUMS(TIME_INPUT, 8), ENUMS(REPEAT_INPUT, 8), ENUMS(WIDTH_INPUT, 8), CLOCK_INPUT, RESET_INPUT, START_INPUT, DIRECTION_INPUT, NUM_INPUTS }; enum OutputIds { ENUMS(OUTS_OUTPUT, 8), MAIN_OUTPUT, NUM_OUTPUTS }; enum LightIds { ENUMS(STEP_LIGHT, 8), NUM_LIGHTS }; // All the triggers that may be input dsp::SchmittTrigger resetTrigger; dsp::SchmittTrigger startTrigger; dsp::SchmittTrigger directionTrigger; dsp::SchmittTrigger clockTrigger; // Timers for the free running pulse generator dsp::PulseGenerator pulse; dsp::Timer stepTime; dsp::Timer beatTime; // Counters for the clocked pulse generator int stepClockCount = 0; int beatClockCount = 0; bool clocked = false; Sequencer sequencer; // How long each step/beat/on pulse is, as a fraction of the global rate float globalRate = 0.f; float stepLength = 0.f; float beatLength = 0.f; float pulseWidth = 0.f; int repeats = 1; Botzinger() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); for (int i = 0; i < 8; ++i) { int j = i + 1; configParam(TIME_PARAM + i, 0.f, 1.f, .4f, string::f("Step %d Time", j), "%", 0.f, 100.f); configParam(REPEAT_PARAM + i, 1.f, 32.f, 1.f, string::f("Step %d Repeats", j)); configParam(WIDTH_PARAM + i, 0.f, 1.f, 0.25, string::f("Step %d Width", j), "%", 0.f, 100.f); configInput(TIME_INPUT + i, string::f("Step %d Time CV", j)); configInput(REPEAT_INPUT + i, string::f("Step %d Repeats CV", j)); configInput(WIDTH_INPUT + i, string::f("Step %d Width CV", j)); configOutput(OUTS_OUTPUT, string::f("Step %d", j)); configLight(STEP_LIGHT, string::f("Step %d", j)); } configParam(RATE_PARAM, -2.f, 4.f, 0.f, "Global Rate Multiplier", "", 10.f); configParam(START_PARAM, 0.f, 1.f, 0.f, "Start/Stop"); configParam(DIRECTION_PARAM, 0.f, 1.f, 0.f, "Sequencer Direction"); configInput(CLOCK_INPUT, "Clock Trig"); configInput(RESET_INPUT, "Reset Trig"); configInput(START_INPUT, "Start Trig"); configInput(DIRECTION_INPUT, "Direction Trig"); configOutput(MAIN_OUTPUT, "Main"); sequencer.running = true; } void resetTimers() { stepTime.reset(); beatTime.reset(); pulse.reset(); } void getFreeRunParameters() { // Expect the globalRate param to return a value -2<x<4 globalRate = params[RATE_PARAM].getValue(); // Convert to a decade scale - 10^x seconds globalRate = pow(10.f, globalRate); // stepLength is a percentage of the global rate stepLength = params[TIME_PARAM + sequencer.index].getValue(); if (inputs[TIME_INPUT + sequencer.index].isConnected()) { stepLength += inputs[TIME_INPUT + sequencer.index].getVoltage() * 0.1f; stepLength = clamp(stepLength, 0.f, 1.f); } stepLength *= globalRate; // beatLength is essentially how long a beat is if it is repeated n times in a step repeats = params[REPEAT_PARAM + sequencer.index].getValue(); beatLength = stepLength / repeats; // pulseWidth is a percentage of beatLength, basically pulsewidth pulseWidth = params[WIDTH_PARAM + sequencer.index].getValue(); if (inputs[WIDTH_INPUT + sequencer.index].isConnected()) { pulseWidth += inputs[WIDTH_INPUT + sequencer.index].getVoltage() * 0.1f; pulseWidth = clamp(pulseWidth, 0.f, 1.f); } pulseWidth *= beatLength; } void nextStep() { // Remove any voltage from the current output // This seems to be necessary to clear the individual gate outputs outputs[OUTS_OUTPUT + sequencer.index].setVoltage(0.f); // Set the current sequencer index light to off lights[STEP_LIGHT + sequencer.index].setBrightness(0.f); // Move the internal sequener to the next step sequencer.advanceIndex(); if (clocked) { beatClockCount = 0; stepClockCount = 0; } else { // Restart all timers resetTimers(); // Start a new pulse timer // The length of which is determined by pulseWidth pulse.trigger(pulseWidth); } // Set the new sequencer index light to on lights[STEP_LIGHT + sequencer.index].setBrightness(10.f); } void nextBeat() { // Remove any voltage from the current output // This seems to be necessary to clear the individual gate outputs outputs[OUTS_OUTPUT + sequencer.index].setVoltage(0.f); if (clocked) { beatClockCount = 0; } else { // Restart beat and on timers beatTime.reset(); pulse.reset(); // Start a new pulse timer // The length of which is determined by pulseWidth pulse.trigger(pulseWidth); } } void checkTriggers() { // Check for starts/stops if (startTrigger.process(inputs[START_INPUT].getVoltage() + params[START_PARAM].getValue())) { sequencer.startStop(); } // Check for direction change if (directionTrigger.process(inputs[DIRECTION_INPUT].getVoltage() + params[DIRECTION_PARAM].getValue())) { sequencer.directionChange(); } // Check for resets if (resetTrigger.process(inputs[RESET_INPUT].getVoltage())) { // Clear both timers resetTimers(); stepClockCount = 0; beatClockCount = 0; // Clear the output port of the current step of any voltage outputs[OUTS_OUTPUT + sequencer.index].setVoltage(0.f); // Set the current sequencer index light to off lights[STEP_LIGHT + sequencer.index].setBrightness(0.f); sequencer.reset(); } } void getClockMode() { bool previousState = clocked; clocked = inputs[CLOCK_INPUT].isConnected(); if (clocked != previousState) { // We've just changed clock modes // Reset stuff resetTimers(); stepClockCount = 0; beatClockCount = 0; } } void getClockedParameters() { // Expect the globalRate param to return a value -2<x<4 globalRate = params[RATE_PARAM].getValue(); // Convert to a decade scale - 10^x seconds globalRate = pow(10.f, globalRate); // stepLength stepLength = params[TIME_PARAM + sequencer.index].getValue(); if (inputs[TIME_INPUT + sequencer.index].isConnected()) { stepLength += inputs[TIME_INPUT + sequencer.index].getVoltage() * 0.1f; stepLength = clamp(stepLength, 0.f, 1.f); } stepLength *= globalRate; // beatLength is essentially how long a beat is if it is repeated n times in a step repeats = params[REPEAT_PARAM + sequencer.index].getValue(); beatLength = stepLength / repeats; // pulseWidth is a percentage of beatLength, basically pulsewidth pulseWidth = params[WIDTH_PARAM + sequencer.index].getValue(); if (inputs[WIDTH_INPUT + sequencer.index].isConnected()) { pulseWidth += inputs[WIDTH_INPUT + sequencer.index].getVoltage() * 0.1f; pulseWidth = clamp(pulseWidth, 0.f, 1.f); } pulseWidth *= beatLength; } void process(const ProcessArgs &args) override { float out = 0.f; getClockMode(); checkTriggers(); if (sequencer.running) { if (clocked) { getClockedParameters(); // Run sequencer clocked // // Round off parameter values to a round number? // stepLength = round(stepLength); // beatLength = round(beatLength); // pulseWidth = round(pulseWidth); // Count how many clock pulses have arrived since we started this step if (clockTrigger.process(inputs[CLOCK_INPUT].getVoltage())) { ++stepClockCount; ++beatClockCount; } if (beatClockCount <= pulseWidth) { out = 10.f; } if (beatClockCount > beatLength) { nextBeat(); } if (stepClockCount > stepLength) { nextStep(); } } else { getFreeRunParameters(); if (beatTime.process(args.sampleTime) > beatLength) { nextBeat(); } if (stepTime.process(args.sampleTime) > stepLength) { nextStep(); } out = 10.f * float(pulse.process(args.sampleTime)); } } outputs[OUTS_OUTPUT + sequencer.index].setVoltage(out); outputs[MAIN_OUTPUT].setVoltage(out); } }; struct BotzingerWidget : ModuleWidget { BotzingerWidget(Botzinger *module) { setModule(module); setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Botzinger.svg"))); addChild(createWidget<FFHexScrew>(Vec(RACK_GRID_WIDTH, 0))); addChild(createWidget<FFHexScrew>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); addChild(createWidget<FFHexScrew>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); addChild(createWidget<FFHexScrew>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); for (int i = 0; i < 8; ++i) { float deltaX = 15.0; addParam(createLightParamCentered<LEDLightSlider<RedLight>>(mm2px(Vec(31.462 + (i * deltaX), 50.814)), module, Botzinger::TIME_PARAM + i, Botzinger::STEP_LIGHT + i)); addParam(createParamCentered<FF08GSnapKnob>(mm2px(Vec(31.462 + (i * deltaX), 89.104)), module, Botzinger::REPEAT_PARAM + i)); addParam(createParamCentered<FF08GKnob>(mm2px(Vec(31.462 + (i * deltaX), 100.669)), module, Botzinger::WIDTH_PARAM + i)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(31.462 + (i * deltaX), 24.189)), module, Botzinger::TIME_INPUT + i)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(31.462 + (i * deltaX), 76.492)), module, Botzinger::REPEAT_INPUT + i)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(31.462 + (i * deltaX), 113.225)), module, Botzinger::OUTS_OUTPUT + i)); } addParam(createParamCentered<FF15GSnapKnob>(mm2px(Vec(161.638, 50.45)), module, Botzinger::RATE_PARAM)); addParam(createParamCentered<FFDPW>(mm2px(Vec(167.958, 76.492)), module, Botzinger::START_PARAM)); addParam(createParamCentered<FFDPW>(mm2px(Vec(167.958, 97.487)), module, Botzinger::DIRECTION_PARAM)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(155.317, 24.189)), module, Botzinger::CLOCK_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(167.958, 24.189)), module, Botzinger::RESET_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(155.317, 76.492)), module, Botzinger::START_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(155.317, 97.487)), module, Botzinger::DIRECTION_INPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(155.317, 113.225)), module, Botzinger::MAIN_OUTPUT)); } }; Model *modelBotzinger = createModel<Botzinger, BotzingerWidget>("Botzinger");
10,565
C++
.cpp
311
30.630225
169
0.708076
RCameron93/FehlerFabrik
30
3
7
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,821
Planck.cpp
RCameron93_FehlerFabrik/src/Planck.cpp
// Title font - Wesley Gothic // https://www.behance.net/gallery/53499505/Wesley-Gothic-Free-Font // Main font - Jost // https://indestructibletype.com/Jost.html #include "plugin.hpp" #include "ffCommon.hpp" struct Planck : Module { enum ParamIds { DEPTH_PARAM, RATE_PARAM, NUM_PARAMS }; enum InputIds { DEPTH_INPUT, DEPTH_AMT_INPUT, CRUSH_INPUT, RATE_INPUT, NUM_INPUTS }; enum OutputIds { DEPTH_OUTPUT, CRUSH_OUTPUT, NUM_OUTPUTS }; enum LightIds { NUM_LIGHTS }; BitDepthReducer reducers[16]; SampleRateCrusher crushers[16]; Planck() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); configParam(DEPTH_PARAM, 1.f, 16.f, 16.f, "Bit Depth Reduction", "Bits"); configParam(RATE_PARAM, 0.f, 100.f, 0.f, "Sample Rate Decimation"); configInput(DEPTH_INPUT, "Bit Depth Reducer"); configInput(DEPTH_AMT_INPUT, "Depth Reduction CV"); configInput(CRUSH_INPUT, "Sample Rate Decimator"); configInput(RATE_INPUT, "Sample Rate Decimation CV"); configOutput(DEPTH_OUTPUT, "Bit Depth Reducer"); configOutput(CRUSH_OUTPUT, "Sample Rate Decimator"); configBypass(DEPTH_INPUT, DEPTH_OUTPUT); configBypass(CRUSH_INPUT, CRUSH_OUTPUT); } void process(const ProcessArgs &args) override { // Bit depth reduction // Seperate amount of channels for the depth reducer and the rate crusher int depthChannels = std::max(inputs[DEPTH_INPUT].getChannels(), 1); // Get knob value int globalDepthAmount = (int)params[DEPTH_PARAM].getValue(); // Array to hold output values, will be normalled to the rate crusher input float depthOuts[16] = {0.f}; for (int c = 0; c < depthChannels; ++c) { float depthIn = inputs[DEPTH_INPUT].getPolyVoltage(c); // 1V corresponds to 2^n - 1 bit depth int depthAmount = globalDepthAmount; depthAmount -= (int)2 * inputs[DEPTH_AMT_INPUT].getPolyVoltage(c); depthAmount = clamp(depthAmount, 1, 16); // Perform bit depth reduction // Clamps input to 10v pp / +-5v depthOuts[c] = reducers[c].process(depthIn, depthAmount, 10.f); outputs[DEPTH_OUTPUT].setVoltage(depthOuts[c], c); } outputs[DEPTH_OUTPUT].setChannels(depthChannels); // Sample rate crushing // Get number of channels int crushChannels = inputs[CRUSH_INPUT].getChannels(); // Get knob value int globalCrushAmount = (int)params[RATE_PARAM].getValue(); // If there's nothing connected we set the number of channels to be the same as the depth reducer if (crushChannels == 0) crushChannels = depthChannels; for (int c = 0; c < crushChannels; ++c) { // Get parameters and input // Normalised to depth reduction output float crushIn = inputs[CRUSH_INPUT].getNormalPolyVoltage(depthOuts[c], c); int crushAmount = globalCrushAmount; crushAmount += (int)10 * inputs[RATE_INPUT].getPolyVoltage(c); crushAmount = clamp(crushAmount, 0, 100); // Perfrom sample rate crushing crushers[c].process(crushAmount, crushIn); float crushOut = crushers[c].out; outputs[CRUSH_OUTPUT].setVoltage(crushOut, c); } outputs[CRUSH_OUTPUT].setChannels(crushChannels); } }; struct PlanckWidget : ModuleWidget { PlanckWidget(Planck *module) { setModule(module); setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Planck.svg"))); addChild(createWidget<FFHexScrew>(Vec(RACK_GRID_WIDTH, 0))); addChild(createWidget<FFHexScrew>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); addChild(createWidget<FFHexScrew>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); addChild(createWidget<FFHexScrew>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); addParam(createParamCentered<FF15GSnapKnob>(mm2px(Vec(10.971, 58.109)), module, Planck::DEPTH_PARAM)); addParam(createParamCentered<FF15GKnob>(mm2px(Vec(29.737, 36.251)), module, Planck::RATE_PARAM)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(30.757, 100.434)), module, Planck::CRUSH_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(30.757, 87.594)), module, Planck::RATE_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(9.843, 100.434)), module, Planck::DEPTH_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(9.843, 87.594)), module, Planck::DEPTH_AMT_INPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(30.757, 113.225)), module, Planck::CRUSH_OUTPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(9.843, 113.225)), module, Planck::DEPTH_OUTPUT)); } }; Model *modelPlanck = createModel<Planck, PlanckWidget>("Planck");
5,127
C++
.cpp
115
36.434783
118
0.64998
RCameron93/FehlerFabrik
30
3
7
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,822
Nova.cpp
RCameron93_FehlerFabrik/src/Nova.cpp
// Cut-up Sequenced Sampler // Ross Cameron 2021/01/18 // Title font - Citytype Miami // https://www.citype.net/city/miami // Main font - Jost // https://indestructibletype.com/Jost.html #include "plugin.hpp" #include "ffCommon.hpp" #include <array> // Each sample buffer is 2097152 samples long - 47 seconds at 44.1KHz static const int bufferSize = 1 << 21; // struct Sequencer // { // bool running = false; // // 0 = fwd, 1 = rev, 2 = bounce, 3 = rnd // int direction = 0; // // Just used in bounce mode // int bounceDir = 0; // int index = 0; // Sequencer index // void reset() // { // index = 0; // } // void setIndex(int step) // { // if (step < 8 && step > -1) // { // index = step; // } // } // void startStop() // { // running = !running; // } // void directionChange() // { // // Cycle through direction modes // ++direction; // direction %= 4; // } // void advanceIndex() // { // switch (direction) // { // case 0: // // Forward // ++index; // index %= 8; // break; // case 1: // // Reverse // --index; // index = (index % 8 + 8) % 8; // break; // case 2: // // Bouncing (plays each end twice so as to be a factor of four) // if (bounceDir) // { // ++index; // if (index == 8) // { // bounceDir = !bounceDir; // index = 7; // } // } // else // { // --index; // if (index == -1) // { // bounceDir = !bounceDir; // index = 0; // } // } // break; // case 3: // // Random // { // float rng = 7 * random::uniform(); // index = (int)round(rng); // } // break; // default: // break; // } // } // }; // Data structure for storing sampled audio struct SampleBuffer { std::array<float, bufferSize> sampleBuff; int index = 0; int length = 0; int capacity = bufferSize; float originalSampleRate = 0.f; float currentSampleRate = 0.f; bool full = false; bool finished = false; bool empty = true; void push(float input, float sampleRate) { if (index < capacity) { empty = false; sampleBuff[index] = input; originalSampleRate = sampleRate; ++index; ++length; return; } else { full = true; return; } } void resetIndex(bool reversed) { finished = false; if (!reversed) { index = 0; } else { index = length - 1; } } void clear() { // sampleBuff.fill(0.f); empty = true; length = 0; originalSampleRate = 0.f; currentSampleRate = 0.f; } float play(bool reversed) { if (finished) { return 0.f; } else if (!reversed) { float output = sampleBuff[index]; ++index; if (index > length - 1) { finished = true; } return output; } else { float output = sampleBuff[index]; --index; if (index < 0) { finished = true; } return output; } } }; struct Sampler { SampleBuffer inBuffer; SampleBuffer outBuffer; dsp::SampleRateConverter<1> inputSrc; float output = 0.f; float previousPitch = 0.f; // Clears everything from the input and output buffers void clear() { inBuffer.clear(); outBuffer.clear(); } // Reset all indices ready to begin playback void resetIndex(bool reverse) { // We reset to the end of the recorded buffer if we're about to playback in reverse inBuffer.resetIndex(reverse); outBuffer.resetIndex(reverse); } // Convert from original sample rate a buffer was recorded at to new one determined by the pitch control void convert(float pitch, float sampleRate) { previousPitch = pitch; // Clear previous outBuffer outBuffer.clear(); // Expecting the input paramter to be between -1.f and 1.f // Produces a pitch/speed change from 1/4 to 4 times float ratio = pow(4, -pitch); // New sample rate we're converting to float newRate = inBuffer.originalSampleRate * ratio; outBuffer.currentSampleRate = newRate; // Prepare sample rate converter inputSrc.setRates(inBuffer.originalSampleRate, newRate); int inLen = inBuffer.length + 1; int outLen = std::min((int)(inLen * ratio), (int)bufferSize); outBuffer.length = outLen; // Process the sample rate conversion inputSrc.process((dsp::Frame<1> *)&inBuffer.sampleBuff[0], &inLen, (dsp::Frame<1> *)&outBuffer.sampleBuff[0], &outLen); } void preparePlayback(bool reverse, float pitch) { resetIndex(reverse); // This should only (and always) be true after a recording has just been completed // This is where we'll initially set previousPitch for this recording if (outBuffer.currentSampleRate == 0.f) { // Just copy from the in buffer to the output without any conversion if (pitch == 0.f) { // This should copy over to the output buffer inBuffer.currentSampleRate = inBuffer.originalSampleRate; outBuffer = inBuffer; previousPitch = 0.f; return; } // Copy into the outBuffer via sample rate conversion else { convert(pitch, inBuffer.originalSampleRate); return; } } // Output buffer has a sample rate, and it's what the pitch control says it should be else if (pitch == previousPitch) { // Do nothing here, outBuffer should be correct return; } // Output buffer has a sample rate, but we have a new pitch value else { convert(pitch, inBuffer.originalSampleRate); return; } } void prepareRecording() { // Clear both buffers clear(); // We always record moving forwards through the buffer resetIndex(false); } // Records a sample into the input buffer void record(float input, float sampleRate) { inBuffer.push(input, sampleRate); } // Gets the the next sample from the output buffer float play(bool reverse) { output = outBuffer.play(reverse); return output; } // We use this value to determine the colour of the sequencer LED during playback float playheadPercent() { float percent = (float)outBuffer.index / (float)outBuffer.length; return percent; } }; struct Nova : Module { enum ParamIds { START_PARAM, RESET_PARAM, DIRECTION_PARAM, RECORD_PARAM, ENUMS(GAINS_PARAM, 8), ENUMS(MUTES_PARAM, 8), ENUMS(SKIPS_PARAM, 8), ENUMS(REVERSES_PARAM, 8), ENUMS(TRIGGERS_PARAM, 8), ATTACK_PARAM, RELEASE_PARAM, PITCH_PARAM, NUM_PARAMS }; enum InputIds { IN_INPUT, CLOCK_INPUT, START_INPUT, RESET_INPUT, DIRECTION_INPUT, RECORD_INPUT, ENUMS(TRIGGERS_INPUT, 8), NUM_INPUTS }; enum OutputIds { ENUMS(OUTS_OUTPUT, 8), MAINOUT_OUTPUT, NUM_OUTPUTS }; enum LightIds { ENUMS(SEQS_LIGHT, 24), REC_LIGHT, NUM_LIGHTS }; Sequencer sequencer; Sampler samplers[8]; Ramp ramp; dsp::SchmittTrigger clockTrigger; dsp::SchmittTrigger startTrigger; dsp::SchmittTrigger clearTrigger; dsp::SchmittTrigger directionTrigger; dsp::SchmittTrigger recordTrigger; dsp::SchmittTrigger jumpTriggers[8]; bool recording = false; float gains[8] = {1.f}; // 0 = muted, 1 = active float mutes[8] = {1.f}; // 0 = fwd 1 = rev bool reverses[8] = {0}; bool skips[8] = {0}; Nova() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); configButton(START_PARAM, "Sequencer Start"); configButton(RESET_PARAM, "Sequencer Reset"); configButton(DIRECTION_PARAM, "Sequencer Direction"); configButton(RECORD_PARAM, "Sampler Record Start"); for (int i = 0; i < 8; ++i) { configParam(GAINS_PARAM + i, 0.f, 1.f, 1.f, string::f("Sample %d Gain", i + 1), "dB", -10.f, 20.f); configSwitch(MUTES_PARAM + i, 0.f, 1.f, 0.f, string::f("Sample %d Mute", i + 1), {"Unmuted", "Muted"}); configSwitch(SKIPS_PARAM + i, 0.f, 1.f, 0.f, string::f("Sample %d Skip", i + 1), {"", "Skipped"}); configSwitch(REVERSES_PARAM + i, 0.f, 1.f, 0.f, string::f("Sample %d Reverse", i + 1), {"Forward", "Reversed"}); configButton(TRIGGERS_PARAM + i, string::f("Sample %d Trigger", i + 1)); configInput(TRIGGERS_INPUT + i, string::f("Step %d Trigger", i + 1)); configOutput(OUTS_OUTPUT + i, string::f("Step %d", i + 1)); configLight(SEQS_LIGHT + i * 3, string::f("Step %d", i * 3 + 1)); } configParam(ATTACK_PARAM, 0.f, 1.f, 0.f, "Global Sample Attack"); configParam(RELEASE_PARAM, 0.f, 1.f, 1.f, "Global Sample Release"); configParam(PITCH_PARAM, -1.f, 1.f, 0.f, "Global Sample Pitch", "x", 4.f); configInput(IN_INPUT, "Sampler"); configInput(CLOCK_INPUT, "Clock Trigger"); configInput(START_INPUT, "Start Trigger"); configInput(RESET_INPUT, "Reset Trigger"); configInput(DIRECTION_INPUT, "Direction Trigger"); configInput(RECORD_INPUT, "Record Arm Trigger"); configOutput(MAINOUT_OUTPUT, "Main"); configLight(REC_LIGHT, "Record Arm"); configBypass(IN_INPUT, MAINOUT_OUTPUT); } void displayLED() { // Set all to off for (int i = 0; i < 8; ++i) { lights[SEQS_LIGHT + i * 3].setBrightness(0); lights[SEQS_LIGHT + i * 3 + 1].setBrightness(0); lights[SEQS_LIGHT + i * 3 + 2].setBrightness(0); } int *index = &sequencer.index; if (!mutes[*index]) { // Sample is muted lights[SEQS_LIGHT + sequencer.index * 3].setBrightness(1); lights[SEQS_LIGHT + sequencer.index * 3 + 1].setBrightness(0); } else if (samplers[*index].inBuffer.empty) { // No sample recorded lights[SEQS_LIGHT + sequencer.index * 3].setBrightness(0); lights[SEQS_LIGHT + sequencer.index * 3 + 1].setBrightness(1); } else { // Sample has been recorded // Should change from green to yellow to indicate playback progress through the sample buffer lights[SEQS_LIGHT + sequencer.index * 3].setBrightness(samplers[*index].playheadPercent()); lights[SEQS_LIGHT + sequencer.index * 3 + 1].setBrightness(1); } } void process(const ProcessArgs &args) override { float outs[8] = {0.f}; float mainOut = 0.f; int jumpTo = -1; // ENVELOPE PARAMS // Get rates // These are probably capable of being too fast, a lot of the knob range isn't useful float attack = params[ATTACK_PARAM].getValue(); float release = params[RELEASE_PARAM].getValue(); // Get pitch change amount float pitch = params[PITCH_PARAM].getValue(); // SEQUENCER PARAMS // Externally clocked only // Check for starts/stops if (startTrigger.process(inputs[START_INPUT].getVoltage() + params[START_PARAM].getValue())) { sequencer.startStop(); } // Check for direction change if (directionTrigger.process(inputs[DIRECTION_INPUT].getVoltage() + params[DIRECTION_PARAM].getValue())) { sequencer.directionChange(); } // Check for recording armed if (recordTrigger.process(inputs[RECORD_INPUT].getVoltage() + params[RECORD_PARAM].getValue())) { recording = !recording; } // SAMPLERS PARAMS // Check each sample players state for (int i = 0; i < 8; ++i) { // Get gains gains[i] = params[GAINS_PARAM + i].getValue(); // Check for mutes // Annoyingly I think we have to have 0 = unmuted, 1 = muted for the button to look right, so we do a funny conversion here to get a float we can multiply our sample by mutes[i] = (float)!bool(params[MUTES_PARAM + i].getValue()); // Check for reverses reverses[i] = (bool)params[REVERSES_PARAM + i].getValue(); // Check for skips skips[i] = (bool)params[SKIPS_PARAM + i].getValue(); // Check for jumps if (jumpTriggers[i].process(inputs[TRIGGERS_INPUT + i].getVoltage() + params[TRIGGERS_PARAM + i].getValue())) { jumpTo = i; } } // Check for sample buffer clear if (clearTrigger.process(inputs[RESET_INPUT].getVoltage() + params[RESET_PARAM].getValue())) { for (int i = 0; i < 8; ++i) { samplers[i].clear(); } } // SEQUENCER PROCESSING if (sequencer.running) { // A little easier on the eyes to use this int *index = &sequencer.index; // Sequencer advanced by clock trigger // Really should encapsulate this so we're not repeating ourselves bellow if (clockTrigger.process(inputs[CLOCK_INPUT].getVoltage())) { sequencer.advanceIndex(); // If the current step is skipped, just keep advancing until we find one that isn't // Should this be a do while? while (skips[*index]) { sequencer.advanceIndex(); } // If we're recording a new sample, clear out anything from the buffer if (recording) { samplers[*index].prepareRecording(); } else { // Still need to reset index to begin playback // But here we also perform any necessary sample rate conversion samplers[*index].preparePlayback(reverses[*index], pitch); } // Reset the gain envelope ramp.out = 0.f; ramp.gate = true; } // Sequencer advanced by jumping to a specific step if (jumpTo > -1) { sequencer.setIndex(jumpTo); // We always play a triggered step regardless of whether it's skipped or not // If we're recording a new sample, clear out anything from the buffer if (recording) { samplers[jumpTo].prepareRecording(); } else { // Still need to reset index to begin playback // But here we also perform an necessary sample rate conversion samplers[jumpTo].preparePlayback(reverses[jumpTo], pitch); } // Reset the gain envelope ramp.out = 0.f; ramp.gate = true; } //SAMPLER PROCESSING if (recording) { // Get the input float in = inputs[IN_INPUT].getVoltage(); // Send it to the sampler, along with the sample rate it's being recorded at samplers[*index].record(in, args.sampleRate); // Output whatever we're recording as we're recording it outs[*index] = in; mainOut = in; } else { // Playback samplers[*index].play(reverses[*index]); // Process the ramp even when it's not being used because params might be changed over the playback of a long recording float envelope = 1.f; ramp.process(0.3, attack, release, args.sampleTime, false); // If the knobs are at default we don't use the envelope if (attack > 0.f || release < 1.f) { envelope = ramp.out; } // Multiply the output from the sampler by the relevant gains and send it to the outs outs[*index] = samplers[*index].output * gains[*index] * envelope; mainOut = samplers[*index].output * gains[*index] * mutes[*index] * envelope; } } // Set all the individual step outs for (int i = 0; i < 8; ++i) { outputs[OUTS_OUTPUT + i].setVoltage(outs[i]); } // Set the master out outputs[MAINOUT_OUTPUT].setVoltage(mainOut); // If we're recording, turn the record light on lights[REC_LIGHT].setBrightness(recording); // Display the LED for the current step displayLED(); } }; struct NovaWidget : ModuleWidget { NovaWidget(Nova *module) { setModule(module); setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Nova.svg"))); addChild(createWidget<FFHexScrew>(Vec(RACK_GRID_WIDTH, 0))); addChild(createWidget<FFHexScrew>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); addChild(createWidget<FFHexScrew>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); addChild(createWidget<FFHexScrew>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); addParam(createParamCentered<FFDPW>(mm2px(Vec(28.976, 59.34)), module, Nova::START_PARAM)); addParam(createParamCentered<FFDPW>(mm2px(Vec(28.976, 77.302)), module, Nova::RESET_PARAM)); addParam(createParamCentered<FFDPW>(mm2px(Vec(28.976, 95.263)), module, Nova::DIRECTION_PARAM)); addParam(createParamCentered<FFDPW>(mm2px(Vec(28.976, 113.225)), module, Nova::RECORD_PARAM)); addParam(createParamCentered<FF15GKnob>(mm2px(Vec(190.051, 39.694)), module, Nova::ATTACK_PARAM)); addParam(createParamCentered<FF15GKnob>(mm2px(Vec(190.051, 65.493)), module, Nova::RELEASE_PARAM)); addParam(createParamCentered<FF15GKnob>(mm2px(Vec(190.051, 91.272)), module, Nova::PITCH_PARAM)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(22.88, 23.417)), module, Nova::IN_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(22.88, 41.379)), module, Nova::CLOCK_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(16.335, 59.34)), module, Nova::START_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(16.335, 77.302)), module, Nova::RESET_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(16.335, 95.263)), module, Nova::DIRECTION_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(16.335, 113.225)), module, Nova::RECORD_INPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(190.051, 110.766)), module, Nova::MAINOUT_OUTPUT)); addChild(createLightCentered<MediumLight<RedLight>>(mm2px(Vec(33, 105.200)), module, Nova::REC_LIGHT)); for (int i = 0; i < 8; ++i) { float deltaX = 15.05f; addParam(createParamCentered<FF10GKnob>(mm2px(Vec(61.531 + (i * deltaX), 23.43)), module, Nova::GAINS_PARAM + i)); addParam(createParamCentered<FFDPTW>(mm2px(Vec(61.531 + (i * deltaX), 38.834)), module, Nova::MUTES_PARAM + i)); addParam(createParamCentered<FFDPTW>(mm2px(Vec(61.531 + (i * deltaX), 54.238)), module, Nova::SKIPS_PARAM + i)); addParam(createParamCentered<FFDPTW>(mm2px(Vec(61.531 + (i * deltaX), 69.642)), module, Nova::REVERSES_PARAM + i)); addParam(createParamCentered<FFDPW>(mm2px(Vec(61.531 + (i * deltaX), 85.046)), module, Nova::TRIGGERS_PARAM + i)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(61.531 + (i * deltaX), 97.487)), module, Nova::TRIGGERS_INPUT + i)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(61.531 + (i * deltaX), 110.766)), module, Nova::OUTS_OUTPUT + i)); addChild(createLightCentered<MediumLight<RedGreenBlueLight>>(mm2px(Vec(61.531 + (i * deltaX), 117.503)), module, Nova::SEQS_LIGHT + (i * 3))); } } }; Model *modelNova = createModel<Nova, NovaWidget>("Nova");
17,682
C++
.cpp
571
27.884413
171
0.680458
RCameron93/FehlerFabrik
30
3
7
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
1,542,823
Luigi.cpp
RCameron93_FehlerFabrik/src/Luigi.cpp
// Digital clock and noise generator // Ross Cameron // Title font - GlpyhWorld Meadow // www.glyphworld.online // Main font - Jost // https://indestructibletype.com/Jost.html #include "plugin.hpp" struct Luigi : Module { enum ParamIds { RATE_PARAM, AMP_PARAM, NUM_PARAMS }; enum InputIds { CLOCK_INPUT, RATE_INPUT, AMP_INPUT, NUM_INPUTS }; enum OutputIds { RANDOM_OUTPUT, DUST_OUTPUT, NOISE_OUTPUT, NUM_OUTPUTS }; enum LightIds { NUM_LIGHTS }; dsp::SchmittTrigger clockTrigger; float phase = 0.f; float noise = 0.f; float rndClock = 0.f; float dust = 0.f; void noiseGen(float amplitude) { noise = 3.f * amplitude * random::normal(); noise = clamp(noise, -5.f, 5.f); dust = noise; rndClock = noise > 0 ? 10 : 0; rndClock *= amplitude; } Luigi() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); configParam(RATE_PARAM, 0.f, 12.f, 7.f, "Noise Generator Rate"); configParam(AMP_PARAM, 0.f, 1.f, 1.f, "Noise Amplitude"); configInput(CLOCK_INPUT, "External Clock Trigger"); configInput(RATE_INPUT, "Internal Clock Rate CV"); configInput(AMP_INPUT, "Output Amplitude CV"); configOutput(RANDOM_OUTPUT, "Random Clock"); configOutput(DUST_OUTPUT, "Dust"); configOutput(NOISE_OUTPUT, "Noise"); } void process(const ProcessArgs &args) override { float amplitude = params[AMP_PARAM].getValue(); amplitude += 0.1 * inputs[AMP_INPUT].getVoltage(); amplitude = clamp(amplitude, -1.f, 1.f); dust = 0.f; // External Clock if (inputs[CLOCK_INPUT].isConnected()) { if (clockTrigger.process(inputs[CLOCK_INPUT].getVoltage())) { noiseGen(amplitude); } } // Internal Clock else { float rate = params[RATE_PARAM].getValue(); rate += inputs[RATE_INPUT].getVoltage(); rate = clamp(rate, 0.f, 12.f); rate = 5.f * rack::dsp::approxExp2_taylor5(rate); phase += rate * args.sampleTime; if (phase >= 0.5f) { phase -= 1.f; noiseGen(amplitude); } else if (phase <= -0.5f) { phase += 1.f; } } outputs[RANDOM_OUTPUT].setVoltage(rndClock); outputs[DUST_OUTPUT].setVoltage(dust); outputs[NOISE_OUTPUT].setVoltage(noise); } }; struct LuigiWidget : ModuleWidget { LuigiWidget(Luigi *module) { setModule(module); setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Luigi.svg"))); addChild(createWidget<FFHexScrew>(Vec(RACK_GRID_WIDTH, 0))); addChild(createWidget<FFHexScrew>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); addChild(createWidget<FFHexScrew>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); addChild(createWidget<FFHexScrew>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); addParam(createParamCentered<FF10GKnob>(mm2px(Vec(30.789, 54.414)), module, Luigi::RATE_PARAM)); addParam(createParamCentered<FF10GKnob>(mm2px(Vec(9.851, 54.414)), module, Luigi::AMP_PARAM)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(30.789, 74.757)), module, Luigi::RATE_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(20.32, 31.441)), module, Luigi::CLOCK_INPUT)); addInput(createInputCentered<FF01JKPort>(mm2px(Vec(9.851, 74.757)), module, Luigi::AMP_INPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(20.32, 100.386)), module, Luigi::RANDOM_OUTPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(30.789, 113.225)), module, Luigi::DUST_OUTPUT)); addOutput(createOutputCentered<FF01JKPort>(mm2px(Vec(9.851, 113.225)), module, Luigi::NOISE_OUTPUT)); } }; Model *modelLuigi = createModel<Luigi, LuigiWidget>("Luigi");
4,172
C++
.cpp
116
28.017241
118
0.607727
RCameron93/FehlerFabrik
30
3
7
GPL-3.0
9/20/2024, 10:45:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false