mirror of
https://github.com/bfbbdecomp/bfbb.git
synced 2024-11-30 10:01:18 +00:00
zLightning work (#366)
* zLightning work * Correct sLightning size * Remove xDebugAddTweak def from header
This commit is contained in:
parent
c00f2e099b
commit
ef0b45a19c
@ -1,49 +1,64 @@
|
||||
#include "zLightning.h"
|
||||
#include "zGlobals.h"
|
||||
|
||||
#include "xDebug.h"
|
||||
|
||||
#include <types.h>
|
||||
#include <rwcore.h>
|
||||
|
||||
extern _tagLightningAdd gLightningTweakAddInfo;
|
||||
extern zLightning sLightning[0x30];
|
||||
extern zLightning* sLightning[0x30];
|
||||
extern RwRaster* sLightningRaster;
|
||||
extern xVec3 sTweakStart;
|
||||
extern xVec3 sTweakEnd;
|
||||
|
||||
#if 0
|
||||
// WIP.
|
||||
void lightningTweakChangeType(tweak_info& t)
|
||||
extern char stringBase0[];
|
||||
|
||||
void xDebugAddTweak(const char*, F32*, F32, F32, const tweak_callback*, void*, U32)
|
||||
{
|
||||
xDebugRemoveTweak(WEFEW);
|
||||
if (gLightningTweakAddInfo.type == 1)
|
||||
}
|
||||
|
||||
void lightningTweakChangeType(const tweak_info& t)
|
||||
{
|
||||
// "Lightning|\x01Type Info"
|
||||
xDebugRemoveTweak(stringBase0 + 0x18);
|
||||
|
||||
switch (gLightningTweakAddInfo.type)
|
||||
{
|
||||
xDebugAddTweaK(WEFEWFEF, &gLightningTweakAddInfo.setup_degrees, @668, @669, NULL, NULL, 2);
|
||||
xDebugAddTweaK(WEFEWFEF, &gLightningTweakAddInfo.move_degrees, @668, @669, NULL, NULL, 2);
|
||||
}
|
||||
else if (FFWEFEWF)
|
||||
{
|
||||
// TODO!!!
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// "Lightning|\x01Type Info|Setup Degrees"
|
||||
xDebugAddTweak(stringBase0 + 0x2d, &gLightningTweakAddInfo.setup_degrees, -1e9, 1e9, NULL, NULL, 2);
|
||||
|
||||
// "Lightning|\x01Type Info|Move Degrees"
|
||||
xDebugAddTweak(stringBase0 + 0x50, &gLightningTweakAddInfo.move_degrees, -1e9, 1e9, NULL, NULL, 2);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// "Lightning|\x01Type Info|Normal Offset"
|
||||
xDebugAddTweak(stringBase0 + 0x72, &gLightningTweakAddInfo.zeus_normal_offset, -100.0, 100.0, NULL, NULL, 2);
|
||||
|
||||
// "Lightning|\x01Type Info|Back Offset"
|
||||
xDebugAddTweak(stringBase0 + 0x95, &gLightningTweakAddInfo.zeus_back_offset, -100.0, 100.0, NULL, NULL, 2);
|
||||
|
||||
// "Lightning|\x01Type Info|Side Offset"
|
||||
xDebugAddTweak(stringBase0 + 0xb6, &gLightningTweakAddInfo.zeus_side_offset, 0.0, 100.0, NULL, NULL, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// Structure is off?
|
||||
void lightningTweakStart(tweak_info& t)
|
||||
static void lightningTweakStart(const tweak_info& t)
|
||||
{
|
||||
xVec3 s, e;
|
||||
xVec3Add(&s, (xVec3*)&globals.player.ent.collModel->Mat->pos, &sTweakStart);
|
||||
xVec3Add(&e, (xVec3*)&globals.player.ent.collModel->Mat->pos, &sTweakEnd);
|
||||
xVec3Add(&s, (xVec3*)&globals.player.ent.model->Mat->pos, &sTweakStart);
|
||||
xVec3Add(&e, (xVec3*)&globals.player.ent.model->Mat->pos, &sTweakEnd);
|
||||
gLightningTweakAddInfo.start = &s;
|
||||
gLightningTweakAddInfo.end = &e;
|
||||
zLightningAdd(&gLightningTweakAddInfo);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// WIP.
|
||||
void zLightningRender()
|
||||
{
|
||||
if (sLightningRaster != NULL)
|
||||
@ -52,17 +67,15 @@ void zLightningRender()
|
||||
}
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
|
||||
for (S32 i = 0; i < 0x30; i++)
|
||||
for (S32 i = 0; i < (S32)(sizeof(sLightning) / sizeof(zLightning*)); i++)
|
||||
{
|
||||
if (&sLightning[i] != NULL && sLightning[i].flags & 0x41 == 0x41)
|
||||
if (sLightning[i] != NULL && (sLightning[i]->flags & 0x41) == 0x41)
|
||||
{
|
||||
RenderLightning(&sLightning[i]);
|
||||
RenderLightning(sLightning[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void zLightningShow(zLightning* l, S32 show)
|
||||
{
|
||||
if (show)
|
||||
@ -80,6 +93,27 @@ void zLightningKill(zLightning* l)
|
||||
l->flags &= 0xfffffefe;
|
||||
}
|
||||
|
||||
static zLightning* FindFreeLightning()
|
||||
{
|
||||
for (int i = 0; i != (sizeof(sLightning) / sizeof(zLightning*)); i++)
|
||||
{
|
||||
if (sLightning[i] != NULL)
|
||||
{
|
||||
if (!(sLightning[i]->flags & 1))
|
||||
{
|
||||
return sLightning[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sLightning[i] = (zLightning*)xMemAlloc(gActiveHeap, 0x234, 0);
|
||||
return sLightning[i];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void xDebugAddTweak(const char*, S16*, S16, S16, const tweak_callback*, void*, U32)
|
||||
{
|
||||
}
|
||||
|
@ -91,7 +91,6 @@ struct zLightning
|
||||
void lightningTweakChangeType(tweak_info& t);
|
||||
void lightningTweakStart(tweak_info& t);
|
||||
void zLightningInit();
|
||||
zLightning* FindFreeLightning();
|
||||
zLightning* zLightningAdd(_tagLightningAdd* add);
|
||||
void UpdateLightning(zLightning* l, F32 seconds);
|
||||
void zLightningUpdate(F32 seconds);
|
||||
|
Loading…
Reference in New Issue
Block a user