| 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 | |
| 19 | #ifndef _MATCEN_H_ |
| 20 | #define _MATCEN_H_cxx . . $ `Descent3/matcen.h:20:9`! |
| 21 | |
| 22 | #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/ |
| 23 | #include "vecmat.h"cxx . . $ `<file>/lib/vecmat.h`/ |
| 24 | #include "matcen_external.h"cxx . . $ `<file>/Descent3/matcen_external.h`/ |
| 25 | |
| 26 | #define MAX_MATCENScxx . . $ `Descent3/matcen.h:26:9`! 60 |
| 27 | #define MAX_MATCEN_NAME_LENcxx . . $ `Descent3/matcen.h:27:9`! 32 |
| 28 | |
| 29 | #define MATCEN_LOADSAVE_VERSIONcxx . . $ `Descent3/matcen.h:29:9`! 3 |
| 30 | |
| 31 | #define MAX_MATCEN_ALIVE_CHILDRENcxx . . $ `Descent3/matcen.h:31:9`! 32 |
| 32 | |
| 33 | extern int Num_matcenscxx . . $ Num_matcens.; |
| 34 | extern bool Matcen_createdcxx . . $ Matcen_created.; |
| 35 | |
| 36 | #define MATCEN_OUTSIDE_NEAR_DISTcxx . . $ `Descent3/matcen.h:36:9`! 150.0f |
| 37 | |
| 38 | #define MATCEN_ACTIVE_CHECK_RATEcxx . . $ `Descent3/matcen.h:38:9`! 4.0f |
| 39 | #define MATCEN_ACTIVE_CHECK_VARIENCEcxx . . $ `Descent3/matcen.h:39:9`! 1.0f |
| 40 | |
| 41 | #define CHECK_ACTIVE_RATEcxx . . $ `Descent3/matcen.h:41:9`! 3.0f |
| 42 | #define CHECK_ACTIVE_VARIENCEcxx . . $ `Descent3/matcen.h:42:9`! 1.0f |
| 43 | |
| 44 | #define MAX_MATCEN_EFFECT_SATURATIONcxx . . $ `Descent3/matcen.h:44:9`! 2 |
| 45 | |
| 46 | #ifdef EDITOR |
| 47 | extern char *MatcenEffectStrings[NUM_MATCEN_EFFECTS]; |
| 48 | #endif |
| 49 | |
| 50 | // Versions |
| 51 | // 1 - Initial |
| 52 | // 2 - Added matcen effects |
| 53 | // 3 - Added matcen active_sound_handle |
| 54 | |
| 55 | class matcencxx . . $ matcen# { |
| 56 | private: |
| 57 | // Static data -- only changes by OSIRIS |
| 58 | char m_namecxx . . $ matcen#m_name.[MAX_MATCEN_NAME_LENcxx . . $ `Descent3/matcen.h:27:9`!]; |
| 59 | |
| 60 | char m_num_prod_typescxx . . $ matcen#m_num_prod_types.; |
| 61 | char m_control_typecxx . . $ matcen#m_control_type.; |
| 62 | char m_typecxx . . $ matcen#m_type.; |
| 63 | char m_creation_effectcxx . . $ matcen#m_creation_effect.; |
| 64 | int16_t m_creation_texturecxx . . $ matcen#m_creation_texture.; |
| 65 | uint8_tcxx . . $ uint8_t# m_cur_saturation_countcxx . . $ matcen#m_cur_saturation_count.; |
| 66 | |
| 67 | int m_num_spawn_pntscxx . . $ matcen#m_num_spawn_pnts.; |
| 68 | |
| 69 | unioncxx . . $ matcen#$anonymous_type_0# { |
| 70 | int m_roomnumcxx . . $ matcen#$anonymous_type_0#m_roomnum.; |
| 71 | int m_objrefcxx . . $ matcen#$anonymous_type_0#m_objref.; |
| 72 | }; |
| 73 | |
| 74 | vectorcxx . . $ vector# m_create_pntcxx . . $ matcen#m_create_pnt.; |
| 75 | int m_create_roomcxx . . $ matcen#m_create_room.; |
| 76 | |
| 77 | int m_spawn_pntcxx . . $ matcen#m_spawn_pnt.[MAX_SPAWN_PNTScxx . . $ `Descent3/matcen_external.h:23:9`!]; |
| 78 | vectorcxx . . $ vector# m_spawn_veccxx . . $ matcen#m_spawn_vec.[MAX_SPAWN_PNTScxx . . $ `Descent3/matcen_external.h:23:9`!]; |
| 79 | vectorcxx . . $ vector# m_spawn_normalcxx . . $ matcen#m_spawn_normal.[MAX_SPAWN_PNTScxx . . $ `Descent3/matcen_external.h:23:9`!]; |
| 80 | int16_t m_spawn_vis_effectscxx . . $ matcen#m_spawn_vis_effects.[MAX_MATCEN_EFFECT_SATURATIONcxx . . $ `Descent3/matcen.h:44:9`!][MAX_SPAWN_PNTScxx . . $ `Descent3/matcen_external.h:23:9`!]; |
| 81 | |
| 82 | int m_max_prodcxx . . $ matcen#m_max_prod.; |
| 83 | |
| 84 | int m_prod_typecxx . . $ matcen#m_prod_type.[MAX_PROD_TYPEScxx . . $ `Descent3/matcen_external.h:22:9`!]; |
| 85 | float m_prod_timecxx . . $ matcen#m_prod_time.[MAX_PROD_TYPEScxx . . $ `Descent3/matcen_external.h:22:9`!]; |
| 86 | int m_prod_prioritycxx . . $ matcen#m_prod_priority.[MAX_PROD_TYPEScxx . . $ `Descent3/matcen_external.h:22:9`!]; |
| 87 | int m_max_prod_typecxx . . $ matcen#m_max_prod_type.[MAX_PROD_TYPEScxx . . $ `Descent3/matcen_external.h:22:9`!]; |
| 88 | |
| 89 | int16_t m_max_alive_childrencxx . . $ matcen#m_max_alive_children.; |
| 90 | int16_t m_num_alivecxx . . $ matcen#m_num_alive.; |
| 91 | int *m_alive_listcxx . . $ matcen#m_alive_list.; // list of alive children |
| 92 | |
| 93 | float m_preprod_timecxx . . $ matcen#m_preprod_time.; |
| 94 | float m_postprod_timecxx . . $ matcen#m_postprod_time.; |
| 95 | |
| 96 | int m_soundscxx . . $ matcen#m_sounds.[MAX_MATCEN_SOUNDScxx . . $ `Descent3/matcen_external.h:60:9`!]; |
| 97 | |
| 98 | float m_speed_multicxx . . $ matcen#m_speed_multi.; |
| 99 | |
| 100 | // Dynamic values that change without scripting |
| 101 | char m_prod_modecxx . . $ matcen#m_prod_mode.; |
| 102 | float m_prod_mode_timecxx . . $ matcen#m_prod_mode_time.; |
| 103 | |
| 104 | int m_statuscxx . . $ matcen#m_status.; |
| 105 | |
| 106 | int m_num_prodcxx . . $ matcen#m_num_prod.; |
| 107 | int m_last_prod_type_indexcxx . . $ matcen#m_last_prod_type_index.; |
| 108 | float m_last_prod_finish_timecxx . . $ matcen#m_last_prod_finish_time.; |
| 109 | |
| 110 | int m_cached_prod_indexcxx . . $ matcen#m_cached_prod_index.; |
| 111 | float m_cached_prod_timecxx . . $ matcen#m_cached_prod_time.; |
| 112 | |
| 113 | int m_sound_active_handlecxx . . $ matcen#m_sound_active_handle.; |
| 114 | |
| 115 | float m_next_active_check_timecxx . . $ matcen#m_next_active_check_time.; |
| 116 | bool m_last_active_check_resultcxx . . $ matcen#m_last_active_check_result.; |
| 117 | |
| 118 | int m_last_prod_objrefcxx . . $ matcen#m_last_prod_objref.; |
| 119 | |
| 120 | int m_num_prod_typecxx . . $ matcen#m_num_prod_type.[MAX_PROD_TYPEScxx . . $ `Descent3/matcen_external.h:22:9`!]; |
| 121 | |
| 122 | // Private functions that are not available outside of the matcen internals |
| 123 | bool StartObjProdcxx . . $ matcen#StartObjProd(c9857a73d68e59ba).(); |
| 124 | bool DoObjProdcxx . . $ matcen#DoObjProd(c9857a73d68e59ba).(); |
| 125 | bool FinishObjProdcxx . . $ matcen#FinishObjProd(c9857a73d68e59ba).(); |
| 126 | |
| 127 | bool ComputeNextProdInfocxx . . $ matcen#ComputeNextProdInfo(c9857a73d68e59ba).(); |
| 128 | bool ComputeCreatePntcxx . . $ matcen#ComputeCreatePnt(c9857a73d68e59ba).(); |
| 129 | |
| 130 | void CheckActivateStatuscxx . . $ matcen#CheckActivateStatus(49f6e7a06ebc5aa8).(); |
| 131 | bool DoAliveListFramecxx . . $ matcen#DoAliveListFrame(c9857a73d68e59ba).(); |
| 132 | bool AddToAliveListcxx . . $ matcen#AddToAliveList(83c267b20bac841a).(int objref); |
| 133 | |
| 134 | public: |
| 135 | matcencxx . . $ matcen#matcen(49f6e7a06ebc5aa8).(); |
| 136 | ~cxx . . $ matcen#`~matcen`(49f6e7a06ebc5aa8).matcencxx . . $ matcen#(); |
| 137 | |
| 138 | void SetCreationTexturecxx . . $ matcen#SetCreationTexture(68e3ae50fe6578a9).(int16_t texnum); |
| 139 | int16_t GetCreationTexturecxx . . $ matcen#GetCreationTexture(4c3706f7850cf040).(); |
| 140 | |
| 141 | char GetAttachTypecxx . . $ matcen#GetAttachType(6e9c618e4dd2eafc).(); |
| 142 | bool SetAttachTypecxx . . $ matcen#SetAttachType(b5fd09639b7a0261).(char type); |
| 143 | |
| 144 | char GetControlTypecxx . . $ matcen#GetControlType(6e9c618e4dd2eafc).(); |
| 145 | bool SetControlTypecxx . . $ matcen#SetControlType(b5fd09639b7a0261).(char type); |
| 146 | |
| 147 | int GetAttachcxx . . $ matcen#GetAttach(b126dc7c1de90089).(); |
| 148 | bool SetAttachcxx . . $ matcen#SetAttach(83c267b20bac841a).(int attach); |
| 149 | |
| 150 | bool GetCreatePntcxx . . $ matcen#GetCreatePnt(4719af520dcffa60).(vectorcxx . . $ vector# *pnt); |
| 151 | bool SetCreatePntcxx . . $ matcen#SetCreatePnt(4719af520dcffa60).(vectorcxx . . $ vector# *pnt); |
| 152 | int GetCreateRoomcxx . . $ matcen#GetCreateRoom(b126dc7c1de90089).(); |
| 153 | bool SetCreateRoomcxx . . $ matcen#SetCreateRoom(83c267b20bac841a).(int room); |
| 154 | |
| 155 | char GetNumSpawnPntscxx . . $ matcen#GetNumSpawnPnts(6e9c618e4dd2eafc).(); |
| 156 | bool SetNumSpawnPntscxx . . $ matcen#SetNumSpawnPnts(b5fd09639b7a0261).(char num_s); |
| 157 | |
| 158 | int GetSpawnPntcxx . . $ matcen#GetSpawnPnt(784f3405e7e545be).(char s_index); |
| 159 | bool SetSpawnPntcxx . . $ matcen#SetSpawnPnt(2878427ea6fbc47b).(char s_index, int s_value); |
| 160 | |
| 161 | void SaveDatacxx . . $ matcen#SaveData(3639e799710acb68).(CFILEcxx . . $ CFILE# *fptr); |
| 162 | void LoadDatacxx . . $ matcen#LoadData(3639e799710acb68).(CFILEcxx . . $ CFILE# *fptr); |
| 163 | |
| 164 | void GetNamecxx . . $ matcen#GetName(fda57c8427c60377).(char *); |
| 165 | bool SetNamecxx . . $ matcen#SetName(c5f7da30cbc0f4e9).(const char *); |
| 166 | |
| 167 | int GetMaxProdcxx . . $ matcen#GetMaxProd(b126dc7c1de90089).(); |
| 168 | bool SetMaxProdcxx . . $ matcen#SetMaxProd(83c267b20bac841a).(int max_p); |
| 169 | |
| 170 | char GetNumProdTypescxx . . $ matcen#GetNumProdTypes(6e9c618e4dd2eafc).(); |
| 171 | bool SetNumProdTypescxx . . $ matcen#SetNumProdTypes(b5fd09639b7a0261).(char num_prod_types); |
| 172 | |
| 173 | bool GetProdInfocxx . . $ matcen#GetProdInfo(a55cc0d2b0f04aaa).(char index, int *type_id, int *priority, float *time, int *max_prod); |
| 174 | bool SetProdInfocxx . . $ matcen#SetProdInfo(a55cc0d2b0f04aaa).(char index, int *type_id, int *priority, float *time, int *max_prod); |
| 175 | |
| 176 | float GetProdMultipliercxx . . $ matcen#GetProdMultiplier(9b8c9e39889c762c).(); |
| 177 | bool SetProdMultipliercxx . . $ matcen#SetProdMultiplier(4e2b510d3867ab27).(float multi); |
| 178 | |
| 179 | int GetStatuscxx . . $ matcen#GetStatus(b126dc7c1de90089).(); |
| 180 | bool SetStatuscxx . . $ matcen#SetStatus(9609253e83e89946).(int status, bool f_enable); // Not all flags are settable |
| 181 | |
| 182 | void DoThinkFramecxx . . $ matcen#DoThinkFrame(49f6e7a06ebc5aa8).(); |
| 183 | void DoRenderFramecxx . . $ matcen#DoRenderFrame(49f6e7a06ebc5aa8).(); |
| 184 | |
| 185 | char GetCreationEffectcxx . . $ matcen#GetCreationEffect(6e9c618e4dd2eafc).(); |
| 186 | bool SetCreationEffectcxx . . $ matcen#SetCreationEffect(b5fd09639b7a0261).(char effect_index); |
| 187 | |
| 188 | int GetMaxAliveChildrencxx . . $ matcen#GetMaxAliveChildren(b126dc7c1de90089).(); |
| 189 | bool SetMaxAliveChildrencxx . . $ matcen#SetMaxAliveChildren(83c267b20bac841a).(int max_alive); |
| 190 | |
| 191 | float GetPreProdTimecxx . . $ matcen#GetPreProdTime(9b8c9e39889c762c).(); |
| 192 | bool SetPreProdTimecxx . . $ matcen#SetPreProdTime(4e2b510d3867ab27).(float time); |
| 193 | |
| 194 | float GetPostProdTimecxx . . $ matcen#GetPostProdTime(9b8c9e39889c762c).(); |
| 195 | bool SetPostProdTimecxx . . $ matcen#SetPostProdTime(4e2b510d3867ab27).(float time); |
| 196 | |
| 197 | int GetSoundcxx . . $ matcen#GetSound(784f3405e7e545be).(char sound_type); |
| 198 | bool SetSoundcxx . . $ matcen#SetSound(2878427ea6fbc47b).(char sound_type, int sound_index); |
| 199 | |
| 200 | void Resetcxx . . $ matcen#Reset(49f6e7a06ebc5aa8).(); |
| 201 | }; |
| 202 | |
| 203 | extern matcencxx . . $ matcen# *Matcencxx . . $ Matcen.[MAX_MATCENScxx . . $ `Descent3/matcen.h:26:9`!]; |
| 204 | int FindMatcenIndexcxx . . $ FindMatcenIndex(5c4306d8553b3696).(const char *name); |
| 205 | int CreateMatcencxx . . $ CreateMatcen(d75b4a580f3cbb10).(const char *name, bool *f_name_changed); |
| 206 | void InitMatcenscxx . . $ InitMatcens(49f6e7a06ebc5aa8).(); |
| 207 | |
| 208 | void DestroyAllMatcenscxx . . $ DestroyAllMatcens(49f6e7a06ebc5aa8).(); |
| 209 | |
| 210 | void DestroyMatcencxx . . $ DestroyMatcen(918ebd27a9ddbad3).(int id, bool f_resort); |
| 211 | |
| 212 | bool MatcenValidcxx . . $ MatcenValid(83c267b20bac841a).(int id); |
| 213 | |
| 214 | void DoMatcensFramecxx . . $ DoMatcensFrame(49f6e7a06ebc5aa8).(); |
| 215 | void DoMatcensRenderFramecxx . . $ DoMatcensRenderFrame(49f6e7a06ebc5aa8).(); |
| 216 | void InitMatcensForLevelcxx . . $ InitMatcensForLevel(49f6e7a06ebc5aa8).(); |
| 217 | |
| 218 | #endif |