Small tweak

This commit is contained in:
intns 2022-10-30 12:49:01 +00:00
parent 6daf065b03
commit aaac36217b
25 changed files with 111 additions and 126 deletions

9
docs/classes.md Normal file
View File

@ -0,0 +1,9 @@
# Class definitions in header files
When writing code for the project, you will have to create definitions of classes.
Sometimes it is not entirely obvious where a class will be situated, so this file will aim to keep documentation regarding the location of those header files.
Please note that this list will not be exhaustive nor will it be completely up-to-date all the time.
Furthermore, always perform a search of the project for your target structure or namespace before creating a new header file.
## Game
- `BaseHIOParms`, `BaseHIOSection`, `HIORootNode` can be found in `Game/BaseHIO.h`
- `TPositionObject`, `CollNode`, `CollisionBuffer`, `CellLeg`, `Cell`, `CellObject`, `CellLayer`, `CellPyramid`, `CellIteratorArg`, `CellIterator` can be found in `cellPyramid.h`

View File

@ -120,7 +120,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/cellMgrParms.cpp">cellMgrParms.cpp</a> | 6740 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_Load.cpp">singleGS_Load.cpp</a> | 10000 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/mapMgrTraceMove.cpp">mapMgrTraceMove.cpp</a> | 10344 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/efxModelObjects.cpp">efxModelObjects.cpp</a> | 11463 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameDeathCount.cpp">gameDeathCount.cpp</a> | 12494 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gamePelletList.cpp">gamePelletList.cpp</a> | 12594 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/baseHIOSection.cpp">baseHIOSection.cpp</a> | 13040 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/cellIterator.cpp">cellIterator.cpp</a> | 13172 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/baseHIOSection.cpp">baseHIOSection.cpp</a> | 13033 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/cellIterator.cpp">cellIterator.cpp</a> | 13172 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/vsGS_Load.cpp">vsGS_Load.cpp</a> | 13331 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/flockMgr.cpp">flockMgr.cpp</a> | 13934 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiBridge.cpp">aiBridge.cpp</a> | 14258 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/genPiki.cpp">genPiki.cpp</a> | 14456 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/genPellet.cpp">genPellet.cpp</a> | 14546 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/genItem.cpp">genItem.cpp</a> | 15329 |
@ -142,7 +142,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/baseGameSectionKantei.cpp">baseGameSectionKantei.cpp</a> | 35291 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/vsGS_Title.cpp">vsGS_Title.cpp</a> | 37212 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_DayEnd.cpp">singleGS_DayEnd.cpp</a> | 37384 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiWeed.cpp">aiWeed.cpp</a> | 38092 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiAttack.cpp">aiAttack.cpp</a> | 38728 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/collinfo.cpp">collinfo.cpp</a> | 42536 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameCPlate.cpp">gameCPlate.cpp</a> | 43839 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/creature.cpp">creature.cpp</a> | 45782 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameCPlate.cpp">gameCPlate.cpp</a> | 43839 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/creature.cpp">creature.cpp</a> | 45794 |
### <section id="plugProjectKonoU">plugProjectKonoU</section>
| File | Size (bytes) | File | Size (bytes) |
@ -173,7 +173,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/BigFootShadow.cpp">BigFootShadow.cpp</a> | 15684 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/HoudaiShadow.cpp">HoudaiShadow.cpp</a> | 17519 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/DamagumoShadow.cpp">DamagumoShadow.cpp</a> | 18421 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/SnakeWholeShadow.cpp">SnakeWholeShadow.cpp</a> | 19376 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/SnakeCrowShadow.cpp">SnakeCrowShadow.cpp</a> | 19417 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/MaroFrog.cpp">MaroFrog.cpp</a> | 20927 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/RumbleMgr.cpp">RumbleMgr.cpp</a> | 21535 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/ImomushiState.cpp">ImomushiState.cpp</a> | 22020 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/RumbleMgr.cpp">RumbleMgr.cpp</a> | 21535 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/ImomushiState.cpp">ImomushiState.cpp</a> | 22042 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/QueenState.cpp">QueenState.cpp</a> | 22718 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Demon.cpp">Demon.cpp</a> | 24834 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/ElecHiba.cpp">ElecHiba.cpp</a> | 26887 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/LeafChappy.cpp">LeafChappy.cpp</a> | 27467 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/OtakaraBase.cpp">OtakaraBase.cpp</a> | 28244 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/RandMapMgr.cpp">RandMapMgr.cpp</a> | 28857 |
@ -244,7 +244,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/P2DScreen.cpp">P2DScreen.cpp</a> | 13009 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/modelEffect.cpp">modelEffect.cpp</a> | 13143 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectSpecialActor.cpp">JSTObjectSpecialActor.cpp</a> | 13400 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/captionMgr.cpp">captionMgr.cpp</a> | 14407 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/messageObj.cpp">messageObj.cpp</a> | 16076 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/gameflow.cpp">gameflow.cpp</a> | 16519 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/light.cpp">light.cpp</a> | 17269 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/demoSection.cpp">demoSection.cpp</a> | 17575 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/light.cpp">light.cpp</a> | 17269 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/demoSection.cpp">demoSection.cpp</a> | 17568 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/wipe.cpp">wipe.cpp</a> | 17651 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/screenObj.cpp">screenObj.cpp</a> | 17888 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/pikmin2AramMgr.cpp">pikmin2AramMgr.cpp</a> | 18340 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/screenScene.cpp">screenScene.cpp</a> | 18502 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectCamera.cpp">JSTObjectCamera.cpp</a> | 18683 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/movieConfig.cpp">movieConfig.cpp</a> | 19260 |

View File

@ -38,7 +38,3 @@ Which, for enemies, you may want to look at the ```isCreatureWithinRange``` func
- ```C_PARMS``` is shorthand for ```static_cast<Parms*>(this->m_parms)```.
- ```CG_PROPERPARMS(x)``` is shorthand for ```static_cast<Parms*>(x->m_parms)->m_properParms```.
- ```C_PROPERPARMS(x)``` is shorthand for ```static_cast<Parms*>(this->m_parms)->m_properParms```.
## Project Organisation
- Generally speaking, if a search of the include folder does not yield results, you may add a new file for a new structure / class. If it makes more sense for the structure definition to be within another file, prefer that option over a new file completely.
- The project is actively formatted using .clang-format, for a consistent code style.

View File

@ -1,8 +0,0 @@
#ifndef _AMBIENTLIGHTOBJ_H
#define _AMBIENTLIGHTOBJ_H
struct AmbientLightObj {
~AmbientLightObj();
};
#endif

View File

@ -2,7 +2,7 @@
#define _BOOTSECTION_H
#include "DvdThreadCommand.h"
#include "Game/BaseHIOSection.h"
#include "Game/BaseHIO.h"
struct Graphics;
template <typename T>

View File

@ -4,7 +4,7 @@
// Header for entire Demo namespace.
#include "DvdThreadCommand.h"
#include "Game/BaseHIOSection.h"
#include "Game/BaseHIO.h"
#include "Game/THPPlayer.h"
struct JUTTexture;

View File

@ -1,7 +1,7 @@
#ifndef _GAME_BASEGAMESECTION_H
#define _GAME_BASEGAMESECTION_H
#include "Game/BaseHIOSection.h"
#include "Game/BaseHIO.h"
#include "Game/PikiContainer.h"
#include "Camera.h"
#include "DvdThreadCommand.h"
@ -197,7 +197,7 @@ struct BaseGameSection : public BaseHIOSection {
// should there not be another 0x4 here in USA (not demo)? ...
BlendCamera* m_blendCamera; // _50
f32 m_blendFactor; // _54
bool m_blendCameraActive; // _58
bool m_isBlendCameraActive; // _58
DvdThreadCommand m_dvdThreadCommand; // _5C
IDelegate3<MovieConfig*, u32, u32>* _C8; // _C8
IDelegate3<MovieConfig*, void*, u32>* _CC; // _CC
@ -206,8 +206,8 @@ struct BaseGameSection : public BaseHIOSection {
WipeOutFader* m_wipeOutFader; // _D8
WipeOutInFader* m_wipeOutInFader; // _DC
u32 _E0; // _E0
int m_lastActiveNaviIndex; // _E4
f32 m_vp2YScale; // _E8
int m_prevNaviIdx; // _E4
f32 m_secondViewportHeight; // _E8
f32 m_split; // _EC
u8 m_setSplit; // _F0
JUTTexture* m_mizuTexture; // _F4
@ -235,12 +235,12 @@ struct BaseGameSection : public BaseHIOSection {
f32 _144; // _144
Delegate1<BaseGameSection, Rectf&>* m_kanteiDelegate; // _148
ZoomCamera* m_treasureZoomCamera; // _14C
u8 _150[4]; // _150
u32 _150; // _150
JUTTexture* m_xfbImage; // _154
JUTTexture* m_fbTexture; // _158
int m_xfbTexture1; // _15C
int m_xfbTexture2; // _160
u8 _164; // _164
u8 m_xfbFlags; // _164
JUTTexture* _168; // _168
int m_texData1; // _16C
int _170; // _170

View File

@ -12,6 +12,15 @@ namespace Game {
struct GameMessage;
struct HIORootNode;
namespace BaseHIOParms {
extern bool sEntryOpt;
extern bool sEntryOptMapRoom;
extern bool sDrawParticle;
extern bool sMabikiEfx;
extern bool sMapRoomFinal;
extern bool sTekiChappyFlag;
} // namespace BaseHIOParms
struct BaseHIOSection : public Section {
BaseHIOSection(JKRHeap*);

View File

@ -1,17 +0,0 @@
#ifndef _GAME_BASEHIOPARMS_H
#define _GAME_BASEHIOPARMS_H
#include "types.h"
namespace Game {
namespace BaseHIOParms {
extern bool sEntryOpt;
extern bool sEntryOptMapRoom;
extern bool sDrawParticle;
extern bool sMabikiEfx;
extern bool sMapRoomFinal;
extern bool sTekiChappyFlag;
} // namespace BaseHIOParms
} // namespace Game
#endif

View File

@ -32,7 +32,7 @@ struct CameraData {
struct CameraParms : public Parameters {
CameraParms();
Parm<f32> m_cnld;
Parm<f32> m_cnld; // TODO: offsets?
Parm<f32> m_cnla;
Parm<f32> m_cnlf;
Parm<f32> m_cnlo;

View File

@ -92,6 +92,7 @@ struct CreatureKillArg {
int _04; // _04
};
/// @brief Basic Creature structure
struct Creature : public CellObject {
struct CheckHellArg {
inline CheckHellArg()
@ -327,11 +328,6 @@ struct Creature : public CellObject {
static bool usePacketCulling;
Matrixf* m_captureMatrix; // _0B8
// The following bitfield is here for mod usage.
// Vanilla seems to just use the previous 2 representations.
// u32 m_isDebugCollision : 1, : 24, m_isMovieExtra : 1,
// m_isMovieMotion : 1, m_isMovieActor : 1, padding2 : 1,
// m_isCollisionFlick : 1, m_isAlive : 1, m_isAtari : 1;
BitFlag<u32> m_flags; // _0BC
void* m_parms; // _0C0
Generator* m_generator; // _0C4
@ -342,14 +338,14 @@ struct Creature : public CellObject {
Recti m_cellRect; // _0E0
Creature* m_sticked; // _0F0
Creature* m_sticker; // _0F4
CollPart* _0F8; // _0F8
CollPart* m_stuckCollPart; // _0F8
Creature* m_captured; // _0FC
Creature* m_capture; // _100
Vector3f _104; // _104
short m_hasStick; // _110
CollTree* m_collTree; // _114
float m_mass; // _118
Vector3f _11C; // _11C
Vector3f m_triangleNormal; // _11C
u16 m_objectTypeID; // _128
UpdateContext m_updateContext; // _12C
Matrixf m_mainMatrix; // _138

View File

@ -581,7 +581,7 @@ struct EnemyBase : public Creature, public SysShape::MotionListener, virtual pub
Sys::Sphere m_curLodSphere; // _270
WaterBox* m_waterBox; // _280
EnemyEffectNodeHamon* m_effectNodeHamon; // _284
Sys::Triangle* _288; // _288
Sys::Triangle* m_curWallTri; // _288
PSM::EnemyBase* m_soundObj; // _28C
CNode m_effectNodeHamonRoot; // _290 - treat as EnemyEffectNodeBase with EnemyEffectNodeHamon nodes
f32 _2A8; // _2A8

View File

@ -18,32 +18,32 @@ struct TDispTriangleArray;
struct MoveInfo {
inline MoveInfo(Sys::Sphere* sphere, Vector3f* vec, float a)
: _00(sphere)
, _04(vec)
, m_velocity(vec)
, _08(a)
{
_0C = 0.0f;
_10 = nullptr;
_44 = nullptr;
_74 = 0;
_19 = 0;
_18 = 0;
_48 = nullptr;
_14 = nullptr;
_90 = 0;
_94 = nullptr;
_2C = JMath::sincosTable_.m_table[256].first; // pi/2
_30 = 0.6f;
_98 = -1;
_4C = nullptr;
_1A = 0;
_0C = 0.0f;
_10 = nullptr;
m_curTriangle = nullptr;
_74 = 0;
_19 = 0;
_18 = 0;
m_curWallTri = nullptr;
m_infoOrigin = nullptr;
_90 = 0;
_94 = nullptr;
_2C = JMath::sincosTable_.m_table[256].first; // pi/2
_30 = 0.6f;
_98 = -1;
_4C = nullptr;
_1A = 0;
}
Sys::Sphere* _00; // _00
Vector3f* _04; // _04
Vector3f* m_velocity; // _04
float _08; // _08
float _0C; // _0C
Delegate2<DynCreature, Vector3f&, Vector3f&>* _10; // _10
BaseItem* _14; // _14
BaseItem* m_infoOrigin; // _14
u8 _18; // _18
u8 _19; // _19
u8 _1A; // _1A
@ -52,10 +52,10 @@ struct MoveInfo {
float _2C; // _2C
float _30; // _30
u8 _34[16]; // _34
Sys::Triangle* _44; // _44
Sys::Triangle* _48; // _48
Sys::Triangle* m_curTriangle; // _44
Sys::Triangle* m_curWallTri; // _48
Sys::Triangle* _4C; // _4C
Vector3f _50; // _50
Vector3f m_position; // _50
Vector3f _5C; // _5C
float _68; // _60
float _6C; // _64

View File

@ -42,8 +42,8 @@ struct CollisionBuffer {
void insertSort(CellObject*, float);
int findIndex(CellObject*);
int m_nodeCount; // _00 /* total node count? */
int m_usedNodeCount; // _04 /* used node count? */
int m_nodeCount; // _00/
int m_usedNodeCount; // _04
CollNode* m_collNodes; // _08
CellObject* m_cellObject; // _0C
};

View File

@ -4,7 +4,7 @@
// Header for entire Demo namespace.
#include "DvdThreadCommand.h"
#include "Game/BaseHIOSection.h"
#include "Game/BaseHIO.h"
#include "Section.h"
#include "ebi/Omake.h"
#include "ebi/TMainTitleMgr.h"

View File

@ -4,7 +4,7 @@
#include "Dolphin/stl.h"
#include "DvdThreadCommand.h"
#include "Game/BaseGameSection.h"
#include "Game/BaseHIOSection.h"
#include "Game/BaseHIO.h"
#include "Game/CameraMgr.h"
#include "Game/TimeMgr.h"
#include "Game/gameGenerator.h"
@ -902,7 +902,7 @@ BaseGameSection::BaseGameSection(JKRHeap* heap)
: BaseHIOSection(heap)
, m_dvdThreadCommand()
{
_164 = 0;
m_xfbFlags = 0;
setDisplay(JFWDisplay::createManager(nullptr, _1C, JUTXfb::DoubleBuffer, true), 1);
m_playerMode = 2;
m_draw2DCreature = nullptr;

View File

@ -113,7 +113,7 @@ void BaseGameSection::newdraw_drawAll(Viewport* vp)
_12C->get(7)->draw();
_130->get(7)->draw();
if (!_168 && (_164 & 3) == 0) {
if (!_168 && (m_xfbFlags & 3) == 0) {
m_xfbImage->capture(m_xfbTexture1, m_xfbTexture2, GX_TF_RGB565, true, 0);
}
m_lightMgr->set(gfx);

View File

@ -1,4 +1,4 @@
#include "Game/BaseHIOSection.h"
#include "Game/BaseHIO.h"
#include "CNode.h"
#include "Controller.h"
#include "Dolphin/os.h"

View File

@ -1,4 +1,4 @@
#include "Game/BaseHIOParms.h"
#include "Game/BaseHIO.h"
#include "types.h"
namespace Game {

View File

@ -431,7 +431,7 @@ void Creature::init(Game::CreatureInitArg* arg)
m_flags.typeView |= 7;
clearStick();
m_updateContext.init(Game::collisionUpdateMgr);
_11C = Vector3f(0.0f);
m_triangleNormal = Vector3f(0.0f);
clearCapture();
m_curTriangle = nullptr;
m_collisionPosition = Vector3f(0.0f, 1.0f, 0.0f);

View File

@ -519,7 +519,7 @@ void PikiSwallowedState::init(Piki* piki, StateArg* stateArg)
piki->startMotion(animIdx, animIdx, nullptr, nullptr);
Creature* creature = piki->m_sticker;
CollPart* collpart = piki->_0F8;
CollPart* collpart = piki->m_stuckCollPart;
if (piki->getCurrAction()) {
piki->getCurrAction()->cleanup();

View File

@ -591,7 +591,7 @@ void StateClimb::exec(EnemyBase* enemy)
f32 val = imomushi->_2FC;
f32 yval = imomushi->_104.y;
if (yval > 1.0f - val) {
CollPart* childPart = static_cast<CollPart*>(imomushi->_0F8->m_child);
CollPart* childPart = static_cast<CollPart*>(imomushi->m_stuckCollPart->m_child);
if (childPart != nullptr && childPart->m_hasCollPart == 2) {
imomushi->startClimbPlant(childPart);
} else {
@ -599,7 +599,7 @@ void StateClimb::exec(EnemyBase* enemy)
imomushi->finishMotion();
}
} else if (yval < -val) {
CollPart* parentPart = static_cast<CollPart*>(imomushi->_0F8->m_parent);
CollPart* parentPart = static_cast<CollPart*>(imomushi->m_stuckCollPart->m_parent);
if (parentPart != nullptr && parentPart->m_hasCollPart == 2) {
imomushi->startClimbPlant(parentPart);
}

View File

@ -13,7 +13,7 @@
#include "Game/WaterBox.h"
#include "Game/AIConstants.h"
#include "Game/BaseItem.h"
#include "Game/BaseHIOParms.h"
#include "Game/BaseHIO.h"
#include "Game/Cave/RandMapMgr.h"
#include "Game/cellPyramid.h"
#include "Game/EnemyAnimatorBase.h"
@ -765,7 +765,7 @@ EnemyBase::EnemyBase()
, m_pelletInfo()
, m_lodParm()
, m_waterBox(nullptr)
, _288(0)
, m_curWallTri(0)
, m_soundObj(nullptr)
, m_effectNodeHamonRoot()
, _2A8(0.0f)
@ -2593,26 +2593,26 @@ void EnemyBase::bounceProcedure(Sys::Triangle* triangle)
*/
// WIP: https://decomp.me/scratch/YsXWy
// LITERALLY MATCHES IF VECTOR3F::LENGTH AND NORMALISE MATCH SMH
void EnemyBase::collisionMapAndPlat(f32 constraint)
void EnemyBase::collisionMapAndPlat(f32 accelRate)
{
if (!isStickTo()) {
if (!(isEvent(0, EB_3))) {
doSimulationGround(constraint);
doSimulationGround(accelRate);
} else {
doSimulationFlying(constraint);
doSimulationFlying(accelRate);
resetEvent(0, EB_30);
}
f32 radius = static_cast<EnemyParmsBase*>(m_parms)->m_general.m_fp01.m_value;
f32 yOffsetFromMap = static_cast<EnemyParmsBase*>(m_parms)->m_general.m_fp01.m_value;
Vector3f pos = getPosition();
m_commonEffectOffset = getOffsetForMapCollision();
Sys::Sphere sphere;
pos += m_commonEffectOffset;
pos.y += radius;
pos.y += yOffsetFromMap;
sphere.m_position = pos;
sphere.m_radius = radius;
sphere.m_radius = yOffsetFromMap;
f32 z;
if (checkSecondary()) {
@ -2621,57 +2621,57 @@ void EnemyBase::collisionMapAndPlat(f32 constraint)
z = static_cast<CreatureProperty*>(m_parms)->m_props.m_wallReflection.m_value;
}
_11C.y = 0.0f;
m_triangleNormal.y = 0.0f;
Vector3f vec = m_impVelocity + _11C;
MoveInfo moveInfo(&sphere, &vec, z);
moveInfo._14 = (BaseItem*)this;
Vector3f velocityDest = m_impVelocity + m_triangleNormal;
MoveInfo moveInfo(&sphere, &velocityDest, z);
moveInfo.m_infoOrigin = (BaseItem*)this;
mapMgr->traceMove(moveInfo, constraint);
mapMgr->traceMove(moveInfo, accelRate);
m_impVelocity = vec;
m_impVelocity = velocityDest;
f32 velocityNorm = m_impVelocity.normalise();
f32 _11CNorm = _11C.length();
f32 velocityNorm = m_impVelocity.normalise();
f32 collTriNormal = m_triangleNormal.length();
if ((velocityNorm > _11CNorm)) {
velocityNorm -= _11CNorm;
if ((velocityNorm > collTriNormal)) {
velocityNorm -= collTriNormal;
m_impVelocity *= velocityNorm;
_11C = 0.0f;
m_triangleNormal = 0.0f;
} else {
m_impVelocity *= velocityNorm;
_11C = 0.0f;
m_triangleNormal = 0.0f;
}
if (m_curTriangle == nullptr && moveInfo._44) {
bounceProcedure(moveInfo._44);
if (m_curTriangle == nullptr && moveInfo.m_curTriangle) {
bounceProcedure(moveInfo.m_curTriangle);
}
m_curTriangle = moveInfo._44;
m_curTriangle = moveInfo.m_curTriangle;
m_collisionPosition = moveInfo._50;
m_collisionPosition = moveInfo.m_position;
if (_288 == nullptr && moveInfo._48) {
if (m_curWallTri == nullptr && moveInfo.m_curWallTri) {
wallCallback(moveInfo);
}
_288 = moveInfo._48;
m_curWallTri = moveInfo.m_curWallTri;
if (platMgr != nullptr && isEvent(0, EB_13)) {
moveInfo._04 = &m_impVelocity;
moveInfo.m_velocity = &m_impVelocity;
platMgr->traceMove(moveInfo, constraint);
if (m_curTriangle == nullptr) {
if (moveInfo._44) {
bounceProcedure(moveInfo._44);
if (moveInfo.m_curTriangle) {
bounceProcedure(moveInfo.m_curTriangle);
}
m_curTriangle = moveInfo._44;
m_curTriangle = moveInfo.m_curTriangle;
m_collisionPosition = moveInfo._50;
m_collisionPosition = moveInfo.m_position;
}
if (_288 == nullptr && moveInfo._48) {
if (m_curWallTri == nullptr && moveInfo.m_curWallTri) {
wallCallback(moveInfo);
}
_288 = moveInfo._48;
m_curWallTri = moveInfo.m_curWallTri;
}
if (mapMgr->hasHiddenCollision()) {
@ -2679,12 +2679,12 @@ void EnemyBase::collisionMapAndPlat(f32 constraint)
}
m_position.x = sphere.m_position.x - m_commonEffectOffset.x;
m_position.y = sphere.m_position.y - m_commonEffectOffset.y - radius;
m_position.y = sphere.m_position.y - m_commonEffectOffset.y - yOffsetFromMap;
m_position.z = sphere.m_position.z - m_commonEffectOffset.z;
updateSpheres();
} else {
_11C = 0.0f;
m_triangleNormal = 0.0f;
doSimulationStick(constraint);
@ -3211,7 +3211,7 @@ void EnemyBase::doSimulation(f32 arg) { static_cast<EnemyBaseFSM::StateMachine*>
void EnemyBase::doSimulationConstraint(f32 arg)
{
if (!(isEvent(0, EB_HardConstraint))) {
if (_11C.x != 0.0f || _11C.z != 0.0f) {
if (m_triangleNormal.x != 0.0f || m_triangleNormal.z != 0.0f) {
setEvent(0, EB_30);
} else if (m_curTriangle) {
resetEvent(0, EB_30);
@ -4831,10 +4831,10 @@ void EnemyBase::hardConstraintOn()
void EnemyBase::hardConstraintOff()
{
resetEvent(0, EB_HardConstraint);
m_mass = m_friction;
_11C.x = 0.0f;
_11C.y = 0.0f;
_11C.z = 0.0f;
m_mass = m_friction;
m_triangleNormal.x = 0.0f;
m_triangleNormal.y = 0.0f;
m_triangleNormal.z = 0.0f;
}
/*

View File

@ -525,7 +525,7 @@ bool Obj::farmCallBack(Creature* c, float power)
void Obj::onStickStart(Creature* other)
{
EnemyBase::onStickStart(other);
if (other->_0F8 && other->_0F8->m_specialID.getStrID()[3] == '0') {
if (other->m_stuckCollPart && other->m_stuckCollPart->m_specialID.getStrID()[3] == '0') {
addDamage(m_maxHealth, 1.0f);
}
}

View File

@ -1,5 +1,5 @@
#include "Demo.h"
#include "Game/BaseHIOSection.h"
#include "Game/BaseHIO.h"
#include "Game/THPPlayer.h"
#include "System.h"
#include "types.h"
@ -15,7 +15,7 @@
.skip 1
.asciz "JMANewSinTable"
.skip 1
.4byte 0x54485083 # "THP<EFBFBD>Z<EFBFBD>N<EFBFBD>V<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
.4byte 0x54485083 # "THP?¿½Z?¿½N?¿½V?¿½?¿½?¿½?¿½"
.4byte 0x5A834E83
.4byte 0x56838783
.4byte 0x93000000