mirror of
https://github.com/bfbbdecomp/bfbb.git
synced 2024-11-27 00:21:00 +00:00
zPlatform matches + fix typo (#378)
This commit is contained in:
parent
7f078a6325
commit
0225dd9364
@ -128,7 +128,7 @@ void xEntAddHittableFlag(xEnt* ent)
|
||||
{
|
||||
if (ent->baseType == eBaseTypeNPC || ent->baseType == eBaseTypeDestructObj ||
|
||||
ent->baseType == eBaseTypeButton || ent->baseType == eBaseTypeBoulder ||
|
||||
(ent->baseType == eBaseTypePlatform && ent->subType == ZPLATFROM_SUBTYPE_PADDLE))
|
||||
(ent->baseType == eBaseTypePlatform && ent->subType == ZPLATFORM_SUBTYPE_PADDLE))
|
||||
{
|
||||
ent->moreFlags |= 0x10;
|
||||
}
|
||||
|
@ -34,5 +34,6 @@ struct xEntDrive
|
||||
void xEntDriveInit(xEntDrive* drv, xEnt* driven);
|
||||
void xEntDriveMount(xEntDrive* drv, xEnt* driver, F32 mt, const xCollis* coll);
|
||||
void xEntDriveDismount(xEntDrive* drv, F32 dmt);
|
||||
void xEntDriveUpdate(xEntDrive* drv, xScene* s, F32 dt, xEntFrame* frame);
|
||||
|
||||
#endif
|
||||
|
@ -391,6 +391,7 @@ void zEntPlayer_ShadowModelEnable();
|
||||
void zEntPlayer_ShadowModelDisable();
|
||||
|
||||
void zEntPlayerJumpStart(class xEnt* ent, class zJumpParam* jump);
|
||||
bool zEntPlayer_IsSneaking();
|
||||
|
||||
void zEntPlayer_setBoulderMode(U32 mode);
|
||||
void zEntPlayer_GiveHealth(S32);
|
||||
|
@ -1,7 +1,18 @@
|
||||
#include "zPlatform.h"
|
||||
#include "zEnt.h"
|
||||
#include "zEntPlayer.h"
|
||||
#include "xEntDrive.h"
|
||||
#include "zParEmitter.h"
|
||||
|
||||
#include "xMath.h"
|
||||
|
||||
#include <types.h>
|
||||
|
||||
zParEmitter* sEmitTremble;
|
||||
zParEmitter* sEmitBreakaway;
|
||||
|
||||
extern char stringBase0[];
|
||||
|
||||
void genericPlatRender(xEnt* ent)
|
||||
{
|
||||
if (!ent->model || !xEntIsVisible(ent))
|
||||
@ -26,3 +37,97 @@ void zPlatform_Load(zPlatform* ent, xSerial* s)
|
||||
{
|
||||
zEntLoad(ent, s);
|
||||
}
|
||||
|
||||
void zPlatform_Move(xEnt* entPlat, xScene* s, float dt, xEntFrame* frame)
|
||||
{
|
||||
zPlatform* plat = (zPlatform*)entPlat;
|
||||
xEntMotionMove(&plat->motion, s, dt, frame);
|
||||
xEntDriveUpdate(&plat->drv, s, dt, NULL);
|
||||
}
|
||||
|
||||
void zPlatform_Tremble(zPlatform* plat, float ampl, float freq, float dur);
|
||||
|
||||
void zPlatform_Mount(zPlatform* ent)
|
||||
{
|
||||
if (ent->subType == ZPLATFORM_SUBTYPE_BREAKAWAY)
|
||||
{
|
||||
if (ent->state == 0)
|
||||
{
|
||||
if ((ent->passet->ba.breakflags & 1) && zEntPlayer_IsSneaking())
|
||||
{
|
||||
ent->state = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->state = 2;
|
||||
|
||||
// Needs to be used or the comparison's operands will be swapped.
|
||||
F32 restingSpeed = 0.0f;
|
||||
if ( ent->passet->fr.fspeed != restingSpeed )
|
||||
{
|
||||
zPlatform_Tremble(ent, 0.06f, DEG2RAD(720), ent->passet->fr.fspeed + 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void zPlatform_Setup(zPlatform* ent, xScene* sc)
|
||||
{
|
||||
zEntSetup((zEnt *)ent);
|
||||
sEmitTremble = zParEmitterFind(stringBase0 + 0x36); // "PAREMIT_PLAT_TREMBLE"
|
||||
sEmitBreakaway = zParEmitterFind(stringBase0 + 0x4b); // "PAREMIT_PLAT_BREAKAWAY"
|
||||
if (ent->subType == ZPLATFORM_SUBTYPE_PADDLE)
|
||||
{
|
||||
ent->tmr = -1e38;
|
||||
ent->state = 2;
|
||||
ent->ctr = ent->passet->paddle.startOrient;
|
||||
}
|
||||
}
|
||||
|
||||
void zPlatformTranslate(xEnt* xent, xVec3* dpos, xMat4x3* dmat)
|
||||
{
|
||||
zPlatform* plat = (zPlatform*)xent;
|
||||
xEntDefaultTranslate(xent,dpos,dmat);
|
||||
xEntMotionTranslate(&plat->motion, dpos, dmat);
|
||||
}
|
||||
|
||||
void zPlatform_BreakawayFallFX(zPlatform* ent, F32 dt)
|
||||
{
|
||||
if (sEmitBreakaway != NULL)
|
||||
{
|
||||
xParEmitterCustomSettings info;
|
||||
info.custom_flags = 0x100;
|
||||
info.pos = *xEntGetCenter(ent);
|
||||
info.pos.y += 0.5f;
|
||||
for (int iVar2 = 0; iVar2 < 25; iVar2++)
|
||||
{
|
||||
xParEmitterEmitCustom(sEmitBreakaway, 0.03333333f, &info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U32 zMechIsStartingForth(zPlatform* ent, U16 param_2)
|
||||
{
|
||||
if (ent->motion.asset->mech.type == 4)
|
||||
{
|
||||
return param_2 == 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return param_2 == 0;
|
||||
}
|
||||
}
|
||||
|
||||
U32 zMechIsStartingBack(zPlatform* ent, U16 param_2)
|
||||
{
|
||||
if (ent->motion.asset->mech.type == 4)
|
||||
{
|
||||
return param_2 == 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
return param_2 == 3;
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ struct zPlatform : zEnt
|
||||
#define ZPLATFORM_SUBTYPE_BREAKAWAY 9
|
||||
#define ZPLATFORM_SUBTYPE_SPRINGBOARD 10
|
||||
#define ZPLATFORM_SUBTYPE_TEETER 11
|
||||
#define ZPLATFROM_SUBTYPE_PADDLE 12
|
||||
#define ZPLATFORM_SUBTYPE_PADDLE 12
|
||||
#define ZPLATFORM_SUBTYPE_FM 13
|
||||
|
||||
void genericPlatRender(xEnt* ent);
|
||||
|
Loading…
Reference in New Issue
Block a user