| 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 _LEVELGOAL_H_ |
| 20 | #define _LEVELGOAL_H_cxx . . $ `Descent3/levelgoal.h:20:9`! |
| 21 | |
| 22 | #include "object.h"cxx . . $ `<file>/Descent3/object.h`/ |
| 23 | #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/ |
| 24 | #include <cstdlib> |
| 25 | #include "mem.h"cxx . . $ `<file>/mem/mem.h`/ |
| 26 | #include "levelgoal_external.h"cxx . . $ `<file>/Descent3/levelgoal_external.h`/ |
| 27 | |
| 28 | class litemcxx . . $ litem# { |
| 29 | public: |
| 30 | litemcxx . . $ litem#litem(49f6e7a06ebc5aa8).() { |
| 31 | m_typecxx . . $ litem#m_type. = LIT_OBJECTcxx . . $ `Descent3/levelgoal_external.h:28:9`!; |
| 32 | m_handlecxx . . $ litem#m_handle. = OBJECT_HANDLE_NONEcxx . . $ `Descent3/object_external.h:156:9`!; |
| 33 | m_f_donecxx . . $ litem#m_f_done. = false; |
| 34 | }; |
| 35 | |
| 36 | char m_typecxx . . $ litem#m_type.; |
| 37 | int m_handlecxx . . $ litem#m_handle.; |
| 38 | bool m_f_donecxx . . $ litem#m_f_done.; |
| 39 | }; |
| 40 | |
| 41 | class lgoalcxx . . $ lgoal# { |
| 42 | private: |
| 43 | char *m_namecxx . . $ lgoal#m_name.; |
| 44 | char *m_item_namecxx . . $ lgoal#m_item_name.; |
| 45 | char *m_desccxx . . $ lgoal#m_desc.; |
| 46 | char *m_completion_messagecxx . . $ lgoal#m_completion_message.; |
| 47 | |
| 48 | int m_num_itemscxx . . $ lgoal#m_num_items.; |
| 49 | litemcxx . . $ litem# m_itemcxx . . $ lgoal#m_item.[MAX_GOAL_ITEMScxx . . $ `Descent3/levelgoal_external.h:62:9`!]; |
| 50 | |
| 51 | char m_g_listcxx . . $ lgoal#m_g_list.; |
| 52 | char m_modifiedcxx . . $ lgoal#m_modified.; |
| 53 | bool m_goal_completedcxx . . $ lgoal#m_goal_completed.; // since flags in a multiplayer game (client) get set to 0, then |
| 54 | // reset, we need to use this to store whether the goal has |
| 55 | // been completed, else we *possibly* can complete the goal more than |
| 56 | // once. |
| 57 | int m_prioritycxx . . $ lgoal#m_priority.; |
| 58 | uint32_tcxx . . $ uint32_t# m_flagscxx . . $ lgoal#m_flags.; |
| 59 | |
| 60 | void GoalCompletecxx . . $ lgoal#GoalComplete(918ebd27a9ddbad3).(int handle, bool announce); |
| 61 | void SendMultiUpdatecxx . . $ lgoal#SendMultiUpdate(d4f767463ce0a6b3).(int handle); |
| 62 | |
| 63 | public: |
| 64 | lgoalcxx . . $ lgoal#lgoal(49f6e7a06ebc5aa8).() { |
| 65 | m_namecxx . . $ lgoal#m_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 66 | m_item_namecxx . . $ lgoal#m_item_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 67 | m_desccxx . . $ lgoal#m_desc. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 68 | m_num_itemscxx . . $ lgoal#m_num_items. = 0; |
| 69 | m_completion_messagecxx . . $ lgoal#m_completion_message. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 70 | m_prioritycxx . . $ lgoal#m_priority. = 0; |
| 71 | m_g_listcxx . . $ lgoal#m_g_list. = 0; |
| 72 | m_flagscxx . . $ lgoal#m_flags. = LGF_ENABLEDcxx . . $ `Descent3/levelgoal_external.h:40:9`! | LGF_TELCOM_LISTScxx . . $ `Descent3/levelgoal_external.h:42:9`!; |
| 73 | m_modifiedcxx . . $ lgoal#m_modified. = 0; |
| 74 | m_goal_completedcxx . . $ lgoal#m_goal_completed. = false; |
| 75 | }; |
| 76 | ~cxx . . $ lgoal#`~lgoal`(ced63f7c635d850d).lgoalcxx . . $ lgoal#() { |
| 77 | if (m_namecxx . . $ lgoal#m_name.) |
| 78 | mem_freecxx . . $ `mem/mem.h:80:9`!(m_name); |
| 79 | if (m_item_namecxx . . $ lgoal#m_item_name.) |
| 80 | mem_freecxx . . $ `mem/mem.h:80:9`!(m_item_name); |
| 81 | if (m_desccxx . . $ lgoal#m_desc.) |
| 82 | mem_freecxx . . $ free(bd21765a0afc8e3c).(m_desc); |
| 83 | }; |
| 84 | |
| 85 | int AddItemcxx . . $ lgoal#AddItem(b126dc7c1de90089).(); |
| 86 | bool DeleteItemcxx . . $ lgoal#DeleteItem(83c267b20bac841a).(int index); |
| 87 | bool ItemInfocxx . . $ lgoal#ItemInfo(517b8770e5a0ffe0).(int index, char operation, char *type, int *handle, bool *done); |
| 88 | |
| 89 | void Resetcxx . . $ lgoal#Reset(b45ddcbc8423892c).(bool f_from_editor); |
| 90 | |
| 91 | bool SetNamecxx . . $ lgoal#SetName(ceb9eed3194142b2).(int handle, char *name); |
| 92 | bool SetItemNamecxx . . $ lgoal#SetItemName(c6b7e35ff6de5671).(char *iname); |
| 93 | bool SetDesccxx . . $ lgoal#SetDesc(c6b7e35ff6de5671).(char *desc); |
| 94 | bool SetCompletionMessagecxx . . $ lgoal#SetCompletionMessage(c6b7e35ff6de5671).(char *message); |
| 95 | |
| 96 | int GetNamecxx . . $ lgoal#GetName(6abd07ddb1a912f0).(char *name, int buffer_size); |
| 97 | int GetItemNamecxx . . $ lgoal#GetItemName(6abd07ddb1a912f0).(char *iname, int buffer_size); |
| 98 | int GetDesccxx . . $ lgoal#GetDesc(6abd07ddb1a912f0).(char *desc, int buffer_size); |
| 99 | int GetCompletionMessagecxx . . $ lgoal#GetCompletionMessage(6abd07ddb1a912f0).(char *message, int buffer_size); |
| 100 | |
| 101 | bool Prioritycxx . . $ lgoal#Priority(f3551096b2e9a55d).(int handle, char operation, int *value); |
| 102 | bool GoalListcxx . . $ lgoal#GoalList(c4e55793fafc8042).(char operation, char *value); |
| 103 | bool GetStatuscxx . . $ lgoal#GetStatus(861cbd76ae8afef5).(int handle, char operation, int *value, bool f_save_load = false, bool announce = true); |
| 104 | |
| 105 | void SendStateToPlayercxx . . $ lgoal#SendStateToPlayer(3e454b8ccf442868).(int index, int pnum); |
| 106 | void ResetModifiedcxx . . $ lgoal#ResetModified(49f6e7a06ebc5aa8).(void); |
| 107 | |
| 108 | int GetNumItemscxx . . $ lgoal#GetNumItems(b126dc7c1de90089).(); |
| 109 | }; |
| 110 | |
| 111 | // Goals are sorted by priority and completion |
| 112 | class levelgoalscxx . . $ levelgoals# { |
| 113 | private: |
| 114 | int m_num_goalscxx . . $ levelgoals#m_num_goals.; |
| 115 | lgoalcxx . . $ lgoal# m_goalcxx . . $ levelgoals#m_goal.[MAX_LEVEL_GOALScxx . . $ `Descent3/levelgoal_external.h:63:9`!]; |
| 116 | int m_flagscxx . . $ levelgoals#m_flags.; |
| 117 | |
| 118 | int m_num_active_primariescxx . . $ levelgoals#m_num_active_primaries.; |
| 119 | int m_active_primariescxx . . $ levelgoals#m_active_primaries.[MAX_LEVEL_GOALScxx . . $ `Descent3/levelgoal_external.h:63:9`!]; |
| 120 | int m_num_active_secondariescxx . . $ levelgoals#m_num_active_secondaries.; |
| 121 | int m_active_secondariescxx . . $ levelgoals#m_active_secondaries.[MAX_LEVEL_GOALScxx . . $ `Descent3/levelgoal_external.h:63:9`!]; |
| 122 | |
| 123 | public: |
| 124 | levelgoalscxx . . $ levelgoals#levelgoals(49f6e7a06ebc5aa8).() { |
| 125 | m_num_goalscxx . . $ levelgoals#m_num_goals. = 0; |
| 126 | m_num_active_secondariescxx . . $ levelgoals#m_num_active_secondaries. = 0; |
| 127 | m_num_active_primariescxx . . $ levelgoals#m_num_active_primaries. = 0; |
| 128 | }; |
| 129 | |
| 130 | int AddGoalcxx . . $ levelgoals#AddGoal(73da94e76e6bd037).(bool f_from_editor); |
| 131 | bool DeleteGoalcxx . . $ levelgoals#DeleteGoal(83c267b20bac841a).(int index); |
| 132 | |
| 133 | int GoalAddItemcxx . . $ levelgoals#GoalAddItem(7864480464b09eea).(int goal_index); |
| 134 | bool GoalDeleteItemcxx . . $ levelgoals#GoalDeleteItem(cf9ef193275fa6d8).(int goal_index, int item_index); |
| 135 | bool GoalItemInfocxx . . $ levelgoals#GoalItemInfo(af0847b9747ce646).(int goal_index, int index, char operation, char *type, int *handle, bool *done); |
| 136 | |
| 137 | bool GoalSetNamecxx . . $ levelgoals#GoalSetName(ceb9eed3194142b2).(int goal_index, char *name); |
| 138 | bool GoalSetItemNamecxx . . $ levelgoals#GoalSetItemName(ceb9eed3194142b2).(int goal_index, char *iname); |
| 139 | bool GoalSetDesccxx . . $ levelgoals#GoalSetDesc(ceb9eed3194142b2).(int goal_index, char *desc); |
| 140 | bool GoalSetCompletionMessagecxx . . $ levelgoals#GoalSetCompletionMessage(ceb9eed3194142b2).(int goal_index, char *message); |
| 141 | |
| 142 | int GoalGetNamecxx . . $ levelgoals#GoalGetName(6836bd73a290bb97).(int goal_index, char *name, int buffer_size); |
| 143 | int GoalGetItemNamecxx . . $ levelgoals#GoalGetItemName(6836bd73a290bb97).(int goal_index, char *iname, int buffer_size); |
| 144 | int GoalGetDesccxx . . $ levelgoals#GoalGetDesc(6836bd73a290bb97).(int goal_index, char *desc, int buffer_size); |
| 145 | int GoalGetCompletionMessagecxx . . $ levelgoals#GoalGetCompletionMessage(6836bd73a290bb97).(int goal_index, char *message, int buffer_size); |
| 146 | |
| 147 | bool GoalPrioritycxx . . $ levelgoals#GoalPriority(f3551096b2e9a55d).(int goal_index, char operation, int *value); |
| 148 | bool GoalGoalListcxx . . $ levelgoals#GoalGoalList(5a6a60347df10d71).(int goal_index, char operation, char *value); |
| 149 | bool GoalStatuscxx . . $ levelgoals#GoalStatus(a197d185bbe4f6f0).(int goal_index, char operation, int *value, bool announce = true); |
| 150 | |
| 151 | int GoalFindIdcxx . . $ levelgoals#GoalFindId(5c4306d8553b3696).(const char *goal_name); |
| 152 | |
| 153 | int GoalGetNumItemscxx . . $ levelgoals#GoalGetNumItems(7864480464b09eea).(int goal_index); |
| 154 | |
| 155 | int GetNumGoalscxx . . $ levelgoals#GetNumGoals(b126dc7c1de90089).(); |
| 156 | |
| 157 | bool SaveLevelGoalInfocxx . . $ levelgoals#SaveLevelGoalInfo(254217fab7598d49).(CFILEcxx . . $ CFILE# *fptr); |
| 158 | bool LoadLevelGoalInfocxx . . $ levelgoals#LoadLevelGoalInfo(254217fab7598d49).(CFILEcxx . . $ CFILE# *fptr); |
| 159 | |
| 160 | bool LGStatuscxx . . $ levelgoals#LGStatus(a986cf6c14500712).(char operation, int *value); |
| 161 | |
| 162 | int GetNumActivePrimaryGoalscxx . . $ levelgoals#GetNumActivePrimaryGoals(b126dc7c1de90089).(); |
| 163 | int GetActivePrimaryGoalcxx . . $ levelgoals#GetActivePrimaryGoal(7864480464b09eea).(int p_index); |
| 164 | |
| 165 | int GetNumActiveSecondaryGoalscxx . . $ levelgoals#GetNumActiveSecondaryGoals(b126dc7c1de90089).(); |
| 166 | int GetActiveSecondaryGoalcxx . . $ levelgoals#GetActiveSecondaryGoal(7864480464b09eea).(int s_index); |
| 167 | |
| 168 | void DoFramecxx . . $ levelgoals#DoFrame(49f6e7a06ebc5aa8).(); |
| 169 | void CleanupAfterLevelcxx . . $ levelgoals#CleanupAfterLevel(49f6e7a06ebc5aa8).(); |
| 170 | void InitLevelcxx . . $ levelgoals#InitLevel(49f6e7a06ebc5aa8).(); |
| 171 | void Informcxx . . $ levelgoals#Inform(8589f1c7c2d24df6).(char type, int comp_type, int handle); |
| 172 | |
| 173 | void ResetModifiedFlagscxx . . $ levelgoals#ResetModifiedFlags(49f6e7a06ebc5aa8).(void); |
| 174 | void MultiSendChangedGoalscxx . . $ levelgoals#MultiSendChangedGoals(d4f767463ce0a6b3).(int pnum); |
| 175 | }; |
| 176 | |
| 177 | extern levelgoalscxx . . $ levelgoals# Level_goalscxx . . $ Level_goals.; |
| 178 | |
| 179 | #endif |