ItemGenerator decompilation

This commit is contained in:
shibbo 2019-11-03 21:22:41 -05:00
parent b2cd7a3024
commit 70a1673300
4 changed files with 95 additions and 0 deletions

View File

@ -0,0 +1,23 @@
#ifndef ITEMGENERATOR_H
#define ITEMGENERATOR_H
#include "types.h"
class LiveActor;
class ItemGenerator
{
public:
ItemGenerator();
void setTypeNone();
void setTypeCoin(s32);
void setTypeStarPeace(s32);
void generate(const LiveActor *);
bool isUseFarSE() const;
s32 mItemCount; // _0
u8 mType; // _4
};
#endif // ITEMGENERATOR_H

View File

@ -32,6 +32,9 @@ namespace MR
ResourceHolder* createAndAddResourceHolder(const char *);
void* loadResourceFromArc(const char *, const char *);
void appearCoinPopToDirection(const NameObj *, const JGeometry::TVec3<f32> &, const JGeometry::TVec3<f32> &, s32);
void appearStarPieceToDirection(const NameObj *, const JGeometry::TVec3<f32> &, const JGeometry::TVec3<f32> &, s32, f32, f32, bool);
};
#endif // OBJUTIL_H

View File

@ -13,6 +13,8 @@ namespace MR
void getRailInfo(JMapInfoIter *, const JMapInfo **, const JMapInfoIter &);
void getCameraRailInfo(JMapInfoIter *, const JMapInfo **, s32, s32);
bool isEqualStageName(const char *);
bool isPlacementLocalStage();
JGeometry::TMatrix34<JGeometry::SMatrix34C<f32> const>* getZonePlacementMtx(const JMapInfoIter &);
};

View File

@ -0,0 +1,67 @@
#include "Game/Enemy/ItemGenerator.h"
#include "MR/ObjUtil.h"
#include "MR/SceneUtil.h"
#include "MR/SoundUtil.h"
ItemGenerator::ItemGenerator()
: mItemCount(1), mType(1)
{ }
void ItemGenerator::setTypeNone()
{
mType = 0;
mItemCount = 0;
}
void ItemGenerator::setTypeCoin(s32 count)
{
mItemCount = count;
mType = 1;
}
void ItemGenerator::setTypeStarPeace(s32 count)
{
mItemCount = count;
mType = 2;
}
/* todo -- fix the vector initialization */
void ItemGenerator::generate(const LiveActor *pActor)
{
if (mItemCount > 0)
{
if (mType == 2)
{
JGeometry::TVec3<f32> temp;
temp = temp - pActor->mGravity;
MR::appearStarPieceToDirection(pActor, pActor->mTranslation, temp, mItemCount, 10.0f, 40.0f, false);
if (isUseFarSE())
{
MR::startSound(pActor, "SE_OJ_STAR_PIECE_BURST_F", -1, -1);
}
else
{
MR::startSound(pActor, "SE_OJ_STAR_PIECE_BURST", -1, -1);
}
}
else
{
if (mType < 2)
{
if (mType >= 1)
{
JGeometry::TVec3<f32> temp;
temp = temp - pActor->mGravity;
MR::appearCoinPopToDirection(pActor, pActor->mTranslation, temp, mItemCount);
}
}
}
}
}
bool ItemGenerator::isUseFarSE() const
{
return MR::isEqualStageName("KoopaBattleVs2Galaxy");
}