| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/Dmfc/idmfc.cpp $ |
| 21 | * $Revision: 1.1.1.1 $ |
| 22 | * $Date: 2003/08/26 03:57:21 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * DMFC COM Interface implementation |
| 26 | * |
| 27 | * $Log: idmfc.cpp,v $ |
| 28 | * Revision 1.1.1.1 2003/08/26 03:57:21 kevinb |
| 29 | * initial 1.5 import |
| 30 | * |
| 31 | * |
| 32 | * 3 7/16/99 2:43p Jeff |
| 33 | * changed CreateMenuItemWArgs function |
| 34 | * |
| 35 | * 2 3/17/99 12:25p Jeff |
| 36 | * converted DMFC to be COM interface |
| 37 | * |
| 38 | * 1 3/17/99 11:54a Jeff |
| 39 | * |
| 40 | * $NoKeywords: $ |
| 41 | */ |
| 42 | |
| 43 | #include "idmfc.h"cxx . . $ `<file>/netgames/includes/idmfc.h`/ |
| 44 | #include "dmfcinternal.h"cxx . . $ `<file>/netgames/dmfc/dmfcinternal.h`/ |
| 45 | |
| 46 | /* |
| 47 | *********************************************** |
| 48 | IDMFC |
| 49 | *********************************************** |
| 50 | */ |
| 51 | DMFCBasecxx . . $ DMFCBase# *basethiscxx . . $ basethis. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 52 | IDMFCcxx . . $ IDMFC# DLLFUNCCALLPTRcxx . . $ `lib/module.h:94:10`! CreateDMFCcxx . . $ CreateDMFC(f7722f44b60fc702).(void) { |
| 53 | if (basethiscxx . . $ basethis.) { |
| 54 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 55 | } |
| 56 | |
| 57 | basethiscxx . . $ basethis. = new DMFCBasecxx . . $ DMFCBase#DMFCBase(49f6e7a06ebc5aa8).; |
| 58 | IDMFCcxx . . $ IDMFC# *pfsResult = basethiscxx . . $ basethis.; |
| 59 | if (pfsResult) { |
| 60 | pfsResult->DuplicatePointercxx . . $ IObject#DuplicatePointer(49f6e7a06ebc5aa8).(); |
| 61 | } |
| 62 | |
| 63 | return pfsResult; |
| 64 | } |
| 65 | |
| 66 | void DMFCBasecxx . . $ DMFCBase#::Deletecxx . . $ DMFCBase#Delete(49f6e7a06ebc5aa8).(void) { |
| 67 | delete this; |
| 68 | basethiscxx . . $ basethis. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 69 | } |
| 70 | |
| 71 | void *DMFCBasecxx . . $ DMFCBase#::Dynamic_Castcxx . . $ DMFCBase#Dynamic_Cast(42228c1987407501).(const char *pszType) { |
| 72 | void *pvResult = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 73 | |
| 74 | if (strcmp(pszType, "IDMFC") == 0) |
| 75 | pvResult = static_cast<IDMFCcxx . . $ IDMFC# *>(this); |
| 76 | else |
| 77 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 78 | |
| 79 | ((IObjectcxx . . $ IObject# *)pvResult)->DuplicatePointercxx . . $ IObject#DuplicatePointer(49f6e7a06ebc5aa8).(); |
| 80 | return pvResult; |
| 81 | } |
| 82 | |
| 83 | void DMFCBasecxx . . $ DMFCBase#::DuplicatePointercxx . . $ DMFCBase#DuplicatePointer(49f6e7a06ebc5aa8).(void) { ++m_cPtrscxx . . $ DMFCBase#m_cPtrs.; } |
| 84 | |
| 85 | void DMFCBasecxx . . $ DMFCBase#::DestroyPointercxx . . $ DMFCBase#DestroyPointer(49f6e7a06ebc5aa8).(void) { |
| 86 | if (--m_cPtrscxx . . $ DMFCBase#m_cPtrs. == 0) { |
| 87 | basethiscxx . . $ basethis. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 88 | delete this; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | /* |
| 93 | *********************************************** |
| 94 | IMenuItem |
| 95 | *********************************************** |
| 96 | */ |
| 97 | |
| 98 | IMenuItemcxx . . $ IMenuItem# DLLFUNCCALLPTRcxx . . $ `lib/module.h:94:10`! CreateMenuItemcxx . . $ CreateMenuItem(8efbf9c7cdf9c614).(void) { |
| 99 | IMenuItemcxx . . $ IMenuItem# *pfsResult = new MenuItemcxx . . $ MenuItem#; |
| 100 | if (pfsResult) |
| 101 | pfsResult->DuplicatePointercxx . . $ IObject#DuplicatePointer(49f6e7a06ebc5aa8).(); |
| 102 | return pfsResult; |
| 103 | } |
| 104 | |
| 105 | IMenuItemcxx . . $ IMenuItem# DLLFUNCCALLPTRcxx . . $ `lib/module.h:94:10`! CreateMenuItemWArgscxx . . $ CreateMenuItemWArgs(4be79d200f89c8e1).(const char *title, char type, uint8_tcxx . . $ uint8_t# flags, void (*fp)(int), |
| 106 | tCustomMenucxx . . $ tCustomMenu# *custom_menu) { |
| 107 | MenuItemcxx . . $ MenuItem# *p; |
| 108 | |
| 109 | if (type != MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`! && type != MIT_STATEcxx . . $ `netgames/includes/DMFC.h:515:9`!) { |
| 110 | p = new MenuItemcxx . . $ MenuItem#(title, type, flags, fp); |
| 111 | } else { |
| 112 | if (type == MIT_CUSTOMcxx . . $ `netgames/includes/DMFC.h:517:9`!) { |
| 113 | ASSERTcxx . . $ `netgames/includes/DMFC.h:370:9`!(custom_menu != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 114 | if (custom_menu == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 115 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 116 | |
| 117 | p = new MenuItemcxx . . $ MenuItem#(title, type, flags, fp, custom_menu); |
| 118 | } else { |
| 119 | p = new MenuItemcxx . . $ MenuItem#(title, type, flags, fp, 0, 0); // set initially to 0 state items |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | if (p) |
| 124 | p->DuplicatePointercxx . . $ MenuItem#DuplicatePointer(49f6e7a06ebc5aa8).(); |
| 125 | |
| 126 | return p; |
| 127 | } |
| 128 | |
| 129 | void MenuItemcxx . . $ MenuItem#::Deletecxx . . $ MenuItem#Delete(49f6e7a06ebc5aa8).(void) { delete this; } |
| 130 | |
| 131 | void *MenuItemcxx . . $ MenuItem#::Dynamic_Castcxx . . $ MenuItem#Dynamic_Cast(42228c1987407501).(const char *pszType) { |
| 132 | void *pvResult = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 133 | |
| 134 | if (strcmp(pszType, "IMenuItem") == 0) |
| 135 | pvResult = static_cast<IMenuItemcxx . . $ IMenuItem# *>(this); |
| 136 | else |
| 137 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 138 | |
| 139 | ((IObjectcxx . . $ IObject# *)pvResult)->DuplicatePointercxx . . $ IObject#DuplicatePointer(49f6e7a06ebc5aa8).(); |
| 140 | return pvResult; |
| 141 | } |
| 142 | |
| 143 | void MenuItemcxx . . $ MenuItem#::DuplicatePointercxx . . $ MenuItem#DuplicatePointer(49f6e7a06ebc5aa8).(void) { ++m_cPtrscxx . . $ MenuItem#m_cPtrs.; } |
| 144 | |
| 145 | void MenuItemcxx . . $ MenuItem#::DestroyPointercxx . . $ MenuItem#DestroyPointer(49f6e7a06ebc5aa8).(void) { |
| 146 | if (--m_cPtrscxx . . $ MenuItem#m_cPtrs. == 0) |
| 147 | delete this; |
| 148 | } |
| 149 | |
| 150 | /* |
| 151 | *********************************************** |
| 152 | IDmfcStats |
| 153 | *********************************************** |
| 154 | */ |
| 155 | IDmfcStatscxx . . $ IDmfcStats# DLLFUNCCALLPTRcxx . . $ `lib/module.h:94:10`! CreateDmfcStatscxx . . $ CreateDmfcStats(c8564d9da1e784e1).(void) { |
| 156 | IDmfcStatscxx . . $ IDmfcStats# *pfsResult = new CDmfcStatscxx . . $ CDmfcStats#; |
| 157 | if (pfsResult) |
| 158 | pfsResult->DuplicatePointercxx . . $ IObject#DuplicatePointer(49f6e7a06ebc5aa8).(); |
| 159 | return pfsResult; |
| 160 | } |
| 161 | |
| 162 | void CDmfcStatscxx . . $ CDmfcStats#::Deletecxx . . $ CDmfcStats#Delete(49f6e7a06ebc5aa8).(void) { delete this; } |
| 163 | |
| 164 | void *CDmfcStatscxx . . $ CDmfcStats#::Dynamic_Castcxx . . $ CDmfcStats#Dynamic_Cast(42228c1987407501).(const char *pszType) { |
| 165 | void *pvResult = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 166 | |
| 167 | if (strcmp(pszType, "IDmfcStats") == 0) |
| 168 | pvResult = static_cast<IDmfcStatscxx . . $ IDmfcStats# *>(this); |
| 169 | else |
| 170 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 171 | |
| 172 | ((IObjectcxx . . $ IObject# *)pvResult)->DuplicatePointercxx . . $ IObject#DuplicatePointer(49f6e7a06ebc5aa8).(); |
| 173 | return pvResult; |
| 174 | } |
| 175 | |
| 176 | void CDmfcStatscxx . . $ CDmfcStats#::DuplicatePointercxx . . $ CDmfcStats#DuplicatePointer(49f6e7a06ebc5aa8).(void) { ++m_cPtrscxx . . $ CDmfcStats#m_cPtrs.; } |
| 177 | |
| 178 | void CDmfcStatscxx . . $ CDmfcStats#::DestroyPointercxx . . $ CDmfcStats#DestroyPointer(49f6e7a06ebc5aa8).(void) { |
| 179 | if (--m_cPtrscxx . . $ CDmfcStats#m_cPtrs. == 0) |
| 180 | delete this; |
| 181 | } |