mirror of
https://github.com/CTR-tools/CTR-ModSDK.git
synced 2025-03-01 17:46:40 +00:00
RB_RainCloud
This commit is contained in:
parent
dc70c4c986
commit
2ae2d3f99a
@ -7,28 +7,29 @@ void DECOMP_RB_RainCloud_FadeAway(struct Thread* t)
|
||||
struct RainCloud* rcloud;
|
||||
|
||||
inst = t->inst;
|
||||
|
||||
rcloud = t->object;
|
||||
parentInst = t->parentThread->inst;
|
||||
|
||||
rcloud = inst->thread->object;
|
||||
|
||||
// set X, Y and Z
|
||||
inst->matrix.t[0] += parentInst->matrix.t[0] >> 1;
|
||||
inst->matrix.t[1] += (parentInst->matrix.t[1] + 0x80) >> 1;
|
||||
inst->matrix.t[2] += parentInst->matrix.t[2] >> 1;
|
||||
|
||||
// shrink scale (x, y, z)
|
||||
inst->scale[0] += FPS_HALF(-0x100);
|
||||
inst->scale[1] += FPS_HALF(-0x100);
|
||||
inst->scale[2] += FPS_HALF(-0x100);
|
||||
struct RainLocal* rainLocal = rcloud->rainLocal;
|
||||
rainLocal->frameCount -= FPS_HALF(2);
|
||||
|
||||
*(int *)((int)rcloud->rainBuffer + 8) -= FPS_HALF(2);
|
||||
// shrink scale (x, y, z)
|
||||
// use this order, for better register
|
||||
// allocation, and less cpu instructions
|
||||
inst->scale[2] += FPS_HALF(-0x100);
|
||||
inst->scale[1] += FPS_HALF(-0x100);
|
||||
inst->scale[0] += FPS_HALF(-0x100);
|
||||
|
||||
if (inst->scale[0] < 0)
|
||||
{
|
||||
DECOMP_JitPool_Remove(
|
||||
sdata->gGT->JitPools.rain,
|
||||
rcloud->rainBuffer
|
||||
&sdata->gGT->JitPools.rain,
|
||||
rainLocal
|
||||
);
|
||||
|
||||
// This thread is now dead
|
@ -7,21 +7,23 @@ void DECOMP_RB_RainCloud_ThTick(struct Thread* t)
|
||||
int reduce;
|
||||
int rng;
|
||||
struct Instance* inst;
|
||||
struct Driver* parent;
|
||||
struct Driver* d;
|
||||
struct RainCloud* rcloud;
|
||||
struct Instance* parentInst;
|
||||
struct Instance* dInst;
|
||||
|
||||
struct GameTracker* gGT = sdata->gGT;
|
||||
|
||||
inst = t->inst;
|
||||
rcloud = t->object;
|
||||
|
||||
animFrame = inst->animFrame;
|
||||
|
||||
// get player who put the potion
|
||||
parent = t->parentThread->object;
|
||||
parentInst = t->parentThread->inst;
|
||||
struct Thread* driverTh =
|
||||
t->parentThread;
|
||||
|
||||
d = driverTh->object;
|
||||
dInst = driverTh->inst;
|
||||
|
||||
animFrame = inst->animFrame;
|
||||
numFrames = INSTANCE_GetNumAnimFrames(inst,0);
|
||||
|
||||
// if you have not reached the end of the animation
|
||||
@ -39,16 +41,16 @@ void DECOMP_RB_RainCloud_ThTick(struct Thread* t)
|
||||
}
|
||||
|
||||
// set scale of one instance to half the scale of another
|
||||
inst->scale[0] += parentInst->scale[0] >> 1;
|
||||
inst->scale[1] += parentInst->scale[1] >> 1;
|
||||
inst->scale[2] += parentInst->scale[2] >> 1;
|
||||
inst->scale[0] += dInst->scale[0] >> 1;
|
||||
inst->scale[1] += dInst->scale[1] >> 1;
|
||||
inst->scale[2] += dInst->scale[2] >> 1;
|
||||
|
||||
inst->matrix.t[0] += parentInst->matrix.t[0] >> 1;
|
||||
inst->matrix.t[1] += (parentInst->matrix.t[1] + (inst->scale[1] * 5 >> 7)) >> 1;
|
||||
inst->matrix.t[2] += parentInst->matrix.t[2] >> 1;
|
||||
inst->matrix.t[0] += dInst->matrix.t[0] >> 1;
|
||||
inst->matrix.t[1] += (dInst->matrix.t[1] + (inst->scale[1] * 5 >> 7)) >> 1;
|
||||
inst->matrix.t[2] += dInst->matrix.t[2] >> 1;
|
||||
|
||||
// if driver is not using mask weapon
|
||||
if ((parent->actionsFlagSet & 0x800000) == 0)
|
||||
if ((d->actionsFlagSet & 0x800000) == 0)
|
||||
{
|
||||
// if RainCloud alive
|
||||
if (rcloud->timeMS != 0)
|
||||
@ -60,15 +62,14 @@ void DECOMP_RB_RainCloud_ThTick(struct Thread* t)
|
||||
if (rcloud->boolScrollItem != 1)
|
||||
return;
|
||||
|
||||
// If your weapon is "no weapon"
|
||||
if (parent->heldItemID == 0xf)
|
||||
// skip this, cause RainCloud_Init
|
||||
// already checks before setting bool
|
||||
#if 0
|
||||
if (d->heldItemID == 0xf)
|
||||
return;
|
||||
|
||||
// This is if weapon was already fired,
|
||||
// but is flickering in the UI
|
||||
if (parent->noItemTimer != 0)
|
||||
if (d->noItemTimer != 0)
|
||||
return;
|
||||
|
||||
#endif
|
||||
|
||||
// === Have weapon, have not used it yet ===
|
||||
|
||||
@ -76,48 +77,42 @@ void DECOMP_RB_RainCloud_ThTick(struct Thread* t)
|
||||
// === Naughty Dog Bug fixed ===
|
||||
// Allow warpball to be found in itemRNG
|
||||
// if the warpball "was" held, then lost
|
||||
if(parent->heldItemID == 9)
|
||||
if(d->heldItemID == 9)
|
||||
gGT->gameMode1 &= ~(WARPBALL_HELD);
|
||||
|
||||
// set weapon to "weapon roulette" to make it spin
|
||||
parent->heldItemID = 0x10;
|
||||
d->heldItemID = 0x10;
|
||||
|
||||
// you are always 5 frames away from new weapon,
|
||||
// so you get weapon 5 frames after cloud dies
|
||||
parent->itemRollTimer = FPS_DOUBLE(5);
|
||||
d->itemRollTimer = FPS_DOUBLE(5);
|
||||
|
||||
// you hold zero of this item
|
||||
parent->numHeldItems = 0;
|
||||
d->numHeldItems = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// === RainCloud timeMS is over ===
|
||||
|
||||
rcloud->timeMS = 0;
|
||||
|
||||
// erase cloudTh pointer
|
||||
parent->thCloud = NULL;
|
||||
|
||||
if (
|
||||
(rcloud->boolScrollItem == 1) &&
|
||||
|
||||
// If your weapon is not "no weapon"
|
||||
(parent->heldItemID != 0xf)
|
||||
(d->heldItemID != 0xf)
|
||||
)
|
||||
{
|
||||
parent->itemRollTimer = 0;
|
||||
d->itemRollTimer = 0;
|
||||
|
||||
// pick random weapon for driver
|
||||
VehPhysGeneral_SetHeldItem(parent);
|
||||
VehPhysGeneral_SetHeldItem(d);
|
||||
}
|
||||
}
|
||||
else {
|
||||
rcloud->timeMS = 0;
|
||||
|
||||
// erase pointer to cloud thread
|
||||
parent->thCloud = NULL;
|
||||
}
|
||||
|
||||
// using mask weapon,
|
||||
// or timeMS is over
|
||||
rcloud->timeMS = 0;
|
||||
d->thCloud = NULL;
|
||||
|
||||
ThTick_SetAndExec(t,RB_RainCloud_FadeAway);
|
||||
ThTick_SetAndExec(t,DECOMP_RB_RainCloud_FadeAway);
|
||||
return;
|
||||
}
|
@ -2,9 +2,9 @@
|
||||
|
||||
void DECOMP_RB_RainCloud_Init(struct Driver* d)
|
||||
{
|
||||
char* rain;
|
||||
struct Instance* cloudInst;
|
||||
struct RainCloud* rcloud;
|
||||
struct RainLocal* rlocal;
|
||||
unsigned short uVar3;
|
||||
|
||||
// if driver -> cloudTh is invalid
|
||||
@ -36,34 +36,31 @@ void DECOMP_RB_RainCloud_Init(struct Driver* d)
|
||||
*(char *)(cloudInst + 0x51) = *(char *)(d->instSelf + 0x51);
|
||||
|
||||
// add rain to pool
|
||||
rain = JitPool_Add(sdata->gGT->JitPools.rain);
|
||||
rlocal = DECOMP_JitPool_Add(&sdata->gGT->JitPools.rain);
|
||||
|
||||
// no idea what struct is this yet
|
||||
if (rain != NULL)
|
||||
if (rlocal != NULL)
|
||||
{
|
||||
*(short *)((int)rain + 8) = 0x1e;
|
||||
rlocal->frameCount = 0x1e;
|
||||
|
||||
// short[4]
|
||||
*(short *)((int)rain + 0xc) = 0;
|
||||
*(short *)((int)rain + 0xe) = 0;
|
||||
*(short *)((int)rain + 0x10) = 0;
|
||||
rlocal->unk1[0] = 0;
|
||||
rlocal->unk1[1] = 0;
|
||||
rlocal->unk1[2] = 0;
|
||||
|
||||
// short[4]
|
||||
*(short *)((int)rain + 0x14) = 0;
|
||||
*(short *)((int)rain + 0x16) = 0xffd8;
|
||||
*(short *)((int)rain + 0x18) = 0;
|
||||
rlocal->vel[0] = 0;
|
||||
rlocal->vel[1] = FPS_HALF(-0x28);
|
||||
rlocal->vel[2] = 0;
|
||||
|
||||
// short[4]
|
||||
*(short *)((int)rain + 0x1c) = d->instSelf->matrix.t[0];
|
||||
*(short *)((int)rain + 0x1e) = d->instSelf->matrix.t[1] + 0x80;
|
||||
*(short *)((int)rain + 0x20) = d->instSelf->matrix.t[2];
|
||||
rlocal->pos[0] = d->instSelf->matrix.t[0];
|
||||
rlocal->pos[1] = d->instSelf->matrix.t[1] + 0x80;
|
||||
rlocal->pos[2] = d->instSelf->matrix.t[2];
|
||||
|
||||
*(int *)( (int)rain + 0x24) = cloudInst;
|
||||
rlocal->cloudInst = cloudInst;
|
||||
}
|
||||
|
||||
rcloud = cloudInst->thread->object;
|
||||
rcloud->timeMS = 0x1e00; // 7.68s
|
||||
rcloud->rainBuffer = rain;
|
||||
rcloud->rainLocal = rlocal;
|
||||
rcloud->boolScrollItem = 1;
|
||||
|
||||
if (
|
||||
@ -89,7 +86,7 @@ void DECOMP_RB_RainCloud_Init(struct Driver* d)
|
||||
rcloud->timeMS = 0x1e00;
|
||||
|
||||
// random number
|
||||
rng = DECOMP_MixRNG_Scramble();
|
||||
int rng = DECOMP_MixRNG_Scramble();
|
||||
|
||||
// random (related to driver offset 0x50a)
|
||||
rcloud->boolScrollItem = (short)((rng % 400) / 100);
|
@ -271,7 +271,7 @@ int DECOMP_RB_CrateWeapon_LInC(
|
||||
if (
|
||||
(
|
||||
(struct RainCloud*)driver->thCloud->object
|
||||
)->itemScrollRandom == 1
|
||||
)->boolScrollItem == 1
|
||||
)
|
||||
{
|
||||
return 1;
|
||||
|
@ -38,18 +38,6 @@ void NewCallback231()
|
||||
*(unsigned short*)0x800AFC64 = -0x80;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// raincloud
|
||||
{
|
||||
// cut values in half
|
||||
|
||||
// scale from FadeAway
|
||||
*(unsigned short*)0x800B0f7c = -0x80;
|
||||
*(unsigned short*)0x800B0f88 = -0x80;
|
||||
*(unsigned short*)0x800B0f94 = -0x80;
|
||||
}
|
||||
#endif
|
||||
|
||||
// shield
|
||||
{
|
||||
// ShieldDark_Pop and ShieldDark_PerFrame
|
||||
|
@ -34,7 +34,8 @@ void DECOMP_VehPhysGeneral_SetHeldItem(struct Driver* driver) {
|
||||
itemSet = ITEMSET_BattleCustom;
|
||||
|
||||
// 5th Itemset (Battle Mode Default Itemset, 0x34de)
|
||||
if (gGT->battleSetup.enabledWeapons == 0x34de) itemSet = ITEMSET_BattleDefault;
|
||||
if (gGT->battleSetup.enabledWeapons == 0x34de)
|
||||
itemSet = ITEMSET_BattleDefault;
|
||||
|
||||
// Not in Battle Mode
|
||||
if ((gGT->gameMode1 & BATTLE_MODE) == 0)
|
||||
@ -43,7 +44,7 @@ void DECOMP_VehPhysGeneral_SetHeldItem(struct Driver* driver) {
|
||||
itemSet = ITEMSET_CrystalChallenge;
|
||||
|
||||
// Not in Crystal Challenge
|
||||
if (!(gGT->gameMode1 & CRYSTAL_CHALLENGE))
|
||||
if ((gGT->gameMode1 & CRYSTAL_CHALLENGE) == 0)
|
||||
{
|
||||
// Choose Itemset based on number of Drivers
|
||||
switch(gGT->numPlyrCurrGame + gGT->numBotsNextGame)
|
||||
@ -128,8 +129,10 @@ void DECOMP_VehPhysGeneral_SetHeldItem(struct Driver* driver) {
|
||||
}
|
||||
}
|
||||
|
||||
// if you have 4th-place itemset on first lap, then override to 3rd place
|
||||
if (itemSet == ITEMSET_Race4 && driver->lapIndex == 0) itemSet = ITEMSET_Race3;
|
||||
// if you have 4th-place itemset on first lap,
|
||||
// then override to 3rd place
|
||||
if (itemSet == ITEMSET_Race4 && driver->lapIndex == 0)
|
||||
itemSet = ITEMSET_Race3;
|
||||
}
|
||||
|
||||
// Decide item for Driver
|
||||
@ -179,13 +182,15 @@ void DECOMP_VehPhysGeneral_SetHeldItem(struct Driver* driver) {
|
||||
if (bossFails < 0x3)
|
||||
{
|
||||
// Replace Clock, Mask, with 3 Missiles
|
||||
if ((u_int)driver->heldItemID - 0x7 < 0x3) driver->heldItemID = 0xb;
|
||||
if ((u_int)driver->heldItemID - 0x7 < 0x3)
|
||||
driver->heldItemID = 0xb;
|
||||
}
|
||||
|
||||
else if (bossFails < 0x4)
|
||||
{
|
||||
// Replace Clock, Mask with 3 Missiles
|
||||
if ((u_int)driver->heldItemID - 0x7 < 0x2) driver->heldItemID = 0xb;
|
||||
if ((u_int)driver->heldItemID - 0x7 < 0x2)
|
||||
driver->heldItemID = 0xb;
|
||||
}
|
||||
|
||||
else if (bossFails < 0x5 && driver->heldItemID == 0x8)
|
||||
@ -195,7 +200,8 @@ void DECOMP_VehPhysGeneral_SetHeldItem(struct Driver* driver) {
|
||||
}
|
||||
|
||||
// Replace 3 Missiles with 1 Missile if racing Komodo Joe
|
||||
if (gGT->levelID == DRAGON_MINES && driver->heldItemID == 0xb) driver->heldItemID = 0x2;
|
||||
if (gGT->levelID == DRAGON_MINES && driver->heldItemID == 0xb)
|
||||
driver->heldItemID = 0x2;
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -230,14 +236,16 @@ void DECOMP_VehPhysGeneral_SetHeldItem(struct Driver* driver) {
|
||||
)
|
||||
{
|
||||
// if less than 2 drivers have 3 missiles, then increase number of drivers that have it
|
||||
if (gGT->numPlayersWith3Missiles < 2) gGT->numPlayersWith3Missiles++;
|
||||
if (gGT->numPlayersWith3Missiles < 2)
|
||||
gGT->numPlayersWith3Missiles++;
|
||||
|
||||
// if 2 drivers already have 3 missiles, now you have 1 missile
|
||||
else driver->heldItemID = 0x2;
|
||||
}
|
||||
|
||||
// Set number of held items
|
||||
if ((u_int)driver->heldItemID - 0xA < 0x2) driver->numHeldItems = 0x3;
|
||||
if ((u_int)driver->heldItemID - 0xA < 0x2)
|
||||
driver->numHeldItems = 0x3;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ void DECOMP_VehPhysProc_Driving_PhysLinear(struct Thread* thread, struct Driver*
|
||||
// if you have a raincloud over your head from potion
|
||||
if (driver->thCloud != 0)
|
||||
driverRankItemValue =
|
||||
((struct RainCloud*)driver->thCloud->object)->itemScrollRandom;
|
||||
((struct RainCloud*)driver->thCloud->object)->boolScrollItem;
|
||||
|
||||
// get approximate speed
|
||||
approximateSpeed = driver->speedApprox;
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
extern void *PlayerEatenFuncTable[13];
|
||||
|
||||
void RB_RainCloud_FadeAway(struct Thread *t);
|
||||
|
||||
// when eaten by plant on papu pyramid
|
||||
void DECOMP_VehStuckProc_PlantEaten_Init(struct Thread *t, struct Driver *d)
|
||||
{
|
||||
@ -31,7 +29,7 @@ void DECOMP_VehStuckProc_PlantEaten_Init(struct Thread *t, struct Driver *d)
|
||||
// if thread of "cloud" exists
|
||||
if (d->thCloud != NULL)
|
||||
{
|
||||
*(short *)&((struct RainCloud *)d->thCloud->object)->unknown[4] = 0;
|
||||
((struct RainCloud *)d->thCloud->object)->timeMS = 0;
|
||||
|
||||
d->thCloud->funcThTick = RB_RainCloud_FadeAway;
|
||||
d->thCloud = NULL;
|
||||
|
@ -93,7 +93,12 @@ common, 231, RB_ShieldDark_ThTick_Pop, 0x0, General/231/231_037_RB_ShieldDark_Th
|
||||
// rb_38_shieldgrow
|
||||
common, 231, RB_Player_ToggleInvisible, 0x0, General/231/231_039_RB_Player_ToggleInvisible.c
|
||||
common, 231, RB_Player_ToggleFlicker, 0x0, General/231/231_040_RB_Player_ToggleFlicker.c
|
||||
// skip raincloud, explosion, blowup, burst,
|
||||
|
||||
//common, 231, RB_RainCloud_FadeAway, 0x0, General/231/231_041_RB_RainCloud_FadeAway.c
|
||||
//common, 231, RB_RainCloud_ThTick, 0x0, General/231/231_042_RB_RainCloud_ThTick.c
|
||||
common, 231, RB_RainCloud_Init, 0x0, General/231/231_043_RB_RainCloud_Init.c
|
||||
|
||||
// skip explosion, blowup, burst,
|
||||
common, 231, RB_Burst_CollLevInst, 0x0, General/231/231_050_RB_Burst_CollLevInst.c
|
||||
// skip burst
|
||||
common, 231, RB_Baron_ThTick, 0x0, General/231/231_GROUP_54_70.c
|
||||
|
@ -582,6 +582,10 @@ u_int MM_Video_CheckIfFinished(int param_1);
|
||||
void DECOMP_RB_Player_ModifyWumpa(struct Driver* driver, int wumpaDelta);
|
||||
int DECOMP_RB_Hazard_InterpolateValue(short currRot, short desiredRot, short rotSpeed);
|
||||
|
||||
void DECOMP_RB_RainCloud_FadeAway(struct Thread* t);
|
||||
void DECOMP_RB_RainCloud_ThTick(struct Thread* t);
|
||||
void DECOMP_RB_RainCloud_Init(struct Driver* d);
|
||||
|
||||
void DECOMP_RB_Baron_LInB(struct Instance* inst);
|
||||
|
||||
void DECOMP_RB_Blade_ThTick(struct Thread* t);
|
||||
|
@ -1175,6 +1175,10 @@ void CS_BoxScene_InstanceSplitLines();
|
||||
|
||||
void RB_Player_ToggleInvisible();
|
||||
void RB_Player_ToggleFlicker();
|
||||
|
||||
void RB_RainCloud_FadeAway(struct Thread *t);
|
||||
void RB_RainCloud_ThTick(struct Thread* t);
|
||||
|
||||
void RB_Burst_ProcessBucket(struct Thread* thread);
|
||||
void RB_Blowup_ProcessBucket(struct Thread* thread);
|
||||
void RB_Spider_DrawWebs(struct Thread* thread, struct PushBuffer* pb);
|
||||
|
@ -125,10 +125,34 @@ struct TrackerWeapon
|
||||
// 0x58 bytes large
|
||||
};
|
||||
|
||||
struct RainLocal
|
||||
{
|
||||
// 0x0
|
||||
struct RainLocal* next;
|
||||
struct RainLocal* prev;
|
||||
|
||||
// 0x8
|
||||
int frameCount;
|
||||
|
||||
// 0xC
|
||||
short unk1[4];
|
||||
|
||||
// 0x14
|
||||
short vel[4];
|
||||
|
||||
// 0x1c
|
||||
short pos[4];
|
||||
|
||||
// 0x24
|
||||
struct instance* cloudInst;
|
||||
|
||||
// 0x28 -- size
|
||||
};
|
||||
|
||||
struct RainCloud
|
||||
{
|
||||
// 0x0
|
||||
void* rainBuffer;
|
||||
struct RainLocal* rainLocal;
|
||||
|
||||
// 0x4
|
||||
short timeMS;
|
||||
@ -136,6 +160,8 @@ struct RainCloud
|
||||
// 0x6
|
||||
// I guess this is used for randomizing the items?
|
||||
short boolScrollItem;
|
||||
|
||||
// size - 0x8
|
||||
};
|
||||
|
||||
// when the shield is worn
|
||||
|
Loading…
x
Reference in New Issue
Block a user