Implement CookingMgr class (#113)

* Added CookingMgr fields and started on ctor

* Implemented CookItem::copy

* Implemented CookingMgr dtor

* Marked CookingMgr createInstance as matching

* Implemented CookingMgr::getCookItem

* Added CookingMgr::cook decl

* Added CookingMgr method decls

* Replaced part of CookingMgr with sead::FixedObjArray

* Added line separators in cookManager.h

* Defined structs Ingredient and BoostArg in CookingMgr

* Defined structs CookArg and CookIngredient

* Renamed some fields of CookingMgr

* Added struct CookingMgr::CookingEffectEntry

* Started implementing CookingMgr::init

* Set more entries in init

* Set field _548

* Set field default values in init

* Loaded string values from config

* Set mCookingEffectEntries in init

* Added conditional mConfig allocation

* Added FixedTreeMap class to sead

* Used FixedTreeMap in CookingMgr

* Set CookingMgr constructor to default and marked it as matching

* Removed field _31C from CookingMgr

* Updated sead

* Cleared _548 before filling

* Used name hash for _548 keys

* Fixed path setup

* Changed type of _548 to sead::FixedTreeMap<u32, u32, 13>

* Set mNMSSR to correct values

* Fixed field init order

* Rearranged variables

* Swapped entry_hash comparisons

* Changed CRC32 names and index values

* Cast i to u64

* Renamed static crc32 variables

* Renamed _548 to mCookingEffectNameIdMap

* Marked static vars as const and used decimal numbers

* Used sead::SafeArray for mNMMR and mNMSSR

* Rearranged mNMMR and mNMSSR conditions

* Removed size check from mNMMR and mNMSSR conditions

* Removed size check from CEI conditions

* Renamed mRes2 to mResHandle

* Renamed cook args

* Moved crc32 statics into Constants struct

* Marked CookingMgr::init as matching

* Renamed Constants to Crc32Constants

* Added cookFail and cookFailForMissingConfig

* Added NumIngredientsMax, NumEffects, and NumEffectSlots constants

* Renamed getCookItem to setCookItem

* Renamed x to getCookItem

* Implemented getCookItem

* Made setCookItem take a const ref

* Decompiled cookCalcItemPrice

* Marked cookCalcItemPrice as const

* Fixed both cookFail and cookFailForMissingConfig

* Added CookItem::reset

* Added CookingMgr::resetCookItem

* Moved ctor and dtor below static variables

* Changed cookFailForMissingConfig arg to sead::SafeString

* Started on cookCalcBoost

* Moved CookItem into cookManager.h

* Moved Cooking into Game

* Moved CookingMgr to uking namespace

* Inlined CookItem::reset

* Renamed CookItem members

* Fixed CookItem mangled names in uking_functions.csv

* Added enum class CookEffectId

* Moved CookingMgr ctor below disposer impl

* Updated sead

* Started on cookHandleBoostSuccessInner

* Made changes to cookCalcBoost and cookHandleBoostSuccessInner

* Extracted cookHandleBoostMonsterExtractInner

* Removed found_monster_extract in cookCalcBoost

* Marked cookCalcBoost as matching

* Got cookHandleBoostMonsterExtractInner matching

* Made changes to cookHandleBoostSuccessInner

* Renamed discriminator to bonus in cookHandleBoostSuccessInner

* Added CookingMgr::cookCalcSpiceBoost

* Made changes to CookingMgr::cookCalcSpiceBoost

* Added CookingMgr::cookCalcPotencyBoost

* Mostly matched CookingMgr::cookCalcPotencyBoost

* Added CookingMgr::getCookEffectId

* Used getCookEffectId in cookCalcPotencyBoost

* Set access modifiers in CookingMgr

* Made cookCalcPotencyBoost const-correct

* Marked global init as mismatching

* Renamed CookingMgr functions in uking_functions.csv

* Added CookingMgr::prepareCookArg

* Added IngredientArray type

* Added cookWithItems

* Added CookingMgr::prepareCookArg

* Fixed getCookEffectId

* Fixed cookCalcPotencyBoost

* Made changes to prepareCookArg

* Got cookWithItems matching

* Marked vars const

* Removed commented-out destructor and UnkItem

* Renamed CookIngredient._58 to count

* Started on CookingMgr::cook

* Extracted cookAdjustItem

* Fixed ingredient setup

* Extracted actor_info_data

* Fixed some control flow for single ingredients

* Fixed more control flow for single ingredients

* Handled no effect and empty actor name

* Renamed Ingredient::_10 to used_in_recipe

* Fixed recipe control flow

* Matched cookAdjustItem

* Fixed InfoData instance uses

* Removed BAD_RECIPE label

* Rearranged to remove goto

* Added cookCalcRecipeBoost

* Extracted getCookEffectId

* Extracted isCookFailure and isMedicine

* Extracted getCookEffectIdFromTreeMap

* Extracted findIngredientByName and findIngredientByTag

* Marked nonmatching functions

* Added resetArgCookData

* Matched resetArgCookData and prepareCookArg

* Added fields and handleMessage to CookPotRoot

* Started on CookPotRoot::init_

* Added hasMonsterExtract

* Added to CookPotRoot::handleMessage_

* Removed Ingredient::_4 field

* Renamed CookItem::_224 to is_crit

* Renamed CookingEffectEntry members

* Renamed CookingMgr fields

* Changed comparison in cook

* Renamed actor_tag_iter to hash_iter and added num checks

* Got cookCalcSpiceBoost closer to matching

* Removed int_val init from cookCalcSpiceBoost

* Inlined actor_data

* Added `using namespace ksys::act`

* Moved int_val outside loop

* Marked cookCalcSpiceBoost as matching

* Rearranged cookHandleBoostSuccessInner

* Renamed cookCalcPotencyBoost to cookCalcIngredientsBoost

* Renamed stamina_recover to vitality_boost

* Renamed CookItem args to cook_item

* Renamed cookFailForMissingConfig arg

* Used IngredientArray in findIngredient functions

* Renamed crit functions

* Renamed getCookEffectId arg

* Renamed getCookEffectId to getCookEffectIdByName

* Added SetCookItemInDemo::oneShot_

* Matched SetCookItemInDemo::oneShot_

* Added comment about CookArg constructor and formatted

* Removed TODO from CookingMgr

* Marked WIP functions as non-matching

* Fixed formatting

* Matched sead::SafeArray<uking::CookIngredient, 5>::SafeArray

* Added BoostArg default member initializers

* Used auto for cooking_mgr in CookPotRoot::handleMessage_

* Used designated initializers for boost_arg and added whitespace

* Used angle brackets for sead import

* Removed [[maybe_unused]] from declaration

* Used safeDelete

* Inverted condition in CookingMgr::cookCalcCritBoost

* Added getCookingEffectEntry getter and moved CookingEffectEntry up

* Cleaned up CookingMgr::cookCalcSpiceBoost

* Used loops to init ingredient num members

* Converted CookingMgr fields to s32

* Cleaned up CookingMgr::cookCalcItemPrice

* Renamed CookItem::item_price to sell_price

* Used min and max in CookingMgr::cookCalcItemPrice

* Inlined count vars in CookingMgr::cookCalcItemPrice

* Removed explicit casts in CookingMgr::cookCalcItemPrice

* Cleaned up and reformatted CookingMgr::cookCalcIngredientsBoost

* Added casts back into CookingMgr::cookCalcItemPrice to silence warnings
This commit is contained in:
Briggs Baltzell
2023-01-27 11:30:24 -06:00
committed by GitHub
parent 969b1c3f33
commit 2340dc7bc0
16 changed files with 1556 additions and 97 deletions
+31 -30
View File
@@ -386,7 +386,7 @@ Address,Quality,Size,Name
0x0000007100009ffc,O,000140,_ZNK4sead15RuntimeTypeInfo6DeriveIN4ksys4phys7UserTagEE9isDerivedEPKNS0_9InterfaceE
0x000000710000a088,U,000140,
0x000000710000a114,U,000316,CookResult::construct
0x000000710000a250,O,000384,_ZN4ksys8CookItemC1Ev
0x000000710000a250,O,000384,_ZN5uking8CookItemC1Ev
0x000000710000a3d0,U,000532,
0x000000710000a5e4,U,000736,act::copyCookResultToCookItem
0x000000710000a8c4,U,000004,j_GameObject::m0
@@ -15657,7 +15657,7 @@ Address,Quality,Size,Name
0x0000007100246168,O,000020,_ZN5uking6action17SetCookItemInDemoD1Ev
0x000000710024617c,O,000052,_ZN5uking6action17SetCookItemInDemoD0Ev
0x00000071002461b0,O,000008,_ZN5uking6action17SetCookItemInDemo5init_EPN4sead4HeapE
0x00000071002461b8,U,000208,_ZN5uking6action17SetCookItemInDemo8oneShot_Ev
0x00000071002461b8,O,000208,_ZN5uking6action17SetCookItemInDemo8oneShot_Ev
0x0000007100246288,O,000360,_ZN5uking6action17SetCookItemInDemo11loadParams_Ev
0x00000071002463f0,O,000288,_ZNK5uking6action17SetCookItemInDemo27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
0x0000007100246510,O,000092,_ZNK5uking6action17SetCookItemInDemo18getRuntimeTypeInfoEv
@@ -22375,17 +22375,17 @@ Address,Quality,Size,Name
0x0000007100357d1c,U,000008,uking::ai::DragonRootBase::m39
0x0000007100357d24,U,000004,j__ZdlPv_95
0x0000007100357d28,U,000176,AI_AI_CookPotRoot::ctor
0x0000007100357dd8,U,000596,CookArg::ctor
0x0000007100357dd8,O,000596,_ZN4sead9SafeArrayIN5uking14CookIngredientELi5EEC2Ev
0x000000710035802c,U,000112,_ZN5uking2ai11CookPotRootD1Ev
0x000000710035809c,U,000004,nullsub_1060
0x00000071003580a0,U,000120,_ZN5uking2ai11CookPotRootD0Ev
0x0000007100358118,U,000640,_ZN5uking2ai11CookPotRoot5init_EPN4sead4HeapE
0x0000007100358118,M,000640,_ZN5uking2ai11CookPotRoot5init_EPN4sead4HeapE
0x0000007100358398,U,000316,_ZN5uking2ai11CookPotRoot6enter_EPN4ksys3act2ai15InlineParamPackE
0x00000071003584d4,U,000320,AI_AI_CookPotRoot::x
0x0000007100358614,U,000488,_ZN5uking2ai11CookPotRoot5calc_Ev
0x00000071003587fc,U,000192,_ZN5uking2ai11CookPotRoot6leave_Ev
0x00000071003588bc,O,000100,_ZN5uking2ai11CookPotRoot11loadParams_Ev
0x0000007100358920,U,000660,_ZN5uking2ai11CookPotRoot14handleMessage_ERKN4ksys7MessageE
0x0000007100358920,M,000660,_ZN5uking2ai11CookPotRoot14handleMessage_ERKN4ksys7MessageE
0x0000007100358bb4,O,000288,_ZNK5uking2ai11CookPotRoot27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
0x0000007100358cd4,O,000092,_ZNK5uking2ai11CookPotRoot18getRuntimeTypeInfoEv
0x0000007100358d30,U,000204,
@@ -53023,29 +53023,30 @@ Address,Quality,Size,Name
0x000000710089f8c0,O,000140,_ZNK4sead15RuntimeTypeInfo6DeriveIN4ksys3res16EntryFactoryBaseEE9isDerivedEPKNS0_9InterfaceE
0x000000710089f94c,U,000004,j__ZdlPv_390
0x000000710089f950,U,000004,nullsub_5418
0x000000710089f954,U,000792,sinitCookingEffectsAndCrc32
0x000000710089fc6c,U,000084,
0x000000710089fcc0,U,000528,CookItem::copy
0x000000710089fed0,U,000120,CookingMgr::Disposer::dtor
0x000000710089ff48,U,000128,CookingMgr::Disposer::dtorDelete
0x000000710089ffc8,U,000128,CookingMgr::createInstance
0x00000071008a0048,U,000664,CookingMgr::ctor
0x00000071008a02e0,U,000484,CookingMgr::cookFail
0x00000071008a04c4,U,000644,CookingMgr::cookFailForMissingConfig
0x00000071008a0748,U,001112,CookingMgr::cookCalcBoost
0x00000071008a0ba0,U,000436,CookingMgr::cookHandleBoostSuccessInner
0x00000071008a0d54,U,000512,CookingMgr::cookCalc3
0x00000071008a0f54,U,000604,CookingMgr::cookCalcItemPrice
0x00000071008a11b0,U,001412,CookingMgr::cookCalc1
0x00000071008a1734,U,000124,CookingMgr::__auto0
0x00000071008a17b0,U,002908,CookingMgr::init
0x00000071008a230c,U,003308,CookingMgr::cook
0x00000071008a2ff8,U,001648,CookingMgr::resetArgCookData
0x00000071008a3668,U,001628,
0x00000071008a3cc4,U,001496,CookingMgr::cookWithItems
0x00000071008a429c,U,000016,CookingMgr::getCookItem
0x00000071008a42ac,U,000084,
0x00000071008a4300,U,000008,CookingMgr::x
0x000000710089f954,M,000792,_GLOBAL__sub_I_cookManager.cpp
0x000000710089fc6c,O,000084,_ZN5uking8CookItem5resetEv
0x000000710089fcc0,O,000528,_ZNK5uking8CookItem4copyERS0_
0x000000710089fed0,O,000120,_ZN5uking10CookingMgr18SingletonDisposer_D1Ev
0x000000710089ff48,O,000128,_ZN5uking10CookingMgr18SingletonDisposer_D0Ev
0x000000710089ffc8,O,000128,_ZN5uking10CookingMgr14createInstanceEPN4sead4HeapE
0x00000071008a0048,O,000664,_ZN5uking10CookingMgrC1Ev
0x00000071008a02e0,O,000484,_ZN5uking10CookingMgr8cookFailERNS_8CookItemE
0x00000071008a04c4,O,000644,_ZN5uking10CookingMgr24cookFailForMissingConfigERNS_8CookItemERKN4sead14SafeStringBaseIcEE
0x00000071008a0748,O,000708,_ZNK5uking10CookingMgr17cookCalcCritBoostERKN4sead9SafeArrayINS0_10IngredientELi5EEERNS_8CookItemEPKNS0_8BoostArgE
0x00000071008a0a0c,O,000404,_ZNK5uking10CookingMgr24cookHandleMonsterExtractERKN4sead9SafeArrayINS0_10IngredientELi5EEERNS_8CookItemE
0x00000071008a0ba0,M,000436,_ZNK5uking10CookingMgr14cookHandleCritERKN4sead9SafeArrayINS0_10IngredientELi5EEERNS_8CookItemE
0x00000071008a0d54,O,000512,_ZNK5uking10CookingMgr18cookCalcSpiceBoostERKN4sead9SafeArrayINS0_10IngredientELi5EEERNS_8CookItemE
0x00000071008a0f54,O,000604,_ZNK5uking10CookingMgr17cookCalcItemPriceERKN4sead9SafeArrayINS0_10IngredientELi5EEERNS_8CookItemE
0x00000071008a11b0,O,001412,_ZNK5uking10CookingMgr24cookCalcIngredientsBoostERKN4sead9SafeArrayINS0_10IngredientELi5EEERNS_8CookItemE
0x00000071008a1734,O,000124,_ZNK5uking10CookingMgr21getCookEffectIdByNameERKN4sead14SafeStringBaseIcEE
0x00000071008a17b0,O,002908,_ZN5uking10CookingMgr4initEPN4sead4HeapE
0x00000071008a230c,M,003308,_ZN5uking10CookingMgr4cookERKNS_7CookArgERNS_8CookItemERKNS0_8BoostArgE
0x00000071008a2ff8,O,001648,_ZNK5uking10CookingMgr16resetArgCookDataERNS_7CookArgERKN4sead6BufferINS3_15FixedSafeStringILi64EEEEEiRNS_8CookItemE
0x00000071008a3668,O,001628,_ZNK5uking10CookingMgr14prepareCookArgERNS_7CookArgERKN4sead9SafeArrayINS3_15FixedSafeStringILi64EEELi5EEEiRNS_8CookItemE
0x00000071008a3cc4,O,001496,_ZN5uking10CookingMgr13cookWithItemsERKN4sead14SafeStringBaseIcEES5_S5_S5_S5_RNS_8CookItemERKNS0_8BoostArgE
0x00000071008a429c,O,000016,_ZN5uking10CookingMgr11setCookItemERKNS_8CookItemE
0x00000071008a42ac,O,000084,_ZN5uking10CookingMgr13resetCookItemEv
0x00000071008a4300,O,000008,_ZNK5uking10CookingMgr11getCookItemERNS_8CookItemE
0x00000071008a4308,U,000016,
0x00000071008a4318,U,000116,
0x00000071008a438c,U,000048,
@@ -56385,8 +56386,8 @@ Address,Quality,Size,Name
0x000000710096efb8,O,000688,_ZN5uking2ui16PauseMenuDataMgr7itemGetERKN4sead14SafeStringBaseIcEEiPKNS_3act18WeaponModifierInfoE
0x000000710096f268,O,001876,_ZN5uking2ui16PauseMenuDataMgr10addToPouchERKN4sead14SafeStringBaseIcEENS0_13PouchItemTypeERNS1_5ListsEibPKNS_3act18WeaponModifierInfoEb
0x000000710096f9bc,O,001700,_ZNK5uking2ui16PauseMenuDataMgr14saveToGameDataERKN4sead10OffsetListINS0_9PouchItemEEE
0x0000007100970060,O,000248,_ZN5uking2ui16PauseMenuDataMgr11cookItemGetERKN4ksys8CookItemE
0x0000007100970158,O,000268,_ZN5uking2ui16PauseMenuDataMgr26setCookDataOnLastAddedItemERKN4ksys8CookItemE
0x0000007100970060,O,000248,_ZN5uking2ui16PauseMenuDataMgr11cookItemGetERKNS_8CookItemE
0x0000007100970158,O,000268,_ZN5uking2ui16PauseMenuDataMgr26setCookDataOnLastAddedItemERKNS_8CookItemE
0x0000007100970264,O,000116,_ZN5uking2ui16PauseMenuDataMgr22autoEquipLastAddedItemEv
0x00000071009702d8,m,000268,_ZN5uking2ui16PauseMenuDataMgr9autoEquipEPNS0_9PouchItemERKN4sead10OffsetListIS2_EE
0x00000071009703e4,m,000216,_ZN5uking2ui16PauseMenuDataMgr10unequipAllENS0_13PouchItemTypeE
Can't render this file because it is too large.