1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 14:34:32 +00:00

Split SaveContext into sub-structs (#1393)

* Split SaveContext struct

* run formatter

* Remove temporary-until-split stuff in z_sram

* .

* run formatter
This commit is contained in:
Dragorn421 2023-08-13 21:24:26 +02:00 committed by GitHub
parent e272186b5f
commit 6e7a6d4181
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
107 changed files with 1819 additions and 1751 deletions

View file

@ -619,7 +619,7 @@ Mips2c is bad at arrays. We see this in the `(*(&gSaveContext + 0xEDA) & 0x400)
3. The entry in `SaveContext` that contains `0xEDA` is `/* 0x0ED4 */ u16 eventChkInf[14];`
4. Since `0xEDA - 0xED4 = 0x6`, and `u16`s take up 2 bytes each, we conclude that it is `eventChkInf[3]` that is being referenced.
Therefore, the condition should be `(gSaveContext.eventChkInf[3] & 0x400) != 0`. This is a flag comparison, so we can also leave off the `!= 0`.
Therefore, the condition should be `(gSaveContext.save.info.eventChkInf[3] & 0x400) != 0`. This is a flag comparison, so we can also leave off the `!= 0`.
With all of this implemented, the function should now compile without errors. The parts of the file that we have changed now look like
@ -724,7 +724,7 @@ void EnJj_Init(Actor *thisx, PlayState *play) {
this->unk_30F = 0;
this->unk_310 = 0;
this->unk_311 = 0;
if ((gSaveContext.eventChkInf[3] & 0x400) != 0) {
if ((gSaveContext.save.info.eventChkInf[3] & 0x400) != 0) {
func_80A87800(this, func_80A87BEC);
} else {
func_80A87800(this, func_80A87C30);
@ -848,7 +848,7 @@ void EnJj_Init(Actor* thisx, PlayState* play) {
this->unk_30F = 0;
this->unk_310 = 0;
this->unk_311 = 0;
if ((gSaveContext.eventChkInf[3] & 0x400) != 0) {
if ((gSaveContext.save.info.eventChkInf[3] & 0x400) != 0) {
func_80A87800(this, func_80A87BEC);
} else {
func_80A87800(this, func_80A87C30);

View file

@ -399,7 +399,7 @@ Easy things to sort out:
func_8005B1A4(GET_ACTIVE_CAM(play));
```
- `gSaveContext.unkEDA` we have dealt with before: it is `gSaveContext.eventChkInf[3]`. This is a flag-setting function; it can be written more compactly as
- `gSaveContext.unkEDA` we have dealt with before: it is `gSaveContext.save.info.eventChkInf[3]`. This is a flag-setting function; it can be written more compactly as
```C
gSaveContext.unkEDA |= 0x400
```
@ -419,7 +419,7 @@ void func_80A87CEC(EnJj *this, PlayState *play) {
gSaveContext.cutsceneTrigger = 1;
func_8003EBF8(play, &play->colCtx.dyna, child->bgId);
func_8005B1A4(GET_ACTIVE_CAM(play));
gSaveContext.eventChkInf[3] |= 0x400;
gSaveContext.save.info.eventChkInf[3] |= 0x400;
func_80078884(NA_SE_SY_CORRECT_CHIME);
}
```
@ -438,7 +438,7 @@ void func_80A87CEC(EnJj* this, PlayState* play) {
gSaveContext.cutsceneTrigger = 1;
func_8003EBF8(play, &play->colCtx.dyna, child->bgId);
func_8005B1A4(GET_ACTIVE_CAM(play));
gSaveContext.eventChkInf[3] |= 0x400;
gSaveContext.save.info.eventChkInf[3] |= 0x400;
func_80078884(NA_SE_SY_CORRECT_CHIME);
}
}