Weather manager - #484
Conversation
I need the renamed weather_manager.h to be part of the filesystem for replace.sh
I wonder if people realize I commit every 5 functions to record my progress and have to keep finding new relevant commit messages to make it seem like there's more purpose to my commits
I wonder if the frequency and in-progress-ness of these commits screw with LLMs enough to ward them off from the project.
|
|
||
| FogData *Fog_New(); | ||
| void ov01_021EA840(s32 *arg0); | ||
| BOOL Fog_CheckActive(FogData *arg0); |
There was a problem hiding this comment.
FogData could have a better name than arg0
| typedef struct WeatherDraw { | ||
| GF_2DGfxResMan *resMan[4]; | ||
| GF_2DGfxResHeader *header; | ||
| NNSG2dRendererInstance instance; |
There was a problem hiding this comment.
renderInstance and renderSurface may be better names than just instance and surface
| Field3dObjectTaskManager *field3dObjectTaskManager; | ||
| FieldDrawMapNameInfo *drawMapNameInfo; | ||
| void *unk_0C; // weather related? | ||
| WeatherManager *weatherManager; // weather related? |
| #define POKEHEARTGOLD_OVERLAY_01_02203E40_H | ||
|
|
||
| void *ov01_02203EA0(); | ||
| void ov01_02203F2C(void *, float a0); |
There was a problem hiding this comment.
Surprisingly yes, the function itself calls float related instructions I've never seen before
| return dst; | ||
| } | ||
|
|
||
| void ov01_021EA840(s32 *arg0) { |
There was a problem hiding this comment.
Most certainly Fog_Free(FogData *fog), I confirmed this in #491
| } | ||
|
|
||
| static u16 ov01_021EB804(WeatherSystem *weatherSystem, int weather) { | ||
| if (weather >= 14) { |
| } | ||
|
|
||
| if (v0->unk2 != 0xFFFF) { | ||
| GfGfx_EngineATogglePlanes(4, 0); |
| WeatherSystem_Sub0 *v0 = &weatherSystem->unk0[weather]; | ||
|
|
||
| if (v0->unk2 != 0xFFFF) { | ||
| GfGfx_EngineATogglePlanes(4, 0); |
There was a problem hiding this comment.
this should be GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG2, GF_PLANE_TOGGLE_OFF);
|
|
||
| Sprite *temp = a0->unk4; | ||
| memset(a0, 0, sizeof(WeatherObject)); | ||
| a0->unk4 = temp; |
| LocalFieldData *localFieldData = Save_LocalFieldData_Get(ctx->fieldSystem->saveData); | ||
| LocalFieldData_SetWeatherType(localFieldData, 12); | ||
| FieldWeatherUpdate_UsedFlash(ctx->fieldSystem->unk4->unk_0C, LocalFieldData_GetWeatherType(localFieldData)); // CallFieldTask_Flash? | ||
| WeatherManager_ChangeWeather(ctx->fieldSystem->unk4->weatherManager, LocalFieldData_GetWeatherType(localFieldData)); // CallFieldTask_Flash? |
| typedef struct WeatherObject WeatherObject; | ||
| struct WeatherObject { | ||
| WeatherSystem *weatherSystem; | ||
| Sprite *unk4; |
There was a problem hiding this comment.
Could just be named sprite?
| struct WeatherSystem_Sub0_Sub8 { | ||
| WeatherSystem *weatherSystem; | ||
| WeatherSystem_Sub0 *unk4; | ||
| WeatherSpriteResources *unk8; |
There was a problem hiding this comment.
weatherSpriteResources
|
|
||
| struct WeatherSystem { | ||
| WeatherSystem_Sub0 *unk0; | ||
| const WeatherGfxNarcData *unk4; |
| u32 weather; | ||
| u32 nextWeather; | ||
| u32 state; | ||
| u32 unk10; |
There was a problem hiding this comment.
unkWeather? We know it is definitely weather, just not what purpose it serves.
| weatherSystem->unk0 = ov01_022098B0; | ||
| weatherSystem->unk4 = ov01_0220675C; | ||
|
|
||
| weatherSystem->narc = NARC_New(NARC_a_0_6_3, HEAP_ID_FIELD1); |
There was a problem hiding this comment.
Can we confirm the contents of this NARC and rename the constant accordingly?
There was a problem hiding this comment.
Having looked at it in tinke, everything other than the bin files is individual weather particles. there's also an enormous rainbow that i assume is unused.
the bin files could also be weather, i dunno.
| WeatherSystem_Sub0 *unk4; | ||
| WeatherSpriteResources *unk8; | ||
| WeatherObject linkedListDummy; | ||
| WeatherObject linkedList[64]; |
There was a problem hiding this comment.
I suspect the data attached to this linked list is used to cyclically spawn and free individual weather particles (e.g. raindrops)
| static void ov01_021EC028(WeatherSystem_Sub0_Sub8 *a0) { | ||
| for (int i = 0; i < 64; i++) { | ||
| a0->linkedList[i].unk4 = Sprite_CreateAffine(&a0->unk8->spriteTemplate); | ||
| Sprite_SetDrawFlag(a0->linkedList[i].unk4, 0); |
There was a problem hiding this comment.
SetDrawFlag's second param is a BOOL
| static void ov01_021EC300(void *data) { | ||
| } | ||
|
|
||
| static VecFx32 ov01_021EC304(WeatherObject *a0) { |
There was a problem hiding this comment.
WeatherObject_GetSpriteMatrixPtr?
| static void ov01_021EC6A4(WeatherFogChange *fogChange, FogData *fog, s32 arg2, s32 arg3, GXRgb rgb, s32 arg5) { | ||
| int slope = Fog_GetSlope(fog); | ||
| int offset = Fog_GetOffset(fog); | ||
| GXRgb rgb2 = ov01_021EA860(fog); |
There was a problem hiding this comment.
Surely this can just be Fog_GetColor?
-Decompile and partially document weather_manager.c
- @Pixelstyx has offered to document the rest at a future point in time
-Document field/fog.c
PR checklist
make compare_heartgold && make compare_soulsilver).git clang-format).