-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SceneDB [WIP Do not merge] #4460
base: develop
Are you sure you want to change the base?
Conversation
04df12b
to
ad535b1
Compare
@@ -1675,7 +1675,8 @@ typedef struct PreNMIContext { | |||
} PreNMIContext; // size = 0xAC | |||
|
|||
typedef enum { | |||
/* 1 */ F_8F = 1, | |||
/* 0 */ F_NA, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have deviated from decomp documentation to add a value to this enum. All dungeons have 8 floors and 0 is used to represent invalid/unused floors. Having an actual enum value saves a lot of static_casts for the scene table.
@@ -48,8 +48,8 @@ typedef struct { | |||
/* 0x28 */ u16 equipment; // a mask where each nibble corresponds to a type of equipment `EquipmentType`, and each bit to an owned piece `EquipInv*` | |||
/* 0x2C */ u32 upgrades; | |||
/* 0x30 */ u32 questItems; | |||
/* 0x34 */ u8 dungeonItems[20]; | |||
/* 0x48 */ s8 dungeonKeys[19]; | |||
/* 0x34 */ u8* dungeonItems; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are now dynamically sized to support any number of scenes. Fun side effect: all scenes can now have small keys, etc. This was easier and less invasive than restricting it to dungeons and making a mapping from scene id to dungeonItems index.
@@ -1882,9 +1884,16 @@ namespace Rando { | |||
|
|||
void Logic::NewSaveContext() { | |||
if (mSaveContext != nullptr && mSaveContext != &gSaveContext) { | |||
free(mSaveContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed free to delete as you should always match malloc/free, new/delete
@@ -84,15 +83,15 @@ static void Entrance_SeparateOGCFairyFountainExit(void) { | |||
//Overwrite unused entrance 0x03E8 (ENTR_POTION_SHOP_KAKARIKO_1) with values from 0x0340 (ENTR_CASTLE_GROUNDS_GREAT_FAIRY_EXIT) to use it as the | |||
//exit from OGC Great Fairy Fountain -> Castle Grounds | |||
for (size_t i = 0; i < 4; ++i) { | |||
gEntranceTable[ENTR_POTION_SHOP_KAKARIKO_1 + i] = gEntranceTable[ENTR_CASTLE_GROUNDS_GREAT_FAIRY_EXIT + i]; | |||
EntranceDB_Copy(ENTR_CASTLE_GROUNDS_GREAT_FAIRY_EXIT + i, ENTR_POTION_SHOP_KAKARIKO_1 + i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the order is reversed compared to assignment. This is to better match the verbiage of "copy from X to Y".
u8 startTransition; | ||
} EntranceDBEntry; | ||
|
||
#define SCENEDB_ISBOSS(entry) ((entry)->bossData.mapScene != -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have elected to infer traits about scenes based on the data instead of having a "type" field. I wanted to avoid data invariants. Instead, if a scene has data for a thing, it is that thing.
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->actor.world.pos, | ||
&this->actor.projectedPos, &this->actor.projectedW); | ||
} | ||
SceneDBEntry* entry = SceneDB_Retrieve(play->sceneNum); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a giant array of valid epona spawn locations, they are stored per-scene.
@@ -86,9 +88,6 @@ void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx) { | |||
pauseCtx->cursorX[PAUSE_MAP] = 0; | |||
pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->dungeonMapSlot; | |||
osSyncPrintf("kscope->cursor_point=%d\n", pauseCtx->cursorPoint[PAUSE_MAP]); | |||
R_MAP_TEX_INDEX = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no longer an array of dungeon map textures. Each scene store it's own. R_MAP_TEX_INDEX is used to present what room link is in in some of the UI code, so it's removal has repercussions. Luckily, there are other things we can use.
@@ -56,122 +64,98 @@ void PauseMapMark_DrawForDungeon(PlayState* play) { | |||
PauseMapMarkInfo* markInfo; | |||
f32 scale; | |||
s32 i = 0; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is largely reworked for the same reasons as the minimap map mark function.
@@ -1421,11 +1421,11 @@ void func_80A053F0(Actor* thisx, PlayState* play) { | |||
} else { | |||
this->actionFunc(this, play); | |||
thisx->shape.rot.y = this->unk_2BC; | |||
nREG(80) = gSaveContext.sceneFlags[127].chest; | |||
nREG(80) = HIGH_SCORE(HS_HBA); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an OOB that we now have to fix. This is an odd way to access a highscore, and decomp went with this because of the debug comment. Decomp has a comment explaining it now, but for SceneDB, we have to fix this.
break; | ||
SceneDBEntry* entry = SceneDB_Retrieve(mapIndex); | ||
|
||
if (SCENEDB_ISOVERWORLD(entry)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This handles special cases for overworld minimaps (filling the lake, discovering ST entrance, etc.). I have reworked it a bit to handle the logic and have hard-coded the special values that were originally in a tables past the normal ends. I have elected not to have this data in the SceneDB because I felt like these were too much of a niche case. For mods, I think this will be best handled with a hook.
ad535b1
to
2c63ae3
Compare
This is a WIP PR for SceneDB -- dynamic scene IDs that will pave the way for custom scenes.
Currently, I need to clean up the code and remove TODOs, as well as test it by doing a full playthrough with normal and MQ dungeons, as well as some random settings.
Build Artifacts