SceneNum -> SceneId (#1036)

* sceneNum -> sceneId

* horse data scene -> sceneId

* Clean up scene table

* format

* PR comments

* Some more

* It helps if you actually save the file

* PR

* Remove comment

* Format

* Conflicts
This commit is contained in:
Derek Hensley
2022-09-29 19:22:59 -07:00
committed by GitHub
parent 08be0b3bd4
commit 3a723efb15
90 changed files with 975 additions and 964 deletions
+27 -27
View File
@@ -365,7 +365,7 @@ s16 gItemPrices[] = {
};
// Used to map scene indexes to their region in Termina
u16 gScenesPerRegion[11][27] = {
u16 gSceneIdsPerRegion[11][27] = {
// Great Bay
{
SCENE_30GYOSON,
@@ -522,7 +522,7 @@ void Inventory_ChangeUpgrade(s16 upgrade, u32 value) {
gSaveContext.save.inventory.upgrades = upgrades;
}
s32 Inventory_IsMapVisible(s16 sceneNum) {
s32 Inventory_IsMapVisible(s16 sceneId) {
s16 index = 0;
/**
@@ -530,30 +530,30 @@ s32 Inventory_IsMapVisible(s16 sceneNum) {
* increment to the next index of scenesVisible so that every scene gets a unique flag in scenesVisible,
* 224 bits were allocated to this although there are only 112 scenes
*/
if (sceneNum >= 0x20) {
if (sceneNum < 0x40) {
if (sceneId >= 0x20) {
if (sceneId < 0x40) {
index = 1;
} else if (sceneNum < 0x60) {
} else if (sceneId < 0x60) {
index = 2;
} else if (sceneNum < 0x80) {
} else if (sceneId < 0x80) {
index = 3;
} else if (sceneNum < 0xA0) {
} else if (sceneId < 0xA0) {
index = 4;
} else if (sceneNum < 0xC0) {
} else if (sceneId < 0xC0) {
index = 5;
} else if (sceneNum < 0xE0) {
} else if (sceneId < 0xE0) {
index = 6;
}
}
if (gSaveContext.save.scenesVisible[index] & gBitFlags[sceneNum - (index << 5)]) {
if (gSaveContext.save.scenesVisible[index] & gBitFlags[sceneId - (index << 5)]) {
return true;
}
return false;
}
static u16 sScenesPerTingleMap[6][12] = {
static u16 sSceneIdsPerTingleMap[6][12] = {
{
// Clock Town Tingle Map
SCENE_00KEIKOKU,
@@ -630,11 +630,11 @@ static u16 sScenesPerTingleMap[6][12] = {
void Inventory_SetMapVisibility(s16 tingleIndex) {
s16 i = 0;
s16 index = 0;
u16(*tingleMapSceneIndices)[] = &sScenesPerTingleMap[tingleIndex];
u16(*tingleMapSceneIds)[] = &sSceneIdsPerTingleMap[tingleIndex];
if ((tingleIndex >= 0) && (tingleIndex < 6)) {
while (true) {
if ((*tingleMapSceneIndices)[i] == 0xFFFF) {
if ((*tingleMapSceneIds)[i] == 0xFFFF) {
break;
}
@@ -643,38 +643,38 @@ void Inventory_SetMapVisibility(s16 tingleIndex) {
* increment to the next index of scenesVisible so that every scene gets a unique flag in scenesVisible,
* 224 bits were allocated to this although there are only 112 scenes
*/
if (((s16)(*tingleMapSceneIndices)[i]) < 0x20) {
if (((s16)(*tingleMapSceneIds)[i]) < 0x20) {
index = 0;
} else if (((s16)(*tingleMapSceneIndices)[i]) < 0x40) {
} else if (((s16)(*tingleMapSceneIds)[i]) < 0x40) {
index = 1;
} else if (((s16)(*tingleMapSceneIndices)[i]) < 0x60) {
} else if (((s16)(*tingleMapSceneIds)[i]) < 0x60) {
index = 2;
} else if (((s16)(*tingleMapSceneIndices)[i]) < 0x80) {
} else if (((s16)(*tingleMapSceneIds)[i]) < 0x80) {
index = 3;
} else if (((s16)(*tingleMapSceneIndices)[i]) < 0xA0) {
} else if (((s16)(*tingleMapSceneIds)[i]) < 0xA0) {
index = 4;
} else if (((s16)(*tingleMapSceneIndices)[i]) < 0xC0) {
} else if (((s16)(*tingleMapSceneIds)[i]) < 0xC0) {
index = 5;
} else if (((s16)(*tingleMapSceneIndices)[i]) < 0xE0) {
} else if (((s16)(*tingleMapSceneIds)[i]) < 0xE0) {
index = 6;
}
gSaveContext.save.scenesVisible[index] =
gSaveContext.save.scenesVisible[index] | gBitFlags[(s16)(*tingleMapSceneIndices)[i] - (index << 5)];
gSaveContext.save.scenesVisible[index] | gBitFlags[(s16)(*tingleMapSceneIds)[i] - (index << 5)];
i++;
}
if ((*tingleMapSceneIndices) == sScenesPerTingleMap[0]) {
if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[0]) {
gSaveContext.save.mapsVisible |= 3;
} else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[1]) {
} else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[1]) {
gSaveContext.save.mapsVisible |= 0x1C;
} else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[2]) {
} else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[2]) {
gSaveContext.save.mapsVisible |= 0xE0;
} else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[3]) {
} else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[3]) {
gSaveContext.save.mapsVisible |= 0x100;
} else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[4]) {
} else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[4]) {
gSaveContext.save.mapsVisible |= 0x1E00;
} else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[5]) {
} else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[5]) {
gSaveContext.save.mapsVisible |= 0x6000;
}
}