This commit is contained in:
Niko 2024-03-03 09:52:51 -05:00
parent 659e0b0dd1
commit 829f88c922
26 changed files with 95 additions and 97 deletions

View File

@ -0,0 +1,50 @@
#include <common.h>
void DECOMP_DropRain_MakeSound(struct GameTracker *gGT)
{
int i, lev;
unsigned int rained;
rained = 0;
lev = gGT->levelID;
// if you are not in
if (
(lev != TIGER_TEMPLE) &&
(lev != CORTEX_CASTLE)
)
{
return;
}
for (i = 0; i < gGT->numPlyrCurrGame; i++)
{
rained |= gGT->rainBuffer[i].numParticles_curr;
}
// if someone is rained on
if (rained != 0)
{
// if there is no rain
if (gGT->rainSoundID == 0)
gGT->rainSoundID = OtherFX_Play(0x82, 0);
}
// if nobody is rained on
else
{
if (gGT->rainSoundID != 0)
{
OtherFX_Stop1(gGT->rainSoundID);
gGT->rainSoundID = 0;
}
}
return;
}
void DECOMP_DropRain_Reset(struct GameTracker *gGT)
{
gGT->rainSoundID = 0;
return;
}

View File

@ -191,9 +191,9 @@ void DECOMP_MainFrame_RenderFrame(struct GameTracker* gGT, struct GamepadSystem*
#ifndef REBUILD_PS1
RainLogic(gGT);
EffectSfxRain_MakeSound(gGT);
#endif
DECOMP_DropRain_MakeSound(gGT);
MenuHighlight();
#ifdef REBUILD_PS1

View File

@ -71,10 +71,7 @@ u_int DECOMP_main()
DECOMP_TitleFlag_BeginTransition(2);
}
#ifndef REBUILD_PS1
EffectSfxRain_Reset(gGT);
#endif
DECOMP_DropRain_Reset(gGT);
DECOMP_GAMEPROG_GetPtrHighScoreTrack();
DECOMP_MainInit_FinalizeInit(gGT);
DECOMP_GAMEPAD_GetNumConnected(gGS);

View File

@ -1,53 +0,0 @@
// called "EffectSfx" for no good reason,
// but is related to rain sounds, no proof of name
// this func handle rain on tiger temple and cortex castle
void DECOMP_EffectSfxRain_MakeSound(struct GameTracker *gGT) {
int i, lev;
unsigned int rained;
rained = 0;
lev = gGT->levelID;
// if you are not in
if (
// Tiger Temple
(lev != 4)
// Cortex Castle
&& (lev != 10)) {
return;
}
// if numPlyrCurrGame is not zero
if (gGT->numPlyrCurrGame) {
for (i = 0; i < gGT->numPlyrCurrGame; i++) {
rained |= gGT->rainBuffer[i];
}
} else {
return;
}
// if at least one is rained on
if (rained) {
// if there is no rain
if (gGT->rainVariable == 0) {
// now there is rain
gGT->rainVariable = OtherFX_Play(0x82, 0);
}
}
// if nobody is rained on
else {
// if it's raining
if (gGT->rainVariable != 0) {
OtherFX_Stop1();
// no more rain
gGT->rainVariable = 0;
}
}
return;
}
void EffectSfxRain_Reset(struct gameTracker *gGT) {
gGT->rainVariable = 0;
return;
}

View File

@ -1,4 +1,4 @@
// 455+43+33+27+38+14+18+16+19+12+6+1+8+9+1+1+2+2+3+3+2+4+2+3+16+3+47-12 = 776 rewritten so far
// 455+43+33+27+38+14+18+16+19+12+6+1+8+9+1+1+1+2+2+3+3+2+4+2+3+16+3+47-12 = 776 rewritten so far
// 455 for every 'common' and ','
// additions for every file that has multiple functions,
// 43 for HOWL block
@ -15,6 +15,7 @@
// +8 for UI Block #3
// +9 for GAMEPAD Block #1
// +1 for DebugFont
// +1 for DropRain
// +1 for 222
// +2 for 223
// +2 for 224
@ -234,6 +235,9 @@ common, exe, DISPLAY_Swap, 0x0, General/Display/DISPLAY_Swap.c
// DotLights (done)
common, exe, DotLights_Video, 0x0, General/DotLights/DotLights.c
// DropRain (done)
common, exe, DropRain_MakeSound, 0x0, General/DropRain/DropRain.c
// ElimBG
common, exe, ElimBG_SaveScreenshot_Chunk, 0x0, General/ElimBG/ElimBG_AAA_BigBlock1.c
@ -678,8 +682,8 @@ common, exe, Tawna_Init, 0x0, General/Tawna_Init.c
// rewritten psyq lib entry, not written by ND, needed for debugging
926, exe, start, 0x0, General/psyq_start.c
// Benchmarking, requires removing: MainFrame_RenderFrame, DotLights, EffectSfxRain_MakeSound,
// Benchmarking, requires removing: MainFrame_RenderFrame, DotLights, DropRain_MakeSound,
// and requires adding DF_Main to RDATA with the rest of decomp RDATA
//926, exe, 0x800379b0, 0x0, ../mods/Tests/TenSecondBenchmark/src/DF_JalDrawOTag.s
//926, exe, EffectSfxRain_Reset, -0x8, ../mods/Tests/TenSecondBenchmark/src/DF_JmpPrintText.s
//926, exe, DropRain_Reset, -0x8, ../mods/Tests/TenSecondBenchmark/src/DF_JmpPrintText.s
// add to RDATA: ../mods/Tests/TenSecondBenchmark/src/DF_main.c

View File

@ -1,7 +1,7 @@
// called "EffectSfx" for no good reason,
// but is related to rain sounds, no proof of name
// EffectSfxRain_MakeSound
// DropRain_MakeSound
// handle rain on tiger temple and cortex castle
void FUN_80024464(int param_1)
@ -78,7 +78,7 @@ void FUN_80024464(int param_1)
// param1 is PTR_DAT_8008d2ac
// EffectSfxRain_Reset
// DropRain_Reset
void FUN_8002451c(int param_1)
{

View File

@ -2034,7 +2034,7 @@ void FUN_80035e70(uint *param_1)
}
// param1 is PTR_DAT_8008d2ac
// EffectSfxRain_MakeSound
// DropRain_MakeSound
FUN_80024464(param_1);
// frame timer for MenuBox row highlight
@ -8976,7 +8976,7 @@ LAB_8003ca68:
}
}
// EffectSfxRain_Reset
// DropRain_Reset
FUN_8002451c(PTR_DAT_8008d2ac);
// GAMEPROG_GetPtrHighScoreTrack

View File

@ -176,7 +176,7 @@ struct DRAWENV {
// DECALMP.c: 80023488 - 80023a3f
// DISPLAY.c: 800a3a40 - 8002406b
// DOTLIGHTS.c: 8002406c - 80024463
// EffectSfxRain.c: 80024464 - 80024523
// DropRain.c: 80024464 - 80024523
// ElimBG.c: 80024524 - 80024c4b
// FLARE.c: 80024c4c - 800251ab
// GAMEPAD.c: 800251ac - 800265bf

View File

@ -160,10 +160,10 @@ void DISPLAY_Blur_Main(struct TileView* tileView, int strength);
//DotLights_Video()
void DotLights_AudioAndVideo(struct GameTracker* gGT);
// EffectSfxRain
// DropRain
void EffectSfxRain_MakeSound(struct GameTracker* gGT);
void EffectSfxRain_Reset(struct GameTracker* gGT);
void DropRain_MakeSound(struct GameTracker* gGT);
void DropRain_Reset(struct GameTracker* gGT);
// ElimBG

View File

@ -627,7 +627,7 @@ struct GameTracker
// watch it change when you go into a room, it
// change to zero when rain stops, and gets a
// new value when no roof is over your head (rain)
int rainVariable;
int rainSoundID;
// 1ecc
// RedOff, RedOn, GreenOff, GreenOn

View File

@ -215,7 +215,7 @@ u_int main()
TitleFlag_BeginTransition(2);
}
EffectSfxRain_Reset(gGT);
DropRain_Reset(gGT);
GAMEPROG_GetPtrHighScoreTrack();
MainInit_FinalizeInit(gGT);

View File

@ -6,7 +6,7 @@
common, exe, MainFrame_RequestMaskHint,0x0, src/cancelMask.s
common, exe, BOTS_SetRotation, -0x8, src/hookUpdate.s
common, exe, MainInit_StringToLevID, -0x8, src/hookInit.s
common, exe, EffectSfxRain_Reset, -0x8, src/hookDrawIGT.s
common, exe, DropRain_Reset, -0x8, src/hookDrawIGT.s
common, exe, INSTANCE_Birth2D, -0x8, src/hookInstanceBirth.s
common, exe, MainInit_FinalizeInit, -0x8, src/hookBeforeTeleport.s
common, exe, VehInit_TeleportAll, -0x8, src/hookAfterTeleport.s

View File

@ -8,7 +8,7 @@
1006, exe, 0x80038fe8, 0x0, src/DF_JalDrawOTag.s
1020, exe, 0x80037e00, 0x0, src/DF_JalDrawOTag.s
1111, exe, 0x80039674, 0x0, src/DF_JalDrawOTag.s
common, exe, EffectSfxRain_Reset, -0x8, src/DF_JmpPrintText.s
common, exe, DropRain_Reset, -0x8, src/DF_JmpPrintText.s
// Compile main code to empty spaces in RDATA
common, exe, rdata_free, 0x0, src/DF_main.c

View File

@ -8,7 +8,7 @@
1006, exe, 0x80038fe8, 0x0, src/DF_JalDrawOTag.s
1020, exe, 0x80037e00, 0x0, src/DF_JalDrawOTag.s
1111, exe, 0x80039674, 0x0, src/DF_JalDrawOTag.s
common, exe, EffectSfxRain_Reset, -0x8, src/DF_JmpPrintText.s
common, exe, DropRain_Reset, -0x8, src/DF_JmpPrintText.s
// Compile main code to empty spaces in RDATA
common, exe, rdata_free, 0x0, src/DF_main.c

View File

@ -8,5 +8,5 @@ common, exe, rdata_free, 0x0, src/hello.c
// Compile the ASM injection that will load our code
// ASM injections for loading modded functions are typically done at the "jr ra" or "return" instruction of a function, which is 8 bytes away from the start of the function that follows it
// Hooked at the end of EffectSfxRain_MakeSound, which will make the code run every frame at all times including the loading screen!
common, exe, EffectSfxRain_Reset, -0x8, src/hookMidFrame.s
// Hooked at the end of DropRain_MakeSound, which will make the code run every frame at all times including the loading screen!
common, exe, DropRain_Reset, -0x8, src/hookMidFrame.s

View File

@ -35,7 +35,7 @@ common, exe, MainInit_StringToLevID, -0x8, ../../Modules/CustomCups/src/hookInit
1006, exe, 0x80038fe8, 0x0, ../../Tests/DebugFrustum/src/DF_JalDrawOTag.s
1020, exe, 0x80037e00, 0x0, ../../Tests/DebugFrustum/src/DF_JalDrawOTag.s
1111, exe, 0x80039674, 0x0, ../../Tests/DebugFrustum/src/DF_JalDrawOTag.s
common, exe, EffectSfxRain_Reset, -0x8, ../../Tests/DebugFrustum/src/DF_JmpPrintText.s
common, exe, DropRain_Reset, -0x8, ../../Tests/DebugFrustum/src/DF_JmpPrintText.s
// GraphicsUpgrade //
// CharacterRandomizer already includes OverrideMPK

View File

@ -117,8 +117,8 @@ DecalMP_02 = 0x80024d1c;
DecalMP_03 = 0x80024e60;
DotLights_Video = 0x80025748;
DotLights_AudioAndVideo = 0x80025994;
EffectSfxRain_MakeSound = 0x80025b40;
EffectSfxRain_Reset = 0x80025bf8;
DropRain_MakeSound = 0x80025b40;
DropRain_Reset = 0x80025bf8;
ElimBG_SaveScreenshot_Chunk = 0x80025c00;
ElimBG_SaveScreenshot_Full = 0x80025c78;
ElimBG_Activate = 0x80025ef8;

View File

@ -108,8 +108,8 @@ DISPLAY_Blur_Main = 0x80023d4c;
DISPLAY_Swap = 0x80023ffc;
DotLights_Video = 0x8002423c;
DotLights_AudioAndVideo = 0x80024488;
EffectSfxRain_MakeSound = 0x80024634;
EffectSfxRain_Reset = 0x800246ec;
DropRain_MakeSound = 0x80024634;
DropRain_Reset = 0x800246ec;
ElimBG_SaveScreenshot_Chunk = 0x800246f4;
ElimBG_SaveScreenshot_Full = 0x8002476c;
ElimBG_Activate = 0x800249ec;

View File

@ -119,8 +119,8 @@ DecalMP_02 = 0x80024fc8;
DecalMP_03 = 0x8002510c;
DotLights_Video = 0x80025984;
DotLights_AudioAndVideo = 0x80025bd0;
EffectSfxRain_MakeSound = 0x80025d7c;
EffectSfxRain_Reset = 0x80025e34;
DropRain_MakeSound = 0x80025d7c;
DropRain_Reset = 0x80025e34;
ElimBG_SaveScreenshot_Chunk = 0x80025e3c;
ElimBG_SaveScreenshot_Full = 0x80025eb4;
ElimBG_Activate = 0x80026134;

View File

@ -107,8 +107,8 @@ DecalMP_03 = 0x80023d74;
DISPLAY_Swap = 0x80023ffc;
DotLights_Video = 0x8002465c;
DotLights_AudioAndVideo = 0x80024894;
EffectSfxRain_MakeSound = 0x80024a40;
EffectSfxRain_Reset = 0x80024af8;
DropRain_MakeSound = 0x80024a40;
DropRain_Reset = 0x80024af8;
ElimBG_SaveScreenshot_Chunk = 0x80024b00;
ElimBG_SaveScreenshot_Full = 0x80024b78;
ElimBG_Activate = 0x80024df8;

View File

@ -115,8 +115,8 @@ DISPLAY_Blur_Main = 0x80023d4c;
DISPLAY_Swap = 0x80023ffc;
DotLights_Video = 0x8002406c;
DotLights_AudioAndVideo = 0x800242b8;
EffectSfxRain_MakeSound = 0x80024464;
EffectSfxRain_Reset = 0x8002451c;
DropRain_MakeSound = 0x80024464;
DropRain_Reset = 0x8002451c;
ElimBG_SaveScreenshot_Chunk = 0x80024524;
ElimBG_SaveScreenshot_Full = 0x8002459c;
ElimBG_Activate = 0x8002481c;

View File

@ -168,8 +168,8 @@
80025748 DotLights_Video
80025994 DotLights_AudioAndVideo
80025b40 EffectSfxRain_MakeSound
80025bf8 EffectSfxRain_Reset
80025b40 DropRain_MakeSound
80025bf8 DropRain_Reset
80025c00 ElimBG_SaveScreenshot_Chunk
80025c78 ElimBG_SaveScreenshot_Full

View File

@ -156,8 +156,8 @@
8002423c DotLights_Video
80024488 DotLights_AudioAndVideo
80024634 EffectSfxRain_MakeSound
800246ec EffectSfxRain_Reset
80024634 DropRain_MakeSound
800246ec DropRain_Reset
800246f4 ElimBG_SaveScreenshot_Chunk
8002476c ElimBG_SaveScreenshot_Full

View File

@ -169,8 +169,8 @@
80025984 DotLights_Video
80025bd0 DotLights_AudioAndVideo
80025d7c EffectSfxRain_MakeSound
80025e34 EffectSfxRain_Reset
80025d7c DropRain_MakeSound
80025e34 DropRain_Reset
80025e3c ElimBG_SaveScreenshot_Chunk
80025eb4 ElimBG_SaveScreenshot_Full

View File

@ -157,8 +157,8 @@
8002465c DotLights_Video
80024894 DotLights_AudioAndVideo
80024a40 EffectSfxRain_MakeSound
80024af8 EffectSfxRain_Reset
80024a40 DropRain_MakeSound
80024af8 DropRain_Reset
80024b00 ElimBG_SaveScreenshot_Chunk
80024b78 ElimBG_SaveScreenshot_Full

View File

@ -145,8 +145,8 @@
8002406c DotLights_Video
800242b8 DotLights_AudioAndVideo
80024464 EffectSfxRain_MakeSound
8002451c EffectSfxRain_Reset
80024464 DropRain_MakeSound
8002451c DropRain_Reset
80024524 ElimBG_SaveScreenshot_Chunk
8002459c ElimBG_SaveScreenshot_Full