diff --git a/README.MD b/README.MD index 6553f9656..46aafc2b1 100644 --- a/README.MD +++ b/README.MD @@ -189,6 +189,7 @@ pikmin2.usa.dol: `sha1: 90d328bf8f190c90472e8c19e7e53c6ad0fe0d1a` - plugProjectYamashitaU/enemyStoenInfo.cpp - plugProjectYamashitaU/kochappyAnimator.cpp - plugProjectYamashitaU/pelplantGenerator.cpp + - plugProjectYamashitaU/timeMgr.cpp - plugProjectYamashitaU/treasureLightMgr.cpp - JSystem - JSystem/data.cpp diff --git a/include/Game/Cave/Info.h b/include/Game/Cave/Info.h index 0d5102ded..2d341e72c 100644 --- a/include/Game/Cave/Info.h +++ b/include/Game/Cave/Info.h @@ -48,7 +48,7 @@ struct TekiInfo : CNode { EnemyTypeID::EEnemyTypeID m_enemyID; // _18 int m_weight; // _1C BaseGen::Type m_type; // _20 - u8 m_dropMode; // _24 - should really be DropMode enum eventually + u8 m_dropMode; // _24 - should really be DropMode enum eventually u8 _25; // _25 Game::PelletMgr::OtakaraItemCode m_otakaraItemCode; // _26 }; diff --git a/include/Game/Cave/Node.h b/include/Game/Cave/Node.h index 05316e1f2..9e84aacca 100644 --- a/include/Game/Cave/Node.h +++ b/include/Game/Cave/Node.h @@ -75,12 +75,12 @@ struct GateNode : public ObjectLayoutNode { GateNode(); GateNode(GateUnit* unit, int index, int dir); // for dir, use cardinal direction - virtual ~GateNode() { } // _08 (weak) - virtual int getObjectId(); // _10 - virtual u32 getObjectType(); // _14 - virtual int getBirthCount(); // _18 - virtual float getDirection(); // _1C - virtual int getBirthDoorIndex(); // _20 + virtual ~GateNode() { } // _08 (weak) + virtual int getObjectId(); // _10 + virtual u32 getObjectType(); // _14 + virtual int getBirthCount(); // _18 + virtual float getDirection(); // _1C + virtual int getBirthDoorIndex(); // _20 GateUnit* m_unit; // _18 f32 m_direction; // _1C @@ -95,12 +95,12 @@ struct ItemNode : public ObjectLayoutNode { ItemNode(); ItemNode(ItemUnit*, BaseGen*, int); - virtual ~ItemNode() { } // _08 (weak) - virtual int getObjectId(); // _10 - virtual u32 getObjectType(); // _14 - virtual int getBirthCount(); // _18 - virtual float getDirection(); // _1C - virtual void getBirthPosition(float&, float&); // _24 + virtual ~ItemNode() { } // _08 (weak) + virtual int getObjectId(); // _10 + virtual u32 getObjectType(); // _14 + virtual int getBirthCount(); // _18 + virtual float getDirection(); // _1C + virtual void getBirthPosition(float&, float&); // _24 void makeGlobalData(MapNode*); diff --git a/include/Game/Cave/ObjectLayout.h b/include/Game/Cave/ObjectLayout.h index 551cf8094..e15d4688a 100644 --- a/include/Game/Cave/ObjectLayout.h +++ b/include/Game/Cave/ObjectLayout.h @@ -8,15 +8,15 @@ namespace Game { struct ObjectLayoutNode : public CNode { - virtual ~ObjectLayoutNode() { } // _08 (weak) - virtual int getObjectId() = 0; // _10 - virtual u32 getObjectType() = 0; // _14 - virtual int getBirthCount() = 0; // _18 - virtual float getDirection() { return 0.0f; } // _1C (weak) - virtual int getBirthDoorIndex() { return -1; } // _20 (weak) - virtual void getBirthPosition(float&, float&) { } // _24 (weak) - virtual u32 getExtraCode() { return 0; } // _28 (weak) - virtual bool isFixedBattery() { return false; } // _2C (weak) + virtual ~ObjectLayoutNode() { } // _08 (weak) + virtual int getObjectId() = 0; // _10 + virtual u32 getObjectType() = 0; // _14 + virtual int getBirthCount() = 0; // _18 + virtual float getDirection() { return 0.0f; } // _1C (weak) + virtual int getBirthDoorIndex() { return -1; } // _20 (weak) + virtual void getBirthPosition(float&, float&) { } // _24 (weak) + virtual u32 getExtraCode() { return 0; } // _28 (weak) + virtual bool isFixedBattery() { return false; } // _2C (weak) }; struct ObjectLayoutInfo { diff --git a/include/Game/Cave/math.h b/include/Game/Cave/math.h index 8b409e713..c4a29b87e 100644 --- a/include/Game/Cave/math.h +++ b/include/Game/Cave/math.h @@ -10,10 +10,10 @@ inline float pikmin2_sinf(float x) { - if (x < 0.0f) { - return -JMath::sincosTable_.m_table[((int)(x *= -325.9493f ) & 0x7ffU)].first; + if (x < 0.0f) { + return -JMath::sincosTable_.m_table[((int)(x *= -325.9493f) & 0x7ffU)].first; } - return JMath::sincosTable_.m_table[((int)(x *= 325.9493f ) & 0x7ffU)].first; + return JMath::sincosTable_.m_table[((int)(x *= 325.9493f) & 0x7ffU)].first; } inline float pikmin2_cosf(float x) @@ -21,7 +21,7 @@ inline float pikmin2_cosf(float x) if (x < 0.0f) { x = -x; } - return JMath::sincosTable_.m_table[((int)(x *= 325.9493f ) & 0x7ffU)].second; + return JMath::sincosTable_.m_table[((int)(x *= 325.9493f) & 0x7ffU)].second; } -#endif \ No newline at end of file +#endif diff --git a/include/Game/GameConfig.h b/include/Game/GameConfig.h index 584bcd08c..647f9f4cd 100644 --- a/include/Game/GameConfig.h +++ b/include/Game/GameConfig.h @@ -7,49 +7,49 @@ namespace Game { struct GameConfig { struct Parms : public TagParameters { Parms() - : TagParameters("GameConfig") - , m_gamePrint(this, "gamePrint") - , m_Print(this, "Print") - , m_ogawaPrint(this, "ogawaPrint") - , m_shimizuPrint(this, "shimizuPrint") - , m_yamashitaPrint(this, "yamashitaPrint") - , m_kandoPrint(this, "kandoPrint") - , m_nishimuraPrint(this, "nishimuraPrint") - , m_ebisawaPrint(this, "ebisawaPrint") - , m_morimuraPrint(this, "morimuraPrint") - , m_konoPrint(this, "konoPrint") - , m_fujinoPrint(this, "fujinoPrint") - , m_psoundPrint(this, "psoundPrint") - , m_shortCutUp(this, "shortCutUp") - , m_shortCutDown(this, "shortCutDown") - , m_shortCutLeft(this, "shortCutLeft") - , m_shortCutRight(this, "shortCutRight") - , m_allocAllEnemy(this, "allocAllEnemy") - , m_mapparts_path(this, "mapparts_path") - , m_publicity(this, "publicity") - , m_pelletMultiLang(this, "pelletMultiLang") - , m_AI(this, "AI") - , m_timers(this, "timers") - , m_vsTest(this, "vsTest") - , m_vsDeathType(this, "vsDeathType") - , m_vsHiba(this, "vsHiba") - , m_vsY(this, "vsY") - , m_E3version(this, "E3version") - , m_mukki_cherry(this, "mukki_cherry") - , m_marioClubDevelop(this, "marioClubDevelop") - , m_heapStatusPrint(this, "heapStatusPrint") - , m_heapFreeSize(this, "heapFreeSize") - , m_baseGameNewCheck(this, "baseGameNewCheck") - , m_KFesVersion(this, "KFesVersion") - , m_nintendoVersion(this, "nintendoVersion") - , m_language(this, "language") - , m_autosaveOff(this, "autosaveOff") - , m_vsDebugSelectPattern(this, "vsDebugSelectPattern") - , m_vsFifo(this, "vsFifo") - { - } + : TagParameters("GameConfig") + , m_gamePrint(this, "gamePrint") + , m_Print(this, "Print") + , m_ogawaPrint(this, "ogawaPrint") + , m_shimizuPrint(this, "shimizuPrint") + , m_yamashitaPrint(this, "yamashitaPrint") + , m_kandoPrint(this, "kandoPrint") + , m_nishimuraPrint(this, "nishimuraPrint") + , m_ebisawaPrint(this, "ebisawaPrint") + , m_morimuraPrint(this, "morimuraPrint") + , m_konoPrint(this, "konoPrint") + , m_fujinoPrint(this, "fujinoPrint") + , m_psoundPrint(this, "psoundPrint") + , m_shortCutUp(this, "shortCutUp") + , m_shortCutDown(this, "shortCutDown") + , m_shortCutLeft(this, "shortCutLeft") + , m_shortCutRight(this, "shortCutRight") + , m_allocAllEnemy(this, "allocAllEnemy") + , m_mapparts_path(this, "mapparts_path") + , m_publicity(this, "publicity") + , m_pelletMultiLang(this, "pelletMultiLang") + , m_AI(this, "AI") + , m_timers(this, "timers") + , m_vsTest(this, "vsTest") + , m_vsDeathType(this, "vsDeathType") + , m_vsHiba(this, "vsHiba") + , m_vsY(this, "vsY") + , m_E3version(this, "E3version") + , m_mukki_cherry(this, "mukki_cherry") + , m_marioClubDevelop(this, "marioClubDevelop") + , m_heapStatusPrint(this, "heapStatusPrint") + , m_heapFreeSize(this, "heapFreeSize") + , m_baseGameNewCheck(this, "baseGameNewCheck") + , m_KFesVersion(this, "KFesVersion") + , m_nintendoVersion(this, "nintendoVersion") + , m_language(this, "language") + , m_autosaveOff(this, "autosaveOff") + , m_vsDebugSelectPattern(this, "vsDebugSelectPattern") + , m_vsFifo(this, "vsFifo") + { + } - virtual ~Parms() { } // _08 + virtual ~Parms() { } // _08 PrimTagParm m_gamePrint; // _01C PrimTagParm m_Print; // _02C diff --git a/include/Game/TimeMgr.h b/include/Game/TimeMgr.h index b306680bc..3667379b4 100644 --- a/include/Game/TimeMgr.h +++ b/include/Game/TimeMgr.h @@ -48,7 +48,7 @@ struct TimeMgrParms { struct TimeMgr : public CNode { TimeMgr(); - virtual ~TimeMgr() { } // _00 - WEAK - from timeMgr.cpp + virtual ~TimeMgr() { } // _08 - WEAK - from timeMgr.cpp float getRealDayTime(); float getSunGaugeRatio(); diff --git a/obj_files.mk b/obj_files.mk index 474c892c6..313574592 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -453,7 +453,7 @@ YAMASHITA:=\ $(BUILD_DIR)/asm/plugProjectYamashitaU/farm.o\ $(BUILD_DIR)/asm/plugProjectYamashitaU/farmMgr.o\ $(BUILD_DIR)/asm/plugProjectYamashitaU/genEnemy.o\ - $(BUILD_DIR)/asm/plugProjectYamashitaU/timeMgr.o\ + $(BUILD_DIR)/src/plugProjectYamashitaU/timeMgr.o\ $(BUILD_DIR)/src/plugProjectYamashitaU/pelplantGenerator.o\ $(BUILD_DIR)/src/plugProjectYamashitaU/enemyInteractActions.o\ $(BUILD_DIR)/src/plugProjectYamashitaU/enemyAnimatorBase.o\ diff --git a/src/plugProjectNishimuraU/EnemyUnit.cpp b/src/plugProjectNishimuraU/EnemyUnit.cpp index 2083c1fca..23c38c610 100644 --- a/src/plugProjectNishimuraU/EnemyUnit.cpp +++ b/src/plugProjectNishimuraU/EnemyUnit.cpp @@ -13,19 +13,19 @@ inline ObjectLayoutNode::ObjectLayoutNode(); * Address: 802440F4 * Size: 000074 */ -EnemyNode::EnemyNode() +EnemyNode::EnemyNode() { - // Constructor for EnemyNode - // - default = 0 for all, except birthDoorIndex = -1 - - m_enemyUnit = 0; - m_baseGen = 0; - m_birthDoorIndex = -1; - m_birthCount = 0; - m_direction = 0.0f; - m_birthPos.z = 0.0f; - m_birthPos.y = 0.0f; - m_birthPos.x = 0.0f; + // Constructor for EnemyNode + // - default = 0 for all, except birthDoorIndex = -1 + + m_enemyUnit = 0; + m_baseGen = 0; + m_birthDoorIndex = -1; + m_birthCount = 0; + m_direction = 0.0f; + m_birthPos.z = 0.0f; + m_birthPos.y = 0.0f; + m_birthPos.x = 0.0f; } // /* @@ -33,7 +33,7 @@ EnemyNode::EnemyNode() // * Address: 80244168 // * Size: 000060 // */ -// WEAK - Game/Cave/ObjectLayout.h +// WEAK - Game/Cave/ObjectLayout.h // ObjectLayoutNode::~ObjectLayoutNode() { } /* @@ -41,19 +41,19 @@ EnemyNode::EnemyNode() * Address: 802441C8 * Size: 000094 */ -EnemyNode::EnemyNode(EnemyUnit* inputEnemyUnit, BaseGen* inputBaseGen, int birthCount) +EnemyNode::EnemyNode(EnemyUnit* inputEnemyUnit, BaseGen* inputBaseGen, int birthCount) { - // Constructor for EnemyNode with inputs - // - sets m_enemyUnit, m_baseGen and m_birthCount based on inputs, everything else to 0 - // - (except m_birthDoorIndex to -1) - m_enemyUnit = inputEnemyUnit; - m_baseGen = inputBaseGen; - m_birthDoorIndex = -1; - m_birthCount = birthCount; - m_direction = 0.0f; - m_birthPos.z = 0.0f; - m_birthPos.y = 0.0f; - m_birthPos.x = 0.0f; + // Constructor for EnemyNode with inputs + // - sets m_enemyUnit, m_baseGen and m_birthCount based on inputs, everything else to 0 + // - (except m_birthDoorIndex to -1) + m_enemyUnit = inputEnemyUnit; + m_baseGen = inputBaseGen; + m_birthDoorIndex = -1; + m_birthCount = birthCount; + m_direction = 0.0f; + m_birthPos.z = 0.0f; + m_birthPos.y = 0.0f; + m_birthPos.x = 0.0f; } /* @@ -61,28 +61,27 @@ EnemyNode::EnemyNode(EnemyUnit* inputEnemyUnit, BaseGen* inputBaseGen, int birth * Address: 8024425C * Size: 0001A8 */ -void EnemyNode::makeGlobalData(MapNode* mapNode) +void EnemyNode::makeGlobalData(MapNode* mapNode) { - // get global position and direction from mapNode - m_birthPos = mapNode->getBaseGenGlobalPosition(m_baseGen); - m_direction = mapNode->getBaseGenGlobalDirection(m_baseGen); + // get global position and direction from mapNode + m_birthPos = mapNode->getBaseGenGlobalPosition(m_baseGen); + m_direction = mapNode->getBaseGenGlobalDirection(m_baseGen); - // if teki type is 0 (easy), give it a random distance from spawn within radius + random direction - if ((m_baseGen) && (m_baseGen->m_spawnType == 0)) { + // if teki type is 0 (easy), give it a random distance from spawn within radius + random direction + if ((m_baseGen) && (m_baseGen->m_spawnType == 0)) { - // get max radius of spawn - float radius = m_baseGen->m_radius; - // get random radius between 0 and max radius - radius = radius * (float) rand() / 32768.0f; + // get max radius of spawn + float radius = m_baseGen->m_radius; + // get random radius between 0 and max radius + radius = radius * (float)rand() / 32768.0f; - // set random direction from 0 to 2pi (0 to 360 degrees) - m_direction = TAU * (float) rand() / 32768.0f; + // set random direction from 0 to 2pi (0 to 360 degrees) + m_direction = TAU * (float)rand() / 32768.0f; - // move position x and y (z) according to random radius and random direction - m_birthPos.x += radius * pikmin2_sinf(m_direction); // inlined in header - m_birthPos.z += radius * pikmin2_cosf(m_direction); // inlined in header - - } + // move position x and y (z) according to random radius and random direction + m_birthPos.x += radius * pikmin2_sinf(m_direction); // inlined in header + m_birthPos.z += radius * pikmin2_cosf(m_direction); // inlined in header + } } /* @@ -92,9 +91,9 @@ void EnemyNode::makeGlobalData(MapNode* mapNode) */ void EnemyNode::setGlobalData(Vector3f& pos, float direction) { - // set position and direction based on inputs - m_birthPos = pos; - m_direction = direction; + // set position and direction based on inputs + m_birthPos = pos; + m_direction = direction; } /* @@ -109,14 +108,14 @@ void EnemyNode::setBirthDoorIndex(int idx) { m_birthDoorIndex = idx; } * Address: 8024442C * Size: 000020 */ -int EnemyNode::getObjectId() +int EnemyNode::getObjectId() { - // get enemy ID from m_tekiInfo; if no teki info, set to -1 - TekiInfo* tekiInfo = m_enemyUnit->m_tekiInfo; - if (tekiInfo) { - return m_enemyUnit->m_tekiInfo->m_enemyID; - } - return -1; + // get enemy ID from m_tekiInfo; if no teki info, set to -1 + TekiInfo* tekiInfo = m_enemyUnit->m_tekiInfo; + if (tekiInfo) { + return m_enemyUnit->m_tekiInfo->m_enemyID; + } + return -1; } /* @@ -126,12 +125,12 @@ int EnemyNode::getObjectId() */ u32 EnemyNode::getExtraCode() { - // return code of item dweevil is carrying, if any - TekiInfo* tekiInfo = m_enemyUnit->m_tekiInfo; - if (tekiInfo) { - return tekiInfo->m_otakaraItemCode.m_value; - } - return 0; + // return code of item dweevil is carrying, if any + TekiInfo* tekiInfo = m_enemyUnit->m_tekiInfo; + if (tekiInfo) { + return tekiInfo->m_otakaraItemCode.m_value; + } + return 0; } /* @@ -139,14 +138,14 @@ u32 EnemyNode::getExtraCode() * Address: 8024446C * Size: 000020 */ -u32 EnemyNode::getObjectType() +u32 EnemyNode::getObjectType() { - // return drop type for enemy (i.e. condition for falling, if falling) - TekiInfo* tekiInfo = m_enemyUnit->m_tekiInfo; - if (tekiInfo) { - return tekiInfo->m_dropMode; - } - return 0; + // return drop type for enemy (i.e. condition for falling, if falling) + TekiInfo* tekiInfo = m_enemyUnit->m_tekiInfo; + if (tekiInfo) { + return tekiInfo->m_dropMode; + } + return 0; } /* @@ -161,11 +160,11 @@ int EnemyNode::getBirthCount() { return m_birthCount; } * Address: 80244494 * Size: 000014 */ -void EnemyNode::getBirthPosition(float& x, float& y) +void EnemyNode::getBirthPosition(float& x, float& y) { - // get x and y (z) positions - x = m_birthPos.x; - y = m_birthPos.z; + // get x and y (z) positions + x = m_birthPos.x; + y = m_birthPos.z; } /* @@ -187,7 +186,7 @@ int EnemyNode::getBirthDoorIndex() { return m_birthDoorIndex; } * Address: 802444B8 * Size: 000070 */ -// WEAK - in Game/Cave/Node.h +// WEAK - in Game/Cave/Node.h // EnemyNode::~EnemyNode() { } } // namespace Cave diff --git a/src/plugProjectYamashitaU/timeMgr.cpp b/src/plugProjectYamashitaU/timeMgr.cpp index e0de57989..194a9ebd7 100644 --- a/src/plugProjectYamashitaU/timeMgr.cpp +++ b/src/plugProjectYamashitaU/timeMgr.cpp @@ -182,7 +182,7 @@ float TimeMgr::getSunGaugeRatio() f32 var_f3 = m_currentTimeOfDay; if (m_currentTimeOfDay < m_parms.parms.m_dayStartTime.m_value) { - var_f3 += 1.0f; + var_f3 += 24.0f; } return 1.0f - ((var_f3 - m_parms.parms.m_dayEndTime.m_value) / m_sunRatio); diff --git a/src/sysGCU/gameConfig.cpp b/src/sysGCU/gameConfig.cpp index f05789b95..8f97391a8 100644 --- a/src/sysGCU/gameConfig.cpp +++ b/src/sysGCU/gameConfig.cpp @@ -202,8 +202,6 @@ .4byte 0x73706100 */ - - // TODO: How is this string actually (not) used? // DEFINE__PRINT("gameConfig"); // void fakeMatch_printGameConfig() { printf("gameConfig"); }